@marimo-team/frontend 0.14.14-dev13 → 0.14.14-dev15
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-CyitVr8T.js → ConnectedDataExplorerComponent-CXR7RIzk.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-B2k3c3H8.js → ImageComparisonComponent-DEhI7T6f.js} +1 -1
- package/dist/assets/{VegaLite-BK4v5erD.js → VegaLite-3srqDpv6.js} +1 -1
- package/dist/assets/{_baseEach-DbPn336G.js → _baseEach-Cp9OlGfk.js} +1 -1
- package/dist/assets/_baseMap-TU2Gg6mS.js +1 -0
- package/dist/assets/{_baseUniq-9L08hbYj.js → _baseUniq-CbeZoSQD.js} +1 -1
- package/dist/assets/{_createAggregator-J1Oqw6vi.js → _createAggregator-Y0Gl2pnz.js} +1 -1
- package/dist/assets/{any-language-editor-BJAYa776.js → any-language-editor-Bj4HkDhY.js} +1 -1
- package/dist/assets/{architectureDiagram-SUXI7LT5-CvvZu4Wy.js → architectureDiagram-SUXI7LT5-BUppn2q-.js} +1 -1
- package/dist/assets/{blockDiagram-6J76NXCF-BnPWDsHW.js → blockDiagram-6J76NXCF-31P7kfCG.js} +1 -1
- package/dist/assets/{c4Diagram-6F6E4RAY-BOxFu6aD.js → c4Diagram-6F6E4RAY-DEbQV9is.js} +1 -1
- package/dist/assets/channel-PrYxrA2a.js +1 -0
- package/dist/assets/{chunk-353BL4L5-DDj8rGLd.js → chunk-353BL4L5-D5A4bU9X.js} +1 -1
- package/dist/assets/{chunk-67H74DCK-Ck4voLGo.js → chunk-67H74DCK-RNMryaYW.js} +1 -1
- package/dist/assets/{chunk-AACKK3MU-DHbem_by.js → chunk-AACKK3MU-H3VLrwoL.js} +1 -1
- package/dist/assets/{chunk-BFAMUDN2-BBvokD69.js → chunk-BFAMUDN2-DoQKiGNF.js} +1 -1
- package/dist/assets/{chunk-E2GYISFI-DkTn8QVi.js → chunk-E2GYISFI-BTD9ePCn.js} +1 -1
- package/dist/assets/{chunk-OW32GOEJ-Dd25RlMP.js → chunk-OW32GOEJ-C6erKGL_.js} +1 -1
- package/dist/assets/{chunk-SKB7J2MH-QBSjh0ne.js → chunk-SKB7J2MH-CW-wYTRJ.js} +1 -1
- package/dist/assets/{chunk-SZ463SBG-B2AywpF7.js → chunk-SZ463SBG-pvj7Sz7A.js} +1 -1
- package/dist/assets/{circle-play-hYDsz_NF.js → circle-play-B2wvox_u.js} +1 -1
- package/dist/assets/classDiagram-M3E45YP4-DiALPfyX.js +1 -0
- package/dist/assets/classDiagram-v2-YAWTLIQI-DiALPfyX.js +1 -0
- package/dist/assets/clone-Br-A6gbs.js +1 -0
- package/dist/assets/{compile-DGhRKaoO.js → compile-B4zBiHTW.js} +1 -1
- package/dist/assets/{dagre-JOIXM2OF-DioJvqTI.js → dagre-JOIXM2OF-CRwKTlbE.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-J6tqMWD9.js → data-grid-overlay-editor-C8bIQJLW.js} +1 -1
- package/dist/assets/{diagram-5UYTHUR4-BgY59k18.js → diagram-5UYTHUR4-DuEQ9bam.js} +1 -1
- package/dist/assets/{diagram-VMROVX33-DXmB3hdp.js → diagram-VMROVX33-CJ186_9-.js} +1 -1
- package/dist/assets/{diagram-ZTM2IBQH-DbGtdPMa.js → diagram-ZTM2IBQH-BIu1BKlZ.js} +1 -1
- package/dist/assets/{edit-page-6BW3rZHi.js → edit-page-CjkvDrI3.js} +4 -4
- package/dist/assets/{erDiagram-3M52JZNH-DbtSga_B.js → erDiagram-3M52JZNH-DgW0rK-s.js} +1 -1
- package/dist/assets/{flowDiagram-KYDEHFYC-D4HEKkI3.js → flowDiagram-KYDEHFYC-CPqDaClR.js} +1 -1
- package/dist/assets/{ganttDiagram-EK5VF46D-BT3G1Q-B.js → ganttDiagram-EK5VF46D-BhHRkQah.js} +1 -1
- package/dist/assets/{gitGraphDiagram-GW3U2K7C-D0Hj59-v.js → gitGraphDiagram-GW3U2K7C-uAm0wdvg.js} +1 -1
- package/dist/assets/{glide-data-editor-Dco2ua9i.js → glide-data-editor-BMzu3eOm.js} +4 -4
- package/dist/assets/{graph-Rji_eDme.js → graph-U15oOIY2.js} +1 -1
- package/dist/assets/{home-page-CexUvIwl.js → home-page-Dzzj-4xQ.js} +1 -1
- package/dist/assets/{index-DJSVEkOt.js → index-2gnpOR7Q.js} +1 -1
- package/dist/assets/{index-ChnzUp3N.js → index-B2wgHzow.js} +1 -1
- package/dist/assets/{index-CNO-ux0a.js → index-BDBVpPM6.js} +1 -1
- package/dist/assets/{index-4PDACnJH.js → index-BLzQ1KBe.js} +1 -1
- package/dist/assets/{index-2O6pO3C0.js → index-BRlReJIZ.js} +1 -1
- package/dist/assets/{index-SZT5maAh.js → index-BZmk2zj8.js} +1 -1
- package/dist/assets/{index-BPfVR4iS.js → index-BkopC6U9.js} +1 -1
- package/dist/assets/{index-CsS3i-KH.js → index-C1j4wjey.js} +1 -1
- package/dist/assets/{index-BfBmdhaP.js → index-CD4JO73-.js} +1 -1
- package/dist/assets/{index-4yn4AUDp.js → index-CEx2RJ-e.js} +1 -1
- package/dist/assets/{index-DgzGxqfS.js → index-CJU18EM6.js} +1 -1
- package/dist/assets/{index-iIZ9yzWH.js → index-CYf2C6AJ.js} +1 -1
- package/dist/assets/{index-DCbeFkbq.js → index-CgV59s-V.js} +1 -1
- package/dist/assets/{index-J9vgkNx2.js → index-CopHDdLV.js} +1 -1
- package/dist/assets/{index-DHsEL5zO.js → index-DCXrFm75.js} +1 -1
- package/dist/assets/{index-Bu_eiLEF.js → index-DZPBHAWe.js} +1 -1
- package/dist/assets/{index-Dwe26e5t.js → index-DsT1V6wm.js} +1 -1
- package/dist/assets/{index-BBu3vR09.js → index-GCfFB1VW.js} +1 -1
- package/dist/assets/{index-C2336MLM.js → index-iKBZNcSX.js} +169 -169
- package/dist/assets/infoDiagram-LHK5PUON-B_TjCk0y.js +2 -0
- package/dist/assets/{journeyDiagram-EWQZEKCU-WnzpsJ2T.js → journeyDiagram-EWQZEKCU-6CvQ_Rg_.js} +1 -1
- package/dist/assets/{kanban-definition-ZSS6B67P-D8YgcqXf.js → kanban-definition-ZSS6B67P-COwPS4E6.js} +1 -1
- package/dist/assets/{layout-CDDvq6vU.js → layout-C4zao-I8.js} +1 -1
- package/dist/assets/{linear-CKMIqsjZ.js → linear-CjDrYzl8.js} +1 -1
- package/dist/assets/{links-CSA063mB.js → links-D6lhrSiS.js} +2 -2
- package/dist/assets/{mermaid-Dug1yrTM.js → mermaid-Cvkt-MCZ.js} +4 -4
- package/dist/assets/{min-oAURYhqT.js → min-BWTWl1qF.js} +1 -1
- package/dist/assets/{mindmap-definition-6CBA2TL7-BK3hEjlR.js → mindmap-definition-6CBA2TL7-CZbLvrP3.js} +1 -1
- package/dist/assets/{number-overlay-editor-JULIuqN9.js → number-overlay-editor-DCRVv7sL.js} +1 -1
- package/dist/assets/{pieDiagram-NIOCPIFQ-MckN4uma.js → pieDiagram-NIOCPIFQ-whaipKSr.js} +1 -1
- package/dist/assets/{quadrantDiagram-2OG54O6I-D8tfr3XM.js → quadrantDiagram-2OG54O6I-BZW8L7Ps.js} +1 -1
- package/dist/assets/{react-plotly-Cy_EVRx7.js → react-plotly-BWrrqCbG.js} +1 -1
- package/dist/assets/{requirementDiagram-QOLK2EJ7-BRlfoH1_.js → requirementDiagram-QOLK2EJ7-CdEqWDeK.js} +1 -1
- package/dist/assets/{run-page-hCOTan7v.js → run-page-B-8iMcVD.js} +1 -1
- package/dist/assets/{sankeyDiagram-4UZDY2LN-CxQ8U-Ks.js → sankeyDiagram-4UZDY2LN-C00P64kS.js} +1 -1
- package/dist/assets/{sequenceDiagram-SKLFT4DO-BAw8N1MZ.js → sequenceDiagram-SKLFT4DO-BjDNhF7J.js} +1 -1
- package/dist/assets/{slides-component-BwB5RYkz.js → slides-component-CXltbZiy.js} +1 -1
- package/dist/assets/{sortBy-D2g5sv7e.js → sortBy-TfKp930a.js} +1 -1
- package/dist/assets/{stateDiagram-MI5ZYTHO-1M-uovZ0.js → stateDiagram-MI5ZYTHO-f6ZaiJLA.js} +1 -1
- package/dist/assets/stateDiagram-v2-5AN5P6BG-nL8vEWaM.js +1 -0
- package/dist/assets/{storage-BZ0Mm1oz.js → storage-Dj3Ir4VQ.js} +3 -3
- package/dist/assets/{terminal-Cw3jC7cC.js → terminal-CWX5wZ40.js} +1 -1
- package/dist/assets/{time-DCAiWKgS.js → time-C-NxTERr.js} +1 -1
- package/dist/assets/{timeline-definition-MYPXXCX6-HW-6cVJn.js → timeline-definition-MYPXXCX6-CWrs5HFw.js} +1 -1
- package/dist/assets/{tracing-DfEJ8mrj.js → tracing-Df4x4g0x.js} +2 -2
- package/dist/assets/{trash-BFIVN-CC.js → trash-B1Z3-x8i.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-NwuKS1Zz.js → treemap-75Q7IDZK-BbMi9CAK.js} +1 -1
- package/dist/assets/{vega-component-CLcmXFt_.js → vega-component-Ba-nIjv8.js} +1 -1
- package/dist/assets/{xychartDiagram-H2YORKM3-C5Lnwrl3.js → xychartDiagram-H2YORKM3-CvhEOy7Y.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/_baseMap-hYhOqnhA.js +0 -1
- package/dist/assets/channel-Dp4EX7KF.js +0 -1
- package/dist/assets/classDiagram-M3E45YP4-yDpUDQSX.js +0 -1
- package/dist/assets/classDiagram-v2-YAWTLIQI-yDpUDQSX.js +0 -1
- package/dist/assets/clone-Dpz6es3U.js +0 -1
- package/dist/assets/infoDiagram-LHK5PUON-uMmGUKHm.js +0 -2
- package/dist/assets/stateDiagram-v2-5AN5P6BG-BAyep0Xn.js +0 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-
|
2
|
-
var B7=Object.defineProperty;var rk=At=>{throw TypeError(At)};var U7=(At,wt,Qt)=>wt in At?B7(At,wt,{enumerable:!0,configurable:!0,writable:!0,value:Qt}):At[wt]=Qt;var Z=(At,wt,Qt)=>U7(At,typeof wt!="symbol"?wt+"":wt,Qt),$7=(At,wt,Qt)=>wt.has(At)||rk("Cannot "+Qt);var sk=(At,wt,Qt)=>($7(At,wt,"read from private field"),Qt?Qt.call(At):wt.get(At)),ak=(At,wt,Qt)=>wt.has(At)?rk("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(At):wt.set(At,Qt);import{c as Ee,W as O,e0 as V7,iW as H7,dP as ik,iX as W7,dW as q7,dY as G7,b as G,dK as Of,iY as ur,iZ as Y7,i_ as Df,i$ as lk,j0 as K7,j1 as X7,j2 as ck,j3 as Bl,a as H,f0 as J7,ar as Xe,j as c,ag as On,ao as zo,an as ss,ap as as,bs as Bo,al as ke,aq as on,j4 as Ca,am as Uo,aS as Dn,as as Ea,a1 as je,X as St,eh as Pf,f4 as Rf,j5 as Z7,aN as ze,a7 as it,j6 as Q7,fi as mn,j7 as dk,j8 as uk,j9 as Lf,ja as hk,jb as e9,L as ft,dC as Ul,aZ as $o,jc as $l,a$ as Ff,av as Zt,jd as t9,a4 as _a,je as n9,jf as fk,fh as mk,U as yt,b5 as pk,jg as gk,cF as Vl,jh as o9,e8 as et,ji as Hl,ef as Pn,jj as xk,jk as Ia,T as Ie,bd as Nn,jl as Wl,jm as ql,f7 as is,jn as r9,jo as Ta,jp as bk,ff as yk,jq as zf,jr as Bf,eK as Uf,js as qn,jt as hr,aX as Gl,ju as s9,jv as Yl,jw as Kl,a2 as vo,ey as vk,a3 as Aa,jx as a9,jy as Xl,jz as Vo,bu as fr,f8 as mr,fR as wk,gC as pr,g4 as i9,bg as Ot,jA as l9,jB as c9,gA as Jl,aP as Zl,jC as $f,jD as d9,jE as kk,jF as Vf,jG as u9,jH as Hf,jI as Gn,jJ as Sk,gG as Wf,jK as Ma,jL as Ql,eP as dt,eR as ls,jM as mt,jN as Be,jO as st,jP as qf,jQ as h9,jR as Gf,jS as pt,jT as Nk,dw as Oa,ds as Da,dt as Pa,du as Ra,dr as cs,jU as f9,g2 as Yf,b4 as jn,aJ as Cn,fU as jk,fW as Ck,fX as m9,g0 as p9,fY as Ek,jV as _k,$ as me,eJ as g9,aV as Ho,b2 as Wo,aW as qo,b0 as Dt,fg as rn,jW as Ik,f_ as Tk,jX as x9,jY as b9,fS as Ak,fT as Mk,jZ as ds,dv as Ok,j_ as Dk,j$ as y9,k0 as v9,ak as w9,aj as k9,k1 as Kf,dz as S9,dB as Xf,fF as ec,k2 as tc,k3 as nc,bx as pn,k4 as N9,fb as La,fC as Yn,bl as Pk,ei as Ut,k5 as j9,eE as C9,ah as Jf,k6 as gr,k7 as us,k8 as E9,k9 as _9,ka as Rk,kb as Wt,aY as I9,au as Zf,gF as Lk,eL as oc,kc as T9,h0 as Qf,bk as rc,kd as em,ai as A9,ke as M9,at as Fa,f1 as Fk,bo as O9,kf as D9,kg as zk,hb as P9,h9 as R9,hc as L9,hd as F9,kh as tm,dx as wo,ki as z9,kj as sc,kk as hs,q as ko,o as Ge,gk as Rn,kl as gn,km as ot,kn as fs,ko as Tt,gB as Pt,kp as nm,eO as En,kq as B9,kr as om,bi as Bk,bj as Uk,ks as $k,kt as U9,h2 as ms,ku as ac,bf as ic,h3 as xr,fj as rm,kv as $9,kw as V9,kx as H9,ky as W9,kz as Vk,kA as za,kB as Hk,kC as Wk,kD as qk,kE as Gk,kF as q9,kG as Yk,kH as Kk,fk as ps,kI as G9,kJ as Kn,kK as lc,kL as Xk,kM as cc,dy as Y9,gZ as sm,kN as Ba,kO as Ua,kP as $a,kQ as dc,kR as Go,kS as Jk,kT as So,kU as gs,kV as am,kW as Va,kX as xs,kY as im,kZ as lm,k_ as Zk,k$ as uc,l0 as K9,a6 as Ha,l1 as Wa,l2 as X9,ee as hc,l3 as J9,l4 as cm,l5 as Z9,l6 as Q9,l7 as fc,en as eO,l8 as dm,l9 as br,la as mc,lb as bs,gj as _n,gu as No,gf as Qk,cq as e3,lc as um,g1 as t3,ld as n3,le as qa,lf as o3,lg as pc,lh as hm,li as Ga,lj as Ya,lk as Ka,ll as tO,gb as gc,lm as fm,ln as xc,eD as nO,gc as oO,lo as rO,lp as sO,lq as aO,lr as iO,u as lO,ls as cO,lt as dO,lu as uO,gn as hO,lv as fO,lw as r3,t as F,lx as mO,ly as pO,lz as gO,lA as xO,lB as bO,lC as yO,lD as vO,lE as wO,lF as kO,lG as SO,lH as NO,lI as jO,lJ as CO,lK as EO,lL as _O,lM as IO,lN as TO,lO as AO,lP as MO,lQ as OO,lR as DO,lS as PO,lT as Xa,lU as RO,lV as LO,lW as FO,lX as zO,lY as BO,lZ as UO,l_ as $O,l$ as VO,m0 as mm,m1 as bc,m2 as s3,m3 as HO,m4 as WO,m5 as a3,m6 as qO,m7 as ys,m8 as In,m9 as GO,ma as YO,mb as KO,mc as XO,md as JO,me as ZO,mf as QO,mg as eD,mh as tD,mi as nD,mj as Yo,mk as oD,ml as rD,mm as sD,mn as aD,ek as iD,mo as lD,mp as i3,eo as cD,mq as yc,mr as dD,ms as uD,mt as hD,mu as fD,he as Ko,mv as vc,mw as mD,mx as pD,my as l3,mz as pm,h1 as vs,mA as gD,mB as xD,mC as bD,mD as yD,gs as vD,br as wD,_ as gm,mE as c3,mF as kD,mG as SD,mH as xm,mI as bm,mJ as ND,mK as d3,mL as u3,mM as wc,ge as jD,ab as h3,e6 as CD,mN as f3,fP as vt,mO as Ja,mP as ws,mQ as ED,mR as _D,mS as ID,mT as TD,cp as ym,mU as AD,V as Xo,bh as m3,mV as MD,mW as OD,mX as DD,mY as kc,mZ as p3,e4 as Sc,bt as g3,eQ as PD,m_ as RD,m$ as x3,n0 as b3,n1 as LD,n2 as y3,n3 as v3,n4 as Nc,n5 as FD,n6 as w3,n7 as zD,n8 as BD,n9 as k3,ac as jc,na as UD,bv as S3,nb as $D,a0 as jo,fa as VD,nc as Co,nd as HD,eH as N3,fe as j3,fd as C3,g5 as Cc,ne as vm,nf as E3,aU as wm,eI as Ec,ng as _3,nh as WD,ni as qD,nj as I3,fO as GD,nk as YD,gU as KD,fV as XD,fZ as km,gX as JD,bq as Za,nl as ZD,nm as T3,nn as Sm,no as QD,np as eP,nq as tP,ad as xn,nr as nP,ns as oP,nt as A3,fH as Nm,dE as M3,nu as rP,nv as sP,nw as aP,aO as iP,nx as lP,ny as cP,nz as dP,nA as uP,a8 as hP,nB as _c,aa as fP,fD as mP,nC as O3,g9 as pP,nD as gP,gK as xP,nE as bP,nF as D3,nG as yP,nH as ks,nI as vP,nJ as Ic,nK as wP,nL as kP,nM as SP,z as P3,h7 as NP,nN as Qa,nO as R3,nP as L3,nQ as F3,nR as z3,nS as jP,C as B3,nT as CP,nU as EP,nV as _P,nW as IP,E as yr,fp as U3,be as TP,bc as AP,nX as MP,nY as OP,Z as Tc,nZ as DP,dH as $3,n_ as jm,n$ as PP,eg as V3,o0 as RP,o1 as Cm,o2 as LP,o3 as FP,o4 as zP,o5 as H3,o6 as W3,o7 as q3,fB as G3,o8 as BP,o9 as UP,oa as Y3,ob as K3,oc as Ac,od as X3,oe as J3,of as $P,og as Z3,oh as VP,oi as HP,oj as Q3,ok as WP,ol as qP,om as GP,on as YP,oo as KP,op as XP,ed as JP,oq as ZP,or as QP,gt as Em,os as eR,ot as tR,ou as nR,ov as oR,ow as rR,ox as sR,oy as aR,oz as iR,oA as lR,oB as cR,oC as _m,oD as dR,gh as uR,oE as hR,oF as fR,oG as mR,oH as eS,oI as pR,a5 as gR,oJ as xR,Y as bR,f3 as yR,gN as vR,oK as wR,oL as kR,gP as Im,gL as Ss,gQ as vr,gM as wr,gR as Tm,gS as Am,oM as tS,gO as SR,oN as nS,oO as NR,oP as oS,oQ as Jo,oR as rS,gW as jR,oS as CR,oT as ER,oU as _R,oV as IR,oW as TR,oX as AR,oY as sS,eV as MR,oZ as Mm,o_ as OR,aw as Mc,o$ as aS,p0 as iS,ay as lS,ax as DR,ec as PR,__tla as RR}from"./index-C2336MLM.js";import{b as Ns,A as LR,L as cS,g as FR,G as zR,o as dS,s as BR,k as UR,B as uS,a as $R,M as VR,Y as HR,c as sn,u as ei,C as WR,S as qR,K as GR,d as YR,i as KR,e as hS,f as XR,h as JR,j as ti,P as ni,l as fS,m as ZR,n as QR,p as eL,D as js,q as tL,r as mS,t as Om,T as nL}from"./links-CSA063mB.js";import{V as pS,d as kr,I as Dm,N as gS,S as xS,e as bS,f as yS,L as vS,g as wS,F as kS,M as oL,l as SS,h as rL,E as Pm,i as sL,j as Rm,k as Lm,m as aL,n as iL,o as lL,p as cL,q as dL,s as uL,t as hL,v as fL,a as mL,C as pL,R as NS,A as gL,b as xL,T as bL,w as yL,x as vL,y as wL,z as kL,O as SL,c as NL,P as jL,__tla as CL}from"./storage-BZ0Mm1oz.js";import{c as EL}from"./_createAggregator-J1Oqw6vi.js";import{_ as jS,a as CS,i as _L,w as IL,L as ES,A as TL,C as _S,b as Fm,c as IS,__tla as AL}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Ln,i as Zo,T as zm,a as Bm}from"./transform-CDNfLgV5.js";import{g as TS}from"./timer-Bqd5yn_a.js";import{i as ML}from"./zoom-COrs4lFh.js";import{s as oi}from"./sortBy-D2g5sv7e.js";let Um,Oc,an,Dc,AS,Cs,OL=Promise.all([(()=>{try{return RR}catch{}})(),(()=>{try{return CL}catch{}})(),(()=>{try{return AL}catch{}})()]).then(async()=>{var zl,tk;var At=EL(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,Qt,$m,Pc,Es,Sr,Rc,Lc,Vm,Hm,ri,Fc,Wm,si,qm,zc,Gm,Ym,Bc,Km,Xm,Jm,ai,Zm,Uc,Qm,ep,tp,np,op,rp,$c,sp,Vc,Hc,ap,ip,lp,cp,dp,up,ii,hp,fp,Wc,mp,pp,gp,qc,xp,bp,yp,li,Gc,Yc,vp,wp,kp,Sp,Np,jp,Cp,Ep,_p,Kc,Xc,Ip,Tp,Ap,ci,ln,cn;wt=Ee("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Qt=Ee("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"}]]),$m=Ee("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"}]]),Pc=Ee("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Es=Ee("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Sr=Ee("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"}]]),Rc=Ee("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Lc=Ee("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Dc=Ee("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Vm=Ee("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Hm=Ee("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ri=Ee("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Fc=Ee("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"}]]),Wm=Ee("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"}]]),si=Ee("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"}]]),qm=Ee("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),zc=Ee("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"}]]),Gm=Ee("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"}]]),Ym=Ee("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"}]]),Bc=Ee("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"}]]),Km=Ee("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),Xm=Ee("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"}]]),Jm=Ee("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"}]]),ai=Ee("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"}]]),Zm=Ee("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"}]]),Uc=Ee("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"}]]),Qm=Ee("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"}]]),ep=Ee("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"}]]),tp=Ee("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"}]]),np=Ee("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"}]]),op=Ee("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),rp=Ee("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"}]]),$c=Ee("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"}]]),sp=Ee("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"}]]),Vc=Ee("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"}]]),Hc=Ee("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"}]]),ap=Ee("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"}]]),ip=Ee("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"}]]),lp=Ee("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),cp=Ee("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"}]]),dp=Ee("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),up=Ee("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"}]]),ii=Ee("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"}]]),hp=Ee("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"}]]),fp=Ee("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"}]]),Wc=Ee("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"}]]),mp=Ee("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),pp=Ee("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"}]]),gp=Ee("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"}]]),qc=Ee("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),xp=Ee("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"}]]),bp=Ee("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"}]]),yp=Ee("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"}]]),li=Ee("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"}]]),Gc=Ee("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"}]]),Yc=Ee("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"}]]),vp=Ee("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"}]]),wp=Ee("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),kp=Ee("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"}]]),Sp=Ee("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"}]]),Np=Ee("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),jp=Ee("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"}]]),Cp=Ee("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"}]]),Ep=Ee("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"}]]),_p=Ee("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"}]]),Kc=Ee("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"}]]),Xc=Ee("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"}]]),Ip=Ee("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Tp=Ee("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"}]]),Ap=Ee("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"}]]),ci=Ee("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"}]]),ln=Ee("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"}]]),cn=Ee("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 MS=O.createContext({}),OS=O.forwardRef(function(t,e){[t,e]=q7(t,e,MS);let{toolbarProps:n}=function(s,a){const{"aria-label":i,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=O.useState(!1);V7(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=H7(),m=f==="rtl"&&d==="horizontal";let x=W7(a);const g=O.useRef(null);return{toolbarProps:{...ik(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":i,"aria-labelledby":i==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?x.focusPrevious():x.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?x.focusFirst():x.focusLast())):void 0;m?x.focusNext():x.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=a.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=G7({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=ik(t);return delete r.id,G.createElement("div",{...Of(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function di(t,e){const n=+ur(t)-+ur(e);return n<0?-1:n>0?1:n}function DS(t,e){const n=ur(t,e==null?void 0:e.in);return+function(o,r){const s=ur(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=ur(o,r==null?void 0:r.in),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s}(n,e)}function PS(t,e,n){const[o,r,s]=Df(n==null?void 0:n.in,t,t,e),a=di(r,s),i=Math.abs(function(u,h,f){const[m,x]=Df(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-x.getFullYear())+(m.getMonth()-x.getMonth())}(r,s));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=di(r,s)===-a;DS(o)&&i===1&&di(o,s)===1&&(l=!1);const d=a*(i-+l);return d===0?0:d}function RS(t,e,n){const o=function(r,s){return+ur(r)-+ur(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function LS(t,e){return function(n,o,r){const s=K7(),a=(r==null?void 0:r.locale)??s.locale??X7,i=di(n,o);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:i}),[d,u]=Df(r==null?void 0:r.in,...i>0?[o,n]:[n,o]),h=RS(u,d),f=(lk(u)-lk(d))/1e3,m=Math.round((h-f)/60);let x;if(m<2)return m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<ck){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}if(m<2520)return a.formatDistance("xDays",1,l);if(m<Bl){const g=Math.round(m/ck);return a.formatDistance("xDays",g,l)}if(m<2*Bl)return x=Math.round(m/Bl),a.formatDistance("aboutXMonths",x,l);if(x=PS(u,d),x<12){const g=Math.round(m/Bl);return a.formatDistance("xMonths",g,l)}{const g=x%12,p=Math.trunc(x/12);return g<3?a.formatDistance("aboutXYears",p,l):g<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}(t,function(n){return Y7(n,Date.now())}(t),e)}const ui="https://static.marimo.app",FS=t=>{const e=H.c(24),{onClose:n}=t,[o,r]=O.useState("");let s;s=Math.random().toString(36).slice(2,6);const a=`${o}-${s}`,i=`${ui}/static/${a}`;let l,d,u,h,f,m,x,g,p,b,y;return e[0]!==n||e[1]!==a?(l=async v=>{v.preventDefault(),n();const w=await J7({download:!1,includeCode:!0,files:pS.INSTANCE.filenames()}),S=Xe({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ui}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:a})}).catch(()=>{S.dismiss(),Xe({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:On.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),Xe({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(zo,{children:"Share static notebook"}),e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs(ss,{children:[d,c.jsxs(as,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:ui,target:"_blank",children:ui}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=v=>{const w=v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(w)},e[5]=h):h=e[5],e[6]!==o?(f=c.jsx(Bo,{"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]!==i?(m=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(zS,{text:i}),c.jsx("span",{className:"text-primary",children:i})]})]}),e[8]=i,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=x):x=e[12],e[13]!==n?(g=c.jsx(ke,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==i?(p=c.jsx(ke,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await on(i)},children:"Create"}),e[15]=i,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==x?(y=c.jsx(Uo,{className:"w-fit",children:c.jsxs("form",{onSubmit:l,children:[u,x,b]})}),e[20]=b,e[21]=l,e[22]=x,e[23]=y):y=e[23],y},zS=t=>{const e=H.c(8),[n,o]=G.useState(!1);let r;e[0]!==t.text?(r=Dn.stopPropagation(async d=>{d.preventDefault(),await on(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let a,i,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Ea,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsx(ke,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:a}),e[3]=s,e[4]=i):i=e[4],e[5]!==n||e[6]!==i?(l=c.jsx(je,{content:"Copied!",open:n,children:i}),e[5]=n,e[6]=i,e[7]=l):l=e[7],l};function Mp(){const t=H.c(2),e=St(Pf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const a of Array.from(o)){const i=a.getBoundingClientRect();if(i.top>=0&&i.top<=r||i.bottom>=0&&i.bottom<=r){s=Rf.parse(a.parentNode.id);break}}e(a=>({mode:Z7(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(Rf.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function Jc(t){const e=H.c(3),n=_s();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],ze(o)}function Op(){const t=H.c(2),e=_s();let n;return t[0]!==e?(n=()=>e(dk(mn())),t[0]=e,t[1]=n):n=t[1],ze(n)}function _s(){const t=H.c(2),{prepareForRun:e}=it();let n;return t[0]!==e?(n=async o=>{var i,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=mn(),a=[];for(const d of o){const u=r[d],h=(i=u==null?void 0:u.current)==null?void 0:i.editorView;let f;h?(uk(h)!=="markdown"&&Lf(h),f=hk(h)):f=((l=s[d])==null?void 0:l.code)||"",a.push(f),e({cellId:d})}await e9({cellIds:o,codes:a}).catch(BS)},t[0]=e,t[1]=n):n=t[1],ze(n)}function BS(t){ft.error(t)}const Zc=[{type:"files",Icon:Qm,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Ul,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:$o,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ii,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ns,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Yc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:$l,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:Kc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Ff,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:LR,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:kp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:rp,tooltip:"Secrets",hidden:Zt(),position:"sidebar"},{type:"scratchpad",Icon:t9,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:_a,tooltip:"View errors",position:"footer"}];function US(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(a,i){const l=H.c(11);let d;l[0]!==i?(d=new n9(i),l[0]=i,l[1]=d):d=l[1];const u=d;let h;l[2]!==a||l[3]!==u?(h=()=>u.get(a),l[2]=a,l[3]=u,l[4]=h):h=l[4];const[f,m]=O.useState(h);let x;l[5]!==a||l[6]!==u?(x=b=>{m(b),u.set(a,b)},l[5]=a,l[6]=u,l[7]=x):x=l[7];const g=x;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=a=>{const i=(l=[a,...n],[...new Set(l)]);var l;o(i.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 Dp(t){return t.dropdown!==void 0}function hi(t,e=""){return t.flatMap(n=>n.label?Dp(n)?hi(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Is=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=G.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[a,i]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let d,u;return e[2]!==i||e[3]!==l?(d=c.jsx("div",{className:l,children:i}),e[2]=i,e[3]=l,e[4]=d):d=e[4],e[5]!==a||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[a,d]}),e[5]=a,e[6]=d,e[7]=u):u=e[7],u},Ts=yt(null),$S=yt(!1),Qc=pk("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),VS=yt(t=>{const e=t(Qc);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(Qc,o=>({...o,activeChatId:n}))});function Pp(t){return t!==gk&&!!(t&&t.trim().length>0)}const fi=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=i=>{var l;(i.ctrlKey||i.metaKey)&&i.key==="z"&&(i.preventDefault(),i.stopPropagation(),(l=t.onClick)==null||l.call(t,i))},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],Vl(window,"keydown",n,o);const r=t.children??"Undo";let s,a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(o9,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(a=c.jsxs(ke,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=a):a=e[6],a};function mi(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(et.get(Hl))return;const{cellId:s}=r,a=et.get(Pn),i=(((l=a.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),xk({cellId:s}).catch(()=>{n()}),!i){const{dismiss:d}=Xe({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(fi,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=d}},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function pi(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=async r=>{if(et.get(Hl))return;const{cellIds:s}=r;for(const l of s)await xk({cellId:l}).then(()=>{e({cellId:l})});const{dismiss:a}=Xe({title:"Cells deleted",action:c.jsx(fi,{"data-testid":"undo-delete-button",onClick:()=>{for(const l of s)n();i()}})}),i=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function Rp(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Ia(r.cellId);if(!s)return;const a=hk(s);e(r);const{dismiss:i}=Xe({title:"Cell split",action:c.jsx(fi,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:a}),l()},children:"Undo"})}),l=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function ed(t){const e=H.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:a,sendToTop:i,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=it(),h=Rp(),f=Jc(n==null?void 0:n.cellId),m=!Ie(Hl),x=mi(),{openModal:g}=Nn(),p=St(Ts),b=Ie(Wl),y=Ie(ql),v=Ie(is),w=Ie(r9);if(!n||v){let E;return e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0],E}const{cellId:S,config:N,getEditorView:j,name:C,hasOutput:_,hasConsoleOutput:T,status:I}=n;let P;e[1]!==S||e[2]!==N.disabled||e[3]!==r?(P=async()=>{const E={disabled:!N.disabled};await Vo({configs:{[S]:E}}),r({cellId:S,config:E})},e[1]=S,e[2]=N.disabled,e[3]=r,e[4]=P):P=e[4];const L=P;let M;e[5]!==S||e[6]!==N.hide_code||e[7]!==j||e[8]!==r?(M=async()=>{const E={hide_code:!N.hide_code};await Vo({configs:{[S]:E}}),r({cellId:S,config:E});const U=j();U&&(E.hide_code?U.contentDOM.blur():U.focus())},e[5]=S,e[6]=N.hide_code,e[7]=j,e[8]=r,e[9]=M):M=e[9];const R=M;let z,D,A,k,B;return e[10]===Symbol.for("react.memo_cache_sentinel")?(z=c.jsx(_p,{size:13,strokeWidth:1.5}),e[10]=z):z=e[10],e[11]!==S||e[12]!==C||e[13]!==g||e[14]!==s?(D=()=>{g(c.jsxs(Uo,{children:[c.jsx(ss,{children:c.jsx(zo,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(fr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(gS,{placeholder:"cell name",value:C,onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),E.stopPropagation(),g(null))},onChange:E=>s({cellId:S,name:E})})]})]}))},e[11]=S,e[12]=C,e[13]=g,e[14]=s,e[15]=D):D=e[15],e[16]!==S||e[17]!==s?(A=E=>s({cellId:S,name:E}),e[16]=S,e[17]=s,e[18]=A):A=e[18],e[19]!==C||e[20]!==A?(k=c.jsx(gS,{placeholder:"cell name",value:C,onChange:A}),e[19]=C,e[20]=A,e[21]=k):k=e[21],e[22]!==d||e[23]!==b||e[24]!==w||e[25]!==y||e[26]!==m||e[27]!==S||e[28]!==u||e[29]!==N.disabled||e[30]!==N.hide_code||e[31]!==o||e[32]!==x||e[33]!==j||e[34]!==T||e[35]!==_||e[36]!==a||e[37]!==C||e[38]!==f||e[39]!==l||e[40]!==i||e[41]!==p||e[42]!==h||e[43]!==I||e[44]!==D||e[45]!==k||e[46]!==L||e[47]!==R?(B=[[{icon:z,label:"Name",disableClick:!0,handle:GS,handleHeadless:D,rightElement:k},{icon:c.jsx(kr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:I==="running"||I==="queued"||I==="disabled-transitively"||N.disabled,handle:()=>f()},{icon:c.jsx(Ta,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(E=>(E==null?void 0:E.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:c.jsx(Gc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:S})},{icon:c.jsx(Dm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!_,handle:()=>function(E){const U=document.getElementById(fk.create(E));U&&(U.classList.add("printing-output"),mk(U,"result.png").finally(()=>{U.classList.remove("printing-output")}))}(S)},{icon:c.jsx(yk,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const E=j();E&&bk({[S]:E})}},{icon:N.hide_code?c.jsx(zf,{size:13,strokeWidth:1.5}):c.jsx(Bf,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:R,hotkey:"cell.hideCode"},{icon:N.disabled?c.jsx(ln,{size:13,strokeWidth:1.5}):c.jsx(cn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(Uf,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:L}),handle:L},{icon:c.jsx(_a,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(_||T),handle:()=>{u({cellId:S})}}],[{icon:c.jsx(Gl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const E=j();E&&(qn({autoInstantiate:y,createNewCell:o}),hr(E,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx($o,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const E=j();E&&(qn({autoInstantiate:y,createNewCell:o}),hr(E,{language:"sql",keepCodeAsIs:!1}))}},{icon:c.jsx(Yl,{}),label:"Toggle as Python",handle:()=>{const E=j();E&&(qn({autoInstantiate:y,createNewCell:o}),s9(E,"python",{force:!0}))}}],[{icon:c.jsxs(Is,{children:[c.jsx(ri,{size:13,strokeWidth:1.5}),c.jsx(Kl,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:c.jsxs(Is,{children:[c.jsx(ri,{size:13,strokeWidth:1.5}),c.jsx(vo,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:c.jsx(Kl,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>a({cellId:S,before:!0})},{icon:c.jsx(vo,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>a({cellId:S,before:!1})},{icon:c.jsx(vk,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>a({cellId:S,direction:"left"}),hidden:w!=="columns"},{icon:c.jsx(Aa,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>a({cellId:S,direction:"right"}),hidden:w!=="columns"},{icon:c.jsx(Lc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>i({cellId:S,scroll:!1})},{icon:c.jsx(Rc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S,scroll:!1})},{icon:c.jsx(a9,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>d({cellId:S})}],[{icon:c.jsx(cS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Pp(C),tooltip:Pp(C)?void 0:"Only named cells can be linked to",handle:async()=>{await on(function(E){const U=new URL(window.location.href);return U.hash=`scrollTo=${encodeURIComponent(E)}`,U.toString()}(C)),Xe({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(Xl,{size:13,strokeWidth:1.5}),handle:()=>{x({cellId:S})}}]].map(WS).filter(HS),e[22]=d,e[23]=b,e[24]=w,e[25]=y,e[26]=m,e[27]=S,e[28]=u,e[29]=N.disabled,e[30]=N.hide_code,e[31]=o,e[32]=x,e[33]=j,e[34]=T,e[35]=_,e[36]=a,e[37]=C,e[38]=f,e[39]=l,e[40]=i,e[41]=p,e[42]=h,e[43]=I,e[44]=D,e[45]=k,e[46]=L,e[47]=R,e[48]=B):B=e[48],B}function HS(t){return t.length>0}function WS(t){return t.filter(qS)}function qS(t){return!t.hidden}function GS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function YS(t){return!t.hidden}const td=yt(!1),Lp=()=>{const t=H.c(37),[e,n]=Ot(td),o=l9(),r=Ie(c9),s=Ie(Jl);let a;t[0]!==r?(a={cell:r},t[0]=r,t[1]=a):a=t[1];let i=ed(a).flat();i=hi(i);const l=function(){const A=H.c(73),[k,B]=mr(),[E,U]=wk();let V;A[0]!==B?(V=async Y=>{await pr({config:Y}).then(()=>{B(Y)})},A[0]=B,A[1]=V):V=A[1];const $=V;let K;A[2]!==U?(K=async Y=>{await i9({config:Y}).then(()=>{U(Y)})},A[2]=U,A[3]=K):K=A[3];const X=K;let J;if(A[4]!==E||A[5]!==k||A[6]!==X||A[7]!==$){let Y,oe,se,re,ae;A[9]!==E?(Y=Me=>Me!==E.width,A[9]=E,A[10]=Y):Y=A[10],A[11]!==E||A[12]!==X?(oe=Me=>({label:`App config > Set width=${Me}`,handle:()=>{X({...E,width:Me})}}),A[11]=E,A[12]=X,A[13]=oe):oe=A[13],A[14]!==k||A[15]!==$?(se={label:"Config > Set theme: dark",handle:()=>{$({...k,display:{...k.display,theme:"dark"}})}},A[14]=k,A[15]=$,A[16]=se):se=A[16],A[17]!==k||A[18]!==$?(re={label:"Config > Set theme: light",handle:()=>{$({...k,display:{...k.display,theme:"light"}})}},A[17]=k,A[18]=$,A[19]=re):re=A[19],A[20]!==k||A[21]!==$?(ae={label:"Config > Set theme: system",handle:()=>{$({...k,display:{...k.display,theme:"system"}})}},A[20]=k,A[21]=$,A[22]=ae):ae=A[22];const te=k.keymap.preset==="vim";let be,ye;A[23]!==k||A[24]!==$?(be=()=>{$({...k,keymap:{...k.keymap,preset:"vim"}})},A[23]=k,A[24]=$,A[25]=be):be=A[25],A[26]!==te||A[27]!==be?(ye={label:"Config > Switch keymap to VIM",hidden:te,handle:be},A[26]=te,A[27]=be,A[28]=ye):ye=A[28];const ie=k.keymap.preset==="default";let ve,he,Se;A[29]!==k||A[30]!==$?(ve=()=>{$({...k,keymap:{...k.keymap,preset:"default"}})},A[29]=k,A[30]=$,A[31]=ve):ve=A[31],A[32]!==ie||A[33]!==ve?(he={label:"Config > Switch keymap to default (current: VIM)",hidden:ie,handle:ve},A[32]=ie,A[33]=ve,A[34]=he):he=A[34],A[35]!==k||A[36]!==$?(Se=()=>{$({...k,completion:{...k.completion,copilot:!1}})},A[35]=k,A[36]=$,A[37]=Se):Se=A[37];const De=k.completion.copilot!=="github";let _e,Fe;A[38]!==Se||A[39]!==De?(_e={label:"Config > Disable GitHub Copilot",handle:Se,hidden:De},A[38]=Se,A[39]=De,A[40]=_e):_e=A[40],A[41]!==k||A[42]!==$?(Fe=()=>{$({...k,completion:{...k.completion,copilot:"github"}})},A[41]=k,A[42]=$,A[43]=Fe):Fe=A[43];const Oe=k.completion.copilot==="github";let Qe;A[44]!==Fe||A[45]!==Oe?(Qe={label:"Config > Enable GitHub Copilot",handle:Fe,hidden:Oe},A[44]=Fe,A[45]=Oe,A[46]=Qe):Qe=A[46];const qe=!k.display.reference_highlighting;let Ke,Q,xe,we;A[47]!==k||A[48]!==$?(Ke=()=>{$({...k,display:{...k.display,reference_highlighting:!1}})},A[47]=k,A[48]=$,A[49]=Ke):Ke=A[49],A[50]!==qe||A[51]!==Ke?(Q={label:"Config > Disable reference highlighting",hidden:qe,handle:Ke},A[50]=qe,A[51]=Ke,A[52]=Q):Q=A[52],A[53]!==k||A[54]!==$?(xe=()=>{$({...k,display:{...k.display,reference_highlighting:!0}})},A[53]=k,A[54]=$,A[55]=xe):xe=A[55],A[56]!==k.display.reference_highlighting||A[57]!==xe?(we={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:xe},A[56]=k.display.reference_highlighting,A[57]=xe,A[58]=we):we=A[58];const Te=k.display.cell_output==="above";let W,ne;A[59]!==k||A[60]!==$?(W=()=>{$({...k,display:{...k.display,cell_output:"above"}})},A[59]=k,A[60]=$,A[61]=W):W=A[61],A[62]!==Te||A[63]!==W?(ne={label:"Config > Set cell output area: above",hidden:Te,handle:W},A[62]=Te,A[63]=W,A[64]=ne):ne=A[64];const ue=k.display.cell_output==="below";let de,ge;A[65]!==k||A[66]!==$?(de=()=>{$({...k,display:{...k.display,cell_output:"below"}})},A[65]=k,A[66]=$,A[67]=de):de=A[67],A[68]!==ue||A[69]!==de?(ge={label:"Config > Set cell output area: below",hidden:ue,handle:de},A[68]=ue,A[69]=de,A[70]=ge):ge=A[70],J=[...FR().filter(Y).map(oe),se,re,ae,ye,he,_e,Qe,Q,we,ne,ge],A[4]=E,A[5]=k,A[6]=X,A[7]=$,A[8]=J}else J=A[8];const ee=J;let q;return A[71]!==ee?(q=ee.filter(YS),A[71]=ee,A[72]=q):q=A[72],q}();let d=fg();d=[...hi(d),...hi(l)];const u=d.filter(KS),h=Zl.keyBy(u,XS),{recentCommands:f,addRecentCommand:m}=US();let x;t[2]!==f?(x=new Set(f),t[2]=f,t[3]=x):x=t[3];const g=x;let p,b;t[4]!==s||t[5]!==n?(p=A=>{Hf(s.getHotkey("global.commandPalette").key)(A)&&(A.preventDefault(),n(JS))},t[4]=s,t[5]=n,t[6]=p):p=t[6],Vl(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(A,k)=>{const B=o[A];if(!B)return null;const E=s.getHotkey(A);return c.jsxs(Gn,{disabled:k.disabled,onSelect:()=>{m(A),n(!1),requestAnimationFrame(()=>{B()})},value:E.name,children:[c.jsxs("span",{children:[E.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(Sk,{children:c.jsx(Wf,{shortcut:E.key})})]},A)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=A=>{const{label:k,handle:B,props:E,hotkey:U}=A,V=E===void 0?{}:E;return c.jsxs(Gn,{disabled:V.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[c.jsxs("span",{children:[k,V.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",V.tooltip,")"]})]}),U&&c.jsx(Sk,{children:c.jsx(Wf,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,S=u9;let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(Ma,{placeholder:"Type to search..."}),t[16]=N):N=t[16];const j=Vf;let C;t[17]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(Ql,{children:"No results found."}),t[17]=C):C=t[17];const _=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx($f,{heading:"Recently Used",children:f.map(A=>{const k=h[A];return d9(A)?y(A,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!Dp(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(kk,{})]}),T=$f,I=s.iterate().map(A=>{if(g.has(A))return null;const k=h[A];return y(A,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),P=u.map(A=>g.has(A.label)?null:w({label:A.label,handle:A.handleHeadless||A.handle,props:{disabled:A.disabled,tooltip:A.tooltip}}));let L;t[18]!==g||t[19]!==w?(L=A=>g.has(A.label)?null:w({label:`Cell > ${A.label}`,handle:A.handleHeadless||A.handle,props:{disabled:A.disabled,tooltip:A.tooltip}}),t[18]=g,t[19]=w,t[20]=L):L=t[20];const M=i.map(L);let R,z,D;return t[21]!==T||t[22]!==P||t[23]!==M||t[24]!==I?(R=c.jsxs(T,{heading:"Commands",children:[I,P,M]}),t[21]=T,t[22]=P,t[23]=M,t[24]=I,t[25]=R):R=t[25],t[26]!==j||t[27]!==R||t[28]!==C||t[29]!==_?(z=c.jsxs(j,{children:[C,_,R]}),t[26]=j,t[27]=R,t[28]=C,t[29]=_,t[30]=z):z=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==z||t[35]!==N?(D=c.jsxs(S,{open:e,onOpenChange:n,children:[N,z]}),t[31]=S,t[32]=e,t[33]=n,t[34]=z,t[35]=N,t[36]=D):D=t[36],D};function KS(t){return!t.hotkey}function XS(t){return t.label}function JS(t){return!t}function Qo(){return st().optional().describe(Be.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Fp(){return st().optional().describe(Be.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function gi(){return st().optional().describe(Be.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function zp(){return st().optional().describe(Be.of({label:"URI",optionRegex:".*uri.*"}))}function er(){return st().nonempty().describe(Be.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function Xn(){return st().describe(Be.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function tr(){return st().nonempty().describe(Be.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function nr(t){const e=h9.string().describe(Be.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 Bp(){return ls().default(!1).describe(Be.of({label:"Read Only"}))}const Up=dt({type:mt("postgres"),host:er(),port:nr(5432).optional(),database:Xn(),username:tr(),password:Qo(),ssl:ls().default(!1).describe(Be.of({label:"Use SSL"}))}).describe(Be.of({direction:"two-columns"})),$p=dt({type:mt("mysql"),host:er(),port:nr(3306),database:Xn(),username:tr(),password:Qo(),ssl:ls().default(!1).describe(Be.of({label:"Use SSL"}))}).describe(Be.of({direction:"two-columns"})),Vp=dt({type:mt("sqlite"),database:Xn().describe(Be.of({label:"Database Path"}))}).describe(Be.of({direction:"two-columns"})),Hp=dt({type:mt("duckdb"),database:Xn().describe(Be.of({label:"Database Path"})),read_only:Bp()}).describe(Be.of({direction:"two-columns"})),Wp=dt({type:mt("motherduck"),database:Xn().default("my_db").describe(Be.of({label:"Database Name"})),token:Fp()}).describe(Be.of({direction:"two-columns"})),qp=dt({type:mt("snowflake"),account:st().nonempty().describe(Be.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:st().optional().describe(Be.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:Xn(),schema:st().optional().describe(Be.of({label:"Schema",optionRegex:".*snowflake.*"})),username:tr(),password:Qo(),role:st().optional().describe(Be.of({label:"Role"}))}).describe(Be.of({direction:"two-columns"})),Gp=dt({type:mt("bigquery"),project:st().nonempty().describe(Be.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:st().nonempty().describe(Be.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:st().describe(Be.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Be.of({direction:"two-columns"})),Yp=dt({type:mt("clickhouse_connect"),host:er(),port:nr(8123).optional(),username:tr(),password:Qo(),secure:ls().default(!1).describe(Be.of({label:"Use HTTPs"}))}).describe(Be.of({direction:"two-columns"})),Kp=dt({type:mt("timeplus"),host:er().default("localhost"),port:nr(8123).optional(),username:tr().default("default"),password:Qo().default("")}).describe(Be.of({direction:"two-columns"})),Xp=dt({type:mt("chdb"),database:Xn().describe(Be.of({label:"Database Path"})),read_only:Bp()}).describe(Be.of({direction:"two-columns"})),Jp=dt({type:mt("trino"),host:er(),port:nr(8080),database:Xn(),schema:st().describe(Be.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:tr(),password:Qo(),async_support:ls().default(!1).describe(Be.of({label:"Async Support"}))}).describe(Be.of({direction:"two-columns"})),Zp=dt({type:mt("iceberg"),name:st().describe(Be.of({label:"Catalog Name"})),catalog:qf("type",[dt({type:mt("REST"),warehouse:gi(),uri:st().optional().describe(Be.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Fp()}),dt({type:mt("SQL"),warehouse:gi(),uri:st().optional().describe(Be.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),dt({type:mt("Hive"),warehouse:gi(),uri:zp()}),dt({type:mt("Glue"),warehouse:gi(),uri:zp()}),dt({type:mt("DynamoDB"),"dynamodb.profile-name":st().optional().describe(Be.of({label:"Profile Name"})),"dynamodb.region":st().optional().describe(Be.of({label:"Region"})),"dynamodb.access-key-id":st().optional().describe(Be.of({label:"Access Key ID"})),"dynamodb.secret-access-key":st().optional().describe(Be.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":st().optional().describe(Be.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Be.of({special:"tabs"}))}),Qp=dt({type:mt("datafusion"),sessionContext:ls().optional().describe(Be.of({label:"Use Session Context"}))}),eg=dt({type:mt("pyspark"),host:er().optional(),port:nr().optional()}),tg=dt({type:mt("redshift"),host:er(),port:nr(5439),connectionType:qf("type",[dt({type:mt("IAM credentials"),region:st().describe(Be.of({label:"Region"})),aws_access_key_id:st().nonempty().describe(Be.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:st().nonempty().describe(Be.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:st().optional().describe(Be.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),dt({type:mt("DB credentials"),user:tr(),password:Qo()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:Xn()}).describe(Be.of({direction:"two-columns"})),ZS=qf("type",[Up,$p,Vp,Hp,Wp,qp,Gp,Yp,Kp,Xp,Jp,Zp,Qp,eg,tg]),nd="env:";function xi(t){return typeof t=="string"&&t.startsWith(nd)}function od(t){return`${nd}${t}`}const ng={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class qt{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 QS{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),xi(n)){const r=n.replace(nd,""),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"?Nr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Nr(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 xi(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-Df4x4g0x.js","./index-iKBZNcSX.js","./index-DQuqPUAc.css","./compile-B4zBiHTW.js","./time-C-NxTERr.js","./timer-Bqd5yn_a.js","./linear-CjDrYzl8.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-Dj3Ir4VQ.js","./index-CgV59s-V.js","./index-CYf2C6AJ.js","./index-BkopC6U9.js","./index-B2wgHzow.js","./index-CEx2RJ-e.js","./index-CopHDdLV.js","./index-C1j4wjey.js","./index-BDBVpPM6.js","./index-BRlReJIZ.js","./index-CD4JO73-.js","./index-GCfFB1VW.js","./index-DZPBHAWe.js","./index-DsT1V6wm.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-B1Z3-x8i.js","./storage-De8XnUVS.css","./links-D6lhrSiS.js","./index-CJU18EM6.js","./links-C1rhMrxo.css","./circle-play-B2wvox_u.js","./_createAggregator-Y0Gl2pnz.js","./_baseEach-Cp9OlGfk.js","./loro_wasm_bg-C3hKWL9L.js","./transform-CDNfLgV5.js","./sortBy-TfKp930a.js","./_baseMap-TU2Gg6mS.js","./terminal-CWX5wZ40.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
|
2
|
+
var B7=Object.defineProperty;var rk=At=>{throw TypeError(At)};var U7=(At,wt,Qt)=>wt in At?B7(At,wt,{enumerable:!0,configurable:!0,writable:!0,value:Qt}):At[wt]=Qt;var Z=(At,wt,Qt)=>U7(At,typeof wt!="symbol"?wt+"":wt,Qt),$7=(At,wt,Qt)=>wt.has(At)||rk("Cannot "+Qt);var sk=(At,wt,Qt)=>($7(At,wt,"read from private field"),Qt?Qt.call(At):wt.get(At)),ak=(At,wt,Qt)=>wt.has(At)?rk("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(At):wt.set(At,Qt);import{c as Ee,W as O,e0 as V7,iW as H7,dP as ik,iX as W7,dW as q7,dY as G7,b as G,dK as Of,iY as ur,iZ as Y7,i_ as Df,i$ as lk,j0 as K7,j1 as X7,j2 as ck,j3 as Bl,a as H,f0 as J7,ar as Xe,j as c,ag as On,ao as zo,an as ss,ap as as,bs as Bo,al as ke,aq as on,j4 as Ca,am as Uo,aS as Dn,as as Ea,a1 as je,X as St,eh as Pf,f4 as Rf,j5 as Z7,aN as ze,a7 as it,j6 as Q7,fi as mn,j7 as dk,j8 as uk,j9 as Lf,ja as hk,jb as e9,L as ft,dC as Ul,aZ as $o,jc as $l,a$ as Ff,av as Zt,jd as t9,a4 as _a,je as n9,jf as fk,fh as mk,U as yt,b5 as pk,jg as gk,cF as Vl,jh as o9,e8 as et,ji as Hl,ef as Pn,jj as xk,jk as Ia,T as Ie,bd as Nn,jl as Wl,jm as ql,f7 as is,jn as r9,jo as Ta,jp as bk,ff as yk,jq as zf,jr as Bf,eK as Uf,js as qn,jt as hr,aX as Gl,ju as s9,jv as Yl,jw as Kl,a2 as vo,ey as vk,a3 as Aa,jx as a9,jy as Xl,jz as Vo,bu as fr,f8 as mr,fR as wk,gC as pr,g4 as i9,bg as Ot,jA as l9,jB as c9,gA as Jl,aP as Zl,jC as $f,jD as d9,jE as kk,jF as Vf,jG as u9,jH as Hf,jI as Gn,jJ as Sk,gG as Wf,jK as Ma,jL as Ql,eP as dt,eR as ls,jM as mt,jN as Be,jO as st,jP as qf,jQ as h9,jR as Gf,jS as pt,jT as Nk,dw as Oa,ds as Da,dt as Pa,du as Ra,dr as cs,jU as f9,g2 as Yf,b4 as jn,aJ as Cn,fU as jk,fW as Ck,fX as m9,g0 as p9,fY as Ek,jV as _k,$ as me,eJ as g9,aV as Ho,b2 as Wo,aW as qo,b0 as Dt,fg as rn,jW as Ik,f_ as Tk,jX as x9,jY as b9,fS as Ak,fT as Mk,jZ as ds,dv as Ok,j_ as Dk,j$ as y9,k0 as v9,ak as w9,aj as k9,k1 as Kf,dz as S9,dB as Xf,fF as ec,k2 as tc,k3 as nc,bx as pn,k4 as N9,fb as La,fC as Yn,bl as Pk,ei as Ut,k5 as j9,eE as C9,ah as Jf,k6 as gr,k7 as us,k8 as E9,k9 as _9,ka as Rk,kb as Wt,aY as I9,au as Zf,gF as Lk,eL as oc,kc as T9,h0 as Qf,bk as rc,kd as em,ai as A9,ke as M9,at as Fa,f1 as Fk,bo as O9,kf as D9,kg as zk,hb as P9,h9 as R9,hc as L9,hd as F9,kh as tm,dx as wo,ki as z9,kj as sc,kk as hs,q as ko,o as Ge,gk as Rn,kl as gn,km as ot,kn as fs,ko as Tt,gB as Pt,kp as nm,eO as En,kq as B9,kr as om,bi as Bk,bj as Uk,ks as $k,kt as U9,h2 as ms,ku as ac,bf as ic,h3 as xr,fj as rm,kv as $9,kw as V9,kx as H9,ky as W9,kz as Vk,kA as za,kB as Hk,kC as Wk,kD as qk,kE as Gk,kF as q9,kG as Yk,kH as Kk,fk as ps,kI as G9,kJ as Kn,kK as lc,kL as Xk,kM as cc,dy as Y9,gZ as sm,kN as Ba,kO as Ua,kP as $a,kQ as dc,kR as Go,kS as Jk,kT as So,kU as gs,kV as am,kW as Va,kX as xs,kY as im,kZ as lm,k_ as Zk,k$ as uc,l0 as K9,a6 as Ha,l1 as Wa,l2 as X9,ee as hc,l3 as J9,l4 as cm,l5 as Z9,l6 as Q9,l7 as fc,en as eO,l8 as dm,l9 as br,la as mc,lb as bs,gj as _n,gu as No,gf as Qk,cq as e3,lc as um,g1 as t3,ld as n3,le as qa,lf as o3,lg as pc,lh as hm,li as Ga,lj as Ya,lk as Ka,ll as tO,gb as gc,lm as fm,ln as xc,eD as nO,gc as oO,lo as rO,lp as sO,lq as aO,lr as iO,u as lO,ls as cO,lt as dO,lu as uO,gn as hO,lv as fO,lw as r3,t as F,lx as mO,ly as pO,lz as gO,lA as xO,lB as bO,lC as yO,lD as vO,lE as wO,lF as kO,lG as SO,lH as NO,lI as jO,lJ as CO,lK as EO,lL as _O,lM as IO,lN as TO,lO as AO,lP as MO,lQ as OO,lR as DO,lS as PO,lT as Xa,lU as RO,lV as LO,lW as FO,lX as zO,lY as BO,lZ as UO,l_ as $O,l$ as VO,m0 as mm,m1 as bc,m2 as s3,m3 as HO,m4 as WO,m5 as a3,m6 as qO,m7 as ys,m8 as In,m9 as GO,ma as YO,mb as KO,mc as XO,md as JO,me as ZO,mf as QO,mg as eD,mh as tD,mi as nD,mj as Yo,mk as oD,ml as rD,mm as sD,mn as aD,ek as iD,mo as lD,mp as i3,eo as cD,mq as yc,mr as dD,ms as uD,mt as hD,mu as fD,he as Ko,mv as vc,mw as mD,mx as pD,my as l3,mz as pm,h1 as vs,mA as gD,mB as xD,mC as bD,mD as yD,gs as vD,br as wD,_ as gm,mE as c3,mF as kD,mG as SD,mH as xm,mI as bm,mJ as ND,mK as d3,mL as u3,mM as wc,ge as jD,ab as h3,e6 as CD,mN as f3,fP as vt,mO as Ja,mP as ws,mQ as ED,mR as _D,mS as ID,mT as TD,cp as ym,mU as AD,V as Xo,bh as m3,mV as MD,mW as OD,mX as DD,mY as kc,mZ as p3,e4 as Sc,bt as g3,eQ as PD,m_ as RD,m$ as x3,n0 as b3,n1 as LD,n2 as y3,n3 as v3,n4 as Nc,n5 as FD,n6 as w3,n7 as zD,n8 as BD,n9 as k3,ac as jc,na as UD,bv as S3,nb as $D,a0 as jo,fa as VD,nc as Co,nd as HD,eH as N3,fe as j3,fd as C3,g5 as Cc,ne as vm,nf as E3,aU as wm,eI as Ec,ng as _3,nh as WD,ni as qD,nj as I3,fO as GD,nk as YD,gU as KD,fV as XD,fZ as km,gX as JD,bq as Za,nl as ZD,nm as T3,nn as Sm,no as QD,np as eP,nq as tP,ad as xn,nr as nP,ns as oP,nt as A3,fH as Nm,dE as M3,nu as rP,nv as sP,nw as aP,aO as iP,nx as lP,ny as cP,nz as dP,nA as uP,a8 as hP,nB as _c,aa as fP,fD as mP,nC as O3,g9 as pP,nD as gP,gK as xP,nE as bP,nF as D3,nG as yP,nH as ks,nI as vP,nJ as Ic,nK as wP,nL as kP,nM as SP,z as P3,h7 as NP,nN as Qa,nO as R3,nP as L3,nQ as F3,nR as z3,nS as jP,C as B3,nT as CP,nU as EP,nV as _P,nW as IP,E as yr,fp as U3,be as TP,bc as AP,nX as MP,nY as OP,Z as Tc,nZ as DP,dH as $3,n_ as jm,n$ as PP,eg as V3,o0 as RP,o1 as Cm,o2 as LP,o3 as FP,o4 as zP,o5 as H3,o6 as W3,o7 as q3,fB as G3,o8 as BP,o9 as UP,oa as Y3,ob as K3,oc as Ac,od as X3,oe as J3,of as $P,og as Z3,oh as VP,oi as HP,oj as Q3,ok as WP,ol as qP,om as GP,on as YP,oo as KP,op as XP,ed as JP,oq as ZP,or as QP,gt as Em,os as eR,ot as tR,ou as nR,ov as oR,ow as rR,ox as sR,oy as aR,oz as iR,oA as lR,oB as cR,oC as _m,oD as dR,gh as uR,oE as hR,oF as fR,oG as mR,oH as eS,oI as pR,a5 as gR,oJ as xR,Y as bR,f3 as yR,gN as vR,oK as wR,oL as kR,gP as Im,gL as Ss,gQ as vr,gM as wr,gR as Tm,gS as Am,oM as tS,gO as SR,oN as nS,oO as NR,oP as oS,oQ as Jo,oR as rS,gW as jR,oS as CR,oT as ER,oU as _R,oV as IR,oW as TR,oX as AR,oY as sS,eV as MR,oZ as Mm,o_ as OR,aw as Mc,o$ as aS,p0 as iS,ay as lS,ax as DR,ec as PR,__tla as RR}from"./index-iKBZNcSX.js";import{b as Ns,A as LR,L as cS,g as FR,G as zR,o as dS,s as BR,k as UR,B as uS,a as $R,M as VR,Y as HR,c as sn,u as ei,C as WR,S as qR,K as GR,d as YR,i as KR,e as hS,f as XR,h as JR,j as ti,P as ni,l as fS,m as ZR,n as QR,p as eL,D as js,q as tL,r as mS,t as Om,T as nL}from"./links-D6lhrSiS.js";import{V as pS,d as kr,I as Dm,N as gS,S as xS,e as bS,f as yS,L as vS,g as wS,F as kS,M as oL,l as SS,h as rL,E as Pm,i as sL,j as Rm,k as Lm,m as aL,n as iL,o as lL,p as cL,q as dL,s as uL,t as hL,v as fL,a as mL,C as pL,R as NS,A as gL,b as xL,T as bL,w as yL,x as vL,y as wL,z as kL,O as SL,c as NL,P as jL,__tla as CL}from"./storage-Dj3Ir4VQ.js";import{c as EL}from"./_createAggregator-Y0Gl2pnz.js";import{_ as jS,a as CS,i as _L,w as IL,L as ES,A as TL,C as _S,b as Fm,c as IS,__tla as AL}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Ln,i as Zo,T as zm,a as Bm}from"./transform-CDNfLgV5.js";import{g as TS}from"./timer-Bqd5yn_a.js";import{i as ML}from"./zoom-COrs4lFh.js";import{s as oi}from"./sortBy-TfKp930a.js";let Um,Oc,an,Dc,AS,Cs,OL=Promise.all([(()=>{try{return RR}catch{}})(),(()=>{try{return CL}catch{}})(),(()=>{try{return AL}catch{}})()]).then(async()=>{var zl,tk;var At=EL(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,Qt,$m,Pc,Es,Sr,Rc,Lc,Vm,Hm,ri,Fc,Wm,si,qm,zc,Gm,Ym,Bc,Km,Xm,Jm,ai,Zm,Uc,Qm,ep,tp,np,op,rp,$c,sp,Vc,Hc,ap,ip,lp,cp,dp,up,ii,hp,fp,Wc,mp,pp,gp,qc,xp,bp,yp,li,Gc,Yc,vp,wp,kp,Sp,Np,jp,Cp,Ep,_p,Kc,Xc,Ip,Tp,Ap,ci,ln,cn;wt=Ee("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Qt=Ee("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"}]]),$m=Ee("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"}]]),Pc=Ee("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Es=Ee("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Sr=Ee("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"}]]),Rc=Ee("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Lc=Ee("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Dc=Ee("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Vm=Ee("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Hm=Ee("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ri=Ee("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Fc=Ee("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"}]]),Wm=Ee("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"}]]),si=Ee("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"}]]),qm=Ee("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),zc=Ee("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"}]]),Gm=Ee("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"}]]),Ym=Ee("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"}]]),Bc=Ee("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"}]]),Km=Ee("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),Xm=Ee("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"}]]),Jm=Ee("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"}]]),ai=Ee("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"}]]),Zm=Ee("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"}]]),Uc=Ee("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"}]]),Qm=Ee("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"}]]),ep=Ee("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"}]]),tp=Ee("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"}]]),np=Ee("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"}]]),op=Ee("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),rp=Ee("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"}]]),$c=Ee("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"}]]),sp=Ee("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"}]]),Vc=Ee("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"}]]),Hc=Ee("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"}]]),ap=Ee("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"}]]),ip=Ee("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"}]]),lp=Ee("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),cp=Ee("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"}]]),dp=Ee("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),up=Ee("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"}]]),ii=Ee("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"}]]),hp=Ee("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"}]]),fp=Ee("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"}]]),Wc=Ee("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"}]]),mp=Ee("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),pp=Ee("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"}]]),gp=Ee("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"}]]),qc=Ee("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),xp=Ee("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"}]]),bp=Ee("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"}]]),yp=Ee("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"}]]),li=Ee("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"}]]),Gc=Ee("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"}]]),Yc=Ee("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"}]]),vp=Ee("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"}]]),wp=Ee("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),kp=Ee("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"}]]),Sp=Ee("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"}]]),Np=Ee("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),jp=Ee("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"}]]),Cp=Ee("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"}]]),Ep=Ee("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"}]]),_p=Ee("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"}]]),Kc=Ee("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"}]]),Xc=Ee("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"}]]),Ip=Ee("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Tp=Ee("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"}]]),Ap=Ee("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"}]]),ci=Ee("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"}]]),ln=Ee("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"}]]),cn=Ee("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 MS=O.createContext({}),OS=O.forwardRef(function(t,e){[t,e]=q7(t,e,MS);let{toolbarProps:n}=function(s,a){const{"aria-label":i,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=O.useState(!1);V7(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=H7(),m=f==="rtl"&&d==="horizontal";let x=W7(a);const g=O.useRef(null);return{toolbarProps:{...ik(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":i,"aria-labelledby":i==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?x.focusPrevious():x.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?x.focusFirst():x.focusLast())):void 0;m?x.focusNext():x.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=a.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=G7({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=ik(t);return delete r.id,G.createElement("div",{...Of(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function di(t,e){const n=+ur(t)-+ur(e);return n<0?-1:n>0?1:n}function DS(t,e){const n=ur(t,e==null?void 0:e.in);return+function(o,r){const s=ur(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=ur(o,r==null?void 0:r.in),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s}(n,e)}function PS(t,e,n){const[o,r,s]=Df(n==null?void 0:n.in,t,t,e),a=di(r,s),i=Math.abs(function(u,h,f){const[m,x]=Df(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-x.getFullYear())+(m.getMonth()-x.getMonth())}(r,s));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=di(r,s)===-a;DS(o)&&i===1&&di(o,s)===1&&(l=!1);const d=a*(i-+l);return d===0?0:d}function RS(t,e,n){const o=function(r,s){return+ur(r)-+ur(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function LS(t,e){return function(n,o,r){const s=K7(),a=(r==null?void 0:r.locale)??s.locale??X7,i=di(n,o);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:i}),[d,u]=Df(r==null?void 0:r.in,...i>0?[o,n]:[n,o]),h=RS(u,d),f=(lk(u)-lk(d))/1e3,m=Math.round((h-f)/60);let x;if(m<2)return m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<ck){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}if(m<2520)return a.formatDistance("xDays",1,l);if(m<Bl){const g=Math.round(m/ck);return a.formatDistance("xDays",g,l)}if(m<2*Bl)return x=Math.round(m/Bl),a.formatDistance("aboutXMonths",x,l);if(x=PS(u,d),x<12){const g=Math.round(m/Bl);return a.formatDistance("xMonths",g,l)}{const g=x%12,p=Math.trunc(x/12);return g<3?a.formatDistance("aboutXYears",p,l):g<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}(t,function(n){return Y7(n,Date.now())}(t),e)}const ui="https://static.marimo.app",FS=t=>{const e=H.c(24),{onClose:n}=t,[o,r]=O.useState("");let s;s=Math.random().toString(36).slice(2,6);const a=`${o}-${s}`,i=`${ui}/static/${a}`;let l,d,u,h,f,m,x,g,p,b,y;return e[0]!==n||e[1]!==a?(l=async v=>{v.preventDefault(),n();const w=await J7({download:!1,includeCode:!0,files:pS.INSTANCE.filenames()}),S=Xe({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ui}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:a})}).catch(()=>{S.dismiss(),Xe({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:On.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),Xe({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(zo,{children:"Share static notebook"}),e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs(ss,{children:[d,c.jsxs(as,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:ui,target:"_blank",children:ui}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=v=>{const w=v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(w)},e[5]=h):h=e[5],e[6]!==o?(f=c.jsx(Bo,{"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]!==i?(m=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(zS,{text:i}),c.jsx("span",{className:"text-primary",children:i})]})]}),e[8]=i,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=x):x=e[12],e[13]!==n?(g=c.jsx(ke,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==i?(p=c.jsx(ke,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await on(i)},children:"Create"}),e[15]=i,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==x?(y=c.jsx(Uo,{className:"w-fit",children:c.jsxs("form",{onSubmit:l,children:[u,x,b]})}),e[20]=b,e[21]=l,e[22]=x,e[23]=y):y=e[23],y},zS=t=>{const e=H.c(8),[n,o]=G.useState(!1);let r;e[0]!==t.text?(r=Dn.stopPropagation(async d=>{d.preventDefault(),await on(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let a,i,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Ea,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsx(ke,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:a}),e[3]=s,e[4]=i):i=e[4],e[5]!==n||e[6]!==i?(l=c.jsx(je,{content:"Copied!",open:n,children:i}),e[5]=n,e[6]=i,e[7]=l):l=e[7],l};function Mp(){const t=H.c(2),e=St(Pf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const a of Array.from(o)){const i=a.getBoundingClientRect();if(i.top>=0&&i.top<=r||i.bottom>=0&&i.bottom<=r){s=Rf.parse(a.parentNode.id);break}}e(a=>({mode:Z7(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(Rf.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function Jc(t){const e=H.c(3),n=_s();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],ze(o)}function Op(){const t=H.c(2),e=_s();let n;return t[0]!==e?(n=()=>e(dk(mn())),t[0]=e,t[1]=n):n=t[1],ze(n)}function _s(){const t=H.c(2),{prepareForRun:e}=it();let n;return t[0]!==e?(n=async o=>{var i,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=mn(),a=[];for(const d of o){const u=r[d],h=(i=u==null?void 0:u.current)==null?void 0:i.editorView;let f;h?(uk(h)!=="markdown"&&Lf(h),f=hk(h)):f=((l=s[d])==null?void 0:l.code)||"",a.push(f),e({cellId:d})}await e9({cellIds:o,codes:a}).catch(BS)},t[0]=e,t[1]=n):n=t[1],ze(n)}function BS(t){ft.error(t)}const Zc=[{type:"files",Icon:Qm,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Ul,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:$o,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ii,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ns,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Yc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:$l,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:Kc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Ff,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:LR,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:kp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:rp,tooltip:"Secrets",hidden:Zt(),position:"sidebar"},{type:"scratchpad",Icon:t9,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:_a,tooltip:"View errors",position:"footer"}];function US(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(a,i){const l=H.c(11);let d;l[0]!==i?(d=new n9(i),l[0]=i,l[1]=d):d=l[1];const u=d;let h;l[2]!==a||l[3]!==u?(h=()=>u.get(a),l[2]=a,l[3]=u,l[4]=h):h=l[4];const[f,m]=O.useState(h);let x;l[5]!==a||l[6]!==u?(x=b=>{m(b),u.set(a,b)},l[5]=a,l[6]=u,l[7]=x):x=l[7];const g=x;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=a=>{const i=(l=[a,...n],[...new Set(l)]);var l;o(i.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 Dp(t){return t.dropdown!==void 0}function hi(t,e=""){return t.flatMap(n=>n.label?Dp(n)?hi(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Is=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=G.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[a,i]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let d,u;return e[2]!==i||e[3]!==l?(d=c.jsx("div",{className:l,children:i}),e[2]=i,e[3]=l,e[4]=d):d=e[4],e[5]!==a||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[a,d]}),e[5]=a,e[6]=d,e[7]=u):u=e[7],u},Ts=yt(null),$S=yt(!1),Qc=pk("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),VS=yt(t=>{const e=t(Qc);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(Qc,o=>({...o,activeChatId:n}))});function Pp(t){return t!==gk&&!!(t&&t.trim().length>0)}const fi=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=i=>{var l;(i.ctrlKey||i.metaKey)&&i.key==="z"&&(i.preventDefault(),i.stopPropagation(),(l=t.onClick)==null||l.call(t,i))},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],Vl(window,"keydown",n,o);const r=t.children??"Undo";let s,a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(o9,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(a=c.jsxs(ke,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=a):a=e[6],a};function mi(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(et.get(Hl))return;const{cellId:s}=r,a=et.get(Pn),i=(((l=a.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),xk({cellId:s}).catch(()=>{n()}),!i){const{dismiss:d}=Xe({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(fi,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=d}},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function pi(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=async r=>{if(et.get(Hl))return;const{cellIds:s}=r;for(const l of s)await xk({cellId:l}).then(()=>{e({cellId:l})});const{dismiss:a}=Xe({title:"Cells deleted",action:c.jsx(fi,{"data-testid":"undo-delete-button",onClick:()=>{for(const l of s)n();i()}})}),i=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function Rp(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Ia(r.cellId);if(!s)return;const a=hk(s);e(r);const{dismiss:i}=Xe({title:"Cell split",action:c.jsx(fi,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:a}),l()},children:"Undo"})}),l=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function ed(t){const e=H.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:a,sendToTop:i,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=it(),h=Rp(),f=Jc(n==null?void 0:n.cellId),m=!Ie(Hl),x=mi(),{openModal:g}=Nn(),p=St(Ts),b=Ie(Wl),y=Ie(ql),v=Ie(is),w=Ie(r9);if(!n||v){let E;return e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0],E}const{cellId:S,config:N,getEditorView:j,name:C,hasOutput:_,hasConsoleOutput:T,status:I}=n;let P;e[1]!==S||e[2]!==N.disabled||e[3]!==r?(P=async()=>{const E={disabled:!N.disabled};await Vo({configs:{[S]:E}}),r({cellId:S,config:E})},e[1]=S,e[2]=N.disabled,e[3]=r,e[4]=P):P=e[4];const L=P;let M;e[5]!==S||e[6]!==N.hide_code||e[7]!==j||e[8]!==r?(M=async()=>{const E={hide_code:!N.hide_code};await Vo({configs:{[S]:E}}),r({cellId:S,config:E});const U=j();U&&(E.hide_code?U.contentDOM.blur():U.focus())},e[5]=S,e[6]=N.hide_code,e[7]=j,e[8]=r,e[9]=M):M=e[9];const R=M;let z,D,A,k,B;return e[10]===Symbol.for("react.memo_cache_sentinel")?(z=c.jsx(_p,{size:13,strokeWidth:1.5}),e[10]=z):z=e[10],e[11]!==S||e[12]!==C||e[13]!==g||e[14]!==s?(D=()=>{g(c.jsxs(Uo,{children:[c.jsx(ss,{children:c.jsx(zo,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(fr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(gS,{placeholder:"cell name",value:C,onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),E.stopPropagation(),g(null))},onChange:E=>s({cellId:S,name:E})})]})]}))},e[11]=S,e[12]=C,e[13]=g,e[14]=s,e[15]=D):D=e[15],e[16]!==S||e[17]!==s?(A=E=>s({cellId:S,name:E}),e[16]=S,e[17]=s,e[18]=A):A=e[18],e[19]!==C||e[20]!==A?(k=c.jsx(gS,{placeholder:"cell name",value:C,onChange:A}),e[19]=C,e[20]=A,e[21]=k):k=e[21],e[22]!==d||e[23]!==b||e[24]!==w||e[25]!==y||e[26]!==m||e[27]!==S||e[28]!==u||e[29]!==N.disabled||e[30]!==N.hide_code||e[31]!==o||e[32]!==x||e[33]!==j||e[34]!==T||e[35]!==_||e[36]!==a||e[37]!==C||e[38]!==f||e[39]!==l||e[40]!==i||e[41]!==p||e[42]!==h||e[43]!==I||e[44]!==D||e[45]!==k||e[46]!==L||e[47]!==R?(B=[[{icon:z,label:"Name",disableClick:!0,handle:GS,handleHeadless:D,rightElement:k},{icon:c.jsx(kr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:I==="running"||I==="queued"||I==="disabled-transitively"||N.disabled,handle:()=>f()},{icon:c.jsx(Ta,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(E=>(E==null?void 0:E.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:c.jsx(Gc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:S})},{icon:c.jsx(Dm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!_,handle:()=>function(E){const U=document.getElementById(fk.create(E));U&&(U.classList.add("printing-output"),mk(U,"result.png").finally(()=>{U.classList.remove("printing-output")}))}(S)},{icon:c.jsx(yk,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const E=j();E&&bk({[S]:E})}},{icon:N.hide_code?c.jsx(zf,{size:13,strokeWidth:1.5}):c.jsx(Bf,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:R,hotkey:"cell.hideCode"},{icon:N.disabled?c.jsx(ln,{size:13,strokeWidth:1.5}):c.jsx(cn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(Uf,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:L}),handle:L},{icon:c.jsx(_a,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(_||T),handle:()=>{u({cellId:S})}}],[{icon:c.jsx(Gl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const E=j();E&&(qn({autoInstantiate:y,createNewCell:o}),hr(E,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx($o,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const E=j();E&&(qn({autoInstantiate:y,createNewCell:o}),hr(E,{language:"sql",keepCodeAsIs:!1}))}},{icon:c.jsx(Yl,{}),label:"Toggle as Python",handle:()=>{const E=j();E&&(qn({autoInstantiate:y,createNewCell:o}),s9(E,"python",{force:!0}))}}],[{icon:c.jsxs(Is,{children:[c.jsx(ri,{size:13,strokeWidth:1.5}),c.jsx(Kl,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:c.jsxs(Is,{children:[c.jsx(ri,{size:13,strokeWidth:1.5}),c.jsx(vo,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:c.jsx(Kl,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>a({cellId:S,before:!0})},{icon:c.jsx(vo,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>a({cellId:S,before:!1})},{icon:c.jsx(vk,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>a({cellId:S,direction:"left"}),hidden:w!=="columns"},{icon:c.jsx(Aa,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>a({cellId:S,direction:"right"}),hidden:w!=="columns"},{icon:c.jsx(Lc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>i({cellId:S,scroll:!1})},{icon:c.jsx(Rc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S,scroll:!1})},{icon:c.jsx(a9,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>d({cellId:S})}],[{icon:c.jsx(cS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Pp(C),tooltip:Pp(C)?void 0:"Only named cells can be linked to",handle:async()=>{await on(function(E){const U=new URL(window.location.href);return U.hash=`scrollTo=${encodeURIComponent(E)}`,U.toString()}(C)),Xe({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(Xl,{size:13,strokeWidth:1.5}),handle:()=>{x({cellId:S})}}]].map(WS).filter(HS),e[22]=d,e[23]=b,e[24]=w,e[25]=y,e[26]=m,e[27]=S,e[28]=u,e[29]=N.disabled,e[30]=N.hide_code,e[31]=o,e[32]=x,e[33]=j,e[34]=T,e[35]=_,e[36]=a,e[37]=C,e[38]=f,e[39]=l,e[40]=i,e[41]=p,e[42]=h,e[43]=I,e[44]=D,e[45]=k,e[46]=L,e[47]=R,e[48]=B):B=e[48],B}function HS(t){return t.length>0}function WS(t){return t.filter(qS)}function qS(t){return!t.hidden}function GS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function YS(t){return!t.hidden}const td=yt(!1),Lp=()=>{const t=H.c(37),[e,n]=Ot(td),o=l9(),r=Ie(c9),s=Ie(Jl);let a;t[0]!==r?(a={cell:r},t[0]=r,t[1]=a):a=t[1];let i=ed(a).flat();i=hi(i);const l=function(){const A=H.c(73),[k,B]=mr(),[E,U]=wk();let V;A[0]!==B?(V=async Y=>{await pr({config:Y}).then(()=>{B(Y)})},A[0]=B,A[1]=V):V=A[1];const $=V;let K;A[2]!==U?(K=async Y=>{await i9({config:Y}).then(()=>{U(Y)})},A[2]=U,A[3]=K):K=A[3];const X=K;let J;if(A[4]!==E||A[5]!==k||A[6]!==X||A[7]!==$){let Y,oe,se,re,ae;A[9]!==E?(Y=Me=>Me!==E.width,A[9]=E,A[10]=Y):Y=A[10],A[11]!==E||A[12]!==X?(oe=Me=>({label:`App config > Set width=${Me}`,handle:()=>{X({...E,width:Me})}}),A[11]=E,A[12]=X,A[13]=oe):oe=A[13],A[14]!==k||A[15]!==$?(se={label:"Config > Set theme: dark",handle:()=>{$({...k,display:{...k.display,theme:"dark"}})}},A[14]=k,A[15]=$,A[16]=se):se=A[16],A[17]!==k||A[18]!==$?(re={label:"Config > Set theme: light",handle:()=>{$({...k,display:{...k.display,theme:"light"}})}},A[17]=k,A[18]=$,A[19]=re):re=A[19],A[20]!==k||A[21]!==$?(ae={label:"Config > Set theme: system",handle:()=>{$({...k,display:{...k.display,theme:"system"}})}},A[20]=k,A[21]=$,A[22]=ae):ae=A[22];const te=k.keymap.preset==="vim";let be,ye;A[23]!==k||A[24]!==$?(be=()=>{$({...k,keymap:{...k.keymap,preset:"vim"}})},A[23]=k,A[24]=$,A[25]=be):be=A[25],A[26]!==te||A[27]!==be?(ye={label:"Config > Switch keymap to VIM",hidden:te,handle:be},A[26]=te,A[27]=be,A[28]=ye):ye=A[28];const ie=k.keymap.preset==="default";let ve,he,Se;A[29]!==k||A[30]!==$?(ve=()=>{$({...k,keymap:{...k.keymap,preset:"default"}})},A[29]=k,A[30]=$,A[31]=ve):ve=A[31],A[32]!==ie||A[33]!==ve?(he={label:"Config > Switch keymap to default (current: VIM)",hidden:ie,handle:ve},A[32]=ie,A[33]=ve,A[34]=he):he=A[34],A[35]!==k||A[36]!==$?(Se=()=>{$({...k,completion:{...k.completion,copilot:!1}})},A[35]=k,A[36]=$,A[37]=Se):Se=A[37];const De=k.completion.copilot!=="github";let _e,Fe;A[38]!==Se||A[39]!==De?(_e={label:"Config > Disable GitHub Copilot",handle:Se,hidden:De},A[38]=Se,A[39]=De,A[40]=_e):_e=A[40],A[41]!==k||A[42]!==$?(Fe=()=>{$({...k,completion:{...k.completion,copilot:"github"}})},A[41]=k,A[42]=$,A[43]=Fe):Fe=A[43];const Oe=k.completion.copilot==="github";let Qe;A[44]!==Fe||A[45]!==Oe?(Qe={label:"Config > Enable GitHub Copilot",handle:Fe,hidden:Oe},A[44]=Fe,A[45]=Oe,A[46]=Qe):Qe=A[46];const qe=!k.display.reference_highlighting;let Ke,Q,xe,we;A[47]!==k||A[48]!==$?(Ke=()=>{$({...k,display:{...k.display,reference_highlighting:!1}})},A[47]=k,A[48]=$,A[49]=Ke):Ke=A[49],A[50]!==qe||A[51]!==Ke?(Q={label:"Config > Disable reference highlighting",hidden:qe,handle:Ke},A[50]=qe,A[51]=Ke,A[52]=Q):Q=A[52],A[53]!==k||A[54]!==$?(xe=()=>{$({...k,display:{...k.display,reference_highlighting:!0}})},A[53]=k,A[54]=$,A[55]=xe):xe=A[55],A[56]!==k.display.reference_highlighting||A[57]!==xe?(we={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:xe},A[56]=k.display.reference_highlighting,A[57]=xe,A[58]=we):we=A[58];const Te=k.display.cell_output==="above";let W,ne;A[59]!==k||A[60]!==$?(W=()=>{$({...k,display:{...k.display,cell_output:"above"}})},A[59]=k,A[60]=$,A[61]=W):W=A[61],A[62]!==Te||A[63]!==W?(ne={label:"Config > Set cell output area: above",hidden:Te,handle:W},A[62]=Te,A[63]=W,A[64]=ne):ne=A[64];const ue=k.display.cell_output==="below";let de,ge;A[65]!==k||A[66]!==$?(de=()=>{$({...k,display:{...k.display,cell_output:"below"}})},A[65]=k,A[66]=$,A[67]=de):de=A[67],A[68]!==ue||A[69]!==de?(ge={label:"Config > Set cell output area: below",hidden:ue,handle:de},A[68]=ue,A[69]=de,A[70]=ge):ge=A[70],J=[...FR().filter(Y).map(oe),se,re,ae,ye,he,_e,Qe,Q,we,ne,ge],A[4]=E,A[5]=k,A[6]=X,A[7]=$,A[8]=J}else J=A[8];const ee=J;let q;return A[71]!==ee?(q=ee.filter(YS),A[71]=ee,A[72]=q):q=A[72],q}();let d=fg();d=[...hi(d),...hi(l)];const u=d.filter(KS),h=Zl.keyBy(u,XS),{recentCommands:f,addRecentCommand:m}=US();let x;t[2]!==f?(x=new Set(f),t[2]=f,t[3]=x):x=t[3];const g=x;let p,b;t[4]!==s||t[5]!==n?(p=A=>{Hf(s.getHotkey("global.commandPalette").key)(A)&&(A.preventDefault(),n(JS))},t[4]=s,t[5]=n,t[6]=p):p=t[6],Vl(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(A,k)=>{const B=o[A];if(!B)return null;const E=s.getHotkey(A);return c.jsxs(Gn,{disabled:k.disabled,onSelect:()=>{m(A),n(!1),requestAnimationFrame(()=>{B()})},value:E.name,children:[c.jsxs("span",{children:[E.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(Sk,{children:c.jsx(Wf,{shortcut:E.key})})]},A)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=A=>{const{label:k,handle:B,props:E,hotkey:U}=A,V=E===void 0?{}:E;return c.jsxs(Gn,{disabled:V.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[c.jsxs("span",{children:[k,V.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",V.tooltip,")"]})]}),U&&c.jsx(Sk,{children:c.jsx(Wf,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,S=u9;let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(Ma,{placeholder:"Type to search..."}),t[16]=N):N=t[16];const j=Vf;let C;t[17]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(Ql,{children:"No results found."}),t[17]=C):C=t[17];const _=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx($f,{heading:"Recently Used",children:f.map(A=>{const k=h[A];return d9(A)?y(A,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!Dp(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(kk,{})]}),T=$f,I=s.iterate().map(A=>{if(g.has(A))return null;const k=h[A];return y(A,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),P=u.map(A=>g.has(A.label)?null:w({label:A.label,handle:A.handleHeadless||A.handle,props:{disabled:A.disabled,tooltip:A.tooltip}}));let L;t[18]!==g||t[19]!==w?(L=A=>g.has(A.label)?null:w({label:`Cell > ${A.label}`,handle:A.handleHeadless||A.handle,props:{disabled:A.disabled,tooltip:A.tooltip}}),t[18]=g,t[19]=w,t[20]=L):L=t[20];const M=i.map(L);let R,z,D;return t[21]!==T||t[22]!==P||t[23]!==M||t[24]!==I?(R=c.jsxs(T,{heading:"Commands",children:[I,P,M]}),t[21]=T,t[22]=P,t[23]=M,t[24]=I,t[25]=R):R=t[25],t[26]!==j||t[27]!==R||t[28]!==C||t[29]!==_?(z=c.jsxs(j,{children:[C,_,R]}),t[26]=j,t[27]=R,t[28]=C,t[29]=_,t[30]=z):z=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==z||t[35]!==N?(D=c.jsxs(S,{open:e,onOpenChange:n,children:[N,z]}),t[31]=S,t[32]=e,t[33]=n,t[34]=z,t[35]=N,t[36]=D):D=t[36],D};function KS(t){return!t.hotkey}function XS(t){return t.label}function JS(t){return!t}function Qo(){return st().optional().describe(Be.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Fp(){return st().optional().describe(Be.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function gi(){return st().optional().describe(Be.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function zp(){return st().optional().describe(Be.of({label:"URI",optionRegex:".*uri.*"}))}function er(){return st().nonempty().describe(Be.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function Xn(){return st().describe(Be.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function tr(){return st().nonempty().describe(Be.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function nr(t){const e=h9.string().describe(Be.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 Bp(){return ls().default(!1).describe(Be.of({label:"Read Only"}))}const Up=dt({type:mt("postgres"),host:er(),port:nr(5432).optional(),database:Xn(),username:tr(),password:Qo(),ssl:ls().default(!1).describe(Be.of({label:"Use SSL"}))}).describe(Be.of({direction:"two-columns"})),$p=dt({type:mt("mysql"),host:er(),port:nr(3306),database:Xn(),username:tr(),password:Qo(),ssl:ls().default(!1).describe(Be.of({label:"Use SSL"}))}).describe(Be.of({direction:"two-columns"})),Vp=dt({type:mt("sqlite"),database:Xn().describe(Be.of({label:"Database Path"}))}).describe(Be.of({direction:"two-columns"})),Hp=dt({type:mt("duckdb"),database:Xn().describe(Be.of({label:"Database Path"})),read_only:Bp()}).describe(Be.of({direction:"two-columns"})),Wp=dt({type:mt("motherduck"),database:Xn().default("my_db").describe(Be.of({label:"Database Name"})),token:Fp()}).describe(Be.of({direction:"two-columns"})),qp=dt({type:mt("snowflake"),account:st().nonempty().describe(Be.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:st().optional().describe(Be.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:Xn(),schema:st().optional().describe(Be.of({label:"Schema",optionRegex:".*snowflake.*"})),username:tr(),password:Qo(),role:st().optional().describe(Be.of({label:"Role"}))}).describe(Be.of({direction:"two-columns"})),Gp=dt({type:mt("bigquery"),project:st().nonempty().describe(Be.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:st().nonempty().describe(Be.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:st().describe(Be.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Be.of({direction:"two-columns"})),Yp=dt({type:mt("clickhouse_connect"),host:er(),port:nr(8123).optional(),username:tr(),password:Qo(),secure:ls().default(!1).describe(Be.of({label:"Use HTTPs"}))}).describe(Be.of({direction:"two-columns"})),Kp=dt({type:mt("timeplus"),host:er().default("localhost"),port:nr(8123).optional(),username:tr().default("default"),password:Qo().default("")}).describe(Be.of({direction:"two-columns"})),Xp=dt({type:mt("chdb"),database:Xn().describe(Be.of({label:"Database Path"})),read_only:Bp()}).describe(Be.of({direction:"two-columns"})),Jp=dt({type:mt("trino"),host:er(),port:nr(8080),database:Xn(),schema:st().describe(Be.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:tr(),password:Qo(),async_support:ls().default(!1).describe(Be.of({label:"Async Support"}))}).describe(Be.of({direction:"two-columns"})),Zp=dt({type:mt("iceberg"),name:st().describe(Be.of({label:"Catalog Name"})),catalog:qf("type",[dt({type:mt("REST"),warehouse:gi(),uri:st().optional().describe(Be.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Fp()}),dt({type:mt("SQL"),warehouse:gi(),uri:st().optional().describe(Be.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),dt({type:mt("Hive"),warehouse:gi(),uri:zp()}),dt({type:mt("Glue"),warehouse:gi(),uri:zp()}),dt({type:mt("DynamoDB"),"dynamodb.profile-name":st().optional().describe(Be.of({label:"Profile Name"})),"dynamodb.region":st().optional().describe(Be.of({label:"Region"})),"dynamodb.access-key-id":st().optional().describe(Be.of({label:"Access Key ID"})),"dynamodb.secret-access-key":st().optional().describe(Be.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":st().optional().describe(Be.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Be.of({special:"tabs"}))}),Qp=dt({type:mt("datafusion"),sessionContext:ls().optional().describe(Be.of({label:"Use Session Context"}))}),eg=dt({type:mt("pyspark"),host:er().optional(),port:nr().optional()}),tg=dt({type:mt("redshift"),host:er(),port:nr(5439),connectionType:qf("type",[dt({type:mt("IAM credentials"),region:st().describe(Be.of({label:"Region"})),aws_access_key_id:st().nonempty().describe(Be.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:st().nonempty().describe(Be.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:st().optional().describe(Be.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),dt({type:mt("DB credentials"),user:tr(),password:Qo()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:Xn()}).describe(Be.of({direction:"two-columns"})),ZS=qf("type",[Up,$p,Vp,Hp,Wp,qp,Gp,Yp,Kp,Xp,Jp,Zp,Qp,eg,tg]),nd="env:";function xi(t){return typeof t=="string"&&t.startsWith(nd)}function od(t){return`${nd}${t}`}const ng={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class qt{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 QS{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),xi(n)){const r=n.replace(nd,""),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"?Nr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Nr(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 xi(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 eN extends qt{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),a=this.secrets.printInFString("database",this.connection.database);return pt(`
|
4
4
|
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${a}"
|
5
5
|
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
@@ -144,5 +144,5 @@ ${T}
|
|
144
144
|
`)}),includeOtherCode:gc("")}),onFinish:T=>{e(I=>Iu(I,I.activeChatId,T.id,"assistant",T.content,T.parts))},onToolCall:async({toolCall:T})=>{try{const I=await IP({toolName:T.toolName,arguments:T.args});return I.result||I.error}catch(I){return ft.error("Tool call failed:",I),`Error: ${I instanceof Error?I.message:String(I)}`}},onError:T=>{ft.error("An error occurred:",T)},onResponse:T=>{ft.debug("Received HTTP response from server:",T)}}),N=v==="submitted"||v==="streaming";O.useEffect(()=>{if(!t.activeChatId||f.length===0)return;const T=f[f.length-1];if((T==null?void 0:T.role)!=="user")return;const I=t.chats.find(M=>M.id===t.activeChatId);if(!I)return;const P=new Set(I.messages.map(M=>M.id)),L=f.filter(M=>M.role==="user"&&!P.has(M.id));L.length>0&&e(M=>{let R=M;for(const z of L)R=Iu(R,M.activeChatId,z.id,"user",z.content);return R})},[f,t.activeChatId,t.chats,e]);const j=N&&f.length>0&&(T=>{if(T.length===0)return!1;const I=T.at(-1);if(!I||I.role!=="assistant"||!I.parts)return!1;const P=I.parts;return P.length===0?!1:P[P.length-1].type==="reasoning"})(f);O.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const T=l.current;T.scrollTop=T.scrollHeight}})},[t.activeChatId]);const C=(T,I)=>{g(P=>P.slice(0,T)),t.activeChatId&&e(P=>({...P,chats:P.chats.map(L=>L.id===t.activeChatId?{...L,messages:L.messages.slice(0,T),updatedAt:Date.now()}:L)})),p({role:"user",content:I})},_=()=>{r.trim()&&(T=>{const I=Date.now(),P={id:U3(),title:T.length>50?`${T.slice(0,50)}...`:T,messages:[],createdAt:I,updatedAt:I};e(M=>({...M,chats:[...M.chats,P],activeChatId:P.id}));const L=U3();p({id:L,role:"user",content:T}),x("")})(r.trim())};return c.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[c.jsx(vm,{children:c.jsx(d8,{onNewChat:()=>{o(null),x(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((T,I)=>I.updatedAt-T.updatedAt)})}),c.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&c.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[c.jsx("div",{className:"px-1",children:c.jsx(kc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:()=>{var T,I;return(I=(T=a.current)==null?void 0:T.editor)==null?void 0:I.blur()},onChange:s,onSubmit:_},"new-thread-input")}),c.jsx(ch,{input:r,onSendClick:_,isLoading:N,onStop:S})]}),f.map((T,I)=>c.jsx(Hy,{message:T,index:I,theme:u,onEdit:C,setChatState:e,chatState:t,isStreamingReasoning:j,totalMessages:f.length},I)),N&&c.jsx("div",{className:"flex justify-center py-4",children:c.jsx(Sc,{className:"h-4 w-4 animate-spin"})}),y&&c.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[c.jsx(yr,{error:y}),c.jsx(ke,{variant:"outline",size:"sm",onClick:()=>{w()},children:"Retry"})]}),c.jsx("div",{ref:d})]}),N&&c.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:c.jsx(ke,{variant:"linkDestructive",size:"sm",onClick:S,children:"Stop"})}),f&&f.length>0&&c.jsx(Wy,{input:m,setInput:x,onSubmit:(T,I)=>{I.trim()&&b(T)},theme:u,inputRef:i,isLoading:N,onStop:S})]})};function f8(){}function m8(){}function p8(t){return c.jsx(cs,{value:t.value,className:"text-xs",subtitle:c.jsx("div",{className:"text-muted-foreground text-xs pl-2",children:t.subtitle}),children:t.label},t.value)}function g8(t){return c.jsx(cs,{value:t,className:"text-sm",children:t},t)}function Xt(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=Xt(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:x8}=G,{useSyncExternalStoreWithSelector:b8}=MP,y8=t=>t;function qy(t,e=y8,n){const o=b8(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return x8(o),o}const Gy=(t,e)=>{const n=OP(t),o=(r,s=e)=>qy(n,r,s);return Object.assign(o,n),o};function Ht(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 Hn(t,e){if(t=function(s){let a;for(;a=s.sourceEvent;)s=a;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 v8={passive:!1},ma={capture:!0,passive:!1};function dh(t){t.stopImmediatePropagation()}function qr(t){t.preventDefault(),t.stopImmediatePropagation()}function Yy(t){var e=t.document.documentElement,n=Ln(t).on("dragstart.drag",qr,ma);"onselectstart"in e?n.on("selectstart.drag",qr,ma):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ky(t,e){var n=t.document.documentElement,o=Ln(t).on("dragstart.drag",null);e&&(o.on("click.drag",qr,ma),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const jl=t=>()=>t;function uh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:a,y:i,dx:l,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}function w8(t){return!t.ctrlKey&&!t.button}function k8(){return this.parentNode}function S8(t,e){return e??{x:t.x,y:t.y}}function N8(){return navigator.maxTouchPoints||"ontouchstart"in this}uh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Cl=t=>()=>t;function j8(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 hh(t){t.stopImmediatePropagation()}function pa(t){t.preventDefault(),t.stopImmediatePropagation()}function C8(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function E8(){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 Xy(){return this.__zoom||Zo}function _8(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function I8(){return navigator.maxTouchPoints||"ontouchstart"in this}function T8(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],a=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}const El=O.createContext(null),A8=El.Provider,M8=t=>`Node type "${t}" not found. Using fallback type "default".`,O8=()=>"The React Flow parent container needs a width and a height to render the graph.",D8=()=>"Only child nodes can use a parent extent.",P8=t=>`Marker type "${t}" doesn't exist.`,R8=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,L8=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",F8=t=>`Edge type "${t}" not found. Using fallback type "default".`,z8=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.`,Jy="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function at(t,e){const n=O.useContext(El);if(n===null)throw new Error(Jy);return qy(n,t,e)}const zt=()=>{const t=O.useContext(El);if(t===null)throw new Error(Jy);return O.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},B8=t=>t.userSelectionActive?"none":"all";function _l({position:t,children:e,className:n,style:o,...r}){const s=at(B8),a=`${t}`.split("-");return G.createElement("div",{className:Xt(["react-flow__panel",n,...a]),style:{...o,pointerEvents:s},...r},e)}function U8({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:G.createElement(_l,{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"},G.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var $8=O.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:a=[2,4],labelBgBorderRadius:i=2,children:l,className:d,...u})=>{const h=O.useRef(null),[f,m]=O.useState({x:0,y:0,width:0,height:0}),x=Xt(["react-flow__edge-textwrapper",d]);return O.useEffect(()=>{if(h.current){const g=h.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?G.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:x,visibility:f.width?"visible":"hidden",...u},r&&G.createElement("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:i,ry:i}),G.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const fh=t=>({width:t.offsetWidth,height:t.offsetHeight}),Gr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),mh=(t={x:0,y:0},e)=>({x:Gr(t.x,e[0][0],e[1][0]),y:Gr(t.y,e[0][1],e[1][1])}),Zy=(t,e,n)=>t<e?Gr(Math.abs(t-e),1,50)/50:t>n?-Gr(Math.abs(t-n),1,50)/50:0,Qy=(t,e)=>[20*Zy(t.x,35,e.width-35),20*Zy(t.y,35,e.height-35)],ev=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},ph=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),tv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),gh=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},wn=t=>!isNaN(t)&&isFinite(t),xt=Symbol.for("internals"),nv=["Enter"," ","Escape"];function xh(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 ov=t=>"clientX"in t,Oo=(t,e)=>{var s,a;const n=ov(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(a=t.touches)==null?void 0:a[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Il=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},ga=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m=20})=>G.createElement(G.Fragment,null,G.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&G.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&wn(n)&&wn(o)?G.createElement($8,{x:n,y:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d}):null);function xa(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function rv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,a=Math.abs(o-e)/2;return[s,o<e?o+a:o-a,r,a]}function sv({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:i}){const l=.125*t+.375*r+.375*a+.125*n,d=.125*e+.375*s+.375*i+.125*o;return[l,d,Math.abs(l-t),Math.abs(d-e)]}var cr,av,Do,bh,ba,iv,Po,ya,Yr,lv,Pe,Tl;function cv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Pe.Left||t===Pe.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function dv({sourceX:t,sourceY:e,sourcePosition:n=Pe.Bottom,targetX:o,targetY:r,targetPosition:s=Pe.Top}){const[a,i]=cv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,d]=cv({pos:s,x1:o,y1:r,x2:t,y2:e}),[u,h,f,m]=sv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${i} ${l},${d} ${o},${r}`,u,h,f,m]}ga.displayName="BaseEdge",(av=cr||(cr={})).Strict="strict",av.Loose="loose",(bh=Do||(Do={})).Free="free",bh.Vertical="vertical",bh.Horizontal="horizontal",(iv=ba||(ba={})).Partial="partial",iv.Full="full",(ya=Po||(Po={})).Bezier="default",ya.Straight="straight",ya.Step="step",ya.SmoothStep="smoothstep",ya.SimpleBezier="simplebezier",(lv=Yr||(Yr={})).Arrow="arrow",lv.ArrowClosed="arrowclosed",(Tl=Pe||(Pe={})).Left="left",Tl.Top="top",Tl.Right="right",Tl.Bottom="bottom";const yh=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Pe.Bottom,targetPosition:s=Pe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})=>{const[p,b,y]=dv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return G.createElement(ga,{path:p,labelX:b,labelY:y,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})});yh.displayName="SimpleBezierEdge";const uv={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},hv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function V8({source:t,sourcePosition:e=Pe.Bottom,target:n,targetPosition:o=Pe.Top,center:r,offset:s}){const a=uv[e],i=uv[o],l={x:t.x+a.x*s,y:t.y+a.y*s},d={x:n.x+i.x*s,y:n.y+i.y*s},u=(({source:N,sourcePosition:j=Pe.Bottom,target:C})=>j===Pe.Left||j===Pe.Right?N.x<C.x?{x:1,y:0}:{x:-1,y:0}:N.y<C.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:d}),h=u.x!==0?"x":"y",f=u[h];let m,x,g=[];const p={x:0,y:0},b={x:0,y:0},[y,v,w,S]=rv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[h]*i[h]===-1){m=r.x??y,x=r.y??v;const N=[{x:m,y:l.y},{x:m,y:d.y}],j=[{x:l.x,y:x},{x:d.x,y:x}];g=a[h]===f?h==="x"?N:j:h==="x"?j:N}else{const N=[{x:l.x,y:d.y}],j=[{x:d.x,y:l.y}];if(g=h==="x"?a.x===f?j:N:a.y===f?N:j,e===o){const T=Math.abs(t[h]-n[h]);if(T<=s){const I=Math.min(s-1,s-T);a[h]===f?p[h]=(l[h]>t[h]?-1:1)*I:b[h]=(d[h]>n[h]?-1:1)*I}}if(e!==o){const T=h==="x"?"y":"x",I=a[h]===i[T],P=l[T]>d[T],L=l[T]<d[T];(a[h]===1&&(!I&&P||I&&L)||a[h]!==1&&(!I&&L||I&&P))&&(g=h==="x"?N:j)}const C={x:l.x+p.x,y:l.y+p.y},_={x:d.x+b.x,y:d.y+b.y};Math.max(Math.abs(C.x-g[0].x),Math.abs(_.x-g[0].x))>=Math.max(Math.abs(C.y-g[0].y),Math.abs(_.y-g[0].y))?(m=(C.x+_.x)/2,x=g[0].y):(m=g[0].x,x=(C.y+_.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:d.x+b.x,y:d.y+b.y},n],m,x,w,S]}function vh({sourceX:t,sourceY:e,sourcePosition:n=Pe.Bottom,targetX:o,targetY:r,targetPosition:s=Pe.Top,borderRadius:a=5,centerX:i,centerY:l,offset:d=20}){const[u,h,f,m,x]=V8({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:i,y:l},offset:d});return[u.reduce((g,p,b)=>{let y="";return y=b>0&&b<u.length-1?function(v,w,S,N){const j=Math.min(hv(v,w)/2,hv(w,S)/2,N),{x:C,y:_}=w;if(v.x===C&&C===S.x||v.y===_&&_===S.y)return`L${C} ${_}`;if(v.y===_)return`L ${C+j*(v.x<S.x?-1:1)},${_}Q ${C},${_} ${C},${_+j*(v.y<S.y?1:-1)}`;const T=v.x<S.x?1:-1;return`L ${C},${_+j*(v.y<S.y?-1:1)}Q ${C},${_} ${C+j*T},${_}`}(u[b-1],p,u[b+1],a):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=y},""),h,f,m,x]}const Al=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,sourcePosition:h=Pe.Bottom,targetPosition:f=Pe.Top,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=vh({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 G.createElement(ga,{path:b,labelX:y,labelY:v,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:m,markerStart:x,interactionWidth:p})});Al.displayName="SmoothStepEdge";const wh=O.memo(t=>{var e;return G.createElement(Al,{...t,pathOptions:O.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});wh.displayName="StepEdge";const kh=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[x,g,p]=function({sourceX:b,sourceY:y,targetX:v,targetY:w}){const[S,N,j,C]=rv({sourceX:b,sourceY:y,targetX:v,targetY:w});return[`M ${b},${y}L ${v},${w}`,S,N,j,C]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return G.createElement(ga,{path:x,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})});function Ml(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function fv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Pe.Left:return[e-Ml(e-o,s),n];case Pe.Right:return[e+Ml(o-e,s),n];case Pe.Top:return[e,n-Ml(n-r,s)];case Pe.Bottom:return[e,n+Ml(r-n,s)]}}function mv({sourceX:t,sourceY:e,sourcePosition:n=Pe.Bottom,targetX:o,targetY:r,targetPosition:s=Pe.Top,curvature:a=.25}){const[i,l]=fv({pos:n,x1:t,y1:e,x2:o,y2:r,c:a}),[d,u]=fv({pos:s,x1:o,y1:r,x2:t,y2:e,c:a}),[h,f,m,x]=sv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:d,targetControlY:u});return[`M${t},${e} C${i},${l} ${d},${u} ${o},${r}`,h,f,m,x]}kh.displayName="StraightEdge";const Ol=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Pe.Bottom,targetPosition:s=Pe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=mv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return G.createElement(ga,{path:b,labelX:y,labelY:v,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:p})});Ol.displayName="BezierEdge";const Sh=O.createContext(null),H8=Sh.Provider;Sh.Consumer;const W8=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Nh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,jh=({x:t,y:e},[n,o,r],s,[a,i])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:a*Math.round(l.x/a),y:i*Math.round(l.y/i)}:l},pv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),Kr=(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}},Ch=(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:a}=Kr(r,e).positionAbsolute;return i=o,l=ph({x:s,y:a,width:r.width||0,height:r.height||0}),{x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x2,l.x2),y2:Math.max(i.y2,l.y2)};var i,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:a})=>({x:o,y:r,width:s-o,height:a-r}))(n)},gv=(t,e,[n,o,r]=[0,0,1],s=!1,a=!1,i=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},d=[];return t.forEach(u=>{const{width:h,height:f,selectable:m=!0,hidden:x=!1}=u;if(a&&!m||x)return!1;const{positionAbsolute:g}=Kr(u,i),p={x:g.x,y:g.y,width:h||0,height:f||0},b=gh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||u.dragging)&&d.push(u)}),d},xv=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},bv=(t,e,n,o,r,s=.1)=>{const a=e/(t.width*(1+s)),i=n/(t.height*(1+s)),l=Math.min(a,i),d=Gr(l,o,r);return{x:e/2-(t.x+t.width/2)*d,y:n/2-(t.y+t.height/2)*d,zoom:d}},dr=(t,e=0)=>t.transition().duration(e);function yv(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var a,i;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((a=t.positionAbsolute)==null?void 0:a.x)??0)+s.x+s.width/2,y:(((i=t.positionAbsolute)==null?void 0:i.y)??0)+s.y+s.height/2}),r},[])}const q8={source:null,target:null,sourceHandle:null,targetHandle:null},vv=()=>({handleDomNode:null,isValid:!1,connection:q8,endHandle:null});function wv(t,e,n,o,r,s,a){const i=r==="target",l=a.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),d={...vv(),handleDomNode:l};if(l){const u=Eh(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),x=l.classList.contains("connectableend"),g={source:i?h:n,sourceHandle:i?f:o,target:i?n:h,targetHandle:i?o:f};d.connection=g,m&&x&&(e===cr.Strict?i&&u==="source"||!i&&u==="target":h!==n||f!==o)&&(d.endHandle={nodeId:h,handleId:f,type:u},d.isValid=s(g))}return d}function Eh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function _h(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function G8(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function kv({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:a,isValidConnection:i,edgeUpdaterType:l,onReconnectEnd:d}){const u=ev(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:x,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:y}=s();let v,w=0;const{x:S,y:N}=Oo(t),j=u==null?void 0:u.elementFromPoint(S,N),C=Eh(l,j),_=f==null?void 0:f.getBoundingClientRect();if(!_||!C)return;let T,I=Oo(t,_),P=!1,L=null,M=!1,R=null;const z=function({nodes:B,nodeId:E,handleId:U,handleType:V}){return B.reduce(($,K)=>{if(K[xt]){const{handleBounds:X}=K[xt];let J=[],ee=[];X&&(J=yv(K,X,"source",`${E}-${U}-${V}`),ee=yv(K,X,"target",`${E}-${U}-${V}`)),$.push(...J,...ee)}return $},[])}({nodes:b(),nodeId:n,handleId:e,handleType:C}),D=()=>{if(!m)return;const[B,E]=Qy(I,_);p({x:B,y:E}),w=requestAnimationFrame(D)};function A(B){const{transform:E}=s();I=Oo(B,_);const{handle:U,validHandleResult:V}=function($,K,X,J,ee,q){const{x:Y,y:oe}=Oo($),se=K.elementsFromPoint(Y,oe).find(ye=>ye.classList.contains("react-flow__handle"));if(se){const ye=se.getAttribute("data-nodeid");if(ye){const ie=Eh(void 0,se),ve=se.getAttribute("data-handleid"),he=q({nodeId:ye,id:ve,type:ie});if(he){const Se=ee.find(De=>De.nodeId===ye&&De.type===ie&&De.id===ve);return{handle:{id:ve,type:ie,nodeId:ye,x:(Se==null?void 0:Se.x)||X.x,y:(Se==null?void 0:Se.y)||X.y},validHandleResult:he}}}}let re=[],ae=1/0;if(ee.forEach(ye=>{const ie=Math.sqrt((ye.x-X.x)**2+(ye.y-X.y)**2);if(ie<=J){const ve=q(ye);ie<=ae&&(ie<ae?re=[{handle:ye,validHandleResult:ve}]:ie===ae&&re.push({handle:ye,validHandleResult:ve}),ae=ie)}}),!re.length)return{handle:null,validHandleResult:vv()};if(re.length===1)return re[0];const te=re.some(({validHandleResult:ye})=>ye.isValid),be=re.some(({handle:ye})=>ye.type==="target");return re.find(({handle:ye,validHandleResult:ie})=>be?ye.type==="target":!te||ie.isValid)||re[0]}(B,u,jh(I,E,!1,[1,1]),x,z,$=>wv($,h,n,e,r?"target":"source",i,u));if(v=U,P||(D(),P=!0),R=V.handleDomNode,L=V.connection,M=V.isValid,a({connectionPosition:v&&M?pv({x:v.x,y:v.y},E):I,connectionStatus:G8(!!v,M),connectionEndHandle:V.endHandle}),!v&&!M&&!R)return _h(T);L.source!==L.target&&R&&(_h(T),T=R,R.classList.add("connecting","react-flow__handle-connecting"),R.classList.toggle("valid",M),R.classList.toggle("react-flow__handle-valid",M))}function k(B){var E,U;(v||R)&&L&&M&&(o==null||o(L)),(U=(E=s()).onConnectEnd)==null||U.call(E,B),l&&(d==null||d(B)),_h(T),y(),cancelAnimationFrame(w),P=!1,M=!1,L=null,R=null,u.removeEventListener("mousemove",A),u.removeEventListener("mouseup",k),u.removeEventListener("touchmove",A),u.removeEventListener("touchend",k)}a({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:e,type:C},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:C}),u.addEventListener("mousemove",A),u.addEventListener("mouseup",k),u.addEventListener("touchmove",A),u.addEventListener("touchend",k)}const Sv=()=>!0,Y8=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Nv=O.forwardRef(({type:t="source",position:e=Pe.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:i,children:l,className:d,onMouseDown:u,onTouchStart:h,...f},m)=>{var C,_;const x=a||null,g=t==="target",p=zt(),b=O.useContext(Sh),{connectOnClick:y,noPanClassName:v}=at(Y8,Ht),{connecting:w,clickConnecting:S}=at(((T,I,P)=>L=>{const{connectionStartHandle:M,connectionEndHandle:R,connectionClickStartHandle:z}=L;return{connecting:(M==null?void 0:M.nodeId)===T&&(M==null?void 0:M.handleId)===I&&(M==null?void 0:M.type)===P||(R==null?void 0:R.nodeId)===T&&(R==null?void 0:R.handleId)===I&&(R==null?void 0:R.type)===P,clickConnecting:(z==null?void 0:z.nodeId)===T&&(z==null?void 0:z.handleId)===I&&(z==null?void 0:z.type)===P}})(b,x,t),Ht);b||((_=(C=p.getState()).onError)==null||_.call(C,"010",L8()));const N=T=>{const{defaultEdgeOptions:I,onConnect:P,hasDefaultEdges:L}=p.getState(),M={...I,...T};if(L){const{edges:R,setEdges:z}=p.getState();z(((D,A)=>{if(!D.source||!D.target)return A;let k;return k=(B=>"id"in B&&"source"in B&&"target"in B)(D)?{...D}:{...D,id:W8(D)},((B,E)=>E.some(U=>!(U.source!==B.source||U.target!==B.target||U.sourceHandle!==B.sourceHandle&&(U.sourceHandle||B.sourceHandle)||U.targetHandle!==B.targetHandle&&(U.targetHandle||B.targetHandle))))(k,A)?A:A.concat(k)})(M,R))}P==null||P(M),i==null||i(M)},j=T=>{if(!b)return;const I=ov(T);r&&(I&&T.button===0||!I)&&kv({event:T,handleId:x,nodeId:b,onConnect:N,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||Sv}),I?u==null||u(T):h==null||h(T)};return G.createElement("div",{"data-handleid":x,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${x}-${t}`,className:Xt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,d,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:S,connectionindicator:o&&(r&&!w||s&&w)}]),onMouseDown:j,onTouchStart:j,onClick:y?T=>{const{onClickConnectStart:I,onClickConnectEnd:P,connectionClickStartHandle:L,connectionMode:M,isValidConnection:R}=p.getState();if(!b||!L&&!r)return;if(!L)return I==null||I(T,{nodeId:b,handleId:x,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:x}});const z=ev(T.target),D=n||R||Sv,{connection:A,isValid:k}=wv({nodeId:b,id:x,type:t},M,L.nodeId,L.handleId||null,L.type,D,z);k&&N(A),P==null||P(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});Nv.displayName="Handle";var Ro=O.memo(Nv);const jv=({data:t,isConnectable:e,targetPosition:n=Pe.Top,sourcePosition:o=Pe.Bottom})=>G.createElement(G.Fragment,null,G.createElement(Ro,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,G.createElement(Ro,{type:"source",position:o,isConnectable:e}));jv.displayName="DefaultNode";var Ih=O.memo(jv);const Cv=({data:t,isConnectable:e,sourcePosition:n=Pe.Bottom})=>G.createElement(G.Fragment,null,t==null?void 0:t.label,G.createElement(Ro,{type:"source",position:n,isConnectable:e}));Cv.displayName="InputNode";var Ev=O.memo(Cv);const _v=({data:t,isConnectable:e,targetPosition:n=Pe.Top})=>G.createElement(G.Fragment,null,G.createElement(Ro,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);_v.displayName="OutputNode";var Iv=O.memo(_v);const Th=()=>null;Th.displayName="GroupNode";const K8=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Dl=t=>t.id;function X8(t,e){return Ht(t.selectedNodes.map(Dl),e.selectedNodes.map(Dl))&&Ht(t.selectedEdges.map(Dl),e.selectedEdges.map(Dl))}const Tv=O.memo(({onSelectionChange:t})=>{const e=zt(),{selectedNodes:n,selectedEdges:o}=at(K8,X8);return O.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});Tv.displayName="SelectionListener";const J8=t=>!!t.onSelectionChange;function Z8({onSelectionChange:t}){const e=at(J8);return t||e?G.createElement(Tv,{onSelectionChange:t}):null}const Q8=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 Xr(t,e){O.useEffect(()=>{t!==void 0&&e(t)},[t])}function Ze(t,e,n){O.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const eT=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:a,onClickConnectStart:i,onClickConnectEnd:l,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:x,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:v,elementsSelectable:w,connectionMode:S,snapGrid:N,snapToGrid:j,translateExtent:C,connectOnClick:_,defaultEdgeOptions:T,fitView:I,fitViewOptions:P,onNodesDelete:L,onEdgesDelete:M,onNodeDrag:R,onNodeDragStart:z,onNodeDragStop:D,onSelectionDrag:A,onSelectionDragStart:k,onSelectionDragStop:B,noPanClassName:E,nodeOrigin:U,rfId:V,autoPanOnConnect:$,autoPanOnNodeDrag:K,onError:X,connectionRadius:J,isValidConnection:ee,nodeDragThreshold:q})=>{const{setNodes:Y,setEdges:oe,setDefaultNodesAndEdges:se,setMinZoom:re,setMaxZoom:ae,setTranslateExtent:te,setNodeExtent:be,reset:ye}=at(Q8,Ht),ie=zt();return O.useEffect(()=>{const ve=o==null?void 0:o.map(he=>({...he,...T}));return se(n,ve),()=>{ye()}},[]),Ze("defaultEdgeOptions",T,ie.setState),Ze("connectionMode",S,ie.setState),Ze("onConnect",r,ie.setState),Ze("onConnectStart",s,ie.setState),Ze("onConnectEnd",a,ie.setState),Ze("onClickConnectStart",i,ie.setState),Ze("onClickConnectEnd",l,ie.setState),Ze("nodesDraggable",d,ie.setState),Ze("nodesConnectable",u,ie.setState),Ze("nodesFocusable",h,ie.setState),Ze("edgesFocusable",f,ie.setState),Ze("edgesUpdatable",m,ie.setState),Ze("elementsSelectable",w,ie.setState),Ze("elevateNodesOnSelect",x,ie.setState),Ze("snapToGrid",j,ie.setState),Ze("snapGrid",N,ie.setState),Ze("onNodesChange",y,ie.setState),Ze("onEdgesChange",v,ie.setState),Ze("connectOnClick",_,ie.setState),Ze("fitViewOnInit",I,ie.setState),Ze("fitViewOnInitOptions",P,ie.setState),Ze("onNodesDelete",L,ie.setState),Ze("onEdgesDelete",M,ie.setState),Ze("onNodeDrag",R,ie.setState),Ze("onNodeDragStart",z,ie.setState),Ze("onNodeDragStop",D,ie.setState),Ze("onSelectionDrag",A,ie.setState),Ze("onSelectionDragStart",k,ie.setState),Ze("onSelectionDragStop",B,ie.setState),Ze("noPanClassName",E,ie.setState),Ze("nodeOrigin",U,ie.setState),Ze("rfId",V,ie.setState),Ze("autoPanOnConnect",$,ie.setState),Ze("autoPanOnNodeDrag",K,ie.setState),Ze("onError",X,ie.setState),Ze("connectionRadius",J,ie.setState),Ze("isValidConnection",ee,ie.setState),Ze("nodeDragThreshold",q,ie.setState),Xr(t,Y),Xr(e,oe),Xr(g,re),Xr(p,ae),Xr(C,te),Xr(b,be),null},Av={display:"none"},tT={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mv="react-flow__node-desc",Ov="react-flow__edge-desc",nT=t=>t.ariaLiveMessage;function oT({rfId:t}){const e=at(nT);return G.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:tT},e)}function rT({rfId:t,disableKeyboardA11y:e}){return G.createElement(G.Fragment,null,G.createElement("div",{id:`${Mv}-${t}`,style:Av},"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."," "),G.createElement("div",{id:`${Ov}-${t}`,style:Av},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&G.createElement(oT,{rfId:t}))}var va=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=O.useState(!1),r=O.useRef(!1),s=O.useRef(new Set([])),[a,i]=O.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.split("+")),d=l.reduce((u,h)=>u.concat(...h),[]);return[l,d]}return[[],[]]},[t]);return O.useEffect(()=>{const l=typeof document<"u"?document:null,d=(e==null?void 0:e.target)||l;if(t!==null){const u=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&xh(m))return!1;const x=Pv(m.code,i);s.current.add(m[x]),Dv(a,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&xh(m))return!1;const x=Pv(m.code,i);Dv(a,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[x]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return d==null||d.addEventListener("keydown",u),d==null||d.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{d==null||d.removeEventListener("keydown",u),d==null||d.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function Dv(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function Pv(t,e){return e.includes(t)?"code":"key"}function Rv(t,e,n,o){var i,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),a=Kr(s,o);return Rv(s,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(((i=s[xt])==null?void 0:i.z)??0)>(n.z??0)?((l=s[xt])==null?void 0:l.z)??0:n.z??0},o)}function Lv(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:a,y:i,z:l}=Rv(o,t,{...o.position,z:((s=o[xt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:a,y:i},o[xt].z=l,n!=null&&n[o.id]&&(o[xt].isParent=!0)}})}function Ah(t,e,n,o){const r=new Map,s={},a=o?1e3:0;return t.forEach(i=>{var m;const l=(wn(i.zIndex)?i.zIndex:0)+(i.selected?a:0),d=e.get(i.id),u={...i,positionAbsolute:{x:i.position.x,y:i.position.y}},h=i.parentNode||i.parentId;h&&(s[h]=!0);const f=(d==null?void 0:d.type)&&(d==null?void 0:d.type)!==i.type;Object.defineProperty(u,xt,{enumerable:!1,value:{handleBounds:f||(m=d==null?void 0:d[xt])==null?void 0:m.handleBounds,z:l}}),r.set(i.id,u)}),Lv(r,n,s),r}function Fv(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:a,d3Zoom:i,d3Selection:l,fitViewOnInitDone:d,fitViewOnInit:u,nodeOrigin:h}=t(),f=e.initial&&!d&&u;if(i&&l&&(f||!e.initial)){const m=n().filter(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(y=>y.id===g.id):p}),x=m.every(g=>g.width&&g.height);if(m.length>0&&x){const g=Ch(m,h),{x:p,y:b,zoom:y}=bv(g,o,r,e.minZoom??s,e.maxZoom??a,e.padding??.1),v=Zo.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?i.transform(dr(l,e.duration),v):i.transform(l,v),!0}}return!1}function sT(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[xt]:o[xt],selected:n.selected})}),new Map(e)}function aT(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Pl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:a,onEdgesChange:i,hasDefaultNodes:l,hasDefaultEdges:d}=n();t!=null&&t.length&&(l&&o({nodeInternals:sT(t,r)}),a==null||a(t)),e!=null&&e.length&&(d&&o({edges:aT(e,s)}),i==null||i(e))}const Jr=()=>{},iT={zoomIn:Jr,zoomOut:Jr,zoomTo:Jr,getZoom:()=>1,setViewport:Jr,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Jr,fitBounds:Jr,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},lT=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function wa(){const t=(()=>{const g=zt(),{d3Zoom:p,d3Selection:b}=at(lT,Ht);return O.useMemo(()=>b&&p?{zoomIn:v=>p.scaleBy(dr(b,v==null?void 0:v.duration),1.2),zoomOut:v=>p.scaleBy(dr(b,v==null?void 0:v.duration),1/1.2),zoomTo:(v,w)=>p.scaleTo(dr(b,w==null?void 0:w.duration),v),getZoom:()=>g.getState().transform[2],setViewport:(v,w)=>{const[S,N,j]=g.getState().transform,C=Zo.translate(v.x??S,v.y??N).scale(v.zoom??j);p.transform(dr(b,w==null?void 0:w.duration),C)},getViewport:()=>{const[v,w,S]=g.getState().transform;return{x:v,y:w,zoom:S}},fitView:v=>Fv(g.getState,v),setCenter:(v,w,S)=>{const{width:N,height:j,maxZoom:C}=g.getState(),_=(S==null?void 0:S.zoom)!==void 0?S.zoom:C,T=N/2-v*_,I=j/2-w*_,P=Zo.translate(T,I).scale(_);p.transform(dr(b,S==null?void 0:S.duration),P)},fitBounds:(v,w)=>{const{width:S,height:N,minZoom:j,maxZoom:C}=g.getState(),{x:_,y:T,zoom:I}=bv(v,S,N,j,C,(w==null?void 0:w.padding)??.1),P=Zo.translate(_,T).scale(I);p.transform(dr(b,w==null?void 0:w.duration),P)},project:v=>{const{transform:w,snapToGrid:S,snapGrid:N}=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"),jh(v,w,S,N)},screenToFlowPosition:v=>{const{transform:w,snapToGrid:S,snapGrid:N,domNode:j}=g.getState();if(!j)return v;const{x:C,y:_}=j.getBoundingClientRect(),T={x:v.x-C,y:v.y-_};return jh(T,w,S,N)},flowToScreenPosition:v=>{const{transform:w,domNode:S}=g.getState();if(!S)return v;const{x:N,y:j}=S.getBoundingClientRect(),C=pv(v,w);return{x:C.x+N,y:C.y+j}},viewportInitialized:!0}:iT,[p,b])})(),e=zt(),n=O.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=O.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=O.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=O.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),a=O.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:v}=e.getState(),w=p(),S=typeof g=="function"?g(w):g;if(y)b(S);else if(v){const N=S.length===0?w.map(j=>({type:"remove",id:j.id})):S.map(j=>({item:j,type:"reset"}));v(N)}},[]),i=O.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:v}=e.getState(),w=typeof g=="function"?g(p):g;y?b(w):v&&v(w.length===0?p.map(S=>({type:"remove",id:S.id})):w.map(S=>({item:S,type:"reset"})))},[]),l=O.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:v,onNodesChange:w}=e.getState();if(v)y([...b(),...p]);else if(w){const S=p.map(N=>({item:N,type:"add"}));w(S)}},[]),d=O.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:v,onEdgesChange:w}=e.getState();v?y([...b,...p]):w&&w(p.map(S=>({item:S,type:"add"})))},[]),u=O.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[y,v,w]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x:y,y:v,zoom:w}}},[]),h=O.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:v,hasDefaultNodes:w,hasDefaultEdges:S,onNodesDelete:N,onEdgesDelete:j,onNodesChange:C,onEdgesChange:_}=e.getState(),T=(g||[]).map(R=>R.id),I=(p||[]).map(R=>R.id),P=y().reduce((R,z)=>{const D=z.parentNode||z.parentId,A=!T.includes(z.id)&&D&&R.find(k=>k.id===D);return(typeof z.deletable!="boolean"||z.deletable)&&(T.includes(z.id)||A)&&R.push(z),R},[]),L=v.filter(R=>typeof R.deletable!="boolean"||R.deletable),M=L.filter(R=>I.includes(R.id));if(P||M){const R=xv(P,L),z=[...M,...R],D=z.reduce((A,k)=>(A.includes(k.id)||A.push(k.id),A),[]);(S||w)&&(S&&e.setState({edges:v.filter(A=>!D.includes(A.id))}),w&&(P.forEach(A=>{b.delete(A.id)}),e.setState({nodeInternals:new Map(b)}))),D.length>0&&(j==null||j(z),_&&_(D.map(A=>({id:A,type:"remove"})))),P.length>0&&(N==null||N(P),C)&&C(P.map(A=>({id:A.id,type:"remove"})))}},[]),f=O.useCallback(g=>{const p=wn((b=g).width)&&wn(b.height)&&wn(b.x)&&wn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(g.id);return!p&&!y?[null,null,p]:[p?g:tv(y),y,p]},[]),m=O.useCallback((g,p=!0,b)=>{const[y,v,w]=f(g);return y?(b||e.getState().getNodes()).filter(S=>{if(!(w||S.id!==v.id&&S.positionAbsolute))return!1;const N=tv(S),j=gh(N,y);return p&&j>0||j>=y.width*y.height}):[]},[]),x=O.useCallback((g,p,b=!0)=>{const[y]=f(g);if(!y)return!1;const v=gh(y,p);return b&&v>0||v>=y.width*y.height},[]);return O.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:a,setEdges:i,addNodes:l,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:x}),[t,n,o,r,s,a,i,l,d,u,h,m,x])}const cT={actInsideInputWithModifier:!1},Mh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Rl=t=>({x:t.x,y:t.y,zoom:t.k}),Zr=(t,e)=>t.target.closest(`.${e}`),zv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Bv=t=>{const e=t.ctrlKey&&Il()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},dT=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),uT=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:a=!1,panOnScrollSpeed:i=.5,panOnScrollMode:l=Do.Free,zoomOnDoubleClick:d=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:x,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:v,noPanClassName:w})=>{const S=O.useRef(),N=zt(),j=O.useRef(!1),C=O.useRef(!1),_=O.useRef(null),T=O.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:P,d3ZoomHandler:L,userSelectionActive:M}=at(dT,Ht),R=va(p),z=O.useRef(0),D=O.useRef(!1),A=O.useRef();return function(k){const B=zt();O.useEffect(()=>{let E;const U=()=>{var $,K;if(!k.current)return;const V=fh(k.current);V.height!==0&&V.width!==0||((K=($=B.getState()).onError)==null||K.call($,"004",O8())),B.setState({width:V.width||500,height:V.height||500})};return U(),window.addEventListener("resize",U),k.current&&(E=new ResizeObserver(()=>U()),E.observe(k.current)),()=>{window.removeEventListener("resize",U),E&&k.current&&E.unobserve(k.current)}},[])}(_),O.useEffect(()=>{if(_.current){const k=_.current.getBoundingClientRect(),B=function(){var K,X,J,ee=C8,q=E8,Y=T8,oe=_8,se=I8,re=[0,1/0],ae=[[-1/0,-1/0],[1/0,1/0]],te=250,be=ML,ye=TS("start","zoom","end"),ie=0,ve=10;function he(W){W.property("__zoom",Xy).on("wheel.zoom",qe,{passive:!1}).on("mousedown.zoom",Ke).on("dblclick.zoom",Q).filter(se).on("touchstart.zoom",xe).on("touchmove.zoom",we).on("touchend.zoom touchcancel.zoom",Te).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Se(W,ne){return(ne=Math.max(re[0],Math.min(re[1],ne)))===W.k?W:new zm(ne,W.x,W.y)}function De(W,ne,ue){var de=ne[0]-ue[0]*W.k,ge=ne[1]-ue[1]*W.k;return de===W.x&&ge===W.y?W:new zm(W.k,de,ge)}function _e(W){return[(+W[0][0]+ +W[1][0])/2,(+W[0][1]+ +W[1][1])/2]}function Fe(W,ne,ue,de){W.on("start.zoom",function(){Oe(this,arguments).event(de).start()}).on("interrupt.zoom end.zoom",function(){Oe(this,arguments).event(de).end()}).tween("zoom",function(){var ge=this,Me=arguments,Re=Oe(ge,Me).event(de),He=q.apply(ge,Me),le=ue==null?_e(He):typeof ue=="function"?ue.apply(ge,Me):ue,Ne=Math.max(He[1][0]-He[0][0],He[1][1]-He[0][1]),Ce=ge.__zoom,Le=typeof ne=="function"?ne.apply(ge,Me):ne,Ve=be(Ce.invert(le).concat(Ne/Ce.k),Le.invert(le).concat(Ne/Le.k));return function(Ae){if(Ae===1)Ae=Le;else{var Ue=Ve(Ae),Je=Ne/Ue[2];Ae=new zm(Je,le[0]-Ue[0]*Je,le[1]-Ue[1]*Je)}Re.zoom(null,Ae)}})}function Oe(W,ne,ue){return!ue&&W.__zooming||new Qe(W,ne)}function Qe(W,ne){this.that=W,this.args=ne,this.active=0,this.sourceEvent=null,this.extent=q.apply(W,ne),this.taps=0}function qe(W,...ne){if(ee.apply(this,arguments)){var ue=Oe(this,ne).event(W),de=this.__zoom,ge=Math.max(re[0],Math.min(re[1],de.k*Math.pow(2,oe.apply(this,arguments)))),Me=Hn(W);if(ue.wheel)ue.mouse[0][0]===Me[0]&&ue.mouse[0][1]===Me[1]||(ue.mouse[1]=de.invert(ue.mouse[0]=Me)),clearTimeout(ue.wheel);else{if(de.k===ge)return;ue.mouse=[Me,de.invert(Me)],Bm(this),ue.start()}pa(W),ue.wheel=setTimeout(function(){ue.wheel=null,ue.end()},150),ue.zoom("mouse",Y(De(Se(de,ge),ue.mouse[0],ue.mouse[1]),ue.extent,ae))}}function Ke(W,...ne){if(!J&&ee.apply(this,arguments)){var ue=W.currentTarget,de=Oe(this,ne,!0).event(W),ge=Ln(W.view).on("mousemove.zoom",function(le){if(pa(le),!de.moved){var Ne=le.clientX-Re,Ce=le.clientY-He;de.moved=Ne*Ne+Ce*Ce>ie}de.event(le).zoom("mouse",Y(De(de.that.__zoom,de.mouse[0]=Hn(le,ue),de.mouse[1]),de.extent,ae))},!0).on("mouseup.zoom",function(le){ge.on("mousemove.zoom mouseup.zoom",null),Ky(le.view,de.moved),pa(le),de.event(le).end()},!0),Me=Hn(W,ue),Re=W.clientX,He=W.clientY;Yy(W.view),hh(W),de.mouse=[Me,this.__zoom.invert(Me)],Bm(this),de.start()}}function Q(W,...ne){if(ee.apply(this,arguments)){var ue=this.__zoom,de=Hn(W.changedTouches?W.changedTouches[0]:W,this),ge=ue.invert(de),Me=ue.k*(W.shiftKey?.5:2),Re=Y(De(Se(ue,Me),de,ge),q.apply(this,ne),ae);pa(W),te>0?Ln(this).transition().duration(te).call(Fe,Re,de,W):Ln(this).call(he.transform,Re,de,W)}}function xe(W,...ne){if(ee.apply(this,arguments)){var ue,de,ge,Me,Re=W.touches,He=Re.length,le=Oe(this,ne,W.changedTouches.length===He).event(W);for(hh(W),de=0;de<He;++de)Me=[Me=Hn(ge=Re[de],this),this.__zoom.invert(Me),ge.identifier],le.touch0?le.touch1||le.touch0[2]===Me[2]||(le.touch1=Me,le.taps=0):(le.touch0=Me,ue=!0,le.taps=1+!!K);K&&(K=clearTimeout(K)),ue&&(le.taps<2&&(X=Me[0],K=setTimeout(function(){K=null},500)),Bm(this),le.start())}}function we(W,...ne){if(this.__zooming){var ue,de,ge,Me,Re=Oe(this,ne).event(W),He=W.changedTouches,le=He.length;for(pa(W),ue=0;ue<le;++ue)ge=Hn(de=He[ue],this),Re.touch0&&Re.touch0[2]===de.identifier?Re.touch0[0]=ge:Re.touch1&&Re.touch1[2]===de.identifier&&(Re.touch1[0]=ge);if(de=Re.that.__zoom,Re.touch1){var Ne=Re.touch0[0],Ce=Re.touch0[1],Le=Re.touch1[0],Ve=Re.touch1[1],Ae=(Ae=Le[0]-Ne[0])*Ae+(Ae=Le[1]-Ne[1])*Ae,Ue=(Ue=Ve[0]-Ce[0])*Ue+(Ue=Ve[1]-Ce[1])*Ue;de=Se(de,Math.sqrt(Ae/Ue)),ge=[(Ne[0]+Le[0])/2,(Ne[1]+Le[1])/2],Me=[(Ce[0]+Ve[0])/2,(Ce[1]+Ve[1])/2]}else{if(!Re.touch0)return;ge=Re.touch0[0],Me=Re.touch0[1]}Re.zoom("touch",Y(De(de,ge,Me),Re.extent,ae))}}function Te(W,...ne){if(this.__zooming){var ue,de,ge=Oe(this,ne).event(W),Me=W.changedTouches,Re=Me.length;for(hh(W),J&&clearTimeout(J),J=setTimeout(function(){J=null},500),ue=0;ue<Re;++ue)de=Me[ue],ge.touch0&&ge.touch0[2]===de.identifier?delete ge.touch0:ge.touch1&&ge.touch1[2]===de.identifier&&delete ge.touch1;if(ge.touch1&&!ge.touch0&&(ge.touch0=ge.touch1,delete ge.touch1),ge.touch0)ge.touch0[1]=this.__zoom.invert(ge.touch0[0]);else if(ge.end(),ge.taps===2&&(de=Hn(de,this),Math.hypot(X[0]-de[0],X[1]-de[1])<ve)){var He=Ln(this).on("dblclick.zoom");He&&He.apply(this,arguments)}}}return he.transform=function(W,ne,ue,de){var ge=W.selection?W.selection():W;ge.property("__zoom",Xy),W!==ge?Fe(W,ne,ue,de):ge.interrupt().each(function(){Oe(this,arguments).event(de).start().zoom(null,typeof ne=="function"?ne.apply(this,arguments):ne).end()})},he.scaleBy=function(W,ne,ue,de){he.scaleTo(W,function(){return this.__zoom.k*(typeof ne=="function"?ne.apply(this,arguments):ne)},ue,de)},he.scaleTo=function(W,ne,ue,de){he.transform(W,function(){var ge=q.apply(this,arguments),Me=this.__zoom,Re=ue==null?_e(ge):typeof ue=="function"?ue.apply(this,arguments):ue,He=Me.invert(Re),le=typeof ne=="function"?ne.apply(this,arguments):ne;return Y(De(Se(Me,le),Re,He),ge,ae)},ue,de)},he.translateBy=function(W,ne,ue,de){he.transform(W,function(){return Y(this.__zoom.translate(typeof ne=="function"?ne.apply(this,arguments):ne,typeof ue=="function"?ue.apply(this,arguments):ue),q.apply(this,arguments),ae)},null,de)},he.translateTo=function(W,ne,ue,de,ge){he.transform(W,function(){var Me=q.apply(this,arguments),Re=this.__zoom,He=de==null?_e(Me):typeof de=="function"?de.apply(this,arguments):de;return Y(Zo.translate(He[0],He[1]).scale(Re.k).translate(typeof ne=="function"?-ne.apply(this,arguments):-ne,typeof ue=="function"?-ue.apply(this,arguments):-ue),Me,ae)},de,ge)},Qe.prototype={event:function(W){return W&&(this.sourceEvent=W),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(W,ne){return this.mouse&&W!=="mouse"&&(this.mouse[1]=ne.invert(this.mouse[0])),this.touch0&&W!=="touch"&&(this.touch0[1]=ne.invert(this.touch0[0])),this.touch1&&W!=="touch"&&(this.touch1[1]=ne.invert(this.touch1[0])),this.that.__zoom=ne,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(W){var ne=Ln(this.that).datum();ye.call(W,this.that,new j8(W,{sourceEvent:this.sourceEvent,target:he,transform:this.that.__zoom,dispatch:ye}),ne)}},he.wheelDelta=function(W){return arguments.length?(oe=typeof W=="function"?W:Cl(+W),he):oe},he.filter=function(W){return arguments.length?(ee=typeof W=="function"?W:Cl(!!W),he):ee},he.touchable=function(W){return arguments.length?(se=typeof W=="function"?W:Cl(!!W),he):se},he.extent=function(W){return arguments.length?(q=typeof W=="function"?W:Cl([[+W[0][0],+W[0][1]],[+W[1][0],+W[1][1]]]),he):q},he.scaleExtent=function(W){return arguments.length?(re[0]=+W[0],re[1]=+W[1],he):[re[0],re[1]]},he.translateExtent=function(W){return arguments.length?(ae[0][0]=+W[0][0],ae[1][0]=+W[1][0],ae[0][1]=+W[0][1],ae[1][1]=+W[1][1],he):[[ae[0][0],ae[0][1]],[ae[1][0],ae[1][1]]]},he.constrain=function(W){return arguments.length?(Y=W,he):Y},he.duration=function(W){return arguments.length?(te=+W,he):te},he.interpolate=function(W){return arguments.length?(be=W,he):be},he.on=function(){var W=ye.on.apply(ye,arguments);return W===ye?he:W},he.clickDistance=function(W){return arguments.length?(ie=(W=+W)*W,he):Math.sqrt(ie)},he.tapDistance=function(W){return arguments.length?(ve=+W,he):ve},he}().scaleExtent([x,g]).translateExtent(m),E=Ln(_.current).call(B),U=Zo.translate(f.x,f.y).scale(Gr(f.zoom,x,g)),V=[[0,0],[k.width,k.height]],$=B.constrain()(U,V,m);B.transform(E,$),B.wheelDelta(Bv),N.setState({d3Zoom:B,d3Selection:E,d3ZoomHandler:E.on("wheel.zoom"),transform:[$.x,$.y,$.k],domNode:_.current.closest(".react-flow")})}},[]),O.useEffect(()=>{P&&I&&(!a||R||M?L!==void 0&&P.on("wheel.zoom",function(k,B){if(!b&&k.type==="wheel"&&!k.ctrlKey||Zr(k,v))return null;k.preventDefault(),L.call(this,k,B)},{passive:!1}):P.on("wheel.zoom",k=>{if(Zr(k,v))return!1;k.preventDefault(),k.stopImmediatePropagation();const B=P.property("__zoom").k||1;if(k.ctrlKey&&s){const ee=Hn(k),q=Bv(k),Y=B*Math.pow(2,q);return void I.scaleTo(P,Y,ee,k)}const E=k.deltaMode===1?20:1;let U=l===Do.Vertical?0:k.deltaX*E,V=l===Do.Horizontal?0:k.deltaY*E;!Il()&&k.shiftKey&&l!==Do.Vertical&&(U=k.deltaY*E,V=0),I.translateBy(P,-U/B*i,-V/B*i,{internal:!0});const $=Rl(P.property("__zoom")),{onViewportChangeStart:K,onViewportChange:X,onViewportChangeEnd:J}=N.getState();clearTimeout(A.current),D.current||(D.current=!0,e==null||e(k,$),K==null||K($)),D.current&&(t==null||t(k,$),X==null||X($),A.current=setTimeout(()=>{n==null||n(k,$),J==null||J($),D.current=!1},150))},{passive:!1}))},[M,a,l,P,I,L,R,s,b,v,e,t,n]),O.useEffect(()=>{I&&I.on("start",k=>{var U,V;if(!k.sourceEvent||k.sourceEvent.internal)return null;z.current=(U=k.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:B}=N.getState(),E=Rl(k.transform);j.current=!0,T.current=E,((V=k.sourceEvent)==null?void 0:V.type)==="mousedown"&&N.setState({paneDragging:!0}),B==null||B(E),e==null||e(k.sourceEvent,E)})},[I,e]),O.useEffect(()=>{I&&(M&&!j.current?I.on("zoom",null):M||I.on("zoom",k=>{var E;const{onViewportChange:B}=N.getState();if(N.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),C.current=!(!o||!zv(h,z.current??0)),(t||B)&&!((E=k.sourceEvent)!=null&&E.internal)){const U=Rl(k.transform);B==null||B(U),t==null||t(k.sourceEvent,U)}}))},[M,I,t,h,o]),O.useEffect(()=>{I&&I.on("end",k=>{if(!k.sourceEvent||k.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=N.getState();if(j.current=!1,N.setState({paneDragging:!1}),o&&zv(h,z.current??0)&&!C.current&&o(k.sourceEvent),C.current=!1,(n||B)&&(E=T.current,U=k.transform,E.x!==U.x||E.y!==U.y||E.zoom!==U.k)){const V=Rl(k.transform);T.current=V,clearTimeout(S.current),S.current=setTimeout(()=>{B==null||B(V),n==null||n(k.sourceEvent,V)},a?150:0)}var E,U})},[I,a,h,n,o]),O.useEffect(()=>{I&&I.filter(k=>{const B=R||r,E=s&&k.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&k.button===1&&k.type==="mousedown"&&(Zr(k,"react-flow__node")||Zr(k,"react-flow__edge")))return!0;if(!(h||B||a||d||s)||M||!d&&k.type==="dblclick"||Zr(k,v)&&k.type==="wheel"||Zr(k,w)&&(k.type!=="wheel"||a&&k.type==="wheel"&&!R)||!s&&k.ctrlKey&&k.type==="wheel"||!B&&!a&&!E&&k.type==="wheel"||!h&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(h)&&!h.includes(k.button)&&k.type==="mousedown")return!1;const U=Array.isArray(h)&&h.includes(k.button)||!k.button||k.button<=1;return(!k.ctrlKey||k.type==="wheel")&&U})},[M,I,r,s,a,d,h,u,R]),G.createElement("div",{className:"react-flow__renderer",ref:_,style:Mh},y)},hT=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function fT(){const{userSelectionActive:t,userSelectionRect:e}=at(hT,Ht);return t&&e?G.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 Uv(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 a=Math.abs(e.position.x);o.position.x=o.position.x-a,o.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);o.position.y=o.position.y-a,o.style.height+=a,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function $v(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(i=>i.id===r.id);if(s.length===0)return o.push(r),o;const a={...r};for(const i of s)if(i)switch(i.type){case"select":a.selected=i.selected;break;case"position":i.position!==void 0&&(a.position=i.position),i.positionAbsolute!==void 0&&(a.positionAbsolute=i.positionAbsolute),i.dragging!==void 0&&(a.dragging=i.dragging),a.expandParent&&Uv(o,a);break;case"dimensions":i.dimensions!==void 0&&(a.width=i.dimensions.width,a.height=i.dimensions.height),i.updateStyle!==void 0&&(a.style={...a.style||{},...i.dimensions}),typeof i.resizing=="boolean"&&(a.resizing=i.resizing),a.expandParent&&Uv(o,a);break;case"remove":return o}return o.push(a),o},n)}function Vv(t,e){return $v(t,e)}const Lo=(t,e)=>({id:t,type:"select",selected:e});function Qr(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Lo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Lo(o.id,!1))),n},[])}const Oh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},mT=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Hv=O.memo(({isSelecting:t,selectionMode:e=ba.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:a,onPaneScroll:i,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:u,children:h})=>{const f=O.useRef(null),m=zt(),x=O.useRef(0),g=O.useRef(0),p=O.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:v}=at(mT,Ht),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,g.current=0},S=C=>{s==null||s(C),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},N=i?C=>i(C):void 0,j=y&&(t||b);return G.createElement("div",{className:Xt(["react-flow__pane",{dragging:v,selection:t}]),onClick:j?void 0:Oh(S,f),onContextMenu:Oh(C=>{Array.isArray(n)&&(n!=null&&n.includes(2))?C.preventDefault():a==null||a(C)},f),onWheel:Oh(N,f),onMouseEnter:j?void 0:l,onMouseDown:j?C=>{const{resetSelectedElements:_,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!y||!t||C.button!==0||C.target!==f.current||!p.current)return;const{x:I,y:P}=Oo(C,p.current);_(),m.setState({userSelectionRect:{width:0,height:0,startX:I,startY:P,x:I,y:P}}),o==null||o(C)}:void 0,onMouseMove:j?C=>{const{userSelectionRect:_,nodeInternals:T,edges:I,transform:P,onNodesChange:L,onEdgesChange:M,nodeOrigin:R,getNodes:z}=m.getState();if(!t||!p.current||!_)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const D=Oo(C,p.current),A=_.startX??0,k=_.startY??0,B={..._,x:D.x<A?D.x:A,y:D.y<k?D.y:k,width:Math.abs(D.x-A),height:Math.abs(D.y-k)},E=z(),U=gv(T,B,P,e===ba.Partial,!0,R),V=xv(U,I).map(K=>K.id),$=U.map(K=>K.id);if(x.current!==$.length){x.current=$.length;const K=Qr(E,$);K.length&&(L==null||L(K))}if(g.current!==V.length){g.current=V.length;const K=Qr(I,V);K.length&&(M==null||M(K))}m.setState({userSelectionRect:B})}:d,onMouseUp:j?C=>{if(C.button!==0)return;const{userSelectionRect:_}=m.getState();!b&&_&&C.target===f.current&&(S==null||S(C)),m.setState({nodesSelectionActive:x.current>0}),w(),r==null||r(C)}:void 0,onMouseLeave:j?C=>{b&&(m.setState({nodesSelectionActive:x.current>0}),r==null||r(C)),w()}:u,ref:f,style:Mh},h,G.createElement(fT,null))});function Wv(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Wv(o,e))}function qv(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 pT(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Wv(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,a;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-(((a=r.positionAbsolute)==null?void 0:a.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 Gv(t,e,n,o,r=[0,0],s){const a=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 i=a;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:m}=Kr(h,r).positionAbsolute;i=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=Kr(h,r).positionAbsolute;i=h&&wn(f)&&wn(m)&&wn(h.width)&&wn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:i}else s==null||s("005",D8()),i=a;let d={x:0,y:0};if(l){const h=n.get(l);d=Kr(h,r).positionAbsolute}const u=i&&i!=="parent"?mh(e,i):e;return{position:{x:u.x-d.x,y:u.y-d.y},positionAbsolute:u}}function Dh({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]}Hv.displayName="Pane";const Yv=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),a=e.getBoundingClientRect(),i=a.width*o[0],l=a.height*o[1];return s.map(d=>{const u=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(u.left-a.left-i)/n,y:(u.top-a.top-l)/n,...fh(d)}})};function ka(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function Ph({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeInternals:i,onError:l}=e.getState(),d=i.get(t);d?(e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([t])):l==null||l("012",z8(t))}function Rh(t){return(e,n,o)=>t==null?void 0:t(e,o)}function Kv({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:a}){const i=zt(),[l,d]=O.useState(!1),u=O.useRef([]),h=O.useRef({x:null,y:null}),f=O.useRef(0),m=O.useRef(null),x=O.useRef({x:0,y:0}),g=O.useRef(null),p=O.useRef(!1),b=O.useRef(!1),y=O.useRef(!1),v=function(){const w=zt();return O.useCallback(({sourceEvent:N})=>{const{transform:j,snapGrid:C,snapToGrid:_}=w.getState(),T=N.touches?N.touches[0].clientX:N.clientX,I=N.touches?N.touches[0].clientY:N.clientY,P={x:(T-j[0])/j[2],y:(I-j[1])/j[2]};return{xSnapped:_?C[0]*Math.round(P.x/C[0]):P.x,ySnapped:_?C[1]*Math.round(P.y/C[1]):P.y,...P}},[])}();return O.useEffect(()=>{if(t!=null&&t.current){const w=Ln(t.current),S=({x:C,y:_})=>{const{nodeInternals:T,onNodeDrag:I,onSelectionDrag:P,updateNodePositions:L,nodeExtent:M,snapGrid:R,snapToGrid:z,nodeOrigin:D,onError:A}=i.getState();h.current={x:C,y:_};let k=!1,B={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&M){const U=Ch(u.current,D);B=ph(U)}if(u.current=u.current.map(U=>{const V={x:C-U.distance.x,y:_-U.distance.y};z&&(V.x=R[0]*Math.round(V.x/R[0]),V.y=R[1]*Math.round(V.y/R[1]));const $=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];u.current.length>1&&M&&!U.extent&&($[0][0]=U.positionAbsolute.x-B.x+M[0][0],$[1][0]=U.positionAbsolute.x+(U.width??0)-B.x2+M[1][0],$[0][1]=U.positionAbsolute.y-B.y+M[0][1],$[1][1]=U.positionAbsolute.y+(U.height??0)-B.y2+M[1][1]);const K=Gv(U,V,T,$,D,A);return k=k||U.position.x!==K.position.x||U.position.y!==K.position.y,U.position=K.position,U.positionAbsolute=K.positionAbsolute,U}),!k)return;L(u.current,!0,!0),d(!0);const E=r?I:Rh(P);if(E&&g.current){const[U,V]=Dh({nodeId:r,dragItems:u.current,nodeInternals:T});E(g.current,U,V)}},N=()=>{if(!m.current)return;const[C,_]=Qy(x.current,m.current);if(C!==0||_!==0){const{transform:T,panBy:I}=i.getState();h.current.x=(h.current.x??0)-C/T[2],h.current.y=(h.current.y??0)-_/T[2],I({x:C,y:_})&&S(h.current)}f.current=requestAnimationFrame(N)},j=C=>{var D;const{nodeInternals:_,multiSelectionActive:T,nodesDraggable:I,unselectNodesAndEdges:P,onNodeDragStart:L,onSelectionDragStart:M}=i.getState();b.current=!0;const R=r?L:Rh(M);a&&s||T||!r||(D=_.get(r))!=null&&D.selected||P(),r&&s&&a&&Ph({id:r,store:i,nodeRef:t});const z=v(C);if(h.current=z,u.current=pT(_,I,z,r),R&&u.current){const[A,k]=Dh({nodeId:r,dragItems:u.current,nodeInternals:_});R(C.sourceEvent,A,k)}};if(!e){const C=function(){var _,T,I,P,L=w8,M=k8,R=S8,z=N8,D={},A=TS("start","drag","end"),k=0,B=0;function E(q){q.on("mousedown.drag",U).filter(z).on("touchstart.drag",K).on("touchmove.drag",X,v8).on("touchend.drag touchcancel.drag",J).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U(q,Y){if(!P&&L.call(this,q,Y)){var oe=ee(this,M.call(this,q,Y),q,Y,"mouse");oe&&(Ln(q.view).on("mousemove.drag",V,ma).on("mouseup.drag",$,ma),Yy(q.view),dh(q),I=!1,_=q.clientX,T=q.clientY,oe("start",q))}}function V(q){if(qr(q),!I){var Y=q.clientX-_,oe=q.clientY-T;I=Y*Y+oe*oe>B}D.mouse("drag",q)}function $(q){Ln(q.view).on("mousemove.drag mouseup.drag",null),Ky(q.view,I),qr(q),D.mouse("end",q)}function K(q,Y){if(L.call(this,q,Y)){var oe,se,re=q.changedTouches,ae=M.call(this,q,Y),te=re.length;for(oe=0;oe<te;++oe)(se=ee(this,ae,q,Y,re[oe].identifier,re[oe]))&&(dh(q),se("start",q,re[oe]))}}function X(q){var Y,oe,se=q.changedTouches,re=se.length;for(Y=0;Y<re;++Y)(oe=D[se[Y].identifier])&&(qr(q),oe("drag",q,se[Y]))}function J(q){var Y,oe,se=q.changedTouches,re=se.length;for(P&&clearTimeout(P),P=setTimeout(function(){P=null},500),Y=0;Y<re;++Y)(oe=D[se[Y].identifier])&&(dh(q),oe("end",q,se[Y]))}function ee(q,Y,oe,se,re,ae){var te,be,ye,ie=A.copy(),ve=Hn(ae||oe,Y);if((ye=R.call(q,new uh("beforestart",{sourceEvent:oe,target:E,identifier:re,active:k,x:ve[0],y:ve[1],dx:0,dy:0,dispatch:ie}),se))!=null)return te=ye.x-ve[0]||0,be=ye.y-ve[1]||0,function he(Se,De,_e){var Fe,Oe=ve;switch(Se){case"start":D[re]=he,Fe=k++;break;case"end":delete D[re],--k;case"drag":ve=Hn(_e||De,Y),Fe=k}ie.call(Se,q,new uh(Se,{sourceEvent:De,subject:ye,target:E,identifier:re,active:Fe,x:ve[0]+te,y:ve[1]+be,dx:ve[0]-Oe[0],dy:ve[1]-Oe[1],dispatch:ie}),se)}}return E.filter=function(q){return arguments.length?(L=typeof q=="function"?q:jl(!!q),E):L},E.container=function(q){return arguments.length?(M=typeof q=="function"?q:jl(q),E):M},E.subject=function(q){return arguments.length?(R=typeof q=="function"?q:jl(q),E):R},E.touchable=function(q){return arguments.length?(z=typeof q=="function"?q:jl(!!q),E):z},E.on=function(){var q=A.on.apply(A,arguments);return q===A?E:q},E.clickDistance=function(q){return arguments.length?(B=(q=+q)*q,E):Math.sqrt(B)},E}().on("start",_=>{const{domNode:T,nodeDragThreshold:I}=i.getState();I===0&&j(_),y.current=!1;const P=v(_);h.current=P,m.current=(T==null?void 0:T.getBoundingClientRect())||null,x.current=Oo(_.sourceEvent,m.current)}).on("drag",_=>{var L,M;const T=v(_),{autoPanOnNodeDrag:I,nodeDragThreshold:P}=i.getState();if(_.sourceEvent.type==="touchmove"&&_.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&I&&(p.current=!0,N()),!b.current){const R=T.xSnapped-(((L=h==null?void 0:h.current)==null?void 0:L.x)??0),z=T.ySnapped-(((M=h==null?void 0:h.current)==null?void 0:M.y)??0);Math.sqrt(R*R+z*z)>P&&j(_)}(h.current.x!==T.xSnapped||h.current.y!==T.ySnapped)&&u.current&&b.current&&(g.current=_.sourceEvent,x.current=Oo(_.sourceEvent,m.current),S(T))}}).on("end",_=>{if(b.current&&!y.current&&(d(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:T,nodeInternals:I,onNodeDragStop:P,onSelectionDragStop:L}=i.getState(),M=r?P:Rh(L);if(T(u.current,!1,!1),M){const[R,z]=Dh({nodeId:r,dragItems:u.current,nodeInternals:I});M(_.sourceEvent,R,z)}}}).filter(_=>{const T=_.target;return!_.button&&(!n||!qv(T,`.${n}`,t))&&(!o||qv(T,o,t))});return w.call(C),()=>{w.on(".drag",null)}}w.on(".drag",null)}},[t,e,n,o,s,i,r,a,v]),l}function Xv(){const t=zt();return O.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:a,snapToGrid:i,snapGrid:l,onError:d,nodesDraggable:u}=t.getState(),h=a().filter(y=>y.selected&&(y.draggable||u&&y.draggable===void 0)),f=i?l[0]:5,m=i?l[1]:5,x=n.isShiftPressed?4:1,g=n.x*f*x,p=n.y*m*x,b=h.map(y=>{if(y.positionAbsolute){const v={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+p};i&&(v.x=l[0]*Math.round(v.x/l[0]),v.y=l[1]*Math.round(v.y/l[1]));const{positionAbsolute:w,position:S}=Gv(y,v,o,r,void 0,d);y.position=S,y.positionAbsolute=w}return y});s(b,!0,!1)},[])}const es={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Sa=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:a,xPosOrigin:i,yPosOrigin:l,selected:d,onClick:u,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:x,onDoubleClick:g,style:p,className:b,isDraggable:y,isSelectable:v,isConnectable:w,isFocusable:S,selectNodesOnDrag:N,sourcePosition:j,targetPosition:C,hidden:_,resizeObserver:T,dragHandle:I,zIndex:P,isParent:L,noDragClassName:M,noPanClassName:R,initialized:z,disableKeyboardA11y:D,ariaLabel:A,rfId:k,hasHandleBounds:B})=>{const E=zt(),U=O.useRef(null),V=O.useRef(null),$=O.useRef(j),K=O.useRef(C),X=O.useRef(o),J=v||y||u||h||f||m,ee=Xv(),q=ka(n,E.getState,h),Y=ka(n,E.getState,f),oe=ka(n,E.getState,m),se=ka(n,E.getState,x),re=ka(n,E.getState,g);O.useEffect(()=>()=>{V.current&&(T==null||T.unobserve(V.current),V.current=null)},[]),O.useEffect(()=>{if(U.current&&!_){const te=U.current;z&&B&&V.current===te||(V.current&&(T==null||T.unobserve(V.current)),T==null||T.observe(te),V.current=te)}},[_,z,B]),O.useEffect(()=>{const te=X.current!==o,be=$.current!==j,ye=K.current!==C;U.current&&(te||be||ye)&&(te&&(X.current=o),be&&($.current=j),ye&&(K.current=C),E.getState().updateNodeDimensions([{id:n,nodeElement:U.current,forceUpdate:!0}]))},[n,o,j,C]);const ae=Kv({nodeRef:U,disabled:_||!y,noDragClassName:M,handleSelector:I,nodeId:n,isSelectable:v,selectNodesOnDrag:N});return _?null:G.createElement("div",{className:Xt(["react-flow__node",`react-flow__node-${o}`,{[R]:y},b,{selected:d,selectable:v,parent:L,dragging:ae}]),ref:U,style:{zIndex:P,transform:`translate(${i}px,${l}px)`,pointerEvents:J?"all":"none",visibility:z?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:q,onMouseMove:Y,onMouseLeave:oe,onContextMenu:se,onClick:te=>{const{nodeDragThreshold:be}=E.getState();if(v&&(!N||!y||be>0)&&Ph({id:n,store:E,nodeRef:U}),u){const ye=E.getState().nodeInternals.get(n);ye&&u(te,{...ye})}},onDoubleClick:re,onKeyDown:S?te=>{if(!xh(te)&&!D)if(nv.includes(te.key)&&v){const be=te.key==="Escape";Ph({id:n,store:E,unselect:be,nodeRef:U})}else y&&d&&Object.prototype.hasOwnProperty.call(es,te.key)&&(E.setState({ariaLiveMessage:`Moved selected node ${te.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~a}`}),ee({x:es[te.key].x,y:es[te.key].y,isShiftPressed:te.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":D?void 0:`${Mv}-${k}`,"aria-label":A},G.createElement(H8,{value:n},G.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:a,selected:d,isConnectable:w,sourcePosition:j,targetPosition:C,dragging:ae,dragHandle:I,zIndex:P})))};return e.displayName="NodeWrapper",O.memo(e)};const gT=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Ch(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var xT=O.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=zt(),{width:r,height:s,x:a,y:i,transformString:l,userSelectionActive:d}=at(gT,Ht),u=Xv(),h=O.useRef(null);if(O.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),Kv({nodeRef:h}),d||!r||!s)return null;const f=t?m=>{const x=o.getState().getNodes().filter(g=>g.selected);t(m,x)}:void 0;return G.createElement("div",{className:Xt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},G.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(es,m.key)&&u({x:es[m.key].x,y:es[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:i,left:a}}))});const bT=t=>t.nodesSelectionActive,Jv=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,deleteKeyCode:i,onMove:l,onMoveStart:d,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:x,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:N,panOnScrollSpeed:j,panOnScrollMode:C,zoomOnDoubleClick:_,panOnDrag:T,defaultViewport:I,translateExtent:P,minZoom:L,maxZoom:M,preventScrolling:R,onSelectionContextMenu:z,noWheelClassName:D,noPanClassName:A,disableKeyboardA11y:k})=>{const B=at(bT),E=va(h),U=va(b),V=U||T,$=U||N,K=E||f&&V!==!0;return(({deleteKeyCode:X,multiSelectionKeyCode:J})=>{const ee=zt(),{deleteElements:q}=wa(),Y=va(X,cT),oe=va(J);O.useEffect(()=>{if(Y){const{edges:se,getNodes:re}=ee.getState(),ae=re().filter(be=>be.selected),te=se.filter(be=>be.selected);q({nodes:ae,edges:te}),ee.setState({nodesSelectionActive:!1})}},[Y]),O.useEffect(()=>{ee.setState({multiSelectionActive:oe})},[oe])})({deleteKeyCode:i,multiSelectionKeyCode:p}),G.createElement(uT,{onMove:l,onMoveStart:d,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:$,panOnScrollSpeed:j,panOnScrollMode:C,zoomOnDoubleClick:_,panOnDrag:!E&&V,defaultViewport:I,translateExtent:P,minZoom:L,maxZoom:M,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:D,noPanClassName:A},G.createElement(Hv,{onSelectionStart:x,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:V,isSelecting:!!K,selectionMode:m},t,B&&G.createElement(xT,{onSelectionContextMenu:z,noPanClassName:A,disableKeyboardA11y:k})))};Jv.displayName="FlowRenderer";var yT=O.memo(Jv);function vT(t){return{input:Sa(t.input||Ev),default:Sa(t.default||Ih),output:Sa(t.output||Iv),group:Sa(t.group||Th),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=Sa(t[n]||Ih),e),{})}}const wT=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Zv=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:a}=at(wT,Ht),i=(l=t.onlyRenderVisibleElements,at(O.useCallback(h=>l?gv(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const d=O.useRef(),u=O.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));s(m)});return d.current=h,h},[]);return O.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),G.createElement("div",{className:"react-flow__nodes",style:Mh},i.map(h=>{var N,j,C;let f=h.type||"default";t.nodeTypes[f]||(a==null||a("003",M8(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,x=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?mh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,v=(y==null?void 0:y.x)??0,w=(y==null?void 0:y.y)??0,S=(({x:_,y:T,width:I,height:P,origin:L})=>I&&P?L[0]<0||L[1]<0||L[0]>1||L[1]>1?{x:_,y:T}:{x:_-I*L[0],y:T-P*L[1]}:{x:_,y:T})({x:v,y:w,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return G.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Pe.Bottom,targetPosition:h.targetPosition||Pe.Top,hidden:h.hidden,xPos:v,yPos:w,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:x,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:u,dragHandle:h.dragHandle,zIndex:((N=h[xt])==null?void 0:N.z)??0,isParent:!!((j=h[xt])!=null&&j.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((C=h[xt])!=null&&C.handleBounds)})}))};Zv.displayName="NodeRenderer";var kT=O.memo(Zv);const ST=(t,e,n)=>n===Pe.Left?t-e:n===Pe.Right?t+e:t,NT=(t,e,n)=>n===Pe.Top?t-e:n===Pe.Bottom?t+e:t,Qv="react-flow__edgeupdater",e2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:i})=>G.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Xt([Qv,`${Qv}-${i}`]),cx:ST(e,o,t),cy:NT(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),jT=()=>!0;var ts=t=>{const e=({id:n,className:o,type:r,data:s,onClick:a,onEdgeDoubleClick:i,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,style:p,source:b,target:y,sourceX:v,sourceY:w,targetX:S,targetY:N,sourcePosition:j,targetPosition:C,elementsSelectable:_,hidden:T,sourceHandleId:I,targetHandleId:P,onContextMenu:L,onMouseEnter:M,onMouseMove:R,onMouseLeave:z,reconnectRadius:D,onReconnect:A,onReconnectStart:k,onReconnectEnd:B,markerEnd:E,markerStart:U,rfId:V,ariaLabel:$,isFocusable:K,isReconnectable:X,pathOptions:J,interactionWidth:ee,disableKeyboardA11y:q})=>{const Y=O.useRef(null),[oe,se]=O.useState(!1),[re,ae]=O.useState(!1),te=zt(),be=O.useMemo(()=>`url('#${Nh(U,V)}')`,[U,V]),ye=O.useMemo(()=>`url('#${Nh(E,V)}')`,[E,V]);if(T)return null;const ie=xa(n,te.getState,i),ve=xa(n,te.getState,L),he=xa(n,te.getState,M),Se=xa(n,te.getState,R),De=xa(n,te.getState,z),_e=(qe,Ke)=>{if(qe.button!==0)return;const{edges:Q,isValidConnection:xe}=te.getState(),we=Ke?y:b,Te=(Ke?P:I)||null,W=Ke?"target":"source",ne=xe||jT,ue=Ke,de=Q.find(ge=>ge.id===n);ae(!0),k==null||k(qe,de,W),kv({event:qe,handleId:Te,nodeId:we,onConnect:ge=>A==null?void 0:A(de,ge),isTarget:ue,getState:te.getState,setState:te.setState,isValidConnection:ne,edgeUpdaterType:W,onReconnectEnd:ge=>{ae(!1),B==null||B(ge,de,W)}})},Fe=()=>se(!0),Oe=()=>se(!1),Qe=!_&&!a;return G.createElement("g",{className:Xt(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:d,inactive:Qe,updating:oe}]),onClick:qe=>{var W;const{edges:Ke,addSelectedEdges:Q,unselectNodesAndEdges:xe,multiSelectionActive:we}=te.getState(),Te=Ke.find(ne=>ne.id===n);Te&&(_&&(te.setState({nodesSelectionActive:!1}),Te.selected&&we?(xe({nodes:[],edges:[Te]}),(W=Y.current)==null||W.blur()):Q([n])),a&&a(qe,Te))},onDoubleClick:ie,onContextMenu:ve,onMouseEnter:he,onMouseMove:Se,onMouseLeave:De,onKeyDown:K?qe=>{var Ke;if(!q&&nv.includes(qe.key)&&_){const{unselectNodesAndEdges:Q,addSelectedEdges:xe,edges:we}=te.getState();qe.key==="Escape"?((Ke=Y.current)==null||Ke.blur(),Q({edges:[we.find(Te=>Te.id===n)]})):xe([n])}}:void 0,tabIndex:K?0:void 0,role:K?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":$===null?void 0:$||`Edge from ${b} to ${y}`,"aria-describedby":K?`${Ov}-${V}`:void 0,ref:Y},!re&&G.createElement(t,{id:n,source:b,target:y,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,data:s,style:p,sourceX:v,sourceY:w,targetX:S,targetY:N,sourcePosition:j,targetPosition:C,sourceHandleId:I,targetHandleId:P,markerStart:be,markerEnd:ye,pathOptions:J,interactionWidth:ee}),X&&G.createElement(G.Fragment,null,(X==="source"||X===!0)&&G.createElement(e2,{position:j,centerX:v,centerY:w,radius:D,onMouseDown:qe=>_e(qe,!0),onMouseEnter:Fe,onMouseOut:Oe,type:"source"}),(X==="target"||X===!0)&&G.createElement(e2,{position:C,centerX:S,centerY:N,radius:D,onMouseDown:qe=>_e(qe,!1),onMouseEnter:Fe,onMouseOut:Oe,type:"target"})))};return e.displayName="EdgeWrapper",O.memo(e)};function CT(t){return{default:ts(t.default||Ol),straight:ts(t.bezier||kh),step:ts(t.step||wh),smoothstep:ts(t.step||Al),simplebezier:ts(t.simplebezier||yh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ts(t[n]||Ol),e),{})}}function t2(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,a=(n==null?void 0:n.height)||e.height;switch(t){case Pe.Top:return{x:o+s/2,y:r};case Pe.Right:return{x:o+s,y:r+a/2};case Pe.Bottom:return{x:o+s/2,y:r+a};case Pe.Left:return{x:o,y:r+a/2}}}function n2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function o2(t){var o,r,s,a,i;const e=((o=t==null?void 0:t[xt])==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:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.x)||0,y:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const ET=[{level:0,isMaxLevel:!0,edges:[]}];function _T(t,e,n){return function(o,r,s=!1){let a=-1;const i=o.reduce((d,u)=>{var m,x;const h=wn(u.zIndex);let f=h?u.zIndex:0;if(s){const g=r.get(u.target),p=r.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),y=Math.max(((m=p==null?void 0:p[xt])==null?void 0:m.z)||0,((x=g==null?void 0:g[xt])==null?void 0:x.z)||0,1e3);f=(h?u.zIndex:0)+(b?y:0)}return d[f]?d[f].push(u):d[f]=[u],a=f>a?f:a,d},{}),l=Object.entries(i).map(([d,u])=>{const h=+d;return{edges:u,level:h,isMaxLevel:h===a}});return l.length===0?ET:l}(at(O.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),a=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&function({sourcePos:i,targetPos:l,sourceWidth:d,sourceHeight:u,targetWidth:h,targetHeight:f,width:m,height:x,transform:g}){const p={x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x+d,l.x+h),y2:Math.max(i.y+u,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=ph({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:x/g[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),v=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*v)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const r2={[Yr.Arrow]:({color:t="none",strokeWidth:e=1})=>G.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[Yr.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>G.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},IT=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:i="auto-start-reverse"})=>{const l=function(d){const u=zt();return O.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(r2,d)?r2[d]:((f=(h=u.getState()).onError)==null||f.call(h,"009",P8(d)),null)},[d])}(e);return l?G.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:i,refX:"0",refY:"0"},G.createElement(l,{color:n,strokeWidth:a})):null},s2=({defaultColor:t,rfId:e})=>{const n=at(O.useCallback((({defaultColor:o,rfId:r})=>s=>{const a=[];return s.edges.reduce((i,l)=>([l.markerStart,l.markerEnd].forEach(d=>{if(d&&typeof d=="object"){const u=Nh(d,r);a.includes(u)||(i.push({id:u,color:d.color||o,...d}),a.push(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,a)=>s.id!==r[a].id)));return G.createElement("defs",null,n.map(o=>G.createElement(IT,{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})))};s2.displayName="MarkerDefinitions";var TT=O.memo(s2);const AT=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}),a2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:a,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:v,elementsSelectable:w,width:S,height:N,connectionMode:j,nodeInternals:C,onError:_}=at(AT,Ht),T=_T(e,C,n);return S?G.createElement(G.Fragment,null,T.map(({level:I,edges:P,isMaxLevel:L})=>G.createElement("svg",{key:I,style:{zIndex:I},width:S,height:N,className:"react-flow__edges react-flow__container"},L&&G.createElement(TT,{defaultColor:t,rfId:o}),G.createElement("g",null,P.map(M=>{const[R,z,D]=o2(C.get(M.source)),[A,k,B]=o2(C.get(M.target));if(!D||!B)return null;let E=M.type||"default";r[E]||(_==null||_("011",F8(E)),E="default");const U=r[E]||r.default,V=j===cr.Strict?k.target:(k.target??[]).concat(k.source??[]),$=n2(z.source,M.sourceHandle),K=n2(V,M.targetHandle),X=($==null?void 0:$.position)||Pe.Bottom,J=(K==null?void 0:K.position)||Pe.Top,ee=!!(M.focusable||y&&M.focusable===void 0),q=M.reconnectable||M.updatable,Y=f!==void 0&&(q||v&&q===void 0);if(!$||!K)return _==null||_("008",R8($,M)),null;const{sourceX:oe,sourceY:se,targetX:re,targetY:ae}=((te,be,ye,ie,ve,he)=>{const Se=t2(ye,te,be),De=t2(he,ie,ve);return{sourceX:Se.x,sourceY:Se.y,targetX:De.x,targetY:De.y}})(R,$,X,A,K,J);return G.createElement(U,{key:M.id,id:M.id,className:Xt([M.className,s]),type:E,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:oe,sourceY:se,targetX:re,targetY:ae,sourcePosition:X,targetPosition:J,elementsSelectable:w,onContextMenu:a,onMouseEnter:i,onMouseMove:l,onMouseLeave:d,onClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,rfId:o,ariaLabel:M.ariaLabel,isFocusable:ee,isReconnectable:Y,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:b})})))),p):null};a2.displayName="EdgeRenderer";var MT=O.memo(a2);const OT=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function DT({children:t}){const e=at(OT);return G.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const PT={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top},i2=({nodeId:t,handleType:e,style:n,type:o=Po.Bezier,CustomComponent:r,connectionStatus:s})=>{var N,j,C;const{fromNode:a,handleId:i,toX:l,toY:d,connectionMode:u}=at(O.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.connectionMode}),[t]),Ht),h=(N=a==null?void 0:a[xt])==null?void 0:N.handleBounds;let f=h==null?void 0:h[e];if(u===cr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!a||!f)return null;const m=i?f.find(_=>_.id===i):f[0],x=m?m.x+m.width/2:(a.width??0)/2,g=m?m.y+m.height/2:a.height??0,p=(((j=a.positionAbsolute)==null?void 0:j.x)??0)+x,b=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+g,y=m==null?void 0:m.position,v=y?PT[y]:null;if(!y||!v)return null;if(r)return G.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:a,fromHandle:m,fromX:p,fromY:b,toX:l,toY:d,fromPosition:y,toPosition:v,connectionStatus:s});let w="";const S={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:d,targetPosition:v};return o===Po.Bezier?[w]=mv(S):o===Po.Step?[w]=vh({...S,borderRadius:0}):o===Po.SmoothStep?[w]=vh(S):o===Po.SimpleBezier?[w]=dv(S):w=`M${p},${b} ${l},${d}`,G.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};i2.displayName="ConnectionLine";const RT=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function LT({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:a,width:i,height:l,connectionStatus:d}=at(RT,Ht);return r&&s&&i&&a?G.createElement("svg",{style:t,width:i,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},G.createElement("g",{className:Xt(["react-flow__connection",d])},G.createElement(i2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:d}))):null}function l2(t,e){return O.useRef(null),zt(),O.useMemo(()=>e(t),[t])}const c2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:a,onEdgeClick:i,onNodeDoubleClick:l,onEdgeDoubleClick:d,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:x,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:S,selectionOnDrag:N,selectionMode:j,multiSelectionKeyCode:C,panActivationKeyCode:_,zoomActivationKeyCode:T,deleteKeyCode:I,onlyRenderVisibleElements:P,elementsSelectable:L,selectNodesOnDrag:M,defaultViewport:R,translateExtent:z,minZoom:D,maxZoom:A,preventScrolling:k,defaultMarkerColor:B,zoomOnScroll:E,zoomOnPinch:U,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:K,zoomOnDoubleClick:X,panOnDrag:J,onPaneClick:ee,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:oe,onPaneScroll:se,onPaneContextMenu:re,onEdgeContextMenu:ae,onEdgeMouseEnter:te,onEdgeMouseMove:be,onEdgeMouseLeave:ye,onReconnect:ie,onReconnectStart:ve,onReconnectEnd:he,reconnectRadius:Se,noDragClassName:De,noWheelClassName:_e,noPanClassName:Fe,elevateEdgesOnSelect:Oe,disableKeyboardA11y:Qe,nodeOrigin:qe,nodeExtent:Ke,rfId:Q})=>{const xe=l2(t,vT),we=l2(e,CT);return function(Te){const W=wa(),ne=O.useRef(!1);O.useEffect(()=>{!ne.current&&W.viewportInitialized&&Te&&(setTimeout(()=>Te(W),1),ne.current=!0)},[Te,W.viewportInitialized])}(s),G.createElement(yT,{onPaneClick:ee,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:oe,onPaneContextMenu:re,onPaneScroll:se,deleteKeyCode:I,selectionKeyCode:S,selectionOnDrag:N,selectionMode:j,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:C,panActivationKeyCode:_,zoomActivationKeyCode:T,elementsSelectable:L,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:E,zoomOnPinch:U,zoomOnDoubleClick:X,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:K,panOnDrag:J,defaultViewport:R,translateExtent:z,minZoom:D,maxZoom:A,onSelectionContextMenu:x,preventScrolling:k,noDragClassName:De,noWheelClassName:_e,noPanClassName:Fe,disableKeyboardA11y:Qe},G.createElement(DT,null,G.createElement(MT,{edgeTypes:we,onEdgeClick:i,onEdgeDoubleClick:d,onlyRenderVisibleElements:P,onEdgeContextMenu:ae,onEdgeMouseEnter:te,onEdgeMouseMove:be,onEdgeMouseLeave:ye,onReconnect:ie,onReconnectStart:ve,onReconnectEnd:he,reconnectRadius:Se,defaultMarkerColor:B,noPanClassName:Fe,elevateEdgesOnSelect:!!Oe,disableKeyboardA11y:Qe,rfId:Q},G.createElement(LT,{style:y,type:b,component:v,containerStyle:w})),G.createElement("div",{className:"react-flow__edgelabel-renderer"}),G.createElement(kT,{nodeTypes:xe,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:M,onlyRenderVisibleElements:P,noPanClassName:Fe,noDragClassName:De,disableKeyboardA11y:Qe,nodeOrigin:qe,nodeExtent:Ke,rfId:Q})))};c2.displayName="GraphView";var FT=O.memo(c2);const Lh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Fo={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:Lh,nodeExtent:Lh,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},zT=()=>((t,e)=>t?Gy(t,e):Gy)((t,e)=>({...Fo,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:Ah(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,a=r?Ah(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:a,fitViewOnInitOptions:i,domNode:l,nodeOrigin:d}=e(),u=l==null?void 0:l.querySelector(".react-flow__viewport");if(!u)return;const h=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[xt]:{...b[xt],handleBounds:void 0}});else if(b){const y=fh(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[xt]:{...b[xt],handleBounds:{source:Yv(".source",p.nodeElement,f,d),target:Yv(".target",p.nodeElement,f,d)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);Lv(r,d);const x=a||s&&!a&&Fv(e,{initial:!0,...i});t({nodeInternals:new Map(r),fitViewOnInitDone:x}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),a=n.map(i=>{const l={id:i.id,type:"position",dragging:r};return o&&(l.positionAbsolute=i.positionAbsolute,l.position=i.position),l});s(a)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:a,getNodes:i,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const d=Ah(Vv(n,i()),r,a,l);t({nodeInternals:d})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>Lo(l,!0)):(a=Qr(s(),n),i=Qr(r,[])),Pl({changedNodes:a,changedEdges:i,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>Lo(l,!0)):(a=Qr(r,n),i=Qr(s(),[])),Pl({changedNodes:i,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),a=o||r;Pl({changedNodes:(n||s()).map(i=>(i.selected=!1,Lo(i.id,!1))),changedEdges:a.map(i=>Lo(i.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();Pl({changedNodes:o().filter(r=>r.selected).map(r=>Lo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>Lo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=mh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:a,d3Selection:i,translateExtent:l}=e();if(!a||!i||!n.x&&!n.y)return!1;const d=Zo.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),u=[[0,0],[r,s]],h=a==null?void 0:a.constrain()(d,u,l);return a.transform(i,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Fo.connectionNodeId,connectionHandleId:Fo.connectionHandleId,connectionHandleType:Fo.connectionHandleType,connectionStatus:Fo.connectionStatus,connectionStartHandle:Fo.connectionStartHandle,connectionEndHandle:Fo.connectionEndHandle}),reset:()=>t({...Fo})}),Object.is),Fh=({children:t})=>{const e=O.useRef(null);return e.current||(e.current=zT()),G.createElement(A8,{value:e.current},t)};Fh.displayName="ReactFlowProvider";const d2=({children:t})=>O.useContext(El)?G.createElement(G.Fragment,null,t):G.createElement(Fh,null,t);d2.displayName="ReactFlowWrapper";const BT={input:Ev,default:Ih,output:Iv,group:Th},UT={default:Ol,straight:kh,step:wh,smoothstep:Al,simplebezier:yh},$T=[0,0],VT=[15,15],HT={x:0,y:0,zoom:1},WT={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},zh=O.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=BT,edgeTypes:a=UT,onNodeClick:i,onEdgeClick:l,onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:N,onNodeDragStart:j,onNodeDrag:C,onNodeDragStop:_,onNodesDelete:T,onEdgesDelete:I,onSelectionChange:P,onSelectionDragStart:L,onSelectionDrag:M,onSelectionDragStop:R,onSelectionContextMenu:z,onSelectionStart:D,onSelectionEnd:A,connectionMode:k=cr.Strict,connectionLineType:B=Po.Bezier,connectionLineStyle:E,connectionLineComponent:U,connectionLineContainerStyle:V,deleteKeyCode:$="Backspace",selectionKeyCode:K="Shift",selectionOnDrag:X=!1,selectionMode:J=ba.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:q=Il()?"Meta":"Control",zoomActivationKeyCode:Y=Il()?"Meta":"Control",snapToGrid:oe=!1,snapGrid:se=VT,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:ae=!0,nodesDraggable:te,nodesConnectable:be,nodesFocusable:ye,nodeOrigin:ie=$T,edgesFocusable:ve,edgesUpdatable:he,elementsSelectable:Se,defaultViewport:De=HT,minZoom:_e=.5,maxZoom:Fe=2,translateExtent:Oe=Lh,preventScrolling:Qe=!0,nodeExtent:qe,defaultMarkerColor:Ke="#b1b1b7",zoomOnScroll:Q=!0,zoomOnPinch:xe=!0,panOnScroll:we=!1,panOnScrollSpeed:Te=.5,panOnScrollMode:W=Do.Free,zoomOnDoubleClick:ne=!0,panOnDrag:ue=!0,onPaneClick:de,onPaneMouseEnter:ge,onPaneMouseMove:Me,onPaneMouseLeave:Re,onPaneScroll:He,onPaneContextMenu:le,children:Ne,onEdgeContextMenu:Ce,onEdgeDoubleClick:Le,onEdgeMouseEnter:Ve,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ue,onEdgeUpdate:Je,onEdgeUpdateStart:We,onEdgeUpdateEnd:nt,onReconnect:bt,onReconnectStart:It,onReconnectEnd:Jt,reconnectRadius:Bt=10,edgeUpdaterRadius:Mn=10,onNodesChange:os,onEdgesChange:Wn,noDragClassName:yo="nodrag",noWheelClassName:Sn="nowheel",noPanClassName:rs="nopan",fitView:ja=!1,fitViewOptions:N7,connectOnClick:j7=!0,attributionPosition:C7,proOptions:E7,defaultEdgeOptions:_7,elevateNodesOnSelect:I7=!0,elevateEdgesOnSelect:T7=!1,disableKeyboardA11y:nk=!1,autoPanOnConnect:A7=!0,autoPanOnNodeDrag:M7=!0,connectionRadius:O7=20,isValidConnection:D7,onError:P7,style:R7,id:ok,nodeDragThreshold:L7,...F7},z7)=>{const Mf=ok||"1";return G.createElement("div",{...F7,style:{...R7,...WT},ref:z7,className:Xt(["react-flow",r]),"data-testid":"rf__wrapper",id:ok},G.createElement(d2,null,G.createElement(FT,{onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:N,nodeTypes:s,edgeTypes:a,connectionLineType:B,connectionLineStyle:E,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:K,selectionOnDrag:X,selectionMode:J,deleteKeyCode:$,multiSelectionKeyCode:q,panActivationKeyCode:ee,zoomActivationKeyCode:Y,onlyRenderVisibleElements:re,selectNodesOnDrag:ae,defaultViewport:De,translateExtent:Oe,minZoom:_e,maxZoom:Fe,preventScrolling:Qe,zoomOnScroll:Q,zoomOnPinch:xe,zoomOnDoubleClick:ne,panOnScroll:we,panOnScrollSpeed:Te,panOnScrollMode:W,panOnDrag:ue,onPaneClick:de,onPaneMouseEnter:ge,onPaneMouseMove:Me,onPaneMouseLeave:Re,onPaneScroll:He,onPaneContextMenu:le,onSelectionContextMenu:z,onSelectionStart:D,onSelectionEnd:A,onEdgeContextMenu:Ce,onEdgeDoubleClick:Le,onEdgeMouseEnter:Ve,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ue,onReconnect:bt??Je,onReconnectStart:It??We,onReconnectEnd:Jt??nt,reconnectRadius:Bt??Mn,defaultMarkerColor:Ke,noDragClassName:yo,noWheelClassName:Sn,noPanClassName:rs,elevateEdgesOnSelect:T7,rfId:Mf,disableKeyboardA11y:nk,nodeOrigin:ie,nodeExtent:qe}),G.createElement(eT,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:te,nodesConnectable:be,nodesFocusable:ye,edgesFocusable:ve,edgesUpdatable:he,elementsSelectable:Se,elevateNodesOnSelect:I7,minZoom:_e,maxZoom:Fe,nodeExtent:qe,onNodesChange:os,onEdgesChange:Wn,snapToGrid:oe,snapGrid:se,connectionMode:k,translateExtent:Oe,connectOnClick:j7,defaultEdgeOptions:_7,fitView:ja,fitViewOptions:N7,onNodesDelete:T,onEdgesDelete:I,onNodeDragStart:j,onNodeDrag:C,onNodeDragStop:_,onSelectionDrag:M,onSelectionDragStart:L,onSelectionDragStop:R,noPanClassName:rs,nodeOrigin:ie,rfId:Mf,autoPanOnConnect:A7,autoPanOnNodeDrag:M7,onError:P7,connectionRadius:O7,isValidConnection:D7,nodeDragThreshold:L7}),G.createElement(Z8,{onSelectionChange:P}),Ne,G.createElement(U8,{proOptions:E7,position:C7}),G.createElement(rT,{rfId:Mf,disableKeyboardA11y:nk})))});function u2(t){return e=>{const[n,o]=O.useState(e),r=O.useCallback(s=>o(a=>t(s,a)),[]);return[n,o,r]}}zh.displayName="ReactFlow";const h2=u2(Vv),f2=u2(function(t,e){return $v(t,e)});function qT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},G.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function GT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},G.createElement("path",{d:"M0 0h32v4.2H0z"}))}function YT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},G.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 KT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.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 XT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.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 ns=({children:t,className:e,...n})=>G.createElement("button",{type:"button",className:Xt(["react-flow__controls-button",e]),...n},t);ns.displayName="ControlButton";const JT=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),m2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:i,onInteractiveChange:l,className:d,children:u,position:h="bottom-left"})=>{const f=zt(),[m,x]=O.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=at(JT,Ht),{zoomIn:y,zoomOut:v,fitView:w}=wa();return O.useEffect(()=>{x(!0)},[]),m?G.createElement(_l,{className:Xt(["react-flow__controls",d]),position:h,style:t,"data-testid":"rf__controls"},e&&G.createElement(G.Fragment,null,G.createElement(ns,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},G.createElement(qT,null)),G.createElement(ns,{onClick:()=>{v(),a==null||a()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},G.createElement(GT,null))),n&&G.createElement(ns,{className:"react-flow__controls-fitview",onClick:()=>{w(r),i==null||i()},title:"fit view","aria-label":"fit view"},G.createElement(YT,null)),o&&G.createElement(ns,{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?G.createElement(XT,null):G.createElement(KT,null)),u):null};m2.displayName="Controls";var kn,ZT=O.memo(m2);function QT({color:t,dimensions:e,lineWidth:n}){return G.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function eA({color:t,radius:e}){return G.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(kn||(kn={}));const tA={[kn.Dots]:"#91919a",[kn.Lines]:"#eee",[kn.Cross]:"#e2e2e2"},nA={[kn.Dots]:1,[kn.Lines]:1,[kn.Cross]:6},oA=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function p2({id:t,variant:e=kn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:a,style:i,className:l}){const d=O.useRef(null),{transform:u,patternId:h}=at(oA,Ht),f=a||tA[e],m=o||nA[e],x=e===kn.Dots,g=e===kn.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*u[2]||1,p[1]*u[2]||1],y=m*u[2],v=g?[y,y]:b,w=x?[y/s,y/s]:[v[0]/s,v[1]/s];return G.createElement("svg",{className:Xt(["react-flow__background",l]),style:{...i,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},G.createElement("pattern",{id:h+t,x:u[0]%b[0],y:u[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},x?G.createElement(eA,{color:f,radius:y/s}):G.createElement(QT,{dimensions:v,color:f,lineWidth:r})),G.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}p2.displayName="Background";var rA=O.memo(p2);function Bh(t){return Math.min(11*t+35,200)}const g2=G.createContext("LR"),x2=O.memo(t=>{const e=H.c(51),{data:n,selected:o}=t,r=Ie(n.atom),s=Tc().inOrderIds.indexOf(r.id),a=o?"var(--gray-9)":"var(--gray-3)",i=at(sA),l=O.use(g2);let d,u,h,f,m;if(e[0]!==r.code||e[1]!==a||e[2]!==l||e[3]!==o){const I=r.code.split(`
|
145
145
|
`).length,P=l==="LR"?Pe.Left:Pe.Top;let L;e[8]!==a?(L={background:a},e[8]=a,e[9]=L):L=e[9],e[10]!==P||e[11]!==L?(h=c.jsx(Ro,{type:"target",id:"inputs",position:P,style:L}),e[10]=P,e[11]=L,e[12]=h):h=e[12];const M=l==="LR"?Pe.Left:Pe.Top;let R;e[13]!==a?(R={background:a},e[13]=a,e[14]=R):R=e[14],e[15]!==M||e[16]!==R?(f=c.jsx(Ro,{type:"source",id:"inputs",position:M,style:R}),e[15]=M,e[16]=R,e[17]=f):f=e[17];const z=o&&"border-primary";e[18]!==z?(u=me("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",z),e[18]=z,e[19]=u):u=e[19],d=Bh(I),e[0]=r.code,e[1]=a,e[2]=l,e[3]=o,e[4]=d,e[5]=u,e[6]=h,e[7]=f}else d=e[4],u=e[5],h=e[6],f=e[7];var x;let g;e[20]!==n.forceWidth||e[21]!==i?(m=n.forceWidth||(x=i,Math.min(Math.max(x-100,100),400)),e[20]=n.forceWidth,e[21]=i,e[22]=m):m=e[22],e[23]!==d||e[24]!==m?(g={height:d,width:m},e[23]=d,e[24]=m,e[25]=g):g=e[25];const p=DP(r.name,s);let b,y,v;e[26]!==p?(b=c.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(y=c.jsx(bL,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==u||e[31]!==g||e[32]!==b||e[33]!==y?(v=c.jsxs("div",{className:u,style:g,children:[b,y]}),e[30]=u,e[31]=g,e[32]=b,e[33]=y,e[34]=v):v=e[34];const w=l==="LR"?Pe.Right:Pe.Bottom;let S,N;e[35]!==a?(S={background:a},e[35]=a,e[36]=S):S=e[36],e[37]!==w||e[38]!==S?(N=c.jsx(Ro,{type:"source",id:"outputs",position:w,style:S}),e[37]=w,e[38]=S,e[39]=N):N=e[39];const j=l==="LR"?Pe.Right:Pe.Bottom;let C,_,T;return e[40]!==a?(C={background:a},e[40]=a,e[41]=C):C=e[41],e[42]!==j||e[43]!==C?(_=c.jsx(Ro,{type:"target",id:"outputs",position:j,style:C}),e[42]=j,e[43]=C,e[44]=_):_=e[44],e[45]!==v||e[46]!==N||e[47]!==_||e[48]!==h||e[49]!==f?(T=c.jsxs("div",{children:[h,f,v,N,_]}),e[45]=v,e[46]=N,e[47]=_,e[48]=h,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));x2.displayName="CustomNode";const b2={custom:x2};function sA(t){const{width:e}=t;return e}const y2=t=>{const e=H.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,a=Tc();let i,l,d,u;if(e[0]!==o||e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s){d=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==a?(h=(x,g)=>a.inOrderIds.indexOf(x)-a.inOrderIds.indexOf(g),e[8]=a,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=x):x=e[10],d=x;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(x,g)=>c.jsxs("span",{className:"truncate",children:[c.jsx(jo,{variant:"focus",cellId:x,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x),g<o.length-1&&", "]},x),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],i=f.slice(0,n).map(m),l=o.length>n&&c.jsxs(xr,{children:[c.jsx(vs,{asChild:!0,children:c.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),c.jsx(ms,{className:"w-auto",children:c.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(x=>c.jsx(jo,{variant:"focus",cellId:x,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x))})})]})}e[0]=o,e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i,e[6]=l,e[7]=d}else i=e[5],l=e[6],d=e[7];return d!==Symbol.for("react.early_return_sentinel")?d:(e[15]!==i||e[16]!==l?(u=c.jsxs(c.Fragment,{children:[i,l]}),e[15]=i,e[16]=l,e[17]=u):u=e[17],u)},Uh=t=>{const e=H.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 a=n.length>1?"destructive":"outline";let i,l,d;return e[5]!==o||e[6]!==r?(i=async u=>{r?r(u):(await on(o),Xe({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=i):i=e[7],e[8]!==o||e[9]!==a||e[10]!==i?(l=c.jsx($3,{title:o,variant:a,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:i,children:o}),e[8]=o,e[9]=a,e[10]=i,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(d=c.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=d):d=e[14],d},$h=O.memo(t=>{const e=H.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let a;e[0]!==s||e[1]!==r?(a=(M,R)=>{s({...r,[M]:R})},e[0]=s,e[1]=r,e[2]=a):a=e[2];const i=a;let l,d,u,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(vs,{asChild:!0,children:c.jsx(ke,{variant:"text",size:"xs",children:c.jsx(Qf,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=d):d=e[4],e[5]!==i?(u=M=>i("hidePureMarkdown",!!M),e[5]=i,e[6]=u):u=e[6],e[7]!==r.hidePureMarkdown||e[8]!==u?(h=c.jsx(g3,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:u}),e[7]=r.hidePureMarkdown,e[8]=u,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(fr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=c.jsxs(xr,{children:[l,c.jsxs(ms,{className:"w-auto p-2 text-muted-foreground",children:[d,c.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const x=m,g=o==="_minimap_";let p,b,y;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(yp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(y=c.jsxs(ke,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=y):y=e[18];const v=o==="TB";let w,S,N;e[19]!==n?(w=()=>n("TB"),e[19]=n,e[20]=w):w=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(ii,{className:"w-4 h-4 mr-1"}),e[21]=S):S=e[21],e[22]!==v||e[23]!==w?(N=c.jsxs(ke,{variant:"outline",className:"bg-background","aria-selected":v,size:"xs",onClick:w,children:[S,"Vertical Tree"]}),e[22]=v,e[23]=w,e[24]=N):N=e[24];const j=o==="LR";let C,_,T,I;e[25]!==n?(C=()=>n("LR"),e[25]=n,e[26]=C):C=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(ii,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=_):_=e[27],e[28]!==j||e[29]!==C?(T=c.jsxs(ke,{variant:"outline",className:"bg-background","aria-selected":j,size:"xs",onClick:C,children:[_," ","Horizontal Tree"]}),e[28]=j,e[29]=C,e[30]=T):T=e[30],e[31]!==y||e[32]!==N||e[33]!==T?(I=c.jsxs("div",{className:"flex gap-2",children:[y,N,T]}),e[31]=y,e[32]=N,e[33]=T,e[34]=I):I=e[34];const P=o!=="_minimap_"&&x;let L;return e[35]!==I||e[36]!==P?(L=c.jsxs(_l,{position:"top-right",className:"flex flex-col items-end gap-2",children:[I,P]}),e[35]=I,e[36]=P,e[37]=L):L=e[37],L});$h.displayName="GraphToolbar";const Ll=O.memo(t=>{const e=H.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=aA;let a;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(a=()=>{if(n.type==="node"){const u=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,x)=>c.jsxs(c.Fragment,{children:[m.length===0&&c.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),c.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>c.jsxs(G.Fragment,{children:[c.jsx(Uh,{declaredBy:g.declaredBy,name:g.name}),c.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,c.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),c.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:c.jsx(y2,{skipScroll:!0,onClick:()=>s(x==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(Ul,{className:"w-5 h-5"}),c.jsx(jo,{cellId:n.id}),c.jsx("div",{className:"flex-1"}),c.jsx(J0,{cellId:n.id,children:c.jsx(ke,{variant:"ghost",size:"icon",children:c.jsx(Bc,{className:"w-4 h-4"})})}),c.jsx(ke,{variant:"text",size:"icon",onClick:()=>{r()},children:c.jsx(En,{className:"w-4 h-4"})})]}),c.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx($m,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),c.jsx("hr",{className:"border-divider my-3"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(Qt,{className:"w-4 h-4"}),"Inputs"]}),f(u,"in")]})]})]})}if(n.type==="edge"){const u=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(ci,{className:"w-4 h-4"}),c.jsx(jo,{cellId:n.source}),c.jsx(Pc,{className:"w-4 h-4"}),c.jsx(jo,{cellId:n.target})]}),c.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:u.map(h=>c.jsxs(G.Fragment,{children:[c.jsx(Uh,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),c.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),c.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=a):a=e[6];const i=a;let l,d;return e[7]!==i?(l=i(),e[7]=i,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx(_l,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:c.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=d):d=e[10],d});function aA(t,e){const n=Ia(t);n&&jm(n,e)}function v2(){const t=H.c(7),e=wa(),n=at(lA),o=at(iA);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=PP(r,100);let a,i;t[2]!==s||t[3]!==o||t[4]!==n?(a=()=>{n&&o&&s()},i=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=a,t[6]=i):(a=t[5],i=t[6]),O.useEffect(a,i)}function iA(t){const{height:e}=t;return e}function lA(t){const{width:e}=t;return e}Ll.displayName="GraphSelectionPanel";const w2=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:Yr.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:Bh(et.get(e).code.trim().split(`
|
146
146
|
`).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],a=[];for(const[l,d]of Sm.zip(t,e)){const u=this.createNode(l,d,r);s.push(u),r=u.position.y+(u.height||0)}const i=new Set;for(const l of Object.values(n)){const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:a}}},cA=t=>{const e=H.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let a;e[0]!==r||e[1]!==n||e[2]!==o?(a=w2.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=a):a=e[3];const{nodes:i,edges:l}=a;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[4]=d):d=e[4];const[u,h]=f2(d),[f,m]=h2(i),[x,g]=O.useState(),[p,b]=O.useState(),y=O.useRef(!1);v2();const v=at(dA);let w;e[5]!==h||e[6]!==m?(w=k=>{m(k.nodes),h([])},e[5]=h,e[6]=m,e[7]=w):w=e[7];const S=ze(w);let N,j,C,_;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(N=()=>{y.current?S(w2.createElements(n,r,o,!1)):y.current=!0},j=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,e[11]=o,e[12]=N,e[13]=j):(N=e[12],j=e[13]),O.useEffect(N,j),e[14]!==l||e[15]!==x||e[16]!==h?(C=()=>{if(x){const k=l.filter(B=>{const{source:E,target:U,data:V}=B;return E===x&&V.direction==="outputs"||U===x&&V.direction==="inputs"});h(k)}},_=[x,h,l],e[14]=l,e[15]=x,e[16]=h,e[17]=C,e[18]=_):(C=e[17],_=e[18]),O.useEffect(C,_);const T=function(k,B){const E=H.c(17);let U,V;if(E[0]!==B||E[1]!==k){let Y;E[3]!==B?(Y=(oe,se)=>{const{position:re}=se;return Math.min(oe,re.y-B/2-10)},E[3]=B,E[4]=Y):Y=E[4],V=k.reduce(Y,Number.POSITIVE_INFINITY),E[0]=B,E[1]=k,E[2]=V}else V=E[2];const $=V;let K;if(E[5]!==B||E[6]!==k){let Y;E[8]!==B?(Y=(oe,se)=>{const{position:re}=se;return Math.max(oe,re.y+B/2+10)},E[8]=B,E[9]=Y):Y=E[9],K=k.reduce(Y,Number.NEGATIVE_INFINITY),E[5]=B,E[6]=k,E[7]=K}else K=E[7];const X=K;let J,ee,q;return E[10]!==$?(J=[Number.NEGATIVE_INFINITY,$],E[10]=$,E[11]=J):J=E[11],E[12]!==X?(ee=[Number.POSITIVE_INFINITY,X],E[12]=X,E[13]=ee):ee=E[13],E[14]!==J||E[15]!==ee?(q=[J,ee],E[14]=J,E[15]=ee,E[16]=q):q=E[16],U=q,U}(f,v);let I;e[19]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{g(void 0),b(void 0)},e[19]=I):I=e[19];const P=I;let L;e[20]!==u||e[21]!==p||e[22]!==x||e[23]!==o?(L=()=>p?c.jsx(Ll,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:P,variables:o,edges:u}):x?c.jsx(Ll,{selection:{type:"node",id:x},variables:o,edges:u,onClearSelection:P}):null,e[20]=u,e[21]=p,e[22]=x,e[23]=o,e[24]=L):L=e[24];const M=L;let R,z,D,A;return e[25]!==h?(R=(k,B)=>{const E=B.id;g(E),b(void 0),h([])},e[25]=h,e[26]=R):R=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(z=(k,B)=>{b(B)},e[27]=z):z=e[27],e[28]!==M?(D=M(),e[28]=M,e[29]=D):D=e[29],e[30]!==s||e[31]!==u||e[32]!==f||e[33]!==R||e[34]!==D||e[35]!==T?(A=c.jsxs(zh,{nodes:f,edges:u,nodeTypes:b2,translateExtent:T,onNodeClick:R,onNodeDoubleClick:uA,onEdgeClick:z,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Do.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:[D,s]}),e[30]=s,e[31]=u,e[32]=f,e[33]=R,e[34]=D,e[35]=T,e[36]=A):A=e[36],A};function dA(t){const{height:e}=t;return e}function uA(t,e){V3(e.id,"focus")}var Vh,k2,S2,N2,j2,C2,Hh,E2,Wh,_2,qh,I2,Gh,T2,Yh,A2,Kh,M2,Xh,O2,Jh,D2,Zh,P2,Qh,R2,ef,L2,tf,F2,nf,z2,of,B2,U2,$2,V2,H2,W2,q2,rf,G2,sf,Y2,af,K2,lf,X2,cf,J2,df,Z2,uf,Q2,hf,ew,ff,tw,mf,nw,pf,ow,gf,rw,xf,sw,bf,aw,iw,lw,cw,dw,uw,hw,yf,fw,vf,mw,pw,gw,wf,xw,kf,bw,Sf,yw,Nf,vw,jf,ww,kw,Sw,Nw,jw;function Cf(){if(k2)return Vh;k2=1;var t="\0";function e(s,a){s[a]?s[a]++:s[a]=1}function n(s,a){--s[a]||delete s[a]}function o(s,a,i,l){var d=""+a,u=""+i;if(!s&&d>u){var h=d;d=u,u=h}return d+""+u+""+(l===void 0?"\0":l)}function r(s,a){return o(s,a.v,a.w,a.name)}return Vh=class{constructor(s){Z(this,"_isDirected",!0);Z(this,"_isMultigraph",!1);Z(this,"_isCompound",!1);Z(this,"_label");Z(this,"_defaultNodeLabelFn",()=>{});Z(this,"_defaultEdgeLabelFn",()=>{});Z(this,"_nodes",{});Z(this,"_in",{});Z(this,"_preds",{});Z(this,"_out",{});Z(this,"_sucs",{});Z(this,"_edgeObjs",{});Z(this,"_edgeLabels",{});Z(this,"_nodeCount",0);Z(this,"_edgeCount",0);Z(this,"_parent");Z(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(a=>Object.keys(s._in[a]).length===0)}sinks(){var s=this;return this.nodes().filter(a=>Object.keys(s._out[a]).length===0)}setNodes(s,a){var i=arguments,l=this;return s.forEach(function(d){i.length>1?l.setNode(d,a):l.setNode(d)}),this}setNode(s,a){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=a),this):(this._nodes[s]=arguments.length>1?a: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 a=this;if(Object.hasOwn(this._nodes,s)){var i=l=>a.removeEdge(a._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){a.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(i),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(i),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,a){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(a===void 0)a=t;else{for(var i=a+="";i!==void 0;i=this.parent(i))if(i===s)throw new Error("Setting "+a+" as parent of "+s+" would create a cycle");this.setNode(a)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=a,this._children[a][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var a=this._parent[s];if(a!==t)return a}}children(s=t){if(this._isCompound){var a=this._children[s];if(a)return Object.keys(a)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var a=this._preds[s];if(a)return Object.keys(a)}successors(s){var a=this._sucs[s];if(a)return Object.keys(a)}neighbors(s){var a=this.predecessors(s);if(a){const l=new Set(a);for(var i of this.successors(s))l.add(i);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var a=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});a.setGraph(this.graph());var i=this;Object.entries(this._nodes).forEach(function([u,h]){s(u)&&a.setNode(u,h)}),Object.values(this._edgeObjs).forEach(function(u){a.hasNode(u.v)&&a.hasNode(u.w)&&a.setEdge(u,i.edge(u))});var l={};function d(u){var h=i.parent(u);return h===void 0||a.hasNode(h)?(l[u]=h,h):h in l?l[h]:d(h)}return this._isCompound&&a.nodes().forEach(u=>a.setParent(u,d(u))),a}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,a){var i=this,l=arguments;return s.reduce(function(d,u){return l.length>1?i.setEdge(d,u,a):i.setEdge(d,u),u}),this}setEdge(){var s,a,i,l,d=!1,u=arguments[0];typeof u=="object"&&u!==null&&"v"in u?(s=u.v,a=u.w,i=u.name,arguments.length===2&&(l=arguments[1],d=!0)):(s=u,a=arguments[1],i=arguments[3],arguments.length>2&&(l=arguments[2],d=!0)),s=""+s,a=""+a,i!==void 0&&(i=""+i);var h=o(this._isDirected,s,a,i);if(Object.hasOwn(this._edgeLabels,h))return d&&(this._edgeLabels[h]=l),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[h]=d?l:this._defaultEdgeLabelFn(s,a,i);var f=function(m,x,g,p){var b=""+x,y=""+g;if(!m&&b>y){var v=b;b=y,y=v}var w={v:b,w:y};return p&&(w.name=p),w}(this._isDirected,s,a,i);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[a],s),e(this._sucs[s],a),this._in[a][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i),d=this._edgeObjs[l];return d&&(s=d.v,a=d.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[a],s),n(this._sucs[s],a),delete this._in[a][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,a){var i=this._in[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.v===a):l}}outEdges(s,a){var i=this._out[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.w===a):l}}nodeEdges(s,a){var i=this.inEdges(s,a);if(i)return i.concat(this.outEdges(s,a))}},Vh}function hA(){return C2?j2:(C2=1,j2={Graph:Cf(),version:N2?S2:(N2=1,S2="2.2.4")})}function fA(){if(E2)return Hh;E2=1;var t=Cf();function e(o){return o.nodes().map(function(r){var s=o.node(r),a=o.parent(r),i={v:r};return s!==void 0&&(i.value=s),a!==void 0&&(i.parent=a),i})}function n(o){return o.edges().map(function(r){var s=o.edge(r),a={v:r.v,w:r.w};return r.name!==void 0&&(a.name=r.name),s!==void 0&&(a.value=s),a})}return Hh={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}},Hh}function mA(){return _2||(_2=1,Wh=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}),Wh}function Cw(){return I2?qh:(I2=1,qh=class{constructor(){Z(this,"_arr",[]);Z(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}},qh)}function Ew(){if(T2)return Gh;T2=1;var t=Cw();Gh=function(n,o,r,s){return function(a,i,l,d){var u,h,f={},m=new t,x=function(g){var p=g.v!==u?g.v:g.w,b=f[p],y=l(g),v=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);v<b.distance&&(b.distance=v,b.predecessor=u,m.decrease(p,v))};for(a.nodes().forEach(function(g){var p=g===i?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(u=m.removeMin(),(h=f[u]).distance!==Number.POSITIVE_INFINITY);)d(u).forEach(x);return f}(n,String(o),r||e,s||function(a){return n.outEdges(a)})};var e=()=>1;return Gh}function pA(){if(A2)return Yh;A2=1;var t=Ew();return Yh=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Yh}function _w(){return M2||(M2=1,Kh=function(t){var e=0,n=[],o={},r=[];function s(a){var i=o[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach(function(u){Object.hasOwn(o,u)?o[u].onStack&&(i.lowlink=Math.min(i.lowlink,o[u].index)):(s(u),i.lowlink=Math.min(i.lowlink,o[u].lowlink))}),i.lowlink===i.index){var l,d=[];do l=n.pop(),o[l].onStack=!1,d.push(l);while(a!==l);r.push(d)}}return t.nodes().forEach(function(a){Object.hasOwn(o,a)||s(a)}),r}),Kh}function gA(){if(O2)return Xh;O2=1;var t=_w();return Xh=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Xh}function xA(){if(D2)return Jh;D2=1,Jh=function(e,n,o){return function(r,s,a){var i={},l=r.nodes();return l.forEach(function(d){i[d]={},i[d][d]={distance:0},l.forEach(function(u){d!==u&&(i[d][u]={distance:Number.POSITIVE_INFINITY})}),a(d).forEach(function(u){var h=u.v===d?u.w:u.v,f=s(u);i[d][h]={distance:f,predecessor:d}})}),l.forEach(function(d){var u=i[d];l.forEach(function(h){var f=i[h];l.forEach(function(m){var x=f[d],g=u[m],p=f[m],b=x.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),i}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Jh}function Iw(){if(P2)return Zh;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new e;Object.hasOwn(o,i)||(r[i]=!0,o[i]=!0,n.predecessors(i).forEach(a),delete r[i],s.push(i))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}P2=1;class e extends Error{constructor(){super(...arguments)}}return Zh=t,t.CycleException=e,Zh}function bA(){if(R2)return Qh;R2=1;var t=Iw();return Qh=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Qh}function Tw(){if(L2)return ef;function t(o,r,s,a){for(var i=[[o,!1]];i.length>0;){var l=i.pop();l[1]?a.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,i.push([l[0],!0]),n(r(l[0]),d=>i.push([d,!1])))}}function e(o,r,s,a){for(var i=[o];i.length>0;){var l=i.pop();Object.hasOwn(s,l)||(s[l]=!0,a.push(l),n(r(l),d=>i.push(d)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return L2=1,ef=function(o,r,s){Array.isArray(r)||(r=[r]);var a=o.isDirected()?u=>o.successors(u):u=>o.neighbors(u),i=s==="post"?t:e,l=[],d={};return r.forEach(u=>{if(!o.hasNode(u))throw new Error("Graph does not have node: "+u);i(u,a,d,l)}),l},ef}function yA(){if(F2)return tf;F2=1;var t=Tw();return tf=function(e,n){return t(e,n,"post")},tf}function vA(){if(z2)return nf;z2=1;var t=Tw();return nf=function(e,n){return t(e,n,"pre")},nf}function wA(){if(B2)return of;B2=1;var t=Cf(),e=Cw();return of=function(n,o){var r,s=new t,a={},i=new e;function l(u){var h=u.v===r?u.w:u.v,f=i.priority(h);if(f!==void 0){var m=o(u);m<f&&(a[h]=r,i.decrease(h,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(u){i.add(u,Number.POSITIVE_INFINITY),s.setNode(u)}),i.decrease(n.nodes()[0],0);for(var d=!1;i.size()>0;){if(r=i.removeMin(),Object.hasOwn(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+n);d=!0}n.nodeEdges(r).forEach(l)}return s},of}function An(){if(H2)return V2;H2=1;var t=hA();return V2={Graph:t.Graph,json:fA(),alg:$2?U2:($2=1,U2={components:mA(),dijkstra:Ew(),dijkstraAll:pA(),findCycles:gA(),floydWarshall:xA(),isAcyclic:bA(),postorder:yA(),preorder:vA(),prim:wA(),tarjan:_w(),topsort:Iw()}),version:t.version}}function kA(){if(G2)return rf;G2=1;let t=An().Graph,e=function(){if(q2)return W2;function s(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function a(i,l){if(i!=="_next"&&i!=="_prev")return l}return q2=1,W2=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,l=i._prev;if(l!==i)return s(l),l}enqueue(i){let l=this._sentinel;i._prev&&i._next&&s(i),i._next=l._next,l._next._prev=i,l._next=i,i._prev=l}toString(){let i=[],l=this._sentinel,d=l._prev;for(;d!==l;)i.push(JSON.stringify(d,a)),d=d._prev;return"["+i.join(", ")+"]"}}}();rf=function(s,a){if(s.nodeCount()<=1)return[];let i=function(l,d){let u=new t,h=0,f=0;l.nodes().forEach(g=>{u.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=u.edge(g.v,g.w)||0,b=d(g),y=p+b;u.setEdge(g.v,g.w,y),f=Math.max(f,u.node(g.v).out+=b),h=Math.max(h,u.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+h+3).map(()=>new e),x=h+1;return u.nodes().forEach(g=>{r(m,x,u.node(g))}),{graph:u,buckets:m,zeroIdx:x}}(s,a||n);return function(l,d,u){let h,f=[],m=d[d.length-1],x=d[0];for(;l.nodeCount();){for(;h=x.dequeue();)o(l,d,u,h);for(;h=m.dequeue();)o(l,d,u,h);if(l.nodeCount()){for(let g=d.length-2;g>0;--g)if(h=d[g].dequeue(),h){f=f.concat(o(l,d,u,h,!0));break}}}return f}(i.graph,i.buckets,i.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,a,i,l,d){let u=d?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);d&&u.push({v:h.v,w:h.w}),m.out-=f,r(a,i,m)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),m=h.w,x=s.node(m);x.in-=f,r(a,i,x)}),s.removeNode(l.v),u}function r(s,a,i){i.out?i.in?s[i.out-i.in+a].enqueue(i):s[s.length-1].enqueue(i):s[0].enqueue(i)}return rf}function _t(){if(Y2)return sf;Y2=1;let t=An().Graph;function e(d,u,h,f){for(var m=f;d.hasNode(m);)m=a(f);return h.dummy=u,d.setNode(m,h),m}sf={addBorderNode:function(d,u,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(d,"border",m,u)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(d){let u=new t({multigraph:d.isMultigraph()}).setGraph(d.graph());return d.nodes().forEach(h=>{d.children(h).length||u.setNode(h,d.node(h))}),d.edges().forEach(h=>{u.setEdge(h,d.edge(h))}),u},buildLayerMatrix:function(d){let u=i(r(d)+1).map(()=>[]);return d.nodes().forEach(h=>{let f=d.node(h),m=f.rank;m!==void 0&&(u[m][f.order]=h)}),u},intersectRect:function(d,u){let h,f,m=d.x,x=d.y,g=u.x-m,p=u.y-x,b=d.width/2,y=d.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*y?(p<0&&(y=-y),h=y*g/p,f=y):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:x+f}},mapValues:function(d,u){let h=u;return typeof u=="string"&&(h=f=>f[u]),Object.entries(d).reduce((f,[m,x])=>(f[m]=h(x,m),f),{})},maxRank:r,normalizeRanks:function(d){let u=d.nodes().map(f=>{let m=d.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,u);d.nodes().forEach(f=>{let m=d.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(d,u){return u()},partition:function(d,u){let h={lhs:[],rhs:[]};return d.forEach(f=>{u(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(d,u){const h={};for(const f of u)d[f]!==void 0&&(h[f]=d[f]);return h},predecessorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},range:i,removeEmptyRanks:function(d){let u=d.nodes().map(g=>d.node(g).rank),h=o(Math.min,u),f=[];d.nodes().forEach(g=>{let p=d.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,x=d.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%x!==0?--m:g!==void 0&&m&&g.forEach(b=>d.node(b).rank+=m)})},simplify:function(d){let u=new t().setGraph(d.graph());return d.nodes().forEach(h=>u.setNode(h,d.node(h))),d.edges().forEach(h=>{let f=u.edge(h.v,h.w)||{weight:0,minlen:1},m=d.edge(h);u.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),u},successorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},time:function(d,u){let h=Date.now();try{return u()}finally{console.log(d+" time: "+(Date.now()-h)+"ms")}},uniqueId:a,zipObject:l};const n=65535;function o(d,u){if(u.length>n){const h=function(f,m=n){const x=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);x.push(p)}return x}(u);return d.apply(null,h.map(f=>d.apply(null,f)))}return d.apply(null,u)}function r(d){const u=d.nodes().map(h=>{let f=d.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,u)}let s=0;function a(d){return d+""+ ++s}function i(d,u,h=1){u==null&&(u=d,d=0);let f=x=>x<u;h<0&&(f=x=>u<x);const m=[];for(let x=d;f(x);x+=h)m.push(x);return m}function l(d,u){return d.reduce((h,f,m)=>(h[f]=u[m],h),{})}return sf}function SA(){if(K2)return af;K2=1;let t=kA(),e=_t().uniqueId;return af={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],a={},i={};function l(d){Object.hasOwn(i,d)||(i[d]=!0,a[d]=!0,r.outEdges(d).forEach(u=>{Object.hasOwn(a,u.w)?s.push(u):l(u.w)}),delete a[d])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},af}function NA(){if(X2)return lf;X2=1;let t=_t();return lf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,a,i,l=r.v,d=o.node(l).rank,u=r.w,h=o.node(u).rank,f=r.name,m=o.edge(r),x=m.labelRank;if(h!==d+1){for(o.removeEdge(r),i=0,++d;d<h;++i,++d)m.points=[],a={width:0,height:0,edgeLabel:m,edgeObj:r,rank:d},s=t.addDummyNode(o,"edge",a,"_d"),d===x&&(a.width=m.width,a.height=m.height,a.dummy="edge-label",a.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),i===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,u,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},lf}function Fl(){if(J2)return cf;J2=1;const{applyWithChunking:t}=_t();return cf={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 a=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var i=t(Math.min,a);return i===Number.POSITIVE_INFINITY&&(i=0),s.rank=i})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},cf}function Aw(){if(Z2)return df;Z2=1;var t=An().Graph,e=Fl().slack;function n(s,a){return s.nodes().forEach(function i(l){a.nodeEdges(l).forEach(d=>{var u=d.v,h=l===u?d.w:u;s.hasNode(h)||e(a,d)||(s.setNode(h,{}),s.setEdge(l,h,{}),i(h))})}),s.nodeCount()}function o(s,a){return a.edges().reduce((i,l)=>{let d=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(d=e(a,l)),d<i[0]?[d,l]:i},[Number.POSITIVE_INFINITY,null])[1]}function r(s,a,i){s.nodes().forEach(l=>a.node(l).rank+=i)}return df=function(s){var a,i,l=new t({directed:!1}),d=s.nodes()[0],u=s.nodeCount();for(l.setNode(d,{});n(l,s)<u;)a=o(l,s),i=l.hasNode(a.v)?e(s,a):-e(s,a),r(l,s,i);return l},df}function jA(){if(Q2)return uf;Q2=1;var t=Aw(),e=Fl().slack,n=Fl().longestPath,o=An().alg.preorder,r=An().alg.postorder,s=_t().simplify;function a(g){g=s(g),n(g);var p,b=t(g);for(d(b),i(b,g);p=h(b);)m(b,g,p,f(b,g,p))}function i(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(v,w,S){var N=v.node(S),j=N.parent;v.edge(S,j).cutvalue=l(v,w,S)}(g,p,y))}function l(g,p,b){var y=g.node(b).parent,v=!0,w=p.edge(b,y),S=0;return w||(v=!1,w=p.edge(y,b)),S=w.weight,p.nodeEdges(b).forEach(N=>{var j,C,_=N.v===b,T=_?N.w:N.v;if(T!==y){var I=_===v,P=p.edge(N).weight;if(S+=I?P:-P,j=b,C=T,g.hasEdge(j,C)){var L=g.edge(b,T).cutvalue;S+=I?-L:L}}}),S}function d(g,p){arguments.length<2&&(p=g.nodes()[0]),u(g,{},1,p)}function u(g,p,b,y,v){var w=b,S=g.node(y);return p[y]=!0,g.neighbors(y).forEach(N=>{Object.hasOwn(p,N)||(b=u(g,p,b,N,y))}),S.low=w,S.lim=b++,v?S.parent=v:delete S.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var y=b.v,v=b.w;p.hasEdge(y,v)||(y=b.w,v=b.v);var w=g.node(y),S=g.node(v),N=w,j=!1;w.lim>S.lim&&(N=S,j=!0);var C=p.edges().filter(_=>j===x(g,g.node(_.v),N)&&j!==x(g,g.node(_.w),N));return C.reduce((_,T)=>e(p,T)<e(p,_)?T:_)}function m(g,p,b,y){var v=b.v,w=b.w;g.removeEdge(v,w),g.setEdge(y.v,y.w,{}),d(g),i(g,p),function(S,N){var j=S.nodes().find(_=>!N.node(_).parent),C=o(S,j);(C=C.slice(1)).forEach(_=>{var T=S.node(_).parent,I=N.edge(_,T),P=!1;I||(I=N.edge(T,_),P=!0),N.node(_).rank=N.node(T).rank+(P?I.minlen:-I.minlen)})}(g,p)}function x(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return uf=a,a.initLowLimValues=d,a.initCutValues=i,a.calcCutValue=l,a.leaveEdge=h,a.enterEdge=f,a.exchangeEdges=m,uf}function CA(){if(ew)return hf;ew=1;var t=Fl().longestPath,e=Aw(),n=jA();hf=function(s){var a=s.graph().ranker;if(a instanceof Function)return a(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);case"none":}};var o=t;function r(s){n(s)}return hf}function EA(){return tw||(tw=1,ff=function(t){let e=function(n){let o={},r=0;function s(a){let i=r;n.children(a).forEach(s),o[a]={low:i,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(h,f,m,x){let g,p,b=[],y=[],v=Math.min(f[m].low,f[x].low),w=Math.max(f[m].lim,f[x].lim);g=m;do g=h.parent(g),b.push(g);while(g&&(f[g].low>v||w>f[g].lim));for(p=g,g=x;(g=h.parent(g))!==p;)y.push(g);return{path:b.concat(y.reverse()),lca:p}}(t,e,r.v,r.w),a=s.path,i=s.lca,l=0,d=a[l],u=!0;for(;n!==r.w;){if(o=t.node(n),u){for(;(d=a[l])!==i&&t.node(d).maxRank<o.rank;)l++;d===i&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(d=a[l+1]).minRank<=o.rank;)l++;d=a[l]}t.setParent(n,d),n=t.successors(n)[0]}})}),ff}function _A(){if(nw)return mf;nw=1;let t=_t();function e(n,o,r,s,a,i,l){let d=n.children(l);if(!d.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(h,l),f.borderBottom=h,d.forEach(m=>{e(n,o,r,s,a,i,m);let x=n.node(m),g=x.borderTop?x.borderTop:m,p=x.borderBottom?x.borderBottom:m,b=x.borderTop?s:2*s,y=g!==p?1:a-i[l]+1;n.setEdge(u,g,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:a+i[l]})}return mf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(d){var u={};function h(f,m){var x=d.children(f);x&&x.length&&x.forEach(g=>h(g,m+1)),u[f]=m}return d.children().forEach(f=>h(f,1)),u}(n),s=Object.values(r),a=t.applyWithChunking(Math.max,s)-1,i=2*a+1;n.graph().nestingRoot=o,n.edges().forEach(d=>n.edge(d).minlen*=i);let l=function(d){return d.edges().reduce((u,h)=>u+d.edge(h).weight,0)}(n)+1;n.children().forEach(d=>e(n,o,i,l,a,r,d)),n.graph().nodeRankFactor=i},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)})}},mf}function IA(){if(rw)return gf;function t(r){r.nodes().forEach(s=>e(r.node(s))),r.edges().forEach(s=>e(r.edge(s)))}function e(r){let s=r.width;r.width=r.height,r.height=s}function n(r){r.y=-r.y}function o(r){let s=r.x;r.x=r.y,r.y=s}return rw=1,gf={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(a){a.nodes().forEach(i=>n(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(a){a.nodes().forEach(i=>o(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},gf}function TA(){if(dw)return cw;dw=1;let t=_t();return cw=function(e,n){let o={};return e.forEach((r,s)=>{let a=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(a.barycenter=r.barycenter,a.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],a=o[r.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function a(l){return d=>{d.merged||(d.barycenter===void 0||l.barycenter===void 0||d.barycenter>=l.barycenter)&&function(u,h){let f=0,m=0;u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),u.vs=h.vs.concat(u.vs),u.barycenter=f/m,u.weight=m,u.i=Math.min(h.i,u.i),h.merged=!0}(l,d)}}function i(l){return d=>{d.in.push(l),--d.indegree===0&&r.push(d)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(a(l)),l.out.forEach(i(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function AA(){if(fw)return yf;fw=1;let t=(lw||(lw=1,iw=function(o,r=[]){return r.map(s=>{let a=o.inEdges(s);if(a.length){let i=a.reduce((l,d)=>{let u=o.edge(d),h=o.node(d.v);return{sum:l.sum+u.weight*h.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:s,barycenter:i.sum/i.weight,weight:i.weight}}return{v:s}})}),iw),e=TA(),n=function(){if(hw)return uw;hw=1;let o=_t();function r(s,a,i){let l;for(;a.length&&(l=a[a.length-1]).i<=i;)a.pop(),s.push(l.vs),i++;return i}return uw=function(s,a){let i=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=i.lhs,d=i.rhs.sort((p,b)=>b.i-p.i),u=[],h=0,f=0,m=0;var x;l.sort((x=!!a,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:x?b.i-p.i:p.i-b.i)),m=r(u,d,m),l.forEach(p=>{m+=p.vs.length,u.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(u,d,m)});let g={vs:u.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return yf=function o(r,s,a,i){let l=r.children(s),d=r.node(s),u=d?d.borderLeft:void 0,h=d?d.borderRight:void 0,f={};u&&(l=l.filter(p=>p!==u&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let v=o(r,p.v,a,i);f[p.v]=v,Object.hasOwn(v,"barycenter")&&(y=v,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+y.barycenter*y.weight)/(b.weight+y.weight),b.weight+=y.weight):(b.barycenter=y.barycenter,b.weight=y.weight))}var b,y});let x=e(m,a);(function(p,b){p.forEach(y=>{y.vs=y.vs.flatMap(v=>b[v]?b[v].vs:v)})})(x,f);let g=n(x,i);if(u&&(g.vs=[u,g.vs,h].flat(!0),r.predecessors(u).length)){let p=r.node(r.predecessors(u)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},yf}function MA(){if(mw)return vf;mw=1;let t=An().Graph,e=_t();return vf=function(n,o,r){let s=function(i){for(var l;i.hasNode(l=e.uniqueId("_root")););return l}(n),a=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(i=>n.node(i));return n.nodes().forEach(i=>{let l=n.node(i),d=n.parent(i);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(a.setNode(i),a.setParent(i,d||s),n[r](i).forEach(u=>{let h=u.v===i?u.w:u.v,f=a.edge(h,i),m=f!==void 0?f.weight:0;a.setEdge(h,i,{weight:n.edge(u).weight+m})}),Object.hasOwn(l,"minRank")&&a.setNode(i,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),a},vf}function OA(){if(xw)return wf;xw=1;let t=function(){if(sw)return xf;sw=1;let u=_t();return xf=function(h){let f={},m=h.nodes().filter(y=>!h.children(y).length),x=m.map(y=>h.node(y).rank),g=u.applyWithChunking(Math.max,x),p=u.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let v=h.node(y);p[v.rank].push(y),h.successors(y).forEach(b)}return m.sort((y,v)=>h.node(y).rank-h.node(v).rank).forEach(b),p},xf}(),e=function(){if(aw)return bf;aw=1;let u=_t().zipObject;function h(f,m,x){let g=u(x,x.map((S,N)=>N)),p=m.flatMap(S=>f.outEdges(S).map(N=>({pos:g[N.w],weight:f.edge(N).weight})).sort((N,j)=>N.pos-j.pos)),b=1;for(;b<x.length;)b<<=1;let y=2*b-1;b-=1;let v=new Array(y).fill(0),w=0;return p.forEach(S=>{let N=S.pos+b;v[N]+=S.weight;let j=0;for(;N>0;)N%2&&(j+=v[N+1]),N=N-1>>1,v[N]+=S.weight;w+=S.weight*j}),w}return bf=function(f,m){let x=0;for(let g=1;g<m.length;++g)x+=h(f,m[g-1],m[g]);return x},bf}(),n=AA(),o=MA(),r=(gw||(gw=1,pw=function(u,h,f){let m,x={};f.forEach(g=>{let p,b,y=u.parent(g);for(;y;){if(p=u.parent(y),p?(b=x[p],x[p]=y):(b=m,m=y),b&&b!==y)return void h.setEdge(b,y);y=p}})}),pw),s=An().Graph,a=_t();function i(u,h,f){return h.map(function(m){return o(u,m,f)})}function l(u,h){let f=new s;u.forEach(function(m){let x=m.graph().root,g=n(m,x,f,h);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function d(u,h){Object.values(h).forEach(f=>f.forEach((m,x)=>u.node(m).order=x))}return wf=function u(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,u);let m=a.maxRank(h),x=i(h,a.range(1,m+1),"inEdges"),g=i(h,a.range(m-1,-1,-1),"outEdges"),p=t(h);if(d(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let v=0,w=0;w<4;++v,++w){l(v%2?x:g,v%4>=2),p=a.buildLayerMatrix(h);let S=e(h,p);S<y&&(w=0,b=Object.assign({},p),y=S)}d(h,b)},wf}function DA(){if(bw)return kf;bw=1;let t=An().Graph,e=_t();function n(h,f){let m={};return f.length&&f.reduce(function(x,g){let p=0,b=0,y=x.length,v=g[g.length-1];return g.forEach((w,S)=>{let N=function(C,_){if(C.node(_).dummy)return C.predecessors(_).find(T=>C.node(T).dummy)}(h,w),j=N?h.node(N).order:y;(N||w===v)&&(g.slice(b,S+1).forEach(C=>{h.predecessors(C).forEach(_=>{let T=h.node(_),I=T.order;!(I<p||j<I)||T.dummy&&h.node(C).dummy||r(m,_,C)})}),b=S+1,p=j)}),g}),m}function o(h,f){let m={};function x(g,p,b,y,v){let w;e.range(p,b).forEach(S=>{w=g[S],h.node(w).dummy&&h.predecessors(w).forEach(N=>{let j=h.node(N);j.dummy&&(j.order<y||j.order>v)&&r(m,N,w)})})}return f.length&&f.reduce(function(g,p){let b,y=-1,v=0;return p.forEach((w,S)=>{if(h.node(w).dummy==="border"){let N=h.predecessors(w);N.length&&(b=h.node(N[0]).order,x(p,v,S,y,b),v=S,y=b)}x(p,v,p.length,b,g.length)}),p}),m}function r(h,f,m){if(f>m){let g=f;f=m,m=g}let x=h[f];x||(h[f]=x={}),x[m]=!0}function s(h,f,m){if(f>m){let x=f;f=m,m=x}return!!h[f]&&Object.hasOwn(h[f],m)}function a(h,f,m,x){let g={},p={},b={};return f.forEach(y=>{y.forEach((v,w)=>{g[v]=v,p[v]=v,b[v]=w})}),f.forEach(y=>{let v=-1;y.forEach(w=>{let S=x(w);if(S.length){S=S.sort((j,C)=>b[j]-b[C]);let N=(S.length-1)/2;for(let j=Math.floor(N),C=Math.ceil(N);j<=C;++j){let _=S[j];p[w]===w&&v<b[_]&&!s(m,w,_)&&(p[_]=w,p[w]=g[w]=g[_],v=b[_])}}})}),{root:g,align:p}}function i(h,f,m,x,g){let p={},b=function(w,S,N,j){let C=new t,_=w.graph(),T=function(I,P,L){return(M,R,z)=>{let D,A=M.node(R),k=M.node(z),B=0;if(B+=A.width/2,Object.hasOwn(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":D=-A.width/2;break;case"r":D=A.width/2}if(D&&(B+=L?D:-D),D=0,B+=(A.dummy?P:I)/2,B+=(k.dummy?P:I)/2,B+=k.width/2,Object.hasOwn(k,"labelpos"))switch(k.labelpos.toLowerCase()){case"l":D=k.width/2;break;case"r":D=-k.width/2}return D&&(B+=L?D:-D),D=0,B}}(_.nodesep,_.edgesep,j);return S.forEach(I=>{let P;I.forEach(L=>{let M=N[L];if(C.setNode(M),P){var R=N[P],z=C.edge(R,M);C.setEdge(R,M,Math.max(T(w,L,P),z||0))}P=L})}),C}(h,f,m,g),y=g?"borderLeft":"borderRight";function v(w,S){let N=b.nodes(),j=N.pop(),C={};for(;j;)C[j]?w(j):(C[j]=!0,N.push(j),N=N.concat(S(j))),j=N.pop()}return v(function(w){p[w]=b.inEdges(w).reduce((S,N)=>Math.max(S,p[N.v]+b.edge(N)),0)},b.predecessors.bind(b)),v(function(w){let S=b.outEdges(w).reduce((j,C)=>Math.min(j,p[C.w]-b.edge(C)),Number.POSITIVE_INFINITY),N=h.node(w);S!==Number.POSITIVE_INFINITY&&N.borderType!==y&&(p[w]=Math.max(p[w],S))},b.successors.bind(b)),Object.keys(x).forEach(w=>p[w]=p[m[w]]),p}function l(h,f){return Object.values(f).reduce((m,x)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(x).forEach(([y,v])=>{let w=function(S,N){return S.node(N).width}(h,y)/2;g=Math.max(v+w,g),p=Math.min(v-w,p)});const b=g-p;return b<m[0]&&(m=[b,x]),m},[Number.POSITIVE_INFINITY,null])[1]}function d(h,f){let m=Object.values(f),x=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let y=p+b,v=h[y];if(v===f)return;let w=Object.values(v),S=x-e.applyWithChunking(Math.min,w);b!=="l"&&(S=g-e.applyWithChunking(Math.max,w)),S&&(h[y]=e.mapValues(v,N=>N+S))})})}function u(h,f){return e.mapValues(h.ul,(m,x)=>{if(f)return h[f.toLowerCase()][x];{let g=Object.values(h).map(p=>p[x]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return kf={positionX:function(h){let f,m=e.buildLayerMatrix(h),x=Object.assign(n(h,m),o(h,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(N=>Object.values(N).reverse()));let v=(b==="u"?h.predecessors:h.successors).bind(h),w=a(h,f,x,v),S=i(h,f,w.root,w.align,y==="r");y==="r"&&(S=e.mapValues(S,N=>-N)),g[b+y]=S})});let p=l(h,g);return d(g,p),u(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:a,horizontalCompaction:i,alignCoordinates:d,findSmallestWidthAlignment:l,balance:u},kf}function PA(){if(yw)return Sf;yw=1;let t=_t(),e=DA().positionX;return Sf=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,a=0;r.forEach(i=>{const l=i.reduce((d,u)=>{const h=o.node(u).height;return d>h?d:h},0);i.forEach(d=>o.node(d).y=a+l/2),a+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Sf}function RA(){if(vw)return Nf;vw=1;let t=SA(),e=NA(),n=CA(),o=_t().normalizeRanks,r=EA(),s=_t().removeEmptyRanks,a=_A(),i=function(){if(ow)return pf;ow=1;let j=_t();function C(_,T,I,P,L,M){let R={width:0,height:0,rank:M,borderType:T},z=L[T][M-1],D=j.addDummyNode(_,"border",R,I);L[T][M]=D,_.setParent(D,P),z&&_.setEdge(z,D,{weight:1})}return pf=function(_){_.children().forEach(function T(I){let P=_.children(I),L=_.node(I);if(P.length&&P.forEach(T),Object.hasOwn(L,"minRank")){L.borderLeft=[],L.borderRight=[];for(let M=L.minRank,R=L.maxRank+1;M<R;++M)C(_,"borderLeft","_bl",I,L,M),C(_,"borderRight","_br",I,L,M)}})},pf}(),l=IA(),d=OA(),u=PA(),h=_t(),f=An().Graph;Nf=function(j,C){let _=C&&C.debugTiming?h.time:h.notime;_("layout",()=>{let T=_(" buildLayoutGraph",()=>function(I){let P=new f({multigraph:!0,compound:!0}),L=N(I.graph());return P.setGraph(Object.assign({},x,S(L,m),h.pick(L,g))),I.nodes().forEach(M=>{const R=S(N(I.node(M)),p);Object.keys(b).forEach(z=>{R[z]===void 0&&(R[z]=b[z])}),P.setNode(M,R),P.setParent(M,I.parent(M))}),I.edges().forEach(M=>{let R=N(I.edge(M));P.setEdge(M,Object.assign({},v,S(R,y),h.pick(R,w)))}),P}(j));_(" runLayout",()=>function(I,P,L){P(" makeSpaceForEdgeLabels",()=>function(M){let R=M.graph();R.ranksep/=2,M.edges().forEach(z=>{let D=M.edge(z);D.minlen*=2,D.labelpos.toLowerCase()!=="c"&&(R.rankdir==="TB"||R.rankdir==="BT"?D.width+=D.labeloffset:D.height+=D.labeloffset)})}(I)),P(" removeSelfEdges",()=>function(M){M.edges().forEach(R=>{if(R.v===R.w){var z=M.node(R.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:R,label:M.edge(R)}),M.removeEdge(R)}})}(I)),P(" acyclic",()=>t.run(I)),P(" nestingGraph.run",()=>a.run(I)),P(" rank",()=>n(h.asNonCompoundGraph(I))),P(" injectEdgeLabelProxies",()=>function(M){M.edges().forEach(R=>{let z=M.edge(R);if(z.width&&z.height){let D=M.node(R.v),A={rank:(M.node(R.w).rank-D.rank)/2+D.rank,e:R};h.addDummyNode(M,"edge-proxy",A,"_ep")}})}(I)),P(" removeEmptyRanks",()=>s(I)),P(" nestingGraph.cleanup",()=>a.cleanup(I)),P(" normalizeRanks",()=>o(I)),P(" assignRankMinMax",()=>function(M){let R=0;M.nodes().forEach(z=>{let D=M.node(z);D.borderTop&&(D.minRank=M.node(D.borderTop).rank,D.maxRank=M.node(D.borderBottom).rank,R=Math.max(R,D.maxRank))}),M.graph().maxRank=R}(I)),P(" removeEdgeLabelProxies",()=>function(M){M.nodes().forEach(R=>{let z=M.node(R);z.dummy==="edge-proxy"&&(M.edge(z.e).labelRank=z.rank,M.removeNode(R))})}(I)),P(" normalize.run",()=>e.run(I)),P(" parentDummyChains",()=>r(I)),P(" addBorderSegments",()=>i(I)),P(" order",()=>d(I,L)),P(" insertSelfEdges",()=>function(M){var R=h.buildLayerMatrix(M);R.forEach(z=>{var D=0;z.forEach((A,k)=>{var B=M.node(A);B.order=k+D,(B.selfEdges||[]).forEach(E=>{h.addDummyNode(M,"selfedge",{width:E.label.width,height:E.label.height,rank:B.rank,order:k+ ++D,e:E.e,label:E.label},"_se")}),delete B.selfEdges})})}(I)),P(" adjustCoordinateSystem",()=>l.adjust(I)),P(" position",()=>u(I)),P(" positionSelfEdges",()=>function(M){M.nodes().forEach(R=>{var z=M.node(R);if(z.dummy==="selfedge"){var D=M.node(z.e.v),A=D.x+D.width/2,k=D.y,B=z.x-A,E=D.height/2;M.setEdge(z.e,z.label),M.removeNode(R),z.label.points=[{x:A+2*B/3,y:k-E},{x:A+5*B/6,y:k-E},{x:A+B,y:k},{x:A+5*B/6,y:k+E},{x:A+2*B/3,y:k+E}],z.label.x=z.x,z.label.y=z.y}})}(I)),P(" removeBorderNodes",()=>function(M){M.nodes().forEach(R=>{if(M.children(R).length){let z=M.node(R),D=M.node(z.borderTop),A=M.node(z.borderBottom),k=M.node(z.borderLeft[z.borderLeft.length-1]),B=M.node(z.borderRight[z.borderRight.length-1]);z.width=Math.abs(B.x-k.x),z.height=Math.abs(A.y-D.y),z.x=k.x+z.width/2,z.y=D.y+z.height/2}}),M.nodes().forEach(R=>{M.node(R).dummy==="border"&&M.removeNode(R)})}(I)),P(" normalize.undo",()=>e.undo(I)),P(" fixupEdgeLabelCoords",()=>function(M){M.edges().forEach(R=>{let z=M.edge(R);if(Object.hasOwn(z,"x"))switch(z.labelpos!=="l"&&z.labelpos!=="r"||(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset}})}(I)),P(" undoCoordinateSystem",()=>l.undo(I)),P(" translateGraph",()=>function(M){let R=Number.POSITIVE_INFINITY,z=0,D=Number.POSITIVE_INFINITY,A=0,k=M.graph(),B=k.marginx||0,E=k.marginy||0;function U(V){let $=V.x,K=V.y,X=V.width,J=V.height;R=Math.min(R,$-X/2),z=Math.max(z,$+X/2),D=Math.min(D,K-J/2),A=Math.max(A,K+J/2)}M.nodes().forEach(V=>U(M.node(V))),M.edges().forEach(V=>{let $=M.edge(V);Object.hasOwn($,"x")&&U($)}),R-=B,D-=E,M.nodes().forEach(V=>{let $=M.node(V);$.x-=R,$.y-=D}),M.edges().forEach(V=>{let $=M.edge(V);$.points.forEach(K=>{K.x-=R,K.y-=D}),Object.hasOwn($,"x")&&($.x-=R),Object.hasOwn($,"y")&&($.y-=D)}),k.width=z-R+B,k.height=A-D+E}(I)),P(" assignNodeIntersects",()=>function(M){M.edges().forEach(R=>{let z,D,A=M.edge(R),k=M.node(R.v),B=M.node(R.w);A.points?(z=A.points[0],D=A.points[A.points.length-1]):(A.points=[],z=B,D=k),A.points.unshift(h.intersectRect(k,z)),A.points.push(h.intersectRect(B,D))})}(I)),P(" reversePoints",()=>function(M){M.edges().forEach(R=>{let z=M.edge(R);z.reversed&&z.points.reverse()})}(I)),P(" acyclic.undo",()=>t.undo(I))}(T,_,C)),_(" updateInputGraph",()=>function(I,P){I.nodes().forEach(L=>{let M=I.node(L),R=P.node(L);M&&(M.x=R.x,M.y=R.y,M.rank=R.rank,P.children(L).length&&(M.width=R.width,M.height=R.height))}),I.edges().forEach(L=>{let M=I.edge(L),R=P.edge(L);M.points=R.points,Object.hasOwn(R,"x")&&(M.x=R.x,M.y=R.y)}),I.graph().width=P.graph().width,I.graph().height=P.graph().height}(j,T))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],x={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height","rank"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],v={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},w=["labelpos"];function S(j,C){return h.mapValues(h.pick(j,C),Number)}function N(j){var C={};return j&&Object.entries(j).forEach(([_,T])=>{typeof _=="string"&&(_=_.toLowerCase()),C[_]=T}),C}return Nf}function LA(){if(ww)return jf;ww=1;let t=_t(),e=An().Graph;return jf={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,a)=>{let i="layer"+a;r.setNode(i,{rank:"same"}),s.reduce((l,d)=>(r.setEdge(l,d,{style:"invis"}),d))}),r}},jf}var Mw=jw?Nw:(jw=1,Nw={graphlib:An(),layout:RA(),debug:LA(),util:{time:_t().time,notime:_t().notime},version:Sw?kw:(Sw=1,kw="1.1.5")});const Na=new Mw.graphlib.Graph().setDefaultEdgeLabel(()=>({})),Ow=({nodes:t,edges:e,direction:n})=>(Na.setGraph({rankdir:n,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Na.setEdge(o.source,o.target)),t.forEach(o=>Na.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),Mw.layout(Na),{nodes:t.map(o=>{const{x:r,y:s}=Na.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),Dw=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:Yr.ArrowClosed},id:`${t}-${e}`,style:{strokeWidth:2},source:t,sourceHandle:"outputs",targetHandle:"inputs",target:e}}createNode(t,e){return{id:t,data:{atom:e,forceWidth:300},width:300,type:"custom",height:Bh(et.get(e).code.trim().split(`
|
147
|
-
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],a=new Set,i=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.add(h),a.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of Sm.zip(t,e)){o||r.push(this.createNode(l,d));const u=a.has(l),h=et.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},FA=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:a,settings:i}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a||e[3]!==i.hidePureMarkdown||e[4]!==o?(l=()=>{let k=Dw.createElements(n,r,o,i.hidePureMarkdown);return k=Ow({nodes:k.nodes,edges:k.edges,direction:a}),k},e[0]=r,e[1]=n,e[2]=a,e[3]=i.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=O.useState(l),[u,h,f]=h2(d.nodes),[m,x,g]=f2(d.edges),p=wa();let b;e[6]!==a||e[7]!==x||e[8]!==h?(b=k=>{const B=Ow({nodes:k.nodes,edges:k.edges,direction:a});h(B.nodes),x(B.edges)},e[6]=a,e[7]=x,e[8]=h,e[9]=b):b=e[9];const y=ze(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==i.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(Dw.createElements(n,r,o,i.hidePureMarkdown))},w=[n,o,r,y,i.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=i.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),O.useEffect(v,w);const[S,N]=O.useState();let j;v2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{N(void 0)},e[17]=j):j=e[17];const C=j;let _,T,I,P,L,M,R,z,D,A;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},T=(k,B)=>{N({type:"node",id:B.id})},I=(k,B)=>{const{source:E,target:U}=B;N({type:"edge",source:E,target:U})},e[18]=_,e[19]=T,e[20]=I):(_=e[18],T=e[19],I=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(rA,{color:"#ccc",variant:kn.Dots}),e[21]=P):P=e[21],e[22]!==p||e[23]!==u?(L=()=>{const k=et.get(RP);if(k){const B=u.find(E=>E.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),N({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=L):L=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsx(ip,{className:"size-4"}),e[25]=M):M=e[25],e[26]!==L?(R=c.jsx(ZT,{position:"bottom-right",showInteractive:!1,children:c.jsx(je,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(ns,{onMouseDown:Dn.preventFocus,onClick:L,children:M})})}),e[26]=L,e[27]=R):R=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(z=c.jsx(Ll,{selection:S,variables:o,edges:m,onClearSelection:C}),e[28]=m,e[29]=S,e[30]=o,e[31]=z):z=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==R||e[38]!==z?(D=c.jsxs(zh,{nodes:u,edges:m,nodeTypes:b2,minZoom:.2,fitViewOptions:_,onNodeClick:T,onEdgeClick:I,onNodeDoubleClick:zA,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[P,R,z,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=R,e[38]=z,e[39]=D):D=e[39],e[40]!==a||e[41]!==D?(A=c.jsx(g2,{value:a,children:D}),e[40]=a,e[41]=D,e[42]=A):A=e[42],A};function zA(t,e){V3(e.id,"focus")}const BA=yt("_minimap_"),UA=yt({hidePureMarkdown:!0}),$A=t=>{const e=H.c(11),[n,o]=Ot(BA),[r,s]=Ot(UA);let a;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(a=()=>n==="_minimap_"?c.jsx(cA,{...t,children:c.jsx($h,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(FA,{...t,settings:r,layoutDirection:n,children:c.jsx($h,{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]=a):a=e[5];const i=a;let l,d;return e[6]!==i?(l=i(),e[6]=i,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(Fh,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},VA=()=>{const t=H.c(5),e=Cm(),n=Tc(),[o]=LP();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=me("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx($A,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},HA=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=G.useState(!1);let a,i;return e[0]!==r||e[1]!==n?(a=()=>{n&&!r&&s(!0)},i=[n,r],e[0]=r,e[1]=n,e[2]=a,e[3]=i):(a=e[2],i=e[3]),G.useEffect(a,i),r?o:null},WA=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=et.get(cc)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=Ia(l);d&&jm(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let a,i;return e[2]!==o?(a=me("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a||e[6]!==n?(i=c.jsx("button",{type:"button",onClick:s,className:a,children:n}),e[4]=s,e[5]=a,e[6]=n,e[7]=i):i=e[7],i},qA=yt(t=>{const e=t(FP),n=t(cc),o=t(Nc);return oi(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(i=>i.name===r.variable_name);if(!s)return 0;const a=o.inOrderIds.indexOf(s.declaredBy[0]);return a===-1?0:a})}),GA=yt(t=>{const e=new Map(t(zP));for(const n of H3){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return oi([...e.values()],n=>H3.has(n.name)?1:0)}),YA=()=>{const t=H.c(32),[e,n]=G.useState(""),o=St(W3),r=Ie(qA),s=Ie(GA);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(lg,{children:c.jsxs(ke,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(Ko,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx($o,{})}),t[0]=b):b=t[0],b}const a=!!e.trim();let i,l,d,u,h,f,m,x,g,p;if(t[1]!==o?(i=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=i):i=t[2],t[3]!==e||t[4]!==i?(l=c.jsx(Ma,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:i,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=i,t[5]=l):l=t[5],t[6]!==a?(d=a&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(En,{className:"h-4 w-4"})}),t[6]=a,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(lg,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Ko,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==a||t[14]!==e){let b;t[16]!==a||t[17]!==e?(b=y=>c.jsx(KA,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>c.jsx(XA,{engineName:y.name,database:v,hasSearch:a,children:c.jsx(JA,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:a,searchValue:e})},v.name))},y.name),t[16]=a,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=a,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&c.jsxs(q3,{children:[c.jsx(Yl,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(x=r.length>0&&c.jsx(Pw,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=x):x=t[24],t[25]!==f||t[26]!==m||t[27]!==x?(g=c.jsxs(pm,{className:"flex flex-col",children:[f,m,x]}),t[25]=f,t[26]=m,t[27]=x,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(ac,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},KA=t=>{const e=H.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===BP,a=s?"In-Memory":n.name,[i,l]=G.useState(!1);let d;e[0]!==n.name?(d=async()=>{l(!0),await $P({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=d):d=e[1];const u=d;let h,f,m;e[2]!==n.dialect?(h=c.jsx(Dk,{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=UP(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=c.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const x=a;let g,p,b,y,v;return e[8]!==x?(g=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(WA,{variableName:x}),")"]}),e[8]=x,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==i?(p=!s&&c.jsx(je,{content:"Refresh connection",children:c.jsx(ke,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:c.jsx(bc,{className:me("h-4 w-4 text-muted-foreground hover:text-foreground",i&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=i,e[13]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=c.jsxs(q3,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:c.jsx(Ac,{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?(v=c.jsxs(c.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=v):v=e[24],v},XA=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[a,i]=G.useState(!1),[l,d]=G.useState(!1);let u,h,f;e[0]!==n?(u=()=>{i(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),G.useEffect(u,h),e[3]!==a||e[4]!==l?(f=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let x;e[6]!==a?(x=c.jsx(Z3,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=me("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx($o,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S,N;e[12]!==y?(v=me(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(S=c.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==x||e[23]!==b?(N=c.jsxs(Gn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[x,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=x,e[23]=b,e[24]=N):N=e[24];const j=a&&s;let C;return e[25]!==N||e[26]!==j?(C=c.jsxs(c.Fragment,{children:[N,j]}),e[25]=N,e[26]=j,e[27]=C):C=e[27],C},JA=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:a,hasSearch:i,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ac,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,u;if(e[1]!==a||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=x=>!l||x.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==a||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==i||e[16]!==l?(m=x=>c.jsx(ZA,{databaseName:a,schema:x,hasSearch:i,children:c.jsx(Pw,{tables:x.tables,searchValue:l,sqlTableContext:{engine:s,database:a,schema:x.name,defaultSchema:o,defaultDatabase:r}})},x.name),e[11]=a,e[12]=r,e[13]=o,e[14]=s,e[15]=i,e[16]=l,e[17]=m):m=e[17],d=f.map(m),e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},ZA=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[a,i]=G.useState(!1),[l,d]=G.useState(!1),u=`${n}:${o.name}`;let h,f,m,x;if(e[0]!==s?(h=()=>{i(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),G.useEffect(h,f),J3(o.name))return r;e[3]!==a||e[4]!==l?(m=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=m):m=e[5],e[6]!==a?(x=c.jsx(Z3,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a&&"text-foreground";let p,b;e[8]!==g?(p=me("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(KP,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S;e[12]!==y?(v=me(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=c.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==x||e[20]!==b||e[21]!==u?(S=c.jsxs(Gn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[x,b,w]}),e[17]=w,e[18]=m,e[19]=x,e[20]=b,e[21]=u,e[22]=S):S=e[22];const N=a&&r;let j;return e[23]!==S||e[24]!==N?(j=c.jsxs(c.Fragment,{children:[S,N]}),e[23]=S,e[24]=N,e[25]=j):j=e[25],j},Pw=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=G3(),[a,i]=G.useState(!1),[l,d]=G.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==a?(u=async()=>{if(n.length===0&&o&&!a){i(!0),d(!0);const{engine:p,database:b,schema:y}=o,v=await yL.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw d(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),d(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=a,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==a?(h=[n.length,o,a],e[5]=o,e[6]=n.length,e[7]=a,e[8]=h):h=e[8];const{isPending:f,error:m}=Cn(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Y3,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(K3,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Ac,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let x,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>c.jsx(QA,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],x=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=x}else x=e[16];return e[22]!==x?(g=c.jsx(c.Fragment,{children:x}),e[22]=x,e[23]=g):g=e[23],g},QA=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=G3(),[a,i]=G.useState(!1),[l,d]=G.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==a||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(a&&!u&&o&&!l){d(!0);const{engine:J,database:ee,schema:q}=o,Y=await vL.request({engine:J,database:ee,schema:q,tableName:n.name});if(!(Y!=null&&Y.table))throw new Error("No table details available");s({table:Y.table,sqlTableContext:o})}},e[0]=s,e[1]=a,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==a||e[8]!==u?(f=[a,u],e[7]=a,e[8]=u,e[9]=f):f=e[9];const{isFetching:m,isPending:x,error:g}=Cn(h,f),p=Ie(ql),b=ds(),{createNewCell:y}=it(),v=X3();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{qn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const J=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${J}")`}if(o)return Q3({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return Q3({table:n,columnName:"*",sqlTableContext:o});default:return ec(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const S=w;let N;e[17]!==n.num_columns||e[18]!==n.num_rows?(N=()=>{const J=[];return n.num_rows!=null&&J.push(`${n.num_rows} rows`),n.num_columns!=null&&J.push(`${n.num_columns} columns`),J.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:J.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=N):N=e[19];const j=N;let C;e[20]!==g||e[21]!==m||e[22]!==x||e[23]!==o||e[24]!==n?(C=()=>{if(x||m)return c.jsx(Y3,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(K3,{error:g,className:"pl-12"});const J=n.columns;return J.length===0?c.jsx(Ac,{content:"No columns found",className:"pl-12"}):J.map(ee=>c.jsx(eM,{table:n,column:ee,sqlTableContext:o},ee.name))},e[20]=g,e[21]=m,e[22]=x,e[23]=o,e[24]=n,e[25]=C):C=e[25];const _=C;let T;e[26]!==a||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(T=()=>{if(n.source_type==="local")return;const J=n.type==="table"?VP:zf;return c.jsx(J,{className:"h-3 w-3",strokeWidth:a||r?2.5:void 0})},e[26]=a,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=T):T=e[30];const I=T,P=o?`${o.database}.${o.schema}.${n.name}`:n.name,L=o&&(J3(o.schema)?"pl-9":"pl-12"),M=(a||r)&&"font-semibold";let R,z,D,A,k,B,E,U,V,$,K,X;return e[31]!==L||e[32]!==M?(R=me("rounded-none group h-8 cursor-pointer",L,M),e[31]=L,e[32]=M,e[33]=R):R=e[33],e[34]!==a?(z=()=>i(!a),e[34]=a,e[35]=z):z=e[35],e[36]!==I?(D=I(),e[36]=I,e[37]=D):D=e[37],e[38]!==n.name?(A=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=A):A=e[39],e[40]!==D||e[41]!==A?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[D,A]}),e[40]=D,e[41]=A,e[42]=k):k=e[42],e[43]!==j?(B=j(),e[43]=j,e[44]=B):B=e[44],e[45]!==S?(E=Dn.stopPropagation(()=>S()),e[45]=S,e[46]=E):E=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(HP,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==E?(V=c.jsx(je,{content:"Add table to notebook",delayDuration:400,children:c.jsx(ke,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:E,children:U})}),e[48]=E,e[49]=V):V=e[49],e[50]!==a||e[51]!==z||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==R||e[56]!==P?($=c.jsxs(Gn,{className:R,value:P,"aria-selected":a,forceMount:!0,onSelect:z,children:[k,B,V]}),e[50]=a,e[51]=z,e[52]=k,e[53]=B,e[54]=V,e[55]=R,e[56]=P,e[57]=$):$=e[57],e[58]!==a||e[59]!==_?(K=a&&_(),e[58]=a,e[59]=_,e[60]=K):K=e[60],e[61]!==$||e[62]!==K?(X=c.jsxs(c.Fragment,{children:[$,K]}),e[61]=$,e[62]=K,e[63]=X):X=e[63],X},eM=t=>{var E,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,a]=G.useState(!1),i=Ie(W3),l=St(WP);let d,u;e[0]!==i?(d=()=>{i&&a(!1)},u=[i],e[0]=i,e[1]=d,e[2]=u):(d=e[1],u=e[2]),G.useEffect(d,u),l(s?V=>new Set([...V,`${n.name}:${o.name}`]):V=>(V.delete(`${n.name}:${o.name}`),new Set(V)));const h=X3(),{columnsPreviews:f}=qP();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((E=n.primary_keys)==null?void 0:E.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const x=m;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const p=g;let b;e[9]!==h?(b=V=>{h(V)},e[9]=h,e[10]=b):b=e[10];const y=b,v=tM,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=c.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const N=S,j=`${n.name}.${o.name}`,C=`${n.name}.${o.name}`;let _;e[14]!==s?(_=()=>a(!s),e[14]=s,e[15]=_):_=e[15];const T=r?"pl-14":"pl-7";let I,P,L,M,R,z,D,A,k,B;return e[16]!==T?(I=me("flex flex-row gap-2 items-center flex-1",T),e[16]=T,e[17]=I):I=e[17],e[18]!==o.type||e[19]!==N?(P=c.jsx(GP,{columnName:N,dataType:o.type}),e[18]=o.type,e[19]=N,e[20]=P):P=e[20],e[21]!==x?(L=x&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=x,e[22]=L):L=e[22],e[23]!==p?(M=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=M):M=e[24],e[25]!==I||e[26]!==P||e[27]!==L||e[28]!==M?(R=c.jsxs("div",{className:I,children:[P,L,M]}),e[25]=I,e[26]=P,e[27]=L,e[28]=M,e[29]=R):R=e[29],e[30]!==o.name?(z=c.jsx(je,{content:"Copy column name",delayDuration:400,children:c.jsx(ke,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(B3,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=z):z=e[31],e[32]!==o.external_type?(D=c.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=D):D=e[33],e[34]!==_||e[35]!==R||e[36]!==z||e[37]!==D||e[38]!==j||e[39]!==C?(A=c.jsxs(Gn,{className:"rounded-none py-1 group cursor-pointer",value:C,onSelect:_,children:[R,z,D]},j),e[34]=_,e[35]=R,e[36]=z,e[37]=D,e[38]=j,e[39]=C,e[40]=A):A=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:c.jsx(ic,{children:c.jsx(YP,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==A||e[49]!==k?(B=c.jsxs(c.Fragment,{children:[A,k]}),e[48]=A,e[49]=k,e[50]=B):B=e[50],B};function tM(t){const{tooltipContent:e,content:n}=t;return c.jsx(je,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const nM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(YA,{}),t[0]=e):e=t[0],e},oM=()=>{const t=H.c(5),{documentation:e}=Ie(XP);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(Kc,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Nm({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},rM=()=>{const t=H.c(5),e=JP();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No errors!",icon:c.jsx(pp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(sM),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function sM(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(ZP,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(QP,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const Ef=new Map,aM=({file:t,onOpenNotebook:e})=>{const{theme:n}=Xo(),o=Ie(Jl),[r,s]=O.useState(""),{data:a,isPending:i,error:l,setData:d}=Cn(async()=>{const g=await Em({path:t.path}),p=g.contents||"";return s(Ef.get(t.path)||p),g},[t.path]),u=async()=>{r!==(a==null?void 0:a.contents)&&await iR({path:t.path,contents:r}).then(g=>{g.success&&(d(p=>({...p,contents:r})),s(r))})},h=O.useRef(r);if(h.current=r,O.useEffect(()=>()=>{if(!(a!=null&&a.contents))return;const g=h.current;g===a.contents?Ef.delete(t.path):Ef.set(t.path,g)},[t.path,a==null?void 0:a.contents]),l)return c.jsx(yr,{error:l});if(i||!a)return null;const f=a.mimeType||"text/plain",m=f in _f;if(!a.contents&&!m)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:a.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:f})]});const x=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Zt()&&c.jsx(je,{content:"Open notebook",children:c.jsx(sn,{size:"small",onClick:g=>e(g),children:c.jsx(rc,{})})}),c.jsx(je,{content:"Download",children:c.jsx(sn,{size:"small",onClick:()=>{if(Rw(f)){const g=sR(a.contents,f);return void aR(g,a.file.name)}Fa(new Blob([a.contents||r],{type:f}),a.file.name)},children:c.jsx(Zf,{})})}),!Rw(f)&&c.jsxs(c.Fragment,{children:[c.jsx(je,{content:"Copy contents to clipboard",children:c.jsx(sn,{size:"small",onClick:async()=>{await on(r)},children:c.jsx(Ea,{})})}),c.jsx(je,{content:Wt("global.save"),children:c.jsx(sn,{size:"small",color:r===a.contents?void 0:"green",onClick:u,disabled:r===a.contents,children:c.jsx(li,{})})})]})]});return f.startsWith("image/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(eR,{base64:a.contents,mime:f})})]}):f==="text/csv"&&a.contents?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(tR,{contents:a.contents})})]}):f.startsWith("audio/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(nR,{base64:a.contents,mime:f})})]}):f.startsWith("video/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(oR,{base64:a.contents,mime:f})})]}):f.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(rR,{base64:a.contents,mime:f})})]}):c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(O.Suspense,{children:c.jsx(Qa,{theme:n==="dark"?"dark":"light",language:_f[f]||_f.default,className:"border-b",extensions:[Ge.lineWrapping,_n.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==a.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},Rw=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),_f={"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"},Lw=yt(new class{constructor(t){this.callbacks=t,this.delegate=new Om([]),this.rootPath="",this.onChange=jn.NOOP,this.path=new nc("/"),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 Om(n.files),this.rootPath=n.root,this.path=nc.guessDeliminator(n.root)}catch(n){Xe({title:"Failed",description:m3(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 a=o[r];s===this.rootPath?this.delegate=new Om(a.files):this.delegate.update({id:s,changes:{children:a.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:(Xe({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 a=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:a}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:a}).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:$k,createFileOrFolder:_m,deleteFileOrFolder:cR,renameFileOrFolder:lR})),iM=yt({});function lM(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 Fw(t){const e=H.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:fM,onDropRejected:dM,onDrop:cM,...o},e[2]=o,e[3]=r):r=e[3],dR(r)}async function cM(t){for(const e of t){const n=pM(mM(e));let o="";n&&(o=nc.guessDeliminator(n).dirname(n));const r=(await lM(e)).split(",")[1];await _m({path:o,type:"file",name:e.name,contents:r})}await async function(){await et.get(Lw).refreshAll([])}()}function dM(t){Xe({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(uM)}),variant:"danger"})}function uM(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(hM).join(", "),")"]},t.file.name)}function hM(t){return t.message}function fM(t){ft.error(t),Xe({title:"File upload failed",description:t.message,variant:"danger"})}function mM(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 pM(t){if(t)return t.replace(/^\/+/,"")}const zw=G.createContext(null),gM=t=>{const e=H.c(60),{height:n}=t,o=O.useRef(null),[r]=Ot(Lw);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[a,i]=O.useState(s),[l,d]=O.useState(null),{openPrompt:u}=Nn(),[h,f]=Ot(iM);let m,x;e[1]!==r?(m=()=>r.initialize(i),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[3]=x):x=e[3];const{isPending:g,error:p}=Cn(m,x);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=ze(b);let v;e[7]!==u||e[8]!==r?(v=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=v):v=e[9];const w=ze(v);let S;e[10]!==u||e[11]!==r?(S=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=S):S=e[12];const N=ze(S);let j;e[13]!==f?(j=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=j):j=e[14];const C=ze(j);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(xn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(yr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,E,U,V,$;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(ke,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(wt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(E=c.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[B,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=E):E=e[21],e[22]!==l.path||e[23]!==r?(U=K=>Bw(K,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?(V=c.jsx(O.Suspense,{children:c.jsx(aM,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==E||e[29]!==V?($=c.jsxs(c.Fragment,{children:[E,V]}),e[28]=E,e[29]=V,e[30]=$):$=e[30],$}let _;e[31]!==C||e[32]!==N||e[33]!==w||e[34]!==y||e[35]!==r?(_=c.jsx(bM,{onRefresh:y,onCreateFile:N,onCreateFolder:w,onCollapseAll:C,tree:r}),e[31]=C,e[32]=N,e[33]=w,e[34]=y,e[35]=r,e[36]=_):_=e[36];const T=n-33;let I,P,L,M,R,z,D,A;return e[37]!==r?(I=async k=>{const{ids:B}=k;for(const E of B)await r.delete(E)},P=async k=>{const{id:B,name:E}=k;await r.rename(B,E)},L=async k=>{const{dragIds:B,parentId:E}=k;await r.move(B,E)},e[37]=r,e[38]=I,e[39]=P,e[40]=L):(I=e[38],P=e[39],L=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(M=k=>{const B=k[0];B&&(B.data.isDirectory||d(B.data))},e[41]=M):M=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(R=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=R):R=e[45],e[46]!==a||e[47]!==h||e[48]!==I||e[49]!==P||e[50]!==L||e[51]!==R||e[52]!==T?(z=c.jsx(nL,{width:"100%",ref:o,height:T,className:"h-full",data:a,initialOpenState:h,openByDefault:!1,renderCursor:SM,disableDrop:NM,onDelete:I,onRename:P,onMove:L,onSelect:M,onToggle:R,padding:15,rowHeight:30,indent:xM,overscanCount:1e3,disableMultiSelection:!0,children:wM}),e[46]=a,e[47]=h,e[48]=I,e[49]=P,e[50]=L,e[51]=R,e[52]=T,e[53]=z):z=e[53],e[54]!==z||e[55]!==r?(D=c.jsx(zw,{value:r,children:z}),e[54]=z,e[55]=r,e[56]=D):D=e[56],e[57]!==D||e[58]!==_?(A=c.jsxs(c.Fragment,{children:[_,D]}),e[57]=D,e[58]=_,e[59]=A):A=e[59],A},xM=15,bM=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={noDrag:!0,noDragEventsBubbling:!0},e[0]=a):a=e[0];const{getRootProps:i,getInputProps:l}=Fw(a);let d,u,h,f,m,x,g,p,b,y,v,w,S,N,j;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ai,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(je,{content:"Add file",children:c.jsx(ke,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Uc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(je,{content:"Add folder",children:c.jsx(ke,{"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]!==i?(m=i({}),e[7]=i,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(x=uR({variant:"text",size:"xs"}),g=c.jsx(fR,{size:16}),e[9]=x,e[10]=g):(x=e[9],g=e[10]),e[11]!==m?(p=c.jsx(je,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:x,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(S3,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=c.jsx(je,{content:"Refresh",children:c.jsx(ke,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(Gm,{size:16}),e[20]=S):S=e[20],e[21]!==s?(N=c.jsx(je,{content:"Collapse all folders",children:c.jsx(ke,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=N):N=e[22],e[23]!==y||e[24]!==w||e[25]!==N||e[26]!==u||e[27]!==f||e[28]!==p?(j=c.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,y,w,N]}),e[23]=y,e[24]=w,e[25]=N,e[26]=u,e[27]=f,e[28]=p,e[29]=j):j=e[29],j},yM=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,a;return e[0]!==n?(r=i=>{n.data.isDirectory||(i.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Zt()&&c.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(rc,{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?(a=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=a):a=e[8],a},vM=t=>{const e=H.c(10),{node:n}=t,o=O.useRef(null);let r,s,a,i,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),e[3]!==n?(a=()=>n.reset(),i=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.currentTarget.value)},e[3]=n,e[4]=a,e[5]=i):(a=e[4],i=e[5]),e[6]!==n.data.name||e[7]!==a||e[8]!==i?(l=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:jM,onBlur:a,onKeyDown:i}),e[6]=n.data.name,e[7]=a,e[8]=i,e[9]=l):l=e[9],l},wM=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":Bk(t.data.name),r=Uk[o],{openConfirm:s,openPrompt:a}=Nn(),{createNewCell:i}=it(),l=ds(),d=O.use(zw),u=async g=>{Bw(g,d?d.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(Pk,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=ze(async()=>{t.open(),a({title:"Folder name",onConfirm:async g=>{d==null||d.createFolder(g,t.id)}})}),m=ze(async()=>{t.open(),a({title:"File name",onConfirm:async g=>{d==null||d.createFile(g,t.id)}})}),x=ze(async()=>{var y;if(!d||t.data.isDirectory)return;const[g,p]=hR(t.data.name),b=`${g}_copy${p}`;try{const v=await Em({path:t.data.path}),w=((y=t.parent)==null?void 0:y.data.path)||"";await _m({path:w,type:"file",name:b,contents:v.contents?btoa(v.contents):void 0}),await d.refreshAll([w])}catch{Xe({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:me("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(kM,{node:t}),c.jsxs("span",{className:me("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx(vM,{node:t}):c.jsx(yM,{node:t,onOpenMarimoFile:u}),c.jsxs(Ho,{modal:!1,children:[c.jsx(Wo,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:c.jsx(ke,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx(Bc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(qo,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(Dt,{onSelect:()=>t.select(),children:[c.jsx(Tp,{...g}),"Open file"]}),!t.data.isDirectory&&!Zt()&&c.jsxs(Dt,{onSelect:()=>{mR({path:t.data.path})},children:[c.jsx(rc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Dt,{onSelect:()=>m(),children:[c.jsx(ai,{...g}),"Create file"]}),c.jsxs(Dt,{onSelect:()=>f(),children:[c.jsx(Uc,{...g}),"Create folder"]}),c.jsx(rn,{})]}),c.jsxs(Dt,{onSelect:()=>t.edit(),children:[c.jsx(gp,{...g}),"Rename"]}),!t.data.isDirectory&&c.jsxs(Dt,{onSelect:x,children:[c.jsx(Ea,{...g}),"Duplicate"]}),c.jsxs(Dt,{onSelect:async()=>{await on(t.data.path),Xe({title:"Copied to clipboard"})},children:[c.jsx(Hc,{...g}),"Copy path"]}),d&&c.jsxs(Dt,{onSelect:async()=>{await on(d.relativeFromRoot(t.data.path)),Xe({title:"Copied to clipboard"})},children:[c.jsx(Hc,{...g}),"Copy relative path"]}),c.jsx(rn,{}),c.jsxs(Dt,{onSelect:()=>{const{path:p}=t.data;(b=>{i({code:b,before:!1,cellId:l??"__end__"})})(eS[o](p))},children:[c.jsx(Sr,{...g}),"Insert snippet for reading file"]}),c.jsxs(Dt,{onSelect:async()=>{Xe({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=eS[o](p);await on(b)},children:[c.jsx(pR,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsxs(Dt,{onSelect:u,children:[c.jsx(jp,{...g}),"Open notebook"]})]}),c.jsx(rn,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Dt,{onSelect:async()=>{const p=(await Em({path:t.data.path})).contents||"";Fa(new Blob([p]),t.data.name)},children:[c.jsx(Zf,{...g}),"Download"]}),c.jsx(rn,{})]}),c.jsxs(Dt,{onSelect:h,variant:"danger",children:[c.jsx(Xl,{...g}),"Delete"]})]})})()]})]})]})},kM=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(vo,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(Aa,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function Bw(t,e){t.stopPropagation(),t.preventDefault(),dS(e)}function SM(){return null}function NM(t){const{parentNode:e}=t;return!e.data.isDirectory}function jM(t){return t.stopPropagation()}let Uw,$w,Vw;Uw=()=>{const t=H.c(20),{ref:e,height:n}=gR(),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:a,isDragActive:i}=Fw(r);let l,d,u,h,f,m,x,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=me("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==a?(u=a(),t[4]=a,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==i?(f=i&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=i,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(gM,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(x=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=x):x=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==x?(g=c.jsxs("div",{...l,className:d,children:[h,f,x]}),t[15]=l,t[16]=h,t[17]=f,t[18]=x,t[19]=g):g=t[19],g},Um=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=me("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},$w=()=>{const t=H.c(9),e=xR(),{clearLogs:n}=it();if(e.length===0){let a,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=a):a=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No logs",description:c.jsxs("span",{children:[a," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx(Ff,{})}),t[1]=i):i=t[1],i}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(Um,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(Vw,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},Vw=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,a,i,l;return e[0]!==o?(r=me("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?(a=n.map(_M),e[3]=n,e[4]=a):a=e[4],e[5]!==a?(i=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:a})}),e[5]=a,e[6]=i):i=e[6],e[7]!==r||e[8]!==i?(l=c.jsx("div",{className:r,children:i}),e[7]=r,e[8]=i,e[9]=l):l=e[9],l};function CM(t){const e=bR(t.timestamp),n=EM[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),c.jsx("span",{className:me("flex-shrink-0",n),children:o}),c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",c.jsx(jo,{cellId:t.cellId}),")"]}),t.message]})}const EM={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function _M(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:me("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:me("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:CM(t)})]},e)}const IM=()=>{const t=H.c(7),{items:e}=Ie(yR);let n,o;t[0]!==e?(o=wL(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:a}=kL(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(an,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(Yc,{})}),t[2]=l):l=t[2],l}let i;return t[3]!==s||t[4]!==a||t[5]!==e?(i=c.jsx(SL,{items:e,activeHeaderId:s,activeOccurrences:a}),t[3]=s,t[4]=a,t[5]=e,t[6]=i):i=t[6],i},Hw=yt(null),Ww=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(xn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let a,i,l;return e[1]!==s?(a=me("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=a):a=e[2],e[3]!==n?(i=Dn.stopPropagation(n),e[3]=n,e[4]=i):i=e[4],e[5]!==r||e[6]!==a||e[7]!==i?(l=c.jsx("button",{type:"button",className:a,onClick:i,children:r}),e[5]=r,e[6]=a,e[7]=i,e[8]=l):l=e[8],l},TM=()=>{var w,S;const t=H.c(27),[e]=mr(),n=e.package_management.manager,[o,r]=G.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:a,error:i,refetch:l,isPending:d}=Cn(DM,s);if(d){let N;return t[2]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(xn,{size:"medium",centered:!0}),t[2]=N):N=t[2],N}if(i){let N;return t[3]!==i?(N=c.jsx(yr,{error:i}),t[3]=i,t[4]=N):N=t[4],N}const u=a.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(N,j){return N==="list"?"list":j?N||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(w=a.tree)==null?void 0:w.name,x=(S=a==null?void 0:a.tree)==null?void 0:S.version,g=m==="<root>";let p,b,y,v;return t[8]!==n||t[9]!==l?(p=c.jsx(AM,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==x||t[15]!==f?(b=u&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:me("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),c.jsx("button",{type:"button",className:me("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,x&&` v${x}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,t[14]=x,t[15]=f,t[16]=b):b=t[16],t[17]!==a.list||t[18]!==a.tree||t[19]!==i||t[20]!==l||t[21]!==f?(y=f==="list"?c.jsx(MM,{packages:a.list,onSuccess:l}):c.jsx(OM,{tree:a.tree,error:i,onSuccess:l}),t[17]=a.list,t[18]=a.tree,t[19]=i,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(v=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=v):v=t[26],v},AM=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=G.useState(""),{handleClick:a}=ti(),i=Ie(Hw),l=St(Hw);let d,u;e[0]!==i||e[1]!==l?(d=()=>{i&&(s(i),l(null))},u=[i,l],e[0]=i,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),G.useEffect(d,u);const{loading:h,handleInstallPackages:f}=kR();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const x=m;let g;e[6]!==f||e[7]!==r||e[8]!==x?(g=()=>{f(r.split(",").map(PM),x)},e[6]=f,e[7]=r,e[8]=x,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let y,v,w,S,N,j,C,_,T,I,P,L,M,R;e[10]!==h||e[11]!==a?(y=h?c.jsx(xn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(je,{content:"Change package manager",children:c.jsx(Ns,{onClick:()=>a("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=a,e[12]=y):y=e[12],e[13]!==p?(v=E=>{E.key==="Enter"&&(E.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=E=>s(E.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=c.jsx(tS,{placeholder:b,id:u1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=S):S=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=N):N=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs("div",{children:[N," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),C=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=j,e[23]=C):(j=e[22],C=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsxs("div",{children:[C," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),T=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=_,e[25]=T):(_=e[24],T=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsxs("div",{children:[T," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),P=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=I,e[27]=P):(I=e[26],P=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsxs("div",{children:[P," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),M=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=L,e[29]=M):(L=e[28],M=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(je,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[j,_,I,L,c.jsxs("div",{children:[M," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(wm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=R):R=e[30];const z=r&&"bg-accent text-accent-foreground";let D;e[31]!==z?(D=me("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",z,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=z,e[32]=D):D=e[32];const A=!r;let k,B;return e[33]!==p||e[34]!==D||e[35]!==A?(k=c.jsx("button",{type:"button",className:D,onClick:p,disabled:A,children:"Add"}),e[33]=p,e[34]=D,e[35]=A,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=c.jsxs("div",{className:"flex items-center w-full border-b",children:[S,R,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},MM=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(Ns,{})}),e[0]=i):i=e[0],i}let r,s,a;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Im,{children:c.jsxs(Ss,{children:[c.jsx(vr,{children:"Name"}),c.jsx(vr,{children:"Version"}),c.jsx(vr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let i;e[5]!==n?(i=l=>c.jsxs(Ss,{className:"group",onClick:async()=>{await on(`${l.name}==${l.version}`),Xe({title:"Copied to clipboard"})},children:[c.jsx(wr,{children:l.name}),c.jsx(wr,{children:l.version}),c.jsxs(wr,{className:"flex justify-end",children:[c.jsx(qw,{packageName:l.name,onSuccess:n}),c.jsx(Gw,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=i):i=e[6],s=o.map(i),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(a=c.jsxs(Tm,{className:"overflow-auto flex-1",children:[r,c.jsx(Am,{children:s})]}),e[7]=s,e[8]=a):a=e[8],a},qw=({packageName:t,onSuccess:e})=>{const[n,o]=G.useState(!1);return Zt()?null:c.jsx(Ww,{onClick:async()=>{try{o(!0);const r=await SR({package:t,upgrade:!0});r.success?(e(),nS(t)):nS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},Gw=({packageName:t,onSuccess:e})=>{const[n,o]=G.useState(!1);return c.jsx(Ww,{onClick:async()=>{try{o(!0);const r=await NR({package:t});r.success?(e(),oS(t)):oS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},OM=t=>{const e=H.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[a,i]=G.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{i(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],G.useEffect(l,d),o){let x;return e[4]!==o?(x=c.jsx(yr,{error:o}),e[4]=o,e[5]=x):x=e[5],x}if(!n){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(xn,{size:"medium",centered:!0}),e[6]=x):x=e[6],x}if(n.dependencies.length===0){let x;return e[7]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(an,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(Ns,{})}),e[7]=x):x=e[7],x}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=x=>{i(g=>{const p=new Set(g);return p.has(x)?p.delete(x):p.add(x),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==a||e[10]!==r||e[11]!==n.dependencies){let x;e[13]!==a||e[14]!==r?(x=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(Yw,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:a,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=a,e[14]=r,e[15]=x):x=e[15],f=n.dependencies.map(x),e[9]=a,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},Yw=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:a,onToggle:i,onSuccess:l}=t,d=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==a||e[1]!==n?(h=a.has(n),e[0]=a,e[1]=n,e[2]=h):h=e[2];const f=h,m=d?0:16+16*r;let x;e[3]!==u||e[4]!==n||e[5]!==i?(x=D=>{D.key!=="Enter"&&D.key!==" "||(D.preventDefault(),u&&i(n))},e[3]=u,e[4]=n,e[5]=i,e[6]=x):x=e[6];const g=x;let p;e[7]!==u||e[8]!==n||e[9]!==i?(p=D=>{D.stopPropagation(),u&&i(n)},e[7]=u,e[8]=n,e[9]=i,e[10]=p):p=e[10];const b=p,y=u&&"select-none",v=d?"px-2 py-0.5":"";let w,S;e[11]!==y||e[12]!==v?(w=me("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==d?(S=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=S):S=e[16];const N=u?f:void 0;let j,C,_,T,I,P,L,M,R,z;return e[17]!==u||e[18]!==f?(j=u?f?c.jsx(vo,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx(Aa,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=j):j=e[19],e[20]!==o.name?(C=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=C):C=e[21],e[22]!==o.version?(_=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=_):_=e[23],e[24]!==C||e[25]!==_?(T=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[C,_]}),e[24]=C,e[25]=_,e[26]=T):T=e[26],e[27]!==o.tags?(I=o.tags.map(RM),e[27]=o.tags,e[28]=I):I=e[28],e[29]!==I?(P=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:I}),e[29]=I,e[30]=P):P=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(L=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(qw,{packageName:o.name,onSuccess:l}),c.jsx(Gw,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=L):L=e[34],e[35]!==b||e[36]!==g||e[37]!==j||e[38]!==T||e[39]!==P||e[40]!==L||e[41]!==w||e[42]!==S||e[43]!==N?(M=c.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":N,children:[j,T,P,L]}),e[35]=b,e[36]=g,e[37]=j,e[38]=T,e[39]=P,e[40]=L,e[41]=w,e[42]=S,e[43]=N,e[44]=M):M=e[44],e[45]!==a||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==i?(R=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((D,A)=>c.jsx(Yw,{nodeId:`${n}-${A}`,node:D,level:r+1,isTopLevel:!1,expandedNodes:a,onToggle:i,onSuccess:l},`${D.name}-${A}`))}),e[45]=a,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=i,e[53]=R):R=e[53],e[54]!==M||e[55]!==R?(z=c.jsxs("div",{children:[M,R]}),e[54]=M,e[55]=R,e[56]=z):z=e[56],z};async function DM(){const[t,e]=await Promise.all([vR(),wR()]);return{list:t.packages,tree:e.tree}}function PM(t){return t.trim()}function RM(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const If=pk("marimo:scratchpadHistory:v1",[]),LM=yt(!1),FM=yt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(If),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(If,r)}),zM={hide_code:!1,disabled:!1},BM=()=>{const t=H.c(69),e=ps(),[n]=mr(),{theme:o}=Xo(),r=O.useRef(null),s=ds(),{createNewCell:a,updateCellCode:i}=it(),l=e.cellRuntime[Jo],d=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[Jo],m=(f==null?void 0:f.code)??"",x=St(FM),[g,p]=Ot(LM),b=Ie(If);let y;t[0]!==x||t[1]!==m?(y=()=>{rS({code:m}),x(m)},t[0]=x,t[1]=m,t[2]=y):y=t[2];const v=ze(y);let w;t[3]!==m||t[4]!==a||t[5]!==s?(w=()=>{m.trim()&&a({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=a,t[5]=s,t[6]=w):w=t[6];const S=ze(w);let N;t[7]!==i?(N=()=>{i({cellId:Jo,code:"",formattingChange:!1}),rS({code:""});const ie=r.current;ie&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:""}})},t[7]=i,t[8]=N):N=t[8];const j=ze(N);let C;t[9]!==p||t[10]!==i?(C=ie=>{p(!1),i({cellId:Jo,code:ie,formattingChange:!1});const ve=r.current;ve&&ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ie}})},t[9]=p,t[10]=i,t[11]=C):C=t[11];const _=ze(C),[T,I]=O.useState();let P;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==T||t[16]!==d||t[17]!==o||t[18]!==n?(P=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:c.jsx(wu,{theme:o,showPlaceholder:!1,id:Jo,code:m,config:zM,status:"idle",serializedEditorState:null,runCell:v,userConfig:n,editorViewRef:r,setEditorView:ie=>{r.current=ie},hidden:!1,showHiddenCode:jn.NOOP,languageAdapter:T,setLanguageAdapter:I})}),c.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:c.jsx(Ec,{allowExpand:!1,output:d,className:"output-area",cellId:Jo,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:c.jsx(Lm,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:gk,onSubmitDebugger:jn.NOOP,cellId:Jo,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=v,t[15]=T,t[16]=d,t[17]=o,t[18]=n,t[19]=P):P=t[19];const L=P;let M;t[20]!==_||t[21]!==b||t[22]!==g||t[23]!==o?(M=()=>g?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ie,ve)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>_(ie),children:c.jsx(O.Suspense,{children:c.jsx(Qa,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ie.trim(),editable:!1,readOnly:!0})})},ve))})}):null,t[20]=_,t[21]=b,t[22]=g,t[23]=o,t[24]=M):M=t[24];const R=M;let z,D,A,k,B,E,U,V,$,K,X;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=Rf.create(Jo),D=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=z,t[26]=D):(z=t[25],D=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(A=Wt("cell.run"),t[27]=A):A=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(kr,{color:"var(--grass-11)",size:16}),t[28]=k):k=t[28],t[29]!==v||t[30]!==g?(B=c.jsx(je,{content:A,children:c.jsx(ke,{"data-testid":"scratchpad-run-button",onClick:v,disabled:g,variant:"text",size:"xs",children:k})}),t[29]=v,t[30]=g,t[31]=B):B=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(Km,{size:16}),t[32]=E):E=t[32],t[33]!==j||t[34]!==g?(U=c.jsx(je,{content:"Clear code and outputs",children:c.jsx(ke,{disabled:g,size:"xs",variant:"text",onClick:j,children:E})}),t[33]=j,t[34]=g,t[35]=U):U=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(V=c.jsx(Sr,{size:16}),t[36]=V):V=t[36],t[37]!==S||t[38]!==g?($=c.jsx(Ms,{children:c.jsx(je,{content:"Insert code",children:c.jsx(ke,{disabled:g,size:"xs",variant:"text",onClick:S,children:V})})}),t[37]=S,t[38]=g,t[39]=$):$=t[39],t[40]!==u?(K=(u==="running"||u==="queued")&&c.jsx(xn,{className:"inline",size:"small"}),t[40]=u,t[41]=K):K=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(X=c.jsx("div",{className:"flex-1"}),t[42]=X):X=t[42];const J=g&&"bg-[var(--sky-3)] rounded-none";let ee,q;t[43]!==J?(ee=me(J),t[43]=J,t[44]=ee):ee=t[44],t[45]!==g||t[46]!==p?(q=()=>p(!g),t[45]=g,t[46]=p,t[47]=q):q=t[47];const Y=b.length===0;let oe,se,re,ae,te,be,ye;return t[48]===Symbol.for("react.memo_cache_sentinel")?(oe=c.jsx(np,{size:16}),t[48]=oe):oe=t[48],t[49]!==ee||t[50]!==q||t[51]!==Y?(se=c.jsx(je,{content:"Toggle history",children:c.jsx(ke,{size:"xs",variant:"text",className:ee,onClick:q,disabled:Y,children:oe})}),t[49]=ee,t[50]=q,t[51]=Y,t[52]=se):se=t[52],t[53]!==B||t[54]!==U||t[55]!==$||t[56]!==K||t[57]!==se?(re=c.jsxs("div",{className:"flex items-center flex-shrink-0",children:[B,U,$,K,X,se]}),t[53]=B,t[54]=U,t[55]=$,t[56]=K,t[57]=se,t[58]=re):re=t[58],t[59]!==L?(ae=L(),t[59]=L,t[60]=ae):ae=t[60],t[61]!==R?(te=R(),t[61]=R,t[62]=te):te=t[62],t[63]!==ae||t[64]!==te?(be=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ae,te]}),t[63]=ae,t[64]=te,t[65]=be):be=t[65],t[66]!==re||t[67]!==be?(ye=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:z,children:[D,re,be]}),t[66]=re,t[67]=be,t[68]=ye):ye=t[68],ye},UM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(BM,{}),t[0]=e):e=t[0],e},$M=()=>{const t=H.c(23),{openModal:e,closeModal:n}=Nn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:a,refetch:i}=Cn(HM,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(xn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(a){let b;return t[2]!==a?(b=c.jsx(yr,{error:a}),t[2]=a,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(WM).map(qM),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx($c,{})}),t[6]=b):b=t[6],b}let u,h,f,m,x,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==i?(u=()=>e(c.jsx(rg,{providerNames:d,onSuccess:()=>{i(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=i,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ko,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Im,{children:c.jsxs(Ss,{children:[c.jsx(vr,{children:"Environment Variable"}),c.jsx(vr,{children:"Source"}),c.jsx(vr,{})]})}),t[15]=m):m=t[15],t[16]!==r?(x=r.map(GM),t[16]=r,t[17]=x):x=t[17],t[18]!==x?(g=c.jsxs(Tm,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(Am,{children:x})]}),t[18]=x,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},VM=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,a]=G.useState(!1);let i;e[0]!==r?(i=()=>{r(),a(!0),setTimeout(()=>a(!1),1e3)},e[0]=r,e[1]=i):i=e[1];const l=i;let d,u;return e[2]!==s?(d=s?c.jsx(oc,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(Ea,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function HM(){return og((await xS.request({})).secrets)}function WM(t){return t.provider!=="env"}function qM(t){return t.name}function GM(t){return t.keys.map(e=>c.jsxs(Ss,{className:"group",children:[c.jsx(wr,{children:e}),c.jsx(wr,{children:t.provider!=="env"&&c.jsx($3,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(wr,{children:c.jsx(VM,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await on(`os.environ["${e}"]`),Xe({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:me("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const YM=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Nn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(XM,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(D3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},KM=[Ge.lineWrapping],XM=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=O.useState(""),{theme:s}=Xo();let a,i,l,d,u,h;e[0]!==n?(a=async v=>{v.preventDefault();const w=new FormData(v.target),S=w.get("title"),N=w.get("description"),j=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:N,code:j})}),n(),Xe({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(zo,{children:"Contribute a Snippet"}),e[2]=i):i=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(ss,{children:[i,c.jsxs(as,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:On.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Bo,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(jR,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,x,g,p,b,y;return e[8]!==o||e[9]!==f?(m=c.jsx(Qa,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:KM,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==n?(g=c.jsx(ke,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(ke,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==a||e[20]!==b||e[21]!==x?(y=c.jsx(Uo,{className:"w-fit",children:c.jsxs("form",{onSubmit:a,children:[l,x,b]})}),e[19]=a,e[20]=b,e[21]=x,e[22]=y):y=e[22],y},JM=[Ge.lineWrapping],ZM=()=>{const t=H.c(20),[e,n]=G.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:a}=Cn(t7,o);if(s){let b;return t[1]!==s?(b=c.jsx(yr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(a||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(xn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const i=e?"h-1/3":"h-full";let l,d,u,h,f,m,x,g,p;return t[4]!==i?(l=me("border-b rounded-none",i),t[4]=i,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Ma,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=d):d=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs("div",{className:"flex items-center w-full",children:[d,c.jsx(YM,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Ko,{className:"h-4 w-4"})})})]}),h=c.jsx(Ql,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=c.jsx(e7,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(x=c.jsxs(ac,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=x):x=t[14],t[15]!==e?(g=c.jsx(O.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?c.jsx(QM,{snippet:e},e.title):c.jsx(an,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==x||t[18]!==g?(p=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[x,g]}),t[17]=x,t[18]=g,t[19]=p):p=t[19],p},QM=t=>{const e=H.c(27),{snippet:n}=t,{theme:o}=Xo(),{createNewCell:r}=it(),s=ds();let a;e[0]!==r||e[1]!==s||e[2]!==n.sections?(a=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=a):a=e[3];const i=a;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const d=l;let u,h,f,m,x,g;if(e[7]!==n.title?(u=c.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Sr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==i?(f=c.jsx("div",{className:"flex justify-end",children:c.jsx(Ms,{children:c.jsxs(ke,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",h]})})}),e[10]=i,e[11]=f):f=e[11],e[12]!==d||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==d||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:v,id:w}=b;return v?c.jsx("div",{children:Nm({html:v})},`${n.title}-${w}`):y?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(Ms,{children:c.jsx(je,{content:"Insert snippet",children:c.jsx(ke,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(y)},children:c.jsx(Sr,{className:"h-5 w-5"})})})}),c.jsx(O.Suspense,{children:c.jsx(Qa,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:JM,value:y,readOnly:!0},`${n.title}-${w}`)})]},`${n.title}-${w}`):null},e[17]=d,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=d,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(x=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=x):x=e[23],e[24]!==u||e[25]!==x?(g=c.jsxs(c.Fragment,{children:[u,x]}),e[24]=u,e[25]=x,e[26]=g):g=e[26],g},e7=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let a;e[3]!==o?(a=i=>c.jsx(Gn,{className:"rounded-none",onSelect:()=>o(i),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.jsx("span",{className:"mt-1 text-accent-foreground",children:i.title})})},i.title),e[3]=o,e[4]=a):a=e[4],r=n.map(a),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=c.jsx(pm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function t7(){return CR()}const n7=G.lazy(()=>gm(()=>import("./tracing-DfEJ8mrj.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),o7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(G.Suspense,{fallback:c.jsx(r7,{}),children:c.jsx(n7,{})}),t[0]=e):e=t[0],e},r7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(xn,{})}),t[0]=e):e=t[0],e},Kw="name",Xw="type-value",Tf="defs-refs",s7=[{id:Kw,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Mm,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Uh,{name:e,declaredBy:n})}},{id:Xw,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Mm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Tf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(Mm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const a=Ia(s);a&&jm(a,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(Sp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(jo,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,a)=>c.jsxs("span",{className:"flex",children:[c.jsx(jo,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),a<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(ci,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(y2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],Jw=O.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=G.useState([]),[s,a]=G.useState(""),i=ER(),l=O.useMemo(()=>{const h=f=>{const m=i[f];return MR(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,i,e]),d=O.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:x}){m||(m={id:Tf,desc:!1});let g=[];switch(m.id){case Kw:g=oi(f,p=>p.name);break;case Xw:g=oi(f,p=>p.dataType);break;case Tf:g=oi(f,p=>x.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=_R({data:d,columns:s7,getCoreRowModel:AR(),onGlobalFilterChange:a,getFilteredRowModel:TR(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:IR(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(tS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>a(h.target.value)}),c.jsxs(Tm,{className:me("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(Im,{children:c.jsx(Ss,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx(vr,{className:"sticky top-0 bg-background border-b",children:sS(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(Am,{children:u.getRowModel().rows.map(h=>c.jsx(Ss,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(wr,{className:"border-b",children:sS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});Jw.displayName="VariableTable";const a7=()=>{const t=H.c(4),e=Cm(),n=Tc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(Ul,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(Jw,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o};function Af(t,e,n=new Set){if(n.has(t))return new Set;n.add(t);const o=new Set;for(const r of e(t)){o.add(r);for(const s of Af(r,e,n))o.add(s)}return o}const i7=yt(t=>{const e=t(Pn),n=t(cc);return function(o,r){var i,l,d;const s=new Map;for(const u of o)s.set(u,{variables:new Set,parents:new Set,children:new Set});for(const u of Object.values(r))if(u.dataType!=="module")for(const h of u.declaredBy){(i=s.get(h))==null||i.variables.add(u.name);for(const f of u.usedBy)h!==f&&((l=s.get(f))==null||l.parents.add(h),(d=s.get(h))==null||d.children.add(f))}const a={};for(const[u,h]of s.entries())a[u]={parents:h.parents,children:h.children,variables:[...h.variables],ancestors:Af(u,f=>{var m;return((m=s.get(f))==null?void 0:m.parents)??new Set}),descendants:Af(u,f=>{var m;return((m=s.get(f))==null?void 0:m.children)??new Set})};return a}(e.cellIds.inOrderIds,n)});function l7(t,e){return t.usedBy.includes(e.selectedCellId)||t.declaredBy.includes(e.selectedCellId)?!0:t.declaredBy.some(n=>e.selectedGraph.parents.has(n))?t.usedBy.some(n=>e.selectedGraph.parents.has(n)):!!t.declaredBy.some(n=>e.selectedGraph.children.has(n))}const c7=t=>{const e=H.c(39),{cellId:n,cellPositions:o}=t,r=ps(),s=Ie(OR).focusedCellId,a=Ie(i7),i=it(),l=b3(),d=r.cellData[n],u=r.cellRuntime[n],h=a[n],f=s?a[s]:void 0,m=s===n;let x;e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==m?(x=()=>{m?l.blurCell():(i.focusCell({cellId:n,where:"exact"}),l.focusCell({cellId:n}))},e[0]=i,e[1]=n,e[2]=l,e[3]=m,e[4]=x):x=e[4];const g=x,p=m?"text-primary-foreground":"text-[var(--gray-8)] hover:text-[var(--gray-9)]";let b;e[5]!==p?(b=me("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",p),e[5]=p,e[6]=b):b=e[6];const y=m&&"bg-primary group-hover:bg-primary";let v,w,S,N;e[7]!==y?(v=me("group-hover:bg-[var(--gray-2)] flex h-full w-full px-0.5 items-center rounded",y),e[7]=y,e[8]=v):v=e[8],e[9]!==d.code||e[10]!==n||e[11]!==h.variables||e[12]!==s||e[13]!==f?(w=h.variables.length>0?c.jsx(f7,{cellId:n,variableNames:h.variables,selectedCellId:s,selectedGraph:f}):c.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:h7(d.code)??c.jsx("span",{className:"italic",children:"empty"})}),e[9]=d.code,e[10]=n,e[11]=h.variables,e[12]=s,e[13]=f,e[14]=w):w=e[14],e[15]!==d.code||e[16]!==w?(S=c.jsx("div",{className:"truncate px-1 font-mono text-sm flex gap-1",title:d.code,children:w}),e[15]=d.code,e[16]=w,e[17]=S):S=e[17],e[18]!==v||e[19]!==S?(N=c.jsx("div",{className:v,children:S}),e[18]=v,e[19]=S,e[20]=N):N=e[20];const j=m?"z-30":"z-20",C=u.errored?"text-destructive":s===null?"text-foreground":m||f!=null&&f.parents.has(n)||f!=null&&f.children.has(n)?"text-primary":"text-[var(--gray-8)]";let _,T,I,P;return e[21]!==j||e[22]!==C?(_=me("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)_+_17px)] pointer-events-none",j,C),e[21]=j,e[22]=C,e[23]=_):_=e[23],e[24]!==n||e[25]!==o||e[26]!==h||e[27]!==m||e[28]!==f?(T=m?c.jsx(m7,{cellId:n,cellPositions:o,graph:h}):c.jsx(p7,{cellId:n,graph:h,selectedGraph:f}),e[24]=n,e[25]=o,e[26]=h,e[27]=m,e[28]=f,e[29]=T):T=e[29],e[30]!==_||e[31]!==T?(I=c.jsx("svg",{className:_,width:"1",height:"1",children:T}),e[30]=_,e[31]=T,e[32]=I):I=e[32],e[33]!==n||e[34]!==g||e[35]!==I||e[36]!==b||e[37]!==N?(P=c.jsxs("button",{"data-node-id":n,className:b,onClick:g,onMouseDown:g7,children:[N,I]}),e[33]=n,e[34]=g,e[35]=I,e[36]=b,e[37]=N,e[38]=P):P=e[38],P},d7=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=ps();let s;e[0]!==r.cellIds.inOrderIds?(s=Object.fromEntries(r.cellIds.inOrderIds.map(x7)),e[0]=r.cellIds.inOrderIds,e[1]=s):s=e[1];const a=s;let i;if(e[2]!==r.cellIds){i=[];let v=0;for(const[w,S]of r.cellIds.getColumns().entries())w>0&&i.push(v),v+=S.inOrderIds.length;e[2]=r.cellIds,e[3]=i}else i=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let d,u,h,f,m,x,g,p,b,y;if(e[4]!==l?(d=me("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=d):d=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=u):u=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(En,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[u,c.jsx(ke,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==a||e[13]!==i||e[14]!==r.cellIds.inOrderIds){let v;e[16]!==a||e[17]!==i?(v=(w,S)=>{const N=i.includes(S);return c.jsxs(O.Fragment,{children:[N&&c.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-[var(--gray-4)] pointer-events-none","aria-hidden":"true"}),c.jsx(c7,{cellId:w,cellPositions:a})]},w)},e[16]=a,e[17]=i,e[18]=v):v=e[18],x=r.cellIds.inOrderIds.map(v),e[12]=a,e[13]=i,e[14]=r.cellIds.inOrderIds,e[15]=x}else x=e[15];return e[19]!==x?(g=c.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:x}),e[19]=x,e[20]=g):g=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==g?(b=c.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[g,p]}),e[22]=g,e[23]=b):b=e[23],e[24]!==b||e[25]!==d||e[26]!==m?(y=c.jsxs("div",{className:d,children:[m,b]}),e[24]=b,e[25]=d,e[26]=m,e[27]=y):y=e[27],y},u7=()=>{const t=H.c(5),{setIsMinimapOpen:e,toggleMinimap:n}=gr(),{isMinimapOpen:o}=us();let r,s;return t[0]!==n?(r=()=>n(),t[0]=n,t[1]=r):r=t[1],Pt("global.toggleMinimap",r),t[2]!==o||t[3]!==e?(s=c.jsx(d7,{open:o,setOpen:e}),t[2]=o,t[3]=e,t[4]=s):s=t[4],s};function h7(t){return t.split(`
|
148
|
-
`)[0].trim()||void 0}const f7=t=>{const e=H.c(13),{variableNames:n,selectedGraph:o,cellId:r,selectedCellId:s}=t,a=Cm(),i=r===s;let l,d;if(e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n||e[4]!==a){let u;e[6]!==i||e[7]!==s||e[8]!==o||e[9]!==a?(u=(h,f)=>{const m=a[h];return c.jsxs(O.Fragment,{children:[f>0&&", ",c.jsx("span",{className:me({"text-foreground":o===void 0,"font-bold":i,"text-primary font-medium":!i&&o&&s&&l7(m,{selectedCellId:s,selectedGraph:o})}),children:h})]},h)},e[6]=i,e[7]=s,e[8]=o,e[9]=a,e[10]=u):u=e[10],l=n.map(u),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=a,e[5]=l}else l=e[5];return e[11]!==l?(d=c.jsx(c.Fragment,{children:l}),e[11]=l,e[12]=d):d=e[12],d},m7=t=>{const e=H.c(14),{cellId:n,cellPositions:o,graph:r}=t;let s,a,i,l,d;if(e[0]!==n||e[1]!==o||e[2]!==r.children||e[3]!==r.parents){s=[];const u=o[n]??0,h=new Set;for(const f of r.parents)r.children.has(f)&&h.add(f);for(const f of h){const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${x} h 14 v ${-x} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-cycle-${f}`))}}for(const f of r.parents){if(h.has(f))continue;const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${x} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-up-${f}`))}}for(const f of r.children){if(h.has(f))continue;const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M 3 0 H 7 v ${x} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-down-${f}`))}}e[0]=n,e[1]=o,e[2]=r.children,e[3]=r.parents,e[4]=s}else s=e[4];return e[5]!==r?(a=Zw(r),e[5]=r,e[6]=a):a=e[6],e[7]!==a?(i=c.jsx("circle",{r:a,fill:"currentColor",className:"pointer-events-auto"}),e[7]=a,e[8]=i):i=e[8],e[9]!==s?(l=c.jsx("g",{className:"pen pointer-events-auto",children:s}),e[9]=s,e[10]=l):l=e[10],e[11]!==i||e[12]!==l?(d=c.jsxs("g",{transform:"translate(0, 0)",children:[i,l]}),e[11]=i,e[12]=l,e[13]=d):d=e[13],d};function Zw(t){return function(e){return e.ancestors.size===0&&e.descendants.size===0}(t)?1.5:3}function p7(t){const{cellId:e,graph:n,selectedGraph:o}=t,r=Zw(n),s=n.ancestors.size>0,a=n.descendants.size>0;if(!o)return Qw({circleRadius:r,leftWisker:s,rightWisker:a});const i=o.ancestors.has(e),l=o.descendants.has(e);return Qw(i||l?{circleRadius:r,leftWisker:s,rightWisker:a,shift:i&&l?void 0:i?"left":"right"}:{circleRadius:r,leftWisker:!1,rightWisker:!1})}function Qw(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return c.jsxs("g",{transform:`translate(${s}, 0)`,children:[c.jsxs("g",{children:[n&&c.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&c.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),c.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function g7(t){return t.preventDefault()}function x7(t,e){return[t,e]}const b7=G.lazy(()=>gm(()=>import("./terminal-Cw3jC7cC.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),y7=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=us(),{setIsSidebarOpen:a,setIsTerminalOpen:i}=gr(),l=G.useRef(null),d=G.useRef(null);let u,h,f,m,x;e[0]!==o?(u=()=>{if(!l.current)return;const Me=l.current.isCollapsed();o&&Me&&l.current.expand(),o||Me||l.current.collapse(),requestAnimationFrame(w7)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),O.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const Me=d.current.isCollapsed();r&&Me&&d.current.expand(),r||Me||d.current.collapse(),requestAnimationFrame(S7)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),O.useEffect(f,m),e[6]!==n?(x=c.jsx(Mc,{id:"app",className:"relative h-full",children:c.jsx(O.Suspense,{children:n})},"app"),e[6]=n,e[7]=x):x=e[7];const g=x,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=me("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=c.jsx(aS,{onDragging:iS,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,N;e[12]!==w?(S=me("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(N=c.jsx(aS,{onDragging:iS,className:S}),e[14]=S,e[15]=N):N=e[15];const j=N;let C,_,T,I,P,L,M,R,z,D,A,k,B,E,U,V,$,K,X,J,ee;e[16]!==s?(C=c.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=C):C=e[17],e[18]!==a?(_=()=>a(!1),e[18]=a,e[19]=_):_=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx(En,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==_?(I=c.jsx(ke,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:_,children:T}),e[21]=_,e[22]=I):I=e[22],e[23]!==C||e[24]!==I?(P=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[C,I]}),e[23]=C,e[24]=I,e[25]=P):P=e[25],e[26]!==s?(L=s==="files"&&c.jsx(Uw,{}),e[26]=s,e[27]=L):L=e[27],e[28]!==s?(M=s==="errors"&&c.jsx(rM,{}),e[28]=s,e[29]=M):M=e[29],e[30]!==s?(R=s==="variables"&&c.jsx(a7,{}),e[30]=s,e[31]=R):R=e[31],e[32]!==s?(z=s==="dependencies"&&c.jsx(VA,{}),e[32]=s,e[33]=z):z=e[33],e[34]!==s?(D=s==="packages"&&c.jsx(TM,{}),e[34]=s,e[35]=D):D=e[35],e[36]!==s?(A=s==="outline"&&c.jsx(IM,{}),e[36]=s,e[37]=A):A=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(nM,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&c.jsx(oM,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(E=s==="snippets"&&c.jsx(ZM,{}),e[42]=s,e[43]=E):E=e[43],e[44]!==s?(U=s==="scratchpad"&&c.jsx(UM,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&c.jsx(u8,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?($=s==="logs"&&c.jsx($w,{}),e[48]=s,e[49]=$):$=e[49],e[50]!==s?(K=s==="tracing"&&c.jsx(o7,{}),e[50]=s,e[51]=K):K=e[51],e[52]!==s?(X=s==="secrets"&&c.jsx($M,{}),e[52]=s,e[53]=X):X=e[53],e[54]!==L||e[55]!==M||e[56]!==R||e[57]!==z||e[58]!==D||e[59]!==A||e[60]!==k||e[61]!==B||e[62]!==E||e[63]!==U||e[64]!==V||e[65]!==$||e[66]!==K||e[67]!==X?(J=c.jsx(O.Suspense,{children:c.jsxs(_c,{children:[L,M,R,z,D,A,k,B,E,U,V,$,K,X]})}),e[54]=L,e[55]=M,e[56]=R,e[57]=z,e[58]=D,e[59]=A,e[60]=k,e[61]=B,e[62]=E,e[63]=U,e[64]=V,e[65]=$,e[66]=K,e[67]=X,e[68]=J):J=e[68],e[69]!==P||e[70]!==J?(ee=c.jsx(ic,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[P,J]})}),e[69]=P,e[70]=J,e[71]=ee):ee=e[71];const q=ee,Y=o&&"border-r border-l border-[var(--slate-7)]";let oe,se,re,ae,te,be;e[72]!==Y?(oe=me("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Y),e[72]=Y,e[73]=oe):oe=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(se=(Me,Re)=>{var He;Re===0&&Me===10&&((He=l.current)==null||He.resize(30))},e[74]=se):se=e[74],e[75]!==a?(re=()=>a(!1),ae=()=>a(!0),e[75]=a,e[76]=re,e[77]=ae):(re=e[76],ae=e[77]),e[78]!==q||e[79]!==v?(te=c.jsxs("span",{className:"flex flex-row h-full",children:[q," ",v]}),e[78]=q,e[79]=v,e[80]=te):te=e[80],e[81]!==oe||e[82]!==re||e[83]!==ae||e[84]!==te?(be=c.jsx(Mc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:se,onCollapse:re,onExpand:ae,children:te},"helper"),e[81]=oe,e[82]=re,e[83]=ae,e[84]=te,e[85]=be):be=e[85];const ye=be,ie=r&&"border-[var(--slate-7)]";let ve,he,Se,De,_e,Fe,Oe,Qe,qe;e[86]!==ie?(ve=me("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ie),e[86]=ie,e[87]=ve):ve=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(he=(Me,Re)=>{var He;Re===0&&Me===10&&((He=d.current)==null||He.resize(30))},e[88]=he):he=e[88],e[89]!==i?(Se=()=>i(!1),De=()=>i(!0),e[89]=i,e[90]=Se,e[91]=De):(Se=e[90],De=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=c.jsx("div",{}),e[92]=_e):_e=e[92],e[93]!==i?(Fe=()=>i(!1),e[93]=i,e[94]=Fe):Fe=e[94],e[95]!==r||e[96]!==Fe?(Oe=c.jsx(O.Suspense,{fallback:_e,children:c.jsx(b7,{visible:r,onClose:Fe})}),e[95]=r,e[96]=Fe,e[97]=Oe):Oe=e[97],e[98]!==r||e[99]!==Oe?(Qe=c.jsx(HA,{isOpen:r,children:Oe}),e[98]=r,e[99]=Oe,e[100]=Qe):Qe=e[100],e[101]!==ve||e[102]!==Se||e[103]!==De||e[104]!==Qe||e[105]!==j?(qe=c.jsxs(Mc,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:ve,minSize:10,defaultSize:0,maxSize:75,onResize:he,onCollapse:Se,onExpand:De,children:[j,Qe]},"terminal"),e[101]=ve,e[102]=Se,e[103]=De,e[104]=Qe,e[105]=j,e[106]=qe):qe=e[106];const Ke=qe;let Q,xe,we,Te,W,ne,ue,de,ge;return e[107]===Symbol.for("react.memo_cache_sentinel")?(Q=NL(),e[107]=Q):Q=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(xe=c.jsx(_c,{children:c.jsx(G_,{})}),e[108]=xe):xe=e[108],e[109]!==Ke?(we=c.jsx(ub,{capability:"terminal",children:Ke}),e[109]=Ke,e[110]=we):we=e[110],e[111]!==g||e[112]!==we?(Te=c.jsx(Mc,{children:c.jsxs(lS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,we]})}),e[111]=g,e[112]=we,e[113]=Te):Te=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(W=c.jsx(DR,{}),e[114]=W):W=e[114],e[115]!==ye||e[116]!==Te?(ne=c.jsxs(lS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:Q,children:[xe,ye,Te,W]}),e[115]=ye,e[116]=Te,e[117]=ne):ne=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(ue=c.jsx(u7,{}),e[118]=ue):ue=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(de=c.jsx(ic,{children:c.jsx(_c,{children:c.jsx($_,{})})}),e[119]=de):de=e[119],e[120]!==ne?(ge=c.jsxs(jL,{children:[ne,ue,de]}),e[120]=ne,e[121]=ge):ge=e[121],ge};function v7(){window.dispatchEvent(new Event("resize"))}function w7(){requestAnimationFrame(v7)}function k7(){window.dispatchEvent(new Event("resize"))}function S7(){requestAnimationFrame(k7)}let ek;ek=new URL(window.location.href).searchParams.get(PR.showChrome)==="false",AS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(ek){let s,a,i;return e[0]!==t?(s=c.jsx(db,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Lp,{}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs(c.Fragment,{children:[s,a]}),e[3]=s,e[4]=i):i=e[4],i}let n,o,r;return e[5]!==t?(n=c.jsx(db,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(Lp,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(y7,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Um as C,Oc as E,an as P,OL as __tla,Dc as a,AS as e,Cs as f};
|
147
|
+
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],a=new Set,i=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.add(h),a.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of Sm.zip(t,e)){o||r.push(this.createNode(l,d));const u=a.has(l),h=et.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},FA=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:a,settings:i}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a||e[3]!==i.hidePureMarkdown||e[4]!==o?(l=()=>{let k=Dw.createElements(n,r,o,i.hidePureMarkdown);return k=Ow({nodes:k.nodes,edges:k.edges,direction:a}),k},e[0]=r,e[1]=n,e[2]=a,e[3]=i.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=O.useState(l),[u,h,f]=h2(d.nodes),[m,x,g]=f2(d.edges),p=wa();let b;e[6]!==a||e[7]!==x||e[8]!==h?(b=k=>{const B=Ow({nodes:k.nodes,edges:k.edges,direction:a});h(B.nodes),x(B.edges)},e[6]=a,e[7]=x,e[8]=h,e[9]=b):b=e[9];const y=ze(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==i.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(Dw.createElements(n,r,o,i.hidePureMarkdown))},w=[n,o,r,y,i.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=i.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),O.useEffect(v,w);const[S,N]=O.useState();let j;v2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{N(void 0)},e[17]=j):j=e[17];const C=j;let _,T,I,P,L,M,R,z,D,A;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},T=(k,B)=>{N({type:"node",id:B.id})},I=(k,B)=>{const{source:E,target:U}=B;N({type:"edge",source:E,target:U})},e[18]=_,e[19]=T,e[20]=I):(_=e[18],T=e[19],I=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(rA,{color:"#ccc",variant:kn.Dots}),e[21]=P):P=e[21],e[22]!==p||e[23]!==u?(L=()=>{const k=et.get(RP);if(k){const B=u.find(E=>E.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),N({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=L):L=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsx(ip,{className:"size-4"}),e[25]=M):M=e[25],e[26]!==L?(R=c.jsx(ZT,{position:"bottom-right",showInteractive:!1,children:c.jsx(je,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(ns,{onMouseDown:Dn.preventFocus,onClick:L,children:M})})}),e[26]=L,e[27]=R):R=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(z=c.jsx(Ll,{selection:S,variables:o,edges:m,onClearSelection:C}),e[28]=m,e[29]=S,e[30]=o,e[31]=z):z=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==R||e[38]!==z?(D=c.jsxs(zh,{nodes:u,edges:m,nodeTypes:b2,minZoom:.2,fitViewOptions:_,onNodeClick:T,onEdgeClick:I,onNodeDoubleClick:zA,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[P,R,z,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=R,e[38]=z,e[39]=D):D=e[39],e[40]!==a||e[41]!==D?(A=c.jsx(g2,{value:a,children:D}),e[40]=a,e[41]=D,e[42]=A):A=e[42],A};function zA(t,e){V3(e.id,"focus")}const BA=yt("_minimap_"),UA=yt({hidePureMarkdown:!0}),$A=t=>{const e=H.c(11),[n,o]=Ot(BA),[r,s]=Ot(UA);let a;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(a=()=>n==="_minimap_"?c.jsx(cA,{...t,children:c.jsx($h,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(FA,{...t,settings:r,layoutDirection:n,children:c.jsx($h,{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]=a):a=e[5];const i=a;let l,d;return e[6]!==i?(l=i(),e[6]=i,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(Fh,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},VA=()=>{const t=H.c(5),e=Cm(),n=Tc(),[o]=LP();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=me("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx($A,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},HA=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=G.useState(!1);let a,i;return e[0]!==r||e[1]!==n?(a=()=>{n&&!r&&s(!0)},i=[n,r],e[0]=r,e[1]=n,e[2]=a,e[3]=i):(a=e[2],i=e[3]),G.useEffect(a,i),r?o:null},WA=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=et.get(cc)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=Ia(l);d&&jm(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let a,i;return e[2]!==o?(a=me("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a||e[6]!==n?(i=c.jsx("button",{type:"button",onClick:s,className:a,children:n}),e[4]=s,e[5]=a,e[6]=n,e[7]=i):i=e[7],i},qA=yt(t=>{const e=t(FP),n=t(cc),o=t(Nc);return oi(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(i=>i.name===r.variable_name);if(!s)return 0;const a=o.inOrderIds.indexOf(s.declaredBy[0]);return a===-1?0:a})}),GA=yt(t=>{const e=new Map(t(zP));for(const n of H3){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return oi([...e.values()],n=>H3.has(n.name)?1:0)}),YA=()=>{const t=H.c(32),[e,n]=G.useState(""),o=St(W3),r=Ie(qA),s=Ie(GA);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(lg,{children:c.jsxs(ke,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(Ko,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx($o,{})}),t[0]=b):b=t[0],b}const a=!!e.trim();let i,l,d,u,h,f,m,x,g,p;if(t[1]!==o?(i=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=i):i=t[2],t[3]!==e||t[4]!==i?(l=c.jsx(Ma,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:i,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=i,t[5]=l):l=t[5],t[6]!==a?(d=a&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(En,{className:"h-4 w-4"})}),t[6]=a,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(lg,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Ko,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==a||t[14]!==e){let b;t[16]!==a||t[17]!==e?(b=y=>c.jsx(KA,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>c.jsx(XA,{engineName:y.name,database:v,hasSearch:a,children:c.jsx(JA,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:a,searchValue:e})},v.name))},y.name),t[16]=a,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=a,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&c.jsxs(q3,{children:[c.jsx(Yl,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(x=r.length>0&&c.jsx(Pw,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=x):x=t[24],t[25]!==f||t[26]!==m||t[27]!==x?(g=c.jsxs(pm,{className:"flex flex-col",children:[f,m,x]}),t[25]=f,t[26]=m,t[27]=x,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(ac,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},KA=t=>{const e=H.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===BP,a=s?"In-Memory":n.name,[i,l]=G.useState(!1);let d;e[0]!==n.name?(d=async()=>{l(!0),await $P({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=d):d=e[1];const u=d;let h,f,m;e[2]!==n.dialect?(h=c.jsx(Dk,{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=UP(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=c.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const x=a;let g,p,b,y,v;return e[8]!==x?(g=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(WA,{variableName:x}),")"]}),e[8]=x,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==i?(p=!s&&c.jsx(je,{content:"Refresh connection",children:c.jsx(ke,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:c.jsx(bc,{className:me("h-4 w-4 text-muted-foreground hover:text-foreground",i&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=i,e[13]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=c.jsxs(q3,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:c.jsx(Ac,{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?(v=c.jsxs(c.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=v):v=e[24],v},XA=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[a,i]=G.useState(!1),[l,d]=G.useState(!1);let u,h,f;e[0]!==n?(u=()=>{i(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),G.useEffect(u,h),e[3]!==a||e[4]!==l?(f=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let x;e[6]!==a?(x=c.jsx(Z3,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=me("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx($o,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S,N;e[12]!==y?(v=me(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(S=c.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==x||e[23]!==b?(N=c.jsxs(Gn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[x,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=x,e[23]=b,e[24]=N):N=e[24];const j=a&&s;let C;return e[25]!==N||e[26]!==j?(C=c.jsxs(c.Fragment,{children:[N,j]}),e[25]=N,e[26]=j,e[27]=C):C=e[27],C},JA=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:a,hasSearch:i,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ac,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,u;if(e[1]!==a||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=x=>!l||x.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==a||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==i||e[16]!==l?(m=x=>c.jsx(ZA,{databaseName:a,schema:x,hasSearch:i,children:c.jsx(Pw,{tables:x.tables,searchValue:l,sqlTableContext:{engine:s,database:a,schema:x.name,defaultSchema:o,defaultDatabase:r}})},x.name),e[11]=a,e[12]=r,e[13]=o,e[14]=s,e[15]=i,e[16]=l,e[17]=m):m=e[17],d=f.map(m),e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},ZA=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[a,i]=G.useState(!1),[l,d]=G.useState(!1),u=`${n}:${o.name}`;let h,f,m,x;if(e[0]!==s?(h=()=>{i(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),G.useEffect(h,f),J3(o.name))return r;e[3]!==a||e[4]!==l?(m=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=m):m=e[5],e[6]!==a?(x=c.jsx(Z3,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a&&"text-foreground";let p,b;e[8]!==g?(p=me("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(KP,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S;e[12]!==y?(v=me(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=c.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==x||e[20]!==b||e[21]!==u?(S=c.jsxs(Gn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[x,b,w]}),e[17]=w,e[18]=m,e[19]=x,e[20]=b,e[21]=u,e[22]=S):S=e[22];const N=a&&r;let j;return e[23]!==S||e[24]!==N?(j=c.jsxs(c.Fragment,{children:[S,N]}),e[23]=S,e[24]=N,e[25]=j):j=e[25],j},Pw=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=G3(),[a,i]=G.useState(!1),[l,d]=G.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==a?(u=async()=>{if(n.length===0&&o&&!a){i(!0),d(!0);const{engine:p,database:b,schema:y}=o,v=await yL.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw d(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),d(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=a,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==a?(h=[n.length,o,a],e[5]=o,e[6]=n.length,e[7]=a,e[8]=h):h=e[8];const{isPending:f,error:m}=Cn(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Y3,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(K3,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Ac,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let x,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>c.jsx(QA,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],x=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=x}else x=e[16];return e[22]!==x?(g=c.jsx(c.Fragment,{children:x}),e[22]=x,e[23]=g):g=e[23],g},QA=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=G3(),[a,i]=G.useState(!1),[l,d]=G.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==a||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(a&&!u&&o&&!l){d(!0);const{engine:J,database:ee,schema:q}=o,Y=await vL.request({engine:J,database:ee,schema:q,tableName:n.name});if(!(Y!=null&&Y.table))throw new Error("No table details available");s({table:Y.table,sqlTableContext:o})}},e[0]=s,e[1]=a,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==a||e[8]!==u?(f=[a,u],e[7]=a,e[8]=u,e[9]=f):f=e[9];const{isFetching:m,isPending:x,error:g}=Cn(h,f),p=Ie(ql),b=ds(),{createNewCell:y}=it(),v=X3();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{qn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const J=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${J}")`}if(o)return Q3({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return Q3({table:n,columnName:"*",sqlTableContext:o});default:return ec(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const S=w;let N;e[17]!==n.num_columns||e[18]!==n.num_rows?(N=()=>{const J=[];return n.num_rows!=null&&J.push(`${n.num_rows} rows`),n.num_columns!=null&&J.push(`${n.num_columns} columns`),J.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:J.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=N):N=e[19];const j=N;let C;e[20]!==g||e[21]!==m||e[22]!==x||e[23]!==o||e[24]!==n?(C=()=>{if(x||m)return c.jsx(Y3,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(K3,{error:g,className:"pl-12"});const J=n.columns;return J.length===0?c.jsx(Ac,{content:"No columns found",className:"pl-12"}):J.map(ee=>c.jsx(eM,{table:n,column:ee,sqlTableContext:o},ee.name))},e[20]=g,e[21]=m,e[22]=x,e[23]=o,e[24]=n,e[25]=C):C=e[25];const _=C;let T;e[26]!==a||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(T=()=>{if(n.source_type==="local")return;const J=n.type==="table"?VP:zf;return c.jsx(J,{className:"h-3 w-3",strokeWidth:a||r?2.5:void 0})},e[26]=a,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=T):T=e[30];const I=T,P=o?`${o.database}.${o.schema}.${n.name}`:n.name,L=o&&(J3(o.schema)?"pl-9":"pl-12"),M=(a||r)&&"font-semibold";let R,z,D,A,k,B,E,U,V,$,K,X;return e[31]!==L||e[32]!==M?(R=me("rounded-none group h-8 cursor-pointer",L,M),e[31]=L,e[32]=M,e[33]=R):R=e[33],e[34]!==a?(z=()=>i(!a),e[34]=a,e[35]=z):z=e[35],e[36]!==I?(D=I(),e[36]=I,e[37]=D):D=e[37],e[38]!==n.name?(A=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=A):A=e[39],e[40]!==D||e[41]!==A?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[D,A]}),e[40]=D,e[41]=A,e[42]=k):k=e[42],e[43]!==j?(B=j(),e[43]=j,e[44]=B):B=e[44],e[45]!==S?(E=Dn.stopPropagation(()=>S()),e[45]=S,e[46]=E):E=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(HP,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==E?(V=c.jsx(je,{content:"Add table to notebook",delayDuration:400,children:c.jsx(ke,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:E,children:U})}),e[48]=E,e[49]=V):V=e[49],e[50]!==a||e[51]!==z||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==R||e[56]!==P?($=c.jsxs(Gn,{className:R,value:P,"aria-selected":a,forceMount:!0,onSelect:z,children:[k,B,V]}),e[50]=a,e[51]=z,e[52]=k,e[53]=B,e[54]=V,e[55]=R,e[56]=P,e[57]=$):$=e[57],e[58]!==a||e[59]!==_?(K=a&&_(),e[58]=a,e[59]=_,e[60]=K):K=e[60],e[61]!==$||e[62]!==K?(X=c.jsxs(c.Fragment,{children:[$,K]}),e[61]=$,e[62]=K,e[63]=X):X=e[63],X},eM=t=>{var E,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,a]=G.useState(!1),i=Ie(W3),l=St(WP);let d,u;e[0]!==i?(d=()=>{i&&a(!1)},u=[i],e[0]=i,e[1]=d,e[2]=u):(d=e[1],u=e[2]),G.useEffect(d,u),l(s?V=>new Set([...V,`${n.name}:${o.name}`]):V=>(V.delete(`${n.name}:${o.name}`),new Set(V)));const h=X3(),{columnsPreviews:f}=qP();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((E=n.primary_keys)==null?void 0:E.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const x=m;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const p=g;let b;e[9]!==h?(b=V=>{h(V)},e[9]=h,e[10]=b):b=e[10];const y=b,v=tM,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=c.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const N=S,j=`${n.name}.${o.name}`,C=`${n.name}.${o.name}`;let _;e[14]!==s?(_=()=>a(!s),e[14]=s,e[15]=_):_=e[15];const T=r?"pl-14":"pl-7";let I,P,L,M,R,z,D,A,k,B;return e[16]!==T?(I=me("flex flex-row gap-2 items-center flex-1",T),e[16]=T,e[17]=I):I=e[17],e[18]!==o.type||e[19]!==N?(P=c.jsx(GP,{columnName:N,dataType:o.type}),e[18]=o.type,e[19]=N,e[20]=P):P=e[20],e[21]!==x?(L=x&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=x,e[22]=L):L=e[22],e[23]!==p?(M=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=M):M=e[24],e[25]!==I||e[26]!==P||e[27]!==L||e[28]!==M?(R=c.jsxs("div",{className:I,children:[P,L,M]}),e[25]=I,e[26]=P,e[27]=L,e[28]=M,e[29]=R):R=e[29],e[30]!==o.name?(z=c.jsx(je,{content:"Copy column name",delayDuration:400,children:c.jsx(ke,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(B3,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=z):z=e[31],e[32]!==o.external_type?(D=c.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=D):D=e[33],e[34]!==_||e[35]!==R||e[36]!==z||e[37]!==D||e[38]!==j||e[39]!==C?(A=c.jsxs(Gn,{className:"rounded-none py-1 group cursor-pointer",value:C,onSelect:_,children:[R,z,D]},j),e[34]=_,e[35]=R,e[36]=z,e[37]=D,e[38]=j,e[39]=C,e[40]=A):A=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:c.jsx(ic,{children:c.jsx(YP,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==A||e[49]!==k?(B=c.jsxs(c.Fragment,{children:[A,k]}),e[48]=A,e[49]=k,e[50]=B):B=e[50],B};function tM(t){const{tooltipContent:e,content:n}=t;return c.jsx(je,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const nM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(YA,{}),t[0]=e):e=t[0],e},oM=()=>{const t=H.c(5),{documentation:e}=Ie(XP);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(Kc,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Nm({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},rM=()=>{const t=H.c(5),e=JP();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No errors!",icon:c.jsx(pp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(sM),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function sM(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(ZP,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(QP,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const Ef=new Map,aM=({file:t,onOpenNotebook:e})=>{const{theme:n}=Xo(),o=Ie(Jl),[r,s]=O.useState(""),{data:a,isPending:i,error:l,setData:d}=Cn(async()=>{const g=await Em({path:t.path}),p=g.contents||"";return s(Ef.get(t.path)||p),g},[t.path]),u=async()=>{r!==(a==null?void 0:a.contents)&&await iR({path:t.path,contents:r}).then(g=>{g.success&&(d(p=>({...p,contents:r})),s(r))})},h=O.useRef(r);if(h.current=r,O.useEffect(()=>()=>{if(!(a!=null&&a.contents))return;const g=h.current;g===a.contents?Ef.delete(t.path):Ef.set(t.path,g)},[t.path,a==null?void 0:a.contents]),l)return c.jsx(yr,{error:l});if(i||!a)return null;const f=a.mimeType||"text/plain",m=f in _f;if(!a.contents&&!m)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:a.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:f})]});const x=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Zt()&&c.jsx(je,{content:"Open notebook",children:c.jsx(sn,{size:"small",onClick:g=>e(g),children:c.jsx(rc,{})})}),c.jsx(je,{content:"Download",children:c.jsx(sn,{size:"small",onClick:()=>{if(Rw(f)){const g=sR(a.contents,f);return void aR(g,a.file.name)}Fa(new Blob([a.contents||r],{type:f}),a.file.name)},children:c.jsx(Zf,{})})}),!Rw(f)&&c.jsxs(c.Fragment,{children:[c.jsx(je,{content:"Copy contents to clipboard",children:c.jsx(sn,{size:"small",onClick:async()=>{await on(r)},children:c.jsx(Ea,{})})}),c.jsx(je,{content:Wt("global.save"),children:c.jsx(sn,{size:"small",color:r===a.contents?void 0:"green",onClick:u,disabled:r===a.contents,children:c.jsx(li,{})})})]})]});return f.startsWith("image/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(eR,{base64:a.contents,mime:f})})]}):f==="text/csv"&&a.contents?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(tR,{contents:a.contents})})]}):f.startsWith("audio/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(nR,{base64:a.contents,mime:f})})]}):f.startsWith("video/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(oR,{base64:a.contents,mime:f})})]}):f.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(rR,{base64:a.contents,mime:f})})]}):c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(O.Suspense,{children:c.jsx(Qa,{theme:n==="dark"?"dark":"light",language:_f[f]||_f.default,className:"border-b",extensions:[Ge.lineWrapping,_n.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==a.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},Rw=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),_f={"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"},Lw=yt(new class{constructor(t){this.callbacks=t,this.delegate=new Om([]),this.rootPath="",this.onChange=jn.NOOP,this.path=new nc("/"),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 Om(n.files),this.rootPath=n.root,this.path=nc.guessDeliminator(n.root)}catch(n){Xe({title:"Failed",description:m3(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 a=o[r];s===this.rootPath?this.delegate=new Om(a.files):this.delegate.update({id:s,changes:{children:a.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:(Xe({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 a=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:a}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:a}).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:$k,createFileOrFolder:_m,deleteFileOrFolder:cR,renameFileOrFolder:lR})),iM=yt({});function lM(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 Fw(t){const e=H.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:fM,onDropRejected:dM,onDrop:cM,...o},e[2]=o,e[3]=r):r=e[3],dR(r)}async function cM(t){for(const e of t){const n=pM(mM(e));let o="";n&&(o=nc.guessDeliminator(n).dirname(n));const r=(await lM(e)).split(",")[1];await _m({path:o,type:"file",name:e.name,contents:r})}await async function(){await et.get(Lw).refreshAll([])}()}function dM(t){Xe({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(uM)}),variant:"danger"})}function uM(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(hM).join(", "),")"]},t.file.name)}function hM(t){return t.message}function fM(t){ft.error(t),Xe({title:"File upload failed",description:t.message,variant:"danger"})}function mM(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 pM(t){if(t)return t.replace(/^\/+/,"")}const zw=G.createContext(null),gM=t=>{const e=H.c(60),{height:n}=t,o=O.useRef(null),[r]=Ot(Lw);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[a,i]=O.useState(s),[l,d]=O.useState(null),{openPrompt:u}=Nn(),[h,f]=Ot(iM);let m,x;e[1]!==r?(m=()=>r.initialize(i),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[3]=x):x=e[3];const{isPending:g,error:p}=Cn(m,x);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=ze(b);let v;e[7]!==u||e[8]!==r?(v=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=v):v=e[9];const w=ze(v);let S;e[10]!==u||e[11]!==r?(S=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=S):S=e[12];const N=ze(S);let j;e[13]!==f?(j=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=j):j=e[14];const C=ze(j);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(xn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(yr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,E,U,V,$;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(ke,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(wt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(E=c.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[B,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=E):E=e[21],e[22]!==l.path||e[23]!==r?(U=K=>Bw(K,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?(V=c.jsx(O.Suspense,{children:c.jsx(aM,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==E||e[29]!==V?($=c.jsxs(c.Fragment,{children:[E,V]}),e[28]=E,e[29]=V,e[30]=$):$=e[30],$}let _;e[31]!==C||e[32]!==N||e[33]!==w||e[34]!==y||e[35]!==r?(_=c.jsx(bM,{onRefresh:y,onCreateFile:N,onCreateFolder:w,onCollapseAll:C,tree:r}),e[31]=C,e[32]=N,e[33]=w,e[34]=y,e[35]=r,e[36]=_):_=e[36];const T=n-33;let I,P,L,M,R,z,D,A;return e[37]!==r?(I=async k=>{const{ids:B}=k;for(const E of B)await r.delete(E)},P=async k=>{const{id:B,name:E}=k;await r.rename(B,E)},L=async k=>{const{dragIds:B,parentId:E}=k;await r.move(B,E)},e[37]=r,e[38]=I,e[39]=P,e[40]=L):(I=e[38],P=e[39],L=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(M=k=>{const B=k[0];B&&(B.data.isDirectory||d(B.data))},e[41]=M):M=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(R=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=R):R=e[45],e[46]!==a||e[47]!==h||e[48]!==I||e[49]!==P||e[50]!==L||e[51]!==R||e[52]!==T?(z=c.jsx(nL,{width:"100%",ref:o,height:T,className:"h-full",data:a,initialOpenState:h,openByDefault:!1,renderCursor:SM,disableDrop:NM,onDelete:I,onRename:P,onMove:L,onSelect:M,onToggle:R,padding:15,rowHeight:30,indent:xM,overscanCount:1e3,disableMultiSelection:!0,children:wM}),e[46]=a,e[47]=h,e[48]=I,e[49]=P,e[50]=L,e[51]=R,e[52]=T,e[53]=z):z=e[53],e[54]!==z||e[55]!==r?(D=c.jsx(zw,{value:r,children:z}),e[54]=z,e[55]=r,e[56]=D):D=e[56],e[57]!==D||e[58]!==_?(A=c.jsxs(c.Fragment,{children:[_,D]}),e[57]=D,e[58]=_,e[59]=A):A=e[59],A},xM=15,bM=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={noDrag:!0,noDragEventsBubbling:!0},e[0]=a):a=e[0];const{getRootProps:i,getInputProps:l}=Fw(a);let d,u,h,f,m,x,g,p,b,y,v,w,S,N,j;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ai,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(je,{content:"Add file",children:c.jsx(ke,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Uc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(je,{content:"Add folder",children:c.jsx(ke,{"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]!==i?(m=i({}),e[7]=i,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(x=uR({variant:"text",size:"xs"}),g=c.jsx(fR,{size:16}),e[9]=x,e[10]=g):(x=e[9],g=e[10]),e[11]!==m?(p=c.jsx(je,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:x,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(S3,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=c.jsx(je,{content:"Refresh",children:c.jsx(ke,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(Gm,{size:16}),e[20]=S):S=e[20],e[21]!==s?(N=c.jsx(je,{content:"Collapse all folders",children:c.jsx(ke,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=N):N=e[22],e[23]!==y||e[24]!==w||e[25]!==N||e[26]!==u||e[27]!==f||e[28]!==p?(j=c.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,y,w,N]}),e[23]=y,e[24]=w,e[25]=N,e[26]=u,e[27]=f,e[28]=p,e[29]=j):j=e[29],j},yM=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,a;return e[0]!==n?(r=i=>{n.data.isDirectory||(i.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Zt()&&c.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(rc,{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?(a=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=a):a=e[8],a},vM=t=>{const e=H.c(10),{node:n}=t,o=O.useRef(null);let r,s,a,i,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),e[3]!==n?(a=()=>n.reset(),i=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.currentTarget.value)},e[3]=n,e[4]=a,e[5]=i):(a=e[4],i=e[5]),e[6]!==n.data.name||e[7]!==a||e[8]!==i?(l=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:jM,onBlur:a,onKeyDown:i}),e[6]=n.data.name,e[7]=a,e[8]=i,e[9]=l):l=e[9],l},wM=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":Bk(t.data.name),r=Uk[o],{openConfirm:s,openPrompt:a}=Nn(),{createNewCell:i}=it(),l=ds(),d=O.use(zw),u=async g=>{Bw(g,d?d.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(Pk,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=ze(async()=>{t.open(),a({title:"Folder name",onConfirm:async g=>{d==null||d.createFolder(g,t.id)}})}),m=ze(async()=>{t.open(),a({title:"File name",onConfirm:async g=>{d==null||d.createFile(g,t.id)}})}),x=ze(async()=>{var y;if(!d||t.data.isDirectory)return;const[g,p]=hR(t.data.name),b=`${g}_copy${p}`;try{const v=await Em({path:t.data.path}),w=((y=t.parent)==null?void 0:y.data.path)||"";await _m({path:w,type:"file",name:b,contents:v.contents?btoa(v.contents):void 0}),await d.refreshAll([w])}catch{Xe({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:me("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(kM,{node:t}),c.jsxs("span",{className:me("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx(vM,{node:t}):c.jsx(yM,{node:t,onOpenMarimoFile:u}),c.jsxs(Ho,{modal:!1,children:[c.jsx(Wo,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:c.jsx(ke,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx(Bc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(qo,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(Dt,{onSelect:()=>t.select(),children:[c.jsx(Tp,{...g}),"Open file"]}),!t.data.isDirectory&&!Zt()&&c.jsxs(Dt,{onSelect:()=>{mR({path:t.data.path})},children:[c.jsx(rc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Dt,{onSelect:()=>m(),children:[c.jsx(ai,{...g}),"Create file"]}),c.jsxs(Dt,{onSelect:()=>f(),children:[c.jsx(Uc,{...g}),"Create folder"]}),c.jsx(rn,{})]}),c.jsxs(Dt,{onSelect:()=>t.edit(),children:[c.jsx(gp,{...g}),"Rename"]}),!t.data.isDirectory&&c.jsxs(Dt,{onSelect:x,children:[c.jsx(Ea,{...g}),"Duplicate"]}),c.jsxs(Dt,{onSelect:async()=>{await on(t.data.path),Xe({title:"Copied to clipboard"})},children:[c.jsx(Hc,{...g}),"Copy path"]}),d&&c.jsxs(Dt,{onSelect:async()=>{await on(d.relativeFromRoot(t.data.path)),Xe({title:"Copied to clipboard"})},children:[c.jsx(Hc,{...g}),"Copy relative path"]}),c.jsx(rn,{}),c.jsxs(Dt,{onSelect:()=>{const{path:p}=t.data;(b=>{i({code:b,before:!1,cellId:l??"__end__"})})(eS[o](p))},children:[c.jsx(Sr,{...g}),"Insert snippet for reading file"]}),c.jsxs(Dt,{onSelect:async()=>{Xe({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=eS[o](p);await on(b)},children:[c.jsx(pR,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsxs(Dt,{onSelect:u,children:[c.jsx(jp,{...g}),"Open notebook"]})]}),c.jsx(rn,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Dt,{onSelect:async()=>{const p=(await Em({path:t.data.path})).contents||"";Fa(new Blob([p]),t.data.name)},children:[c.jsx(Zf,{...g}),"Download"]}),c.jsx(rn,{})]}),c.jsxs(Dt,{onSelect:h,variant:"danger",children:[c.jsx(Xl,{...g}),"Delete"]})]})})()]})]})]})},kM=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(vo,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(Aa,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function Bw(t,e){t.stopPropagation(),t.preventDefault(),dS(e)}function SM(){return null}function NM(t){const{parentNode:e}=t;return!e.data.isDirectory}function jM(t){return t.stopPropagation()}let Uw,$w,Vw;Uw=()=>{const t=H.c(20),{ref:e,height:n}=gR(),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:a,isDragActive:i}=Fw(r);let l,d,u,h,f,m,x,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=me("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==a?(u=a(),t[4]=a,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==i?(f=i&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=i,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(gM,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(x=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=x):x=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==x?(g=c.jsxs("div",{...l,className:d,children:[h,f,x]}),t[15]=l,t[16]=h,t[17]=f,t[18]=x,t[19]=g):g=t[19],g},Um=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=me("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},$w=()=>{const t=H.c(9),e=xR(),{clearLogs:n}=it();if(e.length===0){let a,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=a):a=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No logs",description:c.jsxs("span",{children:[a," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx(Ff,{})}),t[1]=i):i=t[1],i}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(Um,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(Vw,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},Vw=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,a,i,l;return e[0]!==o?(r=me("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?(a=n.map(_M),e[3]=n,e[4]=a):a=e[4],e[5]!==a?(i=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:a})}),e[5]=a,e[6]=i):i=e[6],e[7]!==r||e[8]!==i?(l=c.jsx("div",{className:r,children:i}),e[7]=r,e[8]=i,e[9]=l):l=e[9],l};function CM(t){const e=bR(t.timestamp),n=EM[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),c.jsx("span",{className:me("flex-shrink-0",n),children:o}),c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",c.jsx(jo,{cellId:t.cellId}),")"]}),t.message]})}const EM={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function _M(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:me("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:me("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:CM(t)})]},e)}const IM=()=>{const t=H.c(7),{items:e}=Ie(yR);let n,o;t[0]!==e?(o=wL(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:a}=kL(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(an,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(Yc,{})}),t[2]=l):l=t[2],l}let i;return t[3]!==s||t[4]!==a||t[5]!==e?(i=c.jsx(SL,{items:e,activeHeaderId:s,activeOccurrences:a}),t[3]=s,t[4]=a,t[5]=e,t[6]=i):i=t[6],i},Hw=yt(null),Ww=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(xn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let a,i,l;return e[1]!==s?(a=me("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=a):a=e[2],e[3]!==n?(i=Dn.stopPropagation(n),e[3]=n,e[4]=i):i=e[4],e[5]!==r||e[6]!==a||e[7]!==i?(l=c.jsx("button",{type:"button",className:a,onClick:i,children:r}),e[5]=r,e[6]=a,e[7]=i,e[8]=l):l=e[8],l},TM=()=>{var w,S;const t=H.c(27),[e]=mr(),n=e.package_management.manager,[o,r]=G.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:a,error:i,refetch:l,isPending:d}=Cn(DM,s);if(d){let N;return t[2]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(xn,{size:"medium",centered:!0}),t[2]=N):N=t[2],N}if(i){let N;return t[3]!==i?(N=c.jsx(yr,{error:i}),t[3]=i,t[4]=N):N=t[4],N}const u=a.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(N,j){return N==="list"?"list":j?N||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(w=a.tree)==null?void 0:w.name,x=(S=a==null?void 0:a.tree)==null?void 0:S.version,g=m==="<root>";let p,b,y,v;return t[8]!==n||t[9]!==l?(p=c.jsx(AM,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==x||t[15]!==f?(b=u&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:me("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),c.jsx("button",{type:"button",className:me("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,x&&` v${x}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,t[14]=x,t[15]=f,t[16]=b):b=t[16],t[17]!==a.list||t[18]!==a.tree||t[19]!==i||t[20]!==l||t[21]!==f?(y=f==="list"?c.jsx(MM,{packages:a.list,onSuccess:l}):c.jsx(OM,{tree:a.tree,error:i,onSuccess:l}),t[17]=a.list,t[18]=a.tree,t[19]=i,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(v=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=v):v=t[26],v},AM=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=G.useState(""),{handleClick:a}=ti(),i=Ie(Hw),l=St(Hw);let d,u;e[0]!==i||e[1]!==l?(d=()=>{i&&(s(i),l(null))},u=[i,l],e[0]=i,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),G.useEffect(d,u);const{loading:h,handleInstallPackages:f}=kR();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const x=m;let g;e[6]!==f||e[7]!==r||e[8]!==x?(g=()=>{f(r.split(",").map(PM),x)},e[6]=f,e[7]=r,e[8]=x,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let y,v,w,S,N,j,C,_,T,I,P,L,M,R;e[10]!==h||e[11]!==a?(y=h?c.jsx(xn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(je,{content:"Change package manager",children:c.jsx(Ns,{onClick:()=>a("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=a,e[12]=y):y=e[12],e[13]!==p?(v=E=>{E.key==="Enter"&&(E.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=E=>s(E.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=c.jsx(tS,{placeholder:b,id:u1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=S):S=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=N):N=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs("div",{children:[N," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),C=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=j,e[23]=C):(j=e[22],C=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsxs("div",{children:[C," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),T=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=_,e[25]=T):(_=e[24],T=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsxs("div",{children:[T," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),P=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=I,e[27]=P):(I=e[26],P=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsxs("div",{children:[P," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),M=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=L,e[29]=M):(L=e[28],M=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(je,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[j,_,I,L,c.jsxs("div",{children:[M," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(wm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=R):R=e[30];const z=r&&"bg-accent text-accent-foreground";let D;e[31]!==z?(D=me("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",z,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=z,e[32]=D):D=e[32];const A=!r;let k,B;return e[33]!==p||e[34]!==D||e[35]!==A?(k=c.jsx("button",{type:"button",className:D,onClick:p,disabled:A,children:"Add"}),e[33]=p,e[34]=D,e[35]=A,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=c.jsxs("div",{className:"flex items-center w-full border-b",children:[S,R,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},MM=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(Ns,{})}),e[0]=i):i=e[0],i}let r,s,a;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Im,{children:c.jsxs(Ss,{children:[c.jsx(vr,{children:"Name"}),c.jsx(vr,{children:"Version"}),c.jsx(vr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let i;e[5]!==n?(i=l=>c.jsxs(Ss,{className:"group",onClick:async()=>{await on(`${l.name}==${l.version}`),Xe({title:"Copied to clipboard"})},children:[c.jsx(wr,{children:l.name}),c.jsx(wr,{children:l.version}),c.jsxs(wr,{className:"flex justify-end",children:[c.jsx(qw,{packageName:l.name,onSuccess:n}),c.jsx(Gw,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=i):i=e[6],s=o.map(i),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(a=c.jsxs(Tm,{className:"overflow-auto flex-1",children:[r,c.jsx(Am,{children:s})]}),e[7]=s,e[8]=a):a=e[8],a},qw=({packageName:t,onSuccess:e})=>{const[n,o]=G.useState(!1);return Zt()?null:c.jsx(Ww,{onClick:async()=>{try{o(!0);const r=await SR({package:t,upgrade:!0});r.success?(e(),nS(t)):nS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},Gw=({packageName:t,onSuccess:e})=>{const[n,o]=G.useState(!1);return c.jsx(Ww,{onClick:async()=>{try{o(!0);const r=await NR({package:t});r.success?(e(),oS(t)):oS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},OM=t=>{const e=H.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[a,i]=G.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{i(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],G.useEffect(l,d),o){let x;return e[4]!==o?(x=c.jsx(yr,{error:o}),e[4]=o,e[5]=x):x=e[5],x}if(!n){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(xn,{size:"medium",centered:!0}),e[6]=x):x=e[6],x}if(n.dependencies.length===0){let x;return e[7]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(an,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(Ns,{})}),e[7]=x):x=e[7],x}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=x=>{i(g=>{const p=new Set(g);return p.has(x)?p.delete(x):p.add(x),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==a||e[10]!==r||e[11]!==n.dependencies){let x;e[13]!==a||e[14]!==r?(x=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(Yw,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:a,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=a,e[14]=r,e[15]=x):x=e[15],f=n.dependencies.map(x),e[9]=a,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},Yw=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:a,onToggle:i,onSuccess:l}=t,d=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==a||e[1]!==n?(h=a.has(n),e[0]=a,e[1]=n,e[2]=h):h=e[2];const f=h,m=d?0:16+16*r;let x;e[3]!==u||e[4]!==n||e[5]!==i?(x=D=>{D.key!=="Enter"&&D.key!==" "||(D.preventDefault(),u&&i(n))},e[3]=u,e[4]=n,e[5]=i,e[6]=x):x=e[6];const g=x;let p;e[7]!==u||e[8]!==n||e[9]!==i?(p=D=>{D.stopPropagation(),u&&i(n)},e[7]=u,e[8]=n,e[9]=i,e[10]=p):p=e[10];const b=p,y=u&&"select-none",v=d?"px-2 py-0.5":"";let w,S;e[11]!==y||e[12]!==v?(w=me("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==d?(S=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=S):S=e[16];const N=u?f:void 0;let j,C,_,T,I,P,L,M,R,z;return e[17]!==u||e[18]!==f?(j=u?f?c.jsx(vo,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx(Aa,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=j):j=e[19],e[20]!==o.name?(C=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=C):C=e[21],e[22]!==o.version?(_=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=_):_=e[23],e[24]!==C||e[25]!==_?(T=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[C,_]}),e[24]=C,e[25]=_,e[26]=T):T=e[26],e[27]!==o.tags?(I=o.tags.map(RM),e[27]=o.tags,e[28]=I):I=e[28],e[29]!==I?(P=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:I}),e[29]=I,e[30]=P):P=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(L=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(qw,{packageName:o.name,onSuccess:l}),c.jsx(Gw,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=L):L=e[34],e[35]!==b||e[36]!==g||e[37]!==j||e[38]!==T||e[39]!==P||e[40]!==L||e[41]!==w||e[42]!==S||e[43]!==N?(M=c.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":N,children:[j,T,P,L]}),e[35]=b,e[36]=g,e[37]=j,e[38]=T,e[39]=P,e[40]=L,e[41]=w,e[42]=S,e[43]=N,e[44]=M):M=e[44],e[45]!==a||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==i?(R=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((D,A)=>c.jsx(Yw,{nodeId:`${n}-${A}`,node:D,level:r+1,isTopLevel:!1,expandedNodes:a,onToggle:i,onSuccess:l},`${D.name}-${A}`))}),e[45]=a,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=i,e[53]=R):R=e[53],e[54]!==M||e[55]!==R?(z=c.jsxs("div",{children:[M,R]}),e[54]=M,e[55]=R,e[56]=z):z=e[56],z};async function DM(){const[t,e]=await Promise.all([vR(),wR()]);return{list:t.packages,tree:e.tree}}function PM(t){return t.trim()}function RM(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const If=pk("marimo:scratchpadHistory:v1",[]),LM=yt(!1),FM=yt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(If),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(If,r)}),zM={hide_code:!1,disabled:!1},BM=()=>{const t=H.c(69),e=ps(),[n]=mr(),{theme:o}=Xo(),r=O.useRef(null),s=ds(),{createNewCell:a,updateCellCode:i}=it(),l=e.cellRuntime[Jo],d=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[Jo],m=(f==null?void 0:f.code)??"",x=St(FM),[g,p]=Ot(LM),b=Ie(If);let y;t[0]!==x||t[1]!==m?(y=()=>{rS({code:m}),x(m)},t[0]=x,t[1]=m,t[2]=y):y=t[2];const v=ze(y);let w;t[3]!==m||t[4]!==a||t[5]!==s?(w=()=>{m.trim()&&a({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=a,t[5]=s,t[6]=w):w=t[6];const S=ze(w);let N;t[7]!==i?(N=()=>{i({cellId:Jo,code:"",formattingChange:!1}),rS({code:""});const ie=r.current;ie&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:""}})},t[7]=i,t[8]=N):N=t[8];const j=ze(N);let C;t[9]!==p||t[10]!==i?(C=ie=>{p(!1),i({cellId:Jo,code:ie,formattingChange:!1});const ve=r.current;ve&&ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ie}})},t[9]=p,t[10]=i,t[11]=C):C=t[11];const _=ze(C),[T,I]=O.useState();let P;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==T||t[16]!==d||t[17]!==o||t[18]!==n?(P=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:c.jsx(wu,{theme:o,showPlaceholder:!1,id:Jo,code:m,config:zM,status:"idle",serializedEditorState:null,runCell:v,userConfig:n,editorViewRef:r,setEditorView:ie=>{r.current=ie},hidden:!1,showHiddenCode:jn.NOOP,languageAdapter:T,setLanguageAdapter:I})}),c.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:c.jsx(Ec,{allowExpand:!1,output:d,className:"output-area",cellId:Jo,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:c.jsx(Lm,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:gk,onSubmitDebugger:jn.NOOP,cellId:Jo,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=v,t[15]=T,t[16]=d,t[17]=o,t[18]=n,t[19]=P):P=t[19];const L=P;let M;t[20]!==_||t[21]!==b||t[22]!==g||t[23]!==o?(M=()=>g?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ie,ve)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>_(ie),children:c.jsx(O.Suspense,{children:c.jsx(Qa,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ie.trim(),editable:!1,readOnly:!0})})},ve))})}):null,t[20]=_,t[21]=b,t[22]=g,t[23]=o,t[24]=M):M=t[24];const R=M;let z,D,A,k,B,E,U,V,$,K,X;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=Rf.create(Jo),D=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=z,t[26]=D):(z=t[25],D=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(A=Wt("cell.run"),t[27]=A):A=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(kr,{color:"var(--grass-11)",size:16}),t[28]=k):k=t[28],t[29]!==v||t[30]!==g?(B=c.jsx(je,{content:A,children:c.jsx(ke,{"data-testid":"scratchpad-run-button",onClick:v,disabled:g,variant:"text",size:"xs",children:k})}),t[29]=v,t[30]=g,t[31]=B):B=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(Km,{size:16}),t[32]=E):E=t[32],t[33]!==j||t[34]!==g?(U=c.jsx(je,{content:"Clear code and outputs",children:c.jsx(ke,{disabled:g,size:"xs",variant:"text",onClick:j,children:E})}),t[33]=j,t[34]=g,t[35]=U):U=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(V=c.jsx(Sr,{size:16}),t[36]=V):V=t[36],t[37]!==S||t[38]!==g?($=c.jsx(Ms,{children:c.jsx(je,{content:"Insert code",children:c.jsx(ke,{disabled:g,size:"xs",variant:"text",onClick:S,children:V})})}),t[37]=S,t[38]=g,t[39]=$):$=t[39],t[40]!==u?(K=(u==="running"||u==="queued")&&c.jsx(xn,{className:"inline",size:"small"}),t[40]=u,t[41]=K):K=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(X=c.jsx("div",{className:"flex-1"}),t[42]=X):X=t[42];const J=g&&"bg-[var(--sky-3)] rounded-none";let ee,q;t[43]!==J?(ee=me(J),t[43]=J,t[44]=ee):ee=t[44],t[45]!==g||t[46]!==p?(q=()=>p(!g),t[45]=g,t[46]=p,t[47]=q):q=t[47];const Y=b.length===0;let oe,se,re,ae,te,be,ye;return t[48]===Symbol.for("react.memo_cache_sentinel")?(oe=c.jsx(np,{size:16}),t[48]=oe):oe=t[48],t[49]!==ee||t[50]!==q||t[51]!==Y?(se=c.jsx(je,{content:"Toggle history",children:c.jsx(ke,{size:"xs",variant:"text",className:ee,onClick:q,disabled:Y,children:oe})}),t[49]=ee,t[50]=q,t[51]=Y,t[52]=se):se=t[52],t[53]!==B||t[54]!==U||t[55]!==$||t[56]!==K||t[57]!==se?(re=c.jsxs("div",{className:"flex items-center flex-shrink-0",children:[B,U,$,K,X,se]}),t[53]=B,t[54]=U,t[55]=$,t[56]=K,t[57]=se,t[58]=re):re=t[58],t[59]!==L?(ae=L(),t[59]=L,t[60]=ae):ae=t[60],t[61]!==R?(te=R(),t[61]=R,t[62]=te):te=t[62],t[63]!==ae||t[64]!==te?(be=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ae,te]}),t[63]=ae,t[64]=te,t[65]=be):be=t[65],t[66]!==re||t[67]!==be?(ye=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:z,children:[D,re,be]}),t[66]=re,t[67]=be,t[68]=ye):ye=t[68],ye},UM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(BM,{}),t[0]=e):e=t[0],e},$M=()=>{const t=H.c(23),{openModal:e,closeModal:n}=Nn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:a,refetch:i}=Cn(HM,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(xn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(a){let b;return t[2]!==a?(b=c.jsx(yr,{error:a}),t[2]=a,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(WM).map(qM),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx($c,{})}),t[6]=b):b=t[6],b}let u,h,f,m,x,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==i?(u=()=>e(c.jsx(rg,{providerNames:d,onSuccess:()=>{i(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=i,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ko,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Im,{children:c.jsxs(Ss,{children:[c.jsx(vr,{children:"Environment Variable"}),c.jsx(vr,{children:"Source"}),c.jsx(vr,{})]})}),t[15]=m):m=t[15],t[16]!==r?(x=r.map(GM),t[16]=r,t[17]=x):x=t[17],t[18]!==x?(g=c.jsxs(Tm,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(Am,{children:x})]}),t[18]=x,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},VM=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,a]=G.useState(!1);let i;e[0]!==r?(i=()=>{r(),a(!0),setTimeout(()=>a(!1),1e3)},e[0]=r,e[1]=i):i=e[1];const l=i;let d,u;return e[2]!==s?(d=s?c.jsx(oc,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(Ea,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function HM(){return og((await xS.request({})).secrets)}function WM(t){return t.provider!=="env"}function qM(t){return t.name}function GM(t){return t.keys.map(e=>c.jsxs(Ss,{className:"group",children:[c.jsx(wr,{children:e}),c.jsx(wr,{children:t.provider!=="env"&&c.jsx($3,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(wr,{children:c.jsx(VM,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await on(`os.environ["${e}"]`),Xe({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:me("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const YM=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Nn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(XM,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(D3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},KM=[Ge.lineWrapping],XM=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=O.useState(""),{theme:s}=Xo();let a,i,l,d,u,h;e[0]!==n?(a=async v=>{v.preventDefault();const w=new FormData(v.target),S=w.get("title"),N=w.get("description"),j=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:N,code:j})}),n(),Xe({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(zo,{children:"Contribute a Snippet"}),e[2]=i):i=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(ss,{children:[i,c.jsxs(as,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:On.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Bo,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(jR,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,x,g,p,b,y;return e[8]!==o||e[9]!==f?(m=c.jsx(Qa,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:KM,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==n?(g=c.jsx(ke,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(ke,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==a||e[20]!==b||e[21]!==x?(y=c.jsx(Uo,{className:"w-fit",children:c.jsxs("form",{onSubmit:a,children:[l,x,b]})}),e[19]=a,e[20]=b,e[21]=x,e[22]=y):y=e[22],y},JM=[Ge.lineWrapping],ZM=()=>{const t=H.c(20),[e,n]=G.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:a}=Cn(t7,o);if(s){let b;return t[1]!==s?(b=c.jsx(yr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(a||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(xn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const i=e?"h-1/3":"h-full";let l,d,u,h,f,m,x,g,p;return t[4]!==i?(l=me("border-b rounded-none",i),t[4]=i,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Ma,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=d):d=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs("div",{className:"flex items-center w-full",children:[d,c.jsx(YM,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Ko,{className:"h-4 w-4"})})})]}),h=c.jsx(Ql,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=c.jsx(e7,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(x=c.jsxs(ac,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=x):x=t[14],t[15]!==e?(g=c.jsx(O.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?c.jsx(QM,{snippet:e},e.title):c.jsx(an,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==x||t[18]!==g?(p=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[x,g]}),t[17]=x,t[18]=g,t[19]=p):p=t[19],p},QM=t=>{const e=H.c(27),{snippet:n}=t,{theme:o}=Xo(),{createNewCell:r}=it(),s=ds();let a;e[0]!==r||e[1]!==s||e[2]!==n.sections?(a=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=a):a=e[3];const i=a;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const d=l;let u,h,f,m,x,g;if(e[7]!==n.title?(u=c.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Sr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==i?(f=c.jsx("div",{className:"flex justify-end",children:c.jsx(Ms,{children:c.jsxs(ke,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",h]})})}),e[10]=i,e[11]=f):f=e[11],e[12]!==d||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==d||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:v,id:w}=b;return v?c.jsx("div",{children:Nm({html:v})},`${n.title}-${w}`):y?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(Ms,{children:c.jsx(je,{content:"Insert snippet",children:c.jsx(ke,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(y)},children:c.jsx(Sr,{className:"h-5 w-5"})})})}),c.jsx(O.Suspense,{children:c.jsx(Qa,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:JM,value:y,readOnly:!0},`${n.title}-${w}`)})]},`${n.title}-${w}`):null},e[17]=d,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=d,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(x=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=x):x=e[23],e[24]!==u||e[25]!==x?(g=c.jsxs(c.Fragment,{children:[u,x]}),e[24]=u,e[25]=x,e[26]=g):g=e[26],g},e7=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let a;e[3]!==o?(a=i=>c.jsx(Gn,{className:"rounded-none",onSelect:()=>o(i),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.jsx("span",{className:"mt-1 text-accent-foreground",children:i.title})})},i.title),e[3]=o,e[4]=a):a=e[4],r=n.map(a),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=c.jsx(pm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function t7(){return CR()}const n7=G.lazy(()=>gm(()=>import("./tracing-Df4x4g0x.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),o7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(G.Suspense,{fallback:c.jsx(r7,{}),children:c.jsx(n7,{})}),t[0]=e):e=t[0],e},r7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(xn,{})}),t[0]=e):e=t[0],e},Kw="name",Xw="type-value",Tf="defs-refs",s7=[{id:Kw,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Mm,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Uh,{name:e,declaredBy:n})}},{id:Xw,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Mm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Tf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(Mm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const a=Ia(s);a&&jm(a,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(Sp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(jo,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,a)=>c.jsxs("span",{className:"flex",children:[c.jsx(jo,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),a<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(ci,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(y2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],Jw=O.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=G.useState([]),[s,a]=G.useState(""),i=ER(),l=O.useMemo(()=>{const h=f=>{const m=i[f];return MR(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,i,e]),d=O.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:x}){m||(m={id:Tf,desc:!1});let g=[];switch(m.id){case Kw:g=oi(f,p=>p.name);break;case Xw:g=oi(f,p=>p.dataType);break;case Tf:g=oi(f,p=>x.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=_R({data:d,columns:s7,getCoreRowModel:AR(),onGlobalFilterChange:a,getFilteredRowModel:TR(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:IR(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(tS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>a(h.target.value)}),c.jsxs(Tm,{className:me("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(Im,{children:c.jsx(Ss,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx(vr,{className:"sticky top-0 bg-background border-b",children:sS(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(Am,{children:u.getRowModel().rows.map(h=>c.jsx(Ss,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(wr,{className:"border-b",children:sS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});Jw.displayName="VariableTable";const a7=()=>{const t=H.c(4),e=Cm(),n=Tc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(Ul,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(Jw,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o};function Af(t,e,n=new Set){if(n.has(t))return new Set;n.add(t);const o=new Set;for(const r of e(t)){o.add(r);for(const s of Af(r,e,n))o.add(s)}return o}const i7=yt(t=>{const e=t(Pn),n=t(cc);return function(o,r){var i,l,d;const s=new Map;for(const u of o)s.set(u,{variables:new Set,parents:new Set,children:new Set});for(const u of Object.values(r))if(u.dataType!=="module")for(const h of u.declaredBy){(i=s.get(h))==null||i.variables.add(u.name);for(const f of u.usedBy)h!==f&&((l=s.get(f))==null||l.parents.add(h),(d=s.get(h))==null||d.children.add(f))}const a={};for(const[u,h]of s.entries())a[u]={parents:h.parents,children:h.children,variables:[...h.variables],ancestors:Af(u,f=>{var m;return((m=s.get(f))==null?void 0:m.parents)??new Set}),descendants:Af(u,f=>{var m;return((m=s.get(f))==null?void 0:m.children)??new Set})};return a}(e.cellIds.inOrderIds,n)});function l7(t,e){return t.usedBy.includes(e.selectedCellId)||t.declaredBy.includes(e.selectedCellId)?!0:t.declaredBy.some(n=>e.selectedGraph.parents.has(n))?t.usedBy.some(n=>e.selectedGraph.parents.has(n)):!!t.declaredBy.some(n=>e.selectedGraph.children.has(n))}const c7=t=>{const e=H.c(39),{cellId:n,cellPositions:o}=t,r=ps(),s=Ie(OR).focusedCellId,a=Ie(i7),i=it(),l=b3(),d=r.cellData[n],u=r.cellRuntime[n],h=a[n],f=s?a[s]:void 0,m=s===n;let x;e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==m?(x=()=>{m?l.blurCell():(i.focusCell({cellId:n,where:"exact"}),l.focusCell({cellId:n}))},e[0]=i,e[1]=n,e[2]=l,e[3]=m,e[4]=x):x=e[4];const g=x,p=m?"text-primary-foreground":"text-[var(--gray-8)] hover:text-[var(--gray-9)]";let b;e[5]!==p?(b=me("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",p),e[5]=p,e[6]=b):b=e[6];const y=m&&"bg-primary group-hover:bg-primary";let v,w,S,N;e[7]!==y?(v=me("group-hover:bg-[var(--gray-2)] flex h-full w-full px-0.5 items-center rounded",y),e[7]=y,e[8]=v):v=e[8],e[9]!==d.code||e[10]!==n||e[11]!==h.variables||e[12]!==s||e[13]!==f?(w=h.variables.length>0?c.jsx(f7,{cellId:n,variableNames:h.variables,selectedCellId:s,selectedGraph:f}):c.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:h7(d.code)??c.jsx("span",{className:"italic",children:"empty"})}),e[9]=d.code,e[10]=n,e[11]=h.variables,e[12]=s,e[13]=f,e[14]=w):w=e[14],e[15]!==d.code||e[16]!==w?(S=c.jsx("div",{className:"truncate px-1 font-mono text-sm flex gap-1",title:d.code,children:w}),e[15]=d.code,e[16]=w,e[17]=S):S=e[17],e[18]!==v||e[19]!==S?(N=c.jsx("div",{className:v,children:S}),e[18]=v,e[19]=S,e[20]=N):N=e[20];const j=m?"z-30":"z-20",C=u.errored?"text-destructive":s===null?"text-foreground":m||f!=null&&f.parents.has(n)||f!=null&&f.children.has(n)?"text-primary":"text-[var(--gray-8)]";let _,T,I,P;return e[21]!==j||e[22]!==C?(_=me("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)_+_17px)] pointer-events-none",j,C),e[21]=j,e[22]=C,e[23]=_):_=e[23],e[24]!==n||e[25]!==o||e[26]!==h||e[27]!==m||e[28]!==f?(T=m?c.jsx(m7,{cellId:n,cellPositions:o,graph:h}):c.jsx(p7,{cellId:n,graph:h,selectedGraph:f}),e[24]=n,e[25]=o,e[26]=h,e[27]=m,e[28]=f,e[29]=T):T=e[29],e[30]!==_||e[31]!==T?(I=c.jsx("svg",{className:_,width:"1",height:"1",children:T}),e[30]=_,e[31]=T,e[32]=I):I=e[32],e[33]!==n||e[34]!==g||e[35]!==I||e[36]!==b||e[37]!==N?(P=c.jsxs("button",{"data-node-id":n,className:b,onClick:g,onMouseDown:g7,children:[N,I]}),e[33]=n,e[34]=g,e[35]=I,e[36]=b,e[37]=N,e[38]=P):P=e[38],P},d7=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=ps();let s;e[0]!==r.cellIds.inOrderIds?(s=Object.fromEntries(r.cellIds.inOrderIds.map(x7)),e[0]=r.cellIds.inOrderIds,e[1]=s):s=e[1];const a=s;let i;if(e[2]!==r.cellIds){i=[];let v=0;for(const[w,S]of r.cellIds.getColumns().entries())w>0&&i.push(v),v+=S.inOrderIds.length;e[2]=r.cellIds,e[3]=i}else i=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let d,u,h,f,m,x,g,p,b,y;if(e[4]!==l?(d=me("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=d):d=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=u):u=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(En,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[u,c.jsx(ke,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==a||e[13]!==i||e[14]!==r.cellIds.inOrderIds){let v;e[16]!==a||e[17]!==i?(v=(w,S)=>{const N=i.includes(S);return c.jsxs(O.Fragment,{children:[N&&c.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-[var(--gray-4)] pointer-events-none","aria-hidden":"true"}),c.jsx(c7,{cellId:w,cellPositions:a})]},w)},e[16]=a,e[17]=i,e[18]=v):v=e[18],x=r.cellIds.inOrderIds.map(v),e[12]=a,e[13]=i,e[14]=r.cellIds.inOrderIds,e[15]=x}else x=e[15];return e[19]!==x?(g=c.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:x}),e[19]=x,e[20]=g):g=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==g?(b=c.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[g,p]}),e[22]=g,e[23]=b):b=e[23],e[24]!==b||e[25]!==d||e[26]!==m?(y=c.jsxs("div",{className:d,children:[m,b]}),e[24]=b,e[25]=d,e[26]=m,e[27]=y):y=e[27],y},u7=()=>{const t=H.c(5),{setIsMinimapOpen:e,toggleMinimap:n}=gr(),{isMinimapOpen:o}=us();let r,s;return t[0]!==n?(r=()=>n(),t[0]=n,t[1]=r):r=t[1],Pt("global.toggleMinimap",r),t[2]!==o||t[3]!==e?(s=c.jsx(d7,{open:o,setOpen:e}),t[2]=o,t[3]=e,t[4]=s):s=t[4],s};function h7(t){return t.split(`
|
148
|
+
`)[0].trim()||void 0}const f7=t=>{const e=H.c(13),{variableNames:n,selectedGraph:o,cellId:r,selectedCellId:s}=t,a=Cm(),i=r===s;let l,d;if(e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n||e[4]!==a){let u;e[6]!==i||e[7]!==s||e[8]!==o||e[9]!==a?(u=(h,f)=>{const m=a[h];return c.jsxs(O.Fragment,{children:[f>0&&", ",c.jsx("span",{className:me({"text-foreground":o===void 0,"font-bold":i,"text-primary font-medium":!i&&o&&s&&l7(m,{selectedCellId:s,selectedGraph:o})}),children:h})]},h)},e[6]=i,e[7]=s,e[8]=o,e[9]=a,e[10]=u):u=e[10],l=n.map(u),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=a,e[5]=l}else l=e[5];return e[11]!==l?(d=c.jsx(c.Fragment,{children:l}),e[11]=l,e[12]=d):d=e[12],d},m7=t=>{const e=H.c(14),{cellId:n,cellPositions:o,graph:r}=t;let s,a,i,l,d;if(e[0]!==n||e[1]!==o||e[2]!==r.children||e[3]!==r.parents){s=[];const u=o[n]??0,h=new Set;for(const f of r.parents)r.children.has(f)&&h.add(f);for(const f of h){const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${x} h 14 v ${-x} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-cycle-${f}`))}}for(const f of r.parents){if(h.has(f))continue;const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${x} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-up-${f}`))}}for(const f of r.children){if(h.has(f))continue;const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M 3 0 H 7 v ${x} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-down-${f}`))}}e[0]=n,e[1]=o,e[2]=r.children,e[3]=r.parents,e[4]=s}else s=e[4];return e[5]!==r?(a=Zw(r),e[5]=r,e[6]=a):a=e[6],e[7]!==a?(i=c.jsx("circle",{r:a,fill:"currentColor",className:"pointer-events-auto"}),e[7]=a,e[8]=i):i=e[8],e[9]!==s?(l=c.jsx("g",{className:"pen pointer-events-auto",children:s}),e[9]=s,e[10]=l):l=e[10],e[11]!==i||e[12]!==l?(d=c.jsxs("g",{transform:"translate(0, 0)",children:[i,l]}),e[11]=i,e[12]=l,e[13]=d):d=e[13],d};function Zw(t){return function(e){return e.ancestors.size===0&&e.descendants.size===0}(t)?1.5:3}function p7(t){const{cellId:e,graph:n,selectedGraph:o}=t,r=Zw(n),s=n.ancestors.size>0,a=n.descendants.size>0;if(!o)return Qw({circleRadius:r,leftWisker:s,rightWisker:a});const i=o.ancestors.has(e),l=o.descendants.has(e);return Qw(i||l?{circleRadius:r,leftWisker:s,rightWisker:a,shift:i&&l?void 0:i?"left":"right"}:{circleRadius:r,leftWisker:!1,rightWisker:!1})}function Qw(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return c.jsxs("g",{transform:`translate(${s}, 0)`,children:[c.jsxs("g",{children:[n&&c.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&c.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),c.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function g7(t){return t.preventDefault()}function x7(t,e){return[t,e]}const b7=G.lazy(()=>gm(()=>import("./terminal-CWX5wZ40.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),y7=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=us(),{setIsSidebarOpen:a,setIsTerminalOpen:i}=gr(),l=G.useRef(null),d=G.useRef(null);let u,h,f,m,x;e[0]!==o?(u=()=>{if(!l.current)return;const Me=l.current.isCollapsed();o&&Me&&l.current.expand(),o||Me||l.current.collapse(),requestAnimationFrame(w7)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),O.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const Me=d.current.isCollapsed();r&&Me&&d.current.expand(),r||Me||d.current.collapse(),requestAnimationFrame(S7)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),O.useEffect(f,m),e[6]!==n?(x=c.jsx(Mc,{id:"app",className:"relative h-full",children:c.jsx(O.Suspense,{children:n})},"app"),e[6]=n,e[7]=x):x=e[7];const g=x,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=me("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=c.jsx(aS,{onDragging:iS,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,N;e[12]!==w?(S=me("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(N=c.jsx(aS,{onDragging:iS,className:S}),e[14]=S,e[15]=N):N=e[15];const j=N;let C,_,T,I,P,L,M,R,z,D,A,k,B,E,U,V,$,K,X,J,ee;e[16]!==s?(C=c.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=C):C=e[17],e[18]!==a?(_=()=>a(!1),e[18]=a,e[19]=_):_=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx(En,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==_?(I=c.jsx(ke,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:_,children:T}),e[21]=_,e[22]=I):I=e[22],e[23]!==C||e[24]!==I?(P=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[C,I]}),e[23]=C,e[24]=I,e[25]=P):P=e[25],e[26]!==s?(L=s==="files"&&c.jsx(Uw,{}),e[26]=s,e[27]=L):L=e[27],e[28]!==s?(M=s==="errors"&&c.jsx(rM,{}),e[28]=s,e[29]=M):M=e[29],e[30]!==s?(R=s==="variables"&&c.jsx(a7,{}),e[30]=s,e[31]=R):R=e[31],e[32]!==s?(z=s==="dependencies"&&c.jsx(VA,{}),e[32]=s,e[33]=z):z=e[33],e[34]!==s?(D=s==="packages"&&c.jsx(TM,{}),e[34]=s,e[35]=D):D=e[35],e[36]!==s?(A=s==="outline"&&c.jsx(IM,{}),e[36]=s,e[37]=A):A=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(nM,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&c.jsx(oM,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(E=s==="snippets"&&c.jsx(ZM,{}),e[42]=s,e[43]=E):E=e[43],e[44]!==s?(U=s==="scratchpad"&&c.jsx(UM,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&c.jsx(u8,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?($=s==="logs"&&c.jsx($w,{}),e[48]=s,e[49]=$):$=e[49],e[50]!==s?(K=s==="tracing"&&c.jsx(o7,{}),e[50]=s,e[51]=K):K=e[51],e[52]!==s?(X=s==="secrets"&&c.jsx($M,{}),e[52]=s,e[53]=X):X=e[53],e[54]!==L||e[55]!==M||e[56]!==R||e[57]!==z||e[58]!==D||e[59]!==A||e[60]!==k||e[61]!==B||e[62]!==E||e[63]!==U||e[64]!==V||e[65]!==$||e[66]!==K||e[67]!==X?(J=c.jsx(O.Suspense,{children:c.jsxs(_c,{children:[L,M,R,z,D,A,k,B,E,U,V,$,K,X]})}),e[54]=L,e[55]=M,e[56]=R,e[57]=z,e[58]=D,e[59]=A,e[60]=k,e[61]=B,e[62]=E,e[63]=U,e[64]=V,e[65]=$,e[66]=K,e[67]=X,e[68]=J):J=e[68],e[69]!==P||e[70]!==J?(ee=c.jsx(ic,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[P,J]})}),e[69]=P,e[70]=J,e[71]=ee):ee=e[71];const q=ee,Y=o&&"border-r border-l border-[var(--slate-7)]";let oe,se,re,ae,te,be;e[72]!==Y?(oe=me("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Y),e[72]=Y,e[73]=oe):oe=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(se=(Me,Re)=>{var He;Re===0&&Me===10&&((He=l.current)==null||He.resize(30))},e[74]=se):se=e[74],e[75]!==a?(re=()=>a(!1),ae=()=>a(!0),e[75]=a,e[76]=re,e[77]=ae):(re=e[76],ae=e[77]),e[78]!==q||e[79]!==v?(te=c.jsxs("span",{className:"flex flex-row h-full",children:[q," ",v]}),e[78]=q,e[79]=v,e[80]=te):te=e[80],e[81]!==oe||e[82]!==re||e[83]!==ae||e[84]!==te?(be=c.jsx(Mc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:se,onCollapse:re,onExpand:ae,children:te},"helper"),e[81]=oe,e[82]=re,e[83]=ae,e[84]=te,e[85]=be):be=e[85];const ye=be,ie=r&&"border-[var(--slate-7)]";let ve,he,Se,De,_e,Fe,Oe,Qe,qe;e[86]!==ie?(ve=me("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ie),e[86]=ie,e[87]=ve):ve=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(he=(Me,Re)=>{var He;Re===0&&Me===10&&((He=d.current)==null||He.resize(30))},e[88]=he):he=e[88],e[89]!==i?(Se=()=>i(!1),De=()=>i(!0),e[89]=i,e[90]=Se,e[91]=De):(Se=e[90],De=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=c.jsx("div",{}),e[92]=_e):_e=e[92],e[93]!==i?(Fe=()=>i(!1),e[93]=i,e[94]=Fe):Fe=e[94],e[95]!==r||e[96]!==Fe?(Oe=c.jsx(O.Suspense,{fallback:_e,children:c.jsx(b7,{visible:r,onClose:Fe})}),e[95]=r,e[96]=Fe,e[97]=Oe):Oe=e[97],e[98]!==r||e[99]!==Oe?(Qe=c.jsx(HA,{isOpen:r,children:Oe}),e[98]=r,e[99]=Oe,e[100]=Qe):Qe=e[100],e[101]!==ve||e[102]!==Se||e[103]!==De||e[104]!==Qe||e[105]!==j?(qe=c.jsxs(Mc,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:ve,minSize:10,defaultSize:0,maxSize:75,onResize:he,onCollapse:Se,onExpand:De,children:[j,Qe]},"terminal"),e[101]=ve,e[102]=Se,e[103]=De,e[104]=Qe,e[105]=j,e[106]=qe):qe=e[106];const Ke=qe;let Q,xe,we,Te,W,ne,ue,de,ge;return e[107]===Symbol.for("react.memo_cache_sentinel")?(Q=NL(),e[107]=Q):Q=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(xe=c.jsx(_c,{children:c.jsx(G_,{})}),e[108]=xe):xe=e[108],e[109]!==Ke?(we=c.jsx(ub,{capability:"terminal",children:Ke}),e[109]=Ke,e[110]=we):we=e[110],e[111]!==g||e[112]!==we?(Te=c.jsx(Mc,{children:c.jsxs(lS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,we]})}),e[111]=g,e[112]=we,e[113]=Te):Te=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(W=c.jsx(DR,{}),e[114]=W):W=e[114],e[115]!==ye||e[116]!==Te?(ne=c.jsxs(lS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:Q,children:[xe,ye,Te,W]}),e[115]=ye,e[116]=Te,e[117]=ne):ne=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(ue=c.jsx(u7,{}),e[118]=ue):ue=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(de=c.jsx(ic,{children:c.jsx(_c,{children:c.jsx($_,{})})}),e[119]=de):de=e[119],e[120]!==ne?(ge=c.jsxs(jL,{children:[ne,ue,de]}),e[120]=ne,e[121]=ge):ge=e[121],ge};function v7(){window.dispatchEvent(new Event("resize"))}function w7(){requestAnimationFrame(v7)}function k7(){window.dispatchEvent(new Event("resize"))}function S7(){requestAnimationFrame(k7)}let ek;ek=new URL(window.location.href).searchParams.get(PR.showChrome)==="false",AS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(ek){let s,a,i;return e[0]!==t?(s=c.jsx(db,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Lp,{}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs(c.Fragment,{children:[s,a]}),e[3]=s,e[4]=i):i=e[4],i}let n,o,r;return e[5]!==t?(n=c.jsx(db,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(Lp,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(y7,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Um as C,Oc as E,an as P,OL as __tla,Dc as a,AS as e,Cs as f};
|