@marimo-team/frontend 0.13.16-dev69 → 0.13.16-dev71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-DRBR54Od.js → ConnectedDataExplorerComponent-D8RQTrpn.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-DSOodUYh.js → ImageComparisonComponent-CxFa5LsQ.js} +1 -1
  3. package/dist/assets/{VegaLite-Bwm5rsCl.js → VegaLite-PHs-Gv1A.js} +1 -1
  4. package/dist/assets/{_baseEach-DMClerTq.js → _baseEach-CNBeOBZe.js} +1 -1
  5. package/dist/assets/_baseMap-qeSIUZ20.js +1 -0
  6. package/dist/assets/{_baseUniq-D3VxhdrA.js → _baseUniq-BxmcaIcH.js} +1 -1
  7. package/dist/assets/{_createAggregator-Chjh3Q_B.js → _createAggregator-BmNkJdfQ.js} +1 -1
  8. package/dist/assets/{any-language-editor-B5YpYwHL.js → any-language-editor-BU_t36So.js} +1 -1
  9. package/dist/assets/{architectureDiagram-IEHRJDOE-DUO1IVyn.js → architectureDiagram-IEHRJDOE-XQFIHtsL.js} +1 -1
  10. package/dist/assets/{blockDiagram-JOT3LUYC-BDha9Wes.js → blockDiagram-JOT3LUYC-CNIPMBCL.js} +1 -1
  11. package/dist/assets/{c4Diagram-VJAJSXHY-CzzillVi.js → c4Diagram-VJAJSXHY-DpMc3IpU.js} +1 -1
  12. package/dist/assets/channel-CpnTxmGH.js +1 -0
  13. package/dist/assets/{chunk-4BMEZGHF-Bd4h9Ve1.js → chunk-4BMEZGHF-B3kbPhwx.js} +1 -1
  14. package/dist/assets/{chunk-A2AXSNBT-C9dYNlCp.js → chunk-A2AXSNBT-BOln6tG-.js} +1 -1
  15. package/dist/assets/{chunk-AEK57VVT-ex6RRDX-.js → chunk-AEK57VVT-CNC12keq.js} +1 -1
  16. package/dist/assets/{chunk-D6G4REZN-BZj0iHgv.js → chunk-D6G4REZN-D5tUE8Th.js} +1 -1
  17. package/dist/assets/{chunk-RZ5BOZE2-Nztj68nn.js → chunk-RZ5BOZE2-DveA7MVg.js} +1 -1
  18. package/dist/assets/{chunk-XZIHB7SX-DmtX4Foe.js → chunk-XZIHB7SX-D5RXRDaZ.js} +1 -1
  19. package/dist/assets/{circle-play-p8Sj7AdH.js → circle-play-Bc8gNlLC.js} +1 -1
  20. package/dist/assets/classDiagram-GIVACNV2-DgwjdiNR.js +1 -0
  21. package/dist/assets/classDiagram-v2-COTLJTTW-DgwjdiNR.js +1 -0
  22. package/dist/assets/clone-r69bI5mO.js +1 -0
  23. package/dist/assets/{compile-Cy--pw_w.js → compile-Chk_s6zN.js} +1 -1
  24. package/dist/assets/{dagre-OKDRZEBW-C5g3Ibk1.js → dagre-OKDRZEBW-AiTg4qFP.js} +1 -1
  25. package/dist/assets/{data-editor-CqJ6Gyd8.js → data-editor-CQUJkANY.js} +1 -1
  26. package/dist/assets/{diagram-SSKATNLV-BUhH-mdF.js → diagram-SSKATNLV-u2FaEI9d.js} +1 -1
  27. package/dist/assets/{diagram-VNBRO52H-D_3Wxl4t.js → diagram-VNBRO52H-09zXb3dE.js} +1 -1
  28. package/dist/assets/{edit-page-IF5Nbx5y.js → edit-page-pzIyQWH-.js} +4 -4
  29. package/dist/assets/{erDiagram-Q7BY3M3F-BTIsVAg4.js → erDiagram-Q7BY3M3F-7qrni5Hq.js} +1 -1
  30. package/dist/assets/{flowDiagram-4HSFHLVR-BzxvBNyx.js → flowDiagram-4HSFHLVR-DTKBnJwQ.js} +1 -1
  31. package/dist/assets/{ganttDiagram-APWFNJXF-C1oSDNmR.js → ganttDiagram-APWFNJXF-Dba2AHq6.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-7IBYFJ6S-vn7ob0pJ.js → gitGraphDiagram-7IBYFJ6S-DLxXE7L4.js} +1 -1
  33. package/dist/assets/{graph-uTLBHozV.js → graph-ZyjWFD2E.js} +1 -1
  34. package/dist/assets/{home-page-WDzb-8-d.js → home-page-DSThru-l.js} +1 -1
  35. package/dist/assets/{index-CgF_B7vt.js → index-BGj9kRhO.js} +1 -1
  36. package/dist/assets/{index-DjRR0PIf.js → index-BL10oHuq.js} +1 -1
  37. package/dist/assets/{index-YXkxUEQg.js → index-BOwes9SE.js} +1 -1
  38. package/dist/assets/{index-BAf07p45.js → index-BpTYgEst.js} +1 -1
  39. package/dist/assets/{index-D1SXFm6O.js → index-C597UBxr.js} +1 -1
  40. package/dist/assets/{index-D4lX6WOv.js → index-C6UZaMLH.js} +1 -1
  41. package/dist/assets/{index-CNf099oP.js → index-C7Am6NF_.js} +14 -14
  42. package/dist/assets/{index-CDZpqLcS.js → index-CNJFmRV_.js} +1 -1
  43. package/dist/assets/{index-DAwRoOnr.js → index-CUW5KY1C.js} +1 -1
  44. package/dist/assets/{index-CAMg0OHB.js → index-D14C-RIP.js} +1 -1
  45. package/dist/assets/{index-DXk_ND4z.js → index-D4FRL2Kc.js} +1 -1
  46. package/dist/assets/{index-BEVBc6Xg.js → index-DOkXecw9.js} +1 -1
  47. package/dist/assets/{index-BQG1kyOa.js → index-DQ8jP575.js} +1 -1
  48. package/dist/assets/{index-COVmIxVW.js → index-DeeHZj9y.js} +1 -1
  49. package/dist/assets/{index-DR7SMDML.js → index-DiwLYcDj.js} +1 -1
  50. package/dist/assets/{index-QCjeiAOJ.js → index-DuXK_mu2.js} +1 -1
  51. package/dist/assets/{index-Bto6WZu4.js → index-LLUT0J2x.js} +1 -1
  52. package/dist/assets/{index-C5z9w9IC.js → index-SF4WuqCm.js} +1 -1
  53. package/dist/assets/{index-D2pgOx78.js → index-zsoXXYZW.js} +1 -1
  54. package/dist/assets/infoDiagram-PH2N3AL5-uvZJ4SjC.js +2 -0
  55. package/dist/assets/{journeyDiagram-U35MCT3I-DsM9d_To.js → journeyDiagram-U35MCT3I-D44xn8Ln.js} +1 -1
  56. package/dist/assets/{kanban-definition-NDS4AKOZ-odt1CP6v.js → kanban-definition-NDS4AKOZ-CSfDORoM.js} +1 -1
  57. package/dist/assets/{layout-D8ZgQVhR.js → layout-D0BC5sDj.js} +1 -1
  58. package/dist/assets/{linear-C3K_catQ.js → linear-wQMrSuqQ.js} +1 -1
  59. package/dist/assets/{mermaid-C_X-At-F.js → mermaid-BbUCJt1U.js} +4 -4
  60. package/dist/assets/{min-CH5ifDe0.js → min-CsKU4lv8.js} +1 -1
  61. package/dist/assets/{mindmap-definition-ALO5MXBD-BgX3xjF9.js → mindmap-definition-ALO5MXBD-D9fdlNN3.js} +1 -1
  62. package/dist/assets/panels-BweGhipq.js +27 -0
  63. package/dist/assets/{pieDiagram-IB7DONF6-DfWM7U-d.js → pieDiagram-IB7DONF6-ykDnMBVl.js} +1 -1
  64. package/dist/assets/{quadrantDiagram-7GDLP6J5-y2t2FYO7.js → quadrantDiagram-7GDLP6J5-v-ZzvqWk.js} +1 -1
  65. package/dist/assets/{radar-MK3ICKWK-DJQCLSI4.js → radar-MK3ICKWK-DS6DuKLQ.js} +1 -1
  66. package/dist/assets/{react-plotly-V2SyWtzI.js → react-plotly-CNYgjzlG.js} +1 -1
  67. package/dist/assets/{requirementDiagram-KVF5MWMF-Bm99LLLS.js → requirementDiagram-KVF5MWMF-TORAlmVh.js} +1 -1
  68. package/dist/assets/{run-page-CU9QDjtU.js → run-page-Gv54ztey.js} +1 -1
  69. package/dist/assets/{sankeyDiagram-QLVOVGJD-IXoqsOAr.js → sankeyDiagram-QLVOVGJD-DuPJc8Jc.js} +1 -1
  70. package/dist/assets/{sequenceDiagram-X6HHIX6F-Dyv8Vefc.js → sequenceDiagram-X6HHIX6F-Djo8NNAG.js} +1 -1
  71. package/dist/assets/{slides-component-Bva6SRT1.js → slides-component-DAngFCwQ.js} +1 -1
  72. package/dist/assets/{sortBy-DPKLLWQt.js → sortBy-CdjNsKA2.js} +1 -1
  73. package/dist/assets/{stateDiagram-DGXRK772-DWnDtoyM.js → stateDiagram-DGXRK772-Cggd4NOG.js} +1 -1
  74. package/dist/assets/stateDiagram-v2-YXO3MK2T-DulbMx0C.js +1 -0
  75. package/dist/assets/{terminal-DDRrFKFT.js → terminal-COx5J6qv.js} +1 -1
  76. package/dist/assets/{time-SdDHpgFE.js → time-BUp7Z0RV.js} +1 -1
  77. package/dist/assets/{timeline-definition-BDJGKUSR-Cpcz0qZ7.js → timeline-definition-BDJGKUSR-CRhEJ-Dc.js} +1 -1
  78. package/dist/assets/{tracing-fC96q6kX.js → tracing-hdybZ30c.js} +2 -2
  79. package/dist/assets/{tree-agTB8sa3.js → tree-DiqnZEyo.js} +1 -1
  80. package/dist/assets/{vega-component-D7Uk-3Bo.js → vega-component-BkBIV5fb.js} +1 -1
  81. package/dist/assets/{xychartDiagram-VJFVF3MP-CQT-fJDG.js → xychartDiagram-VJFVF3MP-DB2lf6ZA.js} +1 -1
  82. package/dist/index.html +1 -1
  83. package/package.json +1 -1
  84. package/dist/assets/_baseMap-CD9hnB3A.js +0 -1
  85. package/dist/assets/channel-D-Qw4Rvo.js +0 -1
  86. package/dist/assets/classDiagram-GIVACNV2-BLhpZLAI.js +0 -1
  87. package/dist/assets/classDiagram-v2-COTLJTTW-BLhpZLAI.js +0 -1
  88. package/dist/assets/clone-CjChZECf.js +0 -1
  89. package/dist/assets/infoDiagram-PH2N3AL5-Bj0Zs9-M.js +0 -2
  90. package/dist/assets/panels-CZwW1Bfb.js +0 -27
  91. package/dist/assets/stateDiagram-v2-YXO3MK2T-CSEDwWkR.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-fC96q6kX.js","./index-CNf099oP.js","./index-4v1-JkQF.css","./compile-Cy--pw_w.js","./time-SdDHpgFE.js","./timer-DFzT7np-.js","./linear-C3K_catQ.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-Cuwikxov.js","./step-BwsUM5iJ.js","./panels-CZwW1Bfb.js","./index-CDZpqLcS.js","./index-C5z9w9IC.js","./index-YXkxUEQg.js","./index-D2pgOx78.js","./index-BAf07p45.js","./index-DR7SMDML.js","./index-DAwRoOnr.js","./index-BQG1kyOa.js","./index-COVmIxVW.js","./index-D4lX6WOv.js","./index-CgF_B7vt.js","./index-DjRR0PIf.js","./index-Bto6WZu4.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-CHJ5qNM_.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-D7xaZ7Da.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-Dri_5nFc.js","./fortran-DL7KluxX.js","./gas-5kEe4nk0.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CmdsSjFB.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-FFvkTduk.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-OdhglgkO.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-BQXy8elZ.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./panels-DcAzAz16.css","./tree-agTB8sa3.js","./index-D1SXFm6O.js","./tree-C1rhMrxo.css","./circle-play-p8Sj7AdH.js","./_createAggregator-Chjh3Q_B.js","./_baseEach-DMClerTq.js","./transform-Cyp0GDF-.js","./sortBy-DPKLLWQt.js","./_baseMap-CD9hnB3A.js","./terminal-DDRrFKFT.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var CF=Object.defineProperty;var y3=zt=>{throw TypeError(zt)};var NF=(zt,It,pn)=>It in zt?CF(zt,It,{enumerable:!0,configurable:!0,writable:!0,value:pn}):zt[It]=pn;var ee=(zt,It,pn)=>NF(zt,typeof It!="symbol"?It+"":It,pn),jF=(zt,It,pn)=>It.has(zt)||y3("Cannot "+pn);var x3=(zt,It,pn)=>(jF(zt,It,"read from private field"),pn?pn.call(zt):It.get(zt)),w3=(zt,It,pn)=>It.has(zt)?y3("Cannot add the same private member more than once"):It instanceof WeakSet?It.add(zt):It.set(zt,pn);import{u as Fe,Q as A,i9 as EF,ia as IF,ib as v3,ic as AF,id as TF,ie as MF,R as K,ig as OF,ih as Or,ii as DF,ij as Zf,ik as k3,il as RF,im as PF,io as S3,ip as rc,c as X,as as Un,iq as Qf,j as h,du as em,dv as C3,dw as LF,dy as tm,dA as nm,f8 as sc,ir as om,ds as rm,dt as sm,dx as im,is as FF,it as N3,ei as j3,bp as et,a8 as Ft,iu as zF,dW as fo,iv as E3,iw as I3,ix as am,iy as A3,iz as BF,L as Zt,_ as Qt,aF as T3,cE as lm,W as Pe,iA as UF,ej as dt,iB as M3,en as ic,iC as VF,ao as lt,iD as ac,Z as We,a_ as Vn,a0 as en,iE as lc,iF as Ms,e6 as Os,iG as $F,iH as Zi,iI as HF,eg as WF,iJ as O3,iK as D3,dO as qF,a7 as cm,iL as lr,iM as Dr,aJ as cc,aL as cr,iN as GF,iO as dc,iP as R3,a5 as Qi,eF as P3,a6 as uc,iQ as YF,an as yn,iR as dm,iS as Rr,aj as dr,ak as Ds,al as ur,bg as Pr,U as Fo,e7 as Rs,gn as L3,fP as Ps,gq as JF,b2 as fn,iT as KF,iU as XF,fN as um,aI as hc,iV as hm,iW as ZF,iX as F3,iY as fm,iZ as QF,i_ as ez,i$ as mo,j0 as z3,fT as mm,j1 as ea,j2 as fc,e1 as tz,ae as Zn,am as Ls,be as hr,j3 as ta,bt as $n,ap as Fs,a4 as Le,f5 as po,b7 as B3,eq as xt,j4 as nz,eS as oz,dB as mc,j5 as pc,aN as pm,j6 as rz,ep as gm,ed as zs,j7 as sz,j8 as _m,bj as jn,j9 as iz,dU as Ae,ja as Je,jb as bm,jc as Ct,jd as U3,je as az,fu as ym,aE as En,aT as Hn,ga as V3,gb as $3,gc as lz,gg as cz,gd as H3,V as Oe,dN as dz,aG as gc,aR as _c,aH as bc,aO as sn,eh as zo,jf as uz,ge as W3,jg as hz,g5 as q3,g7 as G3,jh as Bs,ji as Y3,jj as fz,jk as mz,ai as pz,ah as gz,ec as na,af as xm,jl as oa,jm as yc,jn as _z,jo as bz,jp as J3,jq as mn,fS as K3,dP as xc,ba as yz,jr as xz,ar as wm,aK as wz,js as vz,gr as X3,b6 as wc,jt as vm,aq as ra,e2 as Z3,ju as kz,ag as Sz,jv as Q3,jw as Cz,jx as Nz,jy as jz,jz as Ez,jA as Iz,jB as Az,dq as Bo,jC as vc,jD as Us,o as Uo,n as st,fx as Qn,jE as In,jF as ut,jG as Vs,jH as Vt,fO as Gt,jI as km,dT as go,jJ as Tz,jK as Mz,b4 as e4,b5 as t4,jL as n4,jM as Oz,gu as $s,jN as kc,b1 as Sc,gt as Lr,jO as o4,jP as sa,ek as Sm,jQ as Dz,jR as Rz,jS as Pz,jT as Lz,jU as r4,jV as Fz,jW as s4,jX as i4,jY as zz,jZ as a4,j_ as l4,el as Cc,j$ as Bz,bq as Uz,k0 as Vz,fw as Wn,k1 as $z,k2 as Hz,k3 as Hs,k4 as Nc,k5 as Ws,fH as Vo,k6 as Cm,k7 as ia,k8 as aa,k9 as la,ka as Wz,fn as jc,kb as Nm,kc as c4,kd as Ec,eR as qz,fo as Gz,r as Yz,ke as Jz,kf as Kz,kg as d4,t as D,kh as Xz,ki as Zz,kj as jm,f_ as ca,kk as u4,fA as Qz,fs as h4,co as f4,kl as m4,km as eB,kn as tB,ko as nB,kp as oB,kq as rB,kr as sB,ks as iB,kt as aB,ku as lB,kv as cB,kw as dB,kx as uB,ky as hB,kz as fB,kA as mB,kB as pB,kC as gB,kD as _B,kE as bB,kF as yB,kG as da,kH as xB,kI as wB,kJ as vB,kK as kB,kL as SB,kM as CB,kN as p4,kO as NB,kP as jB,kQ as EB,kR as g4,kS as IB,kT as AB,kU as _4,kV as TB,kW as qs,kX as qn,kY as MB,kZ as OB,k_ as DB,k$ as RB,l0 as PB,l1 as LB,l2 as FB,l3 as zB,l4 as BB,l5 as UB,l6 as fr,l7 as VB,l8 as $B,l9 as HB,la as WB,er as qB,lb as GB,lc as b4,ev as YB,ld as Ic,le as JB,lf as KB,lg as XB,lh as ZB,X as Fr,li as Ac,eu as QB,lj as Em,lk as Tc,ll as ua,lm as ha,ln as Mc,lo as mr,lp as y4,lq as $o,lr as Gs,ls as Im,lt as fa,lu as Ys,lv as Am,lw as Tm,lx as x4,ly as Oc,lz as eU,S as ma,lA as pa,lB as tU,eQ as Dc,lC as nU,lD as Mm,lE as oU,lF as rU,lG as Rc,lH as sU,lI as iU,lJ as w4,lK as Om,gs as Js,lL as aU,lM as lU,lN as cU,lO as dU,fF as uU,bd as hU,gv as Et,lP as ga,lQ as Ks,lR as fU,lS as mU,lT as Dm,lU as pU,cn as Rm,lV as gU,b3 as v4,lW as _U,lX as bU,lY as Pc,lZ as k4,eK as Pm,bf as S4,$ as Lm,l_ as C4,l$ as yU,m0 as xU,m1 as Fm,m2 as zm,m3 as wU,m4 as N4,m5 as j4,m6 as _a,fr as vU,ab as E4,e4 as kU,m7 as I4,m8 as SU,m9 as CU,ma as A4,mb as NU,mc as jU,md as T4,me as M4,mf as EU,bh as O4,mg as IU,mh as Bm,eb as AU,mi as Ho,dL as D4,mj as R4,ef as P4,fh as Um,mk as Vm,ml as L4,bv as $m,dM as Lc,mm as F4,mn as TU,mo as MU,mp as OU,bc as Fc,mq as z4,fa as Hm,g6 as DU,g8 as RU,gf as Wm,gi as PU,mr as LU,ms as qm,mt as FU,mu as zU,mv as BU,mw as UU,mx as VU,my as $U,mz as HU,mA as WU,a9 as qU,mB as zc,aa as GU,mC as B4,mD as YU,f6 as JU,mE as U4,a$ as eo,fl as KU,dD as XU,mF as ZU,mG as V4,mH as QU,eP as eV,mI as tV,mJ as nV,e5 as oV,mK as rV,mL as sV,a2 as Bc,mM as iV,a3 as pr,dG as $4,mN as Gm,mO as aV,eo as H4,mP as lV,mQ as W4,mR as cV,mS as dV,mT as uV,mU as hV,mV as fV,mW as mV,mX as q4,g1 as Ym,f$ as Jm,fW as Xs,g0 as zr,mY as G4,g2 as Km,fX as Br,dX as pV,mZ as Xm,m_ as gV,a1 as _V,m$ as bV,fG as Y4,E as Zs,n0 as yV,n1 as xV,n2 as wV,n3 as vV,n4 as ba,n5 as kV,n6 as SV,n7 as CV,n8 as NV,n9 as jV,na as J4,nb as EV,fv as IV,nc as AV,nd as TV,ne as MV,nf as OV,gh as DV,ng as RV,nh as K4,ni as PV,nj as LV,nk as X4,nl as Z4,nm as Q4,f4 as eS,nn as FV,no as zV,np as tS,nq as nS,nr as Uc,ns as oS,nt as BV,nu as rS,nv as UV,nw as VV,nx as sS,ny as $V,nz as HV,nA as WV,C as iS,nB as qV,nC as GV,nD as YV,nE as gr,nF as aS,dV as JV,fY as KV,nG as lS,fZ as cS,nH as XV,nI as Qs,nJ as ZV,nK as Vc,nL as QV,nM as e$,y as dS,nN as t$,dj as n$,nO as o$,nP as r$,nQ as s$,nR as i$,nS as a$,eX as l$,b0 as c$,aZ as d$,at as $c,nT as uS,nU as hS,av as fS,au as u$,e9 as h$,__tla as f$}from"./index-CNf099oP.js";import{G as m$,L as mS,g as p$,b as ya,A as g$,s as _$,k as b$,B as pS,a as y$,M as x$,Y as w$,c as xn,u as xa,C as v$,S as k$,K as S$,d as C$,i as N$,e as gS,f as j$,h as E$,j as I$,l as wa,P as Zm,m as _S,n as A$,o as T$,p as Qm,T as M$}from"./tree-agTB8sa3.js";import{d as bS,e as yS,L as xS,f as ei,I as ep,g as O$,h as wS,N as vS,V as kS,S as SS,F as CS,i as NS,M as D$,l as jS,j as R$,E as ES,k as P$,m as tp,n as L$,o as F$,p as z$,q as B$,s as U$,t as V$,v as $$,w as H$,x as W$,a as q$,C as G$,R as IS,b as Y$,A as J$,y as K$,z as X$,O as Z$,T as Q$,B as eH,D as tH,c as nH,P as oH,__tla as rH}from"./panels-CZwW1Bfb.js";import{c as sH}from"./_createAggregator-Chjh3Q_B.js";import{s as to,i as _r,T as np,a as op}from"./transform-Cyp0GDF-.js";import{g as AS}from"./timer-DFzT7np-.js";import{i as iH}from"./zoom-COrs4lFh.js";import{s as va}from"./sortBy-DPKLLWQt.js";let rp,Hc,An,Wc,TS,ka,sp,aH=Promise.all([(()=>{try{return f$}catch{}})(),(()=>{try{return rH}catch{}})()]).then(async()=>{var tc,b3;var zt=sH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let It,pn,ip,qc,ti,ni,ap,lp,cp,dp,Sa,Gc,up,Ca,hp,Yc,fp,mp,Jc,pp,gp,_p,Na,bp,Kc,yp,xp,wp,vp,kp,Sp,Xc,Cp,Zc,Np,jp,Ep,Ip,Ap,ja,Tp,Mp,Qc,Op,Dp,Rp,ed,Pp,Lp,Fp,Ea,td,nd,zp,Bp,Up,Vp,$p,Hp,Wp,qp,Gp,od,rd,Yp,Jp,Kp,Ia,br,yr;It=Fe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),pn=Fe("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"}]]),ip=Fe("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"}]]),qc=Fe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ti=Fe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),ni=Fe("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"}]]),ap=Fe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),lp=Fe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Wc=Fe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),cp=Fe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),dp=Fe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Sa=Fe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Gc=Fe("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"}]]),up=Fe("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"}]]),Ca=Fe("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"}]]),hp=Fe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Yc=Fe("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"}]]),fp=Fe("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"}]]),mp=Fe("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"}]]),Jc=Fe("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"}]]),pp=Fe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),gp=Fe("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"}]]),_p=Fe("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"}]]),Na=Fe("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"}]]),bp=Fe("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"}]]),Kc=Fe("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"}]]),yp=Fe("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"}]]),xp=Fe("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"}]]),wp=Fe("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"}]]),vp=Fe("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"}]]),kp=Fe("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"}]]),Sp=Fe("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"}]]),Xc=Fe("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"}]]),Cp=Fe("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"}]]),Zc=Fe("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"}]]),Np=Fe("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"}]]),jp=Fe("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"}]]),Ep=Fe("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"}]]),Ip=Fe("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ap=Fe("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"}]]),ja=Fe("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"}]]),Tp=Fe("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"}]]),Mp=Fe("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"}]]),Qc=Fe("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"}]]),Op=Fe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Dp=Fe("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"}]]),Rp=Fe("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"}]]),ed=Fe("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"}]]),Pp=Fe("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"}]]),Lp=Fe("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"}]]),Fp=Fe("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"}]]),Ea=Fe("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"}]]),td=Fe("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"}]]),nd=Fe("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"}]]),zp=Fe("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"}]]),Bp=Fe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Up=Fe("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"}]]),Vp=Fe("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"}]]),$p=Fe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Hp=Fe("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"}]]),Wp=Fe("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"}]]),qp=Fe("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"}]]),Gp=Fe("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"}]]),od=Fe("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"}]]),rd=Fe("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"}]]),Yp=Fe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Jp=Fe("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"}]]),Kp=Fe("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"}]]),Ia=Fe("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"}]]),br=Fe("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"}]]),yr=Fe("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=A.createContext({}),OS=A.forwardRef(function(t,e){[t,e]=TF(t,e,MS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,u]=A.useState(!1);EF(()=>{var p;u(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=IF(),m=f==="rtl"&&c==="horizontal";let _=AF(i);const g=A.useRef(null);return{toolbarProps:{...v3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?_.focusFirst():_.focusLast())):void 0;m?_.focusNext():_.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:d?void 0:p=>{var b,x;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=MF({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=v3(t);return delete r.id,K.createElement("div",{...OF(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Aa(t,e){const n=+Or(t)-+Or(e);return n<0?-1:n>0?1:n}function DS(t,e){const n=Or(t,e==null?void 0:e.in);return+function(o,r){const s=Or(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Or(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function RS(t,e,n){const[o,r,s]=Zf(n==null?void 0:n.in,t,t,e),i=Aa(r,s),a=Math.abs(function(d,u,f){const[m,_]=Zf(f==null?void 0:f.in,d,u);return 12*(m.getFullYear()-_.getFullYear())+(m.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=Aa(r,s)===-i;DS(o)&&a===1&&Aa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function PS(t,e,n){const o=function(r,s){return+Or(r)-+Or(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=RF(),i=(r==null?void 0:r.locale)??s.locale??PF,a=Aa(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=Zf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),u=PS(d,c),f=(k3(d)-k3(c))/1e3,m=Math.round((u-f)/60);let _;if(m<2)return m===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<S3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<rc){const g=Math.round(m/S3);return i.formatDistance("xDays",g,l)}if(m<2*rc)return _=Math.round(m/rc),i.formatDistance("aboutXMonths",_,l);if(_=RS(d,c),_<12){const g=Math.round(m/rc);return i.formatDistance("xMonths",g,l)}{const g=_%12,p=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",p,l):g<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return DF(n,Date.now())}(t),e)}const FS=()=>{const t=X.c(7),{selectedLayout:e}=bS(),{setLayoutView:n}=yS();if(Un()&&!Qf("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(rm,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:h.jsx(sm,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(em,{children:h.jsxs(C3,{children:[h.jsx(LF,{children:"View as"}),xS.map(BS)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=h.jsxs(im,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function zS(t){const e=Xp(t);return h.jsx(e,{className:"h-4 w-4"})}function Xp(t){switch(t){case"vertical":return Np;case"grid":return m$;case"slides":return ed;default:return sc(t),om}}function Zp(t){return nm(t)}function BS(t){return h.jsx(tm,{value:t,children:h.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[zS(t),h.jsx("span",{children:Zp(t)})]})},t)}function US(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new FF(a),l[0]=a,l[1]=c):c=l[1];const d=c;let u;l[2]!==i||l[3]!==d?(u=()=>d.get(i),l[2]=i,l[3]=d,l[4]=u):u=l[4];const[f,m]=A.useState(u);let _;l[5]!==i||l[6]!==d?(_=b=>{m(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=_):_=l[7];const g=_;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Qp(t){return t.dropdown!==void 0}function Ta(t,e=""){return t.flatMap(n=>n.label?Qp(n)?Ta(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const oi=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=h.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=h.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d};function sd(t){const e=X.c(3),n=id();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],et(o)}function eg(){const t=X.c(2),e=id();let n;return t[0]!==e?(n=()=>e(E3(fo())),t[0]=e,t[1]=n):n=t[1],et(n)}function id(){const t=X.c(2),{prepareForRun:e}=Ft();let n;return t[0]!==e?(n=async o=>{var a;if(o.length===0)return;const{cellHandles:r,cellData:s}=fo(),i=[];for(const l of o){const c=r[l],d=(a=c.current)==null?void 0:a.editorView;let u;d?(I3(d)!=="markdown"&&am(d),u=A3(d)):u=s[l].code,i.push(u),e({cellId:l})}await BF({cellIds:o,codes:i}).catch(VS)},t[0]=e,t[1]=n):n=t[1],et(n)}function VS(t){Zt.error(t)}const Ma=Qt(null),$S=Qt(!1),ad=T3("marimo:ai:chatState:v2",{chats:[],activeChatId:null}),HS=Qt(t=>{const e=t(ad);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(ad,o=>({...o,activeChatId:n}))}),ld=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],lm(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(UF,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=h.jsxs(Pe,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function cd(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=Ft();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(dt.get(M3))return;const{cellId:s}=r,i=dt.get(ic),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),VF({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=lt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:h.jsx(ld,{"data-testid":"undo-delete-button",onClick:()=>{n(),d()}})}),d=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],et(o)}function tg(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=Ft();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=ac(r.cellId);if(!s)return;const i=A3(s);e(r);const{dismiss:a}=lt({title:"Cell split",action:h.jsx(ld,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],et(o)}function dd(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=Ft(),u=tg(),f=sd(n==null?void 0:n.cellId),m=!We(M3),_=cd(),{openModal:g}=Vn(),p=en(Ma),b=We(lc),x=We(Ms),y=We(Os),v=We($F);if(!n||y){let N;return e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],N}const{cellId:S,config:k,getEditorView:E,name:j,hasOutput:I,hasConsoleOutput:T,status:M}=n;let L;e[1]!==S||e[2]!==k.disabled||e[3]!==r?(L=async()=>{const N={disabled:!k.disabled};await Rr({configs:{[S]:N}}),r({cellId:S,config:N})},e[1]=S,e[2]=k.disabled,e[3]=r,e[4]=L):L=e[4];const B=L;let O;e[5]!==S||e[6]!==k.hide_code||e[7]!==E||e[8]!==r?(O=async()=>{const N={hide_code:!k.hide_code};await Rr({configs:{[S]:N}}),r({cellId:S,config:N});const H=E();H&&(N.hide_code?H.contentDOM.blur():H.focus())},e[5]=S,e[6]=k.hide_code,e[7]=E,e[8]=r,e[9]=O):O=e[9];const z=O;let F,V,P,C,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(Gp,{size:13,strokeWidth:1.5}),e[10]=F):F=e[10],e[11]!==S||e[12]!==j||e[13]!==g||e[14]!==s?(V=()=>{g(h.jsxs(dr,{children:[h.jsx(Ds,{children:h.jsx(ur,{children:"Rename cell"})}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Pr,{htmlFor:"cell-name",children:"Cell name"}),h.jsx(vS,{placeholder:"cell name",value:j,onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),N.stopPropagation(),g(null))},onChange:N=>s({cellId:S,name:N})})]})]}))},e[11]=S,e[12]=j,e[13]=g,e[14]=s,e[15]=V):V=e[15],e[16]!==S||e[17]!==s?(P=N=>s({cellId:S,name:N}),e[16]=S,e[17]=s,e[18]=P):P=e[18],e[19]!==j||e[20]!==P?(C=h.jsx(vS,{placeholder:"cell name",value:j,onChange:P}),e[19]=j,e[20]=P,e[21]=C):C=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==m||e[27]!==S||e[28]!==d||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==I||e[36]!==i||e[37]!==j||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==u||e[43]!==M||e[44]!==V||e[45]!==C||e[46]!==B||e[47]!==z?($=[[{icon:F,label:"Name",disableClick:!0,handle:YS,handleHeadless:V,rightElement:C},{icon:h.jsx(ei,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:h.jsx(Zi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(N=>(N==null?void 0:N.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:h.jsx(td,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>u({cellId:S})},{icon:h.jsx(ep,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(N){const H=document.getElementById(N3.create(N));H&&(H.classList.add("printing-output"),j3(H,"result.png").finally(()=>{H.classList.remove("printing-output")}))}(S)},{icon:h.jsx(WF,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const N=E();N&&HF({[S]:N})}},{icon:k.hide_code?h.jsx(O3,{size:13,strokeWidth:1.5}):h.jsx(D3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:z,hotkey:"cell.hideCode"},{icon:k.disabled?h.jsx(br,{size:13,strokeWidth:1.5}):h.jsx(yr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:h.jsx(qF,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:B}),handle:B},{icon:h.jsx(cm,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{d({cellId:S})}}],[{icon:h.jsx(cc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const N=E();N&&(lr(x,o),Dr(N,"markdown",{keepCodeAsIs:!1}))}},{icon:h.jsx(cr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const N=E();N&&(lr(x,o),Dr(N,"sql",{keepCodeAsIs:!1}))}},{icon:h.jsx(dc,{}),label:"Toggle as Python",handle:()=>{const N=E();N&&(lr(x,o),GF(N,"python",{force:!0}))}}],[{icon:h.jsxs(oi,{children:[h.jsx(Sa,{size:13,strokeWidth:1.5}),h.jsx(R3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:h.jsxs(oi,{children:[h.jsx(Sa,{size:13,strokeWidth:1.5}),h.jsx(Qi,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:h.jsx(R3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:S,before:!0})},{icon:h.jsx(Qi,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:S,before:!1})},{icon:h.jsx(P3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:S,direction:"left"}),hidden:v!=="columns"},{icon:h.jsx(uc,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:S,direction:"right"}),hidden:v!=="columns"},{icon:h.jsx(lp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:S})},{icon:h.jsx(ap,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S})},{icon:h.jsx(YF,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:S})}],[{icon:h.jsx(mS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!wS(j),tooltip:wS(j)?void 0:"Only named cells can be linked to",handle:async()=>{await yn(O$(j)),lt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:h.jsx(dm,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:S})}}]].map(qS).filter(WS),e[22]=c,e[23]=b,e[24]=v,e[25]=x,e[26]=m,e[27]=S,e[28]=d,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=I,e[36]=i,e[37]=j,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=u,e[43]=M,e[44]=V,e[45]=C,e[46]=B,e[47]=z,e[48]=$):$=e[48],$}function WS(t){return t.length>0}function qS(t){return t.filter(GS)}function GS(t){return!t.hidden}function YS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function JS(t){return!t.hidden}const ud=Qt(!1),ng=()=>{const t=X.c(37),[e,n]=fn(ud),o=KF(),r=We(XF),s=We(um);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=dd(i).flat();a=Ta(a);const l=function(){const P=X.c(45),{theme:C}=Fo(),[$,N]=Rs(),[H,Y]=L3();let Z;P[0]!==N?(Z=async ce=>{await Ps({config:ce}).then(()=>{N(ce)})},P[0]=N,P[1]=Z):Z=P[1];const q=Z;let re;P[2]!==Y?(re=async ce=>{await JF({config:ce}).then(()=>{Y(ce)})},P[2]=Y,P[3]=re):re=P[3];const ne=re;let oe;if(P[4]!==H||P[5]!==$||P[6]!==ne||P[7]!==q||P[8]!==C){let ce,me,de;P[10]!==H?(ce=Ke=>Ke!==H.width,P[10]=H,P[11]=ce):ce=P[11],P[12]!==H||P[13]!==ne?(me=Ke=>({label:`App config > Set width=${Ke}`,handle:()=>{ne({...H,width:Ke})}}),P[12]=H,P[13]=ne,P[14]=me):me=P[14],P[15]!==$||P[16]!==q||P[17]!==C?(de={label:"Config > Toggle dark mode",handle:()=>{q({...$,display:{...$.display,theme:C==="dark"?"light":"dark"}})}},P[15]=$,P[16]=q,P[17]=C,P[18]=de):de=P[18];const ge=$.keymap.preset==="vim";let ie,xe;P[19]!==$||P[20]!==q?(ie=()=>{q({...$,keymap:{...$.keymap,preset:"vim"}})},P[19]=$,P[20]=q,P[21]=ie):ie=P[21],P[22]!==ge||P[23]!==ie?(xe={label:"Config > Switch keymap to VIM",hidden:ge,handle:ie},P[22]=ge,P[23]=ie,P[24]=xe):xe=P[24];const we=$.keymap.preset==="default";let ae,Se,pe;P[25]!==$||P[26]!==q?(ae=()=>{q({...$,keymap:{...$.keymap,preset:"default"}})},P[25]=$,P[26]=q,P[27]=ae):ae=P[27],P[28]!==ae||P[29]!==we?(Se={label:"Config > Switch keymap to default (current: VIM)",hidden:we,handle:ae},P[28]=ae,P[29]=we,P[30]=Se):Se=P[30],P[31]!==$||P[32]!==q?(pe=()=>{q({...$,completion:{...$.completion,copilot:!1}})},P[31]=$,P[32]=q,P[33]=pe):pe=P[33];const Te=$.completion.copilot!=="github";let Re,He;P[34]!==pe||P[35]!==Te?(Re={label:"Config > Disable GitHub Copilot",handle:pe,hidden:Te},P[34]=pe,P[35]=Te,P[36]=Re):Re=P[36],P[37]!==$||P[38]!==q?(He=()=>{q({...$,completion:{...$.completion,copilot:"github"}})},P[37]=$,P[38]=q,P[39]=He):He=P[39];const ze=$.completion.copilot==="github";let Ne;P[40]!==He||P[41]!==ze?(Ne={label:"Config > Enable GitHub Copilot",handle:He,hidden:ze},P[40]=He,P[41]=ze,P[42]=Ne):Ne=P[42],oe=[...p$().filter(ce).map(me),de,xe,Se,Re,Ne],P[4]=H,P[5]=$,P[6]=ne,P[7]=q,P[8]=C,P[9]=oe}else oe=P[9];const G=oe;let Q;return P[43]!==G?(Q=G.filter(JS),P[43]=G,P[44]=Q):Q=P[44],Q}();let c=Tg();c=[...Ta(c),...Ta(l)];const d=c.filter(KS),u=hc.keyBy(d,XS),{recentCommands:f,addRecentCommand:m}=US();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let p,b;t[4]!==s||t[5]!==n?(p=P=>{ez(s.getHotkey("global.commandPalette").key)(P)&&(P.preventDefault(),n(ZS))},t[4]=s,t[5]=n,t[6]=p):p=t[6],lm(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(P,C)=>{const $=o[P];if(!$)return null;const N=s.getHotkey(P);return h.jsxs(mo,{disabled:C.disabled,onSelect:()=>{m(P),n(!1),requestAnimationFrame(()=>{$()})},value:N.name,children:[h.jsxs("span",{children:[N.name,C.tooltip&&h.jsx("span",{className:"ml-2",children:C.tooltip})]}),h.jsx(z3,{children:h.jsx(mm,{shortcut:N.key})})]},P)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==m||t[13]!==s||t[14]!==n?(y=(P,C,$,N)=>{const H=$===void 0?{}:$;return h.jsxs(mo,{disabled:H.disabled,onSelect:()=>{m(P),n(!1),requestAnimationFrame(()=>{C()})},value:P,children:[h.jsxs("span",{children:[P,H.tooltip&&h.jsxs("span",{className:"ml-2",children:["(",H.tooltip,")"]})]}),N&&h.jsx(z3,{children:h.jsx(mm,{shortcut:s.getHotkey(N).key})})]},P)},t[12]=m,t[13]=s,t[14]=n,t[15]=y):y=t[15];const v=y,S=QF;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(ea,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const E=fm;let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(fc,{children:"No results found."}),t[17]=j):j=t[17];const I=f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(hm,{heading:"Recently Used",children:f.map(P=>{const C=u[P];return ZF(P)?x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip}):C&&!Qp(C)?v(C.label,C.handleHeadless||C.handle,{disabled:C.disabled,tooltip:C.tooltip}):null})}),h.jsx(F3,{})]}),T=hm,M=s.iterate().map(P=>{if(g.has(P))return null;const C=u[P];return x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip})}),L=d.map(P=>g.has(P.label)?null:v(P.label,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}));let B;t[18]!==g||t[19]!==v?(B=P=>g.has(P.label)?null:v(`Cell > ${P.label}`,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}),t[18]=g,t[19]=v,t[20]=B):B=t[20];const O=a.map(B);let z,F,V;return t[21]!==T||t[22]!==L||t[23]!==O||t[24]!==M?(z=h.jsxs(T,{heading:"Commands",children:[M,L,O]}),t[21]=T,t[22]=L,t[23]=O,t[24]=M,t[25]=z):z=t[25],t[26]!==E||t[27]!==z||t[28]!==j||t[29]!==I?(F=h.jsxs(E,{children:[j,I,z]}),t[26]=E,t[27]=z,t[28]=j,t[29]=I,t[30]=F):F=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==F||t[35]!==k?(V=h.jsxs(S,{open:e,onOpenChange:n,children:[k,F]}),t[31]=S,t[32]=e,t[33]=n,t[34]=F,t[35]=k,t[36]=V):V=t[36],V};function KS(t){return!t.hotkey}function XS(t){return t.label}function ZS(t){return!t}const Oa="https://static.marimo.app",QS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=A.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Oa}/static/${i}`;let l,c,d,u,f,m,_,g,p,b,x;return e[0]!==n||e[1]!==i?(l=async y=>{y.preventDefault(),n();const v=await tz({download:!1,includeCode:!0,files:kS.INSTANCE.filenames()}),S=lt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Oa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{S.dismiss(),lt({title:"Error uploading static page",description:h.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",h.jsx("a",{href:Zn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),lt({title:"Static page uploaded!",description:h.jsxs("div",{children:["The URL has been copied to your clipboard.",h.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(ur,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs(Ds,{children:[c,h.jsxs(Ls,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",h.jsx("a",{href:Oa,target:"_blank",children:Oa}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=u):u=e[5],e[6]!==o?(f=h.jsx(hr,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(m=h.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(eC,{text:a}),h.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=_):_=e[12],e[13]!==n?(g=h.jsx(Pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(p=h.jsx(Pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await yn(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=h.jsxs(ta,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=h.jsx(dr,{className:"w-fit",children:h.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},eC=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=$n.stopPropagation(async c=>{c.preventDefault(),await yn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(Fs,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsx(Pe,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=h.jsx(Le,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function og(){const t=X.c(3),{openConfirm:e}=Vn(),n=en(po);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:h.jsx(B3,{onClick:async()=>{n({state:xt.CLOSING}),await nz(),oz()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const hd=[{type:"files",Icon:yp,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:mc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:cr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ja,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ya,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:nd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:pc,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:od,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:pm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:g$,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Up,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Sp,tooltip:"Secrets",hidden:Un(),position:"sidebar"},{type:"scratchpad",Icon:rz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:cm,tooltip:"View errors",position:"footer"}];function rg(){const t=X.c(2),e=en(gm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=zs.parse(i.parentNode.id);break}}e(i=>({mode:sz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(zs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function xr(){return Ae.string().optional().describe(Je.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function sg(){return Ae.string().optional().describe(Je.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Da(){return Ae.string().optional().describe(Je.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function ig(){return Ae.string().optional().describe(Je.of({label:"URI",optionRegex:".*uri.*"}))}function wr(){return Ae.string().nonempty().describe(Je.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function _o(){return Ae.string().describe(Je.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function vr(){return Ae.string().nonempty().describe(Je.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function kr(t){const e=Ae.coerce.string().describe(Je.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 ag(){return Ae.boolean().default(!1).describe(Je.of({label:"Read Only"}))}const lg=Ae.object({type:Ae.literal("postgres"),host:wr(),port:kr(5432).optional(),database:_o(),username:vr(),password:xr(),ssl:Ae.boolean().default(!1).describe(Je.of({label:"Use SSL"}))}).describe(Je.of({direction:"two-columns"})),cg=Ae.object({type:Ae.literal("mysql"),host:wr(),port:kr(3306),database:_o(),username:vr(),password:xr(),ssl:Ae.boolean().default(!1).describe(Je.of({label:"Use SSL"}))}).describe(Je.of({direction:"two-columns"})),dg=Ae.object({type:Ae.literal("sqlite"),database:_o().describe(Je.of({label:"Database Path"}))}).describe(Je.of({direction:"two-columns"})),ug=Ae.object({type:Ae.literal("duckdb"),database:_o().describe(Je.of({label:"Database Path"})),read_only:ag()}).describe(Je.of({direction:"two-columns"})),hg=Ae.object({type:Ae.literal("motherduck"),database:_o().default("my_db").describe(Je.of({label:"Database Name"})),token:sg()}).describe(Je.of({direction:"two-columns"})),fg=Ae.object({type:Ae.literal("snowflake"),account:Ae.string().nonempty().describe(Je.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Ae.string().optional().describe(Je.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:_o(),schema:Ae.string().optional().describe(Je.of({label:"Schema",optionRegex:".*snowflake.*"})),username:vr(),password:xr(),role:Ae.string().optional().describe(Je.of({label:"Role"}))}).describe(Je.of({direction:"two-columns"})),mg=Ae.object({type:Ae.literal("bigquery"),project:Ae.string().nonempty().describe(Je.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Ae.string().nonempty().describe(Je.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Ae.string().describe(Je.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Je.of({direction:"two-columns"})),pg=Ae.object({type:Ae.literal("clickhouse_connect"),host:wr(),port:kr(8123).optional(),username:vr(),password:xr(),secure:Ae.boolean().default(!1).describe(Je.of({label:"Use HTTPs"}))}).describe(Je.of({direction:"two-columns"})),gg=Ae.object({type:Ae.literal("timeplus"),host:wr().default("localhost"),port:kr(8123).optional(),username:vr().default("default"),password:xr().default("")}).describe(Je.of({direction:"two-columns"})),_g=Ae.object({type:Ae.literal("chdb"),database:_o().describe(Je.of({label:"Database Path"})),read_only:ag()}).describe(Je.of({direction:"two-columns"})),bg=Ae.object({type:Ae.literal("trino"),host:wr(),port:kr(8080),database:_o(),schema:Ae.string().describe(Je.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:vr(),password:xr(),async_support:Ae.boolean().default(!1).describe(Je.of({label:"Async Support"}))}).describe(Je.of({direction:"two-columns"})),yg=Ae.object({type:Ae.literal("iceberg"),name:Ae.string().describe(Je.of({label:"Catalog Name"})),catalog:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("REST"),warehouse:Da(),uri:Ae.string().optional().describe(Je.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:sg()}),Ae.object({type:Ae.literal("SQL"),warehouse:Da(),uri:Ae.string().optional().describe(Je.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Ae.object({type:Ae.literal("Hive"),warehouse:Da(),uri:ig()}),Ae.object({type:Ae.literal("Glue"),warehouse:Da(),uri:ig()}),Ae.object({type:Ae.literal("DynamoDB"),"dynamodb.profile-name":Ae.string().optional().describe(Je.of({label:"Profile Name"})),"dynamodb.region":Ae.string().optional().describe(Je.of({label:"Region"})),"dynamodb.access-key-id":Ae.string().optional().describe(Je.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Ae.string().optional().describe(Je.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Ae.string().optional().describe(Je.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Je.of({special:"tabs"}))}),xg=Ae.object({type:Ae.literal("datafusion"),sessionContext:Ae.boolean().optional().describe(Je.of({label:"Use Session Context"}))}),wg=Ae.object({type:Ae.literal("pyspark"),host:wr().optional(),port:kr().optional()}),vg=Ae.object({type:Ae.literal("redshift"),host:wr(),port:kr(5439),connectionType:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("IAM credentials"),region:Ae.string().describe(Je.of({label:"Region"})),aws_access_key_id:Ae.string().nonempty().describe(Je.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Ae.string().nonempty().describe(Je.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Ae.string().optional().describe(Je.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Ae.object({type:Ae.literal("DB credentials"),user:vr(),password:xr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:_o()}).describe(Je.of({direction:"two-columns"})),tC=Ae.discriminatedUnion("type",[lg,cg,dg,ug,hg,fg,mg,pg,gg,_g,bg,yg,xg,wg,vg]),fd="env:";function Ra(t){return typeof t=="string"&&t.startsWith(fd)}function md(t){return`${fd}${t}`}const kg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class an{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class nC{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),Ra(n)){const r=n.replace(fd,""),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"?Ur(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Ur(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 Ra(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-hdybZ30c.js","./index-C7Am6NF_.js","./index-4v1-JkQF.css","./compile-Chk_s6zN.js","./time-BUp7Z0RV.js","./timer-DFzT7np-.js","./linear-wQMrSuqQ.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-Cuwikxov.js","./step-BwsUM5iJ.js","./panels-BweGhipq.js","./index-CNJFmRV_.js","./index-SF4WuqCm.js","./index-BOwes9SE.js","./index-zsoXXYZW.js","./index-BpTYgEst.js","./index-DiwLYcDj.js","./index-CUW5KY1C.js","./index-DQ8jP575.js","./index-DeeHZj9y.js","./index-C6UZaMLH.js","./index-BGj9kRhO.js","./index-BL10oHuq.js","./index-LLUT0J2x.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-CHJ5qNM_.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-D7xaZ7Da.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-Dri_5nFc.js","./fortran-DL7KluxX.js","./gas-5kEe4nk0.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CmdsSjFB.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-FFvkTduk.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-OdhglgkO.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-BQXy8elZ.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./panels-DcAzAz16.css","./tree-DiqnZEyo.js","./index-C597UBxr.js","./tree-C1rhMrxo.css","./circle-play-Bc8gNlLC.js","./_createAggregator-BmNkJdfQ.js","./_baseEach-CNBeOBZe.js","./transform-Cyp0GDF-.js","./sortBy-CdjNsKA2.js","./_baseMap-qeSIUZ20.js","./terminal-COx5J6qv.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
+ var CF=Object.defineProperty;var y3=zt=>{throw TypeError(zt)};var NF=(zt,It,pn)=>It in zt?CF(zt,It,{enumerable:!0,configurable:!0,writable:!0,value:pn}):zt[It]=pn;var ee=(zt,It,pn)=>NF(zt,typeof It!="symbol"?It+"":It,pn),jF=(zt,It,pn)=>It.has(zt)||y3("Cannot "+pn);var x3=(zt,It,pn)=>(jF(zt,It,"read from private field"),pn?pn.call(zt):It.get(zt)),w3=(zt,It,pn)=>It.has(zt)?y3("Cannot add the same private member more than once"):It instanceof WeakSet?It.add(zt):It.set(zt,pn);import{u as Fe,Q as A,i9 as EF,ia as IF,ib as v3,ic as AF,id as TF,ie as MF,R as K,ig as OF,ih as Or,ii as DF,ij as Zf,ik as k3,il as RF,im as PF,io as S3,ip as rc,c as X,as as Un,iq as Qf,j as h,du as em,dv as C3,dw as LF,dy as tm,dA as nm,f8 as sc,ir as om,ds as rm,dt as sm,dx as im,is as FF,it as N3,ei as j3,bp as et,a8 as Ft,iu as zF,dW as fo,iv as E3,iw as I3,ix as am,iy as A3,iz as BF,L as Zt,_ as Qt,aF as T3,cE as lm,W as Pe,iA as UF,ej as dt,iB as M3,en as ic,iC as VF,ao as lt,iD as ac,Z as We,a_ as Vn,a0 as en,iE as lc,iF as Ms,e6 as Os,iG as $F,iH as Zi,iI as HF,eg as WF,iJ as O3,iK as D3,dO as qF,a7 as cm,iL as lr,iM as Dr,aJ as cc,aL as cr,iN as GF,iO as dc,iP as R3,a5 as Qi,eF as P3,a6 as uc,iQ as YF,an as yn,iR as dm,iS as Rr,aj as dr,ak as Ds,al as ur,bg as Pr,U as Fo,e7 as Rs,gn as L3,fP as Ps,gq as JF,b2 as fn,iT as KF,iU as XF,fN as um,aI as hc,iV as hm,iW as ZF,iX as F3,iY as fm,iZ as QF,i_ as ez,i$ as mo,j0 as z3,fT as mm,j1 as ea,j2 as fc,e1 as tz,ae as Zn,am as Ls,be as hr,j3 as ta,bt as $n,ap as Fs,a4 as Le,f5 as po,b7 as B3,eq as xt,j4 as nz,eS as oz,dB as mc,j5 as pc,aN as pm,j6 as rz,ep as gm,ed as zs,j7 as sz,j8 as _m,bj as jn,j9 as iz,dU as Ae,ja as Je,jb as bm,jc as Ct,jd as U3,je as az,fu as ym,aE as En,aT as Hn,ga as V3,gb as $3,gc as lz,gg as cz,gd as H3,V as Oe,dN as dz,aG as gc,aR as _c,aH as bc,aO as sn,eh as zo,jf as uz,ge as W3,jg as hz,g5 as q3,g7 as G3,jh as Bs,ji as Y3,jj as fz,jk as mz,ai as pz,ah as gz,ec as na,af as xm,jl as oa,jm as yc,jn as _z,jo as bz,jp as J3,jq as mn,fS as K3,dP as xc,ba as yz,jr as xz,ar as wm,aK as wz,js as vz,gr as X3,b6 as wc,jt as vm,aq as ra,e2 as Z3,ju as kz,ag as Sz,jv as Q3,jw as Cz,jx as Nz,jy as jz,jz as Ez,jA as Iz,jB as Az,dq as Bo,jC as vc,jD as Us,o as Uo,n as st,fx as Qn,jE as In,jF as ut,jG as Vs,jH as Vt,fO as Gt,jI as km,dT as go,jJ as Tz,jK as Mz,b4 as e4,b5 as t4,jL as n4,jM as Oz,gu as $s,jN as kc,b1 as Sc,gt as Lr,jO as o4,jP as sa,ek as Sm,jQ as Dz,jR as Rz,jS as Pz,jT as Lz,jU as r4,jV as Fz,jW as s4,jX as i4,jY as zz,jZ as a4,j_ as l4,el as Cc,j$ as Bz,bq as Uz,k0 as Vz,fw as Wn,k1 as $z,k2 as Hz,k3 as Hs,k4 as Nc,k5 as Ws,fH as Vo,k6 as Cm,k7 as ia,k8 as aa,k9 as la,ka as Wz,fn as jc,kb as Nm,kc as c4,kd as Ec,eR as qz,fo as Gz,r as Yz,ke as Jz,kf as Kz,kg as d4,t as D,kh as Xz,ki as Zz,kj as jm,f_ as ca,kk as u4,fA as Qz,fs as h4,co as f4,kl as m4,km as eB,kn as tB,ko as nB,kp as oB,kq as rB,kr as sB,ks as iB,kt as aB,ku as lB,kv as cB,kw as dB,kx as uB,ky as hB,kz as fB,kA as mB,kB as pB,kC as gB,kD as _B,kE as bB,kF as yB,kG as da,kH as xB,kI as wB,kJ as vB,kK as kB,kL as SB,kM as CB,kN as p4,kO as NB,kP as jB,kQ as EB,kR as g4,kS as IB,kT as AB,kU as _4,kV as TB,kW as qs,kX as qn,kY as MB,kZ as OB,k_ as DB,k$ as RB,l0 as PB,l1 as LB,l2 as FB,l3 as zB,l4 as BB,l5 as UB,l6 as fr,l7 as VB,l8 as $B,l9 as HB,la as WB,er as qB,lb as GB,lc as b4,ev as YB,ld as Ic,le as JB,lf as KB,lg as XB,lh as ZB,X as Fr,li as Ac,eu as QB,lj as Em,lk as Tc,ll as ua,lm as ha,ln as Mc,lo as mr,lp as y4,lq as $o,lr as Gs,ls as Im,lt as fa,lu as Ys,lv as Am,lw as Tm,lx as x4,ly as Oc,lz as eU,S as ma,lA as pa,lB as tU,eQ as Dc,lC as nU,lD as Mm,lE as oU,lF as rU,lG as Rc,lH as sU,lI as iU,lJ as w4,lK as Om,gs as Js,lL as aU,lM as lU,lN as cU,lO as dU,fF as uU,bd as hU,gv as Et,lP as ga,lQ as Ks,lR as fU,lS as mU,lT as Dm,lU as pU,cn as Rm,lV as gU,b3 as v4,lW as _U,lX as bU,lY as Pc,lZ as k4,eK as Pm,bf as S4,$ as Lm,l_ as C4,l$ as yU,m0 as xU,m1 as Fm,m2 as zm,m3 as wU,m4 as N4,m5 as j4,m6 as _a,fr as vU,ab as E4,e4 as kU,m7 as I4,m8 as SU,m9 as CU,ma as A4,mb as NU,mc as jU,md as T4,me as M4,mf as EU,bh as O4,mg as IU,mh as Bm,eb as AU,mi as Ho,dL as D4,mj as R4,ef as P4,fh as Um,mk as Vm,ml as L4,bv as $m,dM as Lc,mm as F4,mn as TU,mo as MU,mp as OU,bc as Fc,mq as z4,fa as Hm,g6 as DU,g8 as RU,gf as Wm,gi as PU,mr as LU,ms as qm,mt as FU,mu as zU,mv as BU,mw as UU,mx as VU,my as $U,mz as HU,mA as WU,a9 as qU,mB as zc,aa as GU,mC as B4,mD as YU,f6 as JU,mE as U4,a$ as eo,fl as KU,dD as XU,mF as ZU,mG as V4,mH as QU,eP as eV,mI as tV,mJ as nV,e5 as oV,mK as rV,mL as sV,a2 as Bc,mM as iV,a3 as pr,dG as $4,mN as Gm,mO as aV,eo as H4,mP as lV,mQ as W4,mR as cV,mS as dV,mT as uV,mU as hV,mV as fV,mW as mV,mX as q4,g1 as Ym,f$ as Jm,fW as Xs,g0 as zr,mY as G4,g2 as Km,fX as Br,dX as pV,mZ as Xm,m_ as gV,a1 as _V,m$ as bV,fG as Y4,E as Zs,n0 as yV,n1 as xV,n2 as wV,n3 as vV,n4 as ba,n5 as kV,n6 as SV,n7 as CV,n8 as NV,n9 as jV,na as J4,nb as EV,fv as IV,nc as AV,nd as TV,ne as MV,nf as OV,gh as DV,ng as RV,nh as K4,ni as PV,nj as LV,nk as X4,nl as Z4,nm as Q4,f4 as eS,nn as FV,no as zV,np as tS,nq as nS,nr as Uc,ns as oS,nt as BV,nu as rS,nv as UV,nw as VV,nx as sS,ny as $V,nz as HV,nA as WV,C as iS,nB as qV,nC as GV,nD as YV,nE as gr,nF as aS,dV as JV,fY as KV,nG as lS,fZ as cS,nH as XV,nI as Qs,nJ as ZV,nK as Vc,nL as QV,nM as e$,y as dS,nN as t$,dj as n$,nO as o$,nP as r$,nQ as s$,nR as i$,nS as a$,eX as l$,b0 as c$,aZ as d$,at as $c,nT as uS,nU as hS,av as fS,au as u$,e9 as h$,__tla as f$}from"./index-C7Am6NF_.js";import{G as m$,L as mS,g as p$,b as ya,A as g$,s as _$,k as b$,B as pS,a as y$,M as x$,Y as w$,c as xn,u as xa,C as v$,S as k$,K as S$,d as C$,i as N$,e as gS,f as j$,h as E$,j as I$,l as wa,P as Zm,m as _S,n as A$,o as T$,p as Qm,T as M$}from"./tree-DiqnZEyo.js";import{d as bS,e as yS,L as xS,f as ei,I as ep,g as O$,h as wS,N as vS,V as kS,S as SS,F as CS,i as NS,M as D$,l as jS,j as R$,E as ES,k as P$,m as tp,n as L$,o as F$,p as z$,q as B$,s as U$,t as V$,v as $$,w as H$,x as W$,a as q$,C as G$,R as IS,b as Y$,A as J$,y as K$,z as X$,O as Z$,T as Q$,B as eH,D as tH,c as nH,P as oH,__tla as rH}from"./panels-BweGhipq.js";import{c as sH}from"./_createAggregator-BmNkJdfQ.js";import{s as to,i as _r,T as np,a as op}from"./transform-Cyp0GDF-.js";import{g as AS}from"./timer-DFzT7np-.js";import{i as iH}from"./zoom-COrs4lFh.js";import{s as va}from"./sortBy-CdjNsKA2.js";let rp,Hc,An,Wc,TS,ka,sp,aH=Promise.all([(()=>{try{return f$}catch{}})(),(()=>{try{return rH}catch{}})()]).then(async()=>{var tc,b3;var zt=sH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let It,pn,ip,qc,ti,ni,ap,lp,cp,dp,Sa,Gc,up,Ca,hp,Yc,fp,mp,Jc,pp,gp,_p,Na,bp,Kc,yp,xp,wp,vp,kp,Sp,Xc,Cp,Zc,Np,jp,Ep,Ip,Ap,ja,Tp,Mp,Qc,Op,Dp,Rp,ed,Pp,Lp,Fp,Ea,td,nd,zp,Bp,Up,Vp,$p,Hp,Wp,qp,Gp,od,rd,Yp,Jp,Kp,Ia,br,yr;It=Fe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),pn=Fe("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"}]]),ip=Fe("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"}]]),qc=Fe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ti=Fe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),ni=Fe("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"}]]),ap=Fe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),lp=Fe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Wc=Fe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),cp=Fe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),dp=Fe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Sa=Fe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Gc=Fe("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"}]]),up=Fe("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"}]]),Ca=Fe("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"}]]),hp=Fe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Yc=Fe("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"}]]),fp=Fe("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"}]]),mp=Fe("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"}]]),Jc=Fe("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"}]]),pp=Fe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),gp=Fe("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"}]]),_p=Fe("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"}]]),Na=Fe("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"}]]),bp=Fe("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"}]]),Kc=Fe("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"}]]),yp=Fe("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"}]]),xp=Fe("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"}]]),wp=Fe("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"}]]),vp=Fe("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"}]]),kp=Fe("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"}]]),Sp=Fe("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"}]]),Xc=Fe("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"}]]),Cp=Fe("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"}]]),Zc=Fe("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"}]]),Np=Fe("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"}]]),jp=Fe("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"}]]),Ep=Fe("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"}]]),Ip=Fe("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ap=Fe("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"}]]),ja=Fe("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"}]]),Tp=Fe("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"}]]),Mp=Fe("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"}]]),Qc=Fe("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"}]]),Op=Fe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Dp=Fe("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"}]]),Rp=Fe("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"}]]),ed=Fe("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"}]]),Pp=Fe("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"}]]),Lp=Fe("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"}]]),Fp=Fe("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"}]]),Ea=Fe("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"}]]),td=Fe("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"}]]),nd=Fe("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"}]]),zp=Fe("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"}]]),Bp=Fe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Up=Fe("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"}]]),Vp=Fe("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"}]]),$p=Fe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Hp=Fe("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"}]]),Wp=Fe("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"}]]),qp=Fe("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"}]]),Gp=Fe("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"}]]),od=Fe("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"}]]),rd=Fe("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"}]]),Yp=Fe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Jp=Fe("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"}]]),Kp=Fe("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"}]]),Ia=Fe("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"}]]),br=Fe("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"}]]),yr=Fe("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=A.createContext({}),OS=A.forwardRef(function(t,e){[t,e]=TF(t,e,MS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,u]=A.useState(!1);EF(()=>{var p;u(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=IF(),m=f==="rtl"&&c==="horizontal";let _=AF(i);const g=A.useRef(null);return{toolbarProps:{...v3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?_.focusFirst():_.focusLast())):void 0;m?_.focusNext():_.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:d?void 0:p=>{var b,x;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=MF({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=v3(t);return delete r.id,K.createElement("div",{...OF(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Aa(t,e){const n=+Or(t)-+Or(e);return n<0?-1:n>0?1:n}function DS(t,e){const n=Or(t,e==null?void 0:e.in);return+function(o,r){const s=Or(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Or(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function RS(t,e,n){const[o,r,s]=Zf(n==null?void 0:n.in,t,t,e),i=Aa(r,s),a=Math.abs(function(d,u,f){const[m,_]=Zf(f==null?void 0:f.in,d,u);return 12*(m.getFullYear()-_.getFullYear())+(m.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=Aa(r,s)===-i;DS(o)&&a===1&&Aa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function PS(t,e,n){const o=function(r,s){return+Or(r)-+Or(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=RF(),i=(r==null?void 0:r.locale)??s.locale??PF,a=Aa(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=Zf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),u=PS(d,c),f=(k3(d)-k3(c))/1e3,m=Math.round((u-f)/60);let _;if(m<2)return m===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<S3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<rc){const g=Math.round(m/S3);return i.formatDistance("xDays",g,l)}if(m<2*rc)return _=Math.round(m/rc),i.formatDistance("aboutXMonths",_,l);if(_=RS(d,c),_<12){const g=Math.round(m/rc);return i.formatDistance("xMonths",g,l)}{const g=_%12,p=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",p,l):g<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return DF(n,Date.now())}(t),e)}const FS=()=>{const t=X.c(7),{selectedLayout:e}=bS(),{setLayoutView:n}=yS();if(Un()&&!Qf("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(rm,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:h.jsx(sm,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(em,{children:h.jsxs(C3,{children:[h.jsx(LF,{children:"View as"}),xS.map(BS)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=h.jsxs(im,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function zS(t){const e=Xp(t);return h.jsx(e,{className:"h-4 w-4"})}function Xp(t){switch(t){case"vertical":return Np;case"grid":return m$;case"slides":return ed;default:return sc(t),om}}function Zp(t){return nm(t)}function BS(t){return h.jsx(tm,{value:t,children:h.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[zS(t),h.jsx("span",{children:Zp(t)})]})},t)}function US(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new FF(a),l[0]=a,l[1]=c):c=l[1];const d=c;let u;l[2]!==i||l[3]!==d?(u=()=>d.get(i),l[2]=i,l[3]=d,l[4]=u):u=l[4];const[f,m]=A.useState(u);let _;l[5]!==i||l[6]!==d?(_=b=>{m(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=_):_=l[7];const g=_;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Qp(t){return t.dropdown!==void 0}function Ta(t,e=""){return t.flatMap(n=>n.label?Qp(n)?Ta(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const oi=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=h.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=h.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d};function sd(t){const e=X.c(3),n=id();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],et(o)}function eg(){const t=X.c(2),e=id();let n;return t[0]!==e?(n=()=>e(E3(fo())),t[0]=e,t[1]=n):n=t[1],et(n)}function id(){const t=X.c(2),{prepareForRun:e}=Ft();let n;return t[0]!==e?(n=async o=>{var a;if(o.length===0)return;const{cellHandles:r,cellData:s}=fo(),i=[];for(const l of o){const c=r[l],d=(a=c.current)==null?void 0:a.editorView;let u;d?(I3(d)!=="markdown"&&am(d),u=A3(d)):u=s[l].code,i.push(u),e({cellId:l})}await BF({cellIds:o,codes:i}).catch(VS)},t[0]=e,t[1]=n):n=t[1],et(n)}function VS(t){Zt.error(t)}const Ma=Qt(null),$S=Qt(!1),ad=T3("marimo:ai:chatState:v2",{chats:[],activeChatId:null}),HS=Qt(t=>{const e=t(ad);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(ad,o=>({...o,activeChatId:n}))}),ld=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],lm(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(UF,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=h.jsxs(Pe,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function cd(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=Ft();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(dt.get(M3))return;const{cellId:s}=r,i=dt.get(ic),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),VF({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=lt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:h.jsx(ld,{"data-testid":"undo-delete-button",onClick:()=>{n(),d()}})}),d=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],et(o)}function tg(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=Ft();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=ac(r.cellId);if(!s)return;const i=A3(s);e(r);const{dismiss:a}=lt({title:"Cell split",action:h.jsx(ld,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],et(o)}function dd(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=Ft(),u=tg(),f=sd(n==null?void 0:n.cellId),m=!We(M3),_=cd(),{openModal:g}=Vn(),p=en(Ma),b=We(lc),x=We(Ms),y=We(Os),v=We($F);if(!n||y){let N;return e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],N}const{cellId:S,config:k,getEditorView:E,name:j,hasOutput:I,hasConsoleOutput:T,status:M}=n;let L;e[1]!==S||e[2]!==k.disabled||e[3]!==r?(L=async()=>{const N={disabled:!k.disabled};await Rr({configs:{[S]:N}}),r({cellId:S,config:N})},e[1]=S,e[2]=k.disabled,e[3]=r,e[4]=L):L=e[4];const B=L;let O;e[5]!==S||e[6]!==k.hide_code||e[7]!==E||e[8]!==r?(O=async()=>{const N={hide_code:!k.hide_code};await Rr({configs:{[S]:N}}),r({cellId:S,config:N});const H=E();H&&(N.hide_code?H.contentDOM.blur():H.focus())},e[5]=S,e[6]=k.hide_code,e[7]=E,e[8]=r,e[9]=O):O=e[9];const z=O;let F,V,P,C,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(Gp,{size:13,strokeWidth:1.5}),e[10]=F):F=e[10],e[11]!==S||e[12]!==j||e[13]!==g||e[14]!==s?(V=()=>{g(h.jsxs(dr,{children:[h.jsx(Ds,{children:h.jsx(ur,{children:"Rename cell"})}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Pr,{htmlFor:"cell-name",children:"Cell name"}),h.jsx(vS,{placeholder:"cell name",value:j,onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),N.stopPropagation(),g(null))},onChange:N=>s({cellId:S,name:N})})]})]}))},e[11]=S,e[12]=j,e[13]=g,e[14]=s,e[15]=V):V=e[15],e[16]!==S||e[17]!==s?(P=N=>s({cellId:S,name:N}),e[16]=S,e[17]=s,e[18]=P):P=e[18],e[19]!==j||e[20]!==P?(C=h.jsx(vS,{placeholder:"cell name",value:j,onChange:P}),e[19]=j,e[20]=P,e[21]=C):C=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==m||e[27]!==S||e[28]!==d||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==I||e[36]!==i||e[37]!==j||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==u||e[43]!==M||e[44]!==V||e[45]!==C||e[46]!==B||e[47]!==z?($=[[{icon:F,label:"Name",disableClick:!0,handle:YS,handleHeadless:V,rightElement:C},{icon:h.jsx(ei,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:h.jsx(Zi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(N=>(N==null?void 0:N.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:h.jsx(td,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>u({cellId:S})},{icon:h.jsx(ep,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(N){const H=document.getElementById(N3.create(N));H&&(H.classList.add("printing-output"),j3(H,"result.png").finally(()=>{H.classList.remove("printing-output")}))}(S)},{icon:h.jsx(WF,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const N=E();N&&HF({[S]:N})}},{icon:k.hide_code?h.jsx(O3,{size:13,strokeWidth:1.5}):h.jsx(D3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:z,hotkey:"cell.hideCode"},{icon:k.disabled?h.jsx(br,{size:13,strokeWidth:1.5}):h.jsx(yr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:h.jsx(qF,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:B}),handle:B},{icon:h.jsx(cm,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{d({cellId:S})}}],[{icon:h.jsx(cc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const N=E();N&&(lr(x,o),Dr(N,"markdown",{keepCodeAsIs:!1}))}},{icon:h.jsx(cr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const N=E();N&&(lr(x,o),Dr(N,"sql",{keepCodeAsIs:!1}))}},{icon:h.jsx(dc,{}),label:"Toggle as Python",handle:()=>{const N=E();N&&(lr(x,o),GF(N,"python",{force:!0}))}}],[{icon:h.jsxs(oi,{children:[h.jsx(Sa,{size:13,strokeWidth:1.5}),h.jsx(R3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:h.jsxs(oi,{children:[h.jsx(Sa,{size:13,strokeWidth:1.5}),h.jsx(Qi,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:h.jsx(R3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:S,before:!0})},{icon:h.jsx(Qi,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:S,before:!1})},{icon:h.jsx(P3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:S,direction:"left"}),hidden:v!=="columns"},{icon:h.jsx(uc,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:S,direction:"right"}),hidden:v!=="columns"},{icon:h.jsx(lp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:S})},{icon:h.jsx(ap,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S})},{icon:h.jsx(YF,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:S})}],[{icon:h.jsx(mS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!wS(j),tooltip:wS(j)?void 0:"Only named cells can be linked to",handle:async()=>{await yn(O$(j)),lt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:h.jsx(dm,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:S})}}]].map(qS).filter(WS),e[22]=c,e[23]=b,e[24]=v,e[25]=x,e[26]=m,e[27]=S,e[28]=d,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=I,e[36]=i,e[37]=j,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=u,e[43]=M,e[44]=V,e[45]=C,e[46]=B,e[47]=z,e[48]=$):$=e[48],$}function WS(t){return t.length>0}function qS(t){return t.filter(GS)}function GS(t){return!t.hidden}function YS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function JS(t){return!t.hidden}const ud=Qt(!1),ng=()=>{const t=X.c(37),[e,n]=fn(ud),o=KF(),r=We(XF),s=We(um);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=dd(i).flat();a=Ta(a);const l=function(){const P=X.c(45),{theme:C}=Fo(),[$,N]=Rs(),[H,Y]=L3();let Z;P[0]!==N?(Z=async ce=>{await Ps({config:ce}).then(()=>{N(ce)})},P[0]=N,P[1]=Z):Z=P[1];const q=Z;let re;P[2]!==Y?(re=async ce=>{await JF({config:ce}).then(()=>{Y(ce)})},P[2]=Y,P[3]=re):re=P[3];const ne=re;let oe;if(P[4]!==H||P[5]!==$||P[6]!==ne||P[7]!==q||P[8]!==C){let ce,me,de;P[10]!==H?(ce=Ke=>Ke!==H.width,P[10]=H,P[11]=ce):ce=P[11],P[12]!==H||P[13]!==ne?(me=Ke=>({label:`App config > Set width=${Ke}`,handle:()=>{ne({...H,width:Ke})}}),P[12]=H,P[13]=ne,P[14]=me):me=P[14],P[15]!==$||P[16]!==q||P[17]!==C?(de={label:"Config > Toggle dark mode",handle:()=>{q({...$,display:{...$.display,theme:C==="dark"?"light":"dark"}})}},P[15]=$,P[16]=q,P[17]=C,P[18]=de):de=P[18];const ge=$.keymap.preset==="vim";let ie,xe;P[19]!==$||P[20]!==q?(ie=()=>{q({...$,keymap:{...$.keymap,preset:"vim"}})},P[19]=$,P[20]=q,P[21]=ie):ie=P[21],P[22]!==ge||P[23]!==ie?(xe={label:"Config > Switch keymap to VIM",hidden:ge,handle:ie},P[22]=ge,P[23]=ie,P[24]=xe):xe=P[24];const we=$.keymap.preset==="default";let ae,Se,pe;P[25]!==$||P[26]!==q?(ae=()=>{q({...$,keymap:{...$.keymap,preset:"default"}})},P[25]=$,P[26]=q,P[27]=ae):ae=P[27],P[28]!==ae||P[29]!==we?(Se={label:"Config > Switch keymap to default (current: VIM)",hidden:we,handle:ae},P[28]=ae,P[29]=we,P[30]=Se):Se=P[30],P[31]!==$||P[32]!==q?(pe=()=>{q({...$,completion:{...$.completion,copilot:!1}})},P[31]=$,P[32]=q,P[33]=pe):pe=P[33];const Te=$.completion.copilot!=="github";let Re,He;P[34]!==pe||P[35]!==Te?(Re={label:"Config > Disable GitHub Copilot",handle:pe,hidden:Te},P[34]=pe,P[35]=Te,P[36]=Re):Re=P[36],P[37]!==$||P[38]!==q?(He=()=>{q({...$,completion:{...$.completion,copilot:"github"}})},P[37]=$,P[38]=q,P[39]=He):He=P[39];const ze=$.completion.copilot==="github";let Ne;P[40]!==He||P[41]!==ze?(Ne={label:"Config > Enable GitHub Copilot",handle:He,hidden:ze},P[40]=He,P[41]=ze,P[42]=Ne):Ne=P[42],oe=[...p$().filter(ce).map(me),de,xe,Se,Re,Ne],P[4]=H,P[5]=$,P[6]=ne,P[7]=q,P[8]=C,P[9]=oe}else oe=P[9];const G=oe;let Q;return P[43]!==G?(Q=G.filter(JS),P[43]=G,P[44]=Q):Q=P[44],Q}();let c=Tg();c=[...Ta(c),...Ta(l)];const d=c.filter(KS),u=hc.keyBy(d,XS),{recentCommands:f,addRecentCommand:m}=US();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let p,b;t[4]!==s||t[5]!==n?(p=P=>{ez(s.getHotkey("global.commandPalette").key)(P)&&(P.preventDefault(),n(ZS))},t[4]=s,t[5]=n,t[6]=p):p=t[6],lm(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(P,C)=>{const $=o[P];if(!$)return null;const N=s.getHotkey(P);return h.jsxs(mo,{disabled:C.disabled,onSelect:()=>{m(P),n(!1),requestAnimationFrame(()=>{$()})},value:N.name,children:[h.jsxs("span",{children:[N.name,C.tooltip&&h.jsx("span",{className:"ml-2",children:C.tooltip})]}),h.jsx(z3,{children:h.jsx(mm,{shortcut:N.key})})]},P)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==m||t[13]!==s||t[14]!==n?(y=(P,C,$,N)=>{const H=$===void 0?{}:$;return h.jsxs(mo,{disabled:H.disabled,onSelect:()=>{m(P),n(!1),requestAnimationFrame(()=>{C()})},value:P,children:[h.jsxs("span",{children:[P,H.tooltip&&h.jsxs("span",{className:"ml-2",children:["(",H.tooltip,")"]})]}),N&&h.jsx(z3,{children:h.jsx(mm,{shortcut:s.getHotkey(N).key})})]},P)},t[12]=m,t[13]=s,t[14]=n,t[15]=y):y=t[15];const v=y,S=QF;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(ea,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const E=fm;let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(fc,{children:"No results found."}),t[17]=j):j=t[17];const I=f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(hm,{heading:"Recently Used",children:f.map(P=>{const C=u[P];return ZF(P)?x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip}):C&&!Qp(C)?v(C.label,C.handleHeadless||C.handle,{disabled:C.disabled,tooltip:C.tooltip}):null})}),h.jsx(F3,{})]}),T=hm,M=s.iterate().map(P=>{if(g.has(P))return null;const C=u[P];return x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip})}),L=d.map(P=>g.has(P.label)?null:v(P.label,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}));let B;t[18]!==g||t[19]!==v?(B=P=>g.has(P.label)?null:v(`Cell > ${P.label}`,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}),t[18]=g,t[19]=v,t[20]=B):B=t[20];const O=a.map(B);let z,F,V;return t[21]!==T||t[22]!==L||t[23]!==O||t[24]!==M?(z=h.jsxs(T,{heading:"Commands",children:[M,L,O]}),t[21]=T,t[22]=L,t[23]=O,t[24]=M,t[25]=z):z=t[25],t[26]!==E||t[27]!==z||t[28]!==j||t[29]!==I?(F=h.jsxs(E,{children:[j,I,z]}),t[26]=E,t[27]=z,t[28]=j,t[29]=I,t[30]=F):F=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==F||t[35]!==k?(V=h.jsxs(S,{open:e,onOpenChange:n,children:[k,F]}),t[31]=S,t[32]=e,t[33]=n,t[34]=F,t[35]=k,t[36]=V):V=t[36],V};function KS(t){return!t.hotkey}function XS(t){return t.label}function ZS(t){return!t}const Oa="https://static.marimo.app",QS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=A.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Oa}/static/${i}`;let l,c,d,u,f,m,_,g,p,b,x;return e[0]!==n||e[1]!==i?(l=async y=>{y.preventDefault(),n();const v=await tz({download:!1,includeCode:!0,files:kS.INSTANCE.filenames()}),S=lt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Oa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{S.dismiss(),lt({title:"Error uploading static page",description:h.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",h.jsx("a",{href:Zn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),lt({title:"Static page uploaded!",description:h.jsxs("div",{children:["The URL has been copied to your clipboard.",h.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(ur,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs(Ds,{children:[c,h.jsxs(Ls,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",h.jsx("a",{href:Oa,target:"_blank",children:Oa}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=u):u=e[5],e[6]!==o?(f=h.jsx(hr,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(m=h.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(eC,{text:a}),h.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=_):_=e[12],e[13]!==n?(g=h.jsx(Pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(p=h.jsx(Pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await yn(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=h.jsxs(ta,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=h.jsx(dr,{className:"w-fit",children:h.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},eC=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=$n.stopPropagation(async c=>{c.preventDefault(),await yn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(Fs,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsx(Pe,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=h.jsx(Le,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function og(){const t=X.c(3),{openConfirm:e}=Vn(),n=en(po);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:h.jsx(B3,{onClick:async()=>{n({state:xt.CLOSING}),await nz(),oz()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const hd=[{type:"files",Icon:yp,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:mc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:cr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ja,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ya,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:nd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:pc,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:od,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:pm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:g$,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Up,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Sp,tooltip:"Secrets",hidden:Un(),position:"sidebar"},{type:"scratchpad",Icon:rz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:cm,tooltip:"View errors",position:"footer"}];function rg(){const t=X.c(2),e=en(gm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=zs.parse(i.parentNode.id);break}}e(i=>({mode:sz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(zs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function xr(){return Ae.string().optional().describe(Je.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function sg(){return Ae.string().optional().describe(Je.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Da(){return Ae.string().optional().describe(Je.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function ig(){return Ae.string().optional().describe(Je.of({label:"URI",optionRegex:".*uri.*"}))}function wr(){return Ae.string().nonempty().describe(Je.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function _o(){return Ae.string().describe(Je.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function vr(){return Ae.string().nonempty().describe(Je.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function kr(t){const e=Ae.coerce.string().describe(Je.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 ag(){return Ae.boolean().default(!1).describe(Je.of({label:"Read Only"}))}const lg=Ae.object({type:Ae.literal("postgres"),host:wr(),port:kr(5432).optional(),database:_o(),username:vr(),password:xr(),ssl:Ae.boolean().default(!1).describe(Je.of({label:"Use SSL"}))}).describe(Je.of({direction:"two-columns"})),cg=Ae.object({type:Ae.literal("mysql"),host:wr(),port:kr(3306),database:_o(),username:vr(),password:xr(),ssl:Ae.boolean().default(!1).describe(Je.of({label:"Use SSL"}))}).describe(Je.of({direction:"two-columns"})),dg=Ae.object({type:Ae.literal("sqlite"),database:_o().describe(Je.of({label:"Database Path"}))}).describe(Je.of({direction:"two-columns"})),ug=Ae.object({type:Ae.literal("duckdb"),database:_o().describe(Je.of({label:"Database Path"})),read_only:ag()}).describe(Je.of({direction:"two-columns"})),hg=Ae.object({type:Ae.literal("motherduck"),database:_o().default("my_db").describe(Je.of({label:"Database Name"})),token:sg()}).describe(Je.of({direction:"two-columns"})),fg=Ae.object({type:Ae.literal("snowflake"),account:Ae.string().nonempty().describe(Je.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Ae.string().optional().describe(Je.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:_o(),schema:Ae.string().optional().describe(Je.of({label:"Schema",optionRegex:".*snowflake.*"})),username:vr(),password:xr(),role:Ae.string().optional().describe(Je.of({label:"Role"}))}).describe(Je.of({direction:"two-columns"})),mg=Ae.object({type:Ae.literal("bigquery"),project:Ae.string().nonempty().describe(Je.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Ae.string().nonempty().describe(Je.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Ae.string().describe(Je.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Je.of({direction:"two-columns"})),pg=Ae.object({type:Ae.literal("clickhouse_connect"),host:wr(),port:kr(8123).optional(),username:vr(),password:xr(),secure:Ae.boolean().default(!1).describe(Je.of({label:"Use HTTPs"}))}).describe(Je.of({direction:"two-columns"})),gg=Ae.object({type:Ae.literal("timeplus"),host:wr().default("localhost"),port:kr(8123).optional(),username:vr().default("default"),password:xr().default("")}).describe(Je.of({direction:"two-columns"})),_g=Ae.object({type:Ae.literal("chdb"),database:_o().describe(Je.of({label:"Database Path"})),read_only:ag()}).describe(Je.of({direction:"two-columns"})),bg=Ae.object({type:Ae.literal("trino"),host:wr(),port:kr(8080),database:_o(),schema:Ae.string().describe(Je.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:vr(),password:xr(),async_support:Ae.boolean().default(!1).describe(Je.of({label:"Async Support"}))}).describe(Je.of({direction:"two-columns"})),yg=Ae.object({type:Ae.literal("iceberg"),name:Ae.string().describe(Je.of({label:"Catalog Name"})),catalog:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("REST"),warehouse:Da(),uri:Ae.string().optional().describe(Je.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:sg()}),Ae.object({type:Ae.literal("SQL"),warehouse:Da(),uri:Ae.string().optional().describe(Je.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Ae.object({type:Ae.literal("Hive"),warehouse:Da(),uri:ig()}),Ae.object({type:Ae.literal("Glue"),warehouse:Da(),uri:ig()}),Ae.object({type:Ae.literal("DynamoDB"),"dynamodb.profile-name":Ae.string().optional().describe(Je.of({label:"Profile Name"})),"dynamodb.region":Ae.string().optional().describe(Je.of({label:"Region"})),"dynamodb.access-key-id":Ae.string().optional().describe(Je.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Ae.string().optional().describe(Je.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Ae.string().optional().describe(Je.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Je.of({special:"tabs"}))}),xg=Ae.object({type:Ae.literal("datafusion"),sessionContext:Ae.boolean().optional().describe(Je.of({label:"Use Session Context"}))}),wg=Ae.object({type:Ae.literal("pyspark"),host:wr().optional(),port:kr().optional()}),vg=Ae.object({type:Ae.literal("redshift"),host:wr(),port:kr(5439),connectionType:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("IAM credentials"),region:Ae.string().describe(Je.of({label:"Region"})),aws_access_key_id:Ae.string().nonempty().describe(Je.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Ae.string().nonempty().describe(Je.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Ae.string().optional().describe(Je.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Ae.object({type:Ae.literal("DB credentials"),user:vr(),password:xr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:_o()}).describe(Je.of({direction:"two-columns"})),tC=Ae.discriminatedUnion("type",[lg,cg,dg,ug,hg,fg,mg,pg,gg,_g,bg,yg,xg,wg,vg]),fd="env:";function Ra(t){return typeof t=="string"&&t.startsWith(fd)}function md(t){return`${fd}${t}`}const kg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class an{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class nC{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),Ra(n)){const r=n.replace(fd,""),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"?Ur(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Ur(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 Ra(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 oC extends an{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),i=this.secrets.printInFString("database",this.connection.database);return Ct(`
4
4
  DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
5
5
  engine = ${this.orm}.create_engine(DATABASE_URL${e})
@@ -122,7 +122,7 @@ ${t.stack}`:o}function ro(t,e){return t>>>=0,Qr().subarray(t/1,t/1+e)}function K
122
122
  before:right-[-3px] before:w-[9px] before:z-[-1]
123
123
  hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
124
124
  hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const kM=Qt(t=>{const e=t(ic);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),SM=()=>{const t=X.c(3),e=CM;if(!We(kM))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("div",{className:"flex justify-between",children:h.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ca,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95",children:h.jsxs(Fc,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,h.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:h.jsx("div",{children:h.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",h.jsx(Pe,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=h.jsx(M4,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function CM(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):Zt.error("No element with data-stdin-blocking found")}const NM=t=>{const e=X.c(8),n=We(BU),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=h.jsx(jM,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=h.jsx(d0,{id:"column-container",items:n,strategy:o5,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=h.jsx(pM,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},jM=t=>{const e=X.c(50),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,i=Cc(),a=Ft(),{theme:l}=Fo(),{toggleSidebarPanel:c}=oa(),{invisible:d}=$$(i.cellIds.idLength,n);Gt("global.focusTop",a.focusTopCell),Gt("global.focusBottom",a.focusBottomCell),Gt("global.toggleSidebar",c),Gt("global.foldCode",a.foldAll),Gt("global.unfoldCode",a.unfoldAll),Gt("global.formatAll",AM),Gt("cell.hideCode",En.NOOP),Gt("cell.format",En.NOOP);const u=cd(),f=a.scrollToTarget;let m,_,g,p,b,x,y,v,S,k,E,j,I,T,M;if(e[0]!==i.scrollKey||e[1]!==f?(m=()=>{i.scrollKey!==null&&f()},e[0]=i.scrollKey,e[1]=f,e[2]=m):m=e[2],e[3]!==i.cellIds||e[4]!==i.scrollKey||e[5]!==f?(_=[i.cellIds,i.scrollKey,f],e[3]=i.cellIds,e[4]=i.scrollKey,e[5]=f,e[6]=_):_=e[6],A.useEffect(m,_),e[7]!==a||e[8]!==r||e[9]!==s||e[10]!==d||e[11]!==n||e[12]!==i||e[13]!==u||e[14]!==l||e[15]!==o){const L=i.cellIds.getColumns();let B;e[26]!==i.cellIds?(B=i.cellIds.hasOnlyOneId(),e[26]=i.cellIds,e[27]=B):B=e[27];const O=B;let z;e[28]!==i.cellIds.inOrderIds?(z=i.cellIds.inOrderIds.includes(Ho),e[28]=i.cellIds.inOrderIds,e[29]=z):z=e[29];const F=z;g=H$,v="pb-[40vh]",S=d,k=r,E="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(rM,{}),p=h.jsx(SM,{}),e[30]=p,e[31]=j):(p=e[30],j=e[31]),e[32]!==r.width?(b=h.jsx(tM,{width:r.width}),e[32]=r.width,e[33]=b):b=e[33];const V=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[34]!==V?(x=Oe(V),e[34]=V,e[35]=x):x=e[35],y=L.map((P,C)=>h.jsx(EM,{column:P,index:C,columnsLength:L.length,appConfig:r,notebook:i,mode:n,userConfig:o,connStatus:s,actions:a,theme:l,hasOnlyOneCell:O,invisible:d,hasSetupCell:F,onDeleteCell:u},P.id)),e[7]=a,e[8]=r,e[9]=s,e[10]=d,e[11]=n,e[12]=i,e[13]=u,e[14]=l,e[15]=o,e[16]=g,e[17]=p,e[18]=b,e[19]=x,e[20]=y,e[21]=v,e[22]=S,e[23]=k,e[24]=E,e[25]=j}else g=e[16],p=e[17],b=e[18],x=e[19],y=e[20],v=e[21],S=e[22],k=e[23],E=e[24],j=e[25];return e[36]!==x||e[37]!==y?(I=h.jsx("div",{className:x,children:y}),e[36]=x,e[37]=y,e[38]=I):I=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(W$,{}),e[39]=T):T=e[39],e[40]!==g||e[41]!==p||e[42]!==b||e[43]!==I||e[44]!==v||e[45]!==S||e[46]!==k||e[47]!==E||e[48]!==j?(M=h.jsxs(g,{className:v,invisible:S,appConfig:k,innerClassName:E,children:[j,p,b,I,T]}),e[40]=g,e[41]=p,e[42]=b,e[43]=I,e[44]=v,e[45]=S,e[46]=k,e[47]=E,e[48]=j,e[49]=M):M=e[49],M},EM=t=>{const e=X.c(42),{column:n,index:o,columnsLength:r,appConfig:s,notebook:i,mode:a,userConfig:l,connStatus:c,actions:d,theme:u,hasOnlyOneCell:f,invisible:m,hasSetupCell:_,onDeleteCell:g}=t,p=c.state,b=n.id,x=o>0,y=o<r-1,v=s.width,S=r>1,k=n.id,E=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let j,I;e[0]!==E?(j=Oe(E),e[0]=E,e[1]=j):j=e[1],e[2]!==n.id||e[3]!==j?(I=h.jsx(IM,{columnId:k,className:j}),e[2]=n.id,e[3]=j,e[4]=I):I=e[4];const T=`column-${o+1}`,M=n.topLevelIds;let L,B,O,z;return e[5]!==d||e[6]!==p||e[7]!==_||e[8]!==o||e[9]!==m||e[10]!==a||e[11]!==i||e[12]!==g||e[13]!==u||e[14]!==l?(L=o===0&&_&&h.jsx(Nx,{theme:u,showPlaceholder:!1,allowFocus:!m,...i.cellData[Ho],...i.cellRuntime[Ho],...d,runElapsedTimeMs:i.cellRuntime[Ho].runElapsedTimeMs??i.cellData[Ho].lastExecutionTime,canDelete:!0,mode:a,connectionState:p,ref:i.cellHandles[Ho],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:d,deleteCell:g},Ho),e[5]=d,e[6]=p,e[7]=_,e[8]=o,e[9]=m,e[10]=a,e[11]=i,e[12]=g,e[13]=u,e[14]=l,e[15]=L):L=e[15],e[16]!==d||e[17]!==s.width||e[18]!==n||e[19]!==p||e[20]!==f||e[21]!==m||e[22]!==a||e[23]!==i||e[24]!==g||e[25]!==u||e[26]!==l?(B=n.topLevelIds.map(F=>{if(F===Ho)return null;const V=i.cellData[F],P=i.cellRuntime[F];return h.jsx(Nx,{theme:u,showPlaceholder:f,allowFocus:!m,...V,...P,runElapsedTimeMs:P.runElapsedTimeMs??V.lastExecutionTime,canDelete:!f,mode:a,connectionState:p,ref:i.cellHandles[F],userConfig:l,config:V.config,name:V.name,isCollapsed:n.isCollapsed(F),collapseCount:n.getCount(F),canMoveX:s.width==="columns",actions:d,deleteCell:g},V.id.toString())}),e[16]=d,e[17]=s.width,e[18]=n,e[19]=p,e[20]=f,e[21]=m,e[22]=a,e[23]=i,e[24]=g,e[25]=u,e[26]=l,e[27]=B):B=e[27],e[28]!==n.topLevelIds||e[29]!==T||e[30]!==L||e[31]!==B?(O=h.jsxs(d0,{id:T,items:M,strategy:r5,children:[L,B]}),e[28]=n.topLevelIds,e[29]=T,e[30]=L,e[31]=B,e[32]=O):O=e[32],e[33]!==s.width||e[34]!==n.id||e[35]!==o||e[36]!==O||e[37]!==x||e[38]!==y||e[39]!==S||e[40]!==I?(z=h.jsx(Ex,{columnId:b,index:o,canMoveLeft:x,canMoveRight:y,width:v,canDelete:S,footer:I,children:O}),e[33]=s.width,e[34]=n.id,e[35]=o,e[36]=O,e[37]=x,e[38]=y,e[39]=S,e[40]=I,e[41]=z):z=e[41],z},IM=t=>{const e=X.c(17),{columnId:n,className:o}=t,{createNewCell:r}=Ft(),s=We(Ms),[i,a]=UU(!1),l=We(lc);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Oe("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=c):c=e[0];const d=c;let u;e[1]!==l||e[2]!==s||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==a.toggle?(u=()=>i?h.jsx(VU,{onClose:a.toggle}):h.jsxs(h.Fragment,{children:[h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[h.jsx(Bp,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>{lr(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new na().defaultCode})},children:[h.jsx($p,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>{lr(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Ac().defaultCode})},children:[h.jsx(cr,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),h.jsx(Le,{content:l?null:h.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:h.jsxs(Pe,{className:d,variant:"text",size:"sm",disabled:!l,onClick:a.toggle,children:[h.jsx(Zi,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=i,e[6]=a.toggle,e[7]=u):u=e[7];const f=u,m=!i&&"w-fit",_=i&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,p,b;return e[8]!==o||e[9]!==m||e[10]!==_?(g=Oe("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,_,o),e[8]=o,e[9]=m,e[10]=_,e[11]=g):g=e[11],e[12]!==f?(p=f(),e[12]=f,e[13]=p):p=e[13],e[14]!==g||e[15]!==p?(b=h.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:h.jsx("div",{className:g,children:p})}),e[14]=g,e[15]=p,e[16]=b):b=e[16],b};function AM(){a4()}const Ix=t=>{const e=X.c(65),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;$U(B4,BN);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=Ft(),d=We(gm),u=We(HU),f=We(WU),m=xm(),_=en(bd),g=d.mode==="edit",p=d.mode==="present",b=We(qU);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0],A.useEffect(MM,x);const y=n.runtime.auto_instantiate;let v,S,k;e[1]!==i||e[2]!==_?(v=(ce,me)=>{i(ce);const de=ce.map(OM),ge=ce.map(DM),ie=ce.map(RM);_({names:de,codes:ge,configs:ie,layout:me})},e[1]=i,e[2]=_,e[3]=v):v=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(S=E4(),e[4]=S):S=e[4],e[5]!==v||e[6]!==n.runtime.auto_instantiate?(k={autoInstantiate:y,setCells:v,sessionId:S},e[5]=v,e[6]=n.runtime.auto_instantiate,e[7]=k):k=e[7];const{connection:E}=q$(k);let j,I;e[8]!==o.app_title||e[9]!==m?(j=()=>{document.title=o.app_title||jn.basename(m??"")||"Untitled Notebook"},I=[o.app_title,m],e[8]=o.app_title,e[9]=m,e[10]=j,e[11]=I):(j=e[10],I=e[11]),A.useEffect(j,I);const T=Dc(o.width);let M,L;e[12]!==o.width||e[13]!==a||e[14]!==T?(M=()=>{T==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=T,e[15]=M):M=e[15],e[16]!==o.width||e[17]!==a||e[18]!==u||e[19]!==T?(L=[o.width,T,a,u],e[16]=o.width,e[17]=a,e[18]=u,e[19]=T,e[20]=L):L=e[20],A.useEffect(M,L);const B=function(){const ce=X.c(2),me=id();let de;return ce[0]!==me?(de=()=>me(zF(fo())),ce[0]=me,ce[1]=de):de=ce[1],et(de)}(),O=eg(),z=rg();let F,V,P,C,$,N;e[21]!==B?(F=()=>{B()},e[21]=B,e[22]=F):F=e[22],Gt("global.runStale",F),Gt("global.interrupt",PM),e[23]!==z?(V=()=>{z()},e[23]=z,e[24]=V):V=e[24],Gt("global.hideCode",V),e[25]!==O?(P=()=>{O()},e[25]=O,e[26]=P):P=e[26],Gt("global.runAll",P),e[27]!==l?(C=()=>{l()},e[27]=l,e[28]=C):C=e[28],Gt("global.collapseAllSections",C),e[29]!==c?($=()=>{c()},e[29]=c,e[30]=$):$=e[30],Gt("global.expandAllSections",$),e[31]!==o||e[32]!==E||e[33]!==n||e[34]!==d.mode?(N=h.jsx(NM,{connStatus:E,mode:d.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=E,e[33]=n,e[34]=d.mode,e[35]=N):N=e[35];const H=N,Y=o.width;let Z,q,re,ne,oe,G,Q;return e[36]===Symbol.for("react.memo_cache_sentinel")?(Z=Oe("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=Z):Z=e[36],e[37]!==m||e[38]!==g?(q=g&&h.jsx("div",{className:"flex items-center justify-center container",children:h.jsx(FN,{filename:m})}),e[37]=m,e[38]=g,e[39]=q):q=e[39],e[40]!==E||e[41]!==q?(re=h.jsx(Y$,{connection:E,className:Z,children:q}),e[40]=E,e[41]=q,e[42]=re):re=e[42],e[43]!==o||e[44]!==H||e[45]!==f||e[46]!==d.mode?(ne=f&&h.jsx(G$,{appConfig:o,mode:d.mode,children:H}),e[43]=o,e[44]=H,e[45]=f,e[46]=d.mode,e[47]=ne):ne=e[47],e[48]!==o.width||e[49]!==E||e[50]!==b||e[51]!==re||e[52]!==ne?(oe=h.jsxs(J$,{connection:E,isRunning:b,width:Y,children:[re,ne]}),e[48]=o.width,e[49]=E,e[50]=b,e[51]=re,e[52]=ne,e[53]=oe):oe=e[53],e[54]!==o||e[55]!==E||e[56]!==s||e[57]!==p||e[58]!==b||e[59]!==B||e[60]!==z?(G=!s&&h.jsx(zc,{children:h.jsx(ON,{presenting:p,onTogglePresenting:z,onInterrupt:Bm,onRun:B,closed:E.state===xt.CLOSED,running:b,appConfig:o})}),e[54]=o,e[55]=E,e[56]=s,e[57]=p,e[58]=b,e[59]=B,e[60]=z,e[61]=G):G=e[61],e[62]!==oe||e[63]!==G?(Q=h.jsxs(h.Fragment,{children:[oe,G]}),e[62]=oe,e[63]=G,e[64]=Q):Q=e[64],Q};function TM(){IS.INSTANCE.stop()}function MM(){return IS.INSTANCE.start(GU),TM}function OM(t){return t.name}function DM(t){return t.code}function RM(t){return t.config}function PM(){Bm()}const LM=t=>{const e=X.c(17),[n,o]=A.useState(0),r=We(po);let s,i,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o(UM),i={delayMs:1e4,whenVisible:!0},e[0]=s,e[1]=i):(s=e[0],i=e[1]),xa(s,i),e[2]!==r.state?(a=async()=>Un()||r.state!==xt.OPEN?null:YU(),e[2]=r.state,e[3]=a):a=e[3],e[4]!==r.state||e[5]!==n?(l=[n,r.state],e[4]=r.state,e[5]=n,e[6]=l):l=e[6];const{data:c}=Hn(a,l);let d,u,f,m;return e[7]!==c?(d=(c==null?void 0:c.gpu)&&c.gpu.length>0&&h.jsx(BM,{gpus:c.gpu}),e[7]=c,e[8]=d):d=e[8],e[9]!==c?(u=c&&h.jsx(FM,{memory:c.memory,kernel:c.kernel,server:c.server}),e[9]=c,e[10]=u):u=e[10],e[11]!==c?(f=c&&h.jsx(zM,{cpu:c.cpu}),e[11]=c,e[12]=f):f=e[12],e[13]!==d||e[14]!==u||e[15]!==f?(m=h.jsxs("div",{className:"flex gap-2 items-center px-1",children:[d,u,f]}),e[13]=d,e[14]=u,e[15]=f,e[16]=m):m=e[16],m},FM=t=>{const e=X.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("b",{children:"computer memory:"}),e[2]=d):d=e[2];const u=i-a;let f,m,_,g,p,b,x,y,v;return e[3]!==u?(f=Hu(u),e[3]=u,e[4]=f):f=e[4],e[5]!==i?(m=Hu(i),e[5]=i,e[6]=m):m=e[6],e[7]!==c||e[8]!==f||e[9]!==m?(_=h.jsxs("span",{children:[d," ",f," / ",m," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=m,e[10]=_):_=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"marimo server:"})," ",El(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"kernel:"})," ",El(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==_||e[16]!==g||e[17]!==p?(b=h.jsxs("div",{className:"flex flex-col gap-1",children:[_,g,p]}),e[15]=_,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(Ep,{className:"w-4 h-4"}),e[19]=x):x=e[19],e[20]!==c?(y=h.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[x,h.jsx($u,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=y):y=e[21],e[22]!==y||e[23]!==b?(v=h.jsx(Le,{delayDuration:200,content:b,children:y}),e[22]=y,e[23]=b,e[24]=v):v=e[24],v},zM=t=>{const e=X.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(I$,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(c=h.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,h.jsx($u,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=h.jsx(Le,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d},BM=t=>{const e=X.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(VM,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c;return e[2]!==n?(s=n.map($M),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=h.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Ap,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=h.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[a,h.jsx($u,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(c=h.jsx(Le,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c},$u=t=>{const e=X.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=Oe("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=h.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:h.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function El(t){return t>1073741824?`${Hu(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Hu(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function UM(t){return t+1}function VM(t,e){return t+e.memory.percent}function $M(t){return h.jsxs("span",{children:[h.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",El(t.memory.used)," / ",El(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const Ax=t=>We(JU)[t.capability]?t.children:null,Jn=A.forwardRef((t,e)=>{const n=X.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-[var(--sage-3)]",c=i&&"bg-[var(--sage-4)]";let d,u;n[6]!==r||n[7]!==l||n[8]!==c?(d=Oe("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,c,r),n[6]=r,n[7]=l,n[8]=c,n[9]=d):d=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==d?(u=h.jsx("div",{ref:e,className:d,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=d,n[14]=u):u=n[14];const f=u;if(a){let m;return n[15]!==f||n[16]!==a?(m=h.jsx(Le,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=m):m=n[17],m}return f});Jn.displayName="FooterItem";const HM=()=>{var d;const t=X.c(14),e=We(U4),n=We(lc),o=((d=e==null?void 0:e.open_ai)==null?void 0:d.model)||"gpt-4-turbo",{handleClick:r}=wa();if(!n){let u,f,m;return t[0]!==r?(u=()=>r("ai"),t[0]=r,t[1]=u):u=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Zi,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==u?(m=h.jsx(Jn,{tooltip:"Assist is disabled",selected:!1,onClick:u,children:f}),t[3]=u,t[4]=m):m=t[4],m}let s,i,a,l,c;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(i=h.jsxs(h.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=i):i=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Zi,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==i||t[12]!==a?(c=h.jsx(Jn,{tooltip:i,onClick:a,selected:!1,children:l}),t[11]=i,t[12]=a,t[13]=c):c=t[13],c},WM=()=>{const t=X.c(26),e=We(po).state,n=Rm();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===xt.OPEN)try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(v){const S=v;return{isHealthy:!1,lastChecked:new Date,error:S instanceof Error?S.message:"Unknown error"}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{loading:s,error:i,data:a,reload:l}=Hn(o,r),c=e===xt.OPEN?3e4:null;let d,u;t[4]!==c?(d={delayMs:c,whenVisible:!0},t[4]=c,t[5]=d):d=t[5],xa(l,d),t[6]!==e||t[7]!==a||t[8]!==i?(u=()=>[nm(e.toLowerCase()),a!=null&&a.lastChecked?a.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",i?`Error: ${i}`:""].filter(Boolean).join(`
125
- `),t[6]=e,t[7]=a,t[8]=i,t[9]=u):u=t[9];const f=u;let m;t[10]!==e||t[11]!==(a==null?void 0:a.isHealthy)||t[12]!==(a==null?void 0:a.lastChecked)||t[13]!==s?(m=()=>s||e===xt.CONNECTING?h.jsx(eo,{size:"small"}):e===xt.CLOSING?h.jsx(eo,{className:"text-destructive",size:"small"}):e===xt.OPEN?a!=null&&a.isHealthy?h.jsx(Wc,{className:"w-4 h-4 text-[var(--green-9)]"}):a!=null&&a.lastChecked?h.jsx(z4,{className:"w-4 h-4 text-[var(--yellow-9)]"}):h.jsx(Wc,{className:"w-4 h-4"}):h.jsx(Zm,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=a==null?void 0:a.isHealthy,t[12]=a==null?void 0:a.lastChecked,t[13]=s,t[14]=m):m=t[14];const _=m,g=f();let p,b,x,y;return t[15]!==e?(p=e===xt.OPEN&&h.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==g||t[18]!==p?(b=h.jsxs("div",{className:"text-sm whitespace-pre-line",children:[g,p]}),t[17]=g,t[18]=p,t[19]=b):b=t[19],t[20]!==_?(x=_(),t[20]=_,t[21]=x):x=t[21],t[22]!==l||t[23]!==b||t[24]!==x?(y=h.jsx(Jn,{tooltip:b,selected:!1,onClick:l,children:x}),t[22]=l,t[23]=b,t[24]=x,t[25]=y):y=t[25],y},qM=t=>{const e=X.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},GM=Qt(t=>t(KU).completion.copilot),YM=()=>{const t=X.c(1);if(We(GM)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(JM,{}),t[0]=e):e=t[0],e}return null},Tx=Zt.get("[copilot-status-bar]"),JM=()=>{const t=We(_S),e=We(A$)!==null,{handleClick:n}=wa(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=en(_S),i=en(T$);return XU(()=>{const a=gS();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw Tx.error("Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Tx.warn("Connection failed",c),s(!1),i("connectionError"),lt({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:h.jsx(Pe,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),h.jsx(Jn,{tooltip:h.jsxs(h.Fragment,{children:[h.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,children:h.jsx("span",{children:e?h.jsx(eo,{className:"h-4 w-4"}):h.jsx(qM,{className:Oe("h-4 w-4",!t&&"opacity-60")})})})},KM=()=>{const t=X.c(13),e=We(rs),[n,o]=fn(I4),[r,s]=A.useState(!1);if(!_a()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,d,u,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Yp,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=h.jsx(Js,{asChild:!0,children:h.jsx(Jn,{tooltip:i,selected:!1,children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsxs("div",{className:"space-y-2",children:[h.jsx("h4",{className:"font-medium leading-none",children:"Username"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(d=m=>o(m.target.value),t[4]=o,t[5]=d):d=t[5],t[6]!==d||t[7]!==n?(u=h.jsx($s,{className:"w-80",children:h.jsxs("div",{className:"space-y-4",children:[c,h.jsx(hr,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:d,placeholder:"Enter your username"})]})}),t[6]=d,t[7]=n,t[8]=u):u=t[8],t[9]!==r||t[10]!==l||t[11]!==u?(f=h.jsxs(Lr,{open:r,onOpenChange:s,children:[l,u]}),t[9]=r,t[10]=l,t[11]=u,t[12]=f):f=t[12],f},XM=()=>{const t=X.c(56),{selectedPanel:e,isTerminalOpen:n}=yc(),{toggleApplication:o,toggleTerminal:r}=oa(),[s,i]=Rs(),a=We(ZU),l=ZM,c=hd.find(QM);let d;Bo(c,"Error panel not found"),t[0]!==r?(d=()=>{r()},t[0]=r,t[1]=d):d=t[1],Gt("global.toggleTerminal",d);const u=Jn,f=c.tooltip,m=e===c.type,_=()=>o(c.type),g=l(c,a>0?"text-destructive":"");let p,b,x,y,v;t[2]!==a?(p=h.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:a}),t[2]=a,t[3]=p):p=t[3],t[4]!==u||t[5]!==c||t[6]!==m||t[7]!==_||t[8]!==g||t[9]!==p?(b=h.jsxs(u,{tooltip:f,selected:m,onClick:_,children:[g,p]}),t[4]=u,t[5]=c,t[6]=m,t[7]=_,t[8]=g,t[9]=p,t[10]=b):b=t[10],t[11]!==r?(x=()=>r(),t[11]=r,t[12]=x):x=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(qp,{className:"h-5 w-5"}),t[13]=y):y=t[13],t[14]!==n||t[15]!==x?(v=h.jsx(Ax,{capability:"terminal",children:h.jsx(Jn,{tooltip:"Open terminal",selected:n,onClick:x,children:y})}),t[14]=n,t[15]=x,t[16]=v):v=t[16];const S=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let k,E,j;t[17]!==s||t[18]!==i?(k=async()=>{const q={...s,runtime:{...s.runtime,auto_instantiate:!s.runtime.auto_instantiate}};await Ps({config:q}).then(()=>i(q))},t[17]=s,t[18]=i,t[19]=k):k=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx("span",{children:"on startup: "}),t[20]=E):E=t[20],t[21]!==s.runtime.auto_instantiate?(j=s.runtime.auto_instantiate?h.jsx(yr,{size:14}):h.jsx(br,{size:14}),t[21]=s.runtime.auto_instantiate,t[22]=j):j=t[22];const I=s.runtime.auto_instantiate?"autorun":"lazy";let T,M,L,B;t[23]!==I?(T=h.jsx("span",{children:I}),t[23]=I,t[24]=T):T=t[24],t[25]!==j||t[26]!==T?(M=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[E,j,T]}),t[25]=j,t[26]=T,t[27]=M):M=t[27],t[28]!==S||t[29]!==k||t[30]!==M?(L=h.jsx(Jn,{tooltip:S,selected:!1,onClick:k,children:M}),t[28]=S,t[29]=k,t[30]=M,t[31]=L):L=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[32]=B):B=t[32];const O=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let z,F,V,P,C,$,N,H,Y,Z;return t[33]!==s||t[34]!==i?(z=async()=>{const q={...s,runtime:{...s.runtime,on_cell_change:s.runtime.on_cell_change==="autorun"?"lazy":"autorun"}};await Ps({config:q}).then(()=>i(q))},t[33]=s,t[34]=i,t[35]=z):z=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx("span",{children:"on cell change: "}),t[36]=F):F=t[36],t[37]!==s.runtime.on_cell_change?(V=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[F,s.runtime.on_cell_change==="autorun"?h.jsx(yr,{size:14}):h.jsx(br,{size:14}),h.jsx("span",{children:s.runtime.on_cell_change})]}),t[37]=s.runtime.on_cell_change,t[38]=V):V=t[38],t[39]!==O||t[40]!==z||t[41]!==V?(P=h.jsx(Jn,{tooltip:O,selected:!1,onClick:z,children:V}),t[39]=O,t[40]=z,t[41]=V,t[42]=P):P=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[43]=C):C=t[43],t[44]!==s||t[45]!==i?($=!Un()&&h.jsx(Jn,{tooltip:null,selected:!1,children:h.jsxs(gc,{children:[h.jsxs(_c,{className:"font-prose text-sm flex items-center gap-1",children:[h.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&h.jsx(Zm,{size:14}),s.runtime.auto_reload==="lazy"&&h.jsx(br,{size:14}),s.runtime.auto_reload==="autorun"&&h.jsx(yr,{size:14}),h.jsx("span",{children:s.runtime.auto_reload}),h.jsx(Qi,{size:14})]}),h.jsx(bc,{children:["off","lazy","autorun"].map(q=>h.jsxs(sn,{onClick:async()=>{const re={...s,runtime:{...s.runtime,auto_reload:q}};await Ps({config:re}).then(()=>i(re))},children:[q==="off"&&h.jsx(Zm,{size:14,className:"mr-2 text-muted-foreground"}),q==="lazy"&&h.jsx(br,{size:14,className:"mr-2 text-muted-foreground"}),q==="autorun"&&h.jsx(yr,{size:14,className:"mr-2 text-muted-foreground"}),q]},q))})]})}),t[44]=s,t[45]=i,t[46]=$):$=t[46],t[47]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("div",{className:"mx-auto"}),t[47]=N):N=t[47],t[48]===Symbol.for("react.memo_cache_sentinel")?(H=h.jsx(gN,{children:h.jsx(Le,{content:h.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:h.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[48]=H):H=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(Y=h.jsxs("div",{className:"flex items-center",children:[h.jsx(LM,{}),h.jsx(HM,{}),h.jsx(YM,{}),h.jsx(KM,{}),h.jsx(WM,{})]}),t[49]=Y):Y=t[49],t[50]!==v||t[51]!==L||t[52]!==P||t[53]!==$||t[54]!==b?(Z=h.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen",children:[b,v,L,B,P,C,$,N,H,Y]}),t[50]=v,t[51]=L,t[52]=P,t[53]=$,t[54]=b,t[55]=Z):Z=t[55],Z};function ZM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function QM(t){return t.type==="errors"}const eO=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Vn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(h.jsx(tO,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=h.jsx(V4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},tO=t=>{const e=X.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const u=new FormData(d.target),f=u.get("rating"),m=u.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),lt({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(ur,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsxs("li",{className:"my-0",children:["Take our"," ",h.jsx("a",{href:Zn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("li",{className:"my-0",children:["File a"," ",h.jsx("a",{href:Zn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Ds,{children:[r,h.jsxs(Ls,{children:[s,h.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,h.jsxs("li",{className:"my-0",children:["Chat with us on"," ",h.jsx("a",{href:Zn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=h.jsx(dr,{className:"w-fit",children:h.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},nO=()=>{const t=X.c(10),{selectedPanel:e}=yc(),{toggleApplication:n}=oa(),o=rO;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=hd.filter(sO).map(d=>h.jsx(Mx,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(eO,{children:h.jsx(Mx,{tooltip:"Send feedback!",selected:!1,children:h.jsx(Ip,{className:"h-5 w-5"})})}),a=h.jsx("div",{className:"flex-1"}),l=h.jsx(oO,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=h.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},oO=()=>{const t=X.c(7),e=We(QU);let n,o,r;return t[0]!==e?(n=e>0?h.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=h.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(iO)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=h.jsx(Le,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Mx=t=>{const e=X.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let c,d,u;return e[6]!==o||e[7]!==a||e[8]!==l?(c=Oe("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=h.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==i?(u=h.jsx(Le,{content:i,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=i,e[16]=u):u=e[16],u};function rO(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function sO(t){return!t.hidden&&t.position==="sidebar"}function iO(t,e){return h.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}let Ox;An=t=>{const e=X.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,d,u;return e[0]!==r?(i=r&&K.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=h.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=h.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(d=s&&h.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(u=h.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=u):u=e[14],u},Ox=()=>{const t=X.c(5),e=eV();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(An,{title:"No errors!",icon:h.jsx(Dp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(aO),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function aO(t){return h.jsxs("div",{children:[h.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:h.jsx(tV,{cellId:t.cellId})}),h.jsx("div",{className:"px-2",children:h.jsx(nV,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const lO=()=>{const t=X.c(6),{items:e}=We(oV);let n,o;t[0]!==e?(o=K$(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s}=X$(r);if(e.length===0){let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(An,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:h.jsx(nd,{})}),t[2]=a):a=t[2],a}let i;return t[3]!==s||t[4]!==e?(i=h.jsx(Z$,{items:e,activeHeaderId:s}),t[3]=s,t[4]=e,t[5]=i):i=t[5],i};function un(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=un(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:cO}=K,{useSyncExternalStoreWithSelector:dO}=rV,uO=t=>t;function Dx(t,e=uO,n){const o=dO(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return cO(o),o}const Rx=(t,e)=>{const n=sV(t),o=(r,s=e)=>Dx(n,r,s);return Object.assign(o,n),o};function nn(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function io(t,e){if(t=function(s){let i;for(;i=s.sourceEvent;)s=i;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const hO={passive:!1},Di={capture:!0,passive:!1};function Wu(t){t.stopImmediatePropagation()}function is(t){t.preventDefault(),t.stopImmediatePropagation()}function Px(t){var e=t.document.documentElement,n=to(t).on("dragstart.drag",is,Di);"onselectstart"in e?n.on("selectstart.drag",is,Di):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Lx(t,e){var n=t.document.documentElement,o=to(t).on("dragstart.drag",null);e&&(o.on("click.drag",is,Di),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 Il=t=>()=>t;function qu(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function fO(t){return!t.ctrlKey&&!t.button}function mO(){return this.parentNode}function pO(t,e){return e??{x:t.x,y:t.y}}function gO(){return navigator.maxTouchPoints||"ontouchstart"in this}qu.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Al=t=>()=>t;function _O(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 Gu(t){t.stopImmediatePropagation()}function Ri(t){t.preventDefault(),t.stopImmediatePropagation()}function bO(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function yO(){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 Fx(){return this.__zoom||_r}function xO(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function wO(){return navigator.maxTouchPoints||"ontouchstart"in this}function vO(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}const Tl=A.createContext(null),kO=Tl.Provider,SO=t=>`Node type "${t}" not found. Using fallback type "default".`,CO=()=>"The React Flow parent container needs a width and a height to render the graph.",NO=()=>"Only child nodes can use a parent extent.",jO=t=>`Marker type "${t}" doesn't exist.`,EO=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,IO=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",AO=t=>`Edge type "${t}" not found. Using fallback type "default".`,TO=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.`,zx="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function mt(t,e){const n=A.useContext(Tl);if(n===null)throw new Error(zx);return Dx(n,t,e)}const qt=()=>{const t=A.useContext(Tl);if(t===null)throw new Error(zx);return A.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},MO=t=>t.userSelectionActive?"none":"all";function Ml({position:t,children:e,className:n,style:o,...r}){const s=mt(MO),i=`${t}`.split("-");return K.createElement("div",{className:un(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function OO({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Ml,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var DO=A.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d})=>{const u=A.useRef(null),[f,m]=A.useState({x:0,y:0,width:0,height:0}),_=un(["react-flow__edge-textwrapper",c]);return A.useEffect(()=>{if(u.current){const g=u.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&K.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:u,style:o},n),l):null});const Yu=t=>({width:t.offsetWidth,height:t.offsetHeight}),as=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Ju=(t={x:0,y:0},e)=>({x:as(t.x,e[0][0],e[1][0]),y:as(t.y,e[0][1],e[1][1])}),Bx=(t,e,n)=>t<e?as(Math.abs(t-e),1,50)/50:t>n?-as(Math.abs(t-n),1,50)/50:0,Ux=(t,e)=>[20*Bx(t.x,35,e.width-35),20*Bx(t.y,35,e.height-35)],Vx=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Ku=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),$x=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Xu=(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)},Pn=t=>!isNaN(t)&&isFinite(t),jt=Symbol.for("internals"),Hx=["Enter"," ","Escape"];function Zu(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 Wx=t=>"clientX"in t,Qo=(t,e)=>{var s,i;const n=Wx(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Ol=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Pi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:u,markerStart:f}),m&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Pn(n)&&Pn(o)?K.createElement(DO,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Li(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function qx({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,i=Math.abs(o-e)/2;return[s,o<e?o+i:o-i,r,i]}function Gx({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var Ar,Yx,er,Qu,Fi,Jx,tr,zi,ls,Kx,$e,Dl;function Xx({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===$e.Left||t===$e.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Zx({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top}){const[i,a]=Xx({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Xx({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,u,f,m]=Gx({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,d,u,f,m]}Pi.displayName="BaseEdge",(Yx=Ar||(Ar={})).Strict="strict",Yx.Loose="loose",(Qu=er||(er={})).Free="free",Qu.Vertical="vertical",Qu.Horizontal="horizontal",(Jx=Fi||(Fi={})).Partial="partial",Jx.Full="full",(zi=tr||(tr={})).Bezier="default",zi.Straight="straight",zi.Step="step",zi.SmoothStep="smoothstep",zi.SimpleBezier="simplebezier",(Kx=ls||(ls={})).Arrow="arrow",Kx.ArrowClosed="arrowclosed",(Dl=$e||($e={})).Left="left",Dl.Top="top",Dl.Right="right",Dl.Bottom="bottom";const eh=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:g})=>{const[p,b,x]=Zx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return K.createElement(Pi,{path:p,labelX:b,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:g})});eh.displayName="SimpleBezierEdge";const Qx={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},ew=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function RO({source:t,sourcePosition:e=$e.Bottom,target:n,targetPosition:o=$e.Top,center:r,offset:s}){const i=Qx[e],a=Qx[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},d=(({source:k,sourcePosition:E=$e.Bottom,target:j})=>E===$e.Left||E===$e.Right?k.x<j.x?{x:1,y:0}:{x:-1,y:0}:k.y<j.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),u=d.x!==0?"x":"y",f=d[u];let m,_,g=[];const p={x:0,y:0},b={x:0,y:0},[x,y,v,S]=qx({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[u]*a[u]==-1){m=r.x??x,_=r.y??y;const k=[{x:m,y:l.y},{x:m,y:c.y}],E=[{x:l.x,y:_},{x:c.x,y:_}];g=i[u]===f?u==="x"?k:E:u==="x"?E:k}else{const k=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(g=u==="x"?i.x===f?E:k:i.y===f?k:E,e===o){const T=Math.abs(t[u]-n[u]);if(T<=s){const M=Math.min(s-1,s-T);i[u]===f?p[u]=(l[u]>t[u]?-1:1)*M:b[u]=(c[u]>n[u]?-1:1)*M}}if(e!==o){const T=u==="x"?"y":"x",M=i[u]===a[T],L=l[T]>c[T],B=l[T]<c[T];(i[u]===1&&(!M&&L||M&&B)||i[u]!==1&&(!M&&B||M&&L))&&(g=u==="x"?k:E)}const j={x:l.x+p.x,y:l.y+p.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(j.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(j.y-g[0].y),Math.abs(I.y-g[0].y))?(m=(j.x+I.x)/2,_=g[0].y):(m=g[0].x,_=(j.y+I.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:c.x+b.x,y:c.y+b.y},n],m,_,v,S]}function th({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,u,f,m,_]=RO({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[d.reduce((g,p,b)=>{let x="";return x=b>0&&b<d.length-1?function(y,v,S,k){const E=Math.min(ew(y,v)/2,ew(v,S)/2,k),{x:j,y:I}=v;if(y.x===j&&j===S.x||y.y===I&&I===S.y)return`L${j} ${I}`;if(y.y===I)return`L ${j+E*(y.x<S.x?-1:1)},${I}Q ${j},${I} ${j},${I+E*(y.y<S.y?1:-1)}`;const T=y.x<S.x?1:-1;return`L ${j},${I+E*(y.y<S.y?-1:1)}Q ${j},${I} ${j+E*T},${I}`}(d[b-1],p,d[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=x},""),u,f,m,_]}const Rl=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:u=$e.Bottom,targetPosition:f=$e.Top,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=th({sourceX:t,sourceY:e,sourcePosition:u,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return K.createElement(Pi,{path:b,labelX:x,labelY:y,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:_,interactionWidth:p})});Rl.displayName="SmoothStepEdge";const nh=A.memo(t=>{var e;return K.createElement(Rl,{...t,pathOptions:A.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});nh.displayName="StepEdge";const oh=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m})=>{const[_,g,p]=function({sourceX:b,sourceY:x,targetX:y,targetY:v}){const[S,k,E,j]=qx({sourceX:b,sourceY:x,targetX:y,targetY:v});return[`M ${b},${x}L ${y},${v}`,S,k,E,j]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Pi,{path:_,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m})});function Pl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function tw({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case $e.Left:return[e-Pl(e-o,s),n];case $e.Right:return[e+Pl(o-e,s),n];case $e.Top:return[e,n-Pl(n-r,s)];case $e.Bottom:return[e,n+Pl(r-n,s)]}}function nw({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,curvature:i=.25}){const[a,l]=tw({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=tw({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[u,f,m,_]=Gx({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${o},${r}`,u,f,m,_]}oh.displayName="StraightEdge";const Ll=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=nw({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return K.createElement(Pi,{path:b,labelX:x,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:p})});Ll.displayName="BezierEdge";const rh=A.createContext(null),PO=rh.Provider;rh.Consumer;const LO=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,sh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,ih=({x:t,y:e},[n,o,r],s,[i,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},ow=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),cs=(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}},ah=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:i}=cs(r,e).positionAbsolute;return a=o,l=Ku({x:s,y:i,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:i})=>({x:o,y:r,width:s-o,height:i-r}))(n)},rw=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(d=>{const{width:u,height:f,selectable:m=!0,hidden:_=!1}=d;if(i&&!m||_)return!1;const{positionAbsolute:g}=cs(d,a),p={x:g.x,y:g.y,width:u||0,height:f||0},b=Xu(l,p);(u===void 0||f===void 0||u===null||f===null||s&&b>0||b>=(u||0)*(f||0)||d.dragging)&&c.push(d)}),c},sw=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},iw=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=as(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Tr=(t,e=0)=>t.transition().duration(e);function aw(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var i,a;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+s.y+s.height/2}),r},[])}const FO={source:null,target:null,sourceHandle:null,targetHandle:null},lw=()=>({handleDomNode:null,isValid:!1,connection:FO,endHandle:null});function cw(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...lw(),handleDomNode:l};if(l){const d=lh(void 0,l),u=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?u:n,sourceHandle:a?f:o,target:a?n:u,targetHandle:a?o:f};c.connection=g,m&&_&&(e===Ar.Strict?a&&d==="source"||!a&&d==="target":u!==n||f!==o)&&(c.endHandle={nodeId:u,handleId:f,type:d},c.isValid=s(g))}return c}function lh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function ch(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function zO(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function dw({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=Vx(t.target),{connectionMode:u,domNode:f,autoPanOnConnect:m,connectionRadius:_,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:x}=s();let y,v=0;const{x:S,y:k}=Qo(t),E=d==null?void 0:d.elementFromPoint(S,k),j=lh(l,E),I=f==null?void 0:f.getBoundingClientRect();if(!I||!j)return;let T,M=Qo(t,I),L=!1,B=null,O=!1,z=null;const F=function({nodes:$,nodeId:N,handleId:H,handleType:Y}){return $.reduce((Z,q)=>{if(q[jt]){const{handleBounds:re}=q[jt];let ne=[],oe=[];re&&(ne=aw(q,re,"source",`${N}-${H}-${Y}`),oe=aw(q,re,"target",`${N}-${H}-${Y}`)),Z.push(...ne,...oe)}return Z},[])}({nodes:b(),nodeId:n,handleId:e,handleType:j}),V=()=>{if(!m)return;const[$,N]=Ux(M,I);p({x:$,y:N}),v=requestAnimationFrame(V)};function P($){const{transform:N}=s();M=Qo($,I);const{handle:H,validHandleResult:Y}=function(Z,q,re,ne,oe,G){const{x:Q,y:ce}=Qo(Z),me=q.elementsFromPoint(Q,ce).find(we=>we.classList.contains("react-flow__handle"));if(me){const we=me.getAttribute("data-nodeid");if(we){const ae=lh(void 0,me),Se=me.getAttribute("data-handleid"),pe=G({nodeId:we,id:Se,type:ae});if(pe){const Te=oe.find(Re=>Re.nodeId===we&&Re.type===ae&&Re.id===Se);return{handle:{id:Se,type:ae,nodeId:we,x:(Te==null?void 0:Te.x)||re.x,y:(Te==null?void 0:Te.y)||re.y},validHandleResult:pe}}}}let de=[],ge=1/0;if(oe.forEach(we=>{const ae=Math.sqrt((we.x-re.x)**2+(we.y-re.y)**2);if(ae<=ne){const Se=G(we);ae<=ge&&(ae<ge?de=[{handle:we,validHandleResult:Se}]:ae===ge&&de.push({handle:we,validHandleResult:Se}),ge=ae)}}),!de.length)return{handle:null,validHandleResult:lw()};if(de.length===1)return de[0];const ie=de.some(({validHandleResult:we})=>we.isValid),xe=de.some(({handle:we})=>we.type==="target");return de.find(({handle:we,validHandleResult:ae})=>xe?we.type==="target":!ie||ae.isValid)||de[0]}($,d,ih(M,N,!1,[1,1]),_,F,Z=>cw(Z,u,n,e,r?"target":"source",a,d));if(y=H,L||(V(),L=!0),z=Y.handleDomNode,B=Y.connection,O=Y.isValid,i({connectionPosition:y&&O?ow({x:y.x,y:y.y},N):M,connectionStatus:zO(!!y,O),connectionEndHandle:Y.endHandle}),!y&&!O&&!z)return ch(T);B.source!==B.target&&z&&(ch(T),T=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",O),z.classList.toggle("react-flow__handle-valid",O))}function C($){var N,H;(y||z)&&B&&O&&(o==null||o(B)),(H=(N=s()).onConnectEnd)==null||H.call(N,$),l&&(c==null||c($)),ch(T),x(),cancelAnimationFrame(v),L=!1,O=!1,B=null,z=null,d.removeEventListener("mousemove",P),d.removeEventListener("mouseup",C),d.removeEventListener("touchmove",P),d.removeEventListener("touchend",C)}i({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:j,connectionStartHandle:{nodeId:n,handleId:e,type:j},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:j}),d.addEventListener("mousemove",P),d.addEventListener("mouseup",C),d.addEventListener("touchmove",P),d.addEventListener("touchend",C)}const uw=()=>!0,BO=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),hw=A.forwardRef(({type:t="source",position:e=$e.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...f},m)=>{var j,I;const _=i||null,g=t==="target",p=qt(),b=A.useContext(rh),{connectOnClick:x,noPanClassName:y}=mt(BO,nn),{connecting:v,clickConnecting:S}=mt(((T,M,L)=>B=>{const{connectionStartHandle:O,connectionEndHandle:z,connectionClickStartHandle:F}=B;return{connecting:(O==null?void 0:O.nodeId)===T&&(O==null?void 0:O.handleId)===M&&(O==null?void 0:O.type)===L||(z==null?void 0:z.nodeId)===T&&(z==null?void 0:z.handleId)===M&&(z==null?void 0:z.type)===L,clickConnecting:(F==null?void 0:F.nodeId)===T&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===L}})(b,_,t),nn);b||((I=(j=p.getState()).onError)==null||I.call(j,"010",IO()));const k=T=>{const{defaultEdgeOptions:M,onConnect:L,hasDefaultEdges:B}=p.getState(),O={...M,...T};if(B){const{edges:z,setEdges:F}=p.getState();F(((V,P)=>{if(!V.source||!V.target)return P;let C;return C=($=>"id"in $&&"source"in $&&"target"in $)(V)?{...V}:{...V,id:LO(V)},(($,N)=>N.some(H=>!(H.source!==$.source||H.target!==$.target||H.sourceHandle!==$.sourceHandle&&(H.sourceHandle||$.sourceHandle)||H.targetHandle!==$.targetHandle&&(H.targetHandle||$.targetHandle))))(C,P)?P:P.concat(C)})(O,z))}L==null||L(O),a==null||a(O)},E=T=>{if(!b)return;const M=Wx(T);r&&(M&&T.button===0||!M)&&dw({event:T,handleId:_,nodeId:b,onConnect:k,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||uw}),M?d==null||d(T):u==null||u(T)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:un(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",y,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:S,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:E,onTouchStart:E,onClick:x?T=>{const{onClickConnectStart:M,onClickConnectEnd:L,connectionClickStartHandle:B,connectionMode:O,isValidConnection:z}=p.getState();if(!b||!B&&!r)return;if(!B)return M==null||M(T,{nodeId:b,handleId:_,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const F=Vx(T.target),V=n||z||uw,{connection:P,isValid:C}=cw({nodeId:b,id:_,type:t},O,B.nodeId,B.handleId||null,B.type,V,F);C&&k(P),L==null||L(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});hw.displayName="Handle";var nr=A.memo(hw);const fw=({data:t,isConnectable:e,targetPosition:n=$e.Top,sourcePosition:o=$e.Bottom})=>K.createElement(K.Fragment,null,K.createElement(nr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(nr,{type:"source",position:o,isConnectable:e}));fw.displayName="DefaultNode";var dh=A.memo(fw);const mw=({data:t,isConnectable:e,sourcePosition:n=$e.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(nr,{type:"source",position:n,isConnectable:e}));mw.displayName="InputNode";var pw=A.memo(mw);const gw=({data:t,isConnectable:e,targetPosition:n=$e.Top})=>K.createElement(K.Fragment,null,K.createElement(nr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);gw.displayName="OutputNode";var _w=A.memo(gw);const uh=()=>null;uh.displayName="GroupNode";const UO=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Fl=t=>t.id;function VO(t,e){return nn(t.selectedNodes.map(Fl),e.selectedNodes.map(Fl))&&nn(t.selectedEdges.map(Fl),e.selectedEdges.map(Fl))}const bw=A.memo(({onSelectionChange:t})=>{const e=qt(),{selectedNodes:n,selectedEdges:o}=mt(UO,VO);return A.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});bw.displayName="SelectionListener";const $O=t=>!!t.onSelectionChange;function HO({onSelectionChange:t}){const e=mt($O);return t||e?K.createElement(bw,{onSelectionChange:t}):null}const WO=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 ds(t,e){A.useEffect(()=>{t!==void 0&&e(t)},[t])}function at(t,e,n){A.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const qO=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:u,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:_,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:x,onEdgesChange:y,elementsSelectable:v,connectionMode:S,snapGrid:k,snapToGrid:E,translateExtent:j,connectOnClick:I,defaultEdgeOptions:T,fitView:M,fitViewOptions:L,onNodesDelete:B,onEdgesDelete:O,onNodeDrag:z,onNodeDragStart:F,onNodeDragStop:V,onSelectionDrag:P,onSelectionDragStart:C,onSelectionDragStop:$,noPanClassName:N,nodeOrigin:H,rfId:Y,autoPanOnConnect:Z,autoPanOnNodeDrag:q,onError:re,connectionRadius:ne,isValidConnection:oe,nodeDragThreshold:G})=>{const{setNodes:Q,setEdges:ce,setDefaultNodesAndEdges:me,setMinZoom:de,setMaxZoom:ge,setTranslateExtent:ie,setNodeExtent:xe,reset:we}=mt(WO,nn),ae=qt();return A.useEffect(()=>{const Se=o==null?void 0:o.map(pe=>({...pe,...T}));return me(n,Se),()=>{we()}},[]),at("defaultEdgeOptions",T,ae.setState),at("connectionMode",S,ae.setState),at("onConnect",r,ae.setState),at("onConnectStart",s,ae.setState),at("onConnectEnd",i,ae.setState),at("onClickConnectStart",a,ae.setState),at("onClickConnectEnd",l,ae.setState),at("nodesDraggable",c,ae.setState),at("nodesConnectable",d,ae.setState),at("nodesFocusable",u,ae.setState),at("edgesFocusable",f,ae.setState),at("edgesUpdatable",m,ae.setState),at("elementsSelectable",v,ae.setState),at("elevateNodesOnSelect",_,ae.setState),at("snapToGrid",E,ae.setState),at("snapGrid",k,ae.setState),at("onNodesChange",x,ae.setState),at("onEdgesChange",y,ae.setState),at("connectOnClick",I,ae.setState),at("fitViewOnInit",M,ae.setState),at("fitViewOnInitOptions",L,ae.setState),at("onNodesDelete",B,ae.setState),at("onEdgesDelete",O,ae.setState),at("onNodeDrag",z,ae.setState),at("onNodeDragStart",F,ae.setState),at("onNodeDragStop",V,ae.setState),at("onSelectionDrag",P,ae.setState),at("onSelectionDragStart",C,ae.setState),at("onSelectionDragStop",$,ae.setState),at("noPanClassName",N,ae.setState),at("nodeOrigin",H,ae.setState),at("rfId",Y,ae.setState),at("autoPanOnConnect",Z,ae.setState),at("autoPanOnNodeDrag",q,ae.setState),at("onError",re,ae.setState),at("connectionRadius",ne,ae.setState),at("isValidConnection",oe,ae.setState),at("nodeDragThreshold",G,ae.setState),ds(t,Q),ds(e,ce),ds(g,de),ds(p,ge),ds(j,ie),ds(b,xe),null},yw={display:"none"},GO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},xw="react-flow__node-desc",ww="react-flow__edge-desc",YO=t=>t.ariaLiveMessage;function JO({rfId:t}){const e=mt(YO);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:GO},e)}function KO({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${xw}-${t}`,style:yw},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),K.createElement("div",{id:`${ww}-${t}`,style:yw},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(JO,{rfId:t}))}var Bi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=A.useState(!1),r=A.useRef(!1),s=A.useRef(new Set([])),[i,a]=A.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=l.reduce((d,u)=>d.concat(...u),[]);return[l,c]}return[[],[]]},[t]);return A.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const d=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Zu(m))return!1;const _=kw(m.code,a);s.current.add(m[_]),vw(i,s.current,!1)&&(m.preventDefault(),o(!0))},u=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Zu(m))return!1;const _=kw(m.code,a);vw(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[_]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f)}}},[t,o]),n};function vw(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function kw(t,e){return e.includes(t)?"code":"key"}function Sw(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=cs(s,o);return Sw(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[jt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[jt])==null?void 0:l.z)??0:n.z??0},o)}function Cw(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:i,y:a,z:l}=Sw(o,t,{...o.position,z:((s=o[jt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[jt].z=l,n!=null&&n[o.id]&&(o[jt].isParent=!0)}})}function hh(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(Pn(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),d={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},u=a.parentNode||a.parentId;u&&(s[u]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(d,jt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[jt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,d)}),Cw(r,n,s),r}function Nw(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const 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(x=>x.id===g.id):p}),_=m.every(g=>g.width&&g.height);if(m.length>0&&_){const g=ah(m,u),{x:p,y:b,zoom:x}=iw(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=_r.translate(p,b).scale(x);return typeof e.duration=="number"&&e.duration>0?a.transform(Tr(l,e.duration),y):a.transform(l,y),!0}}return!1}function XO(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[jt]:o[jt],selected:n.selected})}),new Map(e)}function ZO(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function zl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:XO(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:ZO(e,s)}),a==null||a(e))}const us=()=>{},QO={zoomIn:us,zoomOut:us,zoomTo:us,getZoom:()=>1,setViewport:us,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:us,fitBounds:us,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},e9=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Ui(){const t=(()=>{const g=qt(),{d3Zoom:p,d3Selection:b}=mt(e9,nn);return A.useMemo(()=>b&&p?{zoomIn:y=>p.scaleBy(Tr(b,y==null?void 0:y.duration),1.2),zoomOut:y=>p.scaleBy(Tr(b,y==null?void 0:y.duration),1/1.2),zoomTo:(y,v)=>p.scaleTo(Tr(b,v==null?void 0:v.duration),y),getZoom:()=>g.getState().transform[2],setViewport:(y,v)=>{const[S,k,E]=g.getState().transform,j=_r.translate(y.x??S,y.y??k).scale(y.zoom??E);p.transform(Tr(b,v==null?void 0:v.duration),j)},getViewport:()=>{const[y,v,S]=g.getState().transform;return{x:y,y:v,zoom:S}},fitView:y=>Nw(g.getState,y),setCenter:(y,v,S)=>{const{width:k,height:E,maxZoom:j}=g.getState(),I=(S==null?void 0:S.zoom)!==void 0?S.zoom:j,T=k/2-y*I,M=E/2-v*I,L=_r.translate(T,M).scale(I);p.transform(Tr(b,S==null?void 0:S.duration),L)},fitBounds:(y,v)=>{const{width:S,height:k,minZoom:E,maxZoom:j}=g.getState(),{x:I,y:T,zoom:M}=iw(y,S,k,E,j,(v==null?void 0:v.padding)??.1),L=_r.translate(I,T).scale(M);p.transform(Tr(b,v==null?void 0:v.duration),L)},project:y=>{const{transform:v,snapToGrid:S,snapGrid:k}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),ih(y,v,S,k)},screenToFlowPosition:y=>{const{transform:v,snapToGrid:S,snapGrid:k,domNode:E}=g.getState();if(!E)return y;const{x:j,y:I}=E.getBoundingClientRect(),T={x:y.x-j,y:y.y-I};return ih(T,v,S,k)},flowToScreenPosition:y=>{const{transform:v,domNode:S}=g.getState();if(!S)return y;const{x:k,y:E}=S.getBoundingClientRect(),j=ow(y,v);return{x:j.x+k,y:j.y+E}},viewportInitialized:!0}:QO,[p,b])})(),e=qt(),n=A.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=A.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=A.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=A.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),i=A.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:x,onNodesChange:y}=e.getState(),v=p(),S=typeof g=="function"?g(v):g;if(x)b(S);else if(y){const k=S.length===0?v.map(E=>({type:"remove",id:E.id})):S.map(E=>({item:E,type:"reset"}));y(k)}},[]),a=A.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:x,onEdgesChange:y}=e.getState(),v=typeof g=="function"?g(p):g;x?b(v):y&&y(v.length===0?p.map(S=>({type:"remove",id:S.id})):v.map(S=>({item:S,type:"reset"})))},[]),l=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:x,hasDefaultNodes:y,onNodesChange:v}=e.getState();if(y)x([...b(),...p]);else if(v){const S=p.map(k=>({item:k,type:"add"}));v(S)}},[]),c=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:x,hasDefaultEdges:y,onEdgesChange:v}=e.getState();y?x([...b,...p]):v&&v(p.map(S=>({item:S,type:"add"})))},[]),d=A.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[x,y,v]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x,y,zoom:v}}},[]),u=A.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:x,edges:y,hasDefaultNodes:v,hasDefaultEdges:S,onNodesDelete:k,onEdgesDelete:E,onNodesChange:j,onEdgesChange:I}=e.getState(),T=(g||[]).map(z=>z.id),M=(p||[]).map(z=>z.id),L=x().reduce((z,F)=>{const V=F.parentNode||F.parentId,P=!T.includes(F.id)&&V&&z.find(C=>C.id===V);return(typeof F.deletable!="boolean"||F.deletable)&&(T.includes(F.id)||P)&&z.push(F),z},[]),B=y.filter(z=>typeof z.deletable!="boolean"||z.deletable),O=B.filter(z=>M.includes(z.id));if(L||O){const z=sw(L,B),F=[...O,...z],V=F.reduce((P,C)=>(P.includes(C.id)||P.push(C.id),P),[]);(S||v)&&(S&&e.setState({edges:y.filter(P=>!V.includes(P.id))}),v&&(L.forEach(P=>{b.delete(P.id)}),e.setState({nodeInternals:new Map(b)}))),V.length>0&&(E==null||E(F),I&&I(V.map(P=>({id:P,type:"remove"})))),L.length>0&&(k==null||k(L),j)&&j(L.map(P=>({id:P.id,type:"remove"})))}},[]),f=A.useCallback(g=>{const p=Pn((b=g).width)&&Pn(b.height)&&Pn(b.x)&&Pn(b.y);var b;const x=p?null:e.getState().nodeInternals.get(g.id);return!p&&!x?[null,null,p]:[p?g:$x(x),x,p]},[]),m=A.useCallback((g,p=!0,b)=>{const[x,y,v]=f(g);return x?(b||e.getState().getNodes()).filter(S=>{if(!(v||S.id!==y.id&&S.positionAbsolute))return!1;const k=$x(S),E=Xu(k,x);return p&&E>0||E>=x.width*x.height}):[]},[]),_=A.useCallback((g,p,b=!0)=>{const[x]=f(g);if(!x)return!1;const y=Xu(x,p);return b&&y>0||y>=x.width*x.height},[]);return A.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:u,getIntersectingNodes:m,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,d,u,m,_])}const t9={actInsideInputWithModifier:!1},fh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Bl=t=>({x:t.x,y:t.y,zoom:t.k}),hs=(t,e)=>t.target.closest(`.${e}`),jw=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Ew=t=>{const e=t.ctrlKey&&Ol()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},n9=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),o9=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=er.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:u=!0,defaultViewport:f,translateExtent:m,minZoom:_,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:x,noWheelClassName:y,noPanClassName:v})=>{const S=A.useRef(),k=qt(),E=A.useRef(!1),j=A.useRef(!1),I=A.useRef(null),T=A.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:L,d3ZoomHandler:B,userSelectionActive:O}=mt(n9,nn),z=Bi(p),F=A.useRef(0),V=A.useRef(!1),P=A.useRef();return function(C){const $=qt();A.useEffect(()=>{let N;const H=()=>{var Z,q;if(!C.current)return;const Y=Yu(C.current);Y.height!==0&&Y.width!==0||((q=(Z=$.getState()).onError)==null||q.call(Z,"004",CO())),$.setState({width:Y.width||500,height:Y.height||500})};return H(),window.addEventListener("resize",H),C.current&&(N=new ResizeObserver(()=>H()),N.observe(C.current)),()=>{window.removeEventListener("resize",H),N&&C.current&&N.unobserve(C.current)}},[])}(I),A.useEffect(()=>{if(I.current){const C=I.current.getBoundingClientRect(),$=function(){var q,re,ne,oe=bO,G=yO,Q=vO,ce=xO,me=wO,de=[0,1/0],ge=[[-1/0,-1/0],[1/0,1/0]],ie=250,xe=iH,we=AS("start","zoom","end"),ae=0,Se=10;function pe(J){J.property("__zoom",Fx).on("wheel.zoom",nt,{passive:!1}).on("mousedown.zoom",it).on("dblclick.zoom",te).filter(me).on("touchstart.zoom",Ce).on("touchmove.zoom",Me).on("touchend.zoom touchcancel.zoom",Be).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Te(J,fe){return(fe=Math.max(de[0],Math.min(de[1],fe)))===J.k?J:new np(fe,J.x,J.y)}function Re(J,fe,_e){var ue=fe[0]-_e[0]*J.k,je=fe[1]-_e[1]*J.k;return ue===J.x&&je===J.y?J:new np(J.k,ue,je)}function He(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function ze(J,fe,_e,ue){J.on("start.zoom",function(){Ne(this,arguments).event(ue).start()}).on("interrupt.zoom end.zoom",function(){Ne(this,arguments).event(ue).end()}).tween("zoom",function(){var je=this,ve=arguments,Ve=Ne(je,ve).event(ue),Qe=G.apply(je,ve),le=_e==null?He(Qe):typeof _e=="function"?_e.apply(je,ve):_e,Ee=Math.max(Qe[1][0]-Qe[0][0],Qe[1][1]-Qe[0][1]),Ie=je.__zoom,Ue=typeof fe=="function"?fe.apply(je,ve):fe,qe=xe(Ie.invert(le).concat(Ee/Ie.k),Ue.invert(le).concat(Ee/Ue.k));return function(De){if(De===1)De=Ue;else{var Ye=qe(De),ot=Ee/Ye[2];De=new np(ot,le[0]-Ye[0]*ot,le[1]-Ye[1]*ot)}Ve.zoom(null,De)}})}function Ne(J,fe,_e){return!_e&&J.__zooming||new Ke(J,fe)}function Ke(J,fe){this.that=J,this.args=fe,this.active=0,this.sourceEvent=null,this.extent=G.apply(J,fe),this.taps=0}function nt(J,...fe){if(oe.apply(this,arguments)){var _e=Ne(this,fe).event(J),ue=this.__zoom,je=Math.max(de[0],Math.min(de[1],ue.k*Math.pow(2,ce.apply(this,arguments)))),ve=io(J);if(_e.wheel)_e.mouse[0][0]===ve[0]&&_e.mouse[0][1]===ve[1]||(_e.mouse[1]=ue.invert(_e.mouse[0]=ve)),clearTimeout(_e.wheel);else{if(ue.k===je)return;_e.mouse=[ve,ue.invert(ve)],op(this),_e.start()}Ri(J),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",Q(Re(Te(ue,je),_e.mouse[0],_e.mouse[1]),_e.extent,ge))}}function it(J,...fe){if(!ne&&oe.apply(this,arguments)){var _e=J.currentTarget,ue=Ne(this,fe,!0).event(J),je=to(J.view).on("mousemove.zoom",function(le){if(Ri(le),!ue.moved){var Ee=le.clientX-Ve,Ie=le.clientY-Qe;ue.moved=Ee*Ee+Ie*Ie>ae}ue.event(le).zoom("mouse",Q(Re(ue.that.__zoom,ue.mouse[0]=io(le,_e),ue.mouse[1]),ue.extent,ge))},!0).on("mouseup.zoom",function(le){je.on("mousemove.zoom mouseup.zoom",null),Lx(le.view,ue.moved),Ri(le),ue.event(le).end()},!0),ve=io(J,_e),Ve=J.clientX,Qe=J.clientY;Px(J.view),Gu(J),ue.mouse=[ve,this.__zoom.invert(ve)],op(this),ue.start()}}function te(J,...fe){if(oe.apply(this,arguments)){var _e=this.__zoom,ue=io(J.changedTouches?J.changedTouches[0]:J,this),je=_e.invert(ue),ve=_e.k*(J.shiftKey?.5:2),Ve=Q(Re(Te(_e,ve),ue,je),G.apply(this,fe),ge);Ri(J),ie>0?to(this).transition().duration(ie).call(ze,Ve,ue,J):to(this).call(pe.transform,Ve,ue,J)}}function Ce(J,...fe){if(oe.apply(this,arguments)){var _e,ue,je,ve,Ve=J.touches,Qe=Ve.length,le=Ne(this,fe,J.changedTouches.length===Qe).event(J);for(Gu(J),ue=0;ue<Qe;++ue)ve=[ve=io(je=Ve[ue],this),this.__zoom.invert(ve),je.identifier],le.touch0?le.touch1||le.touch0[2]===ve[2]||(le.touch1=ve,le.taps=0):(le.touch0=ve,_e=!0,le.taps=1+!!q);q&&(q=clearTimeout(q)),_e&&(le.taps<2&&(re=ve[0],q=setTimeout(function(){q=null},500)),op(this),le.start())}}function Me(J,...fe){if(this.__zooming){var _e,ue,je,ve,Ve=Ne(this,fe).event(J),Qe=J.changedTouches,le=Qe.length;for(Ri(J),_e=0;_e<le;++_e)je=io(ue=Qe[_e],this),Ve.touch0&&Ve.touch0[2]===ue.identifier?Ve.touch0[0]=je:Ve.touch1&&Ve.touch1[2]===ue.identifier&&(Ve.touch1[0]=je);if(ue=Ve.that.__zoom,Ve.touch1){var Ee=Ve.touch0[0],Ie=Ve.touch0[1],Ue=Ve.touch1[0],qe=Ve.touch1[1],De=(De=Ue[0]-Ee[0])*De+(De=Ue[1]-Ee[1])*De,Ye=(Ye=qe[0]-Ie[0])*Ye+(Ye=qe[1]-Ie[1])*Ye;ue=Te(ue,Math.sqrt(De/Ye)),je=[(Ee[0]+Ue[0])/2,(Ee[1]+Ue[1])/2],ve=[(Ie[0]+qe[0])/2,(Ie[1]+qe[1])/2]}else{if(!Ve.touch0)return;je=Ve.touch0[0],ve=Ve.touch0[1]}Ve.zoom("touch",Q(Re(ue,je,ve),Ve.extent,ge))}}function Be(J,...fe){if(this.__zooming){var _e,ue,je=Ne(this,fe).event(J),ve=J.changedTouches,Ve=ve.length;for(Gu(J),ne&&clearTimeout(ne),ne=setTimeout(function(){ne=null},500),_e=0;_e<Ve;++_e)ue=ve[_e],je.touch0&&je.touch0[2]===ue.identifier?delete je.touch0:je.touch1&&je.touch1[2]===ue.identifier&&delete je.touch1;if(je.touch1&&!je.touch0&&(je.touch0=je.touch1,delete je.touch1),je.touch0)je.touch0[1]=this.__zoom.invert(je.touch0[0]);else if(je.end(),je.taps===2&&(ue=io(ue,this),Math.hypot(re[0]-ue[0],re[1]-ue[1])<Se)){var Qe=to(this).on("dblclick.zoom");Qe&&Qe.apply(this,arguments)}}}return pe.transform=function(J,fe,_e,ue){var je=J.selection?J.selection():J;je.property("__zoom",Fx),J!==je?ze(J,fe,_e,ue):je.interrupt().each(function(){Ne(this,arguments).event(ue).start().zoom(null,typeof fe=="function"?fe.apply(this,arguments):fe).end()})},pe.scaleBy=function(J,fe,_e,ue){pe.scaleTo(J,function(){return this.__zoom.k*(typeof fe=="function"?fe.apply(this,arguments):fe)},_e,ue)},pe.scaleTo=function(J,fe,_e,ue){pe.transform(J,function(){var je=G.apply(this,arguments),ve=this.__zoom,Ve=_e==null?He(je):typeof _e=="function"?_e.apply(this,arguments):_e,Qe=ve.invert(Ve),le=typeof fe=="function"?fe.apply(this,arguments):fe;return Q(Re(Te(ve,le),Ve,Qe),je,ge)},_e,ue)},pe.translateBy=function(J,fe,_e,ue){pe.transform(J,function(){return Q(this.__zoom.translate(typeof fe=="function"?fe.apply(this,arguments):fe,typeof _e=="function"?_e.apply(this,arguments):_e),G.apply(this,arguments),ge)},null,ue)},pe.translateTo=function(J,fe,_e,ue,je){pe.transform(J,function(){var ve=G.apply(this,arguments),Ve=this.__zoom,Qe=ue==null?He(ve):typeof ue=="function"?ue.apply(this,arguments):ue;return Q(_r.translate(Qe[0],Qe[1]).scale(Ve.k).translate(typeof fe=="function"?-fe.apply(this,arguments):-fe,typeof _e=="function"?-_e.apply(this,arguments):-_e),ve,ge)},ue,je)},Ke.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active==1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,fe){return this.mouse&&J!=="mouse"&&(this.mouse[1]=fe.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=fe.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=fe.invert(this.touch1[0])),this.that.__zoom=fe,this.emit("zoom"),this},end:function(){return--this.active==0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var fe=to(this.that).datum();we.call(J,this.that,new _O(J,{sourceEvent:this.sourceEvent,target:pe,transform:this.that.__zoom,dispatch:we}),fe)}},pe.wheelDelta=function(J){return arguments.length?(ce=typeof J=="function"?J:Al(+J),pe):ce},pe.filter=function(J){return arguments.length?(oe=typeof J=="function"?J:Al(!!J),pe):oe},pe.touchable=function(J){return arguments.length?(me=typeof J=="function"?J:Al(!!J),pe):me},pe.extent=function(J){return arguments.length?(G=typeof J=="function"?J:Al([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),pe):G},pe.scaleExtent=function(J){return arguments.length?(de[0]=+J[0],de[1]=+J[1],pe):[de[0],de[1]]},pe.translateExtent=function(J){return arguments.length?(ge[0][0]=+J[0][0],ge[1][0]=+J[1][0],ge[0][1]=+J[0][1],ge[1][1]=+J[1][1],pe):[[ge[0][0],ge[0][1]],[ge[1][0],ge[1][1]]]},pe.constrain=function(J){return arguments.length?(Q=J,pe):Q},pe.duration=function(J){return arguments.length?(ie=+J,pe):ie},pe.interpolate=function(J){return arguments.length?(xe=J,pe):xe},pe.on=function(){var J=we.on.apply(we,arguments);return J===we?pe:J},pe.clickDistance=function(J){return arguments.length?(ae=(J=+J)*J,pe):Math.sqrt(ae)},pe.tapDistance=function(J){return arguments.length?(Se=+J,pe):Se},pe}().scaleExtent([_,g]).translateExtent(m),N=to(I.current).call($),H=_r.translate(f.x,f.y).scale(as(f.zoom,_,g)),Y=[[0,0],[C.width,C.height]],Z=$.constrain()(H,Y,m);$.transform(N,Z),$.wheelDelta(Ew),k.setState({d3Zoom:$,d3Selection:N,d3ZoomHandler:N.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:I.current.closest(".react-flow")})}},[]),A.useEffect(()=>{L&&M&&(!i||z||O?B!==void 0&&L.on("wheel.zoom",function(C,$){if(!b&&C.type==="wheel"&&!C.ctrlKey||hs(C,y))return null;C.preventDefault(),B.call(this,C,$)},{passive:!1}):L.on("wheel.zoom",C=>{if(hs(C,y))return!1;C.preventDefault(),C.stopImmediatePropagation();const $=L.property("__zoom").k||1;if(C.ctrlKey&&s){const oe=io(C),G=Ew(C),Q=$*Math.pow(2,G);return void M.scaleTo(L,Q,oe,C)}const N=C.deltaMode===1?20:1;let H=l===er.Vertical?0:C.deltaX*N,Y=l===er.Horizontal?0:C.deltaY*N;!Ol()&&C.shiftKey&&l!==er.Vertical&&(H=C.deltaY*N,Y=0),M.translateBy(L,-H/$*a,-Y/$*a,{internal:!0});const Z=Bl(L.property("__zoom")),{onViewportChangeStart:q,onViewportChange:re,onViewportChangeEnd:ne}=k.getState();clearTimeout(P.current),V.current||(V.current=!0,e==null||e(C,Z),q==null||q(Z)),V.current&&(t==null||t(C,Z),re==null||re(Z),P.current=setTimeout(()=>{n==null||n(C,Z),ne==null||ne(Z),V.current=!1},150))},{passive:!1}))},[O,i,l,L,M,B,z,s,b,y,e,t,n]),A.useEffect(()=>{M&&M.on("start",C=>{var H,Y;if(!C.sourceEvent||C.sourceEvent.internal)return null;F.current=(H=C.sourceEvent)==null?void 0:H.button;const{onViewportChangeStart:$}=k.getState(),N=Bl(C.transform);E.current=!0,T.current=N,((Y=C.sourceEvent)==null?void 0:Y.type)==="mousedown"&&k.setState({paneDragging:!0}),$==null||$(N),e==null||e(C.sourceEvent,N)})},[M,e]),A.useEffect(()=>{M&&(O&&!E.current?M.on("zoom",null):O||M.on("zoom",C=>{var N;const{onViewportChange:$}=k.getState();if(k.setState({transform:[C.transform.x,C.transform.y,C.transform.k]}),j.current=!(!o||!jw(u,F.current??0)),(t||$)&&!((N=C.sourceEvent)!=null&&N.internal)){const H=Bl(C.transform);$==null||$(H),t==null||t(C.sourceEvent,H)}}))},[O,M,t,u,o]),A.useEffect(()=>{M&&M.on("end",C=>{if(!C.sourceEvent||C.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=k.getState();if(E.current=!1,k.setState({paneDragging:!1}),o&&jw(u,F.current??0)&&!j.current&&o(C.sourceEvent),j.current=!1,(n||$)&&(N=T.current,H=C.transform,N.x!==H.x||N.y!==H.y||N.zoom!==H.k)){const Y=Bl(C.transform);T.current=Y,clearTimeout(S.current),S.current=setTimeout(()=>{$==null||$(Y),n==null||n(C.sourceEvent,Y)},i?150:0)}var N,H})},[M,i,u,n,o]),A.useEffect(()=>{M&&M.filter(C=>{const $=z||r,N=s&&C.ctrlKey;if((u===!0||Array.isArray(u)&&u.includes(1))&&C.button===1&&C.type==="mousedown"&&(hs(C,"react-flow__node")||hs(C,"react-flow__edge")))return!0;if(!(u||$||i||c||s)||O||!c&&C.type==="dblclick"||hs(C,y)&&C.type==="wheel"||hs(C,v)&&(C.type!=="wheel"||i&&C.type==="wheel"&&!z)||!s&&C.ctrlKey&&C.type==="wheel"||!$&&!i&&!N&&C.type==="wheel"||!u&&(C.type==="mousedown"||C.type==="touchstart")||Array.isArray(u)&&!u.includes(C.button)&&C.type==="mousedown")return!1;const H=Array.isArray(u)&&u.includes(C.button)||!C.button||C.button<=1;return(!C.ctrlKey||C.type==="wheel")&&H})},[O,M,r,s,i,c,u,d,z]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:fh},x)},r9=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function s9(){const{userSelectionActive:t,userSelectionRect:e}=mt(r9,nn);return t&&e?K.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Iw(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);o.position.x=o.position.x-i,o.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);o.position.y=o.position.y-i,o.style.height+=i,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Aw(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(a=>a.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const a of s)if(a)switch(a.type){case"select":i.selected=a.selected;break;case"position":a.position!==void 0&&(i.position=a.position),a.positionAbsolute!==void 0&&(i.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(i.dragging=a.dragging),i.expandParent&&Iw(o,i);break;case"dimensions":a.dimensions!==void 0&&(i.width=a.dimensions.width,i.height=a.dimensions.height),a.updateStyle!==void 0&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&Iw(o,i);break;case"remove":return o}return o.push(i),o},n)}function Tw(t,e){return Aw(t,e)}const or=(t,e)=>({id:t,type:"select",selected:e});function fs(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(or(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(or(o.id,!1))),n},[])}const mh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},i9=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Mw=A.memo(({isSelecting:t,selectionMode:e=Fi.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:u})=>{const f=A.useRef(null),m=qt(),_=A.useRef(0),g=A.useRef(0),p=A.useRef(),{userSelectionActive:b,elementsSelectable:x,dragging:y}=mt(i9,nn),v=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},S=j=>{s==null||s(j),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},k=a?j=>a(j):void 0,E=x&&(t||b);return K.createElement("div",{className:un(["react-flow__pane",{dragging:y,selection:t}]),onClick:E?void 0:mh(S,f),onContextMenu:mh(j=>{Array.isArray(n)&&(n!=null&&n.includes(2))?j.preventDefault():i==null||i(j)},f),onWheel:mh(k,f),onMouseEnter:E?void 0:l,onMouseDown:E?j=>{const{resetSelectedElements:I,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!x||!t||j.button!==0||j.target!==f.current||!p.current)return;const{x:M,y:L}=Qo(j,p.current);I(),m.setState({userSelectionRect:{width:0,height:0,startX:M,startY:L,x:M,y:L}}),o==null||o(j)}:void 0,onMouseMove:E?j=>{const{userSelectionRect:I,nodeInternals:T,edges:M,transform:L,onNodesChange:B,onEdgesChange:O,nodeOrigin:z,getNodes:F}=m.getState();if(!t||!p.current||!I)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Qo(j,p.current),P=I.startX??0,C=I.startY??0,$={...I,x:V.x<P?V.x:P,y:V.y<C?V.y:C,width:Math.abs(V.x-P),height:Math.abs(V.y-C)},N=F(),H=rw(T,$,L,e===Fi.Partial,!0,z),Y=sw(H,M).map(q=>q.id),Z=H.map(q=>q.id);if(_.current!==Z.length){_.current=Z.length;const q=fs(N,Z);q.length&&(B==null||B(q))}if(g.current!==Y.length){g.current=Y.length;const q=fs(M,Y);q.length&&(O==null||O(q))}m.setState({userSelectionRect:$})}:c,onMouseUp:E?j=>{if(j.button!==0)return;const{userSelectionRect:I}=m.getState();!b&&I&&j.target===f.current&&(S==null||S(j)),m.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(j)}:void 0,onMouseLeave:E?j=>{b&&(m.setState({nodesSelectionActive:_.current>0}),r==null||r(j)),v()}:d,ref:f,style:fh},u,K.createElement(s9,null))});function Ow(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Ow(o,e))}function Dw(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 a9(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Ow(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,i;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=r.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function Rw(t,e,n,o,r=[0,0],s){const i=function(u,f){return f&&f!=="parent"?[f[0],[f[1][0]-(u.width||0),f[1][1]-(u.height||0)]]:f}(t,t.extent||o);let a=i;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const u=n.get(l),{x:f,y:m}=cs(u,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const u=n.get(l),{x:f,y:m}=cs(u,r).positionAbsolute;a=u&&Pn(f)&&Pn(m)&&Pn(u.width)&&Pn(u.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+u.width-t.width+t.width*r[0],m+u.height-t.height+t.height*r[1]]]:a}else s==null||s("005",NO()),a=i;let c={x:0,y:0};if(l){const u=n.get(l);c=cs(u,r).positionAbsolute}const d=a&&a!=="parent"?Ju(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function ph({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]}Mw.displayName="Pane";const Pw=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-i.left-a)/n,y:(d.top-i.top-l)/n,...Yu(c)}})};function Vi(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function gh({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])):l==null||l("012",TO(t))}function _h(t){return(e,n,o)=>t==null?void 0:t(e,o)}function Lw({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=qt(),[l,c]=A.useState(!1),d=A.useRef([]),u=A.useRef({x:null,y:null}),f=A.useRef(0),m=A.useRef(null),_=A.useRef({x:0,y:0}),g=A.useRef(null),p=A.useRef(!1),b=A.useRef(!1),x=A.useRef(!1),y=function(){const v=qt();return A.useCallback(({sourceEvent:k})=>{const{transform:E,snapGrid:j,snapToGrid:I}=v.getState(),T=k.touches?k.touches[0].clientX:k.clientX,M=k.touches?k.touches[0].clientY:k.clientY,L={x:(T-E[0])/E[2],y:(M-E[1])/E[2]};return{xSnapped:I?j[0]*Math.round(L.x/j[0]):L.x,ySnapped:I?j[1]*Math.round(L.y/j[1]):L.y,...L}},[])}();return A.useEffect(()=>{if(t!=null&&t.current){const v=to(t.current),S=({x:j,y:I})=>{const{nodeInternals:T,onNodeDrag:M,onSelectionDrag:L,updateNodePositions:B,nodeExtent:O,snapGrid:z,snapToGrid:F,nodeOrigin:V,onError:P}=a.getState();u.current={x:j,y:I};let C=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&O){const H=ah(d.current,V);$=Ku(H)}if(d.current=d.current.map(H=>{const Y={x:j-H.distance.x,y:I-H.distance.y};F&&(Y.x=z[0]*Math.round(Y.x/z[0]),Y.y=z[1]*Math.round(Y.y/z[1]));const Z=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];d.current.length>1&&O&&!H.extent&&(Z[0][0]=H.positionAbsolute.x-$.x+O[0][0],Z[1][0]=H.positionAbsolute.x+(H.width??0)-$.x2+O[1][0],Z[0][1]=H.positionAbsolute.y-$.y+O[0][1],Z[1][1]=H.positionAbsolute.y+(H.height??0)-$.y2+O[1][1]);const q=Rw(H,Y,T,Z,V,P);return C=C||H.position.x!==q.position.x||H.position.y!==q.position.y,H.position=q.position,H.positionAbsolute=q.positionAbsolute,H}),!C)return;B(d.current,!0,!0),c(!0);const N=r?M:_h(L);if(N&&g.current){const[H,Y]=ph({nodeId:r,dragItems:d.current,nodeInternals:T});N(g.current,H,Y)}},k=()=>{if(!m.current)return;const[j,I]=Ux(_.current,m.current);if(j!==0||I!==0){const{transform:T,panBy:M}=a.getState();u.current.x=(u.current.x??0)-j/T[2],u.current.y=(u.current.y??0)-I/T[2],M({x:j,y:I})&&S(u.current)}f.current=requestAnimationFrame(k)},E=j=>{var V;const{nodeInternals:I,multiSelectionActive:T,nodesDraggable:M,unselectNodesAndEdges:L,onNodeDragStart:B,onSelectionDragStart:O}=a.getState();b.current=!0;const z=r?B:_h(O);i&&s||T||!r||(V=I.get(r))!=null&&V.selected||L(),r&&s&&i&&gh({id:r,store:a,nodeRef:t});const F=y(j);if(u.current=F,d.current=a9(I,M,F,r),z&&d.current){const[P,C]=ph({nodeId:r,dragItems:d.current,nodeInternals:I});z(j.sourceEvent,P,C)}};if(!e){const j=function(){var I,T,M,L,B=fO,O=mO,z=pO,F=gO,V={},P=AS("start","drag","end"),C=0,$=0;function N(G){G.on("mousedown.drag",H).filter(F).on("touchstart.drag",q).on("touchmove.drag",re,hO).on("touchend.drag touchcancel.drag",ne).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function H(G,Q){if(!L&&B.call(this,G,Q)){var ce=oe(this,O.call(this,G,Q),G,Q,"mouse");ce&&(to(G.view).on("mousemove.drag",Y,Di).on("mouseup.drag",Z,Di),Px(G.view),Wu(G),M=!1,I=G.clientX,T=G.clientY,ce("start",G))}}function Y(G){if(is(G),!M){var Q=G.clientX-I,ce=G.clientY-T;M=Q*Q+ce*ce>$}V.mouse("drag",G)}function Z(G){to(G.view).on("mousemove.drag mouseup.drag",null),Lx(G.view,M),is(G),V.mouse("end",G)}function q(G,Q){if(B.call(this,G,Q)){var ce,me,de=G.changedTouches,ge=O.call(this,G,Q),ie=de.length;for(ce=0;ce<ie;++ce)(me=oe(this,ge,G,Q,de[ce].identifier,de[ce]))&&(Wu(G),me("start",G,de[ce]))}}function re(G){var Q,ce,me=G.changedTouches,de=me.length;for(Q=0;Q<de;++Q)(ce=V[me[Q].identifier])&&(is(G),ce("drag",G,me[Q]))}function ne(G){var Q,ce,me=G.changedTouches,de=me.length;for(L&&clearTimeout(L),L=setTimeout(function(){L=null},500),Q=0;Q<de;++Q)(ce=V[me[Q].identifier])&&(Wu(G),ce("end",G,me[Q]))}function oe(G,Q,ce,me,de,ge){var ie,xe,we,ae=P.copy(),Se=io(ge||ce,Q);if((we=z.call(G,new qu("beforestart",{sourceEvent:ce,target:N,identifier:de,active:C,x:Se[0],y:Se[1],dx:0,dy:0,dispatch:ae}),me))!=null)return ie=we.x-Se[0]||0,xe=we.y-Se[1]||0,function pe(Te,Re,He){var ze,Ne=Se;switch(Te){case"start":V[de]=pe,ze=C++;break;case"end":delete V[de],--C;case"drag":Se=io(He||Re,Q),ze=C}ae.call(Te,G,new qu(Te,{sourceEvent:Re,subject:we,target:N,identifier:de,active:ze,x:Se[0]+ie,y:Se[1]+xe,dx:Se[0]-Ne[0],dy:Se[1]-Ne[1],dispatch:ae}),me)}}return N.filter=function(G){return arguments.length?(B=typeof G=="function"?G:Il(!!G),N):B},N.container=function(G){return arguments.length?(O=typeof G=="function"?G:Il(G),N):O},N.subject=function(G){return arguments.length?(z=typeof G=="function"?G:Il(G),N):z},N.touchable=function(G){return arguments.length?(F=typeof G=="function"?G:Il(!!G),N):F},N.on=function(){var G=P.on.apply(P,arguments);return G===P?N:G},N.clickDistance=function(G){return arguments.length?($=(G=+G)*G,N):Math.sqrt($)},N}().on("start",I=>{const{domNode:T,nodeDragThreshold:M}=a.getState();M===0&&E(I),x.current=!1;const L=y(I);u.current=L,m.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=Qo(I.sourceEvent,m.current)}).on("drag",I=>{var B,O;const T=y(I),{autoPanOnNodeDrag:M,nodeDragThreshold:L}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!p.current&&b.current&&M&&(p.current=!0,k()),!b.current){const z=T.xSnapped-(((B=u==null?void 0:u.current)==null?void 0:B.x)??0),F=T.ySnapped-(((O=u==null?void 0:u.current)==null?void 0:O.y)??0);Math.sqrt(z*z+F*F)>L&&E(I)}(u.current.x!==T.xSnapped||u.current.y!==T.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=Qo(I.sourceEvent,m.current),S(T))}}).on("end",I=>{if(b.current&&!x.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:M,onNodeDragStop:L,onSelectionDragStop:B}=a.getState(),O=r?L:_h(B);if(T(d.current,!1,!1),O){const[z,F]=ph({nodeId:r,dragItems:d.current,nodeInternals:M});O(I.sourceEvent,z,F)}}}).filter(I=>{const T=I.target;return!I.button&&(!n||!Dw(T,`.${n}`,t))&&(!o||Dw(T,o,t))});return v.call(j),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,y]),l}function Fw(){const t=qt();return A.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),u=i().filter(x=>x.selected&&(x.draggable||d&&x.draggable===void 0)),f=a?l[0]:5,m=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,p=n.y*m*_,b=u.map(x=>{if(x.positionAbsolute){const y={x:x.positionAbsolute.x+g,y:x.positionAbsolute.y+p};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:v,position:S}=Rw(x,y,o,r,void 0,c);x.position=S,x.positionAbsolute=v}return x});s(b,!0,!1)},[])}const ms={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var $i=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:u,onMouseMove:f,onMouseLeave:m,onContextMenu:_,onDoubleClick:g,style:p,className:b,isDraggable:x,isSelectable:y,isConnectable:v,isFocusable:S,selectNodesOnDrag:k,sourcePosition:E,targetPosition:j,hidden:I,resizeObserver:T,dragHandle:M,zIndex:L,isParent:B,noDragClassName:O,noPanClassName:z,initialized:F,disableKeyboardA11y:V,ariaLabel:P,rfId:C,hasHandleBounds:$})=>{const N=qt(),H=A.useRef(null),Y=A.useRef(null),Z=A.useRef(E),q=A.useRef(j),re=A.useRef(o),ne=y||x||d||u||f||m,oe=Fw(),G=Vi(n,N.getState,u),Q=Vi(n,N.getState,f),ce=Vi(n,N.getState,m),me=Vi(n,N.getState,_),de=Vi(n,N.getState,g);A.useEffect(()=>()=>{Y.current&&(T==null||T.unobserve(Y.current),Y.current=null)},[]),A.useEffect(()=>{if(H.current&&!I){const ie=H.current;F&&$&&Y.current===ie||(Y.current&&(T==null||T.unobserve(Y.current)),T==null||T.observe(ie),Y.current=ie)}},[I,F,$]),A.useEffect(()=>{const ie=re.current!==o,xe=Z.current!==E,we=q.current!==j;H.current&&(ie||xe||we)&&(ie&&(re.current=o),xe&&(Z.current=E),we&&(q.current=j),N.getState().updateNodeDimensions([{id:n,nodeElement:H.current,forceUpdate:!0}]))},[n,o,E,j]);const ge=Lw({nodeRef:H,disabled:I||!x,noDragClassName:O,handleSelector:M,nodeId:n,isSelectable:y,selectNodesOnDrag:k});return I?null:K.createElement("div",{className:un(["react-flow__node",`react-flow__node-${o}`,{[z]:x},b,{selected:c,selectable:y,parent:B,dragging:ge}]),ref:H,style:{zIndex:L,transform:`translate(${a}px,${l}px)`,pointerEvents:ne?"all":"none",visibility:F?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:G,onMouseMove:Q,onMouseLeave:ce,onContextMenu:me,onClick:ie=>{const{nodeDragThreshold:xe}=N.getState();if(y&&(!k||!x||xe>0)&&gh({id:n,store:N,nodeRef:H}),d){const we=N.getState().nodeInternals.get(n);we&&d(ie,{...we})}},onDoubleClick:de,onKeyDown:S?ie=>{if(!Zu(ie)&&!V)if(Hx.includes(ie.key)&&y){const xe=ie.key==="Escape";gh({id:n,store:N,unselect:xe,nodeRef:H})}else x&&c&&Object.prototype.hasOwnProperty.call(ms,ie.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ie.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),oe({x:ms[ie.key].x,y:ms[ie.key].y,isShiftPressed:ie.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":V?void 0:`${xw}-${C}`,"aria-label":P},K.createElement(PO,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:E,targetPosition:j,dragging:ge,dragHandle:M,zIndex:L})))};return e.displayName="NodeWrapper",A.memo(e)};const l9=t=>{const e=t.getNodes().filter(n=>n.selected);return{...ah(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var c9=A.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=qt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=mt(l9,nn),d=Fw(),u=A.useRef(null);if(A.useEffect(()=>{var m;n||((m=u.current)==null||m.focus({preventScroll:!0}))},[n]),Lw({nodeRef:u}),c||!r||!s)return null;const f=t?m=>{const _=o.getState().getNodes().filter(g=>g.selected);t(m,_)}:void 0;return K.createElement("div",{className:un(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(ms,m.key)&&d({x:ms[m.key].x,y:ms[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const d9=t=>t.nodesSelectionActive,zw=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:m,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:k,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:T,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,preventScrolling:z,onSelectionContextMenu:F,noWheelClassName:V,noPanClassName:P,disableKeyboardA11y:C})=>{const $=mt(d9),N=Bi(u),H=Bi(b),Y=H||T,Z=H||k,q=N||f&&Y!==!0;return(({deleteKeyCode:re,multiSelectionKeyCode:ne})=>{const oe=qt(),{deleteElements:G}=Ui(),Q=Bi(re,t9),ce=Bi(ne);A.useEffect(()=>{if(Q){const{edges:me,getNodes:de}=oe.getState(),ge=de().filter(xe=>xe.selected),ie=me.filter(xe=>xe.selected);G({nodes:ge,edges:ie}),oe.setState({nodesSelectionActive:!1})}},[Q]),A.useEffect(()=>{oe.setState({multiSelectionActive:ce})},[ce])})({deleteKeyCode:a,multiSelectionKeyCode:p}),K.createElement(o9,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:Z,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:!N&&Y,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,zoomActivationKeyCode:x,preventScrolling:z,noWheelClassName:V,noPanClassName:P},K.createElement(Mw,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:Y,isSelecting:!!q,selectionMode:m},t,$&&K.createElement(c9,{onSelectionContextMenu:F,noPanClassName:P,disableKeyboardA11y:C})))};zw.displayName="FlowRenderer";var u9=A.memo(zw);function h9(t){return{input:$i(t.input||pw),default:$i(t.default||dh),output:$i(t.output||_w),group:$i(t.group||uh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=$i(t[n]||dh),e),{})}}const f9=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Bw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=mt(f9,nn),a=(l=t.onlyRenderVisibleElements,mt(A.useCallback(u=>l?rw(u.nodeInternals,{x:0,y:0,width:u.width,height:u.height},u.transform,!0):u.getNodes(),[l])));var l;const c=A.useRef(),d=A.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(f=>{const m=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(m)});return c.current=u,u},[]);return A.useEffect(()=>()=>{var u;(u=c==null?void 0:c.current)==null||u.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:fh},a.map(u=>{var k,E,j;let f=u.type||"default";t.nodeTypes[f]||(i==null||i("003",SO(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,_=!!(u.draggable||e&&u.draggable===void 0),g=!!(u.selectable||r&&u.selectable===void 0),p=!!(u.connectable||n&&u.connectable===void 0),b=!!(u.focusable||o&&u.focusable===void 0),x=t.nodeExtent?Ju(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,y=(x==null?void 0:x.x)??0,v=(x==null?void 0:x.y)??0,S=(({x:I,y:T,width:M,height:L,origin:B})=>M&&L?B[0]<0||B[1]<0||B[0]>1||B[1]>1?{x:I,y:T}:{x:I-M*B[0],y:T-L*B[1]}:{x:I,y:T})({x:y,y:v,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return K.createElement(m,{key:u.id,id:u.id,className:u.className,style:u.style,type:f,data:u.data,sourcePosition:u.sourcePosition||$e.Bottom,targetPosition:u.targetPosition||$e.Top,hidden:u.hidden,xPos:y,yPos:v,xPosOrigin: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:!!u.selected,isDraggable:_,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:d,dragHandle:u.dragHandle,zIndex:((k=u[jt])==null?void 0:k.z)??0,isParent:!!((E=u[jt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!((j=u[jt])!=null&&j.handleBounds)})}))};Bw.displayName="NodeRenderer";var m9=A.memo(Bw);const p9=(t,e,n)=>n===$e.Left?t-e:n===$e.Right?t+e:t,g9=(t,e,n)=>n===$e.Top?t-e:n===$e.Bottom?t+e:t,Uw="react-flow__edgeupdater",Vw=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:un([Uw,`${Uw}-${a}`]),cx:p9(e,o,t),cy:g9(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),_9=()=>!0;var ps=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,style:p,source:b,target:x,sourceX:y,sourceY:v,targetX:S,targetY:k,sourcePosition:E,targetPosition:j,elementsSelectable:I,hidden:T,sourceHandleId:M,targetHandleId:L,onContextMenu:B,onMouseEnter:O,onMouseMove:z,onMouseLeave:F,reconnectRadius:V,onReconnect:P,onReconnectStart:C,onReconnectEnd:$,markerEnd:N,markerStart:H,rfId:Y,ariaLabel:Z,isFocusable:q,isReconnectable:re,pathOptions:ne,interactionWidth:oe,disableKeyboardA11y:G})=>{const Q=A.useRef(null),[ce,me]=A.useState(!1),[de,ge]=A.useState(!1),ie=qt(),xe=A.useMemo(()=>`url('#${sh(H,Y)}')`,[H,Y]),we=A.useMemo(()=>`url('#${sh(N,Y)}')`,[N,Y]);if(T)return null;const ae=Li(n,ie.getState,a),Se=Li(n,ie.getState,B),pe=Li(n,ie.getState,O),Te=Li(n,ie.getState,z),Re=Li(n,ie.getState,F),He=(nt,it)=>{if(nt.button!==0)return;const{edges:te,isValidConnection:Ce}=ie.getState(),Me=it?x:b,Be=(it?L:M)||null,J=it?"target":"source",fe=Ce||_9,_e=it,ue=te.find(je=>je.id===n);ge(!0),C==null||C(nt,ue,J),dw({event:nt,handleId:Be,nodeId:Me,onConnect:je=>P==null?void 0:P(ue,je),isTarget:_e,getState:ie.getState,setState:ie.setState,isValidConnection:fe,edgeUpdaterType:J,onReconnectEnd:je=>{ge(!1),$==null||$(je,ue,J)}})},ze=()=>me(!0),Ne=()=>me(!1),Ke=!I&&!i;return K.createElement("g",{className:un(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:Ke,updating:ce}]),onClick:nt=>{var J;const{edges:it,addSelectedEdges:te,unselectNodesAndEdges:Ce,multiSelectionActive:Me}=ie.getState(),Be=it.find(fe=>fe.id===n);Be&&(I&&(ie.setState({nodesSelectionActive:!1}),Be.selected&&Me?(Ce({nodes:[],edges:[Be]}),(J=Q.current)==null||J.blur()):te([n])),i&&i(nt,Be))},onDoubleClick:ae,onContextMenu:Se,onMouseEnter:pe,onMouseMove:Te,onMouseLeave:Re,onKeyDown:q?nt=>{var it;if(!G&&Hx.includes(nt.key)&&I){const{unselectNodesAndEdges:te,addSelectedEdges:Ce,edges:Me}=ie.getState();nt.key==="Escape"?((it=Q.current)==null||it.blur(),te({edges:[Me.find(Be=>Be.id===n)]})):Ce([n])}}:void 0,tabIndex:q?0:void 0,role:q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Z===null?void 0:Z||`Edge from ${b} to ${x}`,"aria-describedby":q?`${ww}-${Y}`:void 0,ref:Q},!de&&K.createElement(t,{id:n,source:b,target:x,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:p,sourceX:y,sourceY:v,targetX:S,targetY:k,sourcePosition:E,targetPosition:j,sourceHandleId:M,targetHandleId:L,markerStart:xe,markerEnd:we,pathOptions:ne,interactionWidth:oe}),re&&K.createElement(K.Fragment,null,(re==="source"||re===!0)&&K.createElement(Vw,{position:E,centerX:y,centerY:v,radius:V,onMouseDown:nt=>He(nt,!0),onMouseEnter:ze,onMouseOut:Ne,type:"source"}),(re==="target"||re===!0)&&K.createElement(Vw,{position:j,centerX:S,centerY:k,radius:V,onMouseDown:nt=>He(nt,!1),onMouseEnter:ze,onMouseOut:Ne,type:"target"})))};return e.displayName="EdgeWrapper",A.memo(e)};function b9(t){return{default:ps(t.default||Ll),straight:ps(t.bezier||oh),step:ps(t.step||nh),smoothstep:ps(t.step||Rl),simplebezier:ps(t.simplebezier||eh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ps(t[n]||Ll),e),{})}}function $w(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case $e.Top:return{x:o+s/2,y:r};case $e.Right:return{x:o+s,y:r+i/2};case $e.Bottom:return{x:o+s/2,y:r+i};case $e.Left:return{x:o,y:r+i/2}}}function Hw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function Ww(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[jt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const y9=[{level:0,isMaxLevel:!0,edges:[]}];function x9(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var m,_;const u=Pn(d.zIndex);let f=u?d.zIndex:0;if(s){const g=r.get(d.target),p=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),x=Math.max(((m=p==null?void 0:p[jt])==null?void 0:m.z)||0,((_=g==null?void 0:g[jt])==null?void 0:_.z)||0,1e3);f=(u?d.zIndex:0)+(b?x:0)}return c[f]?c[f].push(d):c[f]=[d],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,d])=>{const u=+c;return{edges:d,level:u,isMaxLevel:u===i}});return l.length===0?y9:l}(mt(A.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:d,targetWidth:u,targetHeight:f,width:m,height:_,transform:g}){const p={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+u),y2:Math.max(a.y+d,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Ku({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:_/g[2]}),x=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),y=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(x*y)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const qw={[ls.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[ls.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},w9=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const d=qt();return A.useMemo(()=>{var u,f;return Object.prototype.hasOwnProperty.call(qw,c)?qw[c]:((f=(u=d.getState()).onError)==null||f.call(u,"009",jO(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:i})):null},Gw=({defaultColor:t,rfId:e})=>{const n=mt(A.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=sh(c,r);i.includes(d)||(a.push({id:d,color:c.color||o,...c}),i.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return K.createElement("defs",null,n.map(o=>K.createElement(w9,{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})))};Gw.displayName="MarkerDefinitions";var v9=A.memo(Gw);const k9=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}),Yw=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:x,edgesUpdatable:y,elementsSelectable:v,width:S,height:k,connectionMode:E,nodeInternals:j,onError:I}=mt(k9,nn),T=x9(e,j,n);return S?K.createElement(K.Fragment,null,T.map(({level:M,edges:L,isMaxLevel:B})=>K.createElement("svg",{key:M,style:{zIndex:M},width:S,height:k,className:"react-flow__edges react-flow__container"},B&&K.createElement(v9,{defaultColor:t,rfId:o}),K.createElement("g",null,L.map(O=>{const[z,F,V]=Ww(j.get(O.source)),[P,C,$]=Ww(j.get(O.target));if(!V||!$)return null;let N=O.type||"default";r[N]||(I==null||I("011",AO(N)),N="default");const H=r[N]||r.default,Y=E===Ar.Strict?C.target:(C.target??[]).concat(C.source??[]),Z=Hw(F.source,O.sourceHandle),q=Hw(Y,O.targetHandle),re=(Z==null?void 0:Z.position)||$e.Bottom,ne=(q==null?void 0:q.position)||$e.Top,oe=!!(O.focusable||x&&O.focusable===void 0),G=O.reconnectable||O.updatable,Q=f!==void 0&&(G||y&&G===void 0);if(!Z||!q)return I==null||I("008",EO(Z,O)),null;const{sourceX:ce,sourceY:me,targetX:de,targetY:ge}=((ie,xe,we,ae,Se,pe)=>{const Te=$w(we,ie,xe),Re=$w(pe,ae,Se);return{sourceX:Te.x,sourceY:Te.y,targetX:Re.x,targetY:Re.y}})(z,Z,re,P,q,ne);return K.createElement(H,{key:O.id,id:O.id,className:un([O.className,s]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ce,sourceY:me,targetX:de,targetY:ge,sourcePosition:re,targetPosition:ne,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:O.ariaLabel,isFocusable:oe,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),p):null};Yw.displayName="EdgeRenderer";var S9=A.memo(Yw);const C9=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function N9({children:t}){const e=mt(C9);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const j9={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},Jw=({nodeId:t,handleType:e,style:n,type:o=tr.Bezier,CustomComponent:r,connectionStatus:s})=>{var k,E,j;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=mt(A.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),nn),u=(k=i==null?void 0:i[jt])==null?void 0:k.handleBounds;let f=u==null?void 0:u[e];if(d===Ar.Loose&&(f=f||(u==null?void 0:u[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(I=>I.id===a):f[0],_=m?m.x+m.width/2:(i.width??0)/2,g=m?m.y+m.height/2:i.height??0,p=(((E=i.positionAbsolute)==null?void 0:E.x)??0)+_,b=(((j=i.positionAbsolute)==null?void 0:j.y)??0)+g,x=m==null?void 0:m.position,y=x?j9[x]:null;if(!x||!y)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:x,toPosition:y,connectionStatus:s});let v="";const S={sourceX:p,sourceY:b,sourcePosition:x,targetX:l,targetY:c,targetPosition:y};return o===tr.Bezier?[v]=nw(S):o===tr.Step?[v]=th({...S,borderRadius:0}):o===tr.SmoothStep?[v]=th(S):o===tr.SimpleBezier?[v]=Zx(S):v=`M${p},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};Jw.displayName="ConnectionLine";const E9=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function I9({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=mt(E9,nn);return r&&s&&a&&i?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:un(["react-flow__connection",c])},K.createElement(Jw,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function Kw(t,e){return A.useRef(null),qt(),A.useMemo(()=>e(t),[t])}const Xw=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:S,selectionOnDrag:k,selectionMode:E,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,deleteKeyCode:M,onlyRenderVisibleElements:L,elementsSelectable:B,selectNodesOnDrag:O,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,preventScrolling:C,defaultMarkerColor:$,zoomOnScroll:N,zoomOnPinch:H,panOnScroll:Y,panOnScrollSpeed:Z,panOnScrollMode:q,zoomOnDoubleClick:re,panOnDrag:ne,onPaneClick:oe,onPaneMouseEnter:G,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneScroll:me,onPaneContextMenu:de,onEdgeContextMenu:ge,onEdgeMouseEnter:ie,onEdgeMouseMove:xe,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:Se,onReconnectEnd:pe,reconnectRadius:Te,noDragClassName:Re,noWheelClassName:He,noPanClassName:ze,elevateEdgesOnSelect:Ne,disableKeyboardA11y:Ke,nodeOrigin:nt,nodeExtent:it,rfId:te})=>{const Ce=Kw(t,h9),Me=Kw(e,b9);return function(Be){const J=Ui(),fe=A.useRef(!1);A.useEffect(()=>{!fe.current&&J.viewportInitialized&&Be&&(setTimeout(()=>Be(J),1),fe.current=!0)},[Be,J.viewportInitialized])}(s),K.createElement(u9,{onPaneClick:oe,onPaneMouseEnter:G,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneContextMenu:de,onPaneScroll:me,deleteKeyCode:M,selectionKeyCode:S,selectionOnDrag:k,selectionMode:E,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,elementsSelectable:B,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:N,zoomOnPinch:H,zoomOnDoubleClick:re,panOnScroll:Y,panOnScrollSpeed:Z,panOnScrollMode:q,panOnDrag:ne,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,onSelectionContextMenu:_,preventScrolling:C,noDragClassName:Re,noWheelClassName:He,noPanClassName:ze,disableKeyboardA11y:Ke},K.createElement(N9,null,K.createElement(S9,{edgeTypes:Me,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:L,onEdgeContextMenu:ge,onEdgeMouseEnter:ie,onEdgeMouseMove:xe,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:Se,onReconnectEnd:pe,reconnectRadius:Te,defaultMarkerColor:$,noPanClassName:ze,elevateEdgesOnSelect:!!Ne,disableKeyboardA11y:Ke,rfId:te},K.createElement(I9,{style:x,type:b,component:y,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(m9,{nodeTypes:Ce,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:O,onlyRenderVisibleElements:L,noPanClassName:ze,noDragClassName:Re,disableKeyboardA11y:Ke,nodeOrigin:nt,nodeExtent:it,rfId:te})))};Xw.displayName="GraphView";var A9=A.memo(Xw);const bh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],rr={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:bh,nodeExtent:bh,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ar.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},T9=()=>((t,e)=>t?Rx(t,e):Rx)((t,e)=>({...rr,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:hh(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,i=r?hh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const u=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(u.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[jt]:{...b[jt],handleBounds:void 0}});else if(b){const x=Yu(p.nodeElement);!(!x.width||!x.height||b.width===x.width&&b.height===x.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[jt]:{...b[jt],handleBounds:{source:Pw(".source",p.nodeElement,f,c),target:Pw(".target",p.nodeElement,f,c)}},...x}),g.push({id:b.id,type:"dimensions",dimensions:x}))}return g},[]);Cw(r,c);const _=i||s&&!i&&Nw(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=hh(Tw(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>or(l,!0)):(i=fs(s(),n),a=fs(r,[])),zl({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>or(l,!0)):(i=fs(r,n),a=fs(s(),[])),zl({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;zl({changedNodes:(n||s()).map(a=>(a.selected=!1,or(a.id,!1))),changedEdges:i.map(a=>or(a.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();zl({changedNodes:o().filter(r=>r.selected).map(r=>or(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>or(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Ju(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=_r.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],u=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,u),o[0]!==u.x||o[1]!==u.y||o[2]!==u.k},cancelConnection:()=>t({connectionNodeId:rr.connectionNodeId,connectionHandleId:rr.connectionHandleId,connectionHandleType:rr.connectionHandleType,connectionStatus:rr.connectionStatus,connectionStartHandle:rr.connectionStartHandle,connectionEndHandle:rr.connectionEndHandle}),reset:()=>t({...rr})}),Object.is),yh=({children:t})=>{const e=A.useRef(null);return e.current||(e.current=T9()),K.createElement(kO,{value:e.current},t)};yh.displayName="ReactFlowProvider";const Zw=({children:t})=>A.useContext(Tl)?K.createElement(K.Fragment,null,t):K.createElement(yh,null,t);Zw.displayName="ReactFlowWrapper";const M9={input:pw,default:dh,output:_w,group:uh},O9={default:Ll,straight:oh,step:nh,smoothstep:Rl,simplebezier:eh},D9=[0,0],R9=[15,15],P9={x:0,y:0,zoom:1},L9={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},xh=A.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=M9,edgeTypes:i=O9,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onNodesDelete:T,onEdgesDelete:M,onSelectionChange:L,onSelectionDragStart:B,onSelectionDrag:O,onSelectionDragStop:z,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,connectionMode:C=Ar.Strict,connectionLineType:$=tr.Bezier,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:Y,deleteKeyCode:Z="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:re=!1,selectionMode:ne=Fi.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:G=Ol()?"Meta":"Control",zoomActivationKeyCode:Q=Ol()?"Meta":"Control",snapToGrid:ce=!1,snapGrid:me=R9,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:ge=!0,nodesDraggable:ie,nodesConnectable:xe,nodesFocusable:we,nodeOrigin:ae=D9,edgesFocusable:Se,edgesUpdatable:pe,elementsSelectable:Te,defaultViewport:Re=P9,minZoom:He=.5,maxZoom:ze=2,translateExtent:Ne=bh,preventScrolling:Ke=!0,nodeExtent:nt,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:te=!0,zoomOnPinch:Ce=!0,panOnScroll:Me=!1,panOnScrollSpeed:Be=.5,panOnScrollMode:J=er.Free,zoomOnDoubleClick:fe=!0,panOnDrag:_e=!0,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ve,onPaneMouseLeave:Ve,onPaneScroll:Qe,onPaneContextMenu:le,children:Ee,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:Ye,onEdgeUpdate:ot,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:rt,onReconnect:pt,onReconnectStart:yt,onReconnectEnd:Ot,reconnectRadius:wt=10,edgeUpdaterRadius:Ut=10,onNodesChange:Sn,onEdgesChange:hn,noDragClassName:rn="nodrag",noWheelClassName:Xt="nowheel",noPanClassName:Xn="nopan",fitView:ho=!1,fitViewOptions:ks,connectOnClick:Ss=!0,attributionPosition:Cs,proOptions:Ns,defaultEdgeOptions:js,elevateNodesOnSelect:ar=!0,elevateEdgesOnSelect:Es=!1,disableKeyboardA11y:Is=!1,autoPanOnConnect:As=!0,autoPanOnNodeDrag:Lt=!0,connectionRadius:vt=20,isValidConnection:Cn,onError:Nn,style:Ts,id:nc,nodeDragThreshold:Jf,...Kf},oc)=>{const Xf=nc||"1";return K.createElement("div",{...Kf,style:{...Ts,...L9},ref:oc,className:un(["react-flow",r]),"data-testid":"rf__wrapper",id:nc},K.createElement(Zw,null,K.createElement(A9,{onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:Y,selectionKeyCode:q,selectionOnDrag:re,selectionMode:ne,deleteKeyCode:Z,multiSelectionKeyCode:G,panActivationKeyCode:oe,zoomActivationKeyCode:Q,onlyRenderVisibleElements:de,selectNodesOnDrag:ge,defaultViewport:Re,translateExtent:Ne,minZoom:He,maxZoom:ze,preventScrolling:Ke,zoomOnScroll:te,zoomOnPinch:Ce,zoomOnDoubleClick:fe,panOnScroll:Me,panOnScrollSpeed:Be,panOnScrollMode:J,panOnDrag:_e,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ve,onPaneMouseLeave:Ve,onPaneScroll:Qe,onPaneContextMenu:le,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:Ye,onReconnect:pt??ot,onReconnectStart:yt??Xe,onReconnectEnd:Ot??rt,reconnectRadius:wt??Ut,defaultMarkerColor:it,noDragClassName:rn,noWheelClassName:Xt,noPanClassName:Xn,elevateEdgesOnSelect:Es,rfId:Xf,disableKeyboardA11y:Is,nodeOrigin:ae,nodeExtent:nt}),K.createElement(qO,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:ie,nodesConnectable:xe,nodesFocusable:we,edgesFocusable:Se,edgesUpdatable:pe,elementsSelectable:Te,elevateNodesOnSelect:ar,minZoom:He,maxZoom:ze,nodeExtent:nt,onNodesChange:Sn,onEdgesChange:hn,snapToGrid:ce,snapGrid:me,connectionMode:C,translateExtent:Ne,connectOnClick:Ss,defaultEdgeOptions:js,fitView:ho,fitViewOptions:ks,onNodesDelete:T,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onSelectionDrag:O,onSelectionDragStart:B,onSelectionDragStop:z,noPanClassName:Xn,nodeOrigin:ae,rfId:Xf,autoPanOnConnect:As,autoPanOnNodeDrag:Lt,onError:Nn,connectionRadius:vt,isValidConnection:Cn,nodeDragThreshold:Jf}),K.createElement(HO,{onSelectionChange:L}),Ee,K.createElement(OO,{proOptions:Ns,position:Cs}),K.createElement(KO,{rfId:Xf,disableKeyboardA11y:Is})))});function Qw(t){return e=>{const[n,o]=A.useState(e),r=A.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}xh.displayName="ReactFlow";const ev=Qw(Tw),tv=Qw(function(t,e){return Aw(t,e)});function F9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function z9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function B9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function U9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function V9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const gs=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:un(["react-flow__controls-button",e]),...n},t);gs.displayName="ControlButton";const $9=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),nv=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:d,position:u="bottom-left"})=>{const f=qt(),[m,_]=A.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=mt($9,nn),{zoomIn:x,zoomOut:y,fitView:v}=Ui();return A.useEffect(()=>{_(!0)},[]),m?K.createElement(Ml,{className:un(["react-flow__controls",c]),position:u,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(gs,{onClick:()=>{x(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(F9,null)),K.createElement(gs,{onClick:()=>{y(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},K.createElement(z9,null))),n&&K.createElement(gs,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(B9,null)),o&&K.createElement(gs,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?K.createElement(V9,null):K.createElement(U9,null)),d):null};nv.displayName="Controls";var Ln,H9=A.memo(nv);function W9({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function q9({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Ln||(Ln={}));const G9={[Ln.Dots]:"#91919a",[Ln.Lines]:"#eee",[Ln.Cross]:"#e2e2e2"},Y9={[Ln.Dots]:1,[Ln.Lines]:1,[Ln.Cross]:6},J9=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ov({id:t,variant:e=Ln.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=A.useRef(null),{transform:d,patternId:u}=mt(J9,nn),f=i||G9[e],m=o||Y9[e],_=e===Ln.Dots,g=e===Ln.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*d[2]||1,p[1]*d[2]||1],x=m*d[2],y=g?[x,x]:b,v=_?[x/s,x/s]:[y[0]/s,y[1]/s];return K.createElement("svg",{className:un(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.createElement("pattern",{id:u+t,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`},_?K.createElement(q9,{color:f,radius:x/s}):K.createElement(W9,{dimensions:y,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${u+t})`}))}ov.displayName="Background";var K9=A.memo(ov);function wh(t){return Math.min(11*t+35,200)}const rv=K.createContext("LR"),sv=A.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=We(n.atom),s=Bc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=mt(X9),l=A.useContext(rv);let c,d,u,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const M=r.code.split(`
125
+ `),t[6]=e,t[7]=a,t[8]=i,t[9]=u):u=t[9];const f=u;let m;t[10]!==e||t[11]!==(a==null?void 0:a.isHealthy)||t[12]!==(a==null?void 0:a.lastChecked)||t[13]!==s?(m=()=>s||e===xt.CONNECTING?h.jsx(eo,{size:"small"}):e===xt.CLOSING?h.jsx(eo,{className:"text-destructive",size:"small"}):e===xt.OPEN?a!=null&&a.isHealthy?h.jsx(Wc,{className:"w-4 h-4 text-[var(--green-9)]"}):a!=null&&a.lastChecked?h.jsx(z4,{className:"w-4 h-4 text-[var(--yellow-9)]"}):h.jsx(Wc,{className:"w-4 h-4"}):h.jsx(Zm,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=a==null?void 0:a.isHealthy,t[12]=a==null?void 0:a.lastChecked,t[13]=s,t[14]=m):m=t[14];const _=m,g=f();let p,b,x,y;return t[15]!==e?(p=e===xt.OPEN&&h.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==g||t[18]!==p?(b=h.jsxs("div",{className:"text-sm whitespace-pre-line",children:[g,p]}),t[17]=g,t[18]=p,t[19]=b):b=t[19],t[20]!==_?(x=_(),t[20]=_,t[21]=x):x=t[21],t[22]!==l||t[23]!==b||t[24]!==x?(y=h.jsx(Jn,{tooltip:b,selected:!1,onClick:l,children:x}),t[22]=l,t[23]=b,t[24]=x,t[25]=y):y=t[25],y},qM=t=>{const e=X.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},GM=Qt(t=>t(KU).completion.copilot),YM=()=>{const t=X.c(1);if(We(GM)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(JM,{}),t[0]=e):e=t[0],e}return null},Tx=Zt.get("[copilot-status-bar]"),JM=()=>{const t=We(_S),e=We(A$)!==null,{handleClick:n}=wa(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=en(_S),i=en(T$);return XU(()=>{const a=gS();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw Tx.error("Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Tx.warn("Connection failed",c),s(!1),i("connectionError"),lt({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:h.jsx(Pe,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),h.jsx(Jn,{tooltip:h.jsxs(h.Fragment,{children:[h.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,children:h.jsx("span",{children:e?h.jsx(eo,{className:"h-4 w-4"}):h.jsx(qM,{className:Oe("h-4 w-4",!t&&"opacity-60")})})})},KM=()=>{const t=X.c(13),e=We(rs),[n,o]=fn(I4),[r,s]=A.useState(!1);if(!_a()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,d,u,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Yp,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=h.jsx(Js,{asChild:!0,children:h.jsx(Jn,{tooltip:i,selected:!1,children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsxs("div",{className:"space-y-2",children:[h.jsx("h4",{className:"font-medium leading-none",children:"Username"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(d=m=>o(m.target.value),t[4]=o,t[5]=d):d=t[5],t[6]!==d||t[7]!==n?(u=h.jsx($s,{className:"w-80",children:h.jsxs("div",{className:"space-y-4",children:[c,h.jsx(hr,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:d,placeholder:"Enter your username"})]})}),t[6]=d,t[7]=n,t[8]=u):u=t[8],t[9]!==r||t[10]!==l||t[11]!==u?(f=h.jsxs(Lr,{open:r,onOpenChange:s,children:[l,u]}),t[9]=r,t[10]=l,t[11]=u,t[12]=f):f=t[12],f},XM=()=>{const t=X.c(56),{selectedPanel:e,isTerminalOpen:n}=yc(),{toggleApplication:o,toggleTerminal:r}=oa(),[s,i]=Rs(),a=We(ZU),l=ZM,c=hd.find(QM);let d;Bo(c,"Error panel not found"),t[0]!==r?(d=()=>{r()},t[0]=r,t[1]=d):d=t[1],Gt("global.toggleTerminal",d);const u=Jn,f=c.tooltip,m=e===c.type,_=()=>o(c.type),g=l(c,a>0?"text-destructive":"");let p,b,x,y,v;t[2]!==a?(p=h.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:a}),t[2]=a,t[3]=p):p=t[3],t[4]!==u||t[5]!==c||t[6]!==m||t[7]!==_||t[8]!==g||t[9]!==p?(b=h.jsxs(u,{tooltip:f,selected:m,onClick:_,children:[g,p]}),t[4]=u,t[5]=c,t[6]=m,t[7]=_,t[8]=g,t[9]=p,t[10]=b):b=t[10],t[11]!==r?(x=()=>r(),t[11]=r,t[12]=x):x=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(qp,{className:"h-5 w-5"}),t[13]=y):y=t[13],t[14]!==n||t[15]!==x?(v=h.jsx(Ax,{capability:"terminal",children:h.jsx(Jn,{tooltip:"Open terminal",selected:n,onClick:x,children:y})}),t[14]=n,t[15]=x,t[16]=v):v=t[16];const S=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let k,E,j;t[17]!==s||t[18]!==i?(k=async()=>{const q={...s,runtime:{...s.runtime,auto_instantiate:!s.runtime.auto_instantiate}};await Ps({config:q}).then(()=>i(q))},t[17]=s,t[18]=i,t[19]=k):k=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx("span",{children:"on startup: "}),t[20]=E):E=t[20],t[21]!==s.runtime.auto_instantiate?(j=s.runtime.auto_instantiate?h.jsx(yr,{size:14}):h.jsx(br,{size:14}),t[21]=s.runtime.auto_instantiate,t[22]=j):j=t[22];const I=s.runtime.auto_instantiate?"autorun":"lazy";let T,M,L,B;t[23]!==I?(T=h.jsx("span",{children:I}),t[23]=I,t[24]=T):T=t[24],t[25]!==j||t[26]!==T?(M=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[E,j,T]}),t[25]=j,t[26]=T,t[27]=M):M=t[27],t[28]!==S||t[29]!==k||t[30]!==M?(L=h.jsx(Jn,{tooltip:S,selected:!1,onClick:k,children:M}),t[28]=S,t[29]=k,t[30]=M,t[31]=L):L=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[32]=B):B=t[32];const O=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let z,F,V,P,C,$,N,H,Y,Z;return t[33]!==s||t[34]!==i?(z=async()=>{const q={...s,runtime:{...s.runtime,on_cell_change:s.runtime.on_cell_change==="autorun"?"lazy":"autorun"}};await Ps({config:q}).then(()=>i(q))},t[33]=s,t[34]=i,t[35]=z):z=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx("span",{children:"on cell change: "}),t[36]=F):F=t[36],t[37]!==s.runtime.on_cell_change?(V=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[F,s.runtime.on_cell_change==="autorun"?h.jsx(yr,{size:14}):h.jsx(br,{size:14}),h.jsx("span",{children:s.runtime.on_cell_change})]}),t[37]=s.runtime.on_cell_change,t[38]=V):V=t[38],t[39]!==O||t[40]!==z||t[41]!==V?(P=h.jsx(Jn,{tooltip:O,selected:!1,onClick:z,children:V}),t[39]=O,t[40]=z,t[41]=V,t[42]=P):P=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[43]=C):C=t[43],t[44]!==s||t[45]!==i?($=!Un()&&h.jsx(Jn,{tooltip:null,selected:!1,children:h.jsxs(gc,{children:[h.jsxs(_c,{className:"font-prose text-sm flex items-center gap-1",children:[h.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&h.jsx(Zm,{size:14}),s.runtime.auto_reload==="lazy"&&h.jsx(br,{size:14}),s.runtime.auto_reload==="autorun"&&h.jsx(yr,{size:14}),h.jsx("span",{children:s.runtime.auto_reload}),h.jsx(Qi,{size:14})]}),h.jsx(bc,{children:["off","lazy","autorun"].map(q=>h.jsxs(sn,{onClick:async()=>{const re={...s,runtime:{...s.runtime,auto_reload:q}};await Ps({config:re}).then(()=>i(re))},children:[q==="off"&&h.jsx(Zm,{size:14,className:"mr-2 text-muted-foreground"}),q==="lazy"&&h.jsx(br,{size:14,className:"mr-2 text-muted-foreground"}),q==="autorun"&&h.jsx(yr,{size:14,className:"mr-2 text-muted-foreground"}),q]},q))})]})}),t[44]=s,t[45]=i,t[46]=$):$=t[46],t[47]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("div",{className:"mx-auto"}),t[47]=N):N=t[47],t[48]===Symbol.for("react.memo_cache_sentinel")?(H=h.jsx(gN,{children:h.jsx(Le,{content:h.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:h.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[48]=H):H=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(Y=h.jsxs("div",{className:"flex items-center",children:[h.jsx(LM,{}),h.jsx(HM,{}),h.jsx(YM,{}),h.jsx(KM,{}),h.jsx(WM,{})]}),t[49]=Y):Y=t[49],t[50]!==v||t[51]!==L||t[52]!==P||t[53]!==$||t[54]!==b?(Z=h.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen",children:[b,v,L,B,P,C,$,N,H,Y]}),t[50]=v,t[51]=L,t[52]=P,t[53]=$,t[54]=b,t[55]=Z):Z=t[55],Z};function ZM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function QM(t){return t.type==="errors"}const eO=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Vn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(h.jsx(tO,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=h.jsx(V4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},tO=t=>{const e=X.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const u=new FormData(d.target),f=u.get("rating"),m=u.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),lt({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(ur,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsxs("li",{className:"my-0",children:["Take our"," ",h.jsx("a",{href:Zn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("li",{className:"my-0",children:["File a"," ",h.jsx("a",{href:Zn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Ds,{children:[r,h.jsxs(Ls,{children:[s,h.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,h.jsxs("li",{className:"my-0",children:["Chat with us on"," ",h.jsx("a",{href:Zn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=h.jsx(dr,{className:"w-fit",children:h.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},nO=()=>{const t=X.c(10),{selectedPanel:e}=yc(),{toggleApplication:n}=oa(),o=rO;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=hd.filter(sO).map(d=>h.jsx(Mx,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(eO,{children:h.jsx(Mx,{tooltip:"Send feedback!",selected:!1,children:h.jsx(Ip,{className:"h-5 w-5"})})}),a=h.jsx("div",{className:"flex-1"}),l=h.jsx(oO,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=h.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},oO=()=>{const t=X.c(7),e=We(QU);let n,o,r;return t[0]!==e?(n=e>0?h.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=h.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(iO)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=h.jsx(Le,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Mx=t=>{const e=X.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let c,d,u;return e[6]!==o||e[7]!==a||e[8]!==l?(c=Oe("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=h.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==i?(u=h.jsx(Le,{content:i,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=i,e[16]=u):u=e[16],u};function rO(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function sO(t){return!t.hidden&&t.position==="sidebar"}function iO(t,e){return h.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}let Ox;An=t=>{const e=X.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,d,u;return e[0]!==r?(i=r&&K.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=h.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=h.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(d=s&&h.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(u=h.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=u):u=e[14],u},Ox=()=>{const t=X.c(5),e=eV();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(An,{title:"No errors!",icon:h.jsx(Dp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(aO),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function aO(t){return h.jsxs("div",{children:[h.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:h.jsx(tV,{cellId:t.cellId})}),h.jsx("div",{className:"px-2",children:h.jsx(nV,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const lO=()=>{const t=X.c(7),{items:e}=We(oV);let n,o;t[0]!==e?(o=K$(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=X$(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(An,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:h.jsx(nd,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=h.jsx(Z$,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a};function un(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=un(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:cO}=K,{useSyncExternalStoreWithSelector:dO}=rV,uO=t=>t;function Dx(t,e=uO,n){const o=dO(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return cO(o),o}const Rx=(t,e)=>{const n=sV(t),o=(r,s=e)=>Dx(n,r,s);return Object.assign(o,n),o};function nn(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function io(t,e){if(t=function(s){let i;for(;i=s.sourceEvent;)s=i;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const hO={passive:!1},Di={capture:!0,passive:!1};function Wu(t){t.stopImmediatePropagation()}function is(t){t.preventDefault(),t.stopImmediatePropagation()}function Px(t){var e=t.document.documentElement,n=to(t).on("dragstart.drag",is,Di);"onselectstart"in e?n.on("selectstart.drag",is,Di):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Lx(t,e){var n=t.document.documentElement,o=to(t).on("dragstart.drag",null);e&&(o.on("click.drag",is,Di),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 Il=t=>()=>t;function qu(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function fO(t){return!t.ctrlKey&&!t.button}function mO(){return this.parentNode}function pO(t,e){return e??{x:t.x,y:t.y}}function gO(){return navigator.maxTouchPoints||"ontouchstart"in this}qu.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Al=t=>()=>t;function _O(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 Gu(t){t.stopImmediatePropagation()}function Ri(t){t.preventDefault(),t.stopImmediatePropagation()}function bO(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function yO(){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 Fx(){return this.__zoom||_r}function xO(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function wO(){return navigator.maxTouchPoints||"ontouchstart"in this}function vO(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}const Tl=A.createContext(null),kO=Tl.Provider,SO=t=>`Node type "${t}" not found. Using fallback type "default".`,CO=()=>"The React Flow parent container needs a width and a height to render the graph.",NO=()=>"Only child nodes can use a parent extent.",jO=t=>`Marker type "${t}" doesn't exist.`,EO=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,IO=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",AO=t=>`Edge type "${t}" not found. Using fallback type "default".`,TO=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.`,zx="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function mt(t,e){const n=A.useContext(Tl);if(n===null)throw new Error(zx);return Dx(n,t,e)}const qt=()=>{const t=A.useContext(Tl);if(t===null)throw new Error(zx);return A.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},MO=t=>t.userSelectionActive?"none":"all";function Ml({position:t,children:e,className:n,style:o,...r}){const s=mt(MO),i=`${t}`.split("-");return K.createElement("div",{className:un(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function OO({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Ml,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var DO=A.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d})=>{const u=A.useRef(null),[f,m]=A.useState({x:0,y:0,width:0,height:0}),_=un(["react-flow__edge-textwrapper",c]);return A.useEffect(()=>{if(u.current){const g=u.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&K.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:u,style:o},n),l):null});const Yu=t=>({width:t.offsetWidth,height:t.offsetHeight}),as=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Ju=(t={x:0,y:0},e)=>({x:as(t.x,e[0][0],e[1][0]),y:as(t.y,e[0][1],e[1][1])}),Bx=(t,e,n)=>t<e?as(Math.abs(t-e),1,50)/50:t>n?-as(Math.abs(t-n),1,50)/50:0,Ux=(t,e)=>[20*Bx(t.x,35,e.width-35),20*Bx(t.y,35,e.height-35)],Vx=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Ku=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),$x=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Xu=(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)},Pn=t=>!isNaN(t)&&isFinite(t),jt=Symbol.for("internals"),Hx=["Enter"," ","Escape"];function Zu(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 Wx=t=>"clientX"in t,Qo=(t,e)=>{var s,i;const n=Wx(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Ol=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Pi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:u,markerStart:f}),m&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Pn(n)&&Pn(o)?K.createElement(DO,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Li(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function qx({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,i=Math.abs(o-e)/2;return[s,o<e?o+i:o-i,r,i]}function Gx({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var Ar,Yx,er,Qu,Fi,Jx,tr,zi,ls,Kx,$e,Dl;function Xx({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===$e.Left||t===$e.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Zx({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top}){const[i,a]=Xx({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Xx({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,u,f,m]=Gx({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,d,u,f,m]}Pi.displayName="BaseEdge",(Yx=Ar||(Ar={})).Strict="strict",Yx.Loose="loose",(Qu=er||(er={})).Free="free",Qu.Vertical="vertical",Qu.Horizontal="horizontal",(Jx=Fi||(Fi={})).Partial="partial",Jx.Full="full",(zi=tr||(tr={})).Bezier="default",zi.Straight="straight",zi.Step="step",zi.SmoothStep="smoothstep",zi.SimpleBezier="simplebezier",(Kx=ls||(ls={})).Arrow="arrow",Kx.ArrowClosed="arrowclosed",(Dl=$e||($e={})).Left="left",Dl.Top="top",Dl.Right="right",Dl.Bottom="bottom";const eh=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:g})=>{const[p,b,x]=Zx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return K.createElement(Pi,{path:p,labelX:b,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:g})});eh.displayName="SimpleBezierEdge";const Qx={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},ew=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function RO({source:t,sourcePosition:e=$e.Bottom,target:n,targetPosition:o=$e.Top,center:r,offset:s}){const i=Qx[e],a=Qx[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},d=(({source:k,sourcePosition:E=$e.Bottom,target:j})=>E===$e.Left||E===$e.Right?k.x<j.x?{x:1,y:0}:{x:-1,y:0}:k.y<j.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),u=d.x!==0?"x":"y",f=d[u];let m,_,g=[];const p={x:0,y:0},b={x:0,y:0},[x,y,v,S]=qx({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[u]*a[u]==-1){m=r.x??x,_=r.y??y;const k=[{x:m,y:l.y},{x:m,y:c.y}],E=[{x:l.x,y:_},{x:c.x,y:_}];g=i[u]===f?u==="x"?k:E:u==="x"?E:k}else{const k=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(g=u==="x"?i.x===f?E:k:i.y===f?k:E,e===o){const T=Math.abs(t[u]-n[u]);if(T<=s){const M=Math.min(s-1,s-T);i[u]===f?p[u]=(l[u]>t[u]?-1:1)*M:b[u]=(c[u]>n[u]?-1:1)*M}}if(e!==o){const T=u==="x"?"y":"x",M=i[u]===a[T],L=l[T]>c[T],B=l[T]<c[T];(i[u]===1&&(!M&&L||M&&B)||i[u]!==1&&(!M&&B||M&&L))&&(g=u==="x"?k:E)}const j={x:l.x+p.x,y:l.y+p.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(j.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(j.y-g[0].y),Math.abs(I.y-g[0].y))?(m=(j.x+I.x)/2,_=g[0].y):(m=g[0].x,_=(j.y+I.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:c.x+b.x,y:c.y+b.y},n],m,_,v,S]}function th({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,u,f,m,_]=RO({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[d.reduce((g,p,b)=>{let x="";return x=b>0&&b<d.length-1?function(y,v,S,k){const E=Math.min(ew(y,v)/2,ew(v,S)/2,k),{x:j,y:I}=v;if(y.x===j&&j===S.x||y.y===I&&I===S.y)return`L${j} ${I}`;if(y.y===I)return`L ${j+E*(y.x<S.x?-1:1)},${I}Q ${j},${I} ${j},${I+E*(y.y<S.y?1:-1)}`;const T=y.x<S.x?1:-1;return`L ${j},${I+E*(y.y<S.y?-1:1)}Q ${j},${I} ${j+E*T},${I}`}(d[b-1],p,d[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=x},""),u,f,m,_]}const Rl=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:u=$e.Bottom,targetPosition:f=$e.Top,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=th({sourceX:t,sourceY:e,sourcePosition:u,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return K.createElement(Pi,{path:b,labelX:x,labelY:y,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:_,interactionWidth:p})});Rl.displayName="SmoothStepEdge";const nh=A.memo(t=>{var e;return K.createElement(Rl,{...t,pathOptions:A.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});nh.displayName="StepEdge";const oh=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m})=>{const[_,g,p]=function({sourceX:b,sourceY:x,targetX:y,targetY:v}){const[S,k,E,j]=qx({sourceX:b,sourceY:x,targetX:y,targetY:v});return[`M ${b},${x}L ${y},${v}`,S,k,E,j]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Pi,{path:_,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m})});function Pl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function tw({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case $e.Left:return[e-Pl(e-o,s),n];case $e.Right:return[e+Pl(o-e,s),n];case $e.Top:return[e,n-Pl(n-r,s)];case $e.Bottom:return[e,n+Pl(r-n,s)]}}function nw({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,curvature:i=.25}){const[a,l]=tw({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=tw({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[u,f,m,_]=Gx({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${o},${r}`,u,f,m,_]}oh.displayName="StraightEdge";const Ll=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=nw({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return K.createElement(Pi,{path:b,labelX:x,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:p})});Ll.displayName="BezierEdge";const rh=A.createContext(null),PO=rh.Provider;rh.Consumer;const LO=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,sh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,ih=({x:t,y:e},[n,o,r],s,[i,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},ow=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),cs=(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}},ah=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:i}=cs(r,e).positionAbsolute;return a=o,l=Ku({x:s,y:i,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:i})=>({x:o,y:r,width:s-o,height:i-r}))(n)},rw=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(d=>{const{width:u,height:f,selectable:m=!0,hidden:_=!1}=d;if(i&&!m||_)return!1;const{positionAbsolute:g}=cs(d,a),p={x:g.x,y:g.y,width:u||0,height:f||0},b=Xu(l,p);(u===void 0||f===void 0||u===null||f===null||s&&b>0||b>=(u||0)*(f||0)||d.dragging)&&c.push(d)}),c},sw=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},iw=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=as(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Tr=(t,e=0)=>t.transition().duration(e);function aw(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var i,a;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+s.y+s.height/2}),r},[])}const FO={source:null,target:null,sourceHandle:null,targetHandle:null},lw=()=>({handleDomNode:null,isValid:!1,connection:FO,endHandle:null});function cw(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...lw(),handleDomNode:l};if(l){const d=lh(void 0,l),u=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?u:n,sourceHandle:a?f:o,target:a?n:u,targetHandle:a?o:f};c.connection=g,m&&_&&(e===Ar.Strict?a&&d==="source"||!a&&d==="target":u!==n||f!==o)&&(c.endHandle={nodeId:u,handleId:f,type:d},c.isValid=s(g))}return c}function lh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function ch(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function zO(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function dw({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=Vx(t.target),{connectionMode:u,domNode:f,autoPanOnConnect:m,connectionRadius:_,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:x}=s();let y,v=0;const{x:S,y:k}=Qo(t),E=d==null?void 0:d.elementFromPoint(S,k),j=lh(l,E),I=f==null?void 0:f.getBoundingClientRect();if(!I||!j)return;let T,M=Qo(t,I),L=!1,B=null,O=!1,z=null;const F=function({nodes:$,nodeId:N,handleId:H,handleType:Y}){return $.reduce((Z,q)=>{if(q[jt]){const{handleBounds:re}=q[jt];let ne=[],oe=[];re&&(ne=aw(q,re,"source",`${N}-${H}-${Y}`),oe=aw(q,re,"target",`${N}-${H}-${Y}`)),Z.push(...ne,...oe)}return Z},[])}({nodes:b(),nodeId:n,handleId:e,handleType:j}),V=()=>{if(!m)return;const[$,N]=Ux(M,I);p({x:$,y:N}),v=requestAnimationFrame(V)};function P($){const{transform:N}=s();M=Qo($,I);const{handle:H,validHandleResult:Y}=function(Z,q,re,ne,oe,G){const{x:Q,y:ce}=Qo(Z),me=q.elementsFromPoint(Q,ce).find(we=>we.classList.contains("react-flow__handle"));if(me){const we=me.getAttribute("data-nodeid");if(we){const ae=lh(void 0,me),Se=me.getAttribute("data-handleid"),pe=G({nodeId:we,id:Se,type:ae});if(pe){const Te=oe.find(Re=>Re.nodeId===we&&Re.type===ae&&Re.id===Se);return{handle:{id:Se,type:ae,nodeId:we,x:(Te==null?void 0:Te.x)||re.x,y:(Te==null?void 0:Te.y)||re.y},validHandleResult:pe}}}}let de=[],ge=1/0;if(oe.forEach(we=>{const ae=Math.sqrt((we.x-re.x)**2+(we.y-re.y)**2);if(ae<=ne){const Se=G(we);ae<=ge&&(ae<ge?de=[{handle:we,validHandleResult:Se}]:ae===ge&&de.push({handle:we,validHandleResult:Se}),ge=ae)}}),!de.length)return{handle:null,validHandleResult:lw()};if(de.length===1)return de[0];const ie=de.some(({validHandleResult:we})=>we.isValid),xe=de.some(({handle:we})=>we.type==="target");return de.find(({handle:we,validHandleResult:ae})=>xe?we.type==="target":!ie||ae.isValid)||de[0]}($,d,ih(M,N,!1,[1,1]),_,F,Z=>cw(Z,u,n,e,r?"target":"source",a,d));if(y=H,L||(V(),L=!0),z=Y.handleDomNode,B=Y.connection,O=Y.isValid,i({connectionPosition:y&&O?ow({x:y.x,y:y.y},N):M,connectionStatus:zO(!!y,O),connectionEndHandle:Y.endHandle}),!y&&!O&&!z)return ch(T);B.source!==B.target&&z&&(ch(T),T=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",O),z.classList.toggle("react-flow__handle-valid",O))}function C($){var N,H;(y||z)&&B&&O&&(o==null||o(B)),(H=(N=s()).onConnectEnd)==null||H.call(N,$),l&&(c==null||c($)),ch(T),x(),cancelAnimationFrame(v),L=!1,O=!1,B=null,z=null,d.removeEventListener("mousemove",P),d.removeEventListener("mouseup",C),d.removeEventListener("touchmove",P),d.removeEventListener("touchend",C)}i({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:j,connectionStartHandle:{nodeId:n,handleId:e,type:j},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:j}),d.addEventListener("mousemove",P),d.addEventListener("mouseup",C),d.addEventListener("touchmove",P),d.addEventListener("touchend",C)}const uw=()=>!0,BO=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),hw=A.forwardRef(({type:t="source",position:e=$e.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...f},m)=>{var j,I;const _=i||null,g=t==="target",p=qt(),b=A.useContext(rh),{connectOnClick:x,noPanClassName:y}=mt(BO,nn),{connecting:v,clickConnecting:S}=mt(((T,M,L)=>B=>{const{connectionStartHandle:O,connectionEndHandle:z,connectionClickStartHandle:F}=B;return{connecting:(O==null?void 0:O.nodeId)===T&&(O==null?void 0:O.handleId)===M&&(O==null?void 0:O.type)===L||(z==null?void 0:z.nodeId)===T&&(z==null?void 0:z.handleId)===M&&(z==null?void 0:z.type)===L,clickConnecting:(F==null?void 0:F.nodeId)===T&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===L}})(b,_,t),nn);b||((I=(j=p.getState()).onError)==null||I.call(j,"010",IO()));const k=T=>{const{defaultEdgeOptions:M,onConnect:L,hasDefaultEdges:B}=p.getState(),O={...M,...T};if(B){const{edges:z,setEdges:F}=p.getState();F(((V,P)=>{if(!V.source||!V.target)return P;let C;return C=($=>"id"in $&&"source"in $&&"target"in $)(V)?{...V}:{...V,id:LO(V)},(($,N)=>N.some(H=>!(H.source!==$.source||H.target!==$.target||H.sourceHandle!==$.sourceHandle&&(H.sourceHandle||$.sourceHandle)||H.targetHandle!==$.targetHandle&&(H.targetHandle||$.targetHandle))))(C,P)?P:P.concat(C)})(O,z))}L==null||L(O),a==null||a(O)},E=T=>{if(!b)return;const M=Wx(T);r&&(M&&T.button===0||!M)&&dw({event:T,handleId:_,nodeId:b,onConnect:k,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||uw}),M?d==null||d(T):u==null||u(T)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:un(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",y,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:S,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:E,onTouchStart:E,onClick:x?T=>{const{onClickConnectStart:M,onClickConnectEnd:L,connectionClickStartHandle:B,connectionMode:O,isValidConnection:z}=p.getState();if(!b||!B&&!r)return;if(!B)return M==null||M(T,{nodeId:b,handleId:_,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const F=Vx(T.target),V=n||z||uw,{connection:P,isValid:C}=cw({nodeId:b,id:_,type:t},O,B.nodeId,B.handleId||null,B.type,V,F);C&&k(P),L==null||L(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});hw.displayName="Handle";var nr=A.memo(hw);const fw=({data:t,isConnectable:e,targetPosition:n=$e.Top,sourcePosition:o=$e.Bottom})=>K.createElement(K.Fragment,null,K.createElement(nr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(nr,{type:"source",position:o,isConnectable:e}));fw.displayName="DefaultNode";var dh=A.memo(fw);const mw=({data:t,isConnectable:e,sourcePosition:n=$e.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(nr,{type:"source",position:n,isConnectable:e}));mw.displayName="InputNode";var pw=A.memo(mw);const gw=({data:t,isConnectable:e,targetPosition:n=$e.Top})=>K.createElement(K.Fragment,null,K.createElement(nr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);gw.displayName="OutputNode";var _w=A.memo(gw);const uh=()=>null;uh.displayName="GroupNode";const UO=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Fl=t=>t.id;function VO(t,e){return nn(t.selectedNodes.map(Fl),e.selectedNodes.map(Fl))&&nn(t.selectedEdges.map(Fl),e.selectedEdges.map(Fl))}const bw=A.memo(({onSelectionChange:t})=>{const e=qt(),{selectedNodes:n,selectedEdges:o}=mt(UO,VO);return A.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});bw.displayName="SelectionListener";const $O=t=>!!t.onSelectionChange;function HO({onSelectionChange:t}){const e=mt($O);return t||e?K.createElement(bw,{onSelectionChange:t}):null}const WO=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 ds(t,e){A.useEffect(()=>{t!==void 0&&e(t)},[t])}function at(t,e,n){A.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const qO=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:u,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:_,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:x,onEdgesChange:y,elementsSelectable:v,connectionMode:S,snapGrid:k,snapToGrid:E,translateExtent:j,connectOnClick:I,defaultEdgeOptions:T,fitView:M,fitViewOptions:L,onNodesDelete:B,onEdgesDelete:O,onNodeDrag:z,onNodeDragStart:F,onNodeDragStop:V,onSelectionDrag:P,onSelectionDragStart:C,onSelectionDragStop:$,noPanClassName:N,nodeOrigin:H,rfId:Y,autoPanOnConnect:Z,autoPanOnNodeDrag:q,onError:re,connectionRadius:ne,isValidConnection:oe,nodeDragThreshold:G})=>{const{setNodes:Q,setEdges:ce,setDefaultNodesAndEdges:me,setMinZoom:de,setMaxZoom:ge,setTranslateExtent:ie,setNodeExtent:xe,reset:we}=mt(WO,nn),ae=qt();return A.useEffect(()=>{const Se=o==null?void 0:o.map(pe=>({...pe,...T}));return me(n,Se),()=>{we()}},[]),at("defaultEdgeOptions",T,ae.setState),at("connectionMode",S,ae.setState),at("onConnect",r,ae.setState),at("onConnectStart",s,ae.setState),at("onConnectEnd",i,ae.setState),at("onClickConnectStart",a,ae.setState),at("onClickConnectEnd",l,ae.setState),at("nodesDraggable",c,ae.setState),at("nodesConnectable",d,ae.setState),at("nodesFocusable",u,ae.setState),at("edgesFocusable",f,ae.setState),at("edgesUpdatable",m,ae.setState),at("elementsSelectable",v,ae.setState),at("elevateNodesOnSelect",_,ae.setState),at("snapToGrid",E,ae.setState),at("snapGrid",k,ae.setState),at("onNodesChange",x,ae.setState),at("onEdgesChange",y,ae.setState),at("connectOnClick",I,ae.setState),at("fitViewOnInit",M,ae.setState),at("fitViewOnInitOptions",L,ae.setState),at("onNodesDelete",B,ae.setState),at("onEdgesDelete",O,ae.setState),at("onNodeDrag",z,ae.setState),at("onNodeDragStart",F,ae.setState),at("onNodeDragStop",V,ae.setState),at("onSelectionDrag",P,ae.setState),at("onSelectionDragStart",C,ae.setState),at("onSelectionDragStop",$,ae.setState),at("noPanClassName",N,ae.setState),at("nodeOrigin",H,ae.setState),at("rfId",Y,ae.setState),at("autoPanOnConnect",Z,ae.setState),at("autoPanOnNodeDrag",q,ae.setState),at("onError",re,ae.setState),at("connectionRadius",ne,ae.setState),at("isValidConnection",oe,ae.setState),at("nodeDragThreshold",G,ae.setState),ds(t,Q),ds(e,ce),ds(g,de),ds(p,ge),ds(j,ie),ds(b,xe),null},yw={display:"none"},GO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},xw="react-flow__node-desc",ww="react-flow__edge-desc",YO=t=>t.ariaLiveMessage;function JO({rfId:t}){const e=mt(YO);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:GO},e)}function KO({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${xw}-${t}`,style:yw},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),K.createElement("div",{id:`${ww}-${t}`,style:yw},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(JO,{rfId:t}))}var Bi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=A.useState(!1),r=A.useRef(!1),s=A.useRef(new Set([])),[i,a]=A.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=l.reduce((d,u)=>d.concat(...u),[]);return[l,c]}return[[],[]]},[t]);return A.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const d=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Zu(m))return!1;const _=kw(m.code,a);s.current.add(m[_]),vw(i,s.current,!1)&&(m.preventDefault(),o(!0))},u=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Zu(m))return!1;const _=kw(m.code,a);vw(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[_]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f)}}},[t,o]),n};function vw(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function kw(t,e){return e.includes(t)?"code":"key"}function Sw(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=cs(s,o);return Sw(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[jt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[jt])==null?void 0:l.z)??0:n.z??0},o)}function Cw(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:i,y:a,z:l}=Sw(o,t,{...o.position,z:((s=o[jt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[jt].z=l,n!=null&&n[o.id]&&(o[jt].isParent=!0)}})}function hh(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(Pn(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),d={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},u=a.parentNode||a.parentId;u&&(s[u]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(d,jt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[jt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,d)}),Cw(r,n,s),r}function Nw(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const 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(x=>x.id===g.id):p}),_=m.every(g=>g.width&&g.height);if(m.length>0&&_){const g=ah(m,u),{x:p,y:b,zoom:x}=iw(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=_r.translate(p,b).scale(x);return typeof e.duration=="number"&&e.duration>0?a.transform(Tr(l,e.duration),y):a.transform(l,y),!0}}return!1}function XO(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[jt]:o[jt],selected:n.selected})}),new Map(e)}function ZO(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function zl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:XO(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:ZO(e,s)}),a==null||a(e))}const us=()=>{},QO={zoomIn:us,zoomOut:us,zoomTo:us,getZoom:()=>1,setViewport:us,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:us,fitBounds:us,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},e9=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Ui(){const t=(()=>{const g=qt(),{d3Zoom:p,d3Selection:b}=mt(e9,nn);return A.useMemo(()=>b&&p?{zoomIn:y=>p.scaleBy(Tr(b,y==null?void 0:y.duration),1.2),zoomOut:y=>p.scaleBy(Tr(b,y==null?void 0:y.duration),1/1.2),zoomTo:(y,v)=>p.scaleTo(Tr(b,v==null?void 0:v.duration),y),getZoom:()=>g.getState().transform[2],setViewport:(y,v)=>{const[S,k,E]=g.getState().transform,j=_r.translate(y.x??S,y.y??k).scale(y.zoom??E);p.transform(Tr(b,v==null?void 0:v.duration),j)},getViewport:()=>{const[y,v,S]=g.getState().transform;return{x:y,y:v,zoom:S}},fitView:y=>Nw(g.getState,y),setCenter:(y,v,S)=>{const{width:k,height:E,maxZoom:j}=g.getState(),I=(S==null?void 0:S.zoom)!==void 0?S.zoom:j,T=k/2-y*I,M=E/2-v*I,L=_r.translate(T,M).scale(I);p.transform(Tr(b,S==null?void 0:S.duration),L)},fitBounds:(y,v)=>{const{width:S,height:k,minZoom:E,maxZoom:j}=g.getState(),{x:I,y:T,zoom:M}=iw(y,S,k,E,j,(v==null?void 0:v.padding)??.1),L=_r.translate(I,T).scale(M);p.transform(Tr(b,v==null?void 0:v.duration),L)},project:y=>{const{transform:v,snapToGrid:S,snapGrid:k}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),ih(y,v,S,k)},screenToFlowPosition:y=>{const{transform:v,snapToGrid:S,snapGrid:k,domNode:E}=g.getState();if(!E)return y;const{x:j,y:I}=E.getBoundingClientRect(),T={x:y.x-j,y:y.y-I};return ih(T,v,S,k)},flowToScreenPosition:y=>{const{transform:v,domNode:S}=g.getState();if(!S)return y;const{x:k,y:E}=S.getBoundingClientRect(),j=ow(y,v);return{x:j.x+k,y:j.y+E}},viewportInitialized:!0}:QO,[p,b])})(),e=qt(),n=A.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=A.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=A.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=A.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),i=A.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:x,onNodesChange:y}=e.getState(),v=p(),S=typeof g=="function"?g(v):g;if(x)b(S);else if(y){const k=S.length===0?v.map(E=>({type:"remove",id:E.id})):S.map(E=>({item:E,type:"reset"}));y(k)}},[]),a=A.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:x,onEdgesChange:y}=e.getState(),v=typeof g=="function"?g(p):g;x?b(v):y&&y(v.length===0?p.map(S=>({type:"remove",id:S.id})):v.map(S=>({item:S,type:"reset"})))},[]),l=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:x,hasDefaultNodes:y,onNodesChange:v}=e.getState();if(y)x([...b(),...p]);else if(v){const S=p.map(k=>({item:k,type:"add"}));v(S)}},[]),c=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:x,hasDefaultEdges:y,onEdgesChange:v}=e.getState();y?x([...b,...p]):v&&v(p.map(S=>({item:S,type:"add"})))},[]),d=A.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[x,y,v]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x,y,zoom:v}}},[]),u=A.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:x,edges:y,hasDefaultNodes:v,hasDefaultEdges:S,onNodesDelete:k,onEdgesDelete:E,onNodesChange:j,onEdgesChange:I}=e.getState(),T=(g||[]).map(z=>z.id),M=(p||[]).map(z=>z.id),L=x().reduce((z,F)=>{const V=F.parentNode||F.parentId,P=!T.includes(F.id)&&V&&z.find(C=>C.id===V);return(typeof F.deletable!="boolean"||F.deletable)&&(T.includes(F.id)||P)&&z.push(F),z},[]),B=y.filter(z=>typeof z.deletable!="boolean"||z.deletable),O=B.filter(z=>M.includes(z.id));if(L||O){const z=sw(L,B),F=[...O,...z],V=F.reduce((P,C)=>(P.includes(C.id)||P.push(C.id),P),[]);(S||v)&&(S&&e.setState({edges:y.filter(P=>!V.includes(P.id))}),v&&(L.forEach(P=>{b.delete(P.id)}),e.setState({nodeInternals:new Map(b)}))),V.length>0&&(E==null||E(F),I&&I(V.map(P=>({id:P,type:"remove"})))),L.length>0&&(k==null||k(L),j)&&j(L.map(P=>({id:P.id,type:"remove"})))}},[]),f=A.useCallback(g=>{const p=Pn((b=g).width)&&Pn(b.height)&&Pn(b.x)&&Pn(b.y);var b;const x=p?null:e.getState().nodeInternals.get(g.id);return!p&&!x?[null,null,p]:[p?g:$x(x),x,p]},[]),m=A.useCallback((g,p=!0,b)=>{const[x,y,v]=f(g);return x?(b||e.getState().getNodes()).filter(S=>{if(!(v||S.id!==y.id&&S.positionAbsolute))return!1;const k=$x(S),E=Xu(k,x);return p&&E>0||E>=x.width*x.height}):[]},[]),_=A.useCallback((g,p,b=!0)=>{const[x]=f(g);if(!x)return!1;const y=Xu(x,p);return b&&y>0||y>=x.width*x.height},[]);return A.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:u,getIntersectingNodes:m,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,d,u,m,_])}const t9={actInsideInputWithModifier:!1},fh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Bl=t=>({x:t.x,y:t.y,zoom:t.k}),hs=(t,e)=>t.target.closest(`.${e}`),jw=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Ew=t=>{const e=t.ctrlKey&&Ol()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},n9=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),o9=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=er.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:u=!0,defaultViewport:f,translateExtent:m,minZoom:_,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:x,noWheelClassName:y,noPanClassName:v})=>{const S=A.useRef(),k=qt(),E=A.useRef(!1),j=A.useRef(!1),I=A.useRef(null),T=A.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:L,d3ZoomHandler:B,userSelectionActive:O}=mt(n9,nn),z=Bi(p),F=A.useRef(0),V=A.useRef(!1),P=A.useRef();return function(C){const $=qt();A.useEffect(()=>{let N;const H=()=>{var Z,q;if(!C.current)return;const Y=Yu(C.current);Y.height!==0&&Y.width!==0||((q=(Z=$.getState()).onError)==null||q.call(Z,"004",CO())),$.setState({width:Y.width||500,height:Y.height||500})};return H(),window.addEventListener("resize",H),C.current&&(N=new ResizeObserver(()=>H()),N.observe(C.current)),()=>{window.removeEventListener("resize",H),N&&C.current&&N.unobserve(C.current)}},[])}(I),A.useEffect(()=>{if(I.current){const C=I.current.getBoundingClientRect(),$=function(){var q,re,ne,oe=bO,G=yO,Q=vO,ce=xO,me=wO,de=[0,1/0],ge=[[-1/0,-1/0],[1/0,1/0]],ie=250,xe=iH,we=AS("start","zoom","end"),ae=0,Se=10;function pe(J){J.property("__zoom",Fx).on("wheel.zoom",nt,{passive:!1}).on("mousedown.zoom",it).on("dblclick.zoom",te).filter(me).on("touchstart.zoom",Ce).on("touchmove.zoom",Me).on("touchend.zoom touchcancel.zoom",Be).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Te(J,fe){return(fe=Math.max(de[0],Math.min(de[1],fe)))===J.k?J:new np(fe,J.x,J.y)}function Re(J,fe,_e){var ue=fe[0]-_e[0]*J.k,je=fe[1]-_e[1]*J.k;return ue===J.x&&je===J.y?J:new np(J.k,ue,je)}function He(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function ze(J,fe,_e,ue){J.on("start.zoom",function(){Ne(this,arguments).event(ue).start()}).on("interrupt.zoom end.zoom",function(){Ne(this,arguments).event(ue).end()}).tween("zoom",function(){var je=this,ve=arguments,Ve=Ne(je,ve).event(ue),Qe=G.apply(je,ve),le=_e==null?He(Qe):typeof _e=="function"?_e.apply(je,ve):_e,Ee=Math.max(Qe[1][0]-Qe[0][0],Qe[1][1]-Qe[0][1]),Ie=je.__zoom,Ue=typeof fe=="function"?fe.apply(je,ve):fe,qe=xe(Ie.invert(le).concat(Ee/Ie.k),Ue.invert(le).concat(Ee/Ue.k));return function(De){if(De===1)De=Ue;else{var Ye=qe(De),ot=Ee/Ye[2];De=new np(ot,le[0]-Ye[0]*ot,le[1]-Ye[1]*ot)}Ve.zoom(null,De)}})}function Ne(J,fe,_e){return!_e&&J.__zooming||new Ke(J,fe)}function Ke(J,fe){this.that=J,this.args=fe,this.active=0,this.sourceEvent=null,this.extent=G.apply(J,fe),this.taps=0}function nt(J,...fe){if(oe.apply(this,arguments)){var _e=Ne(this,fe).event(J),ue=this.__zoom,je=Math.max(de[0],Math.min(de[1],ue.k*Math.pow(2,ce.apply(this,arguments)))),ve=io(J);if(_e.wheel)_e.mouse[0][0]===ve[0]&&_e.mouse[0][1]===ve[1]||(_e.mouse[1]=ue.invert(_e.mouse[0]=ve)),clearTimeout(_e.wheel);else{if(ue.k===je)return;_e.mouse=[ve,ue.invert(ve)],op(this),_e.start()}Ri(J),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",Q(Re(Te(ue,je),_e.mouse[0],_e.mouse[1]),_e.extent,ge))}}function it(J,...fe){if(!ne&&oe.apply(this,arguments)){var _e=J.currentTarget,ue=Ne(this,fe,!0).event(J),je=to(J.view).on("mousemove.zoom",function(le){if(Ri(le),!ue.moved){var Ee=le.clientX-Ve,Ie=le.clientY-Qe;ue.moved=Ee*Ee+Ie*Ie>ae}ue.event(le).zoom("mouse",Q(Re(ue.that.__zoom,ue.mouse[0]=io(le,_e),ue.mouse[1]),ue.extent,ge))},!0).on("mouseup.zoom",function(le){je.on("mousemove.zoom mouseup.zoom",null),Lx(le.view,ue.moved),Ri(le),ue.event(le).end()},!0),ve=io(J,_e),Ve=J.clientX,Qe=J.clientY;Px(J.view),Gu(J),ue.mouse=[ve,this.__zoom.invert(ve)],op(this),ue.start()}}function te(J,...fe){if(oe.apply(this,arguments)){var _e=this.__zoom,ue=io(J.changedTouches?J.changedTouches[0]:J,this),je=_e.invert(ue),ve=_e.k*(J.shiftKey?.5:2),Ve=Q(Re(Te(_e,ve),ue,je),G.apply(this,fe),ge);Ri(J),ie>0?to(this).transition().duration(ie).call(ze,Ve,ue,J):to(this).call(pe.transform,Ve,ue,J)}}function Ce(J,...fe){if(oe.apply(this,arguments)){var _e,ue,je,ve,Ve=J.touches,Qe=Ve.length,le=Ne(this,fe,J.changedTouches.length===Qe).event(J);for(Gu(J),ue=0;ue<Qe;++ue)ve=[ve=io(je=Ve[ue],this),this.__zoom.invert(ve),je.identifier],le.touch0?le.touch1||le.touch0[2]===ve[2]||(le.touch1=ve,le.taps=0):(le.touch0=ve,_e=!0,le.taps=1+!!q);q&&(q=clearTimeout(q)),_e&&(le.taps<2&&(re=ve[0],q=setTimeout(function(){q=null},500)),op(this),le.start())}}function Me(J,...fe){if(this.__zooming){var _e,ue,je,ve,Ve=Ne(this,fe).event(J),Qe=J.changedTouches,le=Qe.length;for(Ri(J),_e=0;_e<le;++_e)je=io(ue=Qe[_e],this),Ve.touch0&&Ve.touch0[2]===ue.identifier?Ve.touch0[0]=je:Ve.touch1&&Ve.touch1[2]===ue.identifier&&(Ve.touch1[0]=je);if(ue=Ve.that.__zoom,Ve.touch1){var Ee=Ve.touch0[0],Ie=Ve.touch0[1],Ue=Ve.touch1[0],qe=Ve.touch1[1],De=(De=Ue[0]-Ee[0])*De+(De=Ue[1]-Ee[1])*De,Ye=(Ye=qe[0]-Ie[0])*Ye+(Ye=qe[1]-Ie[1])*Ye;ue=Te(ue,Math.sqrt(De/Ye)),je=[(Ee[0]+Ue[0])/2,(Ee[1]+Ue[1])/2],ve=[(Ie[0]+qe[0])/2,(Ie[1]+qe[1])/2]}else{if(!Ve.touch0)return;je=Ve.touch0[0],ve=Ve.touch0[1]}Ve.zoom("touch",Q(Re(ue,je,ve),Ve.extent,ge))}}function Be(J,...fe){if(this.__zooming){var _e,ue,je=Ne(this,fe).event(J),ve=J.changedTouches,Ve=ve.length;for(Gu(J),ne&&clearTimeout(ne),ne=setTimeout(function(){ne=null},500),_e=0;_e<Ve;++_e)ue=ve[_e],je.touch0&&je.touch0[2]===ue.identifier?delete je.touch0:je.touch1&&je.touch1[2]===ue.identifier&&delete je.touch1;if(je.touch1&&!je.touch0&&(je.touch0=je.touch1,delete je.touch1),je.touch0)je.touch0[1]=this.__zoom.invert(je.touch0[0]);else if(je.end(),je.taps===2&&(ue=io(ue,this),Math.hypot(re[0]-ue[0],re[1]-ue[1])<Se)){var Qe=to(this).on("dblclick.zoom");Qe&&Qe.apply(this,arguments)}}}return pe.transform=function(J,fe,_e,ue){var je=J.selection?J.selection():J;je.property("__zoom",Fx),J!==je?ze(J,fe,_e,ue):je.interrupt().each(function(){Ne(this,arguments).event(ue).start().zoom(null,typeof fe=="function"?fe.apply(this,arguments):fe).end()})},pe.scaleBy=function(J,fe,_e,ue){pe.scaleTo(J,function(){return this.__zoom.k*(typeof fe=="function"?fe.apply(this,arguments):fe)},_e,ue)},pe.scaleTo=function(J,fe,_e,ue){pe.transform(J,function(){var je=G.apply(this,arguments),ve=this.__zoom,Ve=_e==null?He(je):typeof _e=="function"?_e.apply(this,arguments):_e,Qe=ve.invert(Ve),le=typeof fe=="function"?fe.apply(this,arguments):fe;return Q(Re(Te(ve,le),Ve,Qe),je,ge)},_e,ue)},pe.translateBy=function(J,fe,_e,ue){pe.transform(J,function(){return Q(this.__zoom.translate(typeof fe=="function"?fe.apply(this,arguments):fe,typeof _e=="function"?_e.apply(this,arguments):_e),G.apply(this,arguments),ge)},null,ue)},pe.translateTo=function(J,fe,_e,ue,je){pe.transform(J,function(){var ve=G.apply(this,arguments),Ve=this.__zoom,Qe=ue==null?He(ve):typeof ue=="function"?ue.apply(this,arguments):ue;return Q(_r.translate(Qe[0],Qe[1]).scale(Ve.k).translate(typeof fe=="function"?-fe.apply(this,arguments):-fe,typeof _e=="function"?-_e.apply(this,arguments):-_e),ve,ge)},ue,je)},Ke.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active==1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,fe){return this.mouse&&J!=="mouse"&&(this.mouse[1]=fe.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=fe.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=fe.invert(this.touch1[0])),this.that.__zoom=fe,this.emit("zoom"),this},end:function(){return--this.active==0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var fe=to(this.that).datum();we.call(J,this.that,new _O(J,{sourceEvent:this.sourceEvent,target:pe,transform:this.that.__zoom,dispatch:we}),fe)}},pe.wheelDelta=function(J){return arguments.length?(ce=typeof J=="function"?J:Al(+J),pe):ce},pe.filter=function(J){return arguments.length?(oe=typeof J=="function"?J:Al(!!J),pe):oe},pe.touchable=function(J){return arguments.length?(me=typeof J=="function"?J:Al(!!J),pe):me},pe.extent=function(J){return arguments.length?(G=typeof J=="function"?J:Al([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),pe):G},pe.scaleExtent=function(J){return arguments.length?(de[0]=+J[0],de[1]=+J[1],pe):[de[0],de[1]]},pe.translateExtent=function(J){return arguments.length?(ge[0][0]=+J[0][0],ge[1][0]=+J[1][0],ge[0][1]=+J[0][1],ge[1][1]=+J[1][1],pe):[[ge[0][0],ge[0][1]],[ge[1][0],ge[1][1]]]},pe.constrain=function(J){return arguments.length?(Q=J,pe):Q},pe.duration=function(J){return arguments.length?(ie=+J,pe):ie},pe.interpolate=function(J){return arguments.length?(xe=J,pe):xe},pe.on=function(){var J=we.on.apply(we,arguments);return J===we?pe:J},pe.clickDistance=function(J){return arguments.length?(ae=(J=+J)*J,pe):Math.sqrt(ae)},pe.tapDistance=function(J){return arguments.length?(Se=+J,pe):Se},pe}().scaleExtent([_,g]).translateExtent(m),N=to(I.current).call($),H=_r.translate(f.x,f.y).scale(as(f.zoom,_,g)),Y=[[0,0],[C.width,C.height]],Z=$.constrain()(H,Y,m);$.transform(N,Z),$.wheelDelta(Ew),k.setState({d3Zoom:$,d3Selection:N,d3ZoomHandler:N.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:I.current.closest(".react-flow")})}},[]),A.useEffect(()=>{L&&M&&(!i||z||O?B!==void 0&&L.on("wheel.zoom",function(C,$){if(!b&&C.type==="wheel"&&!C.ctrlKey||hs(C,y))return null;C.preventDefault(),B.call(this,C,$)},{passive:!1}):L.on("wheel.zoom",C=>{if(hs(C,y))return!1;C.preventDefault(),C.stopImmediatePropagation();const $=L.property("__zoom").k||1;if(C.ctrlKey&&s){const oe=io(C),G=Ew(C),Q=$*Math.pow(2,G);return void M.scaleTo(L,Q,oe,C)}const N=C.deltaMode===1?20:1;let H=l===er.Vertical?0:C.deltaX*N,Y=l===er.Horizontal?0:C.deltaY*N;!Ol()&&C.shiftKey&&l!==er.Vertical&&(H=C.deltaY*N,Y=0),M.translateBy(L,-H/$*a,-Y/$*a,{internal:!0});const Z=Bl(L.property("__zoom")),{onViewportChangeStart:q,onViewportChange:re,onViewportChangeEnd:ne}=k.getState();clearTimeout(P.current),V.current||(V.current=!0,e==null||e(C,Z),q==null||q(Z)),V.current&&(t==null||t(C,Z),re==null||re(Z),P.current=setTimeout(()=>{n==null||n(C,Z),ne==null||ne(Z),V.current=!1},150))},{passive:!1}))},[O,i,l,L,M,B,z,s,b,y,e,t,n]),A.useEffect(()=>{M&&M.on("start",C=>{var H,Y;if(!C.sourceEvent||C.sourceEvent.internal)return null;F.current=(H=C.sourceEvent)==null?void 0:H.button;const{onViewportChangeStart:$}=k.getState(),N=Bl(C.transform);E.current=!0,T.current=N,((Y=C.sourceEvent)==null?void 0:Y.type)==="mousedown"&&k.setState({paneDragging:!0}),$==null||$(N),e==null||e(C.sourceEvent,N)})},[M,e]),A.useEffect(()=>{M&&(O&&!E.current?M.on("zoom",null):O||M.on("zoom",C=>{var N;const{onViewportChange:$}=k.getState();if(k.setState({transform:[C.transform.x,C.transform.y,C.transform.k]}),j.current=!(!o||!jw(u,F.current??0)),(t||$)&&!((N=C.sourceEvent)!=null&&N.internal)){const H=Bl(C.transform);$==null||$(H),t==null||t(C.sourceEvent,H)}}))},[O,M,t,u,o]),A.useEffect(()=>{M&&M.on("end",C=>{if(!C.sourceEvent||C.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=k.getState();if(E.current=!1,k.setState({paneDragging:!1}),o&&jw(u,F.current??0)&&!j.current&&o(C.sourceEvent),j.current=!1,(n||$)&&(N=T.current,H=C.transform,N.x!==H.x||N.y!==H.y||N.zoom!==H.k)){const Y=Bl(C.transform);T.current=Y,clearTimeout(S.current),S.current=setTimeout(()=>{$==null||$(Y),n==null||n(C.sourceEvent,Y)},i?150:0)}var N,H})},[M,i,u,n,o]),A.useEffect(()=>{M&&M.filter(C=>{const $=z||r,N=s&&C.ctrlKey;if((u===!0||Array.isArray(u)&&u.includes(1))&&C.button===1&&C.type==="mousedown"&&(hs(C,"react-flow__node")||hs(C,"react-flow__edge")))return!0;if(!(u||$||i||c||s)||O||!c&&C.type==="dblclick"||hs(C,y)&&C.type==="wheel"||hs(C,v)&&(C.type!=="wheel"||i&&C.type==="wheel"&&!z)||!s&&C.ctrlKey&&C.type==="wheel"||!$&&!i&&!N&&C.type==="wheel"||!u&&(C.type==="mousedown"||C.type==="touchstart")||Array.isArray(u)&&!u.includes(C.button)&&C.type==="mousedown")return!1;const H=Array.isArray(u)&&u.includes(C.button)||!C.button||C.button<=1;return(!C.ctrlKey||C.type==="wheel")&&H})},[O,M,r,s,i,c,u,d,z]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:fh},x)},r9=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function s9(){const{userSelectionActive:t,userSelectionRect:e}=mt(r9,nn);return t&&e?K.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Iw(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);o.position.x=o.position.x-i,o.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);o.position.y=o.position.y-i,o.style.height+=i,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Aw(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(a=>a.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const a of s)if(a)switch(a.type){case"select":i.selected=a.selected;break;case"position":a.position!==void 0&&(i.position=a.position),a.positionAbsolute!==void 0&&(i.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(i.dragging=a.dragging),i.expandParent&&Iw(o,i);break;case"dimensions":a.dimensions!==void 0&&(i.width=a.dimensions.width,i.height=a.dimensions.height),a.updateStyle!==void 0&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&Iw(o,i);break;case"remove":return o}return o.push(i),o},n)}function Tw(t,e){return Aw(t,e)}const or=(t,e)=>({id:t,type:"select",selected:e});function fs(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(or(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(or(o.id,!1))),n},[])}const mh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},i9=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Mw=A.memo(({isSelecting:t,selectionMode:e=Fi.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:u})=>{const f=A.useRef(null),m=qt(),_=A.useRef(0),g=A.useRef(0),p=A.useRef(),{userSelectionActive:b,elementsSelectable:x,dragging:y}=mt(i9,nn),v=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},S=j=>{s==null||s(j),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},k=a?j=>a(j):void 0,E=x&&(t||b);return K.createElement("div",{className:un(["react-flow__pane",{dragging:y,selection:t}]),onClick:E?void 0:mh(S,f),onContextMenu:mh(j=>{Array.isArray(n)&&(n!=null&&n.includes(2))?j.preventDefault():i==null||i(j)},f),onWheel:mh(k,f),onMouseEnter:E?void 0:l,onMouseDown:E?j=>{const{resetSelectedElements:I,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!x||!t||j.button!==0||j.target!==f.current||!p.current)return;const{x:M,y:L}=Qo(j,p.current);I(),m.setState({userSelectionRect:{width:0,height:0,startX:M,startY:L,x:M,y:L}}),o==null||o(j)}:void 0,onMouseMove:E?j=>{const{userSelectionRect:I,nodeInternals:T,edges:M,transform:L,onNodesChange:B,onEdgesChange:O,nodeOrigin:z,getNodes:F}=m.getState();if(!t||!p.current||!I)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Qo(j,p.current),P=I.startX??0,C=I.startY??0,$={...I,x:V.x<P?V.x:P,y:V.y<C?V.y:C,width:Math.abs(V.x-P),height:Math.abs(V.y-C)},N=F(),H=rw(T,$,L,e===Fi.Partial,!0,z),Y=sw(H,M).map(q=>q.id),Z=H.map(q=>q.id);if(_.current!==Z.length){_.current=Z.length;const q=fs(N,Z);q.length&&(B==null||B(q))}if(g.current!==Y.length){g.current=Y.length;const q=fs(M,Y);q.length&&(O==null||O(q))}m.setState({userSelectionRect:$})}:c,onMouseUp:E?j=>{if(j.button!==0)return;const{userSelectionRect:I}=m.getState();!b&&I&&j.target===f.current&&(S==null||S(j)),m.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(j)}:void 0,onMouseLeave:E?j=>{b&&(m.setState({nodesSelectionActive:_.current>0}),r==null||r(j)),v()}:d,ref:f,style:fh},u,K.createElement(s9,null))});function Ow(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Ow(o,e))}function Dw(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 a9(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Ow(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,i;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=r.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function Rw(t,e,n,o,r=[0,0],s){const i=function(u,f){return f&&f!=="parent"?[f[0],[f[1][0]-(u.width||0),f[1][1]-(u.height||0)]]:f}(t,t.extent||o);let a=i;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const u=n.get(l),{x:f,y:m}=cs(u,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const u=n.get(l),{x:f,y:m}=cs(u,r).positionAbsolute;a=u&&Pn(f)&&Pn(m)&&Pn(u.width)&&Pn(u.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+u.width-t.width+t.width*r[0],m+u.height-t.height+t.height*r[1]]]:a}else s==null||s("005",NO()),a=i;let c={x:0,y:0};if(l){const u=n.get(l);c=cs(u,r).positionAbsolute}const d=a&&a!=="parent"?Ju(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function ph({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]}Mw.displayName="Pane";const Pw=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-i.left-a)/n,y:(d.top-i.top-l)/n,...Yu(c)}})};function Vi(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function gh({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])):l==null||l("012",TO(t))}function _h(t){return(e,n,o)=>t==null?void 0:t(e,o)}function Lw({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=qt(),[l,c]=A.useState(!1),d=A.useRef([]),u=A.useRef({x:null,y:null}),f=A.useRef(0),m=A.useRef(null),_=A.useRef({x:0,y:0}),g=A.useRef(null),p=A.useRef(!1),b=A.useRef(!1),x=A.useRef(!1),y=function(){const v=qt();return A.useCallback(({sourceEvent:k})=>{const{transform:E,snapGrid:j,snapToGrid:I}=v.getState(),T=k.touches?k.touches[0].clientX:k.clientX,M=k.touches?k.touches[0].clientY:k.clientY,L={x:(T-E[0])/E[2],y:(M-E[1])/E[2]};return{xSnapped:I?j[0]*Math.round(L.x/j[0]):L.x,ySnapped:I?j[1]*Math.round(L.y/j[1]):L.y,...L}},[])}();return A.useEffect(()=>{if(t!=null&&t.current){const v=to(t.current),S=({x:j,y:I})=>{const{nodeInternals:T,onNodeDrag:M,onSelectionDrag:L,updateNodePositions:B,nodeExtent:O,snapGrid:z,snapToGrid:F,nodeOrigin:V,onError:P}=a.getState();u.current={x:j,y:I};let C=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&O){const H=ah(d.current,V);$=Ku(H)}if(d.current=d.current.map(H=>{const Y={x:j-H.distance.x,y:I-H.distance.y};F&&(Y.x=z[0]*Math.round(Y.x/z[0]),Y.y=z[1]*Math.round(Y.y/z[1]));const Z=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];d.current.length>1&&O&&!H.extent&&(Z[0][0]=H.positionAbsolute.x-$.x+O[0][0],Z[1][0]=H.positionAbsolute.x+(H.width??0)-$.x2+O[1][0],Z[0][1]=H.positionAbsolute.y-$.y+O[0][1],Z[1][1]=H.positionAbsolute.y+(H.height??0)-$.y2+O[1][1]);const q=Rw(H,Y,T,Z,V,P);return C=C||H.position.x!==q.position.x||H.position.y!==q.position.y,H.position=q.position,H.positionAbsolute=q.positionAbsolute,H}),!C)return;B(d.current,!0,!0),c(!0);const N=r?M:_h(L);if(N&&g.current){const[H,Y]=ph({nodeId:r,dragItems:d.current,nodeInternals:T});N(g.current,H,Y)}},k=()=>{if(!m.current)return;const[j,I]=Ux(_.current,m.current);if(j!==0||I!==0){const{transform:T,panBy:M}=a.getState();u.current.x=(u.current.x??0)-j/T[2],u.current.y=(u.current.y??0)-I/T[2],M({x:j,y:I})&&S(u.current)}f.current=requestAnimationFrame(k)},E=j=>{var V;const{nodeInternals:I,multiSelectionActive:T,nodesDraggable:M,unselectNodesAndEdges:L,onNodeDragStart:B,onSelectionDragStart:O}=a.getState();b.current=!0;const z=r?B:_h(O);i&&s||T||!r||(V=I.get(r))!=null&&V.selected||L(),r&&s&&i&&gh({id:r,store:a,nodeRef:t});const F=y(j);if(u.current=F,d.current=a9(I,M,F,r),z&&d.current){const[P,C]=ph({nodeId:r,dragItems:d.current,nodeInternals:I});z(j.sourceEvent,P,C)}};if(!e){const j=function(){var I,T,M,L,B=fO,O=mO,z=pO,F=gO,V={},P=AS("start","drag","end"),C=0,$=0;function N(G){G.on("mousedown.drag",H).filter(F).on("touchstart.drag",q).on("touchmove.drag",re,hO).on("touchend.drag touchcancel.drag",ne).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function H(G,Q){if(!L&&B.call(this,G,Q)){var ce=oe(this,O.call(this,G,Q),G,Q,"mouse");ce&&(to(G.view).on("mousemove.drag",Y,Di).on("mouseup.drag",Z,Di),Px(G.view),Wu(G),M=!1,I=G.clientX,T=G.clientY,ce("start",G))}}function Y(G){if(is(G),!M){var Q=G.clientX-I,ce=G.clientY-T;M=Q*Q+ce*ce>$}V.mouse("drag",G)}function Z(G){to(G.view).on("mousemove.drag mouseup.drag",null),Lx(G.view,M),is(G),V.mouse("end",G)}function q(G,Q){if(B.call(this,G,Q)){var ce,me,de=G.changedTouches,ge=O.call(this,G,Q),ie=de.length;for(ce=0;ce<ie;++ce)(me=oe(this,ge,G,Q,de[ce].identifier,de[ce]))&&(Wu(G),me("start",G,de[ce]))}}function re(G){var Q,ce,me=G.changedTouches,de=me.length;for(Q=0;Q<de;++Q)(ce=V[me[Q].identifier])&&(is(G),ce("drag",G,me[Q]))}function ne(G){var Q,ce,me=G.changedTouches,de=me.length;for(L&&clearTimeout(L),L=setTimeout(function(){L=null},500),Q=0;Q<de;++Q)(ce=V[me[Q].identifier])&&(Wu(G),ce("end",G,me[Q]))}function oe(G,Q,ce,me,de,ge){var ie,xe,we,ae=P.copy(),Se=io(ge||ce,Q);if((we=z.call(G,new qu("beforestart",{sourceEvent:ce,target:N,identifier:de,active:C,x:Se[0],y:Se[1],dx:0,dy:0,dispatch:ae}),me))!=null)return ie=we.x-Se[0]||0,xe=we.y-Se[1]||0,function pe(Te,Re,He){var ze,Ne=Se;switch(Te){case"start":V[de]=pe,ze=C++;break;case"end":delete V[de],--C;case"drag":Se=io(He||Re,Q),ze=C}ae.call(Te,G,new qu(Te,{sourceEvent:Re,subject:we,target:N,identifier:de,active:ze,x:Se[0]+ie,y:Se[1]+xe,dx:Se[0]-Ne[0],dy:Se[1]-Ne[1],dispatch:ae}),me)}}return N.filter=function(G){return arguments.length?(B=typeof G=="function"?G:Il(!!G),N):B},N.container=function(G){return arguments.length?(O=typeof G=="function"?G:Il(G),N):O},N.subject=function(G){return arguments.length?(z=typeof G=="function"?G:Il(G),N):z},N.touchable=function(G){return arguments.length?(F=typeof G=="function"?G:Il(!!G),N):F},N.on=function(){var G=P.on.apply(P,arguments);return G===P?N:G},N.clickDistance=function(G){return arguments.length?($=(G=+G)*G,N):Math.sqrt($)},N}().on("start",I=>{const{domNode:T,nodeDragThreshold:M}=a.getState();M===0&&E(I),x.current=!1;const L=y(I);u.current=L,m.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=Qo(I.sourceEvent,m.current)}).on("drag",I=>{var B,O;const T=y(I),{autoPanOnNodeDrag:M,nodeDragThreshold:L}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!p.current&&b.current&&M&&(p.current=!0,k()),!b.current){const z=T.xSnapped-(((B=u==null?void 0:u.current)==null?void 0:B.x)??0),F=T.ySnapped-(((O=u==null?void 0:u.current)==null?void 0:O.y)??0);Math.sqrt(z*z+F*F)>L&&E(I)}(u.current.x!==T.xSnapped||u.current.y!==T.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=Qo(I.sourceEvent,m.current),S(T))}}).on("end",I=>{if(b.current&&!x.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:M,onNodeDragStop:L,onSelectionDragStop:B}=a.getState(),O=r?L:_h(B);if(T(d.current,!1,!1),O){const[z,F]=ph({nodeId:r,dragItems:d.current,nodeInternals:M});O(I.sourceEvent,z,F)}}}).filter(I=>{const T=I.target;return!I.button&&(!n||!Dw(T,`.${n}`,t))&&(!o||Dw(T,o,t))});return v.call(j),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,y]),l}function Fw(){const t=qt();return A.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),u=i().filter(x=>x.selected&&(x.draggable||d&&x.draggable===void 0)),f=a?l[0]:5,m=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,p=n.y*m*_,b=u.map(x=>{if(x.positionAbsolute){const y={x:x.positionAbsolute.x+g,y:x.positionAbsolute.y+p};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:v,position:S}=Rw(x,y,o,r,void 0,c);x.position=S,x.positionAbsolute=v}return x});s(b,!0,!1)},[])}const ms={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var $i=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:u,onMouseMove:f,onMouseLeave:m,onContextMenu:_,onDoubleClick:g,style:p,className:b,isDraggable:x,isSelectable:y,isConnectable:v,isFocusable:S,selectNodesOnDrag:k,sourcePosition:E,targetPosition:j,hidden:I,resizeObserver:T,dragHandle:M,zIndex:L,isParent:B,noDragClassName:O,noPanClassName:z,initialized:F,disableKeyboardA11y:V,ariaLabel:P,rfId:C,hasHandleBounds:$})=>{const N=qt(),H=A.useRef(null),Y=A.useRef(null),Z=A.useRef(E),q=A.useRef(j),re=A.useRef(o),ne=y||x||d||u||f||m,oe=Fw(),G=Vi(n,N.getState,u),Q=Vi(n,N.getState,f),ce=Vi(n,N.getState,m),me=Vi(n,N.getState,_),de=Vi(n,N.getState,g);A.useEffect(()=>()=>{Y.current&&(T==null||T.unobserve(Y.current),Y.current=null)},[]),A.useEffect(()=>{if(H.current&&!I){const ie=H.current;F&&$&&Y.current===ie||(Y.current&&(T==null||T.unobserve(Y.current)),T==null||T.observe(ie),Y.current=ie)}},[I,F,$]),A.useEffect(()=>{const ie=re.current!==o,xe=Z.current!==E,we=q.current!==j;H.current&&(ie||xe||we)&&(ie&&(re.current=o),xe&&(Z.current=E),we&&(q.current=j),N.getState().updateNodeDimensions([{id:n,nodeElement:H.current,forceUpdate:!0}]))},[n,o,E,j]);const ge=Lw({nodeRef:H,disabled:I||!x,noDragClassName:O,handleSelector:M,nodeId:n,isSelectable:y,selectNodesOnDrag:k});return I?null:K.createElement("div",{className:un(["react-flow__node",`react-flow__node-${o}`,{[z]:x},b,{selected:c,selectable:y,parent:B,dragging:ge}]),ref:H,style:{zIndex:L,transform:`translate(${a}px,${l}px)`,pointerEvents:ne?"all":"none",visibility:F?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:G,onMouseMove:Q,onMouseLeave:ce,onContextMenu:me,onClick:ie=>{const{nodeDragThreshold:xe}=N.getState();if(y&&(!k||!x||xe>0)&&gh({id:n,store:N,nodeRef:H}),d){const we=N.getState().nodeInternals.get(n);we&&d(ie,{...we})}},onDoubleClick:de,onKeyDown:S?ie=>{if(!Zu(ie)&&!V)if(Hx.includes(ie.key)&&y){const xe=ie.key==="Escape";gh({id:n,store:N,unselect:xe,nodeRef:H})}else x&&c&&Object.prototype.hasOwnProperty.call(ms,ie.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ie.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),oe({x:ms[ie.key].x,y:ms[ie.key].y,isShiftPressed:ie.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":V?void 0:`${xw}-${C}`,"aria-label":P},K.createElement(PO,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:E,targetPosition:j,dragging:ge,dragHandle:M,zIndex:L})))};return e.displayName="NodeWrapper",A.memo(e)};const l9=t=>{const e=t.getNodes().filter(n=>n.selected);return{...ah(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var c9=A.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=qt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=mt(l9,nn),d=Fw(),u=A.useRef(null);if(A.useEffect(()=>{var m;n||((m=u.current)==null||m.focus({preventScroll:!0}))},[n]),Lw({nodeRef:u}),c||!r||!s)return null;const f=t?m=>{const _=o.getState().getNodes().filter(g=>g.selected);t(m,_)}:void 0;return K.createElement("div",{className:un(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(ms,m.key)&&d({x:ms[m.key].x,y:ms[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const d9=t=>t.nodesSelectionActive,zw=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:m,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:k,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:T,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,preventScrolling:z,onSelectionContextMenu:F,noWheelClassName:V,noPanClassName:P,disableKeyboardA11y:C})=>{const $=mt(d9),N=Bi(u),H=Bi(b),Y=H||T,Z=H||k,q=N||f&&Y!==!0;return(({deleteKeyCode:re,multiSelectionKeyCode:ne})=>{const oe=qt(),{deleteElements:G}=Ui(),Q=Bi(re,t9),ce=Bi(ne);A.useEffect(()=>{if(Q){const{edges:me,getNodes:de}=oe.getState(),ge=de().filter(xe=>xe.selected),ie=me.filter(xe=>xe.selected);G({nodes:ge,edges:ie}),oe.setState({nodesSelectionActive:!1})}},[Q]),A.useEffect(()=>{oe.setState({multiSelectionActive:ce})},[ce])})({deleteKeyCode:a,multiSelectionKeyCode:p}),K.createElement(o9,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:Z,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:!N&&Y,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,zoomActivationKeyCode:x,preventScrolling:z,noWheelClassName:V,noPanClassName:P},K.createElement(Mw,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:Y,isSelecting:!!q,selectionMode:m},t,$&&K.createElement(c9,{onSelectionContextMenu:F,noPanClassName:P,disableKeyboardA11y:C})))};zw.displayName="FlowRenderer";var u9=A.memo(zw);function h9(t){return{input:$i(t.input||pw),default:$i(t.default||dh),output:$i(t.output||_w),group:$i(t.group||uh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=$i(t[n]||dh),e),{})}}const f9=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Bw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=mt(f9,nn),a=(l=t.onlyRenderVisibleElements,mt(A.useCallback(u=>l?rw(u.nodeInternals,{x:0,y:0,width:u.width,height:u.height},u.transform,!0):u.getNodes(),[l])));var l;const c=A.useRef(),d=A.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(f=>{const m=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(m)});return c.current=u,u},[]);return A.useEffect(()=>()=>{var u;(u=c==null?void 0:c.current)==null||u.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:fh},a.map(u=>{var k,E,j;let f=u.type||"default";t.nodeTypes[f]||(i==null||i("003",SO(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,_=!!(u.draggable||e&&u.draggable===void 0),g=!!(u.selectable||r&&u.selectable===void 0),p=!!(u.connectable||n&&u.connectable===void 0),b=!!(u.focusable||o&&u.focusable===void 0),x=t.nodeExtent?Ju(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,y=(x==null?void 0:x.x)??0,v=(x==null?void 0:x.y)??0,S=(({x:I,y:T,width:M,height:L,origin:B})=>M&&L?B[0]<0||B[1]<0||B[0]>1||B[1]>1?{x:I,y:T}:{x:I-M*B[0],y:T-L*B[1]}:{x:I,y:T})({x:y,y:v,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return K.createElement(m,{key:u.id,id:u.id,className:u.className,style:u.style,type:f,data:u.data,sourcePosition:u.sourcePosition||$e.Bottom,targetPosition:u.targetPosition||$e.Top,hidden:u.hidden,xPos:y,yPos:v,xPosOrigin: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:!!u.selected,isDraggable:_,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:d,dragHandle:u.dragHandle,zIndex:((k=u[jt])==null?void 0:k.z)??0,isParent:!!((E=u[jt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!((j=u[jt])!=null&&j.handleBounds)})}))};Bw.displayName="NodeRenderer";var m9=A.memo(Bw);const p9=(t,e,n)=>n===$e.Left?t-e:n===$e.Right?t+e:t,g9=(t,e,n)=>n===$e.Top?t-e:n===$e.Bottom?t+e:t,Uw="react-flow__edgeupdater",Vw=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:un([Uw,`${Uw}-${a}`]),cx:p9(e,o,t),cy:g9(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),_9=()=>!0;var ps=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,style:p,source:b,target:x,sourceX:y,sourceY:v,targetX:S,targetY:k,sourcePosition:E,targetPosition:j,elementsSelectable:I,hidden:T,sourceHandleId:M,targetHandleId:L,onContextMenu:B,onMouseEnter:O,onMouseMove:z,onMouseLeave:F,reconnectRadius:V,onReconnect:P,onReconnectStart:C,onReconnectEnd:$,markerEnd:N,markerStart:H,rfId:Y,ariaLabel:Z,isFocusable:q,isReconnectable:re,pathOptions:ne,interactionWidth:oe,disableKeyboardA11y:G})=>{const Q=A.useRef(null),[ce,me]=A.useState(!1),[de,ge]=A.useState(!1),ie=qt(),xe=A.useMemo(()=>`url('#${sh(H,Y)}')`,[H,Y]),we=A.useMemo(()=>`url('#${sh(N,Y)}')`,[N,Y]);if(T)return null;const ae=Li(n,ie.getState,a),Se=Li(n,ie.getState,B),pe=Li(n,ie.getState,O),Te=Li(n,ie.getState,z),Re=Li(n,ie.getState,F),He=(nt,it)=>{if(nt.button!==0)return;const{edges:te,isValidConnection:Ce}=ie.getState(),Me=it?x:b,Be=(it?L:M)||null,J=it?"target":"source",fe=Ce||_9,_e=it,ue=te.find(je=>je.id===n);ge(!0),C==null||C(nt,ue,J),dw({event:nt,handleId:Be,nodeId:Me,onConnect:je=>P==null?void 0:P(ue,je),isTarget:_e,getState:ie.getState,setState:ie.setState,isValidConnection:fe,edgeUpdaterType:J,onReconnectEnd:je=>{ge(!1),$==null||$(je,ue,J)}})},ze=()=>me(!0),Ne=()=>me(!1),Ke=!I&&!i;return K.createElement("g",{className:un(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:Ke,updating:ce}]),onClick:nt=>{var J;const{edges:it,addSelectedEdges:te,unselectNodesAndEdges:Ce,multiSelectionActive:Me}=ie.getState(),Be=it.find(fe=>fe.id===n);Be&&(I&&(ie.setState({nodesSelectionActive:!1}),Be.selected&&Me?(Ce({nodes:[],edges:[Be]}),(J=Q.current)==null||J.blur()):te([n])),i&&i(nt,Be))},onDoubleClick:ae,onContextMenu:Se,onMouseEnter:pe,onMouseMove:Te,onMouseLeave:Re,onKeyDown:q?nt=>{var it;if(!G&&Hx.includes(nt.key)&&I){const{unselectNodesAndEdges:te,addSelectedEdges:Ce,edges:Me}=ie.getState();nt.key==="Escape"?((it=Q.current)==null||it.blur(),te({edges:[Me.find(Be=>Be.id===n)]})):Ce([n])}}:void 0,tabIndex:q?0:void 0,role:q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Z===null?void 0:Z||`Edge from ${b} to ${x}`,"aria-describedby":q?`${ww}-${Y}`:void 0,ref:Q},!de&&K.createElement(t,{id:n,source:b,target:x,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:p,sourceX:y,sourceY:v,targetX:S,targetY:k,sourcePosition:E,targetPosition:j,sourceHandleId:M,targetHandleId:L,markerStart:xe,markerEnd:we,pathOptions:ne,interactionWidth:oe}),re&&K.createElement(K.Fragment,null,(re==="source"||re===!0)&&K.createElement(Vw,{position:E,centerX:y,centerY:v,radius:V,onMouseDown:nt=>He(nt,!0),onMouseEnter:ze,onMouseOut:Ne,type:"source"}),(re==="target"||re===!0)&&K.createElement(Vw,{position:j,centerX:S,centerY:k,radius:V,onMouseDown:nt=>He(nt,!1),onMouseEnter:ze,onMouseOut:Ne,type:"target"})))};return e.displayName="EdgeWrapper",A.memo(e)};function b9(t){return{default:ps(t.default||Ll),straight:ps(t.bezier||oh),step:ps(t.step||nh),smoothstep:ps(t.step||Rl),simplebezier:ps(t.simplebezier||eh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ps(t[n]||Ll),e),{})}}function $w(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case $e.Top:return{x:o+s/2,y:r};case $e.Right:return{x:o+s,y:r+i/2};case $e.Bottom:return{x:o+s/2,y:r+i};case $e.Left:return{x:o,y:r+i/2}}}function Hw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function Ww(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[jt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const y9=[{level:0,isMaxLevel:!0,edges:[]}];function x9(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var m,_;const u=Pn(d.zIndex);let f=u?d.zIndex:0;if(s){const g=r.get(d.target),p=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),x=Math.max(((m=p==null?void 0:p[jt])==null?void 0:m.z)||0,((_=g==null?void 0:g[jt])==null?void 0:_.z)||0,1e3);f=(u?d.zIndex:0)+(b?x:0)}return c[f]?c[f].push(d):c[f]=[d],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,d])=>{const u=+c;return{edges:d,level:u,isMaxLevel:u===i}});return l.length===0?y9:l}(mt(A.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:d,targetWidth:u,targetHeight:f,width:m,height:_,transform:g}){const p={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+u),y2:Math.max(a.y+d,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Ku({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:_/g[2]}),x=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),y=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(x*y)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const qw={[ls.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[ls.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},w9=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const d=qt();return A.useMemo(()=>{var u,f;return Object.prototype.hasOwnProperty.call(qw,c)?qw[c]:((f=(u=d.getState()).onError)==null||f.call(u,"009",jO(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:i})):null},Gw=({defaultColor:t,rfId:e})=>{const n=mt(A.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=sh(c,r);i.includes(d)||(a.push({id:d,color:c.color||o,...c}),i.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return K.createElement("defs",null,n.map(o=>K.createElement(w9,{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})))};Gw.displayName="MarkerDefinitions";var v9=A.memo(Gw);const k9=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}),Yw=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:x,edgesUpdatable:y,elementsSelectable:v,width:S,height:k,connectionMode:E,nodeInternals:j,onError:I}=mt(k9,nn),T=x9(e,j,n);return S?K.createElement(K.Fragment,null,T.map(({level:M,edges:L,isMaxLevel:B})=>K.createElement("svg",{key:M,style:{zIndex:M},width:S,height:k,className:"react-flow__edges react-flow__container"},B&&K.createElement(v9,{defaultColor:t,rfId:o}),K.createElement("g",null,L.map(O=>{const[z,F,V]=Ww(j.get(O.source)),[P,C,$]=Ww(j.get(O.target));if(!V||!$)return null;let N=O.type||"default";r[N]||(I==null||I("011",AO(N)),N="default");const H=r[N]||r.default,Y=E===Ar.Strict?C.target:(C.target??[]).concat(C.source??[]),Z=Hw(F.source,O.sourceHandle),q=Hw(Y,O.targetHandle),re=(Z==null?void 0:Z.position)||$e.Bottom,ne=(q==null?void 0:q.position)||$e.Top,oe=!!(O.focusable||x&&O.focusable===void 0),G=O.reconnectable||O.updatable,Q=f!==void 0&&(G||y&&G===void 0);if(!Z||!q)return I==null||I("008",EO(Z,O)),null;const{sourceX:ce,sourceY:me,targetX:de,targetY:ge}=((ie,xe,we,ae,Se,pe)=>{const Te=$w(we,ie,xe),Re=$w(pe,ae,Se);return{sourceX:Te.x,sourceY:Te.y,targetX:Re.x,targetY:Re.y}})(z,Z,re,P,q,ne);return K.createElement(H,{key:O.id,id:O.id,className:un([O.className,s]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ce,sourceY:me,targetX:de,targetY:ge,sourcePosition:re,targetPosition:ne,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:O.ariaLabel,isFocusable:oe,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),p):null};Yw.displayName="EdgeRenderer";var S9=A.memo(Yw);const C9=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function N9({children:t}){const e=mt(C9);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const j9={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},Jw=({nodeId:t,handleType:e,style:n,type:o=tr.Bezier,CustomComponent:r,connectionStatus:s})=>{var k,E,j;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=mt(A.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),nn),u=(k=i==null?void 0:i[jt])==null?void 0:k.handleBounds;let f=u==null?void 0:u[e];if(d===Ar.Loose&&(f=f||(u==null?void 0:u[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(I=>I.id===a):f[0],_=m?m.x+m.width/2:(i.width??0)/2,g=m?m.y+m.height/2:i.height??0,p=(((E=i.positionAbsolute)==null?void 0:E.x)??0)+_,b=(((j=i.positionAbsolute)==null?void 0:j.y)??0)+g,x=m==null?void 0:m.position,y=x?j9[x]:null;if(!x||!y)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:x,toPosition:y,connectionStatus:s});let v="";const S={sourceX:p,sourceY:b,sourcePosition:x,targetX:l,targetY:c,targetPosition:y};return o===tr.Bezier?[v]=nw(S):o===tr.Step?[v]=th({...S,borderRadius:0}):o===tr.SmoothStep?[v]=th(S):o===tr.SimpleBezier?[v]=Zx(S):v=`M${p},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};Jw.displayName="ConnectionLine";const E9=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function I9({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=mt(E9,nn);return r&&s&&a&&i?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:un(["react-flow__connection",c])},K.createElement(Jw,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function Kw(t,e){return A.useRef(null),qt(),A.useMemo(()=>e(t),[t])}const Xw=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:S,selectionOnDrag:k,selectionMode:E,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,deleteKeyCode:M,onlyRenderVisibleElements:L,elementsSelectable:B,selectNodesOnDrag:O,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,preventScrolling:C,defaultMarkerColor:$,zoomOnScroll:N,zoomOnPinch:H,panOnScroll:Y,panOnScrollSpeed:Z,panOnScrollMode:q,zoomOnDoubleClick:re,panOnDrag:ne,onPaneClick:oe,onPaneMouseEnter:G,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneScroll:me,onPaneContextMenu:de,onEdgeContextMenu:ge,onEdgeMouseEnter:ie,onEdgeMouseMove:xe,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:Se,onReconnectEnd:pe,reconnectRadius:Te,noDragClassName:Re,noWheelClassName:He,noPanClassName:ze,elevateEdgesOnSelect:Ne,disableKeyboardA11y:Ke,nodeOrigin:nt,nodeExtent:it,rfId:te})=>{const Ce=Kw(t,h9),Me=Kw(e,b9);return function(Be){const J=Ui(),fe=A.useRef(!1);A.useEffect(()=>{!fe.current&&J.viewportInitialized&&Be&&(setTimeout(()=>Be(J),1),fe.current=!0)},[Be,J.viewportInitialized])}(s),K.createElement(u9,{onPaneClick:oe,onPaneMouseEnter:G,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneContextMenu:de,onPaneScroll:me,deleteKeyCode:M,selectionKeyCode:S,selectionOnDrag:k,selectionMode:E,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,elementsSelectable:B,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:N,zoomOnPinch:H,zoomOnDoubleClick:re,panOnScroll:Y,panOnScrollSpeed:Z,panOnScrollMode:q,panOnDrag:ne,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,onSelectionContextMenu:_,preventScrolling:C,noDragClassName:Re,noWheelClassName:He,noPanClassName:ze,disableKeyboardA11y:Ke},K.createElement(N9,null,K.createElement(S9,{edgeTypes:Me,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:L,onEdgeContextMenu:ge,onEdgeMouseEnter:ie,onEdgeMouseMove:xe,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:Se,onReconnectEnd:pe,reconnectRadius:Te,defaultMarkerColor:$,noPanClassName:ze,elevateEdgesOnSelect:!!Ne,disableKeyboardA11y:Ke,rfId:te},K.createElement(I9,{style:x,type:b,component:y,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(m9,{nodeTypes:Ce,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:O,onlyRenderVisibleElements:L,noPanClassName:ze,noDragClassName:Re,disableKeyboardA11y:Ke,nodeOrigin:nt,nodeExtent:it,rfId:te})))};Xw.displayName="GraphView";var A9=A.memo(Xw);const bh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],rr={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:bh,nodeExtent:bh,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ar.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},T9=()=>((t,e)=>t?Rx(t,e):Rx)((t,e)=>({...rr,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:hh(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,i=r?hh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const u=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(u.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[jt]:{...b[jt],handleBounds:void 0}});else if(b){const x=Yu(p.nodeElement);!(!x.width||!x.height||b.width===x.width&&b.height===x.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[jt]:{...b[jt],handleBounds:{source:Pw(".source",p.nodeElement,f,c),target:Pw(".target",p.nodeElement,f,c)}},...x}),g.push({id:b.id,type:"dimensions",dimensions:x}))}return g},[]);Cw(r,c);const _=i||s&&!i&&Nw(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=hh(Tw(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>or(l,!0)):(i=fs(s(),n),a=fs(r,[])),zl({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>or(l,!0)):(i=fs(r,n),a=fs(s(),[])),zl({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;zl({changedNodes:(n||s()).map(a=>(a.selected=!1,or(a.id,!1))),changedEdges:i.map(a=>or(a.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();zl({changedNodes:o().filter(r=>r.selected).map(r=>or(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>or(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Ju(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=_r.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],u=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,u),o[0]!==u.x||o[1]!==u.y||o[2]!==u.k},cancelConnection:()=>t({connectionNodeId:rr.connectionNodeId,connectionHandleId:rr.connectionHandleId,connectionHandleType:rr.connectionHandleType,connectionStatus:rr.connectionStatus,connectionStartHandle:rr.connectionStartHandle,connectionEndHandle:rr.connectionEndHandle}),reset:()=>t({...rr})}),Object.is),yh=({children:t})=>{const e=A.useRef(null);return e.current||(e.current=T9()),K.createElement(kO,{value:e.current},t)};yh.displayName="ReactFlowProvider";const Zw=({children:t})=>A.useContext(Tl)?K.createElement(K.Fragment,null,t):K.createElement(yh,null,t);Zw.displayName="ReactFlowWrapper";const M9={input:pw,default:dh,output:_w,group:uh},O9={default:Ll,straight:oh,step:nh,smoothstep:Rl,simplebezier:eh},D9=[0,0],R9=[15,15],P9={x:0,y:0,zoom:1},L9={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},xh=A.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=M9,edgeTypes:i=O9,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onNodesDelete:T,onEdgesDelete:M,onSelectionChange:L,onSelectionDragStart:B,onSelectionDrag:O,onSelectionDragStop:z,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,connectionMode:C=Ar.Strict,connectionLineType:$=tr.Bezier,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:Y,deleteKeyCode:Z="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:re=!1,selectionMode:ne=Fi.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:G=Ol()?"Meta":"Control",zoomActivationKeyCode:Q=Ol()?"Meta":"Control",snapToGrid:ce=!1,snapGrid:me=R9,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:ge=!0,nodesDraggable:ie,nodesConnectable:xe,nodesFocusable:we,nodeOrigin:ae=D9,edgesFocusable:Se,edgesUpdatable:pe,elementsSelectable:Te,defaultViewport:Re=P9,minZoom:He=.5,maxZoom:ze=2,translateExtent:Ne=bh,preventScrolling:Ke=!0,nodeExtent:nt,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:te=!0,zoomOnPinch:Ce=!0,panOnScroll:Me=!1,panOnScrollSpeed:Be=.5,panOnScrollMode:J=er.Free,zoomOnDoubleClick:fe=!0,panOnDrag:_e=!0,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ve,onPaneMouseLeave:Ve,onPaneScroll:Qe,onPaneContextMenu:le,children:Ee,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:Ye,onEdgeUpdate:ot,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:rt,onReconnect:pt,onReconnectStart:yt,onReconnectEnd:Ot,reconnectRadius:wt=10,edgeUpdaterRadius:Ut=10,onNodesChange:Sn,onEdgesChange:hn,noDragClassName:rn="nodrag",noWheelClassName:Xt="nowheel",noPanClassName:Xn="nopan",fitView:ho=!1,fitViewOptions:ks,connectOnClick:Ss=!0,attributionPosition:Cs,proOptions:Ns,defaultEdgeOptions:js,elevateNodesOnSelect:ar=!0,elevateEdgesOnSelect:Es=!1,disableKeyboardA11y:Is=!1,autoPanOnConnect:As=!0,autoPanOnNodeDrag:Lt=!0,connectionRadius:vt=20,isValidConnection:Cn,onError:Nn,style:Ts,id:nc,nodeDragThreshold:Jf,...Kf},oc)=>{const Xf=nc||"1";return K.createElement("div",{...Kf,style:{...Ts,...L9},ref:oc,className:un(["react-flow",r]),"data-testid":"rf__wrapper",id:nc},K.createElement(Zw,null,K.createElement(A9,{onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:Y,selectionKeyCode:q,selectionOnDrag:re,selectionMode:ne,deleteKeyCode:Z,multiSelectionKeyCode:G,panActivationKeyCode:oe,zoomActivationKeyCode:Q,onlyRenderVisibleElements:de,selectNodesOnDrag:ge,defaultViewport:Re,translateExtent:Ne,minZoom:He,maxZoom:ze,preventScrolling:Ke,zoomOnScroll:te,zoomOnPinch:Ce,zoomOnDoubleClick:fe,panOnScroll:Me,panOnScrollSpeed:Be,panOnScrollMode:J,panOnDrag:_e,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ve,onPaneMouseLeave:Ve,onPaneScroll:Qe,onPaneContextMenu:le,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:Ye,onReconnect:pt??ot,onReconnectStart:yt??Xe,onReconnectEnd:Ot??rt,reconnectRadius:wt??Ut,defaultMarkerColor:it,noDragClassName:rn,noWheelClassName:Xt,noPanClassName:Xn,elevateEdgesOnSelect:Es,rfId:Xf,disableKeyboardA11y:Is,nodeOrigin:ae,nodeExtent:nt}),K.createElement(qO,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:ie,nodesConnectable:xe,nodesFocusable:we,edgesFocusable:Se,edgesUpdatable:pe,elementsSelectable:Te,elevateNodesOnSelect:ar,minZoom:He,maxZoom:ze,nodeExtent:nt,onNodesChange:Sn,onEdgesChange:hn,snapToGrid:ce,snapGrid:me,connectionMode:C,translateExtent:Ne,connectOnClick:Ss,defaultEdgeOptions:js,fitView:ho,fitViewOptions:ks,onNodesDelete:T,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onSelectionDrag:O,onSelectionDragStart:B,onSelectionDragStop:z,noPanClassName:Xn,nodeOrigin:ae,rfId:Xf,autoPanOnConnect:As,autoPanOnNodeDrag:Lt,onError:Nn,connectionRadius:vt,isValidConnection:Cn,nodeDragThreshold:Jf}),K.createElement(HO,{onSelectionChange:L}),Ee,K.createElement(OO,{proOptions:Ns,position:Cs}),K.createElement(KO,{rfId:Xf,disableKeyboardA11y:Is})))});function Qw(t){return e=>{const[n,o]=A.useState(e),r=A.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}xh.displayName="ReactFlow";const ev=Qw(Tw),tv=Qw(function(t,e){return Aw(t,e)});function F9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function z9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function B9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function U9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function V9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const gs=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:un(["react-flow__controls-button",e]),...n},t);gs.displayName="ControlButton";const $9=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),nv=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:d,position:u="bottom-left"})=>{const f=qt(),[m,_]=A.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=mt($9,nn),{zoomIn:x,zoomOut:y,fitView:v}=Ui();return A.useEffect(()=>{_(!0)},[]),m?K.createElement(Ml,{className:un(["react-flow__controls",c]),position:u,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(gs,{onClick:()=>{x(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(F9,null)),K.createElement(gs,{onClick:()=>{y(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},K.createElement(z9,null))),n&&K.createElement(gs,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(B9,null)),o&&K.createElement(gs,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?K.createElement(V9,null):K.createElement(U9,null)),d):null};nv.displayName="Controls";var Ln,H9=A.memo(nv);function W9({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function q9({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Ln||(Ln={}));const G9={[Ln.Dots]:"#91919a",[Ln.Lines]:"#eee",[Ln.Cross]:"#e2e2e2"},Y9={[Ln.Dots]:1,[Ln.Lines]:1,[Ln.Cross]:6},J9=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ov({id:t,variant:e=Ln.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=A.useRef(null),{transform:d,patternId:u}=mt(J9,nn),f=i||G9[e],m=o||Y9[e],_=e===Ln.Dots,g=e===Ln.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*d[2]||1,p[1]*d[2]||1],x=m*d[2],y=g?[x,x]:b,v=_?[x/s,x/s]:[y[0]/s,y[1]/s];return K.createElement("svg",{className:un(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.createElement("pattern",{id:u+t,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`},_?K.createElement(q9,{color:f,radius:x/s}):K.createElement(W9,{dimensions:y,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${u+t})`}))}ov.displayName="Background";var K9=A.memo(ov);function wh(t){return Math.min(11*t+35,200)}const rv=K.createContext("LR"),sv=A.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=We(n.atom),s=Bc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=mt(X9),l=A.useContext(rv);let c,d,u,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const M=r.code.split(`
126
126
  `).length,L=l==="LR"?$e.Left:$e.Top;let B;e[8]!==i?(B={background:i},e[8]=i,e[9]=B):B=e[9],e[10]!==L||e[11]!==B?(u=h.jsx(nr,{type:"target",id:"inputs",position:L,style:B}),e[10]=L,e[11]=B,e[12]=u):u=e[12];const O=l==="LR"?$e.Left:$e.Top;let z;e[13]!==i?(z={background:i},e[13]=i,e[14]=z):z=e[14],e[15]!==O||e[16]!==z?(f=h.jsx(nr,{type:"source",id:"inputs",position:O,style:z}),e[15]=O,e[16]=z,e[17]=f):f=e[17];const F=o&&"border-primary";e[18]!==F?(d=Oe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",F),e[18]=F,e[19]=d):d=e[19],c=wh(M),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=u,e[7]=f}else c=e[4],d=e[5],u=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(m=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=m):m=e[22],e[23]!==c||e[24]!==m?(g={height:c,width:m},e[23]=c,e[24]=m,e[25]=g):g=e[25];const p=iV(r.name,s);let b,x,y;e[26]!==p?(b=h.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?(x=h.jsx(Q$,{code:r.code}),e[28]=r.code,e[29]=x):x=e[29],e[30]!==d||e[31]!==g||e[32]!==b||e[33]!==x?(y=h.jsxs("div",{className:d,style:g,children:[b,x]}),e[30]=d,e[31]=g,e[32]=b,e[33]=x,e[34]=y):y=e[34];const v=l==="LR"?$e.Right:$e.Bottom;let S,k;e[35]!==i?(S={background:i},e[35]=i,e[36]=S):S=e[36],e[37]!==v||e[38]!==S?(k=h.jsx(nr,{type:"source",id:"outputs",position:v,style:S}),e[37]=v,e[38]=S,e[39]=k):k=e[39];const E=l==="LR"?$e.Right:$e.Bottom;let j,I,T;return e[40]!==i?(j={background:i},e[40]=i,e[41]=j):j=e[41],e[42]!==E||e[43]!==j?(I=h.jsx(nr,{type:"target",id:"outputs",position:E,style:j}),e[42]=E,e[43]=j,e[44]=I):I=e[44],e[45]!==y||e[46]!==k||e[47]!==I||e[48]!==u||e[49]!==f?(T=h.jsxs("div",{children:[u,f,y,k,I]}),e[45]=y,e[46]=k,e[47]=I,e[48]=u,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));sv.displayName="CustomNode";const iv={custom:sv};function X9(t){const{width:e}=t;return e}const av=t=>{const e=X.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Bc();let a,l,c,d;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let u;e[8]!==i?(u=(_,g)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=u):u=e[9];const f=[...o].sort(u);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(_,g)=>h.jsxs("span",{className:"truncate",children:[h.jsx(pr,{variant:"focus",cellId:_,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],a=f.slice(0,n).map(m),l=o.length>n&&h.jsxs(Lr,{children:[h.jsx(Js,{asChild:!0,children:h.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),h.jsx($s,{className:"w-auto",children:h.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>h.jsx(pr,{variant:"focus",cellId:_,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_))})})]})}e[0]=o,e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(d=h.jsxs(h.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},vh=t=>{const e=X.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await yn(o),lt({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=a):a=e[7],e[8]!==o||e[9]!==i||e[10]!==a?(l=h.jsx($4,{title:o,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=i,e[10]=a,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(c=h.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},kh=A.memo(t=>{const e=X.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(O,z)=>{s({...r,[O]:z})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,d,u,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Js,{asChild:!0,children:h.jsx(Pe,{variant:"text",size:"xs",children:h.jsx(X3,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=O=>a("hidePureMarkdown",!!O),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(u=h.jsx(S4,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Pr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==u?(m=h.jsxs(Lr,{children:[l,h.jsxs($s,{className:"w-auto p-2 text-muted-foreground",children:[c,h.jsxs("div",{className:"flex items-center gap-2",children:[u,f]})]})]}),e[11]=u,e[12]=m):m=e[12];const _=m,g=o==="_minimap_";let p,b,x;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Fp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(x=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=x):x=e[18];const y=o==="TB";let v,S,k;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(ja,{className:"w-4 h-4 mr-1"}),e[21]=S):S=e[21],e[22]!==y||e[23]!==v?(k=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:v,children:[S,"Vertical Tree"]}),e[22]=y,e[23]=v,e[24]=k):k=e[24];const E=o==="LR";let j,I,T,M;e[25]!==n?(j=()=>n("LR"),e[25]=n,e[26]=j):j=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsx(ja,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==E||e[29]!==j?(T=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":E,size:"xs",onClick:j,children:[I," ","Horizontal Tree"]}),e[28]=E,e[29]=j,e[30]=T):T=e[30],e[31]!==x||e[32]!==k||e[33]!==T?(M=h.jsxs("div",{className:"flex gap-2",children:[x,k,T]}),e[31]=x,e[32]=k,e[33]=T,e[34]=M):M=e[34];const L=o!=="_minimap_"&&_;let B;return e[35]!==M||e[36]!==L?(B=h.jsxs(Ml,{position:"top-right",className:"flex flex-col items-end gap-2",children:[M,L]}),e[35]=M,e[36]=L,e[37]=B):B=e[37],B});kh.displayName="GraphToolbar";const Ul=A.memo(t=>{const e=X.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=Z9;let i;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(i=()=>{if(n.type==="node"){const d=Object.values(o).filter(m=>m.usedBy.includes(n.id)),u=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,_)=>h.jsxs(h.Fragment,{children:[m.length===0&&h.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),h.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>h.jsxs(K.Fragment,{children:[h.jsx(vh,{declaredBy:g.declaredBy,name:g.name}),h.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,h.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),h.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:h.jsx(av,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(mc,{className:"w-5 h-5"}),h.jsx(pr,{cellId:n.id}),h.jsx("div",{className:"flex-1"}),h.jsx(y0,{cellId:n.id,children:h.jsx(Pe,{variant:"ghost",size:"icon",children:h.jsx(Jc,{className:"w-4 h-4"})})}),h.jsx(Pe,{variant:"text",size:"icon",onClick:()=>{r()},children:h.jsx(go,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(pn,{className:"w-4 h-4"}),"Outputs"]}),f(u,"out")]}),h.jsx("hr",{className:"border-divider my-3"}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(ip,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(u=>u.declaredBy.includes(n.source)&&u.usedBy.includes(n.target));return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(Ia,{className:"w-4 h-4"}),h.jsx(pr,{cellId:n.source}),h.jsx(qc,{className:"w-4 h-4"}),h.jsx(pr,{cellId:n.target})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(u=>h.jsxs(K.Fragment,{children:[h.jsx(vh,{declaredBy:u.declaredBy,name:u.name,onClick:()=>{s(u.declaredBy[0],u.name)}}),h.jsx("div",{className:"truncate text-foreground/60 font-mono",children:u.dataType}),h.jsx("div",{className:"truncate col-span-2",title:u.value??"",children:u.value})]},u.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=i):i=e[6];const a=i;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=h.jsx(Ml,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:h.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=c):c=e[10],c});function Z9(t,e){const n=ac(t);n&&Gm(n,e)}function lv(){const t=X.c(7),e=Ui(),n=mt(eD),o=mt(Q9);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=aV(r,100);let i,a;t[2]!==s||t[3]!==o||t[4]!==n?(i=()=>{n&&o&&s()},a=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=i,t[6]=a):(i=t[5],a=t[6]),A.useEffect(i,a)}function Q9(t){const{height:e}=t;return e}function eD(t){const{width:e}=t;return e}Ul.displayName="GraphSelectionPanel";const cv=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:ls.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:wh(dt.get(e).code.trim().split(`
127
127
  `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of qm.zip(t,e)){const d=this.createNode(l,c,r);s.push(d),r=d.position.y+(d.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:c,usedBy:d}=l;for(const u of c)for(const f of d){const m=`${u}-${f}`;a.has(m)||(a.add(m),i.push(this.createEdge(u,f,"inputs"),this.createEdge(u,f,"outputs")))}}return{nodes:s,edges:i}}},tD=t=>{const e=X.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=cv.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=i):i=e[3];const{nodes:a,edges:l}=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[4]=c):c=e[4];const[d,u]=tv(c),[f,m]=ev(a),[_,g]=A.useState(),[p,b]=A.useState(),x=A.useRef(!1);lv();const y=mt(nD);let v;e[5]!==u||e[6]!==m?(v=C=>{m(C.nodes),u([])},e[5]=u,e[6]=m,e[7]=v):v=e[7];const S=et(v);let k,E,j,I;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(k=()=>{x.current?S(cv.createElements(n,r,o,!1)):x.current=!0},E=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,e[11]=o,e[12]=k,e[13]=E):(k=e[12],E=e[13]),A.useEffect(k,E),e[14]!==l||e[15]!==_||e[16]!==u?(j=()=>{if(_){const C=l.filter($=>{const{source:N,target:H,data:Y}=$;return N===_&&Y.direction==="outputs"||H===_&&Y.direction==="inputs"});u(C)}},I=[_,u,l],e[14]=l,e[15]=_,e[16]=u,e[17]=j,e[18]=I):(j=e[17],I=e[18]),A.useEffect(j,I);const T=function(C,$){const N=X.c(17);let H,Y;if(N[0]!==$||N[1]!==C){let Q;N[3]!==$?(Q=(ce,me)=>{const{position:de}=me;return Math.min(ce,de.y-$/2-10)},N[3]=$,N[4]=Q):Q=N[4],Y=C.reduce(Q,Number.POSITIVE_INFINITY),N[0]=$,N[1]=C,N[2]=Y}else Y=N[2];const Z=Y;let q;if(N[5]!==$||N[6]!==C){let Q;N[8]!==$?(Q=(ce,me)=>{const{position:de}=me;return Math.max(ce,de.y+$/2+10)},N[8]=$,N[9]=Q):Q=N[9],q=C.reduce(Q,Number.NEGATIVE_INFINITY),N[5]=$,N[6]=C,N[7]=q}else q=N[7];const re=q;let ne,oe,G;return N[10]!==Z?(ne=[Number.NEGATIVE_INFINITY,Z],N[10]=Z,N[11]=ne):ne=N[11],N[12]!==re?(oe=[Number.POSITIVE_INFINITY,re],N[12]=re,N[13]=oe):oe=N[13],N[14]!==ne||N[15]!==oe?(G=[ne,oe],N[14]=ne,N[15]=oe,N[16]=G):G=N[16],H=G,H}(f,y);let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{g(void 0),b(void 0)},e[19]=M):M=e[19];const L=M;let B;e[20]!==d||e[21]!==p||e[22]!==_||e[23]!==o?(B=()=>p?h.jsx(Ul,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:L,variables:o,edges:d}):_?h.jsx(Ul,{selection:{type:"node",id:_},variables:o,edges:d,onClearSelection:L}):null,e[20]=d,e[21]=p,e[22]=_,e[23]=o,e[24]=B):B=e[24];const O=B;let z,F,V,P;return e[25]!==u?(z=(C,$)=>{const N=$.id;g(N),b(void 0),u([])},e[25]=u,e[26]=z):z=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(F=(C,$)=>{b($)},e[27]=F):F=e[27],e[28]!==O?(V=O(),e[28]=O,e[29]=V):V=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==z||e[34]!==V||e[35]!==T?(P=h.jsxs(xh,{nodes:f,edges:d,nodeTypes:iv,translateExtent:T,onNodeClick:z,onNodeDoubleClick:oD,onEdgeClick:F,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:er.Vertical,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,selectNodesOnDrag:!1,panOnDrag:!1,preventScrolling:!1,zoomOnPinch:!1,panOnScroll:!0,autoPanOnNodeDrag:!1,autoPanOnConnect:!1,children:[V,s]}),e[30]=s,e[31]=d,e[32]=f,e[33]=z,e[34]=V,e[35]=T,e[36]=P):P=e[36],P};function nD(t){const{height:e}=t;return e}function oD(t,e){H4(e.id,"focus")}var Sh,dv,uv,hv,fv,mv,Ch,pv,Nh,gv,jh,_v,Eh,bv,Ih,yv,Ah,xv,Th,wv,Mh,vv,Oh,kv,Dh,Sv,Rh,Cv,Ph,Nv,Lh,jv,Fh,Ev,Iv,Av,Tv,Mv,Ov,Dv,zh,Rv,Bh,Pv,Uh,Lv,Vh,Fv,$h,zv,Hh,Bv,Wh,Uv,qh,Vv,Gh,$v,Yh,Hv,Jh,Wv,Kh,qv,Xh,Gv,Zh,Yv,Jv,Kv,Xv,Zv,Qv,e2,Qh,t2,ef,n2,o2,r2,tf,s2,nf,i2,of,a2,rf,l2,sf,c2,d2,u2,h2,f2;function af(){if(dv)return Sh;dv=1;var t="\0";function e(s,i){s[i]?s[i]++:s[i]=1}function n(s,i){--s[i]||delete s[i]}function o(s,i,a,l){var c=""+i,d=""+a;if(!s&&c>d){var u=c;c=d,d=u}return c+""+d+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return Sh=class{constructor(s){ee(this,"_isDirected",!0);ee(this,"_isMultigraph",!1);ee(this,"_isCompound",!1);ee(this,"_label");ee(this,"_defaultNodeLabelFn",()=>{});ee(this,"_defaultEdgeLabelFn",()=>{});ee(this,"_nodes",{});ee(this,"_in",{});ee(this,"_preds",{});ee(this,"_out",{});ee(this,"_sucs",{});ee(this,"_edgeObjs",{});ee(this,"_edgeLabels",{});ee(this,"_nodeCount",0);ee(this,"_edgeCount",0);ee(this,"_parent");ee(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([d,u]){s(d)&&i.setNode(d,u)}),Object.values(this._edgeObjs).forEach(function(d){i.hasNode(d.v)&&i.hasNode(d.w)&&i.setEdge(d,a.edge(d))});var l={};function c(d){var u=a.parent(d);return u===void 0||i.hasNode(u)?(l[d]=u,u):u in l?l[u]:c(u)}return this._isCompound&&i.nodes().forEach(d=>i.setParent(d,c(d))),i}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,i){var a=this,l=arguments;return s.reduce(function(c,d){return l.length>1?a.setEdge(c,d,i):a.setEdge(c,d),d}),this}setEdge(){var s,i,a,l,c=!1,d=arguments[0];typeof d=="object"&&d!==null&&"v"in d?(s=d.v,i=d.w,a=d.name,arguments.length===2&&(l=arguments[1],c=!0)):(s=d,i=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);var u=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,u))return c&&(this._edgeLabels[u]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[u]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(m,_,g,p){var b=""+_,x=""+g;if(!m&&b>x){var y=b;b=x,x=y}var v={v:b,w:x};return p&&(v.name=p),v}(this._isDirected,s,i,a);return s=f.v,i=f.w,Object.freeze(f),this._edgeObjs[u]=f,e(this._preds[i],s),e(this._sucs[s],i),this._in[i][u]=f,this._out[s][u]=f,this._edgeCount++,this}edge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a),c=this._edgeObjs[l];return c&&(s=c.v,i=c.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[i],s),n(this._sucs[s],i),delete this._in[i][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,i){var a=this._in[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.v===i):l}}outEdges(s,i){var a=this._out[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.w===i):l}}nodeEdges(s,i){var a=this.inEdges(s,i);if(a)return a.concat(this.outEdges(s,i))}},Sh}function rD(){return mv?fv:(mv=1,fv={Graph:af(),version:hv?uv:(hv=1,uv="2.2.4")})}function sD(){if(pv)return Ch;pv=1;var t=af();function e(o){return o.nodes().map(function(r){var s=o.node(r),i=o.parent(r),a={v:r};return s!==void 0&&(a.value=s),i!==void 0&&(a.parent=i),a})}function n(o){return o.edges().map(function(r){var s=o.edge(r),i={v:r.v,w:r.w};return r.name!==void 0&&(i.name=r.name),s!==void 0&&(i.value=s),i})}return Ch={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}},Ch}function iD(){return gv||(gv=1,Nh=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}),Nh}function m2(){return _v?jh:(_v=1,jh=class{constructor(){ee(this,"_arr",[]);ee(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},jh)}function p2(){if(bv)return Eh;bv=1;var t=m2();Eh=function(n,o,r,s){return function(i,a,l,c){var d,u,f={},m=new t,_=function(g){var p=g.v!==d?g.v:g.w,b=f[p],x=l(g),y=u.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+x);y<b.distance&&(b.distance=y,b.predecessor=d,m.decrease(p,y))};for(i.nodes().forEach(function(g){var p=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(d=m.removeMin(),(u=f[d]).distance!==Number.POSITIVE_INFINITY);)c(d).forEach(_);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return Eh}function aD(){if(yv)return Ih;yv=1;var t=p2();return Ih=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Ih}function g2(){return xv||(xv=1,Ah=function(t){var e=0,n=[],o={},r=[];function s(i){var a=o[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(d){Object.hasOwn(o,d)?o[d].onStack&&(a.lowlink=Math.min(a.lowlink,o[d].index)):(s(d),a.lowlink=Math.min(a.lowlink,o[d].lowlink))}),a.lowlink===a.index){var l,c=[];do l=n.pop(),o[l].onStack=!1,c.push(l);while(i!==l);r.push(c)}}return t.nodes().forEach(function(i){Object.hasOwn(o,i)||s(i)}),r}),Ah}function lD(){if(wv)return Th;wv=1;var t=g2();return Th=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Th}function cD(){if(vv)return Mh;vv=1,Mh=function(e,n,o){return function(r,s,i){var a={},l=r.nodes();return l.forEach(function(c){a[c]={},a[c][c]={distance:0},l.forEach(function(d){c!==d&&(a[c][d]={distance:Number.POSITIVE_INFINITY})}),i(c).forEach(function(d){var u=d.v===c?d.w:d.v,f=s(d);a[c][u]={distance:f,predecessor:c}})}),l.forEach(function(c){var d=a[c];l.forEach(function(u){var f=a[u];l.forEach(function(m){var _=f[c],g=d[m],p=f[m],b=_.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Mh}function _2(){if(kv)return Oh;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function i(a){if(Object.hasOwn(r,a))throw new e;Object.hasOwn(o,a)||(r[a]=!0,o[a]=!0,n.predecessors(a).forEach(i),delete r[a],s.push(a))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}kv=1;class e extends Error{constructor(){super(...arguments)}}return Oh=t,t.CycleException=e,Oh}function dD(){if(Sv)return Dh;Sv=1;var t=_2();return Dh=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Dh}function b2(){if(Cv)return Rh;function t(o,r,s,i){for(var a=[[o,!1]];a.length>0;){var l=a.pop();l[1]?i.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,a.push([l[0],!0]),n(r(l[0]),c=>a.push([c,!1])))}}function e(o,r,s,i){for(var a=[o];a.length>0;){var l=a.pop();Object.hasOwn(s,l)||(s[l]=!0,i.push(l),n(r(l),c=>a.push(c)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return Cv=1,Rh=function(o,r,s){Array.isArray(r)||(r=[r]);var i=o.isDirected()?d=>o.successors(d):d=>o.neighbors(d),a=s==="post"?t:e,l=[],c={};return r.forEach(d=>{if(!o.hasNode(d))throw new Error("Graph does not have node: "+d);a(d,i,c,l)}),l},Rh}function uD(){if(Nv)return Ph;Nv=1;var t=b2();return Ph=function(e,n){return t(e,n,"post")},Ph}function hD(){if(jv)return Lh;jv=1;var t=b2();return Lh=function(e,n){return t(e,n,"pre")},Lh}function fD(){if(Ev)return Fh;Ev=1;var t=af(),e=m2();return Fh=function(n,o){var r,s=new t,i={},a=new e;function l(d){var u=d.v===r?d.w:d.v,f=a.priority(u);if(f!==void 0){var m=o(d);m<f&&(i[u]=r,a.decrease(u,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(d){a.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),a.decrease(n.nodes()[0],0);for(var c=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(i,r))s.setEdge(r,i[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return s},Fh}function Kn(){if(Mv)return Tv;Mv=1;var t=rD();return Tv={Graph:t.Graph,json:sD(),alg:Av?Iv:(Av=1,Iv={components:iD(),dijkstra:p2(),dijkstraAll:aD(),findCycles:lD(),floydWarshall:cD(),isAcyclic:dD(),postorder:uD(),preorder:hD(),prim:fD(),tarjan:g2(),topsort:_2()}),version:t.version}}function mD(){if(Rv)return zh;Rv=1;let t=Kn().Graph,e=function(){if(Dv)return Ov;function s(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,l){if(a!=="_next"&&a!=="_prev")return l}return Dv=1,Ov=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,l=a._prev;if(l!==a)return s(l),l}enqueue(a){let l=this._sentinel;a._prev&&a._next&&s(a),a._next=l._next,l._next._prev=a,l._next=a,a._prev=l}toString(){let a=[],l=this._sentinel,c=l._prev;for(;c!==l;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}}}();zh=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let d=new t,u=0,f=0;l.nodes().forEach(g=>{d.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=d.edge(g.v,g.w)||0,b=c(g),x=p+b;d.setEdge(g.v,g.w,x),f=Math.max(f,d.node(g.v).out+=b),u=Math.max(u,d.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+u+3).map(()=>new e),_=u+1;return d.nodes().forEach(g=>{r(m,_,d.node(g))}),{graph:d,buckets:m,zeroIdx:_}}(s,i||n);return function(l,c,d){let u,f=[],m=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;u=_.dequeue();)o(l,c,d,u);for(;u=m.dequeue();)o(l,c,d,u);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(u=c[g].dequeue(),u){f=f.concat(o(l,c,d,u,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,i,a,l,c){let d=c?[]:void 0;return s.inEdges(l.v).forEach(u=>{let f=s.edge(u),m=s.node(u.v);c&&d.push({v:u.v,w:u.w}),m.out-=f,r(i,a,m)}),s.outEdges(l.v).forEach(u=>{let f=s.edge(u),m=u.w,_=s.node(m);_.in-=f,r(i,a,_)}),s.removeNode(l.v),d}function r(s,i,a){a.out?a.in?s[a.out-a.in+i].enqueue(a):s[s.length-1].enqueue(a):s[0].enqueue(a)}return zh}function Rt(){if(Pv)return Bh;Pv=1;let t=Kn().Graph;function e(c,d,u,f){let m;do m=i(f);while(c.hasNode(m));return u.dummy=d,c.setNode(m,u),m}Bh={addBorderNode:function(c,d,u,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=u,m.order=f),e(c,"border",m,d)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let d=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(u=>{c.children(u).length||d.setNode(u,c.node(u))}),c.edges().forEach(u=>{d.setEdge(u,c.edge(u))}),d},buildLayerMatrix:function(c){let d=a(r(c)+1).map(()=>[]);return c.nodes().forEach(u=>{let f=c.node(u),m=f.rank;m!==void 0&&(d[m][f.order]=u)}),d},intersectRect:function(c,d){let u,f,m=c.x,_=c.y,g=d.x-m,p=d.y-_,b=c.width/2,x=c.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*x?(p<0&&(x=-x),u=x*g/p,f=x):(g<0&&(b=-b),u=b,f=b*p/g),{x:m+u,y:_+f}},mapValues:function(c,d){let u=d;return typeof d=="string"&&(u=f=>f[d]),Object.entries(c).reduce((f,[m,_])=>(f[m]=u(_,m),f),{})},maxRank:r,normalizeRanks:function(c){let d=c.nodes().map(f=>{let m=c.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),u=o(Math.min,d);c.nodes().forEach(f=>{let m=c.node(f);Object.hasOwn(m,"rank")&&(m.rank-=u)})},notime:function(c,d){return d()},partition:function(c,d){let u={lhs:[],rhs:[]};return c.forEach(f=>{d(f)?u.lhs.push(f):u.rhs.push(f)}),u},pick:function(c,d){const u={};for(const f of d)c[f]!==void 0&&(u[f]=c[f]);return u},predecessorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.inEdges(u).forEach(m=>{f[m.v]=(f[m.v]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},range:a,removeEmptyRanks:function(c){let d=c.nodes().map(g=>c.node(g).rank),u=o(Math.min,d),f=[];c.nodes().forEach(g=>{let p=c.node(g).rank-u;f[p]||(f[p]=[]),f[p].push(g)});let m=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%_!=0?--m:g!==void 0&&m&&g.forEach(b=>c.node(b).rank+=m)})},simplify:function(c){let d=new t().setGraph(c.graph());return c.nodes().forEach(u=>d.setNode(u,c.node(u))),c.edges().forEach(u=>{let f=d.edge(u.v,u.w)||{weight:0,minlen:1},m=c.edge(u);d.setEdge(u.v,u.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),d},successorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.outEdges(u).forEach(m=>{f[m.w]=(f[m.w]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},time:function(c,d){let u=Date.now();try{return d()}finally{console.log(c+" time: "+(Date.now()-u)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,d){if(d.length>n){const u=function(f,m=n){const _=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);_.push(p)}return _}(d);return c.apply(null,u.map(f=>c.apply(null,f)))}return c.apply(null,d)}function r(c){const d=c.nodes().map(u=>{let f=c.node(u).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,d)}let s=0;function i(c){var d=++s;return toString(c)+d}function a(c,d,u=1){d==null&&(d=c,c=0);let f=_=>_<d;u<0&&(f=_=>d<_);const m=[];for(let _=c;f(_);_+=u)m.push(_);return m}function l(c,d){return c.reduce((u,f,m)=>(u[f]=d[m],u),{})}return Bh}function pD(){if(Lv)return Uh;Lv=1;let t=mD(),e=Rt().uniqueId;return Uh={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],i={},a={};function l(c){Object.hasOwn(a,c)||(a[c]=!0,i[c]=!0,r.outEdges(c).forEach(d=>{Object.hasOwn(i,d.w)?s.push(d):l(d.w)}),delete i[c])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},Uh}function gD(){if(Fv)return Vh;Fv=1;let t=Rt();return Vh={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,i,a,l=r.v,c=o.node(l).rank,d=r.w,u=o.node(d).rank,f=r.name,m=o.edge(r),_=m.labelRank;if(u!==c+1){for(o.removeEdge(r),a=0,++c;c<u;++a,++c)m.points=[],i={width:0,height:0,edgeLabel:m,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===_&&(i.width=m.width,i.height=m.height,i.dummy="edge-label",i.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,d,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},Vh}function Vl(){if(zv)return $h;zv=1;const{applyWithChunking:t}=Rt();return $h={longestPath:function(e){var n={};e.sources().forEach(function o(r){var s=e.node(r);if(Object.hasOwn(n,r))return s.rank;n[r]=!0;let i=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var a=t(Math.min,i);return a===Number.POSITIVE_INFINITY&&(a=0),s.rank=a})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},$h}function y2(){if(Bv)return Hh;Bv=1;var t=Kn().Graph,e=Vl().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var d=c.v,u=l===d?c.w:d;s.hasNode(u)||e(i,c)||(s.setNode(u,{}),s.setEdge(l,u,{}),a(u))})}),s.nodeCount()}function o(s,i){return i.edges().reduce((a,l)=>{let c=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(c=e(i,l)),c<a[0]?[c,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(s,i,a){s.nodes().forEach(l=>i.node(l).rank+=a)}return Hh=function(s){var i,a,l=new t({directed:!1}),c=s.nodes()[0],d=s.nodeCount();for(l.setNode(c,{});n(l,s)<d;)i=o(l,s),a=l.hasNode(i.v)?e(s,i):-e(s,i),r(l,s,a);return l},Hh}function _D(){if(Uv)return Wh;Uv=1;var t=y2(),e=Vl().slack,n=Vl().longestPath,o=Kn().alg.preorder,r=Kn().alg.postorder,s=Rt().simplify;function i(g){g=s(g),n(g);var p,b=t(g);for(c(b),a(b,g);p=u(b);)m(b,g,p,f(b,g,p))}function a(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(x=>function(y,v,S){var k=y.node(S),E=k.parent;y.edge(S,E).cutvalue=l(y,v,S)}(g,p,x))}function l(g,p,b){var x=g.node(b).parent,y=!0,v=p.edge(b,x),S=0;return v||(y=!1,v=p.edge(x,b)),S=v.weight,p.nodeEdges(b).forEach(k=>{var E,j,I=k.v===b,T=I?k.w:k.v;if(T!==x){var M=I===y,L=p.edge(k).weight;if(S+=M?L:-L,E=b,j=T,g.hasEdge(E,j)){var B=g.edge(b,T).cutvalue;S+=M?-B:B}}}),S}function c(g,p){arguments.length<2&&(p=g.nodes()[0]),d(g,{},1,p)}function d(g,p,b,x,y){var v=b,S=g.node(x);return p[x]=!0,g.neighbors(x).forEach(k=>{Object.hasOwn(p,k)||(b=d(g,p,b,k,x))}),S.low=v,S.lim=b++,y?S.parent=y:delete S.parent,b}function u(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var x=b.v,y=b.w;p.hasEdge(x,y)||(x=b.w,y=b.v);var v=g.node(x),S=g.node(y),k=v,E=!1;v.lim>S.lim&&(k=S,E=!0);var j=p.edges().filter(I=>E===_(g,g.node(I.v),k)&&E!==_(g,g.node(I.w),k));return j.reduce((I,T)=>e(p,T)<e(p,I)?T:I)}function m(g,p,b,x){var y=b.v,v=b.w;g.removeEdge(y,v),g.setEdge(x.v,x.w,{}),c(g),a(g,p),function(S,k){var E=S.nodes().find(I=>!k.node(I).parent),j=o(S,E);(j=j.slice(1)).forEach(I=>{var T=S.node(I).parent,M=k.edge(I,T),L=!1;M||(M=k.edge(T,I),L=!0),k.node(I).rank=k.node(T).rank+(L?M.minlen:-M.minlen)})}(g,p)}function _(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Wh=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=u,i.enterEdge=f,i.exchangeEdges=m,Wh}function bD(){if(Vv)return qh;Vv=1;var t=Vl().longestPath,e=y2(),n=_D();qh=function(s){switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(i){t(i),e(i)})(s);break;case"longest-path":o(s)}};var o=t;function r(s){n(s)}return qh}function yD(){return $v||($v=1,Gh=function(t){let e=function(n){let o={},r=0;function s(i){let a=r;n.children(i).forEach(s),o[i]={low:a,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(u,f,m,_){let g,p,b=[],x=[],y=Math.min(f[m].low,f[_].low),v=Math.max(f[m].lim,f[_].lim);g=m;do g=u.parent(g),b.push(g);while(g&&(f[g].low>y||v>f[g].lim));for(p=g,g=_;(g=u.parent(g))!==p;)x.push(g);return{path:b.concat(x.reverse()),lca:p}}(t,e,r.v,r.w),i=s.path,a=s.lca,l=0,c=i[l],d=!0;for(;n!==r.w;){if(o=t.node(n),d){for(;(c=i[l])!==a&&t.node(c).maxRank<o.rank;)l++;c===a&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(c=i[l+1]).minRank<=o.rank;)l++;c=i[l]}t.setParent(n,c),n=t.successors(n)[0]}})}),Gh}function xD(){if(Hv)return Yh;Hv=1;let t=Rt();function e(n,o,r,s,i,a,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let d=t.addBorderNode(n,"_bt"),u=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(d,l),f.borderTop=d,n.setParent(u,l),f.borderBottom=u,c.forEach(m=>{e(n,o,r,s,i,a,m);let _=n.node(m),g=_.borderTop?_.borderTop:m,p=_.borderBottom?_.borderBottom:m,b=_.borderTop?s:2*s,x=g!==p?1:i-a[l]+1;n.setEdge(d,g,{weight:b,minlen:x,nestingEdge:!0}),n.setEdge(p,u,{weight:b,minlen:x,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,d,{weight:0,minlen:i+a[l]})}return Yh={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function u(f,m){var _=c.children(f);_&&_.length&&_.forEach(g=>u(g,m+1)),d[f]=m}return c.children().forEach(f=>u(f,1)),d}(n),s=Object.values(r),i=t.applyWithChunking(Math.max,s)-1,a=2*i+1;n.graph().nestingRoot=o,n.edges().forEach(c=>n.edge(c).minlen*=a);let l=function(c){return c.edges().reduce((d,u)=>d+c.edge(u).weight,0)}(n)+1;n.children().forEach(c=>e(n,o,a,l,i,r,c)),n.graph().nodeRankFactor=a},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},Yh}function wD(){if(qv)return Kh;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 qv=1,Kh={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(i){i.nodes().forEach(a=>n(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(i){i.nodes().forEach(a=>o(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},Kh}function vD(){if(Zv)return Xv;Zv=1;let t=Rt();return Xv=function(e,n){let o={};return e.forEach((r,s)=>{let i=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(i.barycenter=r.barycenter,i.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],i=o[r.w];s!==void 0&&i!==void 0&&(i.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function i(l){return c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&function(d,u){let f=0,m=0;d.weight&&(f+=d.barycenter*d.weight,m+=d.weight),u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),d.vs=u.vs.concat(d.vs),d.barycenter=f/m,d.weight=m,d.i=Math.min(u.i,d.i),u.merged=!0}(l,c)}}function a(l){return c=>{c.in.push(l),--c.indegree==0&&r.push(c)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(i(l)),l.out.forEach(a(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function kD(){if(t2)return Qh;t2=1;let t=(Kv||(Kv=1,Jv=function(o,r=[]){return r.map(s=>{let i=o.inEdges(s);if(i.length){let a=i.reduce((l,c)=>{let d=o.edge(c),u=o.node(c.v);return{sum:l.sum+d.weight*u.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),Jv),e=vD(),n=function(){if(e2)return Qv;e2=1;let o=Rt();function r(s,i,a){let l;for(;i.length&&(l=i[i.length-1]).i<=a;)i.pop(),s.push(l.vs),a++;return a}return Qv=function(s,i){let a=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=a.lhs,c=a.rhs.sort((p,b)=>b.i-p.i),d=[],u=0,f=0,m=0;var _;l.sort((_=!!i,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:_?b.i-p.i:p.i-b.i)),m=r(d,c,m),l.forEach(p=>{m+=p.vs.length,d.push(p.vs),u+=p.barycenter*p.weight,f+=p.weight,m=r(d,c,m)});let g={vs:d.flat(!0)};return f&&(g.barycenter=u/f,g.weight=f),g}}();return Qh=function o(r,s,i,a){let l=r.children(s),c=r.node(s),d=c?c.borderLeft:void 0,u=c?c.borderRight:void 0,f={};d&&(l=l.filter(p=>p!==d&&p!==u));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let y=o(r,p.v,i,a);f[p.v]=y,Object.hasOwn(y,"barycenter")&&(x=y,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+x.barycenter*x.weight)/(b.weight+x.weight),b.weight+=x.weight):(b.barycenter=x.barycenter,b.weight=x.weight))}var b,x});let _=e(m,i);(function(p,b){p.forEach(x=>{x.vs=x.vs.flatMap(y=>b[y]?b[y].vs:y)})})(_,f);let g=n(_,a);if(d&&(g.vs=[d,g.vs,u].flat(!0),r.predecessors(d).length)){let p=r.node(r.predecessors(d)[0]),b=r.node(r.predecessors(u)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},Qh}function SD(){if(n2)return ef;n2=1;let t=Kn().Graph,e=Rt();return ef=function(n,o,r){let s=function(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}(n),i=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>n.node(a));return n.nodes().forEach(a=>{let l=n.node(a),c=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(i.setNode(a),i.setParent(a,c||s),n[r](a).forEach(d=>{let u=d.v===a?d.w:d.v,f=i.edge(u,a),m=f!==void 0?f.weight:0;i.setEdge(u,a,{weight:n.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},ef}function CD(){if(s2)return tf;s2=1;let t=function(){if(Gv)return Xh;Gv=1;let d=Rt();return Xh=function(u){let f={},m=u.nodes().filter(x=>!u.children(x).length),_=m.map(x=>u.node(x).rank),g=d.applyWithChunking(Math.max,_),p=d.range(g+1).map(()=>[]);function b(x){if(f[x])return;f[x]=!0;let y=u.node(x);p[y.rank].push(x),u.successors(x).forEach(b)}return m.sort((x,y)=>u.node(x).rank-u.node(y).rank).forEach(b),p},Xh}(),e=function(){if(Yv)return Zh;Yv=1;let d=Rt().zipObject;function u(f,m,_){let g=d(_,_.map((S,k)=>k)),p=m.flatMap(S=>f.outEdges(S).map(k=>({pos:g[k.w],weight:f.edge(k).weight})).sort((k,E)=>k.pos-E.pos)),b=1;for(;b<_.length;)b<<=1;let x=2*b-1;b-=1;let y=new Array(x).fill(0),v=0;return p.forEach(S=>{let k=S.pos+b;y[k]+=S.weight;let E=0;for(;k>0;)k%2&&(E+=y[k+1]),k=k-1>>1,y[k]+=S.weight;v+=S.weight*E}),v}return Zh=function(f,m){let _=0;for(let g=1;g<m.length;++g)_+=u(f,m[g-1],m[g]);return _},Zh}(),n=kD(),o=SD(),r=(r2||(r2=1,o2=function(d,u,f){let m,_={};f.forEach(g=>{let p,b,x=d.parent(g);for(;x;){if(p=d.parent(x),p?(b=_[p],_[p]=x):(b=m,m=x),b&&b!==x)return void u.setEdge(b,x);x=p}})}),o2),s=Kn().Graph,i=Rt();function a(d,u,f){return u.map(function(m){return o(d,m,f)})}function l(d,u){let f=new s;d.forEach(function(m){let _=m.graph().root,g=n(m,_,f,u);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function c(d,u){Object.values(u).forEach(f=>f.forEach((m,_)=>d.node(m).order=_))}return tf=function d(u,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(u,d);let m=i.maxRank(u),_=a(u,i.range(1,m+1),"inEdges"),g=a(u,i.range(m-1,-1,-1),"outEdges"),p=t(u);if(c(u,p),f&&f.disableOptimalOrderHeuristic)return;let b,x=Number.POSITIVE_INFINITY;for(let y=0,v=0;v<4;++y,++v){l(y%2?_:g,y%4>=2),p=i.buildLayerMatrix(u);let S=e(u,p);S<x&&(v=0,b=Object.assign({},p),x=S)}c(u,b)},tf}function ND(){if(i2)return nf;i2=1;let t=Kn().Graph,e=Rt();function n(u,f){let m={};return f.length&&f.reduce(function(_,g){let p=0,b=0,x=_.length,y=g[g.length-1];return g.forEach((v,S)=>{let k=function(j,I){if(j.node(I).dummy)return j.predecessors(I).find(T=>j.node(T).dummy)}(u,v),E=k?u.node(k).order:x;(k||v===y)&&(g.slice(b,S+1).forEach(j=>{u.predecessors(j).forEach(I=>{let T=u.node(I),M=T.order;!(M<p||E<M)||T.dummy&&u.node(j).dummy||r(m,I,j)})}),b=S+1,p=E)}),g}),m}function o(u,f){let m={};function _(g,p,b,x,y){let v;e.range(p,b).forEach(S=>{v=g[S],u.node(v).dummy&&u.predecessors(v).forEach(k=>{let E=u.node(k);E.dummy&&(E.order<x||E.order>y)&&r(m,k,v)})})}return f.length&&f.reduce(function(g,p){let b,x=-1,y=0;return p.forEach((v,S)=>{if(u.node(v).dummy==="border"){let k=u.predecessors(v);k.length&&(b=u.node(k[0]).order,_(p,y,S,x,b),y=S,x=b)}_(p,y,p.length,b,g.length)}),p}),m}function r(u,f,m){if(f>m){let g=f;f=m,m=g}let _=u[f];_||(u[f]=_={}),_[m]=!0}function s(u,f,m){if(f>m){let _=f;f=m,m=_}return!!u[f]&&Object.hasOwn(u[f],m)}function i(u,f,m,_){let g={},p={},b={};return f.forEach(x=>{x.forEach((y,v)=>{g[y]=y,p[y]=y,b[y]=v})}),f.forEach(x=>{let y=-1;x.forEach(v=>{let S=_(v);if(S.length){S=S.sort((E,j)=>b[E]-b[j]);let k=(S.length-1)/2;for(let E=Math.floor(k),j=Math.ceil(k);E<=j;++E){let I=S[E];p[v]===v&&y<b[I]&&!s(m,v,I)&&(p[I]=v,p[v]=g[v]=g[I],y=b[I])}}})}),{root:g,align:p}}function a(u,f,m,_,g){let p={},b=function(v,S,k,E){let j=new t,I=v.graph(),T=function(M,L,B){return(O,z,F)=>{let V,P=O.node(z),C=O.node(F),$=0;if($+=P.width/2,Object.hasOwn(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":V=-P.width/2;break;case"r":V=P.width/2}if(V&&($+=B?V:-V),V=0,$+=(P.dummy?L:M)/2,$+=(C.dummy?L:M)/2,$+=C.width/2,Object.hasOwn(C,"labelpos"))switch(C.labelpos.toLowerCase()){case"l":V=C.width/2;break;case"r":V=-C.width/2}return V&&($+=B?V:-V),V=0,$}}(I.nodesep,I.edgesep,E);return S.forEach(M=>{let L;M.forEach(B=>{let O=k[B];if(j.setNode(O),L){var z=k[L],F=j.edge(z,O);j.setEdge(z,O,Math.max(T(v,B,L),F||0))}L=B})}),j}(u,f,m,g),x=g?"borderLeft":"borderRight";function y(v,S){let k=b.nodes(),E=k.pop(),j={};for(;E;)j[E]?v(E):(j[E]=!0,k.push(E),k=k.concat(S(E))),E=k.pop()}return y(function(v){p[v]=b.inEdges(v).reduce((S,k)=>Math.max(S,p[k.v]+b.edge(k)),0)},b.predecessors.bind(b)),y(function(v){let S=b.outEdges(v).reduce((E,j)=>Math.min(E,p[j.w]-b.edge(j)),Number.POSITIVE_INFINITY),k=u.node(v);S!==Number.POSITIVE_INFINITY&&k.borderType!==x&&(p[v]=Math.max(p[v],S))},b.successors.bind(b)),Object.keys(_).forEach(v=>p[v]=p[m[v]]),p}function l(u,f){return Object.values(f).reduce((m,_)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([x,y])=>{let v=function(S,k){return S.node(k).width}(u,x)/2;g=Math.max(y+v,g),p=Math.min(y-v,p)});const b=g-p;return b<m[0]&&(m=[b,_]),m},[Number.POSITIVE_INFINITY,null])[1]}function c(u,f){let m=Object.values(f),_=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let x=p+b,y=u[x];if(y===f)return;let v=Object.values(y),S=_-e.applyWithChunking(Math.min,v);b!=="l"&&(S=g-e.applyWithChunking(Math.max,v)),S&&(u[x]=e.mapValues(y,k=>k+S))})})}function d(u,f){return e.mapValues(u.ul,(m,_)=>{if(f)return u[f.toLowerCase()][_];{let g=Object.values(u).map(p=>p[_]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return nf={positionX:function(u){let f,m=e.buildLayerMatrix(u),_=Object.assign(n(u,m),o(u,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(x=>{x==="r"&&(f=f.map(k=>Object.values(k).reverse()));let y=(b==="u"?u.predecessors:u.successors).bind(u),v=i(u,f,_,y),S=a(u,f,v.root,v.align,x==="r");x==="r"&&(S=e.mapValues(S,k=>-k)),g[b+x]=S})});let p=l(u,g);return c(g,p),d(g,u.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},nf}function jD(){if(a2)return of;a2=1;let t=Rt(),e=ND().positionX;return of=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,i=0;r.forEach(a=>{const l=a.reduce((c,d)=>{const u=o.node(d).height;return c>u?c:u},0);a.forEach(c=>o.node(c).y=i+l/2),i+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},of}function ED(){if(l2)return rf;l2=1;let t=pD(),e=gD(),n=bD(),o=Rt().normalizeRanks,r=yD(),s=Rt().removeEmptyRanks,i=xD(),a=function(){if(Wv)return Jh;Wv=1;let E=Rt();function j(I,T,M,L,B,O){let z={width:0,height:0,rank:O,borderType:T},F=B[T][O-1],V=E.addDummyNode(I,"border",z,M);B[T][O]=V,I.setParent(V,L),F&&I.setEdge(F,V,{weight:1})}return Jh=function(I){I.children().forEach(function T(M){let L=I.children(M),B=I.node(M);if(L.length&&L.forEach(T),Object.hasOwn(B,"minRank")){B.borderLeft=[],B.borderRight=[];for(let O=B.minRank,z=B.maxRank+1;O<z;++O)j(I,"borderLeft","_bl",M,B,O),j(I,"borderRight","_br",M,B,O)}})},Jh}(),l=wD(),c=CD(),d=jD(),u=Rt(),f=Kn().Graph;rf=function(E,j){let I=j&&j.debugTiming?u.time:u.notime;I("layout",()=>{let T=I(" buildLayoutGraph",()=>function(M){let L=new f({multigraph:!0,compound:!0}),B=k(M.graph());return L.setGraph(Object.assign({},_,S(B,m),u.pick(B,g))),M.nodes().forEach(O=>{const z=S(k(M.node(O)),p);Object.keys(b).forEach(F=>{z[F]===void 0&&(z[F]=b[F])}),L.setNode(O,z),L.setParent(O,M.parent(O))}),M.edges().forEach(O=>{let z=k(M.edge(O));L.setEdge(O,Object.assign({},y,S(z,x),u.pick(z,v)))}),L}(E));I(" runLayout",()=>function(M,L,B){L(" makeSpaceForEdgeLabels",()=>function(O){let z=O.graph();z.ranksep/=2,O.edges().forEach(F=>{let V=O.edge(F);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}(M)),L(" removeSelfEdges",()=>function(O){O.edges().forEach(z=>{if(z.v===z.w){var F=O.node(z.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:z,label:O.edge(z)}),O.removeEdge(z)}})}(M)),L(" acyclic",()=>t.run(M)),L(" nestingGraph.run",()=>i.run(M)),L(" rank",()=>n(u.asNonCompoundGraph(M))),L(" injectEdgeLabelProxies",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(F.width&&F.height){let V=O.node(z.v),P={rank:(O.node(z.w).rank-V.rank)/2+V.rank,e:z};u.addDummyNode(O,"edge-proxy",P,"_ep")}})}(M)),L(" removeEmptyRanks",()=>s(M)),L(" nestingGraph.cleanup",()=>i.cleanup(M)),L(" normalizeRanks",()=>o(M)),L(" assignRankMinMax",()=>function(O){let z=0;O.nodes().forEach(F=>{let V=O.node(F);V.borderTop&&(V.minRank=O.node(V.borderTop).rank,V.maxRank=O.node(V.borderBottom).rank,z=Math.max(z,V.maxRank))}),O.graph().maxRank=z}(M)),L(" removeEdgeLabelProxies",()=>function(O){O.nodes().forEach(z=>{let F=O.node(z);F.dummy==="edge-proxy"&&(O.edge(F.e).labelRank=F.rank,O.removeNode(z))})}(M)),L(" normalize.run",()=>e.run(M)),L(" parentDummyChains",()=>r(M)),L(" addBorderSegments",()=>a(M)),L(" order",()=>c(M,B)),L(" insertSelfEdges",()=>function(O){var z=u.buildLayerMatrix(O);z.forEach(F=>{var V=0;F.forEach((P,C)=>{var $=O.node(P);$.order=C+V,($.selfEdges||[]).forEach(N=>{u.addDummyNode(O,"selfedge",{width:N.label.width,height:N.label.height,rank:$.rank,order:C+ ++V,e:N.e,label:N.label},"_se")}),delete $.selfEdges})})}(M)),L(" adjustCoordinateSystem",()=>l.adjust(M)),L(" position",()=>d(M)),L(" positionSelfEdges",()=>function(O){O.nodes().forEach(z=>{var F=O.node(z);if(F.dummy==="selfedge"){var V=O.node(F.e.v),P=V.x+V.width/2,C=V.y,$=F.x-P,N=V.height/2;O.setEdge(F.e,F.label),O.removeNode(z),F.label.points=[{x:P+2*$/3,y:C-N},{x:P+5*$/6,y:C-N},{x:P+$,y:C},{x:P+5*$/6,y:C+N},{x:P+2*$/3,y:C+N}],F.label.x=F.x,F.label.y=F.y}})}(M)),L(" removeBorderNodes",()=>function(O){O.nodes().forEach(z=>{if(O.children(z).length){let F=O.node(z),V=O.node(F.borderTop),P=O.node(F.borderBottom),C=O.node(F.borderLeft[F.borderLeft.length-1]),$=O.node(F.borderRight[F.borderRight.length-1]);F.width=Math.abs($.x-C.x),F.height=Math.abs(P.y-V.y),F.x=C.x+F.width/2,F.y=V.y+F.height/2}}),O.nodes().forEach(z=>{O.node(z).dummy==="border"&&O.removeNode(z)})}(M)),L(" normalize.undo",()=>e.undo(M)),L(" fixupEdgeLabelCoords",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(Object.hasOwn(F,"x"))switch(F.labelpos!=="l"&&F.labelpos!=="r"||(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset}})}(M)),L(" undoCoordinateSystem",()=>l.undo(M)),L(" translateGraph",()=>function(O){let z=Number.POSITIVE_INFINITY,F=0,V=Number.POSITIVE_INFINITY,P=0,C=O.graph(),$=C.marginx||0,N=C.marginy||0;function H(Y){let Z=Y.x,q=Y.y,re=Y.width,ne=Y.height;z=Math.min(z,Z-re/2),F=Math.max(F,Z+re/2),V=Math.min(V,q-ne/2),P=Math.max(P,q+ne/2)}O.nodes().forEach(Y=>H(O.node(Y))),O.edges().forEach(Y=>{let Z=O.edge(Y);Object.hasOwn(Z,"x")&&H(Z)}),z-=$,V-=N,O.nodes().forEach(Y=>{let Z=O.node(Y);Z.x-=z,Z.y-=V}),O.edges().forEach(Y=>{let Z=O.edge(Y);Z.points.forEach(q=>{q.x-=z,q.y-=V}),Object.hasOwn(Z,"x")&&(Z.x-=z),Object.hasOwn(Z,"y")&&(Z.y-=V)}),C.width=F-z+$,C.height=P-V+N}(M)),L(" assignNodeIntersects",()=>function(O){O.edges().forEach(z=>{let F,V,P=O.edge(z),C=O.node(z.v),$=O.node(z.w);P.points?(F=P.points[0],V=P.points[P.points.length-1]):(P.points=[],F=$,V=C),P.points.unshift(u.intersectRect(C,F)),P.points.push(u.intersectRect($,V))})}(M)),L(" reversePoints",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);F.reversed&&F.points.reverse()})}(M)),L(" acyclic.undo",()=>t.undo(M))}(T,I,j)),I(" updateInputGraph",()=>function(M,L){M.nodes().forEach(B=>{let O=M.node(B),z=L.node(B);O&&(O.x=z.x,O.y=z.y,O.rank=z.rank,L.children(B).length&&(O.width=z.width,O.height=z.height))}),M.edges().forEach(B=>{let O=M.edge(B),z=L.edge(B);O.points=z.points,Object.hasOwn(z,"x")&&(O.x=z.x,O.y=z.y)}),M.graph().width=L.graph().width,M.graph().height=L.graph().height}(E,T))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height"],b={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],y={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function S(E,j){return u.mapValues(u.pick(E,j),Number)}function k(E){var j={};return E&&Object.entries(E).forEach(([I,T])=>{typeof I=="string"&&(I=I.toLowerCase()),j[I]=T}),j}return rf}function ID(){if(c2)return sf;c2=1;let t=Rt(),e=Kn().Graph;return sf={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),s.reduce((l,c)=>(r.setEdge(l,c,{style:"invis"}),c))}),r}},sf}var x2=f2?h2:(f2=1,h2={graphlib:Kn(),layout:ED(),debug:ID(),util:{time:Rt().time,notime:Rt().notime},version:u2?d2:(u2=1,d2="1.1.4")});const Hi=new x2.graphlib.Graph().setDefaultEdgeLabel(()=>({})),w2=(t,e,n)=>(Hi.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Hi.setEdge(o.source,o.target)),t.forEach(o=>Hi.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),x2.layout(Hi),{nodes:t.map(o=>{const{x:r,y:s}=Hi.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),v2=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:ls.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:wh(dt.get(e).code.trim().split(`
128
128
  `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const u of c)for(const f of d){const m=`${u}-${f}`;a.has(m)||(a.add(m),i.add(u),i.add(f),s.push(this.createEdge(u,f)))}}for(const[l,c]of qm.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),u=dt.get(c).code.trim().startsWith("mo.md");!d&&u||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},AD=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let C=v2.createElements(n,r,o,a.hidePureMarkdown);return C=w2(C.nodes,C.edges,{direction:i}),C},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=A.useState(l),[d,u,f]=ev(c.nodes),[m,_,g]=tv(c.edges),p=Ui();let b;e[6]!==i||e[7]!==_||e[8]!==u?(b=C=>{const $=w2(C.nodes,C.edges,{direction:i});u($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=u,e[9]=b):b=e[9];const x=et(b);let y,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==x||e[14]!==o?(y=()=>{x(v2.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,x,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=x,e[14]=o,e[15]=y,e[16]=v):(y=e[15],v=e[16]),A.useEffect(y,v);const[S,k]=A.useState();let E;lv(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{k(void 0)},e[17]=E):E=e[17];const j=E;let I,T,M,L,B,O,z,F,V,P;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},T=(C,$)=>{k({type:"node",id:$.id})},M=(C,$)=>{const{source:N,target:H}=$;k({type:"edge",source:N,target:H})},e[18]=I,e[19]=T,e[20]=M):(I=e[18],T=e[19],M=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(K9,{color:"#ccc",variant:Ln.Dots}),e[21]=L):L=e[21],e[22]!==p||e[23]!==d?(B=()=>{const C=dt.get(lV);if(C){const $=d.find(N=>N.id===C);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:C}))}},e[22]=p,e[23]=d,e[24]=B):B=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=h.jsx(jp,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==B?(z=h.jsx(H9,{position:"bottom-right",showInteractive:!1,children:h.jsx(Le,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:h.jsx(gs,{onMouseDown:$n.preventFocus,onClick:B,children:O})})}),e[26]=B,e[27]=z):z=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(F=h.jsx(Ul,{selection:S,variables:o,edges:m,onClearSelection:j}),e[28]=m,e[29]=S,e[30]=o,e[31]=F):F=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==z||e[38]!==F?(V=h.jsxs(xh,{nodes:d,edges:m,nodeTypes:iv,minZoom:.2,fitViewOptions:I,onNodeClick:T,onEdgeClick:M,onNodeDoubleClick:TD,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[L,z,F,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=g,e[36]=f,e[37]=z,e[38]=F,e[39]=V):V=e[39],e[40]!==i||e[41]!==V?(P=h.jsx(rv.Provider,{value:i,children:V}),e[40]=i,e[41]=V,e[42]=P):P=e[42],P};function TD(t,e){H4(e.id,"focus")}const MD=Qt("_minimap_"),OD=Qt({hidePureMarkdown:!0}),DD=t=>{const e=X.c(11),[n,o]=fn(MD),[r,s]=fn(OD);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?h.jsx(tD,{...t,children:h.jsx(kh,{settings:r,onSettingsChange:s,view:n,onChange:o})}):h.jsx(AD,{...t,settings:r,layoutDirection:n,children:h.jsx(kh,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=h.jsx(yh,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},RD=()=>{const t=X.c(5),e=W4(),n=Bc(),[o]=cV();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Oe("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=h.jsx("div",{className:r,children:h.jsx(DD,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},k2="name",S2="type-value",lf="defs-refs",PD=[{id:k2,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Xm,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsx(vh,{name:e,declaredBy:n})}},{id:S2,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Xm,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Type"}),h.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsxs("div",{className:"max-w-[150px]",children:[h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:lf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>h.jsx(Xm,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Declared By"}),h.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=ac(s);i&&Gm(i,o)};return h.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[h.jsx("span",{title:"Declared by",children:h.jsx(Vp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?h.jsx(pr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):h.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>h.jsxs("span",{className:"flex",children:[h.jsx(pr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[h.jsx("span",{title:"Used by",children:h.jsx(Ia,{className:"w-3.5 h-3.5 text-muted-foreground"})}),h.jsx(av,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],C2=A.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=dV(),l=A.useMemo(()=>{const u=f=>{const m=a[f];return pV(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(u),usedByNames:f.usedBy.map(u)}))},[n,a,e]),c=A.useMemo(()=>{const u=new Map;return e.forEach((f,m)=>u.set(f,m)),function(f,m,_){m||(m={id:lf,desc:!1});let g=[];switch(m.id){case k2:g=va(f,p=>p.name);break;case S2:g=va(f,p=>p.dataType);break;case lf:g=va(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}(l,o[0],u)},[l,o,e]),d=uV({data:c,columns:PD,getCoreRowModel:mV(),onGlobalFilterChange:i,getFilteredRowModel:fV(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:u=>u.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:hV(),state:{sorting:o,globalFilter:s}});return h.jsxs(h.Fragment,{children:[h.jsx(q4,{className:"w-full",placeholder:"Search",value:s,onChange:u=>i(u.target.value)}),h.jsxs(Ym,{className:Oe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[h.jsx(Jm,{children:h.jsx(Xs,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(u=>h.jsx(zr,{className:"sticky top-0 bg-background border-b",children:G4(u.column.columnDef.header,u.getContext())},u.id))})}),h.jsx(Km,{children:d.getRowModel().rows.map(u=>h.jsx(Xs,{className:"hover:bg-accent",children:u.getVisibleCells().map(f=>h.jsx(Br,{className:"border-b",children:G4(f.column.columnDef.cell,f.getContext())},f.id))},u.id))})]})]})});C2.displayName="VariableTable";let N2,j2,E2;N2=()=>{const t=X.c(4),e=W4(),n=Bc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(An,{title:"No variables",description:"Global variables will appear here.",icon:h.jsx(mc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=h.jsx(C2,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},rp=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Oe("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=h.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},j2=()=>{const t=X.c(9),e=gV(),{clearLogs:n}=Ft();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(An,{title:"No logs",description:h.jsxs("span",{children:[i," and"," ",h.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:h.jsx(pm,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=h.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:h.jsx(rp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=h.jsx("div",{className:"overflow-auto flex-1",children:h.jsx(E2,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=h.jsxs(h.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},E2=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Oe("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(i=n.map(zD),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=h.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:h.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=h.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function LD(t){const e=_V(t.timestamp),n=FD[t.level],o=t.level.toUpperCase();return h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),h.jsx("span",{className:Oe("flex-shrink-0",n),children:o}),h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",h.jsx(pr,{cellId:t.cellId}),")"]}),t.message]})}const FD={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function zD(t,e){return h.jsxs("div",{className:"contents group",children:[h.jsx("span",{className:Oe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),h.jsx("span",{className:Oe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:LD(t)})]},e)}const BD=()=>{const t=X.c(5),{documentation:e}=We(bV);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(An,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:h.jsx(od,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Hm({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o};function I2(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}sp=function(t){t===void 0&&(t={});var e=t.onResize,n=A.useRef(void 0);n.current=e;var o=t.round||Math.round,r=A.useRef(),s=A.useState({width:void 0,height:void 0}),i=s[0],a=s[1],l=A.useRef(!1);A.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var c=A.useRef({width:void 0,height:void 0}),d=function(u,f){var m=A.useRef(null),_=A.useRef(null);_.current=f;var g=A.useRef(null);A.useEffect(function(){p()});var p=A.useCallback(function(){var b=g.current,x=_.current,y=b||(x?x instanceof Element?x:x.current:null);m.current&&m.current.element===y&&m.current.subscriber===u||(m.current&&m.current.cleanup&&m.current.cleanup(),m.current={element:y,subscriber:u,cleanup:y?u(y):void 0})},[u]);return A.useEffect(function(){return function(){m.current&&m.current.cleanup&&(m.current.cleanup(),m.current=null)}},[]),A.useCallback(function(b){g.current=b,p()},[p])}(A.useCallback(function(u){return r.current&&r.current.box===t.box&&r.current.round===o||(r.current={box:t.box,round:o,instance:new ResizeObserver(function(f){var m=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=I2(m,_,"inlineSize"),p=I2(m,_,"blockSize"),b=g?o(g):void 0,x=p?o(p):void 0;if(c.current.width!==b||c.current.height!==x){var y={width:b,height:x};c.current.width=b,c.current.height=x,n.current?n.current(y):l.current||a(y)}})}),r.current.instance.observe(u,{box:t.box}),function(){r.current&&r.current.instance.unobserve(u)}},[t.box,o]),t.ref);return A.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const cf=new Map,UD=({file:t,onOpenNotebook:e})=>{const{theme:n}=Fo(),o=We(um),[r,s]=A.useState(""),{data:i,loading:a,error:l,setData:c}=Hn(async()=>{const g=await Y4({path:t.path}),p=g.contents||"";return s(cf.get(t.path)||p),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await CV({path:t.path,contents:r}).then(g=>{g.success&&(c(p=>p?{...p,contents:r}:void 0),s(r))})},u=A.useRef(r);if(u.current=r,A.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=u.current;g===i.contents?cf.delete(t.path):cf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return h.jsx(Zs,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",m=f in df;if(!i.contents&&!m)return h.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[h.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),h.jsx("div",{children:i.file.name}),h.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),h.jsx("div",{children:f})]});const _=h.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Un()&&h.jsx(Le,{content:"Open notebook",children:h.jsx(xn,{size:"small",onClick:g=>e(g),children:h.jsx(wc,{})})}),h.jsx(Le,{content:"Download",children:h.jsx(xn,{size:"small",onClick:()=>{if(A2(f)){const g=kV(i.contents,f);SV(g,i.file.name)}else ra(new Blob([i.contents||r],{type:f}),i.file.name)},children:h.jsx(wm,{})})}),!A2(f)&&h.jsxs(h.Fragment,{children:[h.jsx(Le,{content:"Copy contents to clipboard",children:h.jsx(xn,{size:"small",onClick:async()=>{await yn(r)},children:h.jsx(Fs,{})})}),h.jsx(Le,{content:mn("global.save"),children:h.jsx(xn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:h.jsx(Ea,{})})})]})]});return f.startsWith("image/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(yV,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(xV,{contents:i.contents})})]}):f.startsWith("audio/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(wV,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(vV,{base64:i.contents,mime:f})})]}):h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(ba,{theme:n==="dark"?"dark":"light",language:df[f]||df.default,className:"border-b",extensions:[st.lineWrapping,Wn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})]})},A2=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/"),df={"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"},T2=Qt(new class{constructor(t){this.callbacks=t,this.delegate=new Qm([]),this.rootPath="",this.onChange=En.NOOP,this.path=new _m("/"),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 Qm(n.files),this.rootPath=n.root,this.path=_m.guessDeliminator(n.root)}catch(n){lt({title:"Failed",description:v4(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const i=o[r];s===this.rootPath?this.delegate=new Qm(i.files):this.delegate.update({id:s,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=function(o){return o.endsWith("/")?o:`${o}/`}(this.rootPath);return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(lt({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:n4,createFileOrFolder:J4,deleteFileOrFolder:jV,renameFileOrFolder:NV})),VD=Qt({});function $D(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 M2(t){const e=X.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:YD,onDropRejected:WD,onDrop:HD,...o},e[2]=o,e[3]=r):r=e[3],EV(r)}async function HD(t){for(const e of t){const n=(await $D(e)).split(",")[1];await J4({path:"",type:"file",name:e.name,contents:n})}await async function(){await dt.get(T2).refreshAll([])}()}function WD(t){lt({title:"File upload failed",description:h.jsx("div",{className:"flex flex-col gap-1",children:t.map(qD)}),variant:"danger"})}function qD(t){return h.jsxs("div",{children:[t.file.name," (",t.errors.map(GD).join(", "),")"]},t.file.name)}function GD(t){return t.message}function YD(t){Zt.error(t),lt({title:"File upload failed",description:t.message,variant:"danger"})}const O2=K.createContext(null),JD=t=>{const e=X.c(60),{height:n}=t,o=A.useRef(null),[r]=fn(T2);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=A.useState(s),[l,c]=A.useState(null),{openPrompt:d}=Vn(),[u,f]=fn(VD);let m,_;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{loading:g,error:p}=Hn(m,_);let b;e[4]!==u||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(u).filter(C=>u[C]))},e[4]=u,e[5]=r,e[6]=b):b=e[6];const x=et(b);let y;e[7]!==d||e[8]!==r?(y=async()=>{d({title:"Folder name",onConfirm:async C=>{r.createFolder(C,null)}})},e[7]=d,e[8]=r,e[9]=y):y=e[9];const v=et(y);let S;e[10]!==d||e[11]!==r?(S=async()=>{d({title:"File name",onConfirm:async C=>{r.createFile(C,null)}})},e[10]=d,e[11]=r,e[12]=S):S=e[12];const k=et(S);let E;e[13]!==f?(E=()=>{var C;(C=o.current)==null||C.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const j=et(E);if(g){let C;return e[15]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(eo,{size:"medium",centered:!0}),e[15]=C):C=e[15],C}if(p){let C;return e[16]!==p?(C=h.jsx(Zs,{error:p}),e[16]=p,e[17]=C):C=e[17],C}if(l){let C,$,N,H,Y,Z;return e[18]===Symbol.for("react.memo_cache_sentinel")?(C=()=>c(null),e[18]=C):C=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(Pe,{onClick:C,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:h.jsx(It,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(N=h.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,h.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=N):N=e[21],e[22]!==l.path||e[23]!==r?(H=q=>D2(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=H):H=e[24],e[25]!==l||e[26]!==H?(Y=h.jsx(A.Suspense,{children:h.jsx(UD,{onOpenNotebook:H,file:l})}),e[25]=l,e[26]=H,e[27]=Y):Y=e[27],e[28]!==N||e[29]!==Y?(Z=h.jsxs(h.Fragment,{children:[N,Y]}),e[28]=N,e[29]=Y,e[30]=Z):Z=e[30],Z}let I;e[31]!==j||e[32]!==k||e[33]!==v||e[34]!==x||e[35]!==r?(I=h.jsx(XD,{onRefresh:x,onCreateFile:k,onCreateFolder:v,onCollapseAll:j,tree:r}),e[31]=j,e[32]=k,e[33]=v,e[34]=x,e[35]=r,e[36]=I):I=e[36];const T=n-33;let M,L,B,O,z,F,V,P;return e[37]!==r?(M=async C=>{const{ids:$}=C;for(const N of $)await r.delete(N)},L=async C=>{const{id:$,name:N}=C;await r.rename($,N)},B=async C=>{const{dragIds:$,parentId:N}=C;await r.move($,N)},e[37]=r,e[38]=M,e[39]=L,e[40]=B):(M=e[38],L=e[39],B=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=C=>{const $=C[0];$&&($.data.isDirectory||c($.data))},e[41]=O):O=e[41],e[42]!==u||e[43]!==f||e[44]!==r?(z=async C=>{if(await r.expand(C)){const $=u[C]??!1;f({...u,[C]:!$})}},e[42]=u,e[43]=f,e[44]=r,e[45]=z):z=e[45],e[46]!==i||e[47]!==u||e[48]!==M||e[49]!==L||e[50]!==B||e[51]!==z||e[52]!==T?(F=h.jsx(M$,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:u,openByDefault:!1,renderCursor:nR,disableDrop:oR,onDelete:M,onRename:L,onMove:B,onSelect:O,onToggle:z,padding:15,rowHeight:30,indent:KD,overscanCount:1e3,disableMultiSelection:!0,children:eR}),e[46]=i,e[47]=u,e[48]=M,e[49]=L,e[50]=B,e[51]=z,e[52]=T,e[53]=F):F=e[53],e[54]!==F||e[55]!==r?(V=h.jsx(O2.Provider,{value:r,children:F}),e[54]=F,e[55]=r,e[56]=V):V=e[56],e[57]!==V||e[58]!==I?(P=h.jsxs(h.Fragment,{children:[I,V]}),e[57]=V,e[58]=I,e[59]=P):P=e[59],P},KD=15,XD=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=M2(i);let c,d,u,f,m,_,g,p,b,x,y,v,S,k,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Na,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=h.jsx(Le,{content:"Add file",children:h.jsx(Pe,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(Kc,{size:16}),e[4]=u):u=e[4],e[5]!==r?(f=h.jsx(Le,{content:"Add folder",children:h.jsx(Pe,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:u})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(m=a({}),e[7]=a,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=IV({variant:"text",size:"xs"}),g=h.jsx(AV,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=h.jsx(Le,{content:"Upload file",children:h.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:_,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(x=h.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(O4,{size:16}),e[17]=y):y=e[17],e[18]!==n?(v=h.jsx(Le,{content:"Refresh",children:h.jsx(Pe,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(fp,{size:16}),e[20]=S):S=e[20],e[21]!==s?(k=h.jsx(Le,{content:"Collapse all folders",children:h.jsx(Pe,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=k):k=e[22],e[23]!==x||e[24]!==v||e[25]!==k||e[26]!==d||e[27]!==f||e[28]!==p?(E=h.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,p,x,v,k]}),e[23]=x,e[24]=v,e[25]=k,e[26]=d,e[27]=f,e[28]=p,e[29]=E):E=e[29],E},ZD=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Un()&&h.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",h.jsx(wc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(i=h.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},QD=t=>{const e=X.c(10),{node:n}=t,o=A.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),A.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=h.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:rR,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},eR=t=>{const e=X.c(53),{node:n,style:o,dragHandle:r}=t;let s;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(s=n.data.isDirectory?"directory":e4(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=s):s=e[2];const i=s,a=t4[i],{openConfirm:l,openPrompt:c}=Vn(),d=A.useContext(O2);let u;e[3]!==n.data.path||e[4]!==d?(u=async F=>{D2(F,d?d.relativeFromRoot(n.data.path):n.data.path)},e[3]=n.data.path,e[4]=d,e[5]=u):u=e[5];const f=u;let m;e[6]!==n.data.name||e[7]!==n.id||e[8]!==n.tree||e[9]!==l?(m=async F=>{F.stopPropagation(),F.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:h.jsx(B3,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[6]=n.data.name,e[7]=n.id,e[8]=n.tree,e[9]=l,e[10]=m):m=e[10];const _=m;let g;e[11]!==n||e[12]!==c||e[13]!==d?(g=async()=>{n.open(),c({title:"Folder name",onConfirm:async F=>{d==null||d.createFolder(F,n.id)}})},e[11]=n,e[12]=c,e[13]=d,e[14]=g):g=e[14];const p=et(g);let b;e[15]!==n||e[16]!==c||e[17]!==d?(b=async()=>{n.open(),c({title:"File name",onConfirm:async F=>{d==null||d.createFile(F,n.id)}})},e[15]=n,e[16]=c,e[17]=d,e[18]=b):b=e[18];const x=et(b);let y;e[19]!==i||e[20]!==x||e[21]!==p||e[22]!==_||e[23]!==f||e[24]!==n||e[25]!==d?(y=()=>{const F={size:14,strokeWidth:1.5,className:"mr-2"};return h.jsxs(bc,{align:"end",className:"no-print w-[220px]",onClick:sR,onCloseAutoFocus:iR,children:[!n.data.isDirectory&&h.jsxs(sn,{onSelect:()=>n.select(),children:[h.jsx(Jp,{...F}),"Open file"]}),!n.data.isDirectory&&!Un()&&h.jsxs(sn,{onSelect:()=>{TV({path:n.data.path})},children:[h.jsx(wc,{...F}),"Open file in external editor"]}),n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(sn,{onSelect:()=>x(),children:[h.jsx(Na,{...F}),"Create file"]}),h.jsxs(sn,{onSelect:()=>p(),children:[h.jsx(Kc,{...F}),"Create folder"]}),h.jsx(zo,{})]}),h.jsxs(sn,{onSelect:()=>n.edit(),children:[h.jsx(Rp,{...F}),"Rename"]}),h.jsxs(sn,{onSelect:async()=>{await yn(n.data.path),lt({title:"Copied to clipboard"})},children:[h.jsx(Fs,{...F}),"Copy path"]}),d&&h.jsxs(sn,{onSelect:async()=>{await yn(d.relativeFromRoot(n.data.path)),lt({title:"Copied to clipboard"})},children:[h.jsx(Fs,{...F}),"Copy relative path"]}),h.jsxs(sn,{onSelect:async()=>{lt({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:V}=n.data,P=OV[i](V);await yn(P)},children:[h.jsx(MV,{...F}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!Un()&&h.jsxs(h.Fragment,{children:[h.jsx(zo,{}),h.jsxs(sn,{onSelect:f,children:[h.jsx(Hp,{...F}),"Open notebook"]})]}),h.jsx(zo,{}),!n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(sn,{onSelect:async()=>{const V=(await Y4({path:n.data.path})).contents||"";ra(new Blob([V]),n.data.name)},children:[h.jsx(wm,{...F}),"Download"]}),h.jsx(zo,{})]}),h.jsxs(sn,{onSelect:_,variant:"danger",children:[h.jsx(dm,{...F}),"Delete"]})]})},e[19]=i,e[20]=x,e[21]=p,e[22]=_,e[23]=f,e[24]=n,e[25]=d,e[26]=y):y=e[26];const v=y;let S,k,E;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=Oe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[27]=S):S=e[27],e[28]!==n?(k=F=>{F.stopPropagation(),n.data.isDirectory&&n.toggle()},E=h.jsx(tR,{node:n}),e[28]=n,e[29]=k,e[30]=E):(k=e[29],E=e[30]);const j=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let I,T,M,L,B,O,z;return e[31]!==j?(I=Oe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",j),e[31]=j,e[32]=I):I=e[32],e[33]!==a||e[34]!==n.data.isMarimoFile?(T=n.data.isMarimoFile?h.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):h.jsx(a,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),e[33]=a,e[34]=n.data.isMarimoFile,e[35]=T):T=e[35],e[36]!==f||e[37]!==n?(M=n.isEditing?h.jsx(QD,{node:n}):h.jsx(ZD,{node:n,onOpenMarimoFile:f}),e[36]=f,e[37]=n,e[38]=M):M=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(_c,{asChild:!0,tabIndex:-1,onClick:aR,children:h.jsx(Pe,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:h.jsx(Jc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),e[39]=L):L=e[39],e[40]!==v?(B=h.jsxs(gc,{modal:!1,children:[L,v()]}),e[40]=v,e[41]=B):B=e[41],e[42]!==I||e[43]!==T||e[44]!==M||e[45]!==B?(O=h.jsxs("span",{className:I,children:[T,M,B]}),e[42]=I,e[43]=T,e[44]=M,e[45]=B,e[46]=O):O=e[46],e[47]!==r||e[48]!==o||e[49]!==O||e[50]!==k||e[51]!==E?(z=h.jsxs("div",{style:o,ref:r,className:S,draggable:!0,onClick:k,children:[E,O]}),e[47]=r,e[48]=o,e[49]=O,e[50]=k,e[51]=E,e[52]=z):z=e[52],z},tR=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?h.jsx(Qi,{className:"w-5 h-5 flex-shrink-0"}):h.jsx(uc,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function D2(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function nR(){return null}function oR(t){const{parentNode:e}=t;return!e.data.isDirectory}function rR(t){return t.stopPropagation()}function sR(t){return t.stopPropagation()}function iR(t){return t.preventDefault()}function aR(t){return t.stopPropagation()}const lR=()=>{const t=X.c(20),{ref:e,height:n}=sp(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:i,isDragActive:a}=M2(r);let l,c,d,u,f,m,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=Oe("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(d=i(),t[4]=i,t[5]=d):d=t[5],t[6]!==d?(u=h.jsx("input",{...d}),t[6]=d,t[7]=u):u=t[7],t[8]!==a?(f=a&&h.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(m=h.jsx(JD,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=h.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=_):_=t[14],t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==_?(g=h.jsxs("div",{...l,className:c,children:[u,f,_]}),t[15]=l,t[16]=u,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},cR=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Vn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(h.jsx(uR,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=h.jsx(V4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},dR=[st.lineWrapping],uR=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=A.useState(""),{theme:s}=Fo();let i,a,l,c,d,u;e[0]!==n?(i=async y=>{y.preventDefault();const v=new FormData(y.target),S=v.get("title"),k=v.get("description"),E=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:k,code:E})}),n(),lt({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(ur,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Ds,{children:[a,h.jsxs(Ls,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",h.jsx("a",{href:Zn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(hr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=h.jsx(DV,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(u=h.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=u):u=e[7];const f=s==="dark"?"dark":"light";let m,_,g,p,b,x;return e[8]!==o||e[9]!==f?(m=h.jsx(ba,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:dR,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==u||e[12]!==m?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,u,m]}),e[11]=u,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=h.jsx(Pe,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Pe,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=h.jsxs(ta,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(x=h.jsx(dr,{className:"w-fit",children:h.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=x):x=e[22],x},hR=[st.lineWrapping],fR=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,loading:i}=Hn(gR,o);if(s){let b;return t[1]!==s?(b=h.jsx(Zs,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(i||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(eo,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,u,f,m,_,g,p;return t[4]!==a?(l=Oe("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(ea,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs("div",{className:"flex items-center w-full",children:[c,h.jsx(cR,{children:h.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Fr,{className:"h-4 w-4"})})})]}),u=h.jsx(fc,{children:"No results"}),t[7]=d,t[8]=u):(d=t[7],u=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=h.jsx(pR,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=h.jsxs(kc,{className:l,children:[d,u,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=h.jsx(A.Suspense,{children:h.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?h.jsx(mR,{snippet:e},e.title):h.jsx(An,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(p=h.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},mR=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=Fo(),{createNewCell:r}=Ft(),s=Bs();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let d,u,f,m,_,g;if(e[7]!==n.title?(d=h.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=d):d=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(ni,{className:"ml-2 h-4 w-4"}),e[9]=u):u=e[9],e[10]!==a?(f=h.jsx("div",{className:"flex justify-end",children:h.jsx(si,{children:h.jsxs(Pe,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",u]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==c||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:x,html:y,id:v}=b;return y?h.jsx("div",{children:Hm({html:y})},`${n.title}-${v}`):x?h.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[h.jsx(si,{children:h.jsx(Le,{content:"Insert snippet",children:h.jsx(Pe,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(x)},children:h.jsx(ni,{className:"h-5 w-5"})})})}),h.jsx(ba,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:hR,value:x,readOnly:!0},`${n.title}-${v}`)]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(_=h.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=_):_=e[23],e[24]!==d||e[25]!==_?(g=h.jsxs(h.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},pR=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>h.jsx(mo,{className:"rounded-none",onSelect:()=>o(a),children:h.jsx("div",{className:"flex flex-row gap-2 items-center",children:h.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=h.jsx(Om,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function gR(){return RV()}const _R=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const u=dt.get(K4)[d];if(u)return u.declaredBy[0]}(n);if(!l)return;const c=ac(l);c&&Gm(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Oe("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=h.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},bR=Qt(t=>{const e=t(PV),n=t(K4),o=t(B4);return va(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),yR=Qt(t=>{const e=new Map(t(LV));for(const n of X4){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return va([...e.values()],n=>X4.has(n.name)?1:0)}),xR=()=>{const t=X.c(32),[e,n]=K.useState(""),o=en(Z4),r=We(bR),s=We(yR);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(An,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:h.jsx(Ig,{children:h.jsxs(Pe,{variant:"outline",size:"sm",children:["Add database or catalog",h.jsx(Fr,{className:"h-4 w-4 ml-2"})]})}),icon:h.jsx(cr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,u,f,m,_,g,p;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=h.jsx(ea,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&h.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:h.jsx(go,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Ig,{children:h.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Fr,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(u=h.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=u):u=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=x=>h.jsx(wR,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(y=>h.jsx(vR,{engineName:x.name,database:y,hasSearch:i,children:h.jsx(kR,{schemas:y.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:y.name,hasSearch:i,searchValue:e})},y.name))},x.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&h.jsxs(Q4,{children:[h.jsx(dc,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&h.jsx(R2,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=h.jsxs(Om,{className:"flex flex-col",children:[f,m,_]}),t[25]=f,t[26]=m,t[27]=_,t[28]=g):g=t[28],t[29]!==u||t[30]!==g?(p=h.jsxs(kc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[u,g]}),t[29]=u,t[30]=g,t[31]=p):p=t[31],p},wR=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===FV,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await BV({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let u,f,m;e[2]!==n.dialect?(u=h.jsx(Y3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=u):u=e[3],e[4]!==n.dialect?(f=zV(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=h.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const _=i;let g,p,b,x,y;return e[8]!==_?(g=h.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.jsx(_R,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(p=!s&&h.jsx(Le,{content:"Refresh connection",children:h.jsx(Pe,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:h.jsx(Tc,{className:Oe("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=d,e[11]=s,e[12]=a,e[13]=p):p=e[13],e[14]!==u||e[15]!==m||e[16]!==g||e[17]!==p?(b=h.jsxs(Q4,{children:[u,m,g,p]}),e[14]=u,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(x=r?o:h.jsx(Uc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=x):x=e[21],e[22]!==b||e[23]!==x?(y=h.jsxs(h.Fragment,{children:[b,x]}),e[22]=b,e[23]=x,e[24]=y):y=e[24],y},vR=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u,f;e[0]!==n?(d=()=>{a(n)},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),K.useEffect(d,u),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let _;e[6]!==i?(_=h.jsx(rS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=Oe("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=h.jsx(cr,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,S,k;e[12]!==x?(y=Oe(x),e[12]=x,e[13]=y):y=e[13],e[14]!==r.name?(v=r.name===""?h.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==y||e[17]!==v?(S=h.jsx("span",{className:y,children:v}),e[16]=y,e[17]=v,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(k=h.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=k):k=e[24];const E=i&&s;let j;return e[25]!==k||e[26]!==E?(j=h.jsxs(h.Fragment,{children:[k,E]}),e[25]=k,e[26]=E,e[27]=j):j=e[27],j},kR=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(Uc,{content:"No schemas available",className:"pl-6"}),e[0]=u):u=e[0],u}let c,d;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let u;e[9]!==l?(u=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=u):u=e[10];const f=n.filter(u);let m;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(m=_=>h.jsx(SR,{databaseName:i,schema:_,hasSearch:a,children:h.jsx(R2,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=m):m=e[17],c=f.map(m),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=h.jsx(h.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},SR=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=`${n}:${o.name}`;let u,f,m,_;if(e[0]!==s?(u=()=>{a(s)},f=[s],e[0]=s,e[1]=u,e[2]=f):(u=e[1],f=e[2]),K.useEffect(u,f),oS(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(_=h.jsx(rS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let p,b;e[8]!==g?(p=Oe("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=h.jsx(GV,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,S;e[12]!==x?(y=Oe(x),e[12]=x,e[13]=y):y=e[13],e[14]!==o.name||e[15]!==y?(v=h.jsx("span",{className:y,children:o.name}),e[14]=o.name,e[15]=y,e[16]=v):v=e[16],e[17]!==v||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==d?(S=h.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:d,children:[_,b,v]}),e[17]=v,e[18]=m,e[19]=_,e[20]=b,e[21]=d,e[22]=S):S=e[22];const k=i&&r;let E;return e[23]!==S||e[24]!==k?(E=h.jsxs(h.Fragment,{children:[S,k]}),e[23]=S,e[24]=k,e[25]=E):E=e[25],E},R2=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=eS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(d=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:p,database:b,schema:x}=o,y=await eH.request({engine:p,database:b,schema:x});if(!(y!=null&&y.tables))throw c(!1),new Error("No tables available");s({tables:y.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=d):d=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(u=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=u):u=e[8];const{loading:f,error:m}=Hn(d,u);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(tS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=h.jsx(nS,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Uc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=y=>!r||y.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let x;e[19]!==r||e[20]!==o?(x=y=>h.jsx(CR,{table:y,sqlTableContext:o,isSearching:!!r},y.name),e[19]=r,e[20]=o,e[21]=x):x=e[21],_=b.map(x),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=h.jsx(h.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},CR=t=>{const e=X.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=eS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=n.columns.length>0;let u,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(u=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:q,database:re,schema:ne}=o,oe=await tH.request({engine:q,database:re,schema:ne,tableName:n.name});if(!(oe!=null&&oe.table))throw new Error("No table details available");s({table:oe.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=u):u=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{loading:m,error:_}=Hn(u,f),g=We(Ms),p=Bs(),{createNewCell:b}=Ft();let x;e[10]!==g||e[11]!==b||e[12]!==p||e[13]!==o||e[14]!==n?(x=()=>{lr(g,b,p),b({code:(()=>{if(n.source_type==="catalog"){const q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${q}")`}if(o)return sS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return sS(n,"*",o);default:return sc(n.source_type),""}})(),before:!1,cellId:p??"__end__"})},e[10]=g,e[11]=b,e[12]=p,e[13]=o,e[14]=n,e[15]=x):x=e[15];const y=x;let v;e[16]!==n.num_columns||e[17]!==n.num_rows?(v=()=>{const q=[];return n.num_rows!=null&&q.push(`${n.num_rows} rows`),n.num_columns!=null&&q.push(`${n.num_columns} columns`),q.length===0?null:h.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:h.jsx("span",{className:"text-xs text-muted-foreground",children:q.join(", ")})})},e[16]=n.num_columns,e[17]=n.num_rows,e[18]=v):v=e[18];const S=v;let k;e[19]!==_||e[20]!==m||e[21]!==o||e[22]!==n?(k=()=>{if(m)return h.jsx(tS,{message:"Loading columns...",className:"pl-12"});if(_)return h.jsx(nS,{error:_,className:"pl-12"});const q=n.columns;return q.length===0?h.jsx(Uc,{content:"No columns found",className:"pl-12"}):q.map(re=>h.jsx(NR,{table:n,column:re,sqlTableContext:o},re.name))},e[19]=_,e[20]=m,e[21]=o,e[22]=n,e[23]=k):k=e[23];const E=k;let j;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(j=()=>{if(n.source_type==="local")return;const q=n.type==="table"?UV:O3;return h.jsx(q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[24]=i,e[25]=r,e[26]=n.source_type,e[27]=n.type,e[28]=j):j=e[28];const I=j,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(oS(o.schema)?"pl-9":"pl-12"),L=(i||r)&&"font-semibold";let B,O,z,F,V,P,C,$,N,H,Y,Z;return e[29]!==M||e[30]!==L?(B=Oe("rounded-none group h-8 cursor-pointer",M,L),e[29]=M,e[30]=L,e[31]=B):B=e[31],e[32]!==i?(O=()=>a(!i),e[32]=i,e[33]=O):O=e[33],e[34]!==I?(z=I(),e[34]=I,e[35]=z):z=e[35],e[36]!==n.name?(F=h.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=F):F=e[37],e[38]!==z||e[39]!==F?(V=h.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,F]}),e[38]=z,e[39]=F,e[40]=V):V=e[40],e[41]!==S?(P=S(),e[41]=S,e[42]=P):P=e[42],e[43]!==y?(C=$n.stopPropagation(()=>y()),e[43]=y,e[44]=C):C=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(VV,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==C?(N=h.jsx(Le,{content:"Add table to notebook",delayDuration:400,children:h.jsx(Pe,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:$})}),e[46]=C,e[47]=N):N=e[47],e[48]!==i||e[49]!==O||e[50]!==V||e[51]!==P||e[52]!==N||e[53]!==B||e[54]!==T?(H=h.jsxs(mo,{className:B,value:T,"aria-selected":i,forceMount:!0,onSelect:O,children:[V,P,N]}),e[48]=i,e[49]=O,e[50]=V,e[51]=P,e[52]=N,e[53]=B,e[54]=T,e[55]=H):H=e[55],e[56]!==i||e[57]!==E?(Y=i&&E(),e[56]=i,e[57]=E,e[58]=Y):Y=e[58],e[59]!==H||e[60]!==Y?(Z=h.jsxs(h.Fragment,{children:[H,Y]}),e[59]=H,e[60]=Y,e[61]=Z):Z=e[61],Z},NR=t=>{var Y,Z;const e=X.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=We(Z4),l=en($V);let c,d;e[0]!==a?(c=()=>{a&&i(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),K.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const u=We(Ms),f=Bs(),{createNewCell:m}=Ft(),{columnsPreviews:_}=HV();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((Y=n.primary_keys)==null?void 0:Y.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const p=g;let b;e[6]!==o.name||e[7]!==n.indexes?(b=((Z=n.indexes)==null?void 0:Z.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=b):b=e[8];const x=b;let y;e[9]!==u||e[10]!==m||e[11]!==f?(y=q=>{q.includes("alt")&&YV(u,m,f),m({code:q,before:!1,cellId:f??"__end__"})},e[9]=u,e[10]=m,e[11]=f,e[12]=y):y=e[12];const v=y,S=jR,k=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==k?(E=h.jsx("span",{className:k,children:o.name}),e[13]=o.name,e[14]=k,e[15]=E):E=e[15];const j=E,I=`${n.name}.${o.name}`,T=`${n.name}.${o.name}`;let M;e[16]!==s?(M=()=>i(!s),e[16]=s,e[17]=M):M=e[17];const L=r?"pl-14":"pl-7";let B,O,z,F,V,P,C,$,N,H;return e[18]!==L?(B=Oe("flex flex-row gap-2 items-center flex-1",L),e[18]=L,e[19]=B):B=e[19],e[20]!==o.type||e[21]!==j?(O=h.jsx(WV,{columnName:j,dataType:o.type}),e[20]=o.type,e[21]=j,e[22]=O):O=e[22],e[23]!==p?(z=p&&S({tooltipContent:"Primary key",content:"PK"}),e[23]=p,e[24]=z):z=e[24],e[25]!==x?(F=x&&S({tooltipContent:"Indexed",content:"IDX"}),e[25]=x,e[26]=F):F=e[26],e[27]!==B||e[28]!==O||e[29]!==z||e[30]!==F?(V=h.jsxs("div",{className:B,children:[O,z,F]}),e[27]=B,e[28]=O,e[29]=z,e[30]=F,e[31]=V):V=e[31],e[32]!==o.name?(P=h.jsx(Le,{content:"Copy column name",delayDuration:400,children:h.jsx(Pe,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:h.jsx(iS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=P):P=e[33],e[34]!==o.external_type?(C=h.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[34]=o.external_type,e[35]=C):C=e[35],e[36]!==M||e[37]!==V||e[38]!==P||e[39]!==C||e[40]!==I||e[41]!==T?($=h.jsxs(mo,{className:"rounded-none py-1 group cursor-pointer",value:T,onSelect:M,children:[V,P,C]},I),e[36]=M,e[37]=V,e[38]=P,e[39]=C,e[40]=I,e[41]=T,e[42]=$):$=e[42],e[43]!==o||e[44]!==_||e[45]!==v||e[46]!==s||e[47]!==r||e[48]!==n?(N=s&&h.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:h.jsx(Sc,{children:h.jsx(qV,{table:n,column:o,onAddColumnChart:v,preview:_.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[43]=o,e[44]=_,e[45]=v,e[46]=s,e[47]=r,e[48]=n,e[49]=N):N=e[49],e[50]!==$||e[51]!==N?(H=h.jsxs(h.Fragment,{children:[$,N]}),e[50]=$,e[51]=N,e[52]=H):H=e[52],H};function jR(t){const{tooltipContent:e,content:n}=t;return h.jsx(Le,{content:e,delayDuration:100,children:h.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const ER=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(xR,{}),t[0]=e):e=t[0],e},IR=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},uf=T3("marimo:scratchpadHistory:v1",[]),AR=Qt(!1),TR=Qt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(uf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(uf,r)}),MR={hide_code:!1,disabled:!1},OR=()=>{const t=X.c(69),e=Cc(),[n]=Rs(),{theme:o}=Fo(),r=A.useRef(null),s=Bs(),{createNewCell:i,updateCellCode:a}=Ft(),l=e.cellRuntime[gr],c=l==null?void 0:l.output,d=l==null?void 0:l.status,u=l==null?void 0:l.consoleOutputs,f=e.cellData[gr],m=(f==null?void 0:f.code)??"",_=en(TR),[g,p]=fn(AR),b=We(uf);let x;t[0]!==_||t[1]!==m?(x=()=>{aS({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=x):x=t[2];const y=et(x);let v;t[3]!==m||t[4]!==i||t[5]!==s?(v=()=>{m.trim()&&i({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=i,t[5]=s,t[6]=v):v=t[6];const S=et(v);let k;t[7]!==a?(k=()=>{a({cellId:gr,code:"",formattingChange:!1}),aS({code:""});const ae=r.current;ae&&ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const E=et(k);let j;t[9]!==p||t[10]!==a?(j=ae=>{p(!1),a({cellId:gr,code:ae,formattingChange:!1});const Se=r.current;Se&&Se.dispatch({changes:{from:0,to:Se.state.doc.length,insert:ae}})},t[9]=p,t[10]=a,t[11]=j):j=t[11];const I=et(j),[T,M]=A.useState();let L;t[12]!==m||t[13]!==u||t[14]!==y||t[15]!==T||t[16]!==c||t[17]!==o||t[18]!==n?(L=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:h.jsx(Uu,{theme:o,allowFocus:!1,showPlaceholder:!1,id:gr,code:m,config:MR,status:"idle",serializedEditorState:null,runCell:y,userConfig:n,editorViewRef:r,setEditorView:ae=>{r.current=ae},hidden:!1,temporarilyShowCode:En.NOOP,languageAdapter:T,setLanguageAdapter:M})}),h.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:h.jsx(Lc,{allowExpand:!1,output:c,className:"output-area",cellId:gr,stale:!1,loading:!1})}),h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:h.jsx(tp,{consoleOutputs:u,className:"overflow-auto",stale:!1,cellName:JV,onSubmitDebugger:En.NOOP,cellId:gr,debuggerActive:!1})})]}),t[12]=m,t[13]=u,t[14]=y,t[15]=T,t[16]=c,t[17]=o,t[18]=n,t[19]=L):L=t[19];const B=L;let O;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(O=()=>g?h.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:h.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ae,Se)=>h.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ae),children:h.jsx(ba,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ae.trim(),editable:!1,readOnly:!0})},Se))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=O):O=t[24];const z=O;let F,V,P,C,$,N,H,Y,Z,q,re;t[25]===Symbol.for("react.memo_cache_sentinel")?(F=zs.create(gr),V=h.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=F,t[26]=V):(F=t[25],V=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(P=mn("cell.run"),t[27]=P):P=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(ei,{color:"var(--grass-11)",size:16}),t[28]=C):C=t[28],t[29]!==y||t[30]!==g?($=h.jsx(Le,{content:P,children:h.jsx(Pe,{"data-testid":"scratchpad-run-button",onClick:y,disabled:g,variant:"text",size:"xs",children:C})}),t[29]=y,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx(pp,{size:16}),t[32]=N):N=t[32],t[33]!==E||t[34]!==g?(H=h.jsx(Le,{content:"Clear code and outputs",children:h.jsx(Pe,{disabled:g,size:"xs",variant:"text",onClick:E,children:N})}),t[33]=E,t[34]=g,t[35]=H):H=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=h.jsx(ni,{size:16}),t[36]=Y):Y=t[36],t[37]!==S||t[38]!==g?(Z=h.jsx(si,{children:h.jsx(Le,{content:"Insert code",children:h.jsx(Pe,{disabled:g,size:"xs",variant:"text",onClick:S,children:Y})})}),t[37]=S,t[38]=g,t[39]=Z):Z=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&h.jsx(eo,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(re=h.jsx("div",{className:"flex-1"}),t[42]=re):re=t[42];const ne=g&&"bg-[var(--sky-3)] rounded-none";let oe,G;t[43]!==ne?(oe=Oe(ne),t[43]=ne,t[44]=oe):oe=t[44],t[45]!==g||t[46]!==p?(G=()=>p(!g),t[45]=g,t[46]=p,t[47]=G):G=t[47];const Q=b.length===0;let ce,me,de,ge,ie,xe,we;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ce=h.jsx(vp,{size:16}),t[48]=ce):ce=t[48],t[49]!==oe||t[50]!==G||t[51]!==Q?(me=h.jsx(Le,{content:"Toggle history",children:h.jsx(Pe,{size:"xs",variant:"text",className:oe,onClick:G,disabled:Q,children:ce})}),t[49]=oe,t[50]=G,t[51]=Q,t[52]=me):me=t[52],t[53]!==$||t[54]!==H||t[55]!==Z||t[56]!==q||t[57]!==me?(de=h.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,H,Z,q,re,me]}),t[53]=$,t[54]=H,t[55]=Z,t[56]=q,t[57]=me,t[58]=de):de=t[58],t[59]!==B?(ge=B(),t[59]=B,t[60]=ge):ge=t[60],t[61]!==z?(ie=z(),t[61]=z,t[62]=ie):ie=t[62],t[63]!==ge||t[64]!==ie?(xe=h.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ge,ie]}),t[63]=ge,t[64]=ie,t[65]=xe):xe=t[65],t[66]!==de||t[67]!==xe?(we=h.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:F,children:[V,de,xe]}),t[66]=de,t[67]=xe,t[68]=we):we=t[68],we},DR=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(OR,{}),t[0]=e):e=t[0],e},P2=(t,e)=>{lt(e?{title:"Failed to add package",description:e,variant:"danger"}:{title:"Package added",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(ca,{className:"inline",children:t})," and its dependencies has been added to your environment."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},L2=(t,e)=>{lt(e?{title:"Failed to upgrade package",description:e,variant:"danger"}:{title:"Package upgraded",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(ca,{className:"inline",children:t})," has been upgraded."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},F2=(t,e)=>{lt(e?{title:"Failed to remove package",description:e,variant:"danger"}:{title:"Package removed",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(ca,{className:"inline",children:t})," has been removed from your environment."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},z2=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(eo,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=Oe("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=$n.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=h.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},RR=()=>{const t=X.c(16),[e]=Rs(),n=e.package_management.manager;let o;t[0]!==n?(o=[n],t[0]=n,t[1]=o):o=t[1];const{data:r,loading:s,error:i,reload:a}=Hn(BR,o);if(s&&!r){let m;return t[2]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(eo,{size:"medium",centered:!0}),t[2]=m):m=t[2],m}if(i){let m;return t[3]!==i?(m=h.jsx(Zs,{error:i}),t[3]=i,t[4]=m):m=t[4],m}let l;t[5]!==(r==null?void 0:r.packages)?(l=(r==null?void 0:r.packages)||[],t[5]=r==null?void 0:r.packages,t[6]=l):l=t[6];const c=l;let d,u,f;return t[7]!==n||t[8]!==a?(d=h.jsx(PR,{packageManager:n,onSuccess:a}),t[7]=n,t[8]=a,t[9]=d):d=t[9],t[10]!==c||t[11]!==a?(u=h.jsx(LR,{packages:c,onSuccess:a}),t[10]=c,t[11]=a,t[12]=u):u=t[12],t[13]!==d||t[14]!==u?(f=h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d,u]}),t[13]=d,t[14]=u,t[15]=f):f=t[15],f},PR=({onSuccess:t,packageManager:e})=>{const[n,o]=K.useState(""),[r,s]=K.useState(!1),{handleClick:i}=wa(),a=We(lS),l=en(lS);K.useEffect(()=>{a&&(o(a),l(null))},[a,l]);const c=async()=>{try{s(!0);const d=n.split(",").map(u=>u.trim());for(const[u,f]of d.entries()){const m=await cS({package:f});m.success?P2(f):P2(f,m.error),u<d.length-1&&await new Promise(_=>setTimeout(_,1e3))}t()}finally{o(""),s(!1)}};return h.jsxs("div",{className:"flex items-center w-full border-b",children:[h.jsx(q4,{placeholder:`Install packages with ${e}...`,id:K1,icon:r?h.jsx(eo,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):h.jsx(Le,{content:"Change package manager",children:h.jsx(ya,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),rootClassName:"flex-1 border-none",value:n,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),c())},onChange:d=>o(d.target.value)}),h.jsx(Le,{delayDuration:300,side:"left",align:"start",content:h.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",h.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",h.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",h.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",h.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",h.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",h.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:h.jsx($m,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),h.jsx("button",{type:"button",className:Oe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",n&&"bg-accent text-accent-foreground","disabled:cursor-not-allowed disabled:opacity-50"),onClick:c,disabled:!n,children:"Add"})]})},LR=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(An,{title:"No packages",description:"No packages are installed in this environment.",icon:h.jsx(ya,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Jm,{children:h.jsxs(Xs,{children:[h.jsx(zr,{children:"Name"}),h.jsx(zr,{children:"Version"}),h.jsx(zr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>h.jsxs(Xs,{className:"group",onClick:async()=>{await yn(`${l.name}==${l.version}`),lt({title:"Copied to clipboard"})},children:[h.jsx(Br,{children:l.name}),h.jsx(Br,{children:l.version}),h.jsxs(Br,{className:"flex justify-end",children:[h.jsx(FR,{packageName:l.name,onSuccess:n}),h.jsx(zR,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=h.jsxs(Ym,{className:"overflow-auto flex-1",children:[r,h.jsx(Km,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},FR=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return Un()?null:h.jsx(z2,{onClick:async()=>{try{o(!0);const r=await cS({package:t,upgrade:!0});r.success?(e(),L2(t)):L2(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},zR=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return h.jsx(z2,{onClick:async()=>{try{o(!0);const r=await XV({package:t});r.success?(e(),F2(t)):F2(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})};function BR(){return KV()}var hf="ScrollArea",[B2,cH]=_4(hf),[UR,Fn]=B2(hf),U2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=A.useState(null),[c,d]=A.useState(null),[u,f]=A.useState(null),[m,_]=A.useState(null),[g,p]=A.useState(null),[b,x]=A.useState(0),[y,v]=A.useState(0),[S,k]=A.useState(!1),[E,j]=A.useState(!1),I=Qs(e,M=>l(M)),T=ZV(r);return h.jsx(UR,{scope:n,type:o,dir:T,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:u,onContentChange:f,scrollbarX:m,onScrollbarXChange:_,scrollbarXEnabled:S,onScrollbarXEnabledChange:k,scrollbarY:g,onScrollbarYChange:p,scrollbarYEnabled:E,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:v,children:h.jsx(qs.div,{dir:T,...i,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})})});U2.displayName=hf;var V2="ScrollAreaViewport",$2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=Fn(V2,n),a=A.useRef(null),l=Qs(e,a,i.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(qs.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:h.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});$2.displayName=V2;var ao="ScrollAreaScrollbar",ff=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Fn(ao,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return A.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?h.jsx(VR,{...o,ref:e,forceMount:n}):r.type==="scroll"?h.jsx($R,{...o,ref:e,forceMount:n}):r.type==="auto"?h.jsx(H2,{...o,ref:e,forceMount:n}):r.type==="always"?h.jsx(mf,{...o,ref:e}):null});ff.displayName=ao;var VR=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Fn(ao,t.__scopeScrollArea),[s,i]=A.useState(!1);return A.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),h.jsx(Vc,{present:n||s,children:h.jsx(H2,{"data-state":s?"visible":"hidden",...o,ref:e})})}),$R=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Fn(ao,t.__scopeScrollArea),s=t.orientation==="horizontal",i=ql(()=>l("SCROLL_END"),100),[a,l]=function(c,d){return A.useReducer((u,f)=>d[u][f]??u,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return A.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),A.useEffect(()=>{const c=r.viewport,d=s?"scrollLeft":"scrollTop";if(c){let u=c[d];const f=()=>{const m=c[d];u!==m&&(l("SCROLL"),i()),u=m};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),h.jsx(Vc,{present:n||a!=="hidden",children:h.jsx(mf,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:qn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:qn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),H2=A.forwardRef((t,e)=>{const n=Fn(ao,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=A.useState(!1),a=t.orientation==="horizontal",l=ql(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:d)}},10);return _s(n.viewport,l),_s(n.content,l),h.jsx(Vc,{present:o||s,children:h.jsx(mf,{"data-state":s?"visible":"hidden",...r,ref:e})})}),mf=A.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=Fn(ao,t.__scopeScrollArea),s=A.useRef(null),i=A.useRef(0),[a,l]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=J2(a.viewport,a.content),d={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function u(f,m){return function(_,g,p,b="ltr"){const x=Wl(p),y=x/2,v=g||y,S=x-v,k=p.scrollbar.paddingStart+v,E=p.scrollbar.size-p.scrollbar.paddingEnd-S,j=p.content-p.viewport,I=b==="ltr"?[0,j]:[-1*j,0];return X2([k,E],I)(_)}(f,i.current,a,m)}return n==="horizontal"?h.jsx(HR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=K2(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=u(f,r.dir))}}):n==="vertical"?h.jsx(WR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=K2(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=u(f))}}):null}),HR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Fn(ao,t.__scopeScrollArea),[i,a]=A.useState(),l=A.useRef(null),c=Qs(e,l,s.onScrollbarXChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(q2,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,u)=>{if(s.viewport){const f=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),Z2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Hl(i.paddingLeft),paddingEnd:Hl(i.paddingRight)}})}})}),WR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Fn(ao,t.__scopeScrollArea),[i,a]=A.useState(),l=A.useRef(null),c=Qs(e,l,s.onScrollbarYChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(q2,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,u)=>{if(s.viewport){const f=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),Z2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Hl(i.paddingTop),paddingEnd:Hl(i.paddingBottom)}})}})}),[qR,W2]=B2(ao),q2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:u,...f}=t,m=Fn(ao,n),[_,g]=A.useState(null),p=Qs(e,I=>g(I)),b=A.useRef(null),x=A.useRef(""),y=m.viewport,v=o.content-o.viewport,S=fr(d),k=fr(l),E=ql(u,10);function j(I){if(b.current){const T=I.clientX-b.current.left,M=I.clientY-b.current.top;c({x:T,y:M})}}return A.useEffect(()=>{const I=T=>{const M=T.target;(_==null?void 0:_.contains(M))&&S(T,v)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[y,_,v,S]),A.useEffect(k,[o,k]),_s(_,E),_s(m.content,E),h.jsx(qR,{scope:n,scrollbar:_,hasThumb:r,onThumbChange:fr(s),onThumbPointerUp:fr(i),onThumbPositionChange:k,onThumbPointerDown:fr(a),children:h.jsx(qs.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:qn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),b.current=_.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),j(I))}),onPointerMove:qn(t.onPointerMove,j),onPointerUp:qn(t.onPointerUp,I=>{const T=I.target;T.hasPointerCapture(I.pointerId)&&T.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=x.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),$l="ScrollAreaThumb",G2=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=W2($l,t.__scopeScrollArea);return h.jsx(Vc,{present:n||r.hasThumb,children:h.jsx(GR,{ref:e,...o})})}),GR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=Fn($l,n),i=W2($l,n),{onThumbPositionChange:a}=i,l=Qs(e,u=>i.onThumbChange(u)),c=A.useRef(void 0),d=ql(()=>{c.current&&(c.current(),c.current=void 0)},100);return A.useEffect(()=>{const u=s.viewport;if(u){const f=()=>{if(d(),!c.current){const m=JR(u,a);c.current=m,a()}};return a(),u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,d,a]),h.jsx(qs.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:qn(t.onPointerDownCapture,u=>{const f=u.target.getBoundingClientRect(),m=u.clientX-f.left,_=u.clientY-f.top;i.onThumbPointerDown({x:m,y:_})}),onPointerUp:qn(t.onPointerUp,i.onThumbPointerUp)})});G2.displayName=$l;var pf="ScrollAreaCorner",Y2=A.forwardRef((t,e)=>{const n=Fn(pf,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?h.jsx(YR,{...t,ref:e}):null});Y2.displayName=pf;var YR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=Fn(pf,n),[s,i]=A.useState(0),[a,l]=A.useState(0),c=!!(s&&a);return _s(r.scrollbarX,()=>{var u;const d=((u=r.scrollbarX)==null?void 0:u.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),_s(r.scrollbarY,()=>{var u;const d=((u=r.scrollbarY)==null?void 0:u.offsetWidth)||0;r.onCornerWidthChange(d),i(d)}),c?h.jsx(qs.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Hl(t){return t?parseInt(t,10):0}function J2(t,e){const n=t/e;return isNaN(n)?0:n}function Wl(t){const e=J2(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function K2(t,e,n="ltr"){const o=Wl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=e$(t,n==="ltr"?[0,i]:[-1*i,0]);return X2([0,i],[0,a])(l)}function X2(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function Z2(t,e){return t>0&&t<e}var JR=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function ql(t,e){const n=fr(t),o=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(o.current),[]),A.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function _s(t,e){const n=fr(e);QV(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var Q2=U2,KR=$2,XR=Y2;const ek=A.forwardRef((t,e)=>{const n=X.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Oe("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=h.jsx(KR,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(tk,{}),c=h.jsx(XR,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(d=h.jsxs(Q2,{ref:e,className:i,...s,children:[a,l,c]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=d):d=n[14],d});ek.displayName=Q2.displayName;const tk=A.forwardRef((t,e)=>{const n=X.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let c,d,u;return n[4]!==o||n[5]!==a||n[6]!==l?(c=Oe("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(G2,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==c?(u=h.jsx(ff,{ref:e,orientation:i,className:c,...r,children:d}),n[9]=i,n[10]=r,n[11]=e,n[12]=c,n[13]=u):u=n[13],u});tk.displayName=ff.displayName;const ZR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eP={};function nk(t,e){return(eP.jsx?QR:ZR).test(t)}const tP=/[ \t\n\f\r]/g;function ok(t){return t.replace(tP,"")===""}class Wi{constructor(e,n,o){this.property=e,this.normal=n,o&&(this.space=o)}}function rk(t,e){const n={},o={};let r=-1;for(;++r<t.length;)Object.assign(n,t[r].property),Object.assign(o,t[r].normal);return new Wi(n,o,e)}function gf(t){return t.toLowerCase()}Wi.prototype.property={},Wi.prototype.normal={},Wi.prototype.space=null;class zn{constructor(e,n){this.property=e,this.attribute=n}}zn.prototype.space=null,zn.prototype.boolean=!1,zn.prototype.booleanish=!1,zn.prototype.overloadedBoolean=!1,zn.prototype.number=!1,zn.prototype.commaSeparated=!1,zn.prototype.spaceSeparated=!1,zn.prototype.commaOrSpaceSeparated=!1,zn.prototype.mustUseProperty=!1,zn.prototype.defined=!1;let nP=0;const tt=Mr(),Pt=Mr(),sk=Mr(),ye=Mr(),_t=Mr(),bs=Mr(),vn=Mr();function Mr(){return 2**++nP}const _f=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:Pt,commaOrSpaceSeparated:vn,commaSeparated:bs,number:ye,overloadedBoolean:sk,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),bf=Object.keys(_f);class yf extends zn{constructor(e,n,o,r){let s=-1;if(super(e,n),ik(this,"space",r),typeof o=="number")for(;++s<bf.length;){const i=bf[s];ik(this,bf[s],(o&_f[i])===_f[i])}}}function ik(t,e,n){n&&(t[e]=n)}yf.prototype.defined=!0;const oP={}.hasOwnProperty;function ys(t){const e={},n={};let o;for(o in t.properties)if(oP.call(t.properties,o)){const r=t.properties[o],s=new yf(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[gf(o)]=o,n[gf(s.attribute)]=o}return new Wi(e,n,t.space)}const ak=ys({space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),lk=ys({space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function ck(t,e){return e in t?t[e]:e}function dk(t,e){return ck(t,e.toLowerCase())}const uk=ys({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:dk,properties:{xmlns:null,xmlnsXLink:null}}),hk=ys({transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:_t,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:ye,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:_t,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:Pt,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null}}),rP=ys({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:dk,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:bs,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:_t,autoFocus:tt,autoPlay:tt,blocking:_t,capture:null,charSet:null,checked:tt,cite:null,className:_t,cols:ye,colSpan:null,content:null,contentEditable:Pt,controls:tt,controlsList:_t,coords:ye|bs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:sk,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:_t,height:ye,hidden:tt,high:ye,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:_t,itemRef:_t,itemScope:tt,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:tt,optimum:ye,pattern:null,ping:_t,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:_t,required:tt,reversed:tt,rows:ye,rowSpan:ye,sandbox:_t,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:Pt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:ye,security:null,unselectable:null}}),sP=ys({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:ck,properties:{about:vn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:bs,g2:bs,glyphName:bs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vn,rev:vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vn,requiredFeatures:vn,requiredFonts:vn,requiredFormats:vn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),iP=/^data[-\w.:]+$/i,fk=/-[a-z]/g,aP=/[A-Z]/g;function lP(t){return"-"+t.toLowerCase()}function cP(t){return t.charAt(1).toUpperCase()}const dP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uP=rk([lk,ak,uk,hk,rP],"html"),xf=rk([lk,ak,uk,hk,sP],"svg"),mk=dS(t$()),hP=mk.default||mk,pk=gk("end"),wf=gk("start");function gk(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function qi(t){return t&&typeof t=="object"?"position"in t||"type"in t?_k(t.position):"start"in t||"end"in t?_k(t):"line"in t||"column"in t?vf(t):"":""}function vf(t){return bk(t&&t.line)+":"+bk(t&&t.column)}function _k(t){return vf(t&&t.start)+"-"+vf(t&&t.end)}function bk(t){return t&&typeof t=="number"?t:1}class on extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=qi(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}on.prototype.file="",on.prototype.name="",on.prototype.reason="",on.prototype.message="",on.prototype.stack="",on.prototype.column=void 0,on.prototype.line=void 0,on.prototype.ancestors=void 0,on.prototype.cause=void 0,on.prototype.fatal=void 0,on.prototype.place=void 0,on.prototype.ruleId=void 0,on.prototype.source=void 0;const kf={}.hasOwnProperty,fP=new Map,mP=/[A-Z]/g,pP=/-([a-z])/g,gP=new Set(["table","tbody","thead","tfoot","tr"]),_P=new Set(["td","th"]),yk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bP(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(c,d,u,f){const m=Array.isArray(u.children),_=wf(c);return a(d,u,f,m,{columnNumber:_?_.column-1:void 0,fileName:i,lineNumber:_?_.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return c;function c(d,u,f,m){const _=Array.isArray(f.children)?l:a;return m?_(u,f,m):_(u,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?xf:uP,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=xk(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function xk(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=xf,o.schema=a),o.ancestors.push(r);const l=vk(o,r.tagName,!1),c=function(u,f){const m={};let _,g;for(g in f.properties)if(g!=="children"&&kf.call(f.properties,g)){const p=yP(u,g,f.properties[g]);if(p){const[b,x]=p;u.tableCellAlignToStyle&&b==="align"&&typeof x=="string"&&_P.has(f.tagName)?_=x:m[b]=x}}return _&&((m.style||(m.style={}))[u.stylePropertyNameCase==="css"?"text-align":"textAlign"]=_),m}(o,r);let d=Cf(o,r);return gP.has(r.tagName)&&(d=d.filter(function(u){return typeof u!="string"||!(typeof(f=u)=="object"?f.type==="text"&&ok(f.value):ok(f));var f})),wk(o,c,l,r),Sf(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}Gi(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=xf,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:vk(o,r.name,!0),c=function(u,f){const m={};for(const _ of f.attributes)if(_.type==="mdxJsxExpressionAttribute")if(_.data&&_.data.estree&&u.evaluater){const g=_.data.estree.body[0];g.type;const p=g.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,u.evaluater.evaluateExpression(b.argument))}else Gi(u,f.position);else{const g=_.name;let p;if(_.value&&typeof _.value=="object")if(_.value.data&&_.value.data.estree&&u.evaluater){const b=_.value.data.estree.body[0];b.type,p=u.evaluater.evaluateExpression(b.expression)}else Gi(u,f.position);else p=_.value===null||_.value;m[g]=p}return m}(o,r),d=Cf(o,r);return wk(o,c,l,r),Sf(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);Gi(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return Sf(i,Cf(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function wk(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function Sf(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Cf(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:fP;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=r.get(l)||0;i=l+"-"+c,r.set(l,c+1)}}const a=xk(t,s,i);a!==void 0&&n.push(a)}return n}function yP(t,e,n){const o=function(r,s){const i=gf(s);let a=s,l=zn;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&iP.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(fk,cP);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!fk.test(c)){let d=c.replace(aP,lP);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}l=yf}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){const a={};try{hP(i,l)}catch(c){if(!s.ignoreInvalidStyle){const d=c,u=new on("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:d,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw u.file=s.filePath||void 0,u.url=yk+"#cannot-parse-style-attribute",u}}return a;function l(c,d){let u=c;u.slice(0,2)!=="--"&&(u.slice(0,4)==="-ms-"&&(u="ms-"+u.slice(4)),u=u.replace(pP,wP)),a[u]=d}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)kf.call(s,a)&&(i[xP(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?dP[o.property]||o.property:o.attribute,n]}}function vk(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=nk(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=nk(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return kf.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);Gi(t)}function Gi(t,e){const n=new on("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=yk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function xP(t){let e=t.replace(mP,vP);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function wP(t,e){return e.toUpperCase()}function vP(t){return"-"+t.toLowerCase()}const Nf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Gl={};function kk(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Sk(t.children,e,n)}return Array.isArray(t)?Sk(t,e,n):""}function Sk(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=kk(t[r],e,n);return o.join("")}const Ck=document.createElement("i");function jf(t){const e="&"+t+";";Ck.innerHTML=e;const n=Ck.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function lo(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function Bn(t,e){return t.length>0?(lo(t,t.length,0,e),t):e}const Nk={}.hasOwnProperty;function kP(t,e){let n;for(n in e){const o=(Nk.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){Nk.call(o,s)||(o[s]=[]);const i=r[s];SP(o[s],Array.isArray(i)?i:i?[i]:[])}}}function SP(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);lo(t,0,0,o)}function jk(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function xs(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const co=sr(/[A-Za-z]/),kn=sr(/[\dA-Za-z]/),CP=sr(/[#-'*+\--9=?A-Z^-~]/);function Ef(t){return t!==null&&(t<32||t===127)}const If=sr(/\d/),NP=sr(/[\dA-Fa-f]/),jP=sr(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function _n(t){return t!==null&&(t<0||t===32)}function ht(t){return t===-2||t===-1||t===32}const EP=sr(new RegExp("\\p{P}|\\p{S}","u")),IP=sr(/\s/);function sr(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function ws(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&kn(t.charCodeAt(n+1))&&kn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function bt(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return ht(a)?(t.enter(n),i(a)):e(a)};function i(a){return ht(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const AP={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),bt(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Ze(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},TP={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(y){if(i<n.length){const v=n[i];return e.containerState=v[1],t.attempt(v[0].continuation,l,c)(y)}return c(y)}function l(y){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&x();const v=e.events.length;let S,k=v;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){S=e.events[k][1].end;break}b(i);let E=v;for(;E<e.events.length;)e.events[E][1].end={...S},E++;return lo(e.events,k+1,0,e.events.slice(v)),e.events.length=E,c(y)}return a(y)}function c(y){if(i===n.length){if(!o)return f(y);if(o.currentConstruct&&o.currentConstruct.concrete)return _(y);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Ek,d,u)(y)}function d(y){return o&&x(),b(i),f(y)}function u(y){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,_(y)}function f(y){return e.containerState={},t.attempt(Ek,m,_)(y)}function m(y){return i++,n.push([e.currentConstruct,e.containerState]),f(y)}function _(y){return y===null?(o&&x(),b(0),void t.consume(y)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(y))}function g(y){return y===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(y)):Ze(y)?(t.consume(y),p(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(y),g)}function p(y,v){const S=e.sliceStream(y);if(v&&S.push(null),y.previous=r,r&&(r.next=y),r=y,o.defineSkip(y.start),o.write(S),e.parser.lazy[y.start.line]){let k=o.events.length;for(;k--;)if(o.events[k][1].start.offset<s&&(!o.events[k][1].end||o.events[k][1].end.offset>s))return;const E=e.events.length;let j,I,T=E;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(j){I=e.events[T][1].end;break}j=!0}for(b(i),k=E;k<e.events.length;)e.events[k][1].end={...I},k++;lo(e.events,T+1,0,e.events.slice(E)),e.events.length=k}}function b(y){let v=n.length;for(;v-- >y;){const S=n[v];e.containerState=S[1],S[0].exit.call(e,t)}n.length=y}function x(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Ek={tokenize:function(t,e,n){return bt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Ik(t){return t===null||_n(t)||IP(t)?1:EP(t)?2:void 0}function Af(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const Tf={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,c,d=-1;for(;++d<t.length;)if(t[d][0]==="enter"&&t[d][1].type==="attentionSequence"&&t[d][1]._close){for(n=d;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[d][1]).charCodeAt(0)){if((t[n][1]._close||t[d][1]._open)&&(t[d][1].end.offset-t[d][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[d][1].end.offset-t[d][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[d][1].end.offset-t[d][1].start.offset>1?2:1;const u={...t[n][1].end},f={...t[d][1].start};Ak(u,-a),Ak(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[d][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[d][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[d][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=Bn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=Bn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=Bn(l,Af(e.parser.constructs.insideSpan.null,t.slice(n+1,d),e)),l=Bn(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[d][1].end.offset-t[d][1].start.offset?(c=2,l=Bn(l,[["enter",t[d][1],e],["exit",t[d][1],e]])):c=0,lo(t,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<t.length;)t[d][1].type==="attentionSequence"&&(t[d][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=Ik(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),c=Ik(a),d=!c||c===2&&r||n.includes(a),u=!r||r===2&&c||n.includes(o);return l._open=!!(s===42?d:d&&(r||!u)),l._close=!!(s===42?u:u&&(c||!d)),e(a)}}};function Ak(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const MP={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return co(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||kn(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||kn(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Ef(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):CP(f)?(t.consume(f),l):n(f)}function c(f){return kn(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):u(f)}function u(f){if((f===45||kn(f))&&o++<63){const m=f===45?u:d;return t.consume(f),m}return n(f)}}},Yl={partial:!0,tokenize:function(t,e,n){return function(r){return ht(r)?bt(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Ze(r)?e(r):n(r)}}},Tk={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return ht(s)?bt(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(Tk,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return ht(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},Mk={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return jP(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},Ok={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),a};function a(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=kn,c(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=NP,c):(t.enter("characterReferenceValue"),r=7,s=If,c(d))}function c(d){if(d===59&&i){const u=t.exit("characterReferenceValue");return s!==kn||jf(o.sliceSerialize(u))?(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(d)}return s(d)&&i++<r?(t.consume(d),c):n(d)}}},Dk={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},Rk={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(y,v,S){let k=0;return E;function E(L){return y.enter("lineEnding"),y.consume(L),y.exit("lineEnding"),j}function j(L){return y.enter("codeFencedFence"),ht(L)?bt(y,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):I(L)}function I(L){return L===s?(y.enter("codeFencedFenceSequence"),T(L)):S(L)}function T(L){return L===s?(k++,y.consume(L),T):k>=a?(y.exit("codeFencedFenceSequence"),ht(L)?bt(y,M,"whitespace")(L):M(L)):S(L)}function M(L){return L===null||Ze(L)?(y.exit("codeFencedFence"),v(L)):S(L)}}};let s,i=0,a=0;return function(y){return function(v){const S=o.events[o.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,s=v,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(v)}(y)};function l(y){return y===s?(a++,t.consume(y),l):a<3?n(y):(t.exit("codeFencedFenceSequence"),ht(y)?bt(t,c,"whitespace")(y):c(y))}function c(y){return y===null||Ze(y)?(t.exit("codeFencedFence"),o.interrupt?e(y):t.check(Dk,m,x)(y)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===null||Ze(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(y)):ht(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),bt(t,u,"whitespace")(y)):y===96&&y===s?n(y):(t.consume(y),d)}function u(y){return y===null||Ze(y)?c(y):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===null||Ze(y)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(y)):y===96&&y===s?n(y):(t.consume(y),f)}function m(y){return t.attempt(r,x,_)(y)}function _(y){return t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g}function g(y){return i>0&&ht(y)?bt(t,p,"linePrefix",i+1)(y):p(y)}function p(y){return y===null||Ze(y)?t.check(Dk,m,x)(y):(t.enter("codeFlowValue"),b(y))}function b(y){return y===null||Ze(y)?(t.exit("codeFlowValue"),p(y)):(t.consume(y),b)}function x(y){return t.exit("codeFenced"),e(y)}}},Mf={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),bt(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Ze(l)?t.attempt(OP,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Ze(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},OP={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Ze(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):bt(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Ze(i)?r(i):n(i)}}},DP={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(d){return t.enter("codeText"),t.enter("codeTextSequence"),i(d)};function i(d){return d===96?(t.consume(d),s++,i):(t.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),a):d===96?(r=t.enter("codeTextSequence"),o=0,c(d)):Ze(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Ze(d)?(t.exit("codeTextData"),a(d)):(t.consume(d),l)}function c(d){return d===96?(t.consume(d),o++,c):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(r.type="codeTextData",l(d))}}};class RP{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&Yi(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Yi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Yi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Yi(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Yi(this.left,n.reverse())}}}function Yi(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Pk(t){const e={};let n,o,r,s,i,a,l,c=-1;const d=new RP(t);for(;++c<d.length;){for(;c in e;)c=e[c];if(n=d.get(c),c&&n[1].type==="chunkFlow"&&d.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,PP(d,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--&&(s=d.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);o&&(n[1].end={...d.get(o)[1].start},i=d.slice(o,c),i.unshift(n),d.splice(o,c-o+1,i))}}return lo(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function PP(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[],i=n._tokenizer||o.parser[n.contentType](n.start),a=i.events,l=[],c={};let d,u,f=-1,m=n,_=0,g=0;const p=[g];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(d=o.sliceStream(m),m.next||d.push(null),u&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),u=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,p.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=a.slice(p[f],p[f+1]),x=s.pop();l.push([x,x+b.length-1]),t.splice(x,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[_+l[f][0]]=_+l[f][1],_+=l[f][1]-l[f][0]-1;return c}const LP={resolve:function(t){return Pk(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Ze(i)?t.check(FP,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},FP={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),bt(t,r,"linePrefix")};function r(s){if(s===null||Ze(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function Lk(t,e,n,o,r,s,i,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),u):p===null||p===32||p===41||Ef(p)?n(p):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(p))};function u(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(a),u(p)):p===null||p===60||Ze(p)?n(p):(t.consume(p),p===92?m:f)}function m(p){return p===60||p===62||p===92?(t.consume(p),f):f(p)}function _(p){return d||p!==null&&p!==41&&!_n(p)?d<c&&p===40?(t.consume(p),d++,_):p===41?(t.consume(p),d--,_):p===null||p===32||p===40||Ef(p)?n(p):(t.consume(p),p===92?g:_):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(p))}function g(p){return p===40||p===41||p===92?(t.consume(p),_):_(p)}}function Fk(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Ze(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Ze(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!ht(f)),f===92?u:d)}function u(f){return f===91||f===92||f===93?(t.consume(f),l++,d):d(f)}}function zk(t,e,n,o,r,s){let i;return function(u){return u===34||u===39||u===40?(t.enter(o),t.enter(r),t.consume(u),t.exit(r),i=u===40?41:u,a):n(u)};function a(u){return u===i?(t.enter(r),t.consume(u),t.exit(r),t.exit(o),e):(t.enter(s),l(u))}function l(u){return u===i?(t.exit(s),a(i)):u===null?n(u):Ze(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),bt(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(u))}function c(u){return u===i||u===null||Ze(u)?(t.exit("chunkString"),l(u)):(t.consume(u),u===92?d:c)}function d(u){return u===i||u===92?(t.consume(u),c):c(u)}}function Ji(t,e){let n;return function o(r){return Ze(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):ht(r)?bt(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const zP={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(u){return t.enter("definition"),function(f){return Fk.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(u)};function s(u){return r=xs(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),u===58?(t.enter("definitionMarker"),t.consume(u),t.exit("definitionMarker"),i):n(u)}function i(u){return _n(u)?Ji(t,a)(u):a(u)}function a(u){return Lk(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(u)}function l(u){return t.attempt(BP,c,c)(u)}function c(u){return ht(u)?bt(t,d,"whitespace")(u):d(u)}function d(u){return u===null||Ze(u)?(t.exit("definition"),o.parser.defined.push(r),e(u)):n(u)}}},BP={partial:!0,tokenize:function(t,e,n){return function(i){return _n(i)?Ji(t,o)(i):n(i)};function o(i){return zk(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return ht(i)?bt(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Ze(i)?e(i):n(i)}}},UP={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Ze(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},VP={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},lo(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||_n(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Ze(l)?(t.exit("atxHeading"),e(l)):ht(l)?bt(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||_n(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},$P=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Bk=["pre","script","style","textarea"],HP={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(N){return function(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),c}(N)};function c(N){return N===33?(t.consume(N),d):N===47?(t.consume(N),s=!0,m):N===63?(t.consume(N),r=3,o.interrupt?e:P):co(N)?(t.consume(N),i=String.fromCharCode(N),_):n(N)}function d(N){return N===45?(t.consume(N),r=2,u):N===91?(t.consume(N),r=5,a=0,f):co(N)?(t.consume(N),r=4,o.interrupt?e:P):n(N)}function u(N){return N===45?(t.consume(N),o.interrupt?e:P):n(N)}function f(N){return N==="CDATA[".charCodeAt(a++)?(t.consume(N),a===6?o.interrupt?e:T:f):n(N)}function m(N){return co(N)?(t.consume(N),i=String.fromCharCode(N),_):n(N)}function _(N){if(N===null||N===47||N===62||_n(N)){const H=N===47,Y=i.toLowerCase();return H||s||!Bk.includes(Y)?$P.includes(i.toLowerCase())?(r=6,H?(t.consume(N),g):o.interrupt?e(N):T(N)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(N):s?p(N):b(N)):(r=1,o.interrupt?e(N):T(N))}return N===45||kn(N)?(t.consume(N),i+=String.fromCharCode(N),_):n(N)}function g(N){return N===62?(t.consume(N),o.interrupt?e:T):n(N)}function p(N){return ht(N)?(t.consume(N),p):j(N)}function b(N){return N===47?(t.consume(N),j):N===58||N===95||co(N)?(t.consume(N),x):ht(N)?(t.consume(N),b):j(N)}function x(N){return N===45||N===46||N===58||N===95||kn(N)?(t.consume(N),x):y(N)}function y(N){return N===61?(t.consume(N),v):ht(N)?(t.consume(N),y):b(N)}function v(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(t.consume(N),l=N,S):ht(N)?(t.consume(N),v):k(N)}function S(N){return N===l?(t.consume(N),l=null,E):N===null||Ze(N)?n(N):(t.consume(N),S)}function k(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||_n(N)?y(N):(t.consume(N),k)}function E(N){return N===47||N===62||ht(N)?b(N):n(N)}function j(N){return N===62?(t.consume(N),I):n(N)}function I(N){return N===null||Ze(N)?T(N):ht(N)?(t.consume(N),I):n(N)}function T(N){return N===45&&r===2?(t.consume(N),O):N===60&&r===1?(t.consume(N),z):N===62&&r===4?(t.consume(N),C):N===63&&r===3?(t.consume(N),P):N===93&&r===5?(t.consume(N),V):!Ze(N)||r!==6&&r!==7?N===null||Ze(N)?(t.exit("htmlFlowData"),M(N)):(t.consume(N),T):(t.exit("htmlFlowData"),t.check(WP,$,M)(N))}function M(N){return t.check(qP,L,$)(N)}function L(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),B}function B(N){return N===null||Ze(N)?M(N):(t.enter("htmlFlowData"),T(N))}function O(N){return N===45?(t.consume(N),P):T(N)}function z(N){return N===47?(t.consume(N),i="",F):T(N)}function F(N){if(N===62){const H=i.toLowerCase();return Bk.includes(H)?(t.consume(N),C):T(N)}return co(N)&&i.length<8?(t.consume(N),i+=String.fromCharCode(N),F):T(N)}function V(N){return N===93?(t.consume(N),P):T(N)}function P(N){return N===62?(t.consume(N),C):N===45&&r===2?(t.consume(N),P):T(N)}function C(N){return N===null||Ze(N)?(t.exit("htmlFlowData"),$(N)):(t.consume(N),C)}function $(N){return t.exit("htmlFlow"),e(N)}}},WP={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Yl,e,n)}}},qP={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},GP={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(C){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(C),a};function a(C){return C===33?(t.consume(C),l):C===47?(t.consume(C),v):C===63?(t.consume(C),x):co(C)?(t.consume(C),E):n(C)}function l(C){return C===45?(t.consume(C),c):C===91?(t.consume(C),s=0,m):co(C)?(t.consume(C),b):n(C)}function c(C){return C===45?(t.consume(C),f):n(C)}function d(C){return C===null?n(C):C===45?(t.consume(C),u):Ze(C)?(i=d,F(C)):(t.consume(C),d)}function u(C){return C===45?(t.consume(C),f):d(C)}function f(C){return C===62?z(C):C===45?u(C):d(C)}function m(C){return C==="CDATA[".charCodeAt(s++)?(t.consume(C),s===6?_:m):n(C)}function _(C){return C===null?n(C):C===93?(t.consume(C),g):Ze(C)?(i=_,F(C)):(t.consume(C),_)}function g(C){return C===93?(t.consume(C),p):_(C)}function p(C){return C===62?z(C):C===93?(t.consume(C),p):_(C)}function b(C){return C===null||C===62?z(C):Ze(C)?(i=b,F(C)):(t.consume(C),b)}function x(C){return C===null?n(C):C===63?(t.consume(C),y):Ze(C)?(i=x,F(C)):(t.consume(C),x)}function y(C){return C===62?z(C):x(C)}function v(C){return co(C)?(t.consume(C),S):n(C)}function S(C){return C===45||kn(C)?(t.consume(C),S):k(C)}function k(C){return Ze(C)?(i=k,F(C)):ht(C)?(t.consume(C),k):z(C)}function E(C){return C===45||kn(C)?(t.consume(C),E):C===47||C===62||_n(C)?j(C):n(C)}function j(C){return C===47?(t.consume(C),z):C===58||C===95||co(C)?(t.consume(C),I):Ze(C)?(i=j,F(C)):ht(C)?(t.consume(C),j):z(C)}function I(C){return C===45||C===46||C===58||C===95||kn(C)?(t.consume(C),I):T(C)}function T(C){return C===61?(t.consume(C),M):Ze(C)?(i=T,F(C)):ht(C)?(t.consume(C),T):j(C)}function M(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),r=C,L):Ze(C)?(i=M,F(C)):ht(C)?(t.consume(C),M):(t.consume(C),B)}function L(C){return C===r?(t.consume(C),r=void 0,O):C===null?n(C):Ze(C)?(i=L,F(C)):(t.consume(C),L)}function B(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||_n(C)?j(C):(t.consume(C),B)}function O(C){return C===47||C===62||_n(C)?j(C):n(C)}function z(C){return C===62?(t.consume(C),t.exit("htmlTextData"),t.exit("htmlText"),e):n(C)}function F(C){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),V}function V(C){return ht(C)?bt(t,P,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):P(C)}function P(C){return t.enter("htmlTextData"),i(C)}}},Of={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&lo(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},d={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",c,e]],s=Bn(s,t.slice(o+1,o+a+3)),s=Bn(s,[["enter",d,e]]),s=Bn(s,Af(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=Bn(s,[["exit",d,e],t[r-2],t[r-1],["exit",c,e]]),s=Bn(s,t.slice(r+1)),s=Bn(s,[["exit",l,e]]),lo(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(u){return r?r._inactive?d(u):(s=o.parser.defined.includes(xs(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelEnd"),a):n(u)};function a(u){return u===40?t.attempt(YP,c,s?c:d)(u):u===91?t.attempt(JP,c,s?l:d)(u):s?c(u):d(u)}function l(u){return t.attempt(KP,c,d)(u)}function c(u){return e(u)}function d(u){return r._balanced=!0,n(u)}}},YP={tokenize:function(t,e,n){return function(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o};function o(d){return _n(d)?Ji(t,r)(d):r(d)}function r(d){return d===41?c(d):Lk(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return _n(d)?Ji(t,a)(d):c(d)}function i(d){return n(d)}function a(d){return d===34||d===39||d===40?zk(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return _n(d)?Ji(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}},JP={tokenize:function(t,e,n){const o=this;return function(i){return Fk.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(xs(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},KP={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},XP={name:"labelStartImage",resolveAll:Of.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},ZP={name:"labelStartLink",resolveAll:Of.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},Df={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),bt(t,e,"linePrefix")}}},Jl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Ze(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),ht(a)?bt(t,s,"whitespace")(a):s(a))}}},bn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(Yl,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,bt(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!ht(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(eL,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,bt(t,t.attempt(bn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const m=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:If(f)){if(o.containerState.type||(o.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Jl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return If(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(Yl,o.interrupt?n:c,t.attempt(QP,u,d))}function c(f){return o.containerState.initialBlankLine=!0,s++,u(f)}function d(f){return ht(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),u):n(f)}function u(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},QP={partial:!0,tokenize:function(t,e,n){const o=this;return bt(t,function(r){const s=o.events[o.events.length-1];return!ht(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},eL={partial:!0,tokenize:function(t,e,n){const o=this;return bt(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Uk={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(d){return t.enter("setextHeadingLineSequence"),s(d)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),ht(a)?bt(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Ze(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},tL={tokenize:function(t){const e=this,n=t.attempt(Yl,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,bt(t,t.attempt(this.parser.constructs.flow,o,t.attempt(LP,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},nL={resolveAll:$k()},oL=Vk("string"),rL=Vk("text");function Vk(t){return{resolveAll:$k(t==="text"?sL:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(c){return l(c)?r(c):i(c)}function i(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const d=o[c];let u=-1;if(d)for(;++u<d.length;){const f=d[u];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function $k(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function sL(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const c=r[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)s=!0,l++;else if(c!==-1){i++;break}}if(l){const c={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const iL={42:bn,43:bn,45:bn,48:bn,49:bn,50:bn,51:bn,52:bn,53:bn,54:bn,55:bn,56:bn,57:bn,62:Tk},aL={91:zP},lL={[-2]:Mf,[-1]:Mf,32:Mf},cL={35:VP,42:Jl,45:[Uk,Jl],60:HP,61:Uk,95:Jl,96:Rk,126:Rk},dL={38:Ok,92:Mk},uL={[-5]:Df,[-4]:Df,[-3]:Df,33:XP,38:Ok,42:Tf,60:[MP,GP],91:ZP,92:[UP,Mk],93:Of,95:Tf,96:DP},hL={null:[Tf,nL]},fL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:aL,disable:{null:[]},document:iL,flow:cL,flowInitial:lL,insideSpan:hL,string:dL,text:uL},Symbol.toStringTag,{value:"Module"}));function mL(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:p(function(y,v){b(y,v.from)}),check:p(g),consume:function(y){Ze(y)?(o.line++,o.column=1,o.offset+=y===-3?2:1,x()):y!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=y},enter:function(y,v){const S=v||{};return S.type=y,S.start=f(),c.events.push(["enter",S,c]),a.push(S),S},exit:function(y){const v=a.pop();return v.end=f(),c.events.push(["exit",v,c]),v},interrupt:p(g,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(y){r[y.line]=y.column,x()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(y,v){return function(S,k){let E=-1;const j=[];let I;for(;++E<S.length;){const T=S[E];let M;if(typeof T=="string")M=T;else switch(T){case-5:M="\r";break;case-4:M=`
@@ -141,4 +141,4 @@ ${t.stack}`:o}function ro(t,e){return t>>>=0,Qr().subarray(t/1,t/1+e)}function K
141
141
  subprocess.run("${T}")`}:{language:"python",code:`_${I} = """
142
142
  ${T}
143
143
  """`}:{language:"python",code:T}}(o,l);o==="sql"&&lr(a,s,i),s({code:j.code,before:!1,cellId:i??"__end__"})},e[3]=a,e[4]=s,e[5]=o,e[6]=i,e[7]=l,e[8]=f):f=e[8];const m=f;let _;e[9]!==l?(_=async()=>{await yn(l)},e[9]=l,e[10]=_):_=e[10];const g=_,p=r==="dark"?"dark":"light",b=o&&YL.has(o)?o:void 0;let x,y,v,S,k,E;return e[11]!==p||e[12]!==b||e[13]!==l?(x=h.jsx(ba,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:GL,value:l,onChange:c}),e[11]=p,e[12]=b,e[13]=l,e[14]=x):x=e[14],e[15]!==g?(y=h.jsx(KL,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(ni,{className:"ml-2 h-4 w-4"}),e[17]=v):v=e[17],e[18]!==m?(S=h.jsxs(Pe,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",v]}),e[18]=m,e[19]=S):S=e[19],e[20]!==S||e[21]!==y?(k=h.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[y,S]}),e[20]=S,e[21]=y,e[22]=k):k=e[22],e[23]!==k||e[24]!==x?(E=h.jsxs("div",{className:"relative",children:[x,k]}),e[23]=k,e[24]=x,e[25]=E):E=e[25],E},KL=t=>{const e=X.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=A.useState(!1);let i,a,l;e[3]!==r?(i=()=>{r&&setTimeout(()=>s(!1),1e3)},a=[r],e[3]=r,e[4]=i,e[5]=a):(i=e[4],a=e[5]),A.useEffect(i,a),e[6]!==n?(l=u=>{n==null||n(u),s(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let d;return e[8]!==o||e[9]!==l||e[10]!==c?(d=h.jsx(Pe,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},XL={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),h.jsx(JL,{code:t.trim(),language:n})]}):h.jsx("code",{className:e,children:t})}},m3=A.memo(t=>{const e=X.c(2),{content:n}=t;let o;return e[0]!==n?(o=h.jsx(WL,{components:XL,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[0]=n,e[1]=o):o=e[1],o},(t,e)=>t.content===e.content);m3.displayName="MemoizedMarkdownBlock";const Gf=A.memo(({content:t})=>{const e=A.useMemo(()=>{return n=t,n$.lexer(n).map(o=>o.raw);var n},[t]);return h.jsx(h.Fragment,{children:e.map((n,o)=>h.jsx(m3,{content:n},`markdown-block-${o}`))})});Gf.displayName="MarkdownRenderer";const Yf=(t,e,n,o,r)=>e?{...t,chats:t.chats.map(s=>s.id===e?{...s,messages:[...s.messages,{role:n,content:o,timestamp:Date.now(),parts:r}],updatedAt:Date.now()}:s)}:(Zt.warn("No active chat"),t),ZL=t=>{const e=X.c(13),{reasoning:n,index:o,isStreaming:r}=t,s=o===void 0?0:o,i=r!==void 0&&r,a=i?"reasoning":void 0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(pc,{className:"h-3 w-3"}),e[0]=l):l=e[0];const c=i?"Thinking":"View reasoning";let d,u,f,m;return e[1]!==n.length||e[2]!==c?(d=h.jsx(o$,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:h.jsxs("span",{className:"flex items-center gap-2",children:[l,c," (",n.length," ","chars)"]})}),e[1]=n.length,e[2]=c,e[3]=d):d=e[3],e[4]!==n?(u=h.jsx(r$,{className:"pb-2 px-2",children:h.jsx("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:h.jsx("div",{className:"pr-6",children:h.jsx(Gf,{content:n})})})}),e[4]=n,e[5]=u):u=e[5],e[6]!==d||e[7]!==u?(f=h.jsxs(s$,{value:"reasoning",className:"border-0",children:[d,u]}),e[6]=d,e[7]=u,e[8]=f):f=e[8],e[9]!==s||e[10]!==a||e[11]!==f?(m=h.jsx(i$,{type:"single",collapsible:!0,className:"w-full mb-2",value:a,children:f},s),e[9]=s,e[10]=a,e[11]=f,e[12]=m):m=e[12],m},QL=t=>{var y;const e=X.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,i=We(U4),{handleClick:a}=wa(),l=((y=i==null?void 0:i.open_ai)==null?void 0:y.model)||"gpt-4-turbo";let c,d,u,f,m,_,g,p,b,x;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Fr,{className:"h-4 w-4"}),e[0]=c):c=e[0],e[1]!==n?(d=h.jsx(Le,{content:"New chat",children:h.jsx(Pe,{variant:"text",size:"icon",onClick:n,children:c})}),e[1]=n,e[2]=d):d=e[2],e[3]!==a?(u=()=>a("ai"),e[3]=a,e[4]=u):u=e[4],e[5]!==l||e[6]!==u?(f=h.jsx(Pe,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:u,children:l}),e[5]=l,e[6]=u,e[7]=f):f=e[7],e[8]!==d||e[9]!==f?(m=h.jsxs("div",{className:"flex items-center gap-2",children:[d,f]}),e[8]=d,e[9]=f,e[10]=m):m=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Le,{content:"Previous chats",children:h.jsx(Js,{asChild:!0,children:h.jsx(Pe,{variant:"text",size:"icon",children:h.jsx(c$,{className:"h-4 w-4"})})})}),e[11]=_):_=e[11],e[12]!==s.length?(g=s.length===0&&h.jsx(An,{title:"No chats yet",description:"Start a new chat to get started",icon:h.jsx(pc,{})}),e[12]=s.length,e[13]=g):g=e[13],e[14]!==o||e[15]!==s||e[16]!==r){let v;e[18]!==o||e[19]!==r?(v=S=>h.jsxs("div",{className:Oe("p-3 rounded-md cursor-pointer hover:bg-accent",S.id===o&&"bg-accent"),onClick:()=>{r(S.id)},children:[h.jsx("div",{className:"font-medium",children:S.title}),h.jsx("div",{className:"text-sm text-muted-foreground",children:d$(S.updatedAt)})]},S.id),e[18]=o,e[19]=r,e[20]=v):v=e[20],p=s.map(v),e[14]=o,e[15]=s,e[16]=r,e[17]=p}else p=e[17];return e[21]!==g||e[22]!==p?(b=h.jsxs(Lr,{children:[_,h.jsx($s,{className:"w-[520px] p-0",align:"start",side:"right",children:h.jsx(ek,{className:"h-[500px] p-4",children:h.jsxs("div",{className:"space-y-4",children:[g,p]})})})]}),e[21]=g,e[22]=p,e[23]=b):b=e[23],e[24]!==m||e[25]!==b?(x=h.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0 items-center",children:[m,b]}),e[24]=m,e[25]=b,e[26]=x):x=e[26],x},p3=A.memo(t=>{var _;const e=X.c(17),{message:n,index:o,theme:r,onEdit:s,setChatState:i,chatState:a,isStreamingReasoning:l,totalMessages:c}=t,d=n.role==="user"?"justify-end":"justify-start";let u,f,m;return e[0]!==d?(u=Oe("flex group relative",d),e[0]=d,e[1]=u):u=e[1],e[2]!==a||e[3]!==o||e[4]!==l||e[5]!==n.content||e[6]!==n.id||e[7]!==n.parts||e[8]!==n.role||e[9]!==s||e[10]!==i||e[11]!==r||e[12]!==c?(f=n.role==="user"?h.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:h.jsx(Pc,{value:n.content,theme:r,placeholder:"Type your message...",onChange:nF,onSubmit:(g,p)=>{p.trim()&&(s(o,p),a.activeChatId&&i(b=>Yf(b,a.activeChatId,"user",p)))},onClose:oF},n.id)}):h.jsxs("div",{className:"w-[95%]",children:[h.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx(iS,{className:"h-3 w-3",value:n.content})}),(_=n.parts)==null?void 0:_.map((g,p)=>{switch(g.type){case"text":return h.jsx(Gf,{content:g.text});case"reasoning":return h.jsx(ZL,{reasoning:g.reasoning,index:p,isStreaming:o===c-1&&l});default:return null}})]}),e[2]=a,e[3]=o,e[4]=l,e[5]=n.content,e[6]=n.id,e[7]=n.parts,e[8]=n.role,e[9]=s,e[10]=i,e[11]=r,e[12]=c,e[13]=f):f=e[13],e[14]!==u||e[15]!==f?(m=h.jsx("div",{className:u,children:f}),e[14]=u,e[15]=f,e[16]=m):m=e[16],m});p3.displayName="ChatMessage";const g3=A.memo(t=>{var c,d;const e=X.c(8),{input:n,setInput:o,onSubmit:r,theme:s,inputRef:i}=t;let a,l;return e[0]!==((c=i.current)==null?void 0:c.editor)?(a=()=>{var u,f;return(f=(u=i.current)==null?void 0:u.editor)==null?void 0:f.blur()},e[0]=(d=i.current)==null?void 0:d.editor,e[1]=a):a=e[1],e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==s?(l=h.jsx("div",{className:"px-2 py-3 border-t relative flex-shrink-0 min-h-[80px]",children:h.jsx(Pc,{value:n,onChange:o,onSubmit:r,onClose:a,theme:s,placeholder:"Type your message..."})}),e[2]=n,e[3]=r,e[4]=o,e[5]=a,e[6]=s,e[7]=l):l=e[7],l});g3.displayName="ChatInput";const eF=()=>{const t=X.c(6),e=We(lc),{handleClick:n}=wa();if(!e){let r,s,i;return t[0]!==n?(r=h.jsx(Pe,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(pc,{}),t[2]=s):s=t[2],t[3]!==r?(i=h.jsx(An,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=i):i=t[4],i}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(tF,{}),t[5]=o):o=t[5],o},tF=()=>{const t=X.c(86),[e,n]=fn(ad),[o,r]=fn(HS),[s,i]=A.useState(""),a=A.useRef(null),l=A.useRef(null),c=A.useRef(null),d=A.useRef(null),{theme:u}=Fo(),f=Rm(),m=o==null?void 0:o.id;let _,g,p,b,x,y;t[0]!==o?(g=o?o.messages.map(rF):[],t[0]=o,t[1]=g):g=t[1],_=g,t[2]!==f?(p=f.getAiURL("chat").toString(),t[2]=f,t[3]=p):p=t[3],t[4]!==f?(b=f.headers(),t[4]=f,t[5]=b):b=t[5],t[6]!==n?(x=ze=>{n(Ne=>Yf(Ne,Ne.activeChatId,"assistant",ze.content,ze.parts))},t[6]=n,t[7]=x):x=t[7],t[8]!==m||t[9]!==_||t[10]!==p||t[11]!==b||t[12]!==x?(y={id:m,initialMessages:_,keepLastMessageOnError:!0,experimental_throttle:100,api:p,headers:b,experimental_prepareRequestBody:iF,onFinish:x,onError:aF,onResponse:lF},t[8]=m,t[9]=_,t[10]=p,t[11]=b,t[12]=x,t[13]=y):y=t[13];const{messages:v,input:S,setInput:k,setMessages:E,append:j,handleSubmit:I,error:T,status:M,reload:L,stop:B}=a$(y),O=M==="submitted"||M==="streaming",z=cF,F=O&&v.length>0&&z(v);let V,P,C;t[14]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{requestAnimationFrame(()=>{if(c.current){const ze=c.current;ze.scrollTop=ze.scrollHeight}})},t[14]=V):V=t[14],t[15]!==e.activeChatId?(P=[e.activeChatId],t[15]=e.activeChatId,t[16]=P):P=t[16],A.useEffect(V,P),t[17]!==j||t[18]!==n||t[19]!==k?(C=ze=>{const Ne={id:l$(),title:`${ze.slice(0,30)}...`,messages:[{role:"user",content:ze,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()};n(Ke=>({chats:[...Ke.chats,Ne],activeChatId:Ne.id})),k(""),j({role:"user",content:ze})},t[17]=j,t[18]=n,t[19]=k,t[20]=C):C=t[20];const $=C;let N;t[21]!==r||t[22]!==k?(N=()=>{r(null),k(""),i("")},t[21]=r,t[22]=k,t[23]=N):N=t[23];const H=N;let Y;t[24]!==j||t[25]!==E?(Y=(ze,Ne)=>{E(Ke=>Ke.slice(0,ze)),j({role:"user",content:Ne})},t[24]=j,t[25]=E,t[26]=Y):Y=t[26];const Z=Y;let q;t[27]!==e.activeChatId||t[28]!==I||t[29]!==n?(q=(ze,Ne)=>{Ne.trim()&&(I(ze),e.activeChatId&&n(Ke=>Yf(Ke,e.activeChatId,"user",Ne)))},t[27]=e.activeChatId,t[28]=I,t[29]=n,t[30]=q):q=t[30];const re=q;let ne;t[31]!==L?(ne=()=>{L()},t[31]=L,t[32]=ne):ne=t[32];const oe=ne;let G;t[33]!==$||t[34]!==s?(G=()=>{s.trim()&&$(s.trim())},t[33]=$,t[34]=s,t[35]=G):G=t[35];const Q=G;let ce;t[36]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>{var ze,Ne;return(Ne=(ze=a.current)==null?void 0:ze.editor)==null?void 0:Ne.blur()},t[36]=ce):ce=t[36];const me=ce,de=o==null?void 0:o.id;let ge,ie,xe,we,ae,Se,pe,Te,Re,He;if(t[37]!==e.chats||t[38]!==H||t[39]!==r||t[40]!==de?(ge=h.jsx(Vm,{children:h.jsx(QL,{onNewChat:H,activeChatId:de,setActiveChat:r,chats:e.chats})}),t[37]=e.chats,t[38]=H,t[39]=r,t[40]=de,t[41]=ge):ge=t[41],t[42]!==Q||t[43]!==v||t[44]!==s||t[45]!==u?(ie=(!v||v.length===0)&&h.jsx("div",{className:"flex rounded-md border px-1 bg-background",children:h.jsx(Pc,{value:s,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:me,onChange:i,onSubmit:Q},"new-thread-input")}),t[42]=Q,t[43]=v,t[44]=s,t[45]=u,t[46]=ie):ie=t[46],t[47]!==e||t[48]!==Z||t[49]!==F||t[50]!==v||t[51]!==n||t[52]!==u){let ze;t[54]!==e||t[55]!==Z||t[56]!==F||t[57]!==v.length||t[58]!==n||t[59]!==u?(ze=(Ne,Ke)=>h.jsx(p3,{message:Ne,index:Ke,theme:u,onEdit:Z,setChatState:n,chatState:e,isStreamingReasoning:F,totalMessages:v.length},Ke),t[54]=e,t[55]=Z,t[56]=F,t[57]=v.length,t[58]=n,t[59]=u,t[60]=ze):ze=t[60],xe=v.map(ze),t[47]=e,t[48]=Z,t[49]=F,t[50]=v,t[51]=n,t[52]=u,t[53]=xe}else xe=t[53];return t[61]!==O?(we=O&&h.jsx("div",{className:"flex justify-center py-4",children:h.jsx(Pm,{className:"h-4 w-4 animate-spin"})}),t[61]=O,t[62]=we):we=t[62],t[63]!==T||t[64]!==oe?(ae=T&&h.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[h.jsx(Zs,{error:T}),h.jsx(Pe,{variant:"outline",size:"sm",onClick:oe,children:"Retry"})]}),t[63]=T,t[64]=oe,t[65]=ae):ae=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(Se=h.jsx("div",{ref:d}),t[66]=Se):Se=t[66],t[67]!==ie||t[68]!==xe||t[69]!==we||t[70]!==ae?(pe=h.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:c,children:[ie,xe,we,ae,Se]}),t[67]=ie,t[68]=xe,t[69]=we,t[70]=ae,t[71]=pe):pe=t[71],t[72]!==O||t[73]!==B?(Te=O&&h.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:h.jsx(Pe,{variant:"linkDestructive",size:"sm",onClick:B,children:"Stop"})}),t[72]=O,t[73]=B,t[74]=Te):Te=t[74],t[75]!==re||t[76]!==S||t[77]!==v||t[78]!==k||t[79]!==u?(Re=v&&v.length>0&&h.jsx(g3,{input:S,setInput:k,onSubmit:re,theme:u,inputRef:l}),t[75]=re,t[76]=S,t[77]=v,t[78]=k,t[79]=u,t[80]=Re):Re=t[80],t[81]!==ge||t[82]!==pe||t[83]!==Te||t[84]!==Re?(He=h.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[ge,pe,Te,Re]}),t[81]=ge,t[82]=pe,t[83]=Te,t[84]=Re,t[85]=He):He=t[85],He};function nF(){}function oF(){}function rF(t){const{role:e,content:n,timestamp:o,parts:r}=t;return{role:e,content:n,id:o.toString(),parts:r}}function sF(t){return t.content}function iF(t){return{...t,...k4({input:t.messages.map(sF).join(`
144
- `)}),includeOtherCode:jc("")}}function aF(t){Zt.error("An error occurred:",t)}function lF(t){Zt.debug("Received HTTP response from server:",t)}function cF(t){if(t.length===0)return!1;const e=t.at(-1);if(!e||e.role!=="assistant"||!e.parts)return!1;const n=e.parts;return n.length===0?!1:n[n.length-1].type==="reasoning"}const dF=K.lazy(()=>Lm(()=>import("./tracing-fC96q6kX.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122]),import.meta.url).then(t=>({default:t.Tracing}))),uF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(K.Suspense,{fallback:h.jsx(hF,{}),children:h.jsx(dF,{})}),t[0]=e):e=t[0],e},hF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:h.jsx(eo,{})}),t[0]=e):e=t[0],e},fF=()=>{const t=X.c(25),{openModal:e,closeModal:n}=Vn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,loading:s,error:i,reload:a}=Hn(pF,o);let l;t[1]!==r?(l=r===void 0?[]:r,t[1]=r,t[2]=l):l=t[2];const c=l;let d;t[3]!==c?(d=c.filter(gF).map(_F),t[3]=c,t[4]=d):d=t[4];const u=d;if(s&&c.length===0){let y;return t[5]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(eo,{size:"medium",centered:!0}),t[5]=y):y=t[5],y}if(i){let y;return t[6]!==i?(y=h.jsx(Zs,{error:i}),t[6]=i,t[7]=y):y=t[7],y}if(c.length===0){let y;return t[8]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(An,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:h.jsx(Xc,{})}),t[8]=y):y=t[8],y}let f,m,_,g,p,b,x;return t[9]!==n||t[10]!==e||t[11]!==u||t[12]!==a?(f=()=>e(h.jsx(Cg,{providerNames:u,onSuccess:()=>{a(),n()},onClose:n})),t[9]=n,t[10]=e,t[11]=u,t[12]=a,t[13]=f):f=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Fr,{className:"h-4 w-4"}),t[14]=m):m=t[14],t[15]!==f?(_=h.jsx("div",{className:"flex justify-end h-8 border-b",children:h.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:f,children:m})}),t[15]=f,t[16]=_):_=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(Jm,{children:h.jsxs(Xs,{children:[h.jsx(zr,{children:"Environment Variable"}),h.jsx(zr,{children:"Source"}),h.jsx(zr,{})]})}),t[17]=g):g=t[17],t[18]!==c?(p=c.map(bF),t[18]=c,t[19]=p):p=t[19],t[20]!==p?(b=h.jsxs(Ym,{className:"overflow-auto flex-1 mb-16",children:[g,h.jsx(Km,{children:p})]}),t[20]=p,t[21]=b):b=t[21],t[22]!==_||t[23]!==b?(x=h.jsxs("div",{className:"flex flex-col h-full",children:[_,b]}),t[22]=_,t[23]=b,t[24]=x):x=t[24],x},mF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?h.jsx(xc,{className:"w-3 h-3 text-green-700 rounded"}):h.jsx(Fs,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=h.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function pF(){return Sg((await SS.request({})).secrets)}function gF(t){return t.provider!=="env"}function _F(t){return t.name}function bF(t){return t.keys.map(e=>h.jsxs(Xs,{className:"group",children:[h.jsx(Br,{children:e}),h.jsx(Br,{children:t.provider!=="env"&&h.jsx($4,{variant:"outline",className:"select-none",children:t.name})}),h.jsx(Br,{children:h.jsx(mF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await yn(`os.environ["${e}"]`),lt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Oe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const yF=K.lazy(()=>Lm(()=>import("./terminal-DDRrFKFT.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),xF=t=>{const e=X.c(120),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=yc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=oa(),l=K.useRef(null),c=K.useRef(null);let d,u,f,m,_;e[0]!==o?(d=()=>{if(!l.current)return;const ue=l.current.isCollapsed();o&&ue&&l.current.expand(),o||ue||l.current.collapse(),requestAnimationFrame(vF)},u=[o],e[0]=o,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==r?(f=()=>{if(!c.current)return;const ue=c.current.isCollapsed();r&&ue&&c.current.expand(),r||ue||c.current.collapse(),requestAnimationFrame(SF)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),A.useEffect(f,m),e[6]!==n?(_=h.jsx($c,{id:"app",className:"relative h-full",children:h.jsx(A.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==p?(b=Oe("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(x=h.jsx(uS,{onDragging:hS,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let S,k;e[12]!==v?(S=Oe("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=S):S=e[13],e[14]!==S?(k=h.jsx(uS,{onDragging:hS,className:S}),e[14]=S,e[15]=k):k=e[15];const E=k;let j,I,T,M,L,B,O,z,F,V,P,C,$,N,H,Y,Z,q,re,ne,oe;e[16]!==s?(j=h.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=j):j=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(go,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(M=h.jsx(Pe,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:T}),e[21]=I,e[22]=M):M=e[22],e[23]!==j||e[24]!==M?(L=h.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,M]}),e[23]=j,e[24]=M,e[25]=L):L=e[25],e[26]!==s?(B=s==="files"&&h.jsx(lR,{}),e[26]=s,e[27]=B):B=e[27],e[28]!==s?(O=s==="errors"&&h.jsx(Ox,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(z=s==="variables"&&h.jsx(N2,{}),e[30]=s,e[31]=z):z=e[31],e[32]!==s?(F=s==="dependencies"&&h.jsx(RD,{}),e[32]=s,e[33]=F):F=e[33],e[34]!==s?(V=s==="packages"&&h.jsx(RR,{}),e[34]=s,e[35]=V):V=e[35],e[36]!==s?(P=s==="outline"&&h.jsx(lO,{}),e[36]=s,e[37]=P):P=e[37],e[38]!==s?(C=s==="datasources"&&h.jsx(ER,{}),e[38]=s,e[39]=C):C=e[39],e[40]!==s?($=s==="documentation"&&h.jsx(BD,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(N=s==="snippets"&&h.jsx(fR,{}),e[42]=s,e[43]=N):N=e[43],e[44]!==s?(H=s==="scratchpad"&&h.jsx(DR,{}),e[44]=s,e[45]=H):H=e[45],e[46]!==s?(Y=s==="chat"&&h.jsx(eF,{}),e[46]=s,e[47]=Y):Y=e[47],e[48]!==s?(Z=s==="logs"&&h.jsx(j2,{}),e[48]=s,e[49]=Z):Z=e[49],e[50]!==s?(q=s==="tracing"&&h.jsx(uF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(re=s==="secrets"&&h.jsx(fF,{}),e[52]=s,e[53]=re):re=e[53],e[54]!==B||e[55]!==O||e[56]!==z||e[57]!==F||e[58]!==V||e[59]!==P||e[60]!==C||e[61]!==$||e[62]!==N||e[63]!==H||e[64]!==Y||e[65]!==Z||e[66]!==q||e[67]!==re?(ne=h.jsx(A.Suspense,{children:h.jsxs(zc,{children:[B,O,z,F,V,P,C,$,N,H,Y,Z,q,re]})}),e[54]=B,e[55]=O,e[56]=z,e[57]=F,e[58]=V,e[59]=P,e[60]=C,e[61]=$,e[62]=N,e[63]=H,e[64]=Y,e[65]=Z,e[66]=q,e[67]=re,e[68]=ne):ne=e[68],e[69]!==L||e[70]!==ne?(oe=h.jsx(Sc,{children:h.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[L,ne]})}),e[69]=L,e[70]=ne,e[71]=oe):oe=e[71];const G=oe,Q=o&&"border-r border-l border-[var(--slate-7)]";let ce,me,de,ge,ie,xe;e[72]!==Q?(ce=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=ce):ce=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(ue,je)=>{var ve;je===0&&ue===10&&((ve=l.current)==null||ve.resize(30))},e[74]=me):me=e[74],e[75]!==i?(de=()=>i(!1),ge=()=>i(!0),e[75]=i,e[76]=de,e[77]=ge):(de=e[76],ge=e[77]),e[78]!==G||e[79]!==y?(ie=h.jsxs("span",{className:"flex flex-row h-full",children:[G," ",y]}),e[78]=G,e[79]=y,e[80]=ie):ie=e[80],e[81]!==ce||e[82]!==de||e[83]!==ge||e[84]!==ie?(xe=h.jsx($c,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ce,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:de,onExpand:ge,children:ie},"helper"),e[81]=ce,e[82]=de,e[83]=ge,e[84]=ie,e[85]=xe):xe=e[85];const we=xe,ae=r&&"border-[var(--slate-7)]";let Se,pe,Te,Re,He,ze,Ne,Ke;e[86]!==ae?(Se=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=Se):Se=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(pe=(ue,je)=>{var ve;je===0&&ue===10&&((ve=c.current)==null||ve.resize(30))},e[88]=pe):pe=e[88],e[89]!==a?(Te=()=>a(!1),Re=()=>a(!0),e[89]=a,e[90]=Te,e[91]=Re):(Te=e[90],Re=e[91]),e[92]!==a?(He=()=>a(!1),e[92]=a,e[93]=He):He=e[93],e[94]!==r||e[95]!==He?(ze=h.jsx(yF,{visible:r,onClose:He}),e[94]=r,e[95]=He,e[96]=ze):ze=e[96],e[97]!==r||e[98]!==ze?(Ne=h.jsx(IR,{isOpen:r,children:ze}),e[97]=r,e[98]=ze,e[99]=Ne):Ne=e[99],e[100]!==Se||e[101]!==Te||e[102]!==Re||e[103]!==Ne||e[104]!==E?(Ke=h.jsxs($c,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Se,minSize:10,defaultSize:0,maxSize:75,onResize:pe,onCollapse:Te,onExpand:Re,children:[E,Ne]},"terminal"),e[100]=Se,e[101]=Te,e[102]=Re,e[103]=Ne,e[104]=E,e[105]=Ke):Ke=e[105];const nt=Ke;let it,te,Ce,Me,Be,J,fe,_e;return e[106]===Symbol.for("react.memo_cache_sentinel")?(it=nH(),e[106]=it):it=e[106],e[107]===Symbol.for("react.memo_cache_sentinel")?(te=h.jsx(zc,{children:h.jsx(nO,{})}),e[107]=te):te=e[107],e[108]!==nt?(Ce=h.jsx(Ax,{capability:"terminal",children:nt}),e[108]=nt,e[109]=Ce):Ce=e[109],e[110]!==g||e[111]!==Ce?(Me=h.jsx($c,{children:h.jsxs(fS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Ce]})}),e[110]=g,e[111]=Ce,e[112]=Me):Me=e[112],e[113]===Symbol.for("react.memo_cache_sentinel")?(Be=h.jsx(u$,{}),e[113]=Be):Be=e[113],e[114]!==we||e[115]!==Me?(J=h.jsxs(fS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:it,children:[te,we,Me,Be]}),e[114]=we,e[115]=Me,e[116]=J):J=e[116],e[117]===Symbol.for("react.memo_cache_sentinel")?(fe=h.jsx(Sc,{children:h.jsx(zc,{children:h.jsx(XM,{})})}),e[117]=fe):fe=e[117],e[118]!==J?(_e=h.jsxs(oH,{children:[J,fe]}),e[118]=J,e[119]=_e):_e=e[119],_e};function wF(){window.dispatchEvent(new Event("resize"))}function vF(){requestAnimationFrame(wF)}function kF(){window.dispatchEvent(new Event("resize"))}function SF(){requestAnimationFrame(kF)}let _3;_3=new URL(window.location.href).searchParams.get(h$.showChrome)==="false",TS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(_3){let s,i,a;return e[0]!==t?(s=h.jsx(Ix,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(ng,{}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsxs(h.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=h.jsx(Ix,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ng,{}),e[7]=o):o=e[7],e[8]!==n?(r=h.jsxs(xF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{rp as C,Hc as E,An as P,aH as __tla,Wc as a,TS as e,ka as f,sp as u};
144
+ `)}),includeOtherCode:jc("")}}function aF(t){Zt.error("An error occurred:",t)}function lF(t){Zt.debug("Received HTTP response from server:",t)}function cF(t){if(t.length===0)return!1;const e=t.at(-1);if(!e||e.role!=="assistant"||!e.parts)return!1;const n=e.parts;return n.length===0?!1:n[n.length-1].type==="reasoning"}const dF=K.lazy(()=>Lm(()=>import("./tracing-hdybZ30c.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122]),import.meta.url).then(t=>({default:t.Tracing}))),uF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(K.Suspense,{fallback:h.jsx(hF,{}),children:h.jsx(dF,{})}),t[0]=e):e=t[0],e},hF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:h.jsx(eo,{})}),t[0]=e):e=t[0],e},fF=()=>{const t=X.c(25),{openModal:e,closeModal:n}=Vn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,loading:s,error:i,reload:a}=Hn(pF,o);let l;t[1]!==r?(l=r===void 0?[]:r,t[1]=r,t[2]=l):l=t[2];const c=l;let d;t[3]!==c?(d=c.filter(gF).map(_F),t[3]=c,t[4]=d):d=t[4];const u=d;if(s&&c.length===0){let y;return t[5]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(eo,{size:"medium",centered:!0}),t[5]=y):y=t[5],y}if(i){let y;return t[6]!==i?(y=h.jsx(Zs,{error:i}),t[6]=i,t[7]=y):y=t[7],y}if(c.length===0){let y;return t[8]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(An,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:h.jsx(Xc,{})}),t[8]=y):y=t[8],y}let f,m,_,g,p,b,x;return t[9]!==n||t[10]!==e||t[11]!==u||t[12]!==a?(f=()=>e(h.jsx(Cg,{providerNames:u,onSuccess:()=>{a(),n()},onClose:n})),t[9]=n,t[10]=e,t[11]=u,t[12]=a,t[13]=f):f=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Fr,{className:"h-4 w-4"}),t[14]=m):m=t[14],t[15]!==f?(_=h.jsx("div",{className:"flex justify-end h-8 border-b",children:h.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:f,children:m})}),t[15]=f,t[16]=_):_=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(Jm,{children:h.jsxs(Xs,{children:[h.jsx(zr,{children:"Environment Variable"}),h.jsx(zr,{children:"Source"}),h.jsx(zr,{})]})}),t[17]=g):g=t[17],t[18]!==c?(p=c.map(bF),t[18]=c,t[19]=p):p=t[19],t[20]!==p?(b=h.jsxs(Ym,{className:"overflow-auto flex-1 mb-16",children:[g,h.jsx(Km,{children:p})]}),t[20]=p,t[21]=b):b=t[21],t[22]!==_||t[23]!==b?(x=h.jsxs("div",{className:"flex flex-col h-full",children:[_,b]}),t[22]=_,t[23]=b,t[24]=x):x=t[24],x},mF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?h.jsx(xc,{className:"w-3 h-3 text-green-700 rounded"}):h.jsx(Fs,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=h.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function pF(){return Sg((await SS.request({})).secrets)}function gF(t){return t.provider!=="env"}function _F(t){return t.name}function bF(t){return t.keys.map(e=>h.jsxs(Xs,{className:"group",children:[h.jsx(Br,{children:e}),h.jsx(Br,{children:t.provider!=="env"&&h.jsx($4,{variant:"outline",className:"select-none",children:t.name})}),h.jsx(Br,{children:h.jsx(mF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await yn(`os.environ["${e}"]`),lt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Oe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const yF=K.lazy(()=>Lm(()=>import("./terminal-COx5J6qv.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),xF=t=>{const e=X.c(120),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=yc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=oa(),l=K.useRef(null),c=K.useRef(null);let d,u,f,m,_;e[0]!==o?(d=()=>{if(!l.current)return;const ue=l.current.isCollapsed();o&&ue&&l.current.expand(),o||ue||l.current.collapse(),requestAnimationFrame(vF)},u=[o],e[0]=o,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==r?(f=()=>{if(!c.current)return;const ue=c.current.isCollapsed();r&&ue&&c.current.expand(),r||ue||c.current.collapse(),requestAnimationFrame(SF)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),A.useEffect(f,m),e[6]!==n?(_=h.jsx($c,{id:"app",className:"relative h-full",children:h.jsx(A.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==p?(b=Oe("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(x=h.jsx(uS,{onDragging:hS,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let S,k;e[12]!==v?(S=Oe("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=S):S=e[13],e[14]!==S?(k=h.jsx(uS,{onDragging:hS,className:S}),e[14]=S,e[15]=k):k=e[15];const E=k;let j,I,T,M,L,B,O,z,F,V,P,C,$,N,H,Y,Z,q,re,ne,oe;e[16]!==s?(j=h.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=j):j=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(go,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(M=h.jsx(Pe,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:T}),e[21]=I,e[22]=M):M=e[22],e[23]!==j||e[24]!==M?(L=h.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,M]}),e[23]=j,e[24]=M,e[25]=L):L=e[25],e[26]!==s?(B=s==="files"&&h.jsx(lR,{}),e[26]=s,e[27]=B):B=e[27],e[28]!==s?(O=s==="errors"&&h.jsx(Ox,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(z=s==="variables"&&h.jsx(N2,{}),e[30]=s,e[31]=z):z=e[31],e[32]!==s?(F=s==="dependencies"&&h.jsx(RD,{}),e[32]=s,e[33]=F):F=e[33],e[34]!==s?(V=s==="packages"&&h.jsx(RR,{}),e[34]=s,e[35]=V):V=e[35],e[36]!==s?(P=s==="outline"&&h.jsx(lO,{}),e[36]=s,e[37]=P):P=e[37],e[38]!==s?(C=s==="datasources"&&h.jsx(ER,{}),e[38]=s,e[39]=C):C=e[39],e[40]!==s?($=s==="documentation"&&h.jsx(BD,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(N=s==="snippets"&&h.jsx(fR,{}),e[42]=s,e[43]=N):N=e[43],e[44]!==s?(H=s==="scratchpad"&&h.jsx(DR,{}),e[44]=s,e[45]=H):H=e[45],e[46]!==s?(Y=s==="chat"&&h.jsx(eF,{}),e[46]=s,e[47]=Y):Y=e[47],e[48]!==s?(Z=s==="logs"&&h.jsx(j2,{}),e[48]=s,e[49]=Z):Z=e[49],e[50]!==s?(q=s==="tracing"&&h.jsx(uF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(re=s==="secrets"&&h.jsx(fF,{}),e[52]=s,e[53]=re):re=e[53],e[54]!==B||e[55]!==O||e[56]!==z||e[57]!==F||e[58]!==V||e[59]!==P||e[60]!==C||e[61]!==$||e[62]!==N||e[63]!==H||e[64]!==Y||e[65]!==Z||e[66]!==q||e[67]!==re?(ne=h.jsx(A.Suspense,{children:h.jsxs(zc,{children:[B,O,z,F,V,P,C,$,N,H,Y,Z,q,re]})}),e[54]=B,e[55]=O,e[56]=z,e[57]=F,e[58]=V,e[59]=P,e[60]=C,e[61]=$,e[62]=N,e[63]=H,e[64]=Y,e[65]=Z,e[66]=q,e[67]=re,e[68]=ne):ne=e[68],e[69]!==L||e[70]!==ne?(oe=h.jsx(Sc,{children:h.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[L,ne]})}),e[69]=L,e[70]=ne,e[71]=oe):oe=e[71];const G=oe,Q=o&&"border-r border-l border-[var(--slate-7)]";let ce,me,de,ge,ie,xe;e[72]!==Q?(ce=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=ce):ce=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(ue,je)=>{var ve;je===0&&ue===10&&((ve=l.current)==null||ve.resize(30))},e[74]=me):me=e[74],e[75]!==i?(de=()=>i(!1),ge=()=>i(!0),e[75]=i,e[76]=de,e[77]=ge):(de=e[76],ge=e[77]),e[78]!==G||e[79]!==y?(ie=h.jsxs("span",{className:"flex flex-row h-full",children:[G," ",y]}),e[78]=G,e[79]=y,e[80]=ie):ie=e[80],e[81]!==ce||e[82]!==de||e[83]!==ge||e[84]!==ie?(xe=h.jsx($c,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ce,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:de,onExpand:ge,children:ie},"helper"),e[81]=ce,e[82]=de,e[83]=ge,e[84]=ie,e[85]=xe):xe=e[85];const we=xe,ae=r&&"border-[var(--slate-7)]";let Se,pe,Te,Re,He,ze,Ne,Ke;e[86]!==ae?(Se=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=Se):Se=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(pe=(ue,je)=>{var ve;je===0&&ue===10&&((ve=c.current)==null||ve.resize(30))},e[88]=pe):pe=e[88],e[89]!==a?(Te=()=>a(!1),Re=()=>a(!0),e[89]=a,e[90]=Te,e[91]=Re):(Te=e[90],Re=e[91]),e[92]!==a?(He=()=>a(!1),e[92]=a,e[93]=He):He=e[93],e[94]!==r||e[95]!==He?(ze=h.jsx(yF,{visible:r,onClose:He}),e[94]=r,e[95]=He,e[96]=ze):ze=e[96],e[97]!==r||e[98]!==ze?(Ne=h.jsx(IR,{isOpen:r,children:ze}),e[97]=r,e[98]=ze,e[99]=Ne):Ne=e[99],e[100]!==Se||e[101]!==Te||e[102]!==Re||e[103]!==Ne||e[104]!==E?(Ke=h.jsxs($c,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Se,minSize:10,defaultSize:0,maxSize:75,onResize:pe,onCollapse:Te,onExpand:Re,children:[E,Ne]},"terminal"),e[100]=Se,e[101]=Te,e[102]=Re,e[103]=Ne,e[104]=E,e[105]=Ke):Ke=e[105];const nt=Ke;let it,te,Ce,Me,Be,J,fe,_e;return e[106]===Symbol.for("react.memo_cache_sentinel")?(it=nH(),e[106]=it):it=e[106],e[107]===Symbol.for("react.memo_cache_sentinel")?(te=h.jsx(zc,{children:h.jsx(nO,{})}),e[107]=te):te=e[107],e[108]!==nt?(Ce=h.jsx(Ax,{capability:"terminal",children:nt}),e[108]=nt,e[109]=Ce):Ce=e[109],e[110]!==g||e[111]!==Ce?(Me=h.jsx($c,{children:h.jsxs(fS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Ce]})}),e[110]=g,e[111]=Ce,e[112]=Me):Me=e[112],e[113]===Symbol.for("react.memo_cache_sentinel")?(Be=h.jsx(u$,{}),e[113]=Be):Be=e[113],e[114]!==we||e[115]!==Me?(J=h.jsxs(fS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:it,children:[te,we,Me,Be]}),e[114]=we,e[115]=Me,e[116]=J):J=e[116],e[117]===Symbol.for("react.memo_cache_sentinel")?(fe=h.jsx(Sc,{children:h.jsx(zc,{children:h.jsx(XM,{})})}),e[117]=fe):fe=e[117],e[118]!==J?(_e=h.jsxs(oH,{children:[J,fe]}),e[118]=J,e[119]=_e):_e=e[119],_e};function wF(){window.dispatchEvent(new Event("resize"))}function vF(){requestAnimationFrame(wF)}function kF(){window.dispatchEvent(new Event("resize"))}function SF(){requestAnimationFrame(kF)}let _3;_3=new URL(window.location.href).searchParams.get(h$.showChrome)==="false",TS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(_3){let s,i,a;return e[0]!==t?(s=h.jsx(Ix,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(ng,{}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsxs(h.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=h.jsx(Ix,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ng,{}),e[7]=o):o=e[7],e[8]!==n?(r=h.jsxs(xF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{rp as C,Hc as E,An as P,aH as __tla,Wc as a,TS as e,ka as f,sp as u};