@marimo-team/frontend 0.14.14-dev7 → 0.14.14

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 (113) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-F-Xrrd4C.js → ConnectedDataExplorerComponent-Bp3mwTe1.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-_NjorTk3.js → ImageComparisonComponent-BBQrEEp9.js} +1 -1
  3. package/dist/assets/{VegaLite-h89Shu6_.js → VegaLite-BNzfcsRe.js} +1 -1
  4. package/dist/assets/_baseEach-BpkorfLL.js +1 -0
  5. package/dist/assets/_baseMap-BvMXc8Pl.js +1 -0
  6. package/dist/assets/_baseUniq-BSSIGVmX.js +1 -0
  7. package/dist/assets/_createAggregator-Lk1zOWnh.js +1 -0
  8. package/dist/assets/{any-language-editor-3eHmtGuy.js → any-language-editor-1kbv3a1L.js} +1 -1
  9. package/dist/assets/{architectureDiagram-SUXI7LT5-BZYtrsly.js → architectureDiagram-SUXI7LT5-DiOKYUTt.js} +1 -1
  10. package/dist/assets/{blockDiagram-6J76NXCF-BFTsOtXG.js → blockDiagram-6J76NXCF-BxwzEi5b.js} +1 -1
  11. package/dist/assets/{c4Diagram-6F6E4RAY-DL6gNI1N.js → c4Diagram-6F6E4RAY-DiWdqDd2.js} +1 -1
  12. package/dist/assets/channel-UNMFY9Hl.js +1 -0
  13. package/dist/assets/{chunk-353BL4L5-BIdNhoMc.js → chunk-353BL4L5-C8Xkf5bB.js} +1 -1
  14. package/dist/assets/{chunk-67H74DCK-xy7s2ExM.js → chunk-67H74DCK-CrHg40SZ.js} +1 -1
  15. package/dist/assets/{chunk-AACKK3MU-D7qMG1DU.js → chunk-AACKK3MU-q-nfuLWx.js} +1 -1
  16. package/dist/assets/{chunk-BFAMUDN2-BG0lKuqS.js → chunk-BFAMUDN2-YkFuRdC0.js} +1 -1
  17. package/dist/assets/{chunk-E2GYISFI-CSv6gIsh.js → chunk-E2GYISFI-BV-Cww5g.js} +1 -1
  18. package/dist/assets/{chunk-OW32GOEJ-BOzqml1N.js → chunk-OW32GOEJ-BLqw6Kpl.js} +1 -1
  19. package/dist/assets/{chunk-SKB7J2MH-D4BOAo9S.js → chunk-SKB7J2MH-B0GSII6I.js} +1 -1
  20. package/dist/assets/{chunk-SZ463SBG-Cka8JjXr.js → chunk-SZ463SBG-CjmiuwWO.js} +1 -1
  21. package/dist/assets/{circle-play-Cv-5hnN3.js → circle-play-jXMGy0M8.js} +1 -1
  22. package/dist/assets/classDiagram-M3E45YP4-Boz4y8EA.js +1 -0
  23. package/dist/assets/classDiagram-v2-YAWTLIQI-Boz4y8EA.js +1 -0
  24. package/dist/assets/clone-DCspjU4W.js +1 -0
  25. package/dist/assets/{compile-Bu3ilgPW.js → compile-DZkXM1Fd.js} +1 -1
  26. package/dist/assets/{dagre-JOIXM2OF-BVLOgzA8.js → dagre-JOIXM2OF-BAmcj3cC.js} +1 -1
  27. package/dist/assets/{data-grid-overlay-editor-B3eH-l94.js → data-grid-overlay-editor-DCoHCHBq.js} +1 -1
  28. package/dist/assets/{diagram-5UYTHUR4-BZP2yhMp.js → diagram-5UYTHUR4-CHMOxkK4.js} +1 -1
  29. package/dist/assets/{diagram-VMROVX33-BobkT1wh.js → diagram-VMROVX33-CKZctZQ0.js} +1 -1
  30. package/dist/assets/{diagram-ZTM2IBQH-BbEN369b.js → diagram-ZTM2IBQH-CuprAAzw.js} +1 -1
  31. package/dist/assets/edit-page-BVoA4SRK.js +148 -0
  32. package/dist/assets/{erDiagram-3M52JZNH-Cx9yHmAP.js → erDiagram-3M52JZNH-DM2fYH5Q.js} +1 -1
  33. package/dist/assets/{flowDiagram-KYDEHFYC-CsBLdDwO.js → flowDiagram-KYDEHFYC-Da31aHbQ.js} +1 -1
  34. package/dist/assets/{ganttDiagram-EK5VF46D-DKRb26T4.js → ganttDiagram-EK5VF46D-9bL6D59A.js} +1 -1
  35. package/dist/assets/{gitGraphDiagram-GW3U2K7C-CHzRNyo-.js → gitGraphDiagram-GW3U2K7C-C6p63UbR.js} +1 -1
  36. package/dist/assets/{glide-data-editor-Bf9pima_.js → glide-data-editor-B8IMePls.js} +4 -4
  37. package/dist/assets/{graph-YPRE0Vqf.js → graph-DQxh8O8e.js} +1 -1
  38. package/dist/assets/{home-page-B9KK0u7f.js → home-page-DtZ8a0oS.js} +3 -3
  39. package/dist/assets/index-B-OhZVlA.css +1 -0
  40. package/dist/assets/{index-BuuqcNL0.js → index-BQW0hegy.js} +1 -1
  41. package/dist/assets/{index-DbarM-Ip.js → index-BXJ_Veem.js} +1 -1
  42. package/dist/assets/{index-DlRg-fTX.js → index-Bld-3jts.js} +1 -1
  43. package/dist/assets/{index-aou0pXsl.js → index-C23vSotI.js} +1 -1
  44. package/dist/assets/{index-DKUbk3i7.js → index-C3e4fOPq.js} +1 -1
  45. package/dist/assets/{index-BBdU3O2R.js → index-CxASlAdP.js} +171 -171
  46. package/dist/assets/{index-CcDBl2f8.js → index-D3loctUC.js} +1 -1
  47. package/dist/assets/{index-S6Y5XsRJ.js → index-D9-ta2cc.js} +1 -1
  48. package/dist/assets/{index-22uNOxrE.js → index-DQjCG403.js} +1 -1
  49. package/dist/assets/{index-DcJsiUrw.js → index-DTnpAQ-n.js} +1 -1
  50. package/dist/assets/{index-Sx8CO0dU.js → index-DXzoUPqi.js} +1 -1
  51. package/dist/assets/{index-ISmtQgG5.js → index-D_wmS6dv.js} +1 -1
  52. package/dist/assets/{index-CRNMG-IJ.js → index-DvM6cX6Z.js} +1 -1
  53. package/dist/assets/{index-BaSiAp-x.js → index-DvnmDbDs.js} +1 -1
  54. package/dist/assets/{index-Bai-JOtE.js → index-Dx1LFKRN.js} +1 -1
  55. package/dist/assets/{index-BCDsxDDP.js → index-_hCOrXwV.js} +1 -1
  56. package/dist/assets/{index-DCTs9hqu.js → index-fJuCk8q9.js} +1 -1
  57. package/dist/assets/{index-BjwmapG2.js → index-lnm38NWr.js} +1 -1
  58. package/dist/assets/{index-Cj9UMhGd.js → index-uaY5mY94.js} +1 -1
  59. package/dist/assets/infoDiagram-LHK5PUON-Dfklymfx.js +2 -0
  60. package/dist/assets/{journeyDiagram-EWQZEKCU-BnkgjBce.js → journeyDiagram-EWQZEKCU-Ky-ALYuh.js} +1 -1
  61. package/dist/assets/{kanban-definition-ZSS6B67P-BTLMcTVT.js → kanban-definition-ZSS6B67P-b7A2rX6M.js} +1 -1
  62. package/dist/assets/layout-Bv8jUGy6.js +1 -0
  63. package/dist/assets/{linear-BrXp8CZP.js → linear-CVNWndPb.js} +1 -1
  64. package/dist/assets/{links-CJGCQSxO.js → links-CgSdOoi8.js} +13 -13
  65. package/dist/assets/{mermaid-I4TQfgY2.js → mermaid-DrNnN90h.js} +4 -4
  66. package/dist/assets/min-U8mv5UqS.js +1 -0
  67. package/dist/assets/{mindmap-definition-6CBA2TL7-kyS-y3IO.js → mindmap-definition-6CBA2TL7-BI_Cxh5f.js} +1 -1
  68. package/dist/assets/{number-overlay-editor-C5yXVmj5.js → number-overlay-editor-z5Zmc_Jo.js} +2 -2
  69. package/dist/assets/{pieDiagram-NIOCPIFQ-CQt4OJk3.js → pieDiagram-NIOCPIFQ-Czl0fA_x.js} +1 -1
  70. package/dist/assets/{quadrantDiagram-2OG54O6I-BIW-B3oA.js → quadrantDiagram-2OG54O6I-qp_jjVgb.js} +1 -1
  71. package/dist/assets/{react-plotly-kHr4QlMz.js → react-plotly-VBx3BgCC.js} +1 -1
  72. package/dist/assets/{requirementDiagram-QOLK2EJ7-DUNPNW7B.js → requirementDiagram-QOLK2EJ7-C5-MEnwB.js} +1 -1
  73. package/dist/assets/run-page-BXjrQWoS.js +1 -0
  74. package/dist/assets/{sankeyDiagram-4UZDY2LN-B3YRyDfr.js → sankeyDiagram-4UZDY2LN-1YDi0GqJ.js} +1 -1
  75. package/dist/assets/{sequenceDiagram-SKLFT4DO-CZcHM-Y_.js → sequenceDiagram-SKLFT4DO-DRMleoAm.js} +1 -1
  76. package/dist/assets/slides-component-BsNAI2NW.js +1 -0
  77. package/dist/assets/sortBy-BVYStTsp.js +1 -0
  78. package/dist/assets/{stateDiagram-MI5ZYTHO-J8i_HNTe.js → stateDiagram-MI5ZYTHO-YsBGin7O.js} +1 -1
  79. package/dist/assets/stateDiagram-v2-5AN5P6BG-wXnrPOJR.js +1 -0
  80. package/dist/assets/storage-vY5Nu0L9.js +26 -0
  81. package/dist/assets/{terminal-CPxRVQ6J.js → terminal-6c3AeOqD.js} +1 -1
  82. package/dist/assets/{time-BDbk7ICj.js → time-CdE3iyMk.js} +1 -1
  83. package/dist/assets/{timeline-definition-MYPXXCX6-DdlThHAd.js → timeline-definition-MYPXXCX6-Drutufoc.js} +1 -1
  84. package/dist/assets/tracing-BE0mfA71.js +2 -0
  85. package/dist/assets/{trash-DP3sISKj.js → trash-BGJZW9-d.js} +1 -1
  86. package/dist/assets/{treemap-75Q7IDZK-CUY8SXjy.js → treemap-75Q7IDZK-BhtDc7oc.js} +1 -1
  87. package/dist/assets/vega-component-CpUI1HEd.js +1 -0
  88. package/dist/assets/{xychartDiagram-H2YORKM3-DQjOC9XX.js → xychartDiagram-H2YORKM3-CmMvHRUM.js} +1 -1
  89. package/dist/index.html +2 -2
  90. package/package.json +5 -5
  91. package/dist/assets/_baseEach-C9MnFLH-.js +0 -1
  92. package/dist/assets/_baseMap-4JSjbiQt.js +0 -1
  93. package/dist/assets/_baseUniq-BLZW9oRf.js +0 -1
  94. package/dist/assets/_createAggregator-ynvFItZw.js +0 -1
  95. package/dist/assets/channel-BYFn3Ey5.js +0 -1
  96. package/dist/assets/classDiagram-M3E45YP4-BE8-ZMzS.js +0 -1
  97. package/dist/assets/classDiagram-v2-YAWTLIQI-BE8-ZMzS.js +0 -1
  98. package/dist/assets/clone-C6LGk0_X.js +0 -1
  99. package/dist/assets/edit-page-Dy-btbvI.js +0 -148
  100. package/dist/assets/index-B7PzHRJj.css +0 -1
  101. package/dist/assets/infoDiagram-LHK5PUON-Bjg5rc_Z.js +0 -2
  102. package/dist/assets/layout-DSvURtdw.js +0 -1
  103. package/dist/assets/min-DEQMc0wq.js +0 -1
  104. package/dist/assets/run-page-BPsUTm9p.js +0 -1
  105. package/dist/assets/slides-component-BJwd6mcC.js +0 -1
  106. package/dist/assets/sortBy-wJvpeVrY.js +0 -1
  107. package/dist/assets/stateDiagram-v2-5AN5P6BG-WXBL4FmF.js +0 -1
  108. package/dist/assets/storage-Dts5GhLd.js +0 -25
  109. package/dist/assets/tracing-DQ_WtPZ3.js +0 -2
  110. package/dist/assets/vega-component-C2UorcU1.js +0 -1
  111. package/dist/circle-check.ico +0 -0
  112. package/dist/circle-play.ico +0 -0
  113. package/dist/circle-x.ico +0 -0
@@ -1,148 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-DQ_WtPZ3.js","./index-BBdU3O2R.js","./index-B7PzHRJj.css","./compile-Bu3ilgPW.js","./time-BDbk7ICj.js","./timer-Bqd5yn_a.js","./linear-BrXp8CZP.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-Dts5GhLd.js","./index-BjwmapG2.js","./index-ISmtQgG5.js","./index-DbarM-Ip.js","./index-Sx8CO0dU.js","./index-CRNMG-IJ.js","./index-22uNOxrE.js","./index-DlRg-fTX.js","./index-BaSiAp-x.js","./index-DcJsiUrw.js","./index-DCTs9hqu.js","./index-Bai-JOtE.js","./index-CcDBl2f8.js","./index-BCDsxDDP.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-DP3sISKj.js","./storage-De8XnUVS.css","./links-CJGCQSxO.js","./index-BuuqcNL0.js","./links-C1rhMrxo.css","./circle-play-Cv-5hnN3.js","./_createAggregator-ynvFItZw.js","./_baseEach-C9MnFLH-.js","./loro_wasm_bg-C3hKWL9L.js","./transform-CDNfLgV5.js","./sortBy-wJvpeVrY.js","./_baseMap-4JSjbiQt.js","./terminal-CPxRVQ6J.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var z7=Object.defineProperty;var rk=At=>{throw TypeError(At)};var B7=(At,wt,Qt)=>wt in At?z7(At,wt,{enumerable:!0,configurable:!0,writable:!0,value:Qt}):At[wt]=Qt;var Z=(At,wt,Qt)=>B7(At,typeof wt!="symbol"?wt+"":wt,Qt),U7=(At,wt,Qt)=>wt.has(At)||rk("Cannot "+Qt);var sk=(At,wt,Qt)=>(U7(At,wt,"read from private field"),Qt?Qt.call(At):wt.get(At)),ak=(At,wt,Qt)=>wt.has(At)?rk("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(At):wt.set(At,Qt);import{c as Ee,W as O,ix as $7,iy as V7,iz as ik,iA as H7,iB as W7,iC as q7,b as G,iD as Of,iE as ur,iF as G7,iG as Df,iH as lk,iI as Y7,iJ as K7,iK as ck,iL as Rl,a as H,eD as X7,ar as Xe,j as c,ag as On,ao as zo,an as ss,ap as as,bs as Bo,al as ke,aq as on,iM as Ca,am as Uo,aS as Dn,as as ja,a1 as Ce,X as St,dV as Pf,eH as Rf,iN as J7,aN as ze,a7 as it,iO as Z7,eV as mn,iP as dk,iQ as uk,iR as Lf,iS as hk,iT as Q7,L as ft,dC as Ll,aZ as $o,iU as Fl,a$ as Ff,av as Zt,iV as e9,a4 as Ea,iW as t9,iX as fk,eU as mk,U as yt,b5 as pk,iY as gk,cF as zl,iZ as n9,dM as et,i_ as Bl,dT as Pn,i$ as xk,j0 as _a,T as Ie,bd as Nn,j1 as Ul,j2 as $l,eK as is,j3 as o9,j4 as Ia,j5 as bk,eS as yk,j6 as zf,j7 as Bf,em as Uf,j8 as qn,j9 as hr,aX as Vl,ja as r9,jb as Hl,jc as Wl,a2 as vo,ea as vk,a3 as Ta,jd as s9,je as ql,jf as Vo,bu as fr,eL as mr,fs as wk,gd as pr,fH as a9,bg as Ot,jg as i9,jh as l9,gb as Gl,aP as Yl,ji as $f,jj as c9,jk as kk,jl as Vf,jm as d9,jn as Hf,jo as Gn,jp as Sk,gh as Wf,jq as Aa,jr as Kl,er as dt,et as ls,js as mt,jt as Be,ju as st,jv as qf,jw as u9,jx as Gf,jy as pt,jz as Nk,dw as Xl,ds as Jl,dt as Zl,du as Ql,dr as Ma,jA as h9,fF as Yf,b4 as Cn,aJ as jn,fv as Ck,fx as jk,fy as f9,fD as m9,fz as Ek,jB as _k,$ as me,el as p9,aV as Ho,b2 as Wo,aW as qo,b0 as Dt,eT as rn,jC as Ik,fB as Tk,jD as g9,jE as x9,ft as Ak,fu as Mk,jF as cs,dv as Ok,jG as Dk,jH as b9,jI as y9,ak as v9,aj as w9,jJ as Kf,dz as k9,dB as Xf,fg as ec,jK as tc,jL as nc,bx as pn,jM as S9,eO as Oa,fd as Yn,bl as Pk,dW as Ut,jN as N9,eg as C9,ah as Jf,jO as gr,jP as ds,jQ as j9,jR as E9,jS as Rk,jT as Wt,aY as _9,au as Zf,gg as Lk,en as oc,jU as I9,gD as Qf,bk as rc,jV as em,ai as T9,jW as A9,at as Da,eE as Fk,bo as M9,jX as O9,jY as zk,gO as D9,gM as P9,gP as R9,gQ as L9,jZ as tm,dx as wo,j_ as F9,j$ as sc,k0 as us,q as ko,o as Ge,fX as Rn,k1 as gn,k2 as ot,k3 as hs,k4 as Tt,gc as Pt,k5 as nm,eq as En,k6 as z9,k7 as om,bi as Bk,bj as Uk,k8 as $k,k9 as B9,gF as fs,ka as ac,bf as ic,gG as xr,eW as rm,kb as U9,kc as $9,kd as V9,ke as H9,kf as Vk,kg as Pa,kh as Hk,ki as Wk,kj as qk,kk as Gk,kl as W9,km as Yk,kn as Kk,eX as ms,ko as q9,kp as Kn,kq as lc,kr as Xk,ks as cc,dy as G9,gA as sm,kt as Ra,ku as La,kv as Fa,kw as dc,kx as Go,ky as Jk,kz as So,kA as ps,kB as am,kC as za,kD as gs,kE as im,kF as lm,kG as Zk,kH as uc,kI as Y9,a6 as Ba,kJ as Ua,kK as K9,dS as hc,kL as X9,kM as cm,kN as J9,kO as Z9,kP as fc,d$ as Q9,kQ as dm,kR as br,kS as mc,kT as xs,fW as _n,g5 as No,fS as Qk,cq as e3,kU as um,fE as t3,kV as n3,kW as $a,kX as o3,kY as pc,kZ as hm,k_ as Va,k$ as Ha,l0 as Wa,l1 as eO,fO as gc,l2 as fm,l3 as xc,ef as tO,fP as nO,l4 as oO,l5 as rO,l6 as sO,l7 as aO,u as iO,l8 as lO,l9 as cO,la as dO,f_ as uO,lb as hO,lc as r3,t as F,ld as fO,le as mO,lf as pO,lg as gO,lh as xO,li as bO,lj as yO,lk as vO,ll as wO,lm as kO,ln as SO,lo as NO,lp as CO,lq as jO,lr as EO,ls as _O,lt as IO,lu as TO,lv as AO,lw as MO,lx as OO,ly as DO,lz as qa,lA as PO,lB as RO,lC as LO,lD as FO,lE as zO,lF as BO,lG as UO,lH as $O,lI as mm,lJ as bc,lK as s3,lL as VO,lM as HO,lN as a3,lO as WO,lP as bs,lQ as In,lR as qO,lS as GO,lT as YO,lU as KO,lV as XO,lW as JO,lX as ZO,lY as QO,lZ as eD,l_ as tD,l$ as Yo,m0 as nD,m1 as oD,m2 as rD,m3 as sD,dY as aD,m4 as iD,m5 as i3,e0 as lD,m6 as yc,m7 as cD,m8 as dD,m9 as uD,ma as hD,gR as Ko,mb as vc,mc as fD,md as mD,me as l3,mf as pm,gE as ys,mg as pD,mh as gD,mi as xD,mj as bD,g3 as yD,br as vD,_ as gm,mk as c3,ml as wD,mm as kD,mn as xm,mo as bm,mp as SD,mq as d3,mr as u3,ms as wc,fR as ND,ab as h3,dK as CD,mt as f3,fq as vt,mu as Ga,mv as vs,mw as jD,mx as ED,my as _D,mz as ID,cp as ym,mA as TD,V as Xo,bh as m3,mB as AD,mC as MD,mD as OD,mE as kc,mF as p3,dI as Sc,bt as g3,es as DD,mG as PD,mH as x3,mI as b3,mJ as RD,mK as y3,mL as v3,mM as Nc,mN as LD,mO as w3,mP as FD,mQ as zD,mR as k3,ac as Cc,mS as BD,bv as S3,mT as UD,a0 as Co,eN as $D,mU as jo,mV as VD,ej as N3,eR as C3,eQ as j3,fI as jc,mW as vm,mX as E3,aU as wm,ek as Ec,mY as _3,mZ as HD,m_ as WD,m$ as I3,fp as qD,n0 as GD,gv as YD,fw as KD,fA as km,gy as XD,bq as Ya,n1 as JD,n2 as T3,n3 as Sm,n4 as ZD,n5 as QD,n6 as eP,ad as xn,n7 as tP,n8 as nP,n9 as A3,fi as Nm,dE as M3,na as oP,nb as rP,nc as sP,aO as aP,nd as iP,ne as lP,nf as cP,ng as dP,a8 as uP,nh as _c,aa as hP,fe as fP,ni as O3,fM as mP,nj as pP,gl as gP,nk as xP,nl as D3,nm as bP,nn as ws,no as yP,np as Ic,nq as vP,nr as wP,ns as kP,z as P3,gK as SP,nt as Ka,nu as R3,nv as L3,nw as F3,nx as z3,ny as NP,C as B3,nz as CP,nA as jP,nB as EP,E as yr,f0 as U3,be as _P,bc as IP,nC as TP,nD as AP,Z as Tc,nE as MP,dH as $3,nF as Cm,nG as OP,dU as V3,nH as DP,nI as jm,nJ as PP,nK as RP,nL as LP,nM as H3,nN as W3,nO as q3,fc as G3,nP as FP,nQ as zP,nR as Y3,nS as K3,nT as Ac,nU as X3,nV as J3,nW as BP,nX as Z3,nY as UP,nZ as $P,n_ as Q3,n$ as VP,o0 as HP,o1 as WP,o2 as qP,o3 as GP,o4 as YP,dR as KP,o5 as XP,o6 as JP,g4 as Em,o7 as ZP,o8 as QP,o9 as eR,oa as tR,ob as nR,oc as oR,od as rR,oe as sR,of as aR,og as iR,oh as _m,oi as lR,fU as cR,oj as dR,ok as uR,ol as hR,om as eS,on as fR,a5 as mR,oo as pR,Y as gR,eG as xR,go as bR,op as yR,oq as vR,gq as Im,gm as ks,gr as vr,gn as wr,gs as Tm,gt as Am,or as tS,gp as wR,os as nS,ot as kR,ou as oS,ov as Jo,ow as rS,gx as SR,ox as NR,oy as CR,oz as jR,oA as ER,oB as _R,oC as IR,oD as sS,ex as TR,oE as Mm,oF as AR,aw as Mc,oG as aS,oH as iS,ay as lS,ax as MR,dQ as OR,__tla as DR}from"./index-BBdU3O2R.js";import{b as Ss,A as PR,L as cS,g as RR,G as LR,o as dS,s as FR,k as zR,B as uS,a as BR,M as UR,Y as $R,c as sn,u as Xa,C as VR,S as HR,K as WR,d as qR,i as GR,e as hS,f as YR,h as KR,j as Ja,P as Za,l as fS,m as XR,n as JR,p as ZR,D as Ns,q as QR,r as mS,t as Om,T as eL}from"./links-CJGCQSxO.js";import{V as pS,d as kr,I as Dm,N as gS,S as xS,e as bS,f as yS,L as vS,g as wS,F as kS,M as tL,l as SS,h as nL,E as Pm,i as oL,j as Rm,k as Lm,m as rL,n as sL,o as aL,p as iL,q as lL,s as cL,t as dL,v as uL,a as hL,C as fL,R as NS,A as mL,b as pL,T as gL,w as xL,x as bL,y as yL,z as vL,O as wL,c as kL,P as SL,__tla as NL}from"./storage-Dts5GhLd.js";import{c as CL}from"./_createAggregator-ynvFItZw.js";import{_ as CS,a as jS,i as jL,w as EL,L as ES,A as _L,C as _S,b as Fm,c as IS,__tla as IL}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Ln,i as Zo,T as zm,a as Bm}from"./transform-CDNfLgV5.js";import{g as TS}from"./timer-Bqd5yn_a.js";import{i as TL}from"./zoom-COrs4lFh.js";import{s as Qa}from"./sortBy-wJvpeVrY.js";let Um,Oc,an,Dc,AS,Cs,AL=Promise.all([(()=>{try{return DR}catch{}})(),(()=>{try{return NL}catch{}})(),(()=>{try{return IL}catch{}})()]).then(async()=>{var Pl,tk;var At=CL(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,Qt,$m,Pc,js,Sr,Rc,Lc,Vm,Hm,ei,Fc,Wm,ti,qm,zc,Gm,Ym,Bc,Km,Xm,Jm,ni,Zm,Uc,Qm,ep,tp,np,op,rp,$c,sp,Vc,Hc,ap,ip,lp,cp,dp,up,oi,hp,fp,Wc,mp,pp,gp,qc,xp,bp,yp,ri,Gc,Yc,vp,wp,kp,Sp,Np,Cp,jp,Ep,_p,Kc,Xc,Ip,Tp,Ap,si,ln,cn;wt=Ee("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Qt=Ee("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),$m=Ee("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Pc=Ee("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),js=Ee("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Sr=Ee("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),Rc=Ee("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Lc=Ee("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Dc=Ee("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Vm=Ee("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Hm=Ee("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ei=Ee("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Fc=Ee("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Wm=Ee("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),ti=Ee("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),qm=Ee("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),zc=Ee("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Gm=Ee("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),Ym=Ee("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Bc=Ee("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),Km=Ee("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),Xm=Ee("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),Jm=Ee("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),ni=Ee("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),Zm=Ee("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),Uc=Ee("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),Qm=Ee("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),ep=Ee("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),tp=Ee("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),np=Ee("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),op=Ee("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),rp=Ee("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),$c=Ee("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),sp=Ee("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Vc=Ee("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Hc=Ee("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),ap=Ee("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),ip=Ee("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),lp=Ee("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),cp=Ee("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),dp=Ee("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),up=Ee("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),oi=Ee("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),hp=Ee("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),fp=Ee("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Wc=Ee("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),mp=Ee("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),pp=Ee("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),gp=Ee("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),qc=Ee("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),xp=Ee("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),bp=Ee("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),yp=Ee("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),ri=Ee("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Gc=Ee("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Yc=Ee("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),vp=Ee("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),wp=Ee("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),kp=Ee("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Sp=Ee("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Np=Ee("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Cp=Ee("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),jp=Ee("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ep=Ee("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),_p=Ee("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),Kc=Ee("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),Xc=Ee("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Ip=Ee("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Tp=Ee("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),Ap=Ee("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),si=Ee("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),ln=Ee("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),cn=Ee("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const MS=O.createContext({}),OS=O.forwardRef(function(t,e){[t,e]=W7(t,e,MS);let{toolbarProps:n}=function(s,a){const{"aria-label":i,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=O.useState(!1);$7(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=V7(),m=f==="rtl"&&d==="horizontal";let x=H7(a);const g=O.useRef(null);return{toolbarProps:{...ik(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":i,"aria-labelledby":i==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?x.focusPrevious():x.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?x.focusFirst():x.focusLast())):void 0;m?x.focusNext():x.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=a.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=q7({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=ik(t);return delete r.id,G.createElement("div",{...Of(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function ai(t,e){const n=+ur(t)-+ur(e);return n<0?-1:n>0?1:n}function DS(t,e){const n=ur(t,e==null?void 0:e.in);return+function(o,r){const s=ur(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=ur(o,r==null?void 0:r.in),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s}(n,e)}function PS(t,e,n){const[o,r,s]=Df(n==null?void 0:n.in,t,t,e),a=ai(r,s),i=Math.abs(function(u,h,f){const[m,x]=Df(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-x.getFullYear())+(m.getMonth()-x.getMonth())}(r,s));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=ai(r,s)===-a;DS(o)&&i===1&&ai(o,s)===1&&(l=!1);const d=a*(i-+l);return d===0?0:d}function RS(t,e,n){const o=function(r,s){return+ur(r)-+ur(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function LS(t,e){return function(n,o,r){const s=Y7(),a=(r==null?void 0:r.locale)??s.locale??K7,i=ai(n,o);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:i}),[d,u]=Df(r==null?void 0:r.in,...i>0?[o,n]:[n,o]),h=RS(u,d),f=(lk(u)-lk(d))/1e3,m=Math.round((h-f)/60);let x;if(m<2)return m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<ck){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}if(m<2520)return a.formatDistance("xDays",1,l);if(m<Rl){const g=Math.round(m/ck);return a.formatDistance("xDays",g,l)}if(m<2*Rl)return x=Math.round(m/Rl),a.formatDistance("aboutXMonths",x,l);if(x=PS(u,d),x<12){const g=Math.round(m/Rl);return a.formatDistance("xMonths",g,l)}{const g=x%12,p=Math.trunc(x/12);return g<3?a.formatDistance("aboutXYears",p,l):g<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}(t,function(n){return G7(n,Date.now())}(t),e)}const ii="https://static.marimo.app",FS=t=>{const e=H.c(24),{onClose:n}=t,[o,r]=O.useState("");let s;s=Math.random().toString(36).slice(2,6);const a=`${o}-${s}`,i=`${ii}/static/${a}`;let l,d,u,h,f,m,x,g,p,b,y;return e[0]!==n||e[1]!==a?(l=async v=>{v.preventDefault(),n();const w=await X7({download:!1,includeCode:!0,files:pS.INSTANCE.filenames()}),S=Xe({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ii}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:a})}).catch(()=>{S.dismiss(),Xe({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:On.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),Xe({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(zo,{children:"Share static notebook"}),e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs(ss,{children:[d,c.jsxs(as,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:ii,target:"_blank",children:ii}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=v=>{const w=v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(w)},e[5]=h):h=e[5],e[6]!==o?(f=c.jsx(Bo,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==i?(m=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(zS,{text:i}),c.jsx("span",{className:"text-primary",children:i})]})]}),e[8]=i,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=x):x=e[12],e[13]!==n?(g=c.jsx(ke,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==i?(p=c.jsx(ke,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await on(i)},children:"Create"}),e[15]=i,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==x?(y=c.jsx(Uo,{className:"w-fit",children:c.jsxs("form",{onSubmit:l,children:[u,x,b]})}),e[20]=b,e[21]=l,e[22]=x,e[23]=y):y=e[23],y},zS=t=>{const e=H.c(8),[n,o]=G.useState(!1);let r;e[0]!==t.text?(r=Dn.stopPropagation(async d=>{d.preventDefault(),await on(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let a,i,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(ja,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsx(ke,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:a}),e[3]=s,e[4]=i):i=e[4],e[5]!==n||e[6]!==i?(l=c.jsx(Ce,{content:"Copied!",open:n,children:i}),e[5]=n,e[6]=i,e[7]=l):l=e[7],l};function Mp(){const t=H.c(2),e=St(Pf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const a of Array.from(o)){const i=a.getBoundingClientRect();if(i.top>=0&&i.top<=r||i.bottom>=0&&i.bottom<=r){s=Rf.parse(a.parentNode.id);break}}e(a=>({mode:J7(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(Rf.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function Jc(t){const e=H.c(3),n=Es();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],ze(o)}function Op(){const t=H.c(2),e=Es();let n;return t[0]!==e?(n=()=>e(dk(mn())),t[0]=e,t[1]=n):n=t[1],ze(n)}function Es(){const t=H.c(2),{prepareForRun:e}=it();let n;return t[0]!==e?(n=async o=>{var i,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=mn(),a=[];for(const d of o){const u=r[d],h=(i=u==null?void 0:u.current)==null?void 0:i.editorView;let f;h?(uk(h)!=="markdown"&&Lf(h),f=hk(h)):f=((l=s[d])==null?void 0:l.code)||"",a.push(f),e({cellId:d})}await Q7({cellIds:o,codes:a}).catch(BS)},t[0]=e,t[1]=n):n=t[1],ze(n)}function BS(t){ft.error(t)}const Zc=[{type:"files",Icon:Qm,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Ll,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:$o,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:oi,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ss,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Yc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Fl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:Kc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Ff,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:PR,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:kp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:rp,tooltip:"Secrets",hidden:Zt(),position:"sidebar"},{type:"scratchpad",Icon:e9,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Ea,tooltip:"View errors",position:"footer"}];function US(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(a,i){const l=H.c(11);let d;l[0]!==i?(d=new t9(i),l[0]=i,l[1]=d):d=l[1];const u=d;let h;l[2]!==a||l[3]!==u?(h=()=>u.get(a),l[2]=a,l[3]=u,l[4]=h):h=l[4];const[f,m]=O.useState(h);let x;l[5]!==a||l[6]!==u?(x=b=>{m(b),u.set(a,b)},l[5]=a,l[6]=u,l[7]=x):x=l[7];const g=x;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=a=>{const i=(l=[a,...n],[...new Set(l)]);var l;o(i.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Dp(t){return t.dropdown!==void 0}function li(t,e=""){return t.flatMap(n=>n.label?Dp(n)?li(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const _s=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=G.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[a,i]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let d,u;return e[2]!==i||e[3]!==l?(d=c.jsx("div",{className:l,children:i}),e[2]=i,e[3]=l,e[4]=d):d=e[4],e[5]!==a||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[a,d]}),e[5]=a,e[6]=d,e[7]=u):u=e[7],u},Is=yt(null),$S=yt(!1),Qc=pk("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),VS=yt(t=>{const e=t(Qc);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(Qc,o=>({...o,activeChatId:n}))});function Pp(t){return t!==gk&&!!(t&&t.trim().length>0)}const ci=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=i=>{var l;(i.ctrlKey||i.metaKey)&&i.key==="z"&&(i.preventDefault(),i.stopPropagation(),(l=t.onClick)==null||l.call(t,i))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],zl(window,"keydown",n,o);const r=t.children??"Undo";let s,a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(n9,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(a=c.jsxs(ke,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=a):a=e[6],a};function di(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(et.get(Bl))return;const{cellId:s}=r,a=et.get(Pn),i=(((l=a.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),xk({cellId:s}).catch(()=>{n()}),!i){const{dismiss:d}=Xe({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(ci,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=d}},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function ui(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=async r=>{if(et.get(Bl))return;const{cellIds:s}=r;for(const l of s)await xk({cellId:l}).then(()=>{e({cellId:l})});const{dismiss:a}=Xe({title:"Cells deleted",action:c.jsx(ci,{"data-testid":"undo-delete-button",onClick:()=>{for(const l of s)n();i()}})}),i=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function Rp(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=_a(r.cellId);if(!s)return;const a=hk(s);e(r);const{dismiss:i}=Xe({title:"Cell split",action:c.jsx(ci,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:a}),l()},children:"Undo"})}),l=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],ze(o)}function ed(t){const e=H.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:a,sendToTop:i,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=it(),h=Rp(),f=Jc(n==null?void 0:n.cellId),m=!Ie(Bl),x=di(),{openModal:g}=Nn(),p=St(Is),b=Ie(Ul),y=Ie($l),v=Ie(is),w=Ie(o9);if(!n||v){let E;return e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0],E}const{cellId:S,config:N,getEditorView:C,name:j,hasOutput:_,hasConsoleOutput:A,status:T}=n;let P;e[1]!==S||e[2]!==N.disabled||e[3]!==r?(P=async()=>{const E={disabled:!N.disabled};await Vo({configs:{[S]:E}}),r({cellId:S,config:E})},e[1]=S,e[2]=N.disabled,e[3]=r,e[4]=P):P=e[4];const L=P;let M;e[5]!==S||e[6]!==N.hide_code||e[7]!==C||e[8]!==r?(M=async()=>{const E={hide_code:!N.hide_code};await Vo({configs:{[S]:E}}),r({cellId:S,config:E});const U=C();U&&(E.hide_code?U.contentDOM.blur():U.focus())},e[5]=S,e[6]=N.hide_code,e[7]=C,e[8]=r,e[9]=M):M=e[9];const R=M;let z,D,I,k,B;return e[10]===Symbol.for("react.memo_cache_sentinel")?(z=c.jsx(_p,{size:13,strokeWidth:1.5}),e[10]=z):z=e[10],e[11]!==S||e[12]!==j||e[13]!==g||e[14]!==s?(D=()=>{g(c.jsxs(Uo,{children:[c.jsx(ss,{children:c.jsx(zo,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(fr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(gS,{placeholder:"cell name",value:j,onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),E.stopPropagation(),g(null))},onChange:E=>s({cellId:S,name:E})})]})]}))},e[11]=S,e[12]=j,e[13]=g,e[14]=s,e[15]=D):D=e[15],e[16]!==S||e[17]!==s?(I=E=>s({cellId:S,name:E}),e[16]=S,e[17]=s,e[18]=I):I=e[18],e[19]!==j||e[20]!==I?(k=c.jsx(gS,{placeholder:"cell name",value:j,onChange:I}),e[19]=j,e[20]=I,e[21]=k):k=e[21],e[22]!==d||e[23]!==b||e[24]!==w||e[25]!==y||e[26]!==m||e[27]!==S||e[28]!==u||e[29]!==N.disabled||e[30]!==N.hide_code||e[31]!==o||e[32]!==x||e[33]!==C||e[34]!==A||e[35]!==_||e[36]!==a||e[37]!==j||e[38]!==f||e[39]!==l||e[40]!==i||e[41]!==p||e[42]!==h||e[43]!==T||e[44]!==D||e[45]!==k||e[46]!==L||e[47]!==R?(B=[[{icon:z,label:"Name",disableClick:!0,handle:GS,handleHeadless:D,rightElement:k},{icon:c.jsx(kr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:T==="running"||T==="queued"||T==="disabled-transitively"||N.disabled,handle:()=>f()},{icon:c.jsx(Ia,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(E=>(E==null?void 0:E.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:c.jsx(Gc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:S})},{icon:c.jsx(Dm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!_,handle:()=>function(E){const U=document.getElementById(fk.create(E));U&&(U.classList.add("printing-output"),mk(U,"result.png").finally(()=>{U.classList.remove("printing-output")}))}(S)},{icon:c.jsx(yk,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const E=C();E&&bk({[S]:E})}},{icon:N.hide_code?c.jsx(zf,{size:13,strokeWidth:1.5}):c.jsx(Bf,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:R,hotkey:"cell.hideCode"},{icon:N.disabled?c.jsx(ln,{size:13,strokeWidth:1.5}):c.jsx(cn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(Uf,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:L}),handle:L},{icon:c.jsx(Ea,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(_||A),handle:()=>{u({cellId:S})}}],[{icon:c.jsx(Vl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const E=C();E&&(qn({autoInstantiate:y,createNewCell:o}),hr(E,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx($o,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const E=C();E&&(qn({autoInstantiate:y,createNewCell:o}),hr(E,{language:"sql",keepCodeAsIs:!1}))}},{icon:c.jsx(Hl,{}),label:"Toggle as Python",handle:()=>{const E=C();E&&(qn({autoInstantiate:y,createNewCell:o}),r9(E,"python",{force:!0}))}}],[{icon:c.jsxs(_s,{children:[c.jsx(ei,{size:13,strokeWidth:1.5}),c.jsx(Wl,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:c.jsxs(_s,{children:[c.jsx(ei,{size:13,strokeWidth:1.5}),c.jsx(vo,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:c.jsx(Wl,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>a({cellId:S,before:!0})},{icon:c.jsx(vo,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>a({cellId:S,before:!1})},{icon:c.jsx(vk,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>a({cellId:S,direction:"left"}),hidden:w!=="columns"},{icon:c.jsx(Ta,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>a({cellId:S,direction:"right"}),hidden:w!=="columns"},{icon:c.jsx(Lc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>i({cellId:S,scroll:!1})},{icon:c.jsx(Rc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S,scroll:!1})},{icon:c.jsx(s9,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>d({cellId:S})}],[{icon:c.jsx(cS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Pp(j),tooltip:Pp(j)?void 0:"Only named cells can be linked to",handle:async()=>{await on(function(E){const U=new URL(window.location.href);return U.hash=`scrollTo=${encodeURIComponent(E)}`,U.toString()}(j)),Xe({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(ql,{size:13,strokeWidth:1.5}),handle:()=>{x({cellId:S})}}]].map(WS).filter(HS),e[22]=d,e[23]=b,e[24]=w,e[25]=y,e[26]=m,e[27]=S,e[28]=u,e[29]=N.disabled,e[30]=N.hide_code,e[31]=o,e[32]=x,e[33]=C,e[34]=A,e[35]=_,e[36]=a,e[37]=j,e[38]=f,e[39]=l,e[40]=i,e[41]=p,e[42]=h,e[43]=T,e[44]=D,e[45]=k,e[46]=L,e[47]=R,e[48]=B):B=e[48],B}function HS(t){return t.length>0}function WS(t){return t.filter(qS)}function qS(t){return!t.hidden}function GS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function YS(t){return!t.hidden}const td=yt(!1),Lp=()=>{const t=H.c(37),[e,n]=Ot(td),o=i9(),r=Ie(l9),s=Ie(Gl);let a;t[0]!==r?(a={cell:r},t[0]=r,t[1]=a):a=t[1];let i=ed(a).flat();i=li(i);const l=function(){const I=H.c(73),[k,B]=mr(),[E,U]=wk();let V;I[0]!==B?(V=async Y=>{await pr({config:Y}).then(()=>{B(Y)})},I[0]=B,I[1]=V):V=I[1];const $=V;let K;I[2]!==U?(K=async Y=>{await a9({config:Y}).then(()=>{U(Y)})},I[2]=U,I[3]=K):K=I[3];const X=K;let J;if(I[4]!==E||I[5]!==k||I[6]!==X||I[7]!==$){let Y,oe,se,re,ae;I[9]!==E?(Y=Me=>Me!==E.width,I[9]=E,I[10]=Y):Y=I[10],I[11]!==E||I[12]!==X?(oe=Me=>({label:`App config > Set width=${Me}`,handle:()=>{X({...E,width:Me})}}),I[11]=E,I[12]=X,I[13]=oe):oe=I[13],I[14]!==k||I[15]!==$?(se={label:"Config > Set theme: dark",handle:()=>{$({...k,display:{...k.display,theme:"dark"}})}},I[14]=k,I[15]=$,I[16]=se):se=I[16],I[17]!==k||I[18]!==$?(re={label:"Config > Set theme: light",handle:()=>{$({...k,display:{...k.display,theme:"light"}})}},I[17]=k,I[18]=$,I[19]=re):re=I[19],I[20]!==k||I[21]!==$?(ae={label:"Config > Set theme: system",handle:()=>{$({...k,display:{...k.display,theme:"system"}})}},I[20]=k,I[21]=$,I[22]=ae):ae=I[22];const te=k.keymap.preset==="vim";let be,ye;I[23]!==k||I[24]!==$?(be=()=>{$({...k,keymap:{...k.keymap,preset:"vim"}})},I[23]=k,I[24]=$,I[25]=be):be=I[25],I[26]!==te||I[27]!==be?(ye={label:"Config > Switch keymap to VIM",hidden:te,handle:be},I[26]=te,I[27]=be,I[28]=ye):ye=I[28];const ie=k.keymap.preset==="default";let ve,he,Se;I[29]!==k||I[30]!==$?(ve=()=>{$({...k,keymap:{...k.keymap,preset:"default"}})},I[29]=k,I[30]=$,I[31]=ve):ve=I[31],I[32]!==ie||I[33]!==ve?(he={label:"Config > Switch keymap to default (current: VIM)",hidden:ie,handle:ve},I[32]=ie,I[33]=ve,I[34]=he):he=I[34],I[35]!==k||I[36]!==$?(Se=()=>{$({...k,completion:{...k.completion,copilot:!1}})},I[35]=k,I[36]=$,I[37]=Se):Se=I[37];const De=k.completion.copilot!=="github";let _e,Fe;I[38]!==Se||I[39]!==De?(_e={label:"Config > Disable GitHub Copilot",handle:Se,hidden:De},I[38]=Se,I[39]=De,I[40]=_e):_e=I[40],I[41]!==k||I[42]!==$?(Fe=()=>{$({...k,completion:{...k.completion,copilot:"github"}})},I[41]=k,I[42]=$,I[43]=Fe):Fe=I[43];const Oe=k.completion.copilot==="github";let Qe;I[44]!==Fe||I[45]!==Oe?(Qe={label:"Config > Enable GitHub Copilot",handle:Fe,hidden:Oe},I[44]=Fe,I[45]=Oe,I[46]=Qe):Qe=I[46];const qe=!k.display.reference_highlighting;let Ke,Q,xe,we;I[47]!==k||I[48]!==$?(Ke=()=>{$({...k,display:{...k.display,reference_highlighting:!1}})},I[47]=k,I[48]=$,I[49]=Ke):Ke=I[49],I[50]!==qe||I[51]!==Ke?(Q={label:"Config > Disable reference highlighting",hidden:qe,handle:Ke},I[50]=qe,I[51]=Ke,I[52]=Q):Q=I[52],I[53]!==k||I[54]!==$?(xe=()=>{$({...k,display:{...k.display,reference_highlighting:!0}})},I[53]=k,I[54]=$,I[55]=xe):xe=I[55],I[56]!==k.display.reference_highlighting||I[57]!==xe?(we={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:xe},I[56]=k.display.reference_highlighting,I[57]=xe,I[58]=we):we=I[58];const Te=k.display.cell_output==="above";let W,ne;I[59]!==k||I[60]!==$?(W=()=>{$({...k,display:{...k.display,cell_output:"above"}})},I[59]=k,I[60]=$,I[61]=W):W=I[61],I[62]!==Te||I[63]!==W?(ne={label:"Config > Set cell output area: above",hidden:Te,handle:W},I[62]=Te,I[63]=W,I[64]=ne):ne=I[64];const ue=k.display.cell_output==="below";let de,ge;I[65]!==k||I[66]!==$?(de=()=>{$({...k,display:{...k.display,cell_output:"below"}})},I[65]=k,I[66]=$,I[67]=de):de=I[67],I[68]!==ue||I[69]!==de?(ge={label:"Config > Set cell output area: below",hidden:ue,handle:de},I[68]=ue,I[69]=de,I[70]=ge):ge=I[70],J=[...RR().filter(Y).map(oe),se,re,ae,ye,he,_e,Qe,Q,we,ne,ge],I[4]=E,I[5]=k,I[6]=X,I[7]=$,I[8]=J}else J=I[8];const ee=J;let q;return I[71]!==ee?(q=ee.filter(YS),I[71]=ee,I[72]=q):q=I[72],q}();let d=fg();d=[...li(d),...li(l)];const u=d.filter(KS),h=Yl.keyBy(u,XS),{recentCommands:f,addRecentCommand:m}=US();let x;t[2]!==f?(x=new Set(f),t[2]=f,t[3]=x):x=t[3];const g=x;let p,b;t[4]!==s||t[5]!==n?(p=I=>{Hf(s.getHotkey("global.commandPalette").key)(I)&&(I.preventDefault(),n(JS))},t[4]=s,t[5]=n,t[6]=p):p=t[6],zl(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(I,k)=>{const B=o[I];if(!B)return null;const E=s.getHotkey(I);return c.jsxs(Gn,{disabled:k.disabled,onSelect:()=>{m(I),n(!1),requestAnimationFrame(()=>{B()})},value:E.name,children:[c.jsxs("span",{children:[E.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(Sk,{children:c.jsx(Wf,{shortcut:E.key})})]},I)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=I=>{const{label:k,handle:B,props:E,hotkey:U}=I,V=E===void 0?{}:E;return c.jsxs(Gn,{disabled:V.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[c.jsxs("span",{children:[k,V.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",V.tooltip,")"]})]}),U&&c.jsx(Sk,{children:c.jsx(Wf,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,S=d9;let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(Aa,{placeholder:"Type to search..."}),t[16]=N):N=t[16];const C=Vf;let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsx(Kl,{children:"No results found."}),t[17]=j):j=t[17];const _=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx($f,{heading:"Recently Used",children:f.map(I=>{const k=h[I];return c9(I)?y(I,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!Dp(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(kk,{})]}),A=$f,T=s.iterate().map(I=>{if(g.has(I))return null;const k=h[I];return y(I,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),P=u.map(I=>g.has(I.label)?null:w({label:I.label,handle:I.handleHeadless||I.handle,props:{disabled:I.disabled,tooltip:I.tooltip}}));let L;t[18]!==g||t[19]!==w?(L=I=>g.has(I.label)?null:w({label:`Cell > ${I.label}`,handle:I.handleHeadless||I.handle,props:{disabled:I.disabled,tooltip:I.tooltip}}),t[18]=g,t[19]=w,t[20]=L):L=t[20];const M=i.map(L);let R,z,D;return t[21]!==A||t[22]!==P||t[23]!==M||t[24]!==T?(R=c.jsxs(A,{heading:"Commands",children:[T,P,M]}),t[21]=A,t[22]=P,t[23]=M,t[24]=T,t[25]=R):R=t[25],t[26]!==C||t[27]!==R||t[28]!==j||t[29]!==_?(z=c.jsxs(C,{children:[j,_,R]}),t[26]=C,t[27]=R,t[28]=j,t[29]=_,t[30]=z):z=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==z||t[35]!==N?(D=c.jsxs(S,{open:e,onOpenChange:n,children:[N,z]}),t[31]=S,t[32]=e,t[33]=n,t[34]=z,t[35]=N,t[36]=D):D=t[36],D};function KS(t){return!t.hotkey}function XS(t){return t.label}function JS(t){return!t}function Qo(){return st().optional().describe(Be.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Fp(){return st().optional().describe(Be.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function hi(){return st().optional().describe(Be.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function zp(){return st().optional().describe(Be.of({label:"URI",optionRegex:".*uri.*"}))}function er(){return st().nonempty().describe(Be.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function Xn(){return st().describe(Be.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function tr(){return st().nonempty().describe(Be.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function nr(t){const e=u9.string().describe(Be.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function Bp(){return ls().default(!1).describe(Be.of({label:"Read Only"}))}const Up=dt({type:mt("postgres"),host:er(),port:nr(5432).optional(),database:Xn(),username:tr(),password:Qo(),ssl:ls().default(!1).describe(Be.of({label:"Use SSL"}))}).describe(Be.of({direction:"two-columns"})),$p=dt({type:mt("mysql"),host:er(),port:nr(3306),database:Xn(),username:tr(),password:Qo(),ssl:ls().default(!1).describe(Be.of({label:"Use SSL"}))}).describe(Be.of({direction:"two-columns"})),Vp=dt({type:mt("sqlite"),database:Xn().describe(Be.of({label:"Database Path"}))}).describe(Be.of({direction:"two-columns"})),Hp=dt({type:mt("duckdb"),database:Xn().describe(Be.of({label:"Database Path"})),read_only:Bp()}).describe(Be.of({direction:"two-columns"})),Wp=dt({type:mt("motherduck"),database:Xn().default("my_db").describe(Be.of({label:"Database Name"})),token:Fp()}).describe(Be.of({direction:"two-columns"})),qp=dt({type:mt("snowflake"),account:st().nonempty().describe(Be.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:st().optional().describe(Be.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:Xn(),schema:st().optional().describe(Be.of({label:"Schema",optionRegex:".*snowflake.*"})),username:tr(),password:Qo(),role:st().optional().describe(Be.of({label:"Role"}))}).describe(Be.of({direction:"two-columns"})),Gp=dt({type:mt("bigquery"),project:st().nonempty().describe(Be.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:st().nonempty().describe(Be.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:st().describe(Be.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Be.of({direction:"two-columns"})),Yp=dt({type:mt("clickhouse_connect"),host:er(),port:nr(8123).optional(),username:tr(),password:Qo(),secure:ls().default(!1).describe(Be.of({label:"Use HTTPs"}))}).describe(Be.of({direction:"two-columns"})),Kp=dt({type:mt("timeplus"),host:er().default("localhost"),port:nr(8123).optional(),username:tr().default("default"),password:Qo().default("")}).describe(Be.of({direction:"two-columns"})),Xp=dt({type:mt("chdb"),database:Xn().describe(Be.of({label:"Database Path"})),read_only:Bp()}).describe(Be.of({direction:"two-columns"})),Jp=dt({type:mt("trino"),host:er(),port:nr(8080),database:Xn(),schema:st().describe(Be.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:tr(),password:Qo(),async_support:ls().default(!1).describe(Be.of({label:"Async Support"}))}).describe(Be.of({direction:"two-columns"})),Zp=dt({type:mt("iceberg"),name:st().describe(Be.of({label:"Catalog Name"})),catalog:qf("type",[dt({type:mt("REST"),warehouse:hi(),uri:st().optional().describe(Be.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Fp()}),dt({type:mt("SQL"),warehouse:hi(),uri:st().optional().describe(Be.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),dt({type:mt("Hive"),warehouse:hi(),uri:zp()}),dt({type:mt("Glue"),warehouse:hi(),uri:zp()}),dt({type:mt("DynamoDB"),"dynamodb.profile-name":st().optional().describe(Be.of({label:"Profile Name"})),"dynamodb.region":st().optional().describe(Be.of({label:"Region"})),"dynamodb.access-key-id":st().optional().describe(Be.of({label:"Access Key ID"})),"dynamodb.secret-access-key":st().optional().describe(Be.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":st().optional().describe(Be.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Be.of({special:"tabs"}))}),Qp=dt({type:mt("datafusion"),sessionContext:ls().optional().describe(Be.of({label:"Use Session Context"}))}),eg=dt({type:mt("pyspark"),host:er().optional(),port:nr().optional()}),tg=dt({type:mt("redshift"),host:er(),port:nr(5439),connectionType:qf("type",[dt({type:mt("IAM credentials"),region:st().describe(Be.of({label:"Region"})),aws_access_key_id:st().nonempty().describe(Be.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:st().nonempty().describe(Be.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:st().optional().describe(Be.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),dt({type:mt("DB credentials"),user:tr(),password:Qo()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:Xn()}).describe(Be.of({direction:"two-columns"})),ZS=qf("type",[Up,$p,Vp,Hp,Wp,qp,Gp,Yp,Kp,Xp,Jp,Zp,Qp,eg,tg]),nd="env:";function fi(t){return typeof t=="string"&&t.startsWith(nd)}function od(t){return`${nd}${t}`}const ng={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class qt{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class QS{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),fi(n)){const r=n.replace(nd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Nr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Nr(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return fi(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
- `)}}class eN extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),a=this.secrets.printInFString("database",this.connection.database);return pt(`
4
- DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${a}"
5
- engine = ${this.orm}.create_engine(DATABASE_URL${e})
6
- `)}}class tN extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'ssl': {'ssl-mode': 'preferred'}}":"",n=this.secrets.printPassword(this.connection.password,"MYSQL_PASSWORD",!0),o=this.secrets.printInFString("database",this.connection.database),r=this.secrets.printInFString("username",this.connection.username),s=this.secrets.printInFString("host",this.connection.host),a=this.secrets.printInFString("port",this.connection.port);return pt(`
7
- DATABASE_URL = f"mysql+pymysql://${r}:${n}@${s}:${a}/${o}"
8
- engine = ${this.orm}.create_engine(DATABASE_URL${e})
9
- `)}}class nN extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.database?this.secrets.printInFString("database",this.connection.database):"",n=e.startsWith("{")&&e.endsWith("}")?`DATABASE_URL = f"sqlite:///${e}"`:`DATABASE_URL = "sqlite:///${e}"`;return pt(`
10
- ${n}
11
- engine = ${this.orm}.create_engine(DATABASE_URL)
12
- `)}}class oN extends qt{generateImports(){return["from snowflake.sqlalchemy import URL"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"SNOWFLAKE_PASSWORD",!1),n={account:this.secrets.print("account",this.connection.account),user:this.secrets.print("user",this.connection.username),database:this.secrets.print("database",this.connection.database),warehouse:this.connection.warehouse?this.secrets.print("warehouse",this.connection.warehouse):void 0,schema:this.connection.schema?this.secrets.print("schema",this.connection.schema):void 0,role:this.connection.role?this.secrets.print("role",this.connection.role):void 0,password:e};return pt(`
13
- engine = ${this.orm}.create_engine(
14
- URL(
15
- ${mi(n,o=>` ${o}`)},
16
- )
17
- )
18
- `)}}class rN extends qt{generateImports(){return["import json"]}generateConnectionCode(){const e=this.secrets.printInFString("project",this.connection.project),n=this.secrets.printInFString("dataset",this.connection.dataset);return pt(`
19
- credentials = json.loads("""${this.connection.credentials_json}""")
20
- engine = ${this.orm}.create_engine(f"bigquery://${e}/${n}", credentials_info=credentials)
21
- `)}}class sN extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database||":memory:");return pt(`
22
- DATABASE_URL = "${e}"
23
- engine = ${this.orm}.connect(DATABASE_URL, read_only=${Nr(this.connection.read_only)})
24
- `)}}class aN extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database);if(!this.connection.token)return pt(`
25
- conn = duckdb.connect("md:${e}")
26
- `);const n=this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1);return pt(`
27
- conn = duckdb.connect("md:${e}", config={"motherduck_token": ${n}})
28
- `)}}class iN extends qt{generateImports(){return["import clickhouse_connect"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"CLICKHOUSE_PASSWORD",!1),n={host:this.secrets.print("host",this.connection.host),user:this.secrets.print("user",this.connection.username),secure:this.secrets.print("secure",this.connection.secure),port:this.connection.port?this.secrets.print("port",this.connection.port):void 0,password:this.connection.password?e:void 0};return pt(`
29
- engine = ${this.orm}.get_client(
30
- ${mi(n,o=>` ${o}`)},
31
- )
32
- `)}}class lN extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"TIMEPLUS_PASSWORD",!0),n=this.secrets.printInFString("username",this.connection.username),o=this.secrets.printInFString("host",this.connection.host),r=this.secrets.printInFString("port",this.connection.port);return pt(`
33
- DATABASE_URL = f"timeplus://${n}:${e}@${o}:${r}"
34
- engine = ${this.orm}.create_engine(DATABASE_URL)
35
- `)}}class cN extends qt{generateImports(){return["import chdb"]}generateConnectionCode(){const e=this.secrets.print("database",this.connection.database)||'""';return pt(`
36
- engine = ${this.orm}.connect(${e}, read_only=${Nr(this.connection.read_only)})
37
- `)}}class dN extends qt{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){const e=this.connection.async_support?"aiotrino":"trino",n=this.connection.schema?`/${this.connection.schema}`:"",o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),a=this.secrets.printInFString("database",this.connection.database),i=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return pt(`
38
- engine = ${this.orm}.create_engine(f"${e}://${o}:${i}@${r}:${s}/${a}${n}")
39
- `)}}class uN extends qt{generateImports(){switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:Gf(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([a,i])=>i!=null&&i!==""&&a!=="type"));for(const[a,i]of Object.entries(e))fi(i)?e[a]=this.secrets.print(a,i):typeof i=="string"&&(e[a]=`"${i}"`);const n=(o=e,r=a=>` ${a}`,Object.entries(o).filter(([,a])=>a!=null&&a!=="").map(([a,i])=>{const l=`"${a}"`;return r(typeof i=="boolean"?`${l}: ${Nr(i)}`:`${l}: ${i}`)}).join(`,
40
- `));var o,r;const s=`"${this.connection.name}"`;switch(this.connection.catalog.type){case"REST":return pt(`
41
- catalog = RestCatalog(
42
- ${s},
43
- **{
44
- ${n}
45
- },
46
- )
47
- `);case"SQL":return pt(`
48
- catalog = SqlCatalog(
49
- ${s},
50
- **{
51
- ${n}
52
- },
53
- )
54
- `);case"Hive":return pt(`
55
- catalog = HiveCatalog(
56
- ${s},
57
- **{
58
- ${n}
59
- },
60
- )
61
- `);case"Glue":return pt(`
62
- catalog = GlueCatalog(
63
- ${s},
64
- **{
65
- ${n}
66
- },
67
- )
68
- `);case"DynamoDB":return pt(`
69
- catalog = DynamoDBCatalog(
70
- ${s},
71
- **{
72
- ${n}
73
- },
74
- )
75
- `);default:Gf(this.connection.catalog)}}}class hN extends qt{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?pt(`
76
- ctx = SessionContext()
77
- # Sample table
78
- _ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
79
-
80
- con = ibis.datafusion.connect(ctx)
81
- `):pt(`
82
- con = ibis.datafusion.connect()
83
- `)}}class fN extends qt{generateImports(){return["import ibis","from pyspark.sql import SparkSession"]}generateConnectionCode(){if(this.connection.host||this.connection.port){const e=this.secrets.printInFString("host",this.connection.host),n=this.secrets.printInFString("port",this.connection.port);return pt(`
84
- session = SparkSession.builder.remote(f"sc://${e}:${n}").getOrCreate()
85
- con = ibis.pyspark.connect(session)
86
- `)}return pt(`
87
- con = ibis.pyspark.connect()
88
- `)}}class mN extends qt{generateImports(){return["import redshift_connector"]}generateConnectionCode(){const e=this.secrets.print("host",this.connection.host),n=this.secrets.print("port",this.connection.port),o=this.secrets.print("database",this.connection.database);if(this.connection.connectionType.type==="IAM credentials"){const i=this.secrets.print("aws_access_key_id",this.connection.connectionType.aws_access_key_id),l=this.secrets.print("aws_secret_access_key",this.connection.connectionType.aws_secret_access_key),d=this.connection.connectionType.aws_session_token?this.secrets.print("aws_session_token",this.connection.connectionType.aws_session_token):void 0,u={iam:!0,host:e,port:n,region:`"${this.connection.connectionType.region}"`,database:o,access_key_id:i,secret_access_key:l,...d&&{session_token:d}};return pt(`
89
- con = redshift_connector.connect(
90
- ${mi(u,h=>` ${h}`)},
91
- )
92
- `)}const r=this.connection.connectionType.user?this.secrets.print("user",this.connection.connectionType.user):void 0,s=this.connection.connectionType.password?this.secrets.printPassword(this.connection.connectionType.password,"REDSHIFT_PASSWORD",!1):void 0,a={host:e,port:n,database:o,...r&&{user:r},...s&&{password:s}};return pt(`
93
- con = redshift_connector.connect(
94
- ${mi(a,i=>` ${i}`)},
95
- )
96
- `)}}class pN{constructor(){this.secrets=new QS}createGenerator(e,n){switch(e.type){case"postgres":return new eN(e,n,this.secrets);case"mysql":return new tN(e,n,this.secrets);case"sqlite":return new nN(e,n,this.secrets);case"snowflake":return new oN(e,n,this.secrets);case"bigquery":return new rN(e,n,this.secrets);case"duckdb":return new sN(e,n,this.secrets);case"motherduck":return new aN(e,n,this.secrets);case"clickhouse_connect":return new iN(e,n,this.secrets);case"timeplus":return new lN(e,n,this.secrets);case"chdb":return new cN(e,n,this.secrets);case"trino":return new dN(e,n,this.secrets);case"iceberg":return new uN(e,n,this.secrets);case"datafusion":return new hN(e,n,this.secrets);case"pyspark":return new fN(e,n,this.secrets);case"redshift":return new mN(e,n,this.secrets);default:Gf(e)}}}function Nr(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function mi(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${Nr(o)}`:`${n}=${o}`)).join(`,
97
- `)}function og(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const rg=t=>{const e=H.c(42),{providerNames:n,onClose:o,onSuccess:r}=t,[s,a]=G.useState(""),[i,l]=G.useState(""),[d,u]=G.useState(n[0]);let h;e[0]!==s||e[1]!==d||e[2]!==r||e[3]!==i?(h=async D=>{if(D.preventDefault(),d)if(s&&i&&d)try{await h9({key:s,value:i,provider:"dotenv",name:d}),Xe({title:"Secret created",description:"The secret has been created successfully."}),r(s)}catch{Xe({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else Xe({title:"Error",description:"Please fill in all fields.",variant:"danger"});else Xe({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=s,e[1]=d,e[2]=r,e[3]=i,e[4]=h):h=e[4];const f=h;let m,x,g,p,b,y,v,w,S,N,C,j,_,A,T,P;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsxs(ss,{children:[c.jsx(zo,{children:"Add Secret"}),c.jsx(as,{children:"Add a new secret to your environment variables."})]}),e[5]=m):m=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(fr,{htmlFor:"key",children:"Key"}),e[6]=x):x=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=D=>{a(D.target.value.replaceAll(/\W/g,"_"))},e[7]=g):g=e[7],e[8]!==s?(p=c.jsxs("div",{className:"grid gap-2",children:[x,c.jsx(Bo,{id:"key",value:s,onChange:g,placeholder:"MY_SECRET_KEY",required:!0})]}),e[8]=s,e[9]=p):p=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(fr,{htmlFor:"value",children:"Value"}),e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=D=>l(D.target.value),e[11]=y):y=e[11],e[12]!==i?(v=c.jsx(Bo,{id:"value",type:"text",value:i,onChange:y,required:!0,autoComplete:"off"}),e[12]=i,e[13]=v):v=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(w=window.location.href.startsWith("http://")&&c.jsx(Nk,{children:"Note: You are sending this key over http."}),e[14]=w):w=e[14],e[15]!==v?(S=c.jsxs("div",{className:"grid gap-2",children:[b,v,w]}),e[15]=v,e[16]=S):S=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(fr,{htmlFor:"location",children:"Location"}),e[17]=N):N=e[17],e[18]!==n.length?(C=n.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[18]=n.length,e[19]=C):C=e[19],e[20]!==d||e[21]!==n?(j=n.length>0&&c.jsxs(Xl,{value:d,onValueChange:D=>u(D),children:[c.jsx(Jl,{children:c.jsx(Zl,{placeholder:"Select a provider"})}),c.jsx(Ql,{children:n.map(gN)})]}),e[20]=d,e[21]=n,e[22]=j):j=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsxs(Nk,{children:["You can configure the location by setting the"," ",c.jsx(Yf,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[23]=_):_=e[23],e[24]!==C||e[25]!==j?(A=c.jsxs("div",{className:"grid gap-2",children:[N,C,j,_]}),e[24]=C,e[25]=j,e[26]=A):A=e[26],e[27]!==S||e[28]!==A||e[29]!==p?(T=c.jsxs("div",{className:"grid gap-4 py-4",children:[p,S,A]}),e[27]=S,e[28]=A,e[29]=p,e[30]=T):T=e[30],e[31]!==o?(P=c.jsx(ke,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[31]=o,e[32]=P):P=e[32];const L=!s||!i||!d;let M,R,z;return e[33]!==L?(M=c.jsx(ke,{type:"submit",disabled:L,children:"Add Secret"}),e[33]=L,e[34]=M):M=e[34],e[35]!==P||e[36]!==M?(R=c.jsxs(Ca,{children:[P,M]}),e[35]=P,e[36]=M,e[37]=R):R=e[37],e[38]!==f||e[39]!==T||e[40]!==R?(z=c.jsx(Uo,{children:c.jsxs("form",{onSubmit:f,children:[m,T,R]})}),e[38]=f,e[39]=T,e[40]=R,e[41]=z):z=e[41],z};function gN(t){return c.jsx(Ma,{value:t,children:t},t)}const sg=O.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Cn.NOOP}),xN=t=>{const e=H.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,isPending:s,error:a,refetch:i}=jn(wN,o);let l,d,u,h;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(d=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=d):d=e[4],e[5]!==a||e[6]!==s||e[7]!==i||e[8]!==l||e[9]!==d?(u={secretKeys:l,providerNames:d,loading:s,error:a,refreshSecrets:i},e[5]=a,e[6]=s,e[7]=i,e[8]=l,e[9]=d,e[10]=u):u=e[10],e[11]!==n||e[12]!==u?(h=c.jsx(sg,{value:u,children:n}),e[11]=n,e[12]=u,e[13]=h):h=e[13],h};function bN(t){return t.provider!=="env"}function yN(t){return t.name}function vN(t){return t.keys}async function wN(){const t=await xS.request({}),e=og(t.secrets).filter(bN).map(yN);return{secretKeys:t.secrets.flatMap(vN).sort(),providerNames:e}}const ag=[{name:"PostgreSQL",schema:Up,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:$p,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:Vp,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:Hp,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:Wp,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:qp,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:Yp,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Kp,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:Gp,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:Xp,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:Jp,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:Qp,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:eg,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:tg,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],ig=[{name:"Iceberg",schema:Zp,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],kN=t=>{const e=H.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=h=>{const{name:f,schema:m,color:x,logo:g}=h;return c.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-smSolid hover:shadow-mdSolid",style:{backgroundColor:x},onClick:()=>n(m),children:[c.jsx(Dk,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),c.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,a,i,l,d,u;return e[2]!==r?(s=ag.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(a=c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",c.jsx("hr",{className:"flex-1"})]}),e[6]=i):i=e[6],e[7]!==r?(l=ig.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=d):d=e[10],e[11]!==a||e[12]!==d?(u=c.jsxs(c.Fragment,{children:[a,i,d]}),e[11]=a,e[12]=d,e[13]=u):u=e[13],u},SN=[{isMatch:t=>{if(t instanceof _k||t instanceof g9){const{optionRegex:e}=Be.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=O.use(sg),{openModal:a,closeModal:i}=Nn(),{label:l,description:d,optionRegex:u=""}=Be.parse(t._def.description||""),[h,f]=At(o,m=>new RegExp(u,"i").test(m));return c.jsx(Ck,{control:e.control,name:n,render:({field:m})=>c.jsxs(jk,{children:[c.jsx(f9,{children:l}),c.jsx(m9,{children:d}),c.jsx(Ek,{children:c.jsxs("div",{className:"flex gap-2",children:[t instanceof _k?c.jsx(Bo,{...m,value:m.value,onChange:m.onChange,className:me("flex-1")}):c.jsx(p9,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),c.jsxs(Ho,{children:[c.jsx(Wo,{asChild:!0,children:c.jsx(ke,{variant:"outline",size:"icon",className:me(fi(m.value)&&"bg-accent"),children:c.jsx($c,{className:"h-3 w-3"})})}),c.jsxs(qo,{align:"end",className:"max-h-60 overflow-y-auto",children:[c.jsxs(Dt,{onSelect:()=>{a(c.jsx(rg,{providerNames:r,onSuccess:x=>{s(),m.onChange(od(x)),i()},onClose:i}))},children:[c.jsx(ei,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),h.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsx(Ik,{children:"Recommended"})]}),h.map(x=>c.jsx(Dt,{onSelect:()=>m.onChange(od(x)),children:x},x)),f.length>0&&c.jsx(rn,{}),f.map(x=>c.jsx(Dt,{onSelect:()=>m.onChange(od(x)),children:x},x))]})]})]})}),c.jsx(Tk,{})]})})}}],NN=t=>{var B;const e=H.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,a,i;e[0]!==n?(s=x9(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(a=Ak(n),e[2]=n,e[3]=a):a=e[3],e[4]!==s||e[5]!==a?(i={defaultValues:s,resolver:a,reValidateMode:"onChange"},e[4]=s,e[5]=a,e[6]=i):i=e[6];const l=Mk(i),d=(B=[...ag,...ig].find(E=>E.schema===n))==null?void 0:B.connectionLibraries,[u,h]=O.useState((d==null?void 0:d.preferred)??"sqlalchemy"),{createNewCell:f}=it(),m=cs();let x;e[7]!==f||e[8]!==m?(x=E=>{f({code:E,before:!1,cellId:m??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=m,e[9]=x):x=e[9];const g=x;let p;e[10]!==g||e[11]!==o||e[12]!==u?(p=E=>{g(function(U,V){if(!(V in ng))throw new Error(`Unsupported library: ${V}`);ZS.parse(U);const $=new pN,K=$.createGenerator(U,V),X=K.generateConnectionCode(),J=$.secrets,ee=[...new Set([...J.imports,...K.imports])].sort();ee.push("");const q=J.formatSecrets();return q&&ee.push(q),ee.push(X.trim()),ee.join(`
98
- `)}(E,u)),o()},e[10]=g,e[11]=o,e[12]=u,e[13]=p):p=e[13];const b=p;let y;e[14]!==l||e[15]!==b?(y=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=y):y=e[16];let v,w;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(b9,{}),e[17]=v):v=e[17],e[18]!==l||e[19]!==n?(w=c.jsx(xN,{children:c.jsx(y9,{schema:n,form:l,renderers:SN,children:v})}),e[18]=l,e[19]=n,e[20]=w):w=e[20];let S;e[21]!==r?(S=c.jsx(ke,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=S):S=e[22];const N=!l.formState.isValid;let C,j;e[23]!==N?(C=c.jsx(ke,{type:"submit",disabled:N,children:"Add"}),e[23]=N,e[24]=C):C=e[24],e[25]!==S||e[26]!==C?(j=c.jsxs("div",{className:"flex gap-2",children:[S,C]}),e[25]=S,e[26]=C,e[27]=j):j=e[27];const _=Xl;let A,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=E=>h(E),e[28]=A):A=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[c.jsx(Jl,{children:c.jsx(Zl,{placeholder:"Select a library"})}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=T):T=e[29];const P=Ql,L=Ok,M=d==null?void 0:d.libraries.map(jN);let R,z,D,I,k;return e[30]!==L||e[31]!==M?(R=c.jsx(L,{children:M}),e[30]=L,e[31]=M,e[32]=R):R=e[32],e[33]!==P||e[34]!==R?(z=c.jsx(P,{children:R}),e[33]=P,e[34]=R,e[35]=z):z=e[35],e[36]!==_||e[37]!==u||e[38]!==A||e[39]!==T||e[40]!==z?(D=c.jsx("div",{children:c.jsxs(_,{value:u,onValueChange:A,children:[T,z]})}),e[36]=_,e[37]=u,e[38]=A,e[39]=T,e[40]=z,e[41]=D):D=e[41],e[42]!==j||e[43]!==D?(I=c.jsxs("div",{className:"flex gap-2 justify-between",children:[j,D]}),e[42]=j,e[43]=D,e[44]=I):I=e[44],e[45]!==I||e[46]!==y||e[47]!==w?(k=c.jsxs("form",{onSubmit:y,className:"space-y-4",children:[w,I]}),e[45]=I,e[46]=y,e[47]=w,e[48]=k):k=e[48],k},CN=t=>{const e=H.c(5),{onSubmit:n}=t,[o,r]=O.useState(null);if(!o){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(kN,{onSelect:r}),e[0]=i):i=e[0],i}let s,a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(a=c.jsx(NN,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a},lg=t=>{const e=H.c(6),{children:n}=t,[o,r]=O.useState(!1);let s,a,i;return e[0]!==n?(s=c.jsx(v9,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(cg,{onClose:()=>r(!1)}),e[2]=a):a=e[2],e[3]!==o||e[4]!==s?(i=c.jsxs(w9,{open:o,onOpenChange:r,children:[s,a]}),e[3]=o,e[4]=s,e[5]=i):i=e[5],i},cg=t=>{const e=H.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(zo,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsxs(ss,{className:"mb-4",children:[o,c.jsxs(as,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",c.jsx(Yf,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=c.jsxs(Uo,{className:"max-h-[75vh] overflow-y-auto",children:[r,c.jsx(CN,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function jN(t){return c.jsx(Ma,{value:t,children:ng[t]},t)}const EN=()=>{const t=H.c(7),{selectedLayout:e}=bS(),{setLayoutView:n}=yS();if(Zt()&&!Kf("wasm_layouts"))return null;let o,r,s,a;return t[0]!==n?(o=i=>n(i),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Jl,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:c.jsx(Zl,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(Ql,{children:c.jsxs(Ok,{children:[c.jsx(k9,{children:"View as"}),vS.map(IN)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(a=c.jsxs(Xl,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=a):a=t[6],a};function _N(t){const e=dg(t);return c.jsx(e,{className:"h-4 w-4"})}function dg(t){switch(t){case"vertical":return ap;case"grid":return LR;case"slides":return qc;default:return ec(t),tc}}function ug(t){return Xf(t)}function IN(t){return c.jsx(Ma,{value:t,children:c.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[_N(t),c.jsx("span",{children:ug(t)})]})},t)}const TN=()=>{const t=H.c(2),{updateCellConfig:e}=it();let n;return t[0]!==e?(n=async()=>{const o=new Oa,r=mn(),s=r.cellIds.inOrderIds,a={};for(const l of s){if(r.cellData[l]===void 0)continue;const{code:d,config:u}=r.cellData[l];u.hide_code||o.isSupported(d)&&(a[l]={hide_code:!0})}const i=Yl.entries(a);if(i.length!==0){await Vo({configs:a});for(const[l,d]of i)e({cellId:l,config:d})}},t[0]=e,t[1]=n):n=t[1],n};function hg(){const t=H.c(3),{openConfirm:e}=Nn(),n=St(Yn);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:c.jsx(Pk,{onClick:async()=>{n({state:Ut.CLOSING}),await N9(),C9()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const Ts=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function fg(){var E,U;const t=H.c(36),e=Jf(),{openModal:n,closeModal:o}=Nn(),{toggleApplication:r}=gr(),{selectedPanel:s}=ds(),[a]=Ot(Pf),i=Ie(is),l=TN(),[d]=mr(),{updateCellConfig:u,undoDeleteCell:h,clearAllCellOutputs:f,upsertSetupCell:m,collapseAllCells:x,expandAllCells:g}=it(),p=hg(),b=Op(),y=function(V){const $=H.c(4),{openPrompt:K,closeModal:X}=Nn();let J;return $[0]!==X||$[1]!==K||$[2]!==V?(J=()=>{if(!V)return null;const ee=nc.guessDeliminator(V),q=pn.basename(V);K({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${q}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:Y=>{const oe=ee.join(pn.dirname(V),Y);S9({source:V,destination:oe}).then(()=>{X(),Xe({title:"Notebook copied",description:"A copy of the notebook has been created."}),dS(oe)})}})},$[0]=X,$[1]=K,$[2]=V,$[3]=J):J=$[3],J}(e),v=St(td),w=St(FR),S=St(zR),N=Ie(j9),C=Ie(E9),j=Ie(Rk),{selectedLayout:_}=bS(),{setLayoutView:A}=yS(),T=Mp(),P=((E=d.sharing)==null?void 0:E.html)??!0,L=((U=d.sharing)==null?void 0:U.wasm)??!0,M=eC;let R;t[0]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(vp,{size:14,strokeWidth:1.5}),t[0]=R):R=t[0];const z=!P&&!L;let D;t[1]===Symbol.for("react.memo_cache_sentinel")?(D=c.jsx(O9,{size:14,strokeWidth:1.5}),t[1]=D):D=t[1];const I=!P;let k,B;return t[2]!==o||t[3]!==n?(k=async()=>{n(c.jsx(FS,{onClose:o}))},t[2]=o,t[3]=n,t[4]=k):k=t[4],t[5]!==j||t[6]!==f||t[7]!==o||t[8]!==x||t[9]!==y||t[10]!==g||t[11]!==e||t[12]!==N||t[13]!==C||t[14]!==l||t[15]!==i||t[16]!==n||t[17]!==p||t[18]!==b||t[19]!==_||t[20]!==s||t[21]!==v||t[22]!==S||t[23]!==A||t[24]!==w||t[25]!==L||t[26]!==z||t[27]!==I||t[28]!==k||t[29]!==r||t[30]!==T||t[31]!==h||t[32]!==u||t[33]!==m||t[34]!==a.mode?(B=[{icon:R,label:"Share",handle:Ts,hidden:z,dropdown:[{icon:D,label:"Publish HTML to web",hidden:I,handle:k},{icon:c.jsx(cS,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!L,handle:QN}]},{icon:c.jsx(Zf,{size:14,strokeWidth:1.5}),label:"Download",handle:Ts,dropdown:[{icon:c.jsx(kS,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await wS({filename:e,includeCode:!0}):Xe({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(kS,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await wS({filename:e,includeCode:!1}):Xe({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(Vl,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:ZN},{icon:c.jsx(qm,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:JN},{divider:!0,icon:c.jsx(Dm,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:a.mode!=="present",tooltip:a.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",Wt("global.hideCode",!1)]}),handle:XN},{icon:c.jsx(_9,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:a.mode!=="present",tooltip:a.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",Wt("global.hideCode",!1)]}),handle:YN}]},{divider:!0,icon:c.jsx(mp,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Ts,dropdown:Zc.flatMap(V=>{const{type:$,Icon:K,hidden:X}=V;return X?[]:{label:Xf($),rightElement:M(s===$),icon:c.jsx(K,{size:14,strokeWidth:1.5}),handle:()=>r($)}})},{icon:c.jsx(qc,{size:14,strokeWidth:1.5}),label:"Present as",handle:Ts,dropdown:[{icon:a.mode==="present"?c.jsx(Lk,{size:14,strokeWidth:1.5}):c.jsx(Vc,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{T()}},...vS.map((V,$)=>{const K=dg(V);return{divider:$===0,label:ug(V),icon:c.jsx(K,{size:14,strokeWidth:1.5}),rightElement:c.jsx("div",{className:"w-8 flex justify-end",children:_===V&&c.jsx(oc,{size:14})}),handle:()=>{A(V),a.mode==="edit"&&T()}}})]},{icon:c.jsx(Zm,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||Zt(),handle:y},{icon:c.jsx(Fc,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:GN},{icon:c.jsx(cn,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!N||i,handle:async()=>{const V=mn(),$=I9(V),K=Yl.fromEntries($.map(qN));await Vo({configs:K});for(const X of $)u({cellId:X,config:{disabled:!1}})}},{icon:c.jsx(ln,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!C||i,handle:async()=>{const V=mn(),$=dk(V),K=Yl.fromEntries($.map(WN));await Vo({configs:K});for(const X of $)u({cellId:X,config:{disabled:!0}})}},{icon:c.jsx(Bf,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:l},{icon:c.jsx(Hm,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x},{icon:c.jsx(Vm,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:g},{icon:c.jsx(Ym,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{m({code:"# Initialization code that runs before all other cells"})}},{icon:c.jsx(Ea,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{f()}},{icon:c.jsx(Xm,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{b()}},{icon:c.jsx(Xc,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!j||i,handle:()=>{h()}},{icon:c.jsx($o,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(c.jsx(cg,{onClose:o}))}},{divider:!0,icon:c.jsx(zc,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(HN)},{icon:c.jsx(Qf,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>w(VN)},{icon:c.jsx(sp,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>S($N)},{icon:c.jsx(uS,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:UN},{icon:c.jsx(rc,{size:14,strokeWidth:1.5}),label:"Resources",handle:Ts,dropdown:[{icon:c.jsx(uS,{size:14,strokeWidth:1.5}),label:"Documentation",handle:BN},{icon:c.jsx(BR,{size:14,strokeWidth:1.5}),label:"GitHub",handle:zN},{icon:c.jsx(UR,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:FN},{icon:c.jsx($R,{size:14,strokeWidth:1.5}),label:"YouTube",handle:LN},{icon:c.jsx(Ff,{size:14,strokeWidth:1.5}),label:"Changelog",handle:RN}]},{divider:!0,icon:c.jsx(op,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:PN},{icon:c.jsx(ni,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:DN},{icon:c.jsx(jp,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(ON).map(AN),t[5]=j,t[6]=f,t[7]=o,t[8]=x,t[9]=y,t[10]=g,t[11]=e,t[12]=N,t[13]=C,t[14]=l,t[15]=i,t[16]=n,t[17]=p,t[18]=b,t[19]=_,t[20]=s,t[21]=v,t[22]=S,t[23]=A,t[24]=w,t[25]=L,t[26]=z,t[27]=I,t[28]=k,t[29]=r,t[30]=T,t[31]=h,t[32]=u,t[33]=m,t[34]=a.mode,t[35]=B):B=t[35],B}function AN(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(MN)}:t}function MN(t){return!t.hidden}function ON(t){return!t.hidden}function DN(){const t=M9();window.open(t,"_blank")}function PN(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function RN(){window.open(On.releasesPage,"_blank")}function LN(){window.open(On.youtube,"_blank")}function FN(){window.open(On.discordLink,"_blank")}function zN(){window.open(On.githubPage,"_blank")}function BN(){window.open(On.docsPage,"_blank")}function UN(){window.open(On.docsPage,"_blank")}function $N(t){return!t}function VN(t){return!t}function HN(t){return!t}function WN(t){return[t,{disabled:!0}]}function qN(t){return[t,{disabled:!1}]}async function GN(){const t=await em();await on(t.contents),Xe({title:"Copied",description:"Code copied to clipboard."})}async function YN(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(KN,0),setTimeout(()=>window.dispatchEvent(e),0)}function KN(){return window.print()}async function XN(){const t=document.getElementById("App");t&&await mk(t,document.title)}async function JN(){const t=await em();Da(new Blob([t.contents],{type:"text/plain"}),Fk.toPY(document.title))}async function ZN(){const t=await A9({download:!1});Da(new Blob([t],{type:"text/plain"}),Fk.toMarkdown(document.title))}async function QN(){const t=await em(),e=T9({code:t.contents});await on(e),Xe({title:"Copied",description:"Link copied to clipboard."})}function eC(t){return c.jsx("div",{className:"w-8 flex justify-end",children:t&&c.jsx(oc,{size:14})})}const tC=t=>{const e=H.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,a=fg();let i,l,d;e[0]!==s?(i=c.jsx("div",{children:s}),e[0]=s,e[1]=i):i=e[1],e[2]!==r?(l=!r&&c.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[c.jsx("span",{children:"Open command palette"}),Wt("global.commandPalette",!1)]}),e[2]=r,e[3]=l):l=e[3],e[4]!==i||e[5]!==l?(d=c.jsxs("div",{className:"flex flex-col gap-2",children:[i,l]}),e[4]=i,e[5]=l,e[6]=d):d=e[6];const u=d,h=r?"disabled":"hint-green";let f,m,x;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(tL,{strokeWidth:1.8}),e[7]=f):f=e[7],e[8]!==u?(m=c.jsx(Ce,{content:u,children:f}),e[8]=u,e[9]=m):m=e[9],e[10]!==r||e[11]!==h||e[12]!==m?(x=c.jsx(sn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:m}),e[10]=r,e[11]=h,e[12]=m,e[13]=x):x=e[13];const g=x,p=nC;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=_=>{const A=c.jsx(Dt,{variant:_.variant,disabled:_.disabled,onSelect:T=>_.handle(T),"data-testid":`notebook-menu-dropdown-${_.label}`,children:p(_)},_.label);return _.tooltip?c.jsx(Ce,{content:_.tooltip,side:"left",delayDuration:100,children:c.jsx("span",{children:A})},_.label):A},e[14]=b):b=e[14];const y=b;let v,w,S,N,C,j;if(e[15]!==g||e[16]!==r?(v=c.jsx(Wo,{asChild:!0,disabled:r,children:g}),e[15]=g,e[16]=r,e[17]=v):v=e[17],e[18]!==a){let _;e[20]===Symbol.for("react.memo_cache_sentinel")?(_=A=>A.hidden?null:A.dropdown?c.jsxs(D9,{children:[c.jsx(P9,{"data-testid":`notebook-menu-dropdown-${A.label}`,children:p(A)}),c.jsx(R9,{children:c.jsx(L9,{children:A.dropdown.map(T=>c.jsxs(G.Fragment,{children:[T.divider&&c.jsx(rn,{}),y(T)]},T.label))})})]},A.label):c.jsxs(G.Fragment,{children:[A.divider&&c.jsx(rn,{}),y(A)]},A.label),e[20]=_):_=e[20],w=a.map(_),e[18]=a,e[19]=w}else w=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(rn,{}),e[21]=S):S=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:c.jsxs("span",{children:["Version: ",zk()]})}),e[22]=N):N=e[22],e[23]!==w?(C=c.jsxs(qo,{align:"end",className:"no-print w-[240px]",children:[w,S,N]}),e[23]=w,e[24]=C):C=e[24],e[25]!==v||e[26]!==C?(j=c.jsxs(Ho,{modal:!1,children:[v,C]}),e[25]=v,e[26]=C,e[27]=j):j=e[27],j};function nC(t){return c.jsxs(c.Fragment,{children:[t.icon&&c.jsx("span",{className:"flex-0 mr-2",children:t.icon}),c.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&c.jsx(tm,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function rd(t){return wo("create"in t,'Expected query to have a "create" method'),t}const $t=F9({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function mg(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(et.set($t,{type:"setFind",find:n}),et.set($t,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):et.set($t,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return et.get($t).isOpen?(et.set($t,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{et.set($t,{type:"setIsOpen",isOpen:!0})}),!0):(et.set($t,{type:"setIsOpen",isOpen:!0}),!0)}function oC(){return!!et.get($t).isOpen&&(et.set($t,{type:"setIsOpen",isOpen:!1}),!0)}function pi(t){return()=>{const e=et.get($t),n=new sc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:rd(n).create(),search:n})}}const pg=t=>pi(({query:e})=>{const n=us(),o=et.get($t).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const a=[...n,...n].slice(s);for(const i of a){const l=t==="next"?e.nextMatch(i.state,0,r??0):e.prevMatch(i.state,r??i.state.doc.length,i.state.doc.length);if(!l){r=null,i.dispatch({selection:ko.single(0)});continue}const d=ko.single(l.from,l.to);return i.dispatch({selection:d,effects:[Ge.scrollIntoView(d.main,{y:"center"})],userEvent:"select.search"}),et.set($t,{type:"setCurrentView",view:i,range:{from:l.from,to:l.to}}),l}return!1}),sd=pg("next"),gg=pg("prev"),rC=pi(({query:t})=>{var o;const e=us(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(i=>{const{from:l,to:d}=i;return{from:l,to:d,insert:t.getReplacement(i)}});if(!s||s.length===0)continue;const a=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:a}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),sC=pi(({query:t})=>{const e=us(),n=et.get($t).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const a of s){const i=t.nextMatch(a.state,0,o??0);if(!i){o=null,a.dispatch({selection:ko.single(0)});continue}const l=a.state.toText(t.getReplacement(i));return a.dispatch({changes:[{from:i.from,to:i.to,insert:l}],userEvent:"input.replace"}),sd()}return!1}),aC=pi(({query:t})=>{const e=us();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const a of s){const{from:i,to:l}=a,d=o.get(r)||new Map;d.set(`${i}:${l}`,n++),o.set(r,d)}}return{count:n,position:o}}),ad=Tt.define();function xg(){const t=us();for(const e of t)e.state.readOnly||e.dispatch({effects:ad.of(new sc({search:""}))})}const gi=gn.define({create(){const t=et.get($t);return rd(new sc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(ad)&&(t=rd(n.value).create());return t}}),iC=ot.mark({class:"cm-searchMatch"}),lC=ot.mark({class:"cm-searchMatch cm-searchMatch-selected"}),cC=Rn.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(gi))}update(t){const e=t.state.field(gi);(e!==t.startState.field(gi)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return ot.none;const{view:e}=this,n=new hs,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:a}=o[s];const{from:i}=o[s];for(;s<r-1&&a>o[s+1].from-500;)a=o[++s].to;t.highlight(e.state,i,a,(l,d)=>{const u=e.state.selection.ranges.some(h=>h.from===l&&h.to===d);n.add(l,d,u?lC:iC)})}return n.finish()}},{decorations:t=>t.decorations}),dC=Ge.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),uC=()=>{var Fe;const t=H.c(102),[e,n]=O.useState(!1),[o,r]=Ot($t),[s,a]=O.useState(),i=O.useRef(null),l=Ie(Gl);let d,u;t[0]!==e||t[1]!==o.isOpen?(d=()=>(!e||!o.isOpen)&&mg(),t[0]=e,t[1]=o.isOpen,t[2]=d):d=t[2],Pt("cell.findAndReplace",d),t[3]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{const Oe=aC();a(Oe===!1?void 0:Oe)},t[3]=u):u=t[3];const h=u;let f,m,x,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&i.current&&(i.current.focus(),i.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),O.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(x=()=>{if(o.isOpen){if(o.findText==="")return a(void 0),void xg();h(),function(){const Oe=et.get($t),Qe=us();for(const qe of Qe)qe.state.readOnly||qe.dispatch({effects:ad.of(new sc({search:Oe.findText,caseSensitive:Oe.caseSensitive,regexp:Oe.regexp,replace:Oe.replaceText,wholeWord:Oe.wholeWord}))})}()}else xg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=x):x=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],O.useEffect(x,g),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(Fe=s.position.get(p.view))==null?void 0:Fe.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const y=b;let v,w,S,N,C,j,_,A,T,P,L;t[19]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!0),t[19]=v):v=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(w=()=>n(!1),t[20]=w):w=t[20],t[21]!==r?(S=Oe=>{Oe.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=S):S=t[22],t[23]!==r?(N=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=N):N=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(En,{className:"w-4 h-4"}),t[25]=C):C=t[25],t[26]!==N?(j=c.jsx("div",{className:"absolute top-0 right-0",children:c.jsx(ke,{"data-testid":"close-find-replace-button",onClick:N,size:"xs",variant:"text",children:C})}),t[26]=N,t[27]=j):j=t[27],t[28]!==r?(_=Oe=>{r({type:"setFind",find:Oe.target.value})},t[28]=r,t[29]=_):_=t[29],t[30]!==o.findText||t[31]!==_?(A=c.jsx(Bo,{ref:i,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:fC,onChange:_}),t[30]=o.findText,t[31]=_,t[32]=A):A=t[32],t[33]!==r?(T=Oe=>{r({type:"setReplace",replace:Oe.target.value})},t[33]=r,t[34]=T):T=t[34],t[35]!==o.replaceText||t[36]!==T?(P=c.jsx(Bo,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:T}),t[35]=o.replaceText,t[36]=T,t[37]=P):P=t[37],t[38]!==A||t[39]!==P?(L=c.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[A,P]}),t[38]=A,t[39]=P,t[40]=L):L=t[40];const M=o.caseSensitive?"on":"off";let R,z,D;t[41]!==r?(R=Oe=>r({type:"setCaseSensitive",caseSensitive:Oe}),t[41]=r,t[42]=R):R=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(z=c.jsx(z9,{className:"w-4 h-4"}),t[43]=z):z=t[43],t[44]!==o.caseSensitive||t[45]!==M||t[46]!==R?(D=c.jsx(Ce,{content:"Case Sensitive",children:c.jsx(nm,{size:"sm",pressed:o.caseSensitive,"data-state":M,onPressedChange:R,children:z})}),t[44]=o.caseSensitive,t[45]=M,t[46]=R,t[47]=D):D=t[47];const I=o.wholeWord?"on":"off";let k,B,E;t[48]!==r?(k=Oe=>r({type:"setWholeWord",wholeWord:Oe}),t[48]=r,t[49]=k):k=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(Ap,{className:"w-4 h-4"}),t[50]=B):B=t[50],t[51]!==o.wholeWord||t[52]!==I||t[53]!==k?(E=c.jsx(Ce,{content:"Match Whole Word",children:c.jsx(nm,{size:"sm",pressed:o.wholeWord,"data-state":I,onPressedChange:k,children:B})}),t[51]=o.wholeWord,t[52]=I,t[53]=k,t[54]=E):E=t[54];const U=o.regexp?"on":"off";let V,$,K,X,J;t[55]!==r?(V=Oe=>r({type:"setRegex",regexp:Oe}),t[55]=r,t[56]=V):V=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?($=c.jsx(xp,{className:"w-4 h-4"}),t[57]=$):$=t[57],t[58]!==o.regexp||t[59]!==U||t[60]!==V?(K=c.jsx(Ce,{content:"Use Regular Expression",children:c.jsx(nm,{size:"sm",pressed:o.regexp,"data-state":U,onPressedChange:V,children:$})}),t[58]=o.regexp,t[59]=U,t[60]=V,t[61]=K):K=t[61],t[62]!==D||t[63]!==E||t[64]!==K?(X=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[D,E,K]}),t[62]=D,t[63]=E,t[64]=K,t[65]=X):X=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(J=()=>{sC()&&h()},t[66]=J):J=t[66];const ee=o.findText==="";let q,Y;t[67]!==ee?(q=c.jsx(ke,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:J,disabled:ee,children:"Replace Next"}),t[67]=ee,t[68]=q):q=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>{const Oe=rC();if(!Oe)return;h();const{dismiss:Qe}=Xe({title:"Replaced all occurrences",action:c.jsx(ci,{"data-testid":"undo-replace-all-button",onClick:()=>{Oe(),qe()}})}),qe=Qe},t[69]=Y):Y=t[69];const oe=o.findText==="";let se,re,ae,te,be,ye,ie,ve,he,Se,De,_e;return t[70]!==oe?(se=c.jsx(ke,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Y,disabled:oe,children:"Replace All"}),t[70]=oe,t[71]=se):se=t[71],t[72]!==q||t[73]!==se?(re=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[q,se]}),t[72]=q,t[73]=se,t[74]=re):re=t[74],t[75]!==X||t[76]!==re?(ae=c.jsxs("div",{className:"flex flex-col gap-2",children:[X,re]}),t[75]=X,t[76]=re,t[77]=ae):ae=t[77],t[78]!==L||t[79]!==ae?(te=c.jsxs("div",{className:"flex items-center gap-3",children:[L,ae]}),t[78]=L,t[79]=ae,t[80]=te):te=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(be=c.jsx(Ce,{content:"Find Previous",children:c.jsx(ke,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:mC,children:c.jsx(wt,{className:"w-4 h-4"})})}),t[81]=be):be=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(ye=c.jsx(Ce,{content:"Find Next",children:c.jsx(ke,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:pC,children:c.jsx(Pc,{className:"w-4 h-4"})})}),t[82]=ye):ye=t[82],t[83]!==y||t[84]!==s?(ie=s!=null&&y==null&&c.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=y,t[84]=s,t[85]=ie):ie=t[85],t[86]!==y||t[87]!==s?(ve=s!=null&&y!=null&&c.jsxs("span",{className:"text-sm",children:[y+1," of ",s.count]}),t[86]=y,t[87]=s,t[88]=ve):ve=t[88],t[89]!==ie||t[90]!==ve?(he=c.jsxs("div",{className:"flex items-center gap-2",children:[be,ye,ie,ve]}),t[89]=ie,t[90]=ve,t[91]=he):he=t[91],t[92]!==l?(Se=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=Se):Se=t[93],t[94]!==Se.key?(De=c.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",c.jsx(Wf,{shortcut:Se.key})," ","again to open the native browser search."]}),t[94]=Se.key,t[95]=De):De=t[95],t[96]!==j||t[97]!==te||t[98]!==he||t[99]!==De||t[100]!==S?(_e=c.jsx(om,{restoreFocus:!0,autoFocus:!0,children:c.jsxs("div",{onFocus:v,onClick:hC,onBlur:w,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:S,children:[j,te,he,De]})}),t[96]=j,t[97]=te,t[98]=he,t[99]=De,t[100]=S,t[101]=_e):_e=t[101],_e};function hC(t){t.stopPropagation(),t.preventDefault()}function fC(t){t.key==="Enter"&&(t.shiftKey?gg():sd())}function mC(){return gg()}function pC(){return sd()}const bg=t=>{const e=H.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:a,className:i}=t,l=n!==void 0&&n,d=r===void 0?null:r,u=s!==void 0&&s,[h,f]=O.useState(d);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];const[x,g]=O.useState(m),[p,b]=O.useState(!1),y=O.useRef(null),v=O.useRef(!1);let w,S,N;e[1]!==d?(w=()=>{f(d)},S=[d],e[1]=d,e[2]=w,e[3]=S):(w=e[2],S=e[3]),O.useEffect(w,S),e[4]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{b(!0)},e[4]=N):N=e[4];const C=N;let j;e[5]!==d||e[6]!==l?(j=Y=>{var oe;(oe=Y.relatedTarget)!=null&&oe.closest(".filename-input")||(b(!1),l&&f(d))},e[5]=d,e[6]=l,e[7]=j):j=e[7];const _=j;let A;e[8]!==h?(A=pn.dirname(h||""),e[8]=h,e[9]=A):A=e[9];const T=A,P=pn.basename(h||""),L=x.filter(Y=>pn.basename(Y.path).startsWith(P));let M,R;e[10]!==T||e[11]!==p?(M=async()=>{if(!p)return void g([]);const Y=await $k({path:T});g(Y.files)},R=[T,p],e[10]=T,e[11]=p,e[12]=M,e[13]=R):(M=e[12],R=e[13]);const{isPending:z}=jn(M,R),D=function(Y,oe,se){if(Y&&!Y.endsWith("/")&&((Kf("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(pn.extension(Y))||(Y=Y.endsWith(".")?`${Y}py`:Y.endsWith(".p")?`${Y}y`:`${Y}.py`),!oe.some(re=>re.path===Y||pn.basename(re.path)===Y)&&!(se&&(se===Y||pn.basename(se)===Y))))return Y}(h,x,d),I=(D||L.length>0)&&c.jsxs(Vf,{className:"font-mono",children:[!z&&c.jsx(Kl,{children:"No files"}),D&&c.jsxs(Gn,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Y;D&&(v.current=!0,a(D),(Y=y.current)==null||Y.blur())},children:[c.jsx(Jm,{className:"w-4 h-4 mr-2"})," ",c.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",c.jsx("span",{className:"font-medium text-sm",children:pn.basename(D)})]})]},"_rename_"),L.map(Y=>{const oe=Y.isDirectory?"directory":Bk(Y.path),se=Uk[oe];return c.jsxs(Gn,{variant:Y.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Y.isDirectory?f(`${Y.path}/`):f(Y.path)},children:[c.jsx(se,{className:"w-4 h-4 mr-2"})," ",pn.basename(Y.path)]},Y.path)})]}),k=10*Math.max(20,(h==null?void 0:h.length)||(o==null?void 0:o.length)||0),B=p?h||"":d||"";let E,U,V;e[14]!==u||e[15]!==k?(E=u?{maxWidth:k}:void 0,e[14]=u,e[15]=k,e[16]=E):E=e[16],e[17]!==i?(U=me(i,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=i,e[18]=U):U=e[18],e[19]!==o||e[20]!==B||e[21]!==E||e[22]!==U?(V=c.jsx(B9,{children:c.jsx(Aa,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:B,onKeyDown:gC,icon:null,ref:y,onValueChange:f,placeholder:o,autoComplete:"off",style:E,className:U})}),e[19]=o,e[20]=B,e[21]=E,e[22]=U,e[23]=V):V=e[23];const $=I&&"group-focus-within:block";let K,X,J,ee,q;return e[24]!==$?(K=me("p-0 w-full min-w-80 max-w-80vw hidden",$),e[24]=$,e[25]=K):K=e[25],e[26]!==I||e[27]!==K?(X=c.jsx(fs,{side:"bottom",className:K,portal:!1,children:I}),e[26]=I,e[27]=K,e[28]=X):X=e[28],e[29]!==V||e[30]!==X?(J=c.jsxs(Vf,{children:[V,X]}),e[29]=V,e[30]=X,e[31]=J):J=e[31],e[32]!==_||e[33]!==J?(ee=c.jsx(ac,{onFocus:C,onBlur:_,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:J}),e[32]=_,e[33]=J,e[34]=ee):ee=e[34],e[35]!==p||e[36]!==ee?(q=c.jsx(ic,{children:c.jsx(xr,{open:p,modal:!1,children:ee})}),e[35]=p,e[36]=ee,e[37]=q):q=e[37],q};function gC(t){t.key==="Escape"&&t.currentTarget.blur()}const xC=t=>{const e=H.c(33),n=()=>{Da(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=ze(vC);let r,s,a,i,l,d,u,h,f,m,x,g,p,b,y,v,w;return e[0]!==n||e[1]!==t?(r=S=>{S.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=S=>{S.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(zo,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(i={wordBreak:"break-word"},e[6]=i):i=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("p",{children:"This app has unsaved changes. To recover:"}),d={paddingBottom:"10px"},e[7]=l,e[8]=d):(l=e[7],d=e[8]),e[9]!==t.proposedName?(u=c.jsxs("li",{style:d,children:['Click the "Download" button. This will download a file called\xA0',c.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=u):u=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=c.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(x=c.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=x):x=e[16],e[17]!==x||e[18]!==m?(g=c.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",x," with the recovered changes."]}),e[17]=x,e[18]=m,e[19]=g):g=e[19],e[20]!==g||e[21]!==u?(p=c.jsx(as,{className:"markdown break-words",style:i,children:c.jsxs("div",{className:"prose dark:prose-invert",children:[l,c.jsxs("ol",{children:[u,g]})]})}),e[20]=g,e[21]=u,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=c.jsx(ke,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(ke,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=y):y=e[25],e[26]!==b?(v=c.jsxs(Ca,{children:[b,y]}),e[26]=b,e[27]=v):v=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==v?(w=c.jsx(Uo,{className:"w-fit",children:c.jsxs("form",{onSubmit:r,onKeyDown:s,children:[a,p,v]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=v,e[32]=w):w=e[32],w},bC=t=>{const e=H.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=Nn();let a;e[0]!==n?(a=n===null?"app":pn.basename(n).split(".")[0],e[0]=n,e[1]=a):a=e[1];const i=a;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==i?(l=()=>{o&&r(c.jsx(xC,{proposedName:i,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=i,e[6]=l):l=e[6];const d=l;let u;Pt("global.save",d),e[7]===Symbol.for("react.memo_cache_sentinel")?(u=Wt("global.save"),e[7]=u):u=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(ri,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==d||e[10]!==h?(m=c.jsx(Ce,{content:u,children:c.jsx(sn,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=d,e[10]=h,e[11]=m):m=e[11],m};function yC(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function vC(){const t=mn(),e=rm(t),n={version:"1",metadata:{marimo_version:zk()},cells:e.map(yC)};return JSON.stringify(n,null,2)}const id=5e3;async function wC(){await H9({download:!1})}async function kC(){await V9({download:!1,includeCode:!0,files:pS.INSTANCE.filenames()})}async function SC(){await $9({download:!1})}const ld=yt(void 0),yg=yt(t=>{const e=t(ld);return function({state:n,layout:o,lastSavedNotebook:r}){if(!r)return!1;const{cellIds:s,cellData:a}=n,i=s.inOrderIds.map(h=>a[h]),l=i.map(h=>h.code),d=i.map(h=>h.config),u=i.map(h=>h.name);return!(Vk(l,r.codes)&&Vk(u,r.names)&&Pa(d,r.configs)&&Pa(o.selectedLayout,r.layout.selectedLayout)&&Pa(o.layoutData,r.layout.layoutData))}({state:t(Pn),layout:t(SS),lastSavedNotebook:e})});function NC(t){return JSON.stringify(t)}const CC=t=>{const e=H.c(15),{kioskMode:n}=t,o=Jf(),r=Ie(yg),s=Ie(Yn).state===Ut.CLOSED,{saveOrNameNotebook:a,saveIfNotebookIsPersistent:i}=cd();let l,d,u;e[0]!==n||e[1]!==i?(l={onSave:i,kioskMode:n},e[0]=n,e[1]=i,e[2]=l):l=e[2],function(p){const b=H.c(14),y=Ie(Gk),v=ms(),[w]=Ot(Yn),S=Ie(yg);let N,C;if(b[0]!==v){const P=rm(v);N=P.map(TC),C=P.map(IC),b[0]=v,b[1]=N,b[2]=C}else N=b[1],C=b[2];const j=C;let _;b[3]!==v?(_=qk(v),b[3]=v,b[4]=_):_=b[4];const A=_;let T;b[5]!==y||b[6]!==j||b[7]!==N||b[8]!==A||b[9]!==w||b[10]!==S||b[11]!==p.kioskMode||b[12]!==p.onSave?(T={onSave:p.onSave,needsSave:S,codes:N,cellConfigs:A,cellNames:j,connStatus:w,config:y,kioskMode:p.kioskMode},b[5]=y,b[6]=j,b[7]=N,b[8]=A,b[9]=w,b[10]=S,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=T):T=b[13],function(P){const L=H.c(21),{codes:M,cellConfigs:R,config:z,connStatus:D,cellNames:I,needsSave:k,kioskMode:B,onSave:E}=P,U=O.useRef(null);let V;L[0]!==M?(V=M.join(":"),L[0]=M,L[1]=V):V=L[1];const $=V;let K;L[2]!==R?(K=R.map(NC).join(":"),L[2]=R,L[3]=K):K=L[3];const X=K;let J;L[4]!==I?(J=I.join(":"),L[4]=I,L[5]=J):J=L[5];const ee=J;let q,Y;L[6]!==z||L[7]!==D.state||L[8]!==B||L[9]!==k||L[10]!==E?(q=()=>{if(!B)return z.autosave==="after_delay"&&(U.current!==null&&clearTimeout(U.current),k&&D.state===Ut.OPEN&&(U.current=setTimeout(E,z.autosave_delay))),()=>{U.current!==null&&clearTimeout(U.current)}},L[6]=z,L[7]=D.state,L[8]=B,L[9]=k,L[10]=E,L[11]=q):q=L[11],L[12]!==X||L[13]!==ee||L[14]!==$||L[15]!==z||L[16]!==D.state||L[17]!==B||L[18]!==k||L[19]!==E?(Y=[$,X,ee,z,D.state,E,B,k],L[12]=X,L[13]=ee,L[14]=$,L[15]=z,L[16]=D.state,L[17]=B,L[18]=k,L[19]=E,L[20]=Y):Y=L[20],O.useEffect(q,Y)}(T)}(l),function(){const p=H.c(6),b=Ie(U9),{state:y}=Ie(Yn),v=b.auto_download.includes("markdown"),w=b.auto_download.includes("html"),S=b.auto_download.includes("ipynb"),N=!v||y!==Ut.OPEN,C=!w||y!==Ut.OPEN,j=!S||y!==Ut.OPEN;let _,A,T;p[0]!==N?(_={delayMs:id,whenVisible:!0,disabled:N},p[0]=N,p[1]=_):_=p[1],Xa(SC,_),p[2]!==C?(A={delayMs:id,whenVisible:!0,disabled:C},p[2]=C,p[3]=A):A=p[3],Xa(kC,A),p[4]!==j?(T={delayMs:id,whenVisible:!0,disabled:j},p[4]=j,p[5]=T):T=p[5],Xa(wC,T)}(),e[3]!==r?(d=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=d):d=e[4],zl(window,"beforeunload",d),e[5]!==a?(u=p=>{p.preventDefault(),p.stopPropagation(),a()},e[5]=a,e[6]=u):u=e[6];const h=u;if(Pt("global.save",a),s){let p;return e[7]!==o||e[8]!==r?(p=c.jsx(bC,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=Wt("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let x,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(ri,{strokeWidth:1.5,size:18}),e[11]=x):x=e[11],e[12]!==h||e[13]!==m?(g=c.jsx(Ce,{content:f,children:c.jsx(sn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:x})}),e[12]=h,e[13]=m,e[14]=g):g=e[14],g};function cd(){const t=H.c(19),{openModal:e,closeModal:n,openAlert:o}=Nn(),r=St(ld),s=Hk(),a=Wk();let i;t[0]!==o||t[1]!==r||t[2]!==a?(i=(p,b)=>{const y=mn(),v=rm(y),w=v.map(_C),S=v.map(EC),N=v.map(jC),C=qk(y),j=a.get(Yn),_=a.get(Gk),A=a.get(SS);a.get(is)||S.length!==0&&(j.state===Ut.OPEN?(ft.log("saving to ",p),W9({cellIds:w,codes:S,names:N,filename:p,configs:C,layout:nL(),persist:!0}).then(()=>{b&&_.format_on_save&&Yk(),r({names:N,codes:S,configs:C,layout:A})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=a,t[3]=i):i=t[3];const l=ze(i);let d;t[4]!==l||t[5]!==a?(d=p=>{const b=p!==void 0&&p,y=a.get(Kk),v=a.get(Yn);vg(y)&&v.state===Ut.OPEN&&l(y,b)},t[4]=l,t[5]=a,t[6]=d):d=t[6];const u=ze(d);let h;t[7]!==l||t[8]!==s?(h=p=>{s(p).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=s,t[9]=h):h=t[9];const f=h;let m;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==u||t[14]!==a?(m=()=>{const p=a.get(Kk),b=a.get(Yn);u(!0),vg(p)||b.state===Ut.CLOSED||e(c.jsx(AC,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=u,t[14]=a,t[15]=m):m=t[15];const x=ze(m);let g;return t[16]!==u||t[17]!==x?(g={saveOrNameNotebook:x,saveIfNotebookIsPersistent:u},t[16]=u,t[17]=x,t[18]=g):g=t[18],g}function jC(t){return t.name}function EC(t){return t.code}function _C(t){return t.id}function vg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function IC(t){return t.name}function TC(t){return t.code}const AC=t=>{const e=H.c(17),{onClose:n,onSave:o}=t,[r,s]=O.useState();let a;e[0]!==n||e[1]!==o?(a=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=a):a=e[2];const i=a;let l,d,u,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(zo,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(fr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=d):d=e[4],e[5]!==i?(u=c.jsxs("div",{className:"flex flex-col",children:[d,c.jsx(bg,{onNameChange:i,placeholderText:"filename",className:"missing-filename"})]}),e[5]=i,e[6]=u):u=e[6],e[7]!==n?(h=c.jsx(ke,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,x,g;return e[9]!==f?(m=c.jsx(ke,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs(Ca,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==u||e[15]!==x?(g=c.jsxs(Uo,{children:[l,u,x]}),e[14]=u,e[15]=x,e[16]=g):g=e[16],g};function wg(t){const e=H.c(3),[n,o]=O.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const a=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(a)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),t&&n}const As=t=>{const{children:e}=t;return Ie(is)?null:e},MC=t=>{const{children:e}=t;return Ie(is)?e:null},OC=()=>{const t=H.c(6),e=St(td);let n;t[0]!==e?(n=()=>e(DC),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=Wt("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(zc,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(a=c.jsx(Ce,{content:r,children:c.jsx(sn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=a):a=t[5],a};function DC(t){return!t}const PC=t=>{const e=H.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:a,running:i,appConfig:l}=t,d=l.width,u=Ie(Rk),h=Ie(q9),{undoDeleteCell:f}=it(),m=a===Ut.CLOSED;let x,g=null;if(!m&&u){let k,B;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(Xc,{size:16,strokeWidth:1.5}),e[0]=k):k=e[0],e[1]!==f?(B=c.jsx(Ce,{content:"Undo cell deletion",children:c.jsx(sn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:k})}),e[1]=f,e[2]=B):B=e[2],g=B}e[3]!==a?(x=Kn(a),e[3]=a,e[4]=x):x=e[4];const p=x;let b;e[5]!==a||e[6]!==p?(b=p?lc(a):void 0,e[5]=a,e[6]=p,e[7]=b):b=e[7];const y=b;let v,w;e[8]!==n?(v=!n&&c.jsx(uC,{}),e[8]=n,e[9]=v):v=e[9],e[10]!==m||e[11]!==y||e[12]!==p||e[13]!==n?(w=!m&&c.jsxs("div",{className:FC,children:[n&&c.jsx(EN,{}),c.jsx(tC,{disabled:p,tooltip:y}),c.jsx(VR,{disabled:p,tooltip:y}),c.jsx(HR,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:y})]}),e[10]=m,e[11]=y,e[12]=p,e[13]=n,e[14]=w):w=e[14];const S=d==="compact"&&"xl:flex-row items-end";let N,C,j,_,A,T,P,L,M,R,z,D,I;return e[15]!==S?(N=me(zC,S),e[15]=S,e[16]=N):N=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(As,{children:c.jsx(CC,{kioskMode:!1})}),e[17]=C):C=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(j=Wt("global.hideCode"),e[18]=j):j=e[18],e[19]!==n?(_=n?c.jsx(Lk,{strokeWidth:1.5,size:18}):c.jsx(Vc,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=_):_=e[20],e[21]!==o||e[22]!==_?(A=c.jsx(Ce,{content:j,children:c.jsx(sn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:_})}),e[21]=o,e[22]=_,e[23]=A):A=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx(OC,{}),P=c.jsx(WR,{}),L=c.jsx("div",{}),e[24]=T,e[25]=P,e[26]=L):(T=e[24],P=e[25],L=e[26]),e[27]!==m||e[28]!==r||e[29]!==i?(M=!m&&c.jsx(LC,{running:i,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=i,e[30]=M):M=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(R=!m&&c.jsx(RC,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=R):R=e[34],e[35]!==M||e[36]!==R||e[37]!==g?(z=c.jsx(As,{children:c.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,M,R]})}),e[35]=M,e[36]=R,e[37]=g,e[38]=z):z=e[38],e[39]!==A||e[40]!==z||e[41]!==N?(D=c.jsxs("div",{className:N,children:[C,A,T,P,L,z]}),e[39]=A,e[40]=z,e[41]=N,e[42]=D):D=e[42],e[43]!==D||e[44]!==v||e[45]!==w?(I=c.jsxs(c.Fragment,{children:[v,w,D]}),e[43]=D,e[44]=v,e[45]=w,e[46]=I):I=e[46],I},RC=t=>{const e=H.c(8),{needsRun:n,onRun:o}=t,r=Ie(Xk);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Wt("global.runStale"),e[0]=l):l=e[0];const d=r?o:void 0,u=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(kr,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==d||e[3]!==u?(f=c.jsx(Ce,{content:l,children:c.jsx(sn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:d,disabled:u,children:h})}),e[2]=d,e[3]=u,e[4]=f):f=e[4],f}const s=!r;let a,i;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(kr,{strokeWidth:1.5,size:16}),e[5]=a):a=e[5],e[6]!==s?(i=c.jsx(Ce,{content:"Nothing to run",children:c.jsx(sn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:a})}),e[6]=s,e[7]=i):i=e[7],i},LC=t=>{const e=H.c(8),{running:n,onInterrupt:o}=t,r=wg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Wt("global.interrupt"),e[0]=s):s=e[0];const a=!r&&"inactive-button active:shadow-xsSolid";let i;e[1]!==a?(i=me(a),e[1]=a,e[2]=i):i=e[2];const l=r?"yellow":"disabled",d=r?o:Cn.NOOP;let u,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(tc,{strokeWidth:1.5,size:16}),e[3]=u):u=e[3],e[4]!==i||e[5]!==l||e[6]!==d?(h=c.jsx(Ce,{content:s,children:c.jsx(sn,{className:i,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:d,children:u})}),e[4]=i,e[5]=l,e[6]=d,e[7]=h):h=e[7],h},FC="absolute top-3 right-5 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",zC="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",BC=t=>{const e=H.c(7),{filename:n}=t,o=Hk();let r;e[0]!==n?(r=n?pn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let a;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(a=c.jsx(bg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=a):a=e[6],a},kg=yt(new Map);function Ms(){const t=H.c(11),[e,n]=Ot(kg),o=Ie(Pn),r=Ie(cc);let s;t[0]!==o||t[1]!==n||t[2]!==r?(s=f=>{const m=new Map;for(const x of f){const g=o.cellRuntime[x],p=new Map;for(const y of Object.values(r))y.declaredBy.includes(x)&&y.usedBy.length>0&&p.set(y.name,y.usedBy);let b;g!=null&&g.runElapsedTimeMs&&g.runElapsedTimeMs>2e3&&(b=g.runElapsedTimeMs),p.size===0&&b===void 0?m.set(x,{cellId:x,type:"simple"}):m.set(x,{cellId:x,type:"expensive",executionDurationMs:b,defs:p})}n(m)},t[0]=o,t[1]=n,t[2]=r,t[3]=s):s=t[3];const a=s;let i;t[4]!==n?(i=()=>{n(new Map)},t[4]=n,t[5]=i):i=t[5];const l=i,d=e.size===0,u=e.size>1;let h;return t[6]!==l||t[7]!==a||t[8]!==d||t[9]!==u?(h={idle:d,shouldConfirmDelete:u,submit:a,clear:l},t[6]=l,t[7]=a,t[8]=d,t[9]=u,t[10]=h):h=t[10],h}function UC(t){return t.cellId}function $C(t){return t.cellId}function VC(t){return t.type==="simple"}function Sg(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:dd,useActions:HC}=G9(Sg,{select:(t,e)=>({selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])}),extend:(t,e)=>{if(!t.selectionStart)return{selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])};const{cellId:n,allCellIds:o}=e;try{const r=o.findWithId(t.selectionStart),s=r.indexOfOrThrow(t.selectionStart),a=r.indexOfOrThrow(n),[i,l]=s<a?[s,a]:[a,s],d=r.slice(i,l+1);return{selectionStart:t.selectionStart,selectionEnd:n,selected:new Set(d)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:t=>t.selected.size===0?t:Sg()});function xi(){return HC()}const WC=t=>{const e=H.c(14),{actions:n,cellIds:o,disabled:r}=t;let s,a,i,l,d;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(Pm,{size:13,strokeWidth:1.5}),e[0]=s):s=e[0],e[1]!==r?(a=c.jsx(Wo,{asChild:!0,children:c.jsx(ke,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",title:"More actions",disabled:r,children:s})}),e[1]=r,e[2]=a):a=e[2],e[3]!==n||e[4]!==o){let u;e[6]!==n.length||e[7]!==o?(u=(h,f)=>{const m=h.map(x=>c.jsx(Dt,{onSelect:()=>x.handle(o),className:"flex items-center gap-2",children:c.jsxs("div",{className:"flex items-center flex-1",children:[x.icon&&c.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:x.icon}),c.jsx("div",{className:"flex-1",children:x.label}),x.hotkey&&c.jsx(tm,{shortcut:x.hotkey,className:"ml-4"})]})},x.label));return c.jsxs(G.Fragment,{children:[m,f<n.length-1&&c.jsx(rn,{})]},f)},e[6]=n.length,e[7]=o,e[8]=u):u=e[8],i=n.flatMap(u),e[3]=n,e[4]=o,e[5]=i}else i=e[5];return e[9]!==i?(l=c.jsx(qo,{align:"start","data-keep-cell-selection":!0,children:i}),e[9]=i,e[10]=l):l=e[10],e[11]!==a||e[12]!==l?(d=c.jsxs(Ho,{children:[a,l]}),e[11]=a,e[12]=l,e[13]=d):d=e[13],d};function qC(t){return t.length>0}function GC(t){return t.filter(YC)}function YC(t){return!t.hidden}function KC(t){return t.length>0}function XC(t){return t.filter(JC)}function JC(t){return!t.hidden}function ZC(t){const e={};t.forEach(n=>{const o=_a(n);o&&(e[n]=o)}),bk(e)}const QC=()=>{const t=H.c(4),e=Ie(dd);let n;t[0]!==e.selected?(n=[...e.selected],t[0]=e.selected,t[1]=n):n=t[1];const o=n;if(o.length<2)return null;let r;return t[2]!==o?(r=c.jsxs(c.Fragment,{children:[c.jsx(tj,{cellIds:o}),c.jsx(ej,{cellIds:o})]}),t[2]=o,t[3]=r):r=t[3],r},ud=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"h-4 w-px bg-border mx-1"}),t[0]=e):e=t[0],e},ej=t=>{const e=H.c(12),{cellIds:n}=t,o=Ms(),r=ui(),s=xi();if(!o.shouldConfirmDelete)return null;let a,i,l,d,u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(sm,{className:"w-4 h-4 text-[var(--amber-11)] mt-0.5 flex-shrink-0"}),e[0]=a):a=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[c.jsx("p",{className:"text-[var(--amber-11)] font-medium",children:"Some cells in selection may contain expensive operations."}),c.jsx("p",{className:"text-[var(--amber-11)] mt-1",children:"Are you sure you want to delete?"})]}),e[1]=i):i=e[1],e[2]!==o?(l=c.jsx(ke,{size:"xs",variant:"ghost",onClick:()=>o.clear(),className:"text-[var(--amber-11)] hover:bg-[var(--amber-4)] hover:text-[var(--amber-11)]",children:"Cancel"}),e[2]=o,e[3]=l):l=e[3],e[4]!==n||e[5]!==r||e[6]!==o||e[7]!==s?(d=c.jsx(ke,{size:"xs",variant:"secondary",onClick:()=>{r({cellIds:n}),o.clear(),s.clear()},className:"bg-[var(--amber-11)] hover:bg-[var(--amber-12)] text-white border-[var(--amber-11)]",children:"Delete"}),e[4]=n,e[5]=r,e[6]=o,e[7]=s,e[8]=d):d=e[8],e[9]!==l||e[10]!==d?(u=c.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:c.jsx("div",{className:"mx-20",children:c.jsx("div",{className:"bg-[var(--amber-2)] border border-[var(--amber-6)] rounded-lg shadow-lg mt-14 px-4 py-3 animate-in slide-in-from-top-2 duration-200",children:c.jsxs("div",{className:"flex items-start gap-3",children:[a,c.jsxs("div",{className:"flex-1",children:[i,c.jsx(om,{restoreFocus:!0,autoFocus:!0,children:c.jsxs("div",{className:"flex items-center gap-2 mt-3",onKeyDown:nj,children:[l,d]})})]})]})})})}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u},tj=t=>{const e=H.c(23),{cellIds:n}=t,o=xi(),r=Ms(),{actions:s,moreActions:a}=function(p){const b=H.c(30),{updateCellConfig:y,moveCell:v,clearCellOutput:w,sendToTop:S,sendToBottom:N}=it(),C=ui(),j=Ie(Bl),_=xi(),A=Es(),T=Ms(),P=Ie(Ra),L=p.length,M=!j||L<p.length;let R;b[0]!==C||b[1]!==T||b[2]!==_||b[3]!==P?(R=oe=>{T.idle&&P.keymap.destructive_delete?T.submit(oe):(C({cellIds:oe}),T.clear(),_.clear())},b[0]=C,b[1]=T,b[2]=_,b[3]=P,b[4]=R):R=b[4];const z=ze(R);let D;b[5]!==v?(D=(oe,se)=>{if(se==="down"){const re=oe[oe.length-1];if(et.get(Pn).cellIds.findWithId(re).last()===re)return}if(se==="up"){const re=oe[0];if(et.get(Pn).cellIds.findWithId(re).first()===re)return}(se==="up"?oe:[...oe].reverse()).forEach(re=>{v({cellId:re,before:se==="up"})})},b[5]=v,b[6]=D):D=b[6];const I=ze(D);let k;b[7]!==S?(k=oe=>{[...oe].reverse().forEach(se=>{S({cellId:se})})},b[7]=S,b[8]=k):k=b[8];const B=ze(k);let E;b[9]!==N?(E=oe=>{oe.forEach(se=>{N({cellId:se})})},b[9]=N,b[10]=E):E=b[10];const U=ze(E),V=ze(ZC);let $;b[11]!==w?($=oe=>{oe.forEach(se=>{w({cellId:se})})},b[11]=w,b[12]=$):$=b[12];const K=ze($);let X;b[13]!==y?(X=async(oe,se,re)=>{const ae={};oe.forEach(te=>{ae[te]={[se]:re}}),await Vo({configs:ae}),oe.forEach(te=>{y({cellId:te,config:ae[te]})})},b[13]=y,b[14]=X):X=b[14];const J=ze(X);let ee,q,Y;if(b[15]===Symbol.for("react.memo_cache_sentinel")?(ee=c.jsx(kr,{size:13,strokeWidth:1.5}),b[15]=ee):ee=b[15],b[16]!==A?(q=oe=>A(oe),b[16]=A,b[17]=q):q=b[17],b[18]!==M||b[19]!==K||b[20]!==z||b[21]!==V||b[22]!==I||b[23]!==U||b[24]!==B||b[25]!==q||b[26]!==J){const oe=[[{icon:ee,label:"Run cells",handle:q,hotkey:"cell.run"}],[{icon:c.jsx(Wl,{size:13,strokeWidth:1.5}),label:"Move up",handle:te=>I(te,"up"),hotkey:"cell.moveUp"},{icon:c.jsx(vo,{size:13,strokeWidth:1.5}),label:"Move down",handle:te=>I(te,"down"),hotkey:"cell.moveDown"}],[{icon:c.jsx(ql,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!M,handle:z}]],se=[[{icon:c.jsx(yk,{size:13,strokeWidth:1.5}),label:"Format cells",handle:V,hotkey:"cell.format"},{icon:c.jsx(Ea,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:K}],[{icon:c.jsx(Bf,{size:13,strokeWidth:1.5}),label:"Hide code",handle:te=>J(te,"hide_code",!0),hotkey:"cell.hideCode"},{icon:c.jsx(zf,{size:13,strokeWidth:1.5}),label:"Show code",handle:te=>J(te,"hide_code",!1),hotkey:"cell.hideCode"}],[{icon:c.jsx(Wl,{size:13,strokeWidth:1.5}),label:"Move up",handle:te=>I(te,"up"),hotkey:"cell.moveUp"},{icon:c.jsx(vo,{size:13,strokeWidth:1.5}),label:"Move down",handle:te=>I(te,"down"),hotkey:"cell.moveDown"},{icon:c.jsx(Lc,{size:13,strokeWidth:1.5}),label:"Send to top",handle:B,hotkey:"cell.sendToTop"},{icon:c.jsx(Rc,{size:13,strokeWidth:1.5}),label:"Send to bottom",handle:U,hotkey:"cell.sendToBottom"}],[{icon:c.jsx(ln,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:te=>J(te,"disabled",!0)},{icon:c.jsx(cn,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:te=>J(te,"disabled",!1)}]],re=oe.map(XC);let ae;b[28]!==re?(ae=re.filter(KC),b[28]=re,b[29]=ae):ae=b[29],Y={actions:ae,moreActions:se.map(GC).filter(qC)},b[18]=M,b[19]=K,b[20]=z,b[21]=V,b[22]=I,b[23]=U,b[24]=B,b[25]=q,b[26]=J,b[27]=Y}else Y=b[27];return Y}(n),i=n.length;let l;e[0]!==r||e[1]!==o?(l=p=>{(p.target instanceof HTMLElement||p.target instanceof SVGElement)&&p.target.closest("[data-keep-cell-selection]")!==null||p.target instanceof HTMLHtmlElement||(r.clear(),o.clear())},e[0]=r,e[1]=o,e[2]=l):l=e[2],zl(window,"mousedown",l);const d=!r.idle;let u,h,f,m,x,g;if(e[3]!==i?(u=c.jsxs("span",{className:"text-sm font-medium text-muted-foreground px-2 flex-shrink-0",children:[i," cells selected"]}),e[3]=i,e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(ud,{}),e[5]=h):h=e[5],e[6]!==s||e[7]!==n||e[8]!==d){let p;e[10]!==s.length||e[11]!==n||e[12]!==d?(p=(b,y)=>c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[b.map(v=>c.jsxs(ke,{variant:v.variant==="danger"?"linkDestructive":"ghost",size:"sm",onClick:()=>v.handle(n),className:"h-8 px-2 gap-1 flex-shrink-0 flex items-center",title:v.label,disabled:d&&v.label!=="Delete cells",children:[v.icon,c.jsx("span",{className:"text-xs",children:v.label}),v.hotkey&&c.jsx("div",{className:"ml-1 border bg-muted rounded-md px-1",children:c.jsx(tm,{shortcut:v.hotkey})})]},v.label)),y<s.length-1&&c.jsx(ud,{})]},y),e[10]=s.length,e[11]=n,e[12]=d,e[13]=p):p=e[13],f=s.map(p),e[6]=s,e[7]=n,e[8]=d,e[9]=f}else f=e[9];return e[14]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(ud,{}),e[14]=m):m=e[14],e[15]!==n||e[16]!==d||e[17]!==a?(x=c.jsx(WC,{actions:a,cellIds:n,disabled:d}),e[15]=n,e[16]=d,e[17]=a,e[18]=x):x=e[18],e[19]!==u||e[20]!==f||e[21]!==x?(g=c.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:c.jsx("div",{className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border border-[var(--slate-7)] rounded-lg shadow-lg p-2 overflow-x-auto overflow-y-hidden mx-20 scrollbar-thin",children:c.jsxs("div",{className:"flex items-center gap-1",children:[u,h,f,m,x]})})}),e[19]=u,e[20]=f,e[21]=x,e[22]=g):g=e[22],g};function nj(t){t.stopPropagation()}const oj={display:"none"};function rj(t){let{id:e,value:n}=t;return G.createElement("div",{id:e,style:oj},n)}function sj(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return G.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const Ng=O.createContext(null),aj={draggable:`
99
- To pick up a draggable item, press the space bar.
100
- While dragging, use the arrow keys to move the item.
101
- Press space again to drop the item in its new position, or press escape to cancel.
102
- `},ij={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function lj(t){let{announcements:e=ij,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=aj}=t;const{announce:s,announcement:a}=function(){const[h,f]=O.useState("");return{announce:O.useCallback(m=>{m!=null&&f(m)},[]),announcement:h}}(),i=La("DndLiveRegion"),[l,d]=O.useState(!1);if(O.useEffect(()=>{d(!0)},[]),function(h){const f=O.useContext(Ng);O.useEffect(()=>{if(!f)throw new Error("useDndMonitor must be used within a children of <DndContext>");return f(h)},[h,f])}(O.useMemo(()=>({onDragStart(h){let{active:f}=h;s(e.onDragStart({active:f}))},onDragMove(h){let{active:f,over:m}=h;e.onDragMove&&s(e.onDragMove({active:f,over:m}))},onDragOver(h){let{active:f,over:m}=h;s(e.onDragOver({active:f,over:m}))},onDragEnd(h){let{active:f,over:m}=h;s(e.onDragEnd({active:f,over:m}))},onDragCancel(h){let{active:f,over:m}=h;s(e.onDragCancel({active:f,over:m}))}}),[s,e])),!l)return null;const u=G.createElement(G.Fragment,null,G.createElement(rj,{id:o,value:r.draggable}),G.createElement(sj,{id:i,announcement:a}));return n?Ba.createPortal(u,n):u}var Mt;function bi(){}function Cg(t,e){return O.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Mt||(Mt={}));const Tn=Object.freeze({x:0,y:0});function hd(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function fd(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function cj(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function md(t){let{left:e,top:n,height:o,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+o},{x:e+r,y:n+o}]}function pd(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function jg(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+.5*t.width,y:n+.5*t.height}}const gd=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=jg(e,e.left,e.top),s=[];for(const a of o){const{id:i}=a,l=n.get(i);if(l){const d=hd(jg(l),r);s.push({id:i,data:{droppableContainer:a,value:d}})}}return s.sort(fd)};function dj(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),a=r-o,i=s-n;if(o<r&&n<s){const l=e.width*e.height,d=t.width*t.height,u=a*i;return Number((u/(l+d-u)).toFixed(4))}return 0}const Eg=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const s of o){const{id:a}=s,i=n.get(a);if(i){const l=dj(i,e);l>0&&r.push({id:a,data:{droppableContainer:s,value:l}})}}return r.sort(cj)};function uj(t,e){const{top:n,left:o,bottom:r,right:s}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=s}function _g(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Tn}function hj(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((s,a)=>({...s,top:s.top+t*a.y,bottom:s.bottom+t*a.y,left:s.left+t*a.x,right:s.right+t*a.x}),{...e})}}const fj=hj(1),mj={ignoreTransform:!1};function Cr(t,e){e===void 0&&(e=mj);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:u}=So(t).getComputedStyle(t);d&&(n=function(h,f,m){const x=function(C){if(C.startsWith("matrix3d(")){const j=C.slice(9,-1).split(/, /);return{x:+j[12],y:+j[13],scaleX:+j[0],scaleY:+j[5]}}if(C.startsWith("matrix(")){const j=C.slice(7,-1).split(/, /);return{x:+j[4],y:+j[5],scaleX:+j[0],scaleY:+j[3]}}return null}(f);if(!x)return h;const{scaleX:g,scaleY:p,x:b,y}=x,v=h.left-b-(1-g)*parseFloat(m),w=h.top-y-(1-p)*parseFloat(m.slice(m.indexOf(" ")+1)),S=g?h.width/g:h.width,N=p?h.height/p:h.height;return{width:S,height:N,top:w,right:v+S,bottom:w+N,left:v}}(n,d,u))}const{top:o,left:r,width:s,height:a,bottom:i,right:l}=n;return{top:o,left:r,width:s,height:a,bottom:i,right:l}}function Ig(t){return Cr(t,{ignoreTransform:!0})}function yi(t,e){const n=[];return t?function o(r){if(e!=null&&n.length>=e||!r)return n;if(Zk(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!uc(r)||Y9(r)||n.includes(r))return n;const s=So(t).getComputedStyle(r);return r!==t&&function(a,i){i===void 0&&(i=So(a).getComputedStyle(a));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(d=>{const u=i[d];return typeof u=="string"&&l.test(u)})}(r,s)&&n.push(r),function(a,i){return i===void 0&&(i=So(a).getComputedStyle(a)),i.position==="fixed"}(r,s)?n:o(r.parentNode)}(t):n}function Tg(t){const[e]=yi(t,1);return e??null}function xd(t){return lm&&t?cm(t)?t:J9(t)?Zk(t)||t===ps(t).scrollingElement?window:uc(t)?t:null:null:null}function Ag(t){return cm(t)?t.scrollX:t.scrollLeft}function Mg(t){return cm(t)?t.scrollY:t.scrollTop}function bd(t){return{x:Ag(t),y:Mg(t)}}var Rt;function Og(t){return!(!lm||!t)&&t===document.scrollingElement}function Dg(t){const e={x:0,y:0},n=Og(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height};return{isTop:t.scrollTop<=e.y,isLeft:t.scrollLeft<=e.x,isBottom:t.scrollTop>=o.y,isRight:t.scrollLeft>=o.x,maxScroll:o,minScroll:e}}(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Rt||(Rt={}));const pj={x:.2,y:.2};function gj(t,e,n,o,r){let{top:s,left:a,right:i,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=pj);const{isTop:d,isBottom:u,isLeft:h,isRight:f}=Dg(t),m={x:0,y:0},x={x:0,y:0},g=e.height*r.y,p=e.width*r.x;return!d&&s<=e.top+g?(m.y=Rt.Backward,x.y=o*Math.abs((e.top+g-s)/g)):!u&&l>=e.bottom-g&&(m.y=Rt.Forward,x.y=o*Math.abs((e.bottom-g-l)/g)),!f&&i>=e.right-p?(m.x=Rt.Forward,x.x=o*Math.abs((e.right-p-i)/p)):!h&&a<=e.left+p&&(m.x=Rt.Backward,x.x=o*Math.abs((e.left+p-a)/p)),{direction:m,speed:x}}function xj(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:e,left:n,right:o,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:o,bottom:r,width:t.clientWidth,height:t.clientHeight}}function Pg(t){return t.reduce((e,n)=>gs(e,bd(n)),Tn)}const bj=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+Ag(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+Mg(n),0)}]];class yd{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=yi(n),r=Pg(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,a,i]of bj)for(const l of a)Object.defineProperty(this,l,{get:()=>{const d=i(o),u=r[s]-d;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Os{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=e}add(e,n,o){var r;(r=this.target)==null||r.addEventListener(e,n,o),this.listeners.push([e,n,o])}}function vd(t,e){const n=Math.abs(t.x),o=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+o**2)>e:"x"in e&&"y"in e?n>e.x&&o>e.y:"x"in e?n>e.x:"y"in e&&o>e.y}var bn,tt;function Rg(t){t.preventDefault()}function yj(t){t.stopPropagation()}(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(bn||(bn={})),function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"}(tt||(tt={}));const Lg={start:[tt.Space,tt.Enter],cancel:[tt.Esc],end:[tt.Space,tt.Enter,tt.Tab]},vj=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case tt.Right:return{...n,x:n.x+25};case tt.Left:return{...n,x:n.x-25};case tt.Down:return{...n,y:n.y+25};case tt.Up:return{...n,y:n.y-25}}};class wd{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Os(ps(n)),this.windowListeners=new Os(So(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(bn.Resize,this.handleCancel),this.windowListeners.add(bn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(bn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&function(r,s){if(s===void 0&&(s=Cr),!r)return;const{top:a,left:i,bottom:l,right:d}=s(r);Tg(r)&&(l<=0||d<=0||a>=window.innerHeight||i>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}(o),n(Tn)}handleKeyDown(e){if(am(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=Lg,coordinateGetter:a=vj,scrollBehavior:i="smooth"}=r,{code:l}=e;if(s.end.includes(l))return void this.handleEnd(e);if(s.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:d}=o.current,u=d?{x:d.left,y:d.top}:Tn;this.referenceCoordinates||(this.referenceCoordinates=u);const h=a(e,{active:n,context:o.current,currentCoordinates:u});if(h){const f=za(h,u),m={x:0,y:0},{scrollableAncestors:x}=o.current;for(const g of x){const p=e.code,{isTop:b,isRight:y,isLeft:v,isBottom:w,maxScroll:S,minScroll:N}=Dg(g),C=xj(g),j={x:Math.min(p===tt.Right?C.right-C.width/2:C.right,Math.max(p===tt.Right?C.left:C.left+C.width/2,h.x)),y:Math.min(p===tt.Down?C.bottom-C.height/2:C.bottom,Math.max(p===tt.Down?C.top:C.top+C.height/2,h.y))},_=p===tt.Right&&!y||p===tt.Left&&!v,A=p===tt.Down&&!w||p===tt.Up&&!b;if(_&&j.x!==h.x){const T=g.scrollLeft+f.x,P=p===tt.Right&&T<=S.x||p===tt.Left&&T>=N.x;if(P&&!f.y)return void g.scrollTo({left:T,behavior:i});m.x=P?g.scrollLeft-T:p===tt.Right?g.scrollLeft-S.x:g.scrollLeft-N.x,m.x&&g.scrollBy({left:-m.x,behavior:i});break}if(A&&j.y!==h.y){const T=g.scrollTop+f.y,P=p===tt.Down&&T<=S.y||p===tt.Up&&T>=N.y;if(P&&!f.x)return void g.scrollTo({top:T,behavior:i});m.y=P?g.scrollTop-T:p===tt.Down?g.scrollTop-S.y:g.scrollTop-N.y,m.y&&g.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(e,gs(za(h,this.referenceCoordinates),m))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Fg(t){return!!(t&&"distance"in t)}function zg(t){return!!(t&&"delay"in t)}wd.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=Lg,onActivation:r}=e,{active:s}=n;const{code:a}=t.nativeEvent;if(o.start.includes(a)){const i=s.activatorNode.current;return(!i||t.target===i)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class kd{constructor(e,n,o){var r;o===void 0&&(o=function(i){const{EventTarget:l}=So(i);return i instanceof l?i:ps(i)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:a}=s;this.props=e,this.events=n,this.document=ps(a),this.documentListeners=new Os(this.document),this.listeners=new Os(o),this.windowListeners=new Os(So(a)),this.initialCoordinates=(r=im(s))!=null?r:Tn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(bn.Resize,this.handleCancel),this.windowListeners.add(bn.DragStart,Rg),this.windowListeners.add(bn.VisibilityChange,this.handleCancel),this.windowListeners.add(bn.ContextMenu,Rg),this.documentListeners.add(bn.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zg(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if(Fg(n))return void this.handlePending(n)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:o,onPending:r}=this.props;r(o,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(bn.Click,yj,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(bn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:a,options:{activationConstraint:i}}=s;if(!r)return;const l=(n=im(e))!=null?n:Tn,d=za(r,l);if(!o&&i){if(Fg(i)){if(i.tolerance!=null&&vd(d,i.tolerance))return this.handleCancel();if(vd(d,i.distance))return this.handleStart()}return zg(i)&&vd(d,i.tolerance)?this.handleCancel():void this.handlePending(i,d)}e.cancelable&&e.preventDefault(),a(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===tt.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const wj={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Sd extends kd{constructor(e){const{event:n}=e,o=ps(n.target);super(e,wj,o)}}Sd.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return!(!n.isPrimary||n.button!==0)&&(o==null||o({event:n}),!0)}}];const kj={move:{name:"mousemove"},end:{name:"mouseup"}};var Nd;(function(t){t[t.RightClick=2]="RightClick"})(Nd||(Nd={})),(class extends kd{constructor(t){super(t,kj,ps(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==Nd.RightClick&&(o==null||o({event:n}),!0)}}];const Cd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Ds,vi;function Sj(t){let{acceleration:e,activator:n=Ds.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:a=5,order:i=vi.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:f}=t;const m=function(N){let{delta:C,disabled:j}=N;const _=hc(C);return Ua(A=>{if(j||!_||!A)return Nj;const T={x:Math.sign(C.x-_.x),y:Math.sign(C.y-_.y)};return{x:{[Rt.Backward]:A.x[Rt.Backward]||T.x===-1,[Rt.Forward]:A.x[Rt.Forward]||T.x===1},y:{[Rt.Backward]:A.y[Rt.Backward]||T.y===-1,[Rt.Forward]:A.y[Rt.Forward]||T.y===1}}},[j,C,_])}({delta:h,disabled:!s}),[x,g]=K9(),p=O.useRef({x:0,y:0}),b=O.useRef({x:0,y:0}),y=O.useMemo(()=>{switch(n){case Ds.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ds.DraggableRect:return r}},[n,r,l]),v=O.useRef(null),w=O.useCallback(()=>{const N=v.current;if(!N)return;const C=p.current.x*b.current.x,j=p.current.y*b.current.y;N.scrollBy(C,j)},[]),S=O.useMemo(()=>i===vi.TreeOrder?[...d].reverse():d,[i,d]);O.useEffect(()=>{if(s&&d.length&&y){for(const N of S){if((o==null?void 0:o(N))===!1)continue;const C=d.indexOf(N),j=u[C];if(!j)continue;const{direction:_,speed:A}=gj(N,j,y,e,f);for(const T of["x","y"])m[T][_[T]]||(A[T]=0,_[T]=0);if(A.x>0||A.y>0)return g(),v.current=N,x(w,a),p.current=A,void(b.current=_)}p.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,w,o,g,s,a,JSON.stringify(y),JSON.stringify(m),x,d,S,u,JSON.stringify(f)])}(class extends kd{constructor(t){super(t,Cd)}static setup(){return window.addEventListener(Cd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Cd.move.name,t)};function t(){}}}).activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;const{touches:r}=n;return!(r.length>1)&&(o==null||o({event:n}),!0)}}],function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"}(Ds||(Ds={})),function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"}(vi||(vi={}));const Nj={x:{[Rt.Backward]:!1,[Rt.Forward]:!1},y:{[Rt.Backward]:!1,[Rt.Forward]:!1}};var Ps,jd;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ps||(Ps={})),function(t){t.Optimized="optimized"}(jd||(jd={}));const Bg=new Map;function Ug(t,e){return Ua(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function wi(t){let{callback:e,disabled:n}=t;const o=Jk(e),r=O.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:s}=window;return new s(o)},[n]);return O.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function Cj(t){return new yd(Cr(t),t)}function $g(t,e,n){e===void 0&&(e=Cj);const[o,r]=O.useState(null);function s(){r(l=>{if(!t)return null;var d;if(t.isConnected===!1)return(d=l??n)!=null?d:null;const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const a=function(l){let{callback:d,disabled:u}=l;const h=Jk(d),f=O.useMemo(()=>{if(u||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:m}=window;return new m(h)},[h,u]);return O.useEffect(()=>()=>f==null?void 0:f.disconnect(),[f]),f}({callback(l){if(t)for(const d of l){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),i=wi({callback:s});return Go(()=>{s(),t?(i==null||i.observe(t),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),a==null||a.disconnect())},[t]),o}const Vg=[];function Hg(t,e){e===void 0&&(e=[]);const n=O.useRef(null);return O.useEffect(()=>{n.current=null},e),O.useEffect(()=>{const o=t!==Tn;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?za(t,n.current):Tn}function Wg(t){return O.useMemo(()=>t?function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}(t):null,[t])}const qg=[];function jj(t){let{measure:e}=t;const[n,o]=O.useState(null),r=O.useCallback(d=>{for(const{target:u}of d)if(uc(u)){o(h=>{const f=e(u);return h?{...h,width:f.width,height:f.height}:f});break}},[e]),s=wi({callback:r}),a=O.useCallback(d=>{const u=function(h){if(!h)return null;if(h.children.length>1)return h;const f=h.children[0];return uc(f)?f:h}(d);s==null||s.disconnect(),u&&(s==null||s.observe(u)),o(u?e(u):null)},[e,s]),[i,l]=dc(a);return O.useMemo(()=>({nodeRef:i,rect:n,setRef:l}),[n,i,l])}const Ej=[{sensor:Sd,options:{}},{sensor:wd,options:{}}],_j={current:{}},ki={draggable:{measure:Ig},droppable:{measure:Ig,strategy:Ps.WhileDragging,frequency:jd.Optimized},dragOverlay:{measure:Cr}};class Rs extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,o;return(n=(o=this.get(e))==null?void 0:o.node.current)!=null?n:void 0}}const Ij={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bi},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ki,measureDroppableContainers:bi,windowRect:null,measuringScheduled:!1},Tj={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bi,draggableNodes:new Map,over:null,measureDroppableContainers:bi},Si=O.createContext(Tj),Gg=O.createContext(Ij);function Aj(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rs}}}function Mj(t,e){switch(e.type){case Mt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Mt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Mt.DragEnd:case Mt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Mt.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new Rs(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case Mt.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,s=t.droppable.containers.get(n);if(!s||o!==s.key)return t;const a=new Rs(t.droppable.containers);return a.set(n,{...s,disabled:r}),{...t,droppable:{...t.droppable,containers:a}}}case Mt.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const s=new Rs(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function Oj(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=O.useContext(Si),s=hc(o),a=hc(n==null?void 0:n.id);return O.useEffect(()=>{if(!e&&!o&&s&&a!=null){if(!am(s)||document.activeElement===s.target)return;const i=r.get(a);if(!i)return;const{activatorNode:l,node:d}=i;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[l.current,d.current]){if(!u)continue;const h=X9(u);if(h){h.focus();break}}})}},[o,e,r,a,s]),null}const Yg=O.createContext({...Tn,scaleX:1,scaleY:1});var Eo;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Eo||(Eo={}));const Dj=O.memo(function(t){var e,n,o,r;let{id:s,accessibility:a,autoScroll:i=!0,children:l,sensors:d=Ej,collisionDetection:u=Eg,measuring:h,modifiers:f,...m}=t;const x=O.useReducer(Mj,void 0,Aj),[g,p]=x,[b,y]=function(){const[le]=O.useState(()=>new Set),Ne=O.useCallback(je=>(le.add(je),()=>le.delete(je)),[le]);return[O.useCallback(je=>{let{type:Le,event:Ve}=je;le.forEach(Ae=>{var Ue;return(Ue=Ae[Le])==null?void 0:Ue.call(Ae,Ve)})},[le]),Ne]}(),[v,w]=O.useState(Eo.Uninitialized),S=v===Eo.Initialized,{draggable:{active:N,nodes:C,translate:j},droppable:{containers:_}}=g,A=N!=null?C.get(N):null,T=O.useRef({initial:null,translated:null}),P=O.useMemo(()=>{var le;return N!=null?{id:N,data:(le=A==null?void 0:A.data)!=null?le:_j,rect:T}:null},[N,A]),L=O.useRef(null),[M,R]=O.useState(null),[z,D]=O.useState(null),I=Fa(m,Object.values(m)),k=La("DndDescribedBy",s),B=O.useMemo(()=>_.getEnabled(),[_]),E=(U=h,O.useMemo(()=>({draggable:{...ki.draggable,...U==null?void 0:U.draggable},droppable:{...ki.droppable,...U==null?void 0:U.droppable},dragOverlay:{...ki.dragOverlay,...U==null?void 0:U.dragOverlay}}),[U==null?void 0:U.draggable,U==null?void 0:U.droppable,U==null?void 0:U.dragOverlay]));var U;const{droppableRects:V,measureDroppableContainers:$,measuringScheduled:K}=function(le,Ne){let{dragging:je,dependencies:Le,config:Ve}=Ne;const[Ae,Ue]=O.useState(null),{frequency:Je,measure:We,strategy:nt}=Ve,bt=O.useRef(le),It=function(){switch(nt){case Ps.Always:return!1;case Ps.BeforeDragging:return je;default:return!je}}(),Jt=Fa(It),Bt=O.useCallback(function(Wn){Wn===void 0&&(Wn=[]),Jt.current||Ue(yo=>yo===null?Wn:yo.concat(Wn.filter(Sn=>!yo.includes(Sn))))},[Jt]),Mn=O.useRef(null),os=Ua(Wn=>{if(It&&!je)return Bg;if(!Wn||Wn===Bg||bt.current!==le||Ae!=null){const yo=new Map;for(let Sn of le){if(!Sn)continue;if(Ae&&Ae.length>0&&!Ae.includes(Sn.id)&&Sn.rect.current){yo.set(Sn.id,Sn.rect.current);continue}const rs=Sn.node.current,Na=rs?new yd(We(rs),rs):null;Sn.rect.current=Na,Na&&yo.set(Sn.id,Na)}return yo}return Wn},[le,Ae,je,It,We]);return O.useEffect(()=>{bt.current=le},[le]),O.useEffect(()=>{It||Bt()},[je,It]),O.useEffect(()=>{Ae&&Ae.length>0&&Ue(null)},[JSON.stringify(Ae)]),O.useEffect(()=>{It||typeof Je!="number"||Mn.current!==null||(Mn.current=setTimeout(()=>{Bt(),Mn.current=null},Je))},[Je,It,Bt,...Le]),{droppableRects:os,measureDroppableContainers:Bt,measuringScheduled:Ae!=null}}(B,{dragging:S,dependencies:[j.x,j.y],config:E.droppable}),X=function(le,Ne){const je=Ne!=null?le.get(Ne):void 0,Le=je?je.node.current:null;return Ua(Ve=>{var Ae;return Ne==null?null:(Ae=Le??Ve)!=null?Ae:null},[Le,Ne])}(C,N),J=O.useMemo(()=>z?im(z):null,[z]),ee=function(){const le=(M==null?void 0:M.autoScrollEnabled)===!1,Ne=typeof i=="object"?i.enabled===!1:i===!1,je=S&&!le&&!Ne;return typeof i=="object"?{...i,enabled:je}:{enabled:je}}(),q=function(le,Ne){return Ug(le,Ne)}(X,E.draggable.measure);(function(le){let{activeNode:Ne,measure:je,initialRect:Le,config:Ve=!0}=le;const Ae=O.useRef(!1),{x:Ue,y:Je}=typeof Ve=="boolean"?{x:Ve,y:Ve}:Ve;Go(()=>{if(!Ue&&!Je||!Ne)return void(Ae.current=!1);if(Ae.current||!Le)return;const We=Ne==null?void 0:Ne.node.current;if(!We||We.isConnected===!1)return;const nt=_g(je(We),Le);if(Ue||(nt.x=0),Je||(nt.y=0),Ae.current=!0,Math.abs(nt.x)>0||Math.abs(nt.y)>0){const bt=Tg(We);bt&&bt.scrollBy({top:nt.y,left:nt.x})}},[Ne,Ue,Je,Le,je])})({activeNode:N!=null?C.get(N):null,config:ee.layoutShiftCompensation,initialRect:q,measure:E.draggable.measure});const Y=$g(X,E.draggable.measure,q),oe=$g(X?X.parentElement:null),se=O.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:V,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=_.getNodeFor((e=se.current.over)==null?void 0:e.id),ae=jj({measure:E.dragOverlay.measure}),te=(n=ae.nodeRef.current)!=null?n:X,be=S?(o=ae.rect)!=null?o:Y:null,ye=!!(ae.nodeRef.current&&ae.rect),ie=_g(ve=ye?null:Y,Ug(ve));var ve;const he=Wg(te?So(te):null),Se=function(le){const Ne=O.useRef(le),je=Ua(Le=>le?Le&&Le!==Vg&&le&&Ne.current&&le.parentNode===Ne.current.parentNode?Le:yi(le):Vg,[le]);return O.useEffect(()=>{Ne.current=le},[le]),je}(S?re??X:null),De=function(le,Ne){Ne===void 0&&(Ne=Cr);const[je]=le,Le=Wg(je?So(je):null),[Ve,Ae]=O.useState(qg);function Ue(){Ae(()=>le.length?le.map(We=>Og(We)?Le:new yd(Ne(We),We)):qg)}const Je=wi({callback:Ue});return Go(()=>{Je==null||Je.disconnect(),Ue(),le.forEach(We=>Je==null?void 0:Je.observe(We))},[le]),Ve}(Se),_e=function(le,Ne){let{transform:je,...Le}=Ne;return le!=null&&le.length?le.reduce((Ve,Ae)=>Ae({transform:Ve,...Le}),je):je}(f,{transform:{x:j.x-ie.x,y:j.y-ie.y,scaleX:1,scaleY:1},activatorEvent:z,active:P,activeNodeRect:Y,containerNodeRect:oe,draggingNodeRect:be,over:se.current.over,overlayNodeRect:ae.rect,scrollableAncestors:Se,scrollableAncestorRects:De,windowRect:he}),Fe=J?gs(J,j):null,Oe=function(le){const[Ne,je]=O.useState(null),Le=O.useRef(le),Ve=O.useCallback(Ae=>{const Ue=xd(Ae.target);Ue&&je(Je=>Je?(Je.set(Ue,bd(Ue)),new Map(Je)):null)},[]);return O.useEffect(()=>{const Ae=Le.current;if(le!==Ae){Ue(Ae);const Je=le.map(We=>{const nt=xd(We);return nt?(nt.addEventListener("scroll",Ve,{passive:!0}),[nt,bd(nt)]):null}).filter(We=>We!=null);je(Je.length?new Map(Je):null),Le.current=le}return()=>{Ue(le),Ue(Ae)};function Ue(Je){Je.forEach(We=>{const nt=xd(We);nt==null||nt.removeEventListener("scroll",Ve)})}},[Ve,le]),O.useMemo(()=>le.length?Ne?Array.from(Ne.values()).reduce((Ae,Ue)=>gs(Ae,Ue),Tn):Pg(le):Tn,[le,Ne])}(Se),Qe=Hg(Oe),qe=Hg(Oe,[Y]),Ke=gs(_e,Qe),Q=be?fj(be,_e):null,xe=P&&Q?u({active:P,collisionRect:Q,droppableRects:V,droppableContainers:B,pointerCoordinates:Fe}):null,we=pd(xe,"id"),[Te,W]=O.useState(null),ne=function(le,Ne,je){return{...le,scaleX:Ne&&je?Ne.width/je.width:1,scaleY:Ne&&je?Ne.height/je.height:1}}(ye?_e:gs(_e,qe),(r=Te==null?void 0:Te.rect)!=null?r:null,Y),ue=O.useRef(null),de=O.useCallback((le,Ne)=>{let{sensor:je,options:Le}=Ne;if(L.current==null)return;const Ve=C.get(L.current);if(!Ve)return;const Ae=le.nativeEvent,Ue=new je({active:L.current,activeNode:Ve,event:Ae,options:Le,context:se,onAbort(We){if(!C.get(We))return;const{onDragAbort:nt}=I.current,bt={id:We};nt==null||nt(bt),b({type:"onDragAbort",event:bt})},onPending(We,nt,bt,It){if(!C.get(We))return;const{onDragPending:Jt}=I.current,Bt={id:We,constraint:nt,initialCoordinates:bt,offset:It};Jt==null||Jt(Bt),b({type:"onDragPending",event:Bt})},onStart(We){const nt=L.current;if(nt==null)return;const bt=C.get(nt);if(!bt)return;const{onDragStart:It}=I.current,Jt={activatorEvent:Ae,active:{id:nt,data:bt.data,rect:T}};Ba.unstable_batchedUpdates(()=>{It==null||It(Jt),w(Eo.Initializing),p({type:Mt.DragStart,initialCoordinates:We,active:nt}),b({type:"onDragStart",event:Jt}),R(ue.current),D(Ae)})},onMove(We){p({type:Mt.DragMove,coordinates:We})},onEnd:Je(Mt.DragEnd),onCancel:Je(Mt.DragCancel)});function Je(We){return async function(){const{active:nt,collisions:bt,over:It,scrollAdjustedTranslate:Jt}=se.current;let Bt=null;if(nt&&Jt){const{cancelDrop:Mn}=I.current;Bt={activatorEvent:Ae,active:nt,collisions:bt,delta:Jt,over:It},We===Mt.DragEnd&&typeof Mn=="function"&&await Promise.resolve(Mn(Bt))&&(We=Mt.DragCancel)}L.current=null,Ba.unstable_batchedUpdates(()=>{p({type:We}),w(Eo.Uninitialized),W(null),R(null),D(null),ue.current=null;const Mn=We===Mt.DragEnd?"onDragEnd":"onDragCancel";if(Bt){const os=I.current[Mn];os==null||os(Bt),b({type:Mn,event:Bt})}})}}ue.current=Ue},[C]),ge=O.useCallback((le,Ne)=>(je,Le)=>{const Ve=je.nativeEvent,Ae=C.get(Le);if(L.current!==null||!Ae||Ve.dndKit||Ve.defaultPrevented)return;const Ue={active:Ae};le(je,Ne.options,Ue)===!0&&(Ve.dndKit={capturedBy:Ne.sensor},L.current=Le,de(je,Ne))},[C,de]),Me=function(le,Ne){return O.useMemo(()=>le.reduce((je,Le)=>{const{sensor:Ve}=Le;return[...je,...Ve.activators.map(Ae=>({eventName:Ae.eventName,handler:Ne(Ae.handler,Le)}))]},[]),[le,Ne])}(d,ge);(function(le){O.useEffect(()=>{if(!lm)return;const Ne=le.map(je=>{let{sensor:Le}=je;return Le.setup==null?void 0:Le.setup()});return()=>{for(const je of Ne)je==null||je()}},le.map(Ne=>{let{sensor:je}=Ne;return je}))})(d),Go(()=>{Y&&v===Eo.Initializing&&w(Eo.Initialized)},[Y,v]),O.useEffect(()=>{const{onDragMove:le}=I.current,{active:Ne,activatorEvent:je,collisions:Le,over:Ve}=se.current;if(!Ne||!je)return;const Ae={active:Ne,activatorEvent:je,collisions:Le,delta:{x:Ke.x,y:Ke.y},over:Ve};Ba.unstable_batchedUpdates(()=>{le==null||le(Ae),b({type:"onDragMove",event:Ae})})},[Ke.x,Ke.y]),O.useEffect(()=>{const{active:le,activatorEvent:Ne,collisions:je,droppableContainers:Le,scrollAdjustedTranslate:Ve}=se.current;if(!le||L.current==null||!Ne||!Ve)return;const{onDragOver:Ae}=I.current,Ue=Le.get(we),Je=Ue&&Ue.rect.current?{id:Ue.id,rect:Ue.rect.current,data:Ue.data,disabled:Ue.disabled}:null,We={active:le,activatorEvent:Ne,collisions:je,delta:{x:Ve.x,y:Ve.y},over:Je};Ba.unstable_batchedUpdates(()=>{W(Je),Ae==null||Ae(We),b({type:"onDragOver",event:We})})},[we]),Go(()=>{se.current={activatorEvent:z,active:P,activeNode:X,collisionRect:Q,collisions:xe,droppableRects:V,draggableNodes:C,draggingNode:te,draggingNodeRect:be,droppableContainers:_,over:Te,scrollableAncestors:Se,scrollAdjustedTranslate:Ke},T.current={initial:be,translated:Q}},[P,X,xe,Q,C,te,be,V,_,Te,Se,Ke]),Sj({...ee,delta:j,draggingRect:Q,pointerCoordinates:Fe,scrollableAncestors:Se,scrollableAncestorRects:De});const Re=O.useMemo(()=>({active:P,activeNode:X,activeNodeRect:Y,activatorEvent:z,collisions:xe,containerNodeRect:oe,dragOverlay:ae,draggableNodes:C,droppableContainers:_,droppableRects:V,over:Te,measureDroppableContainers:$,scrollableAncestors:Se,scrollableAncestorRects:De,measuringConfiguration:E,measuringScheduled:K,windowRect:he}),[P,X,Y,z,xe,oe,ae,C,_,V,Te,$,Se,De,E,K,he]),He=O.useMemo(()=>({activatorEvent:z,activators:Me,active:P,activeNodeRect:Y,ariaDescribedById:{draggable:k},dispatch:p,draggableNodes:C,over:Te,measureDroppableContainers:$}),[z,Me,P,Y,p,k,C,Te,$]);return G.createElement(Ng.Provider,{value:y},G.createElement(Si.Provider,{value:He},G.createElement(Gg.Provider,{value:Re},G.createElement(Yg.Provider,{value:ne},l)),G.createElement(Oj,{disabled:(a==null?void 0:a.restoreFocus)===!1})),G.createElement(lj,{...a,hiddenTextDescribedById:k}))}),Pj=O.createContext(null),Kg="button";function Rj(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const s=La("Draggable"),{activators:a,activatorEvent:i,active:l,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:f}=O.useContext(Si),{role:m=Kg,roleDescription:x="draggable",tabIndex:g=0}=r??{},p=(l==null?void 0:l.id)===e,b=O.useContext(p?Yg:Pj),[y,v]=dc(),[w,S]=dc(),N=function(j,_){return O.useMemo(()=>j.reduce((A,T)=>{let{eventName:P,handler:L}=T;return A[P]=M=>{L(M,_)},A},{}),[j,_])}(a,e),C=Fa(n);return Go(()=>(h.set(e,{id:e,key:s,node:y,activatorNode:w,data:C}),()=>{const j=h.get(e);j&&j.key===s&&h.delete(e)}),[h,e]),{active:l,activatorEvent:i,activeNodeRect:d,attributes:O.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!p||m!==Kg)||void 0,"aria-roledescription":x,"aria-describedby":u.draggable}),[o,m,g,p,x,u.draggable]),isDragging:p,listeners:o?void 0:N,node:y,over:f,setNodeRef:v,setActivatorNodeRef:S,transform:b}}const Lj={timeout:25};function Xg(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function Fj(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function Ni(t){return t!==null&&t>=0}const Ci={scaleX:1,scaleY:1},zj=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:s,index:a}=t;const i=(e=n[r])!=null?e:o;if(!i)return null;const l=function(d,u,h){const f=d[u],m=d[u-1],x=d[u+1];return!f||!m&&!x?0:h<u?m?f.left-(m.left+m.width):x.left-(f.left+f.width):x?x.left-(f.left+f.width):f.left-(m.left+m.width)}(n,a,r);if(a===r){const d=n[s];return d?{x:r<s?d.left+d.width-(i.left+i.width):d.left-i.left,y:0,...Ci}:null}return a>r&&a<=s?{x:-i.width-l,y:0,...Ci}:a<r&&a>=s?{x:i.width+l,y:0,...Ci}:{x:0,y:0,...Ci}},Jg=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=Xg(e,o,n),a=e[r],i=s[r];return i&&a?{x:i.left-a.left,y:i.top-a.top,scaleX:i.width/a.width,scaleY:i.height/a.height}:null},ji={scaleX:1,scaleY:1},Bj=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:s,overIndex:a}=t;const i=(e=s[n])!=null?e:o;if(!i)return null;if(r===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(i.top+i.height):d.top-i.top,...ji}:null}const l=function(d,u,h){const f=d[u],m=d[u-1],x=d[u+1];return f?h<u?m?f.top-(m.top+m.height):x?x.top-(f.top+f.height):0:x?x.top-(f.top+f.height):m?f.top-(m.top+m.height):0:0}(s,r,n);return r>n&&r<=a?{x:0,y:-i.height-l,...ji}:r<n&&r>=a?{x:0,y:i.height+l,...ji}:{x:0,y:0,...ji}},Zg="Sortable",Qg=G.createContext({activeIndex:-1,containerId:Zg,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Jg,disabled:{draggable:!1,droppable:!1}});function e1(t){let{children:e,id:n,items:o,strategy:r=Jg,disabled:s=!1}=t;const{active:a,dragOverlay:i,droppableRects:l,over:d,measureDroppableContainers:u}=O.useContext(Gg),h=La(Zg,n),f=i.rect!==null,m=O.useMemo(()=>o.map(N=>typeof N=="object"&&"id"in N?N.id:N),[o]),x=a!=null,g=a?m.indexOf(a.id):-1,p=d?m.indexOf(d.id):-1,b=O.useRef(m),y=!function(N,C){if(N===C)return!0;if(N.length!==C.length)return!1;for(let j=0;j<N.length;j++)if(N[j]!==C[j])return!1;return!0}(m,b.current),v=p!==-1&&g===-1||y,w=function(N){return typeof N=="boolean"?{draggable:N,droppable:N}:N}(s);Go(()=>{y&&x&&u(m)},[y,m,x,u]),O.useEffect(()=>{b.current=m},[m]);const S=O.useMemo(()=>({activeIndex:g,containerId:h,disabled:w,disableTransforms:v,items:m,overIndex:p,useDragOverlay:f,sortedRects:Fj(m,l),strategy:r}),[g,h,w.draggable,w.droppable,v,m,p,l,f,r]);return G.createElement(Qg.Provider,{value:S},e)}const Uj=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return Xg(n,o,r).indexOf(e)},$j=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:s,newIndex:a,previousItems:i,previousContainerId:l,transition:d}=t;return!(!d||!o)&&(i===s||r!==a)&&(!!n||a!==r&&e===l)},Vj={duration:200,easing:"ease"},t1="transform",Hj=fc.Transition.toString({property:t1,duration:0,easing:"linear"}),Wj={roleDescription:"sortable"};function n1(t){let{animateLayoutChanges:e=$j,attributes:n,disabled:o,data:r,getNewIndex:s=Uj,id:a,strategy:i,resizeObserverConfig:l,transition:d=Vj}=t;const{items:u,containerId:h,activeIndex:f,disabled:m,disableTransforms:x,sortedRects:g,overIndex:p,useDragOverlay:b,strategy:y}=O.useContext(Qg),v=function(re,ae){var te,be;return typeof re=="boolean"?{draggable:re,droppable:!1}:{draggable:(te=re==null?void 0:re.draggable)!=null?te:ae.draggable,droppable:(be=re==null?void 0:re.droppable)!=null?be:ae.droppable}}(o,m),w=u.indexOf(a),S=O.useMemo(()=>({sortable:{containerId:h,index:w,items:u},...r}),[h,r,w,u]),N=O.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:C,node:j,isOver:_,setNodeRef:A}=function(re){let{data:ae,disabled:te=!1,id:be,resizeObserverConfig:ye}=re;const ie=La("Droppable"),{active:ve,dispatch:he,over:Se,measureDroppableContainers:De}=O.useContext(Si),_e=O.useRef({disabled:te}),Fe=O.useRef(!1),Oe=O.useRef(null),Qe=O.useRef(null),{disabled:qe,updateMeasurementsFor:Ke,timeout:Q}={...Lj,...ye},xe=Fa(Ke??be),we=wi({callback:O.useCallback(()=>{Fe.current?(Qe.current!=null&&clearTimeout(Qe.current),Qe.current=setTimeout(()=>{De(Array.isArray(xe.current)?xe.current:[xe.current]),Qe.current=null},Q)):Fe.current=!0},[Q]),disabled:qe||!ve}),Te=O.useCallback((de,ge)=>{we&&(ge&&(we.unobserve(ge),Fe.current=!1),de&&we.observe(de))},[we]),[W,ne]=dc(Te),ue=Fa(ae);return O.useEffect(()=>{we&&W.current&&(we.disconnect(),Fe.current=!1,we.observe(W.current))},[W,we]),O.useEffect(()=>(he({type:Mt.RegisterDroppable,element:{id:be,key:ie,disabled:te,node:W,rect:Oe,data:ue}}),()=>he({type:Mt.UnregisterDroppable,key:ie,id:be})),[be]),O.useEffect(()=>{te!==_e.current.disabled&&(he({type:Mt.SetDroppableDisabled,id:be,key:ie,disabled:te}),_e.current.disabled=te)},[be,ie,te,he]),{active:ve,rect:Oe,isOver:(Se==null?void 0:Se.id)===be,node:W,over:Se,setNodeRef:ne}}({id:a,data:S,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...l}}),{active:T,activatorEvent:P,activeNodeRect:L,attributes:M,setNodeRef:R,listeners:z,isDragging:D,over:I,setActivatorNodeRef:k,transform:B}=Rj({id:a,data:S,attributes:{...Wj,...n},disabled:v.draggable}),E=Z9(A,R),U=!!T,V=U&&!x&&Ni(f)&&Ni(p),$=!b&&D,K=$&&V?B:null,X=V?K??(i??y)({rects:g,activeNodeRect:L,activeIndex:f,overIndex:p,index:w}):null,J=Ni(f)&&Ni(p)?s({id:a,items:u,activeIndex:f,overIndex:p}):w,ee=T==null?void 0:T.id,q=O.useRef({activeId:ee,items:u,newIndex:J,containerId:h}),Y=u!==q.current.items,oe=e({active:T,containerId:h,isDragging:D,isSorting:U,id:a,index:w,items:u,newIndex:q.current.newIndex,previousItems:q.current.items,previousContainerId:q.current.containerId,transition:d,wasDragging:q.current.activeId!=null}),se=function(re){let{disabled:ae,index:te,node:be,rect:ye}=re;const[ie,ve]=O.useState(null),he=O.useRef(te);return Go(()=>{if(!ae&&te!==he.current&&be.current){const Se=ye.current;if(Se){const De=Cr(be.current,{ignoreTransform:!0}),_e={x:Se.left-De.left,y:Se.top-De.top,scaleX:Se.width/De.width,scaleY:Se.height/De.height};(_e.x||_e.y)&&ve(_e)}}te!==he.current&&(he.current=te)},[ae,te,be,ye]),O.useEffect(()=>{ie&&ve(null)},[ie]),ie}({disabled:!oe,index:w,node:j,rect:C});return O.useEffect(()=>{U&&q.current.newIndex!==J&&(q.current.newIndex=J),h!==q.current.containerId&&(q.current.containerId=h),u!==q.current.items&&(q.current.items=u)},[U,J,h,u]),O.useEffect(()=>{if(ee===q.current.activeId)return;if(ee!=null&&q.current.activeId==null)return void(q.current.activeId=ee);const re=setTimeout(()=>{q.current.activeId=ee},50);return()=>clearTimeout(re)},[ee]),{active:T,activeIndex:f,attributes:M,data:S,rect:C,index:w,newIndex:J,items:u,isOver:_,isSorting:U,isDragging:D,listeners:z,node:j,overIndex:p,over:I,setNodeRef:E,setActivatorNodeRef:k,setDroppableNodeRef:A,setDraggableNodeRef:R,transform:se??X,transition:function(){if(se||Y&&q.current.newIndex===w)return Hj;if(!($&&!am(P)||!d)&&(U||oe))return fc.Transition.toString({...d,property:t1})}()}}function Ei(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const qj=[tt.Down,tt.Right,tt.Up,tt.Left],Gj=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:a,scrollableAncestors:i}}=e;if(qj.includes(t.code)){if(t.preventDefault(),!n||!o)return;const l=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const f=r.get(h.id);if(f)switch(t.code){case tt.Down:o.top<f.top&&l.push(h);break;case tt.Up:o.top>f.top&&l.push(h);break;case tt.Left:o.left>f.left&&l.push(h);break;case tt.Right:o.left<f.left&&l.push(h)}});const d=(h=>{let{collisionRect:f,droppableRects:m,droppableContainers:x}=h;const g=md(f),p=[];for(const b of x){const{id:y}=b,v=m.get(y);if(v){const w=md(v),S=g.reduce((C,j,_)=>C+hd(w[_],j),0),N=Number((S/4).toFixed(4));p.push({id:y,data:{droppableContainer:b,value:N}})}}return p.sort(fd)})({collisionRect:o,droppableRects:r,droppableContainers:l});let u=pd(d,"id");if(u===(a==null?void 0:a.id)&&d.length>1&&(u=d[1].id),u!=null){const h=s.get(n.id),f=s.get(u),m=f?r.get(f.id):null,x=f==null?void 0:f.node.current;if(x&&m&&h&&f){const g=yi(x).some((w,S)=>i[S]!==w),p=o1(h,f),b=function(w,S){return!Ei(w)||!Ei(S)||!o1(w,S)?!1:w.data.current.sortable.index<S.data.current.sortable.index}(h,f),y=g||!p?{x:0,y:0}:{x:b?o.width-m.width:0,y:b?o.height-m.height:0},v={x:m.left,y:m.top};return y.x&&y.y?v:za(v,y)}}}};function o1(t,e){return!(!Ei(t)||!Ei(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}const Yj=Q9("rounded-full shadow-xsSolid border p-[5px] transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-[var(--yellow-3)] hover:bg-[var(--yellow-4)] text-[var(--yellow-11)]",green:"hover:bg-[var(--grass-2)] hover:text-[var(--grass-11)] hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-[var(--red-3)] hover:text-[var(--red-11)]"}},defaultVariants:{variant:"default"}}),Ls=t=>{const e=H.c(21);let n,o,r,s,a;e[0]!==t?({children:n,tooltip:s,disabled:r,variant:a,...o}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=a):(n=e[1],o=e[2],r=e[3],s=e[4],a=e[5]);const i=r!==void 0&&r;let l,d,u;e[6]!==i||e[7]!==o?(l=f=>{var m;i||((m=o.onClick)==null||m.call(o,f))},e[6]=i,e[7]=o,e[8]=l):l=e[8],e[9]!==o.className||e[10]!==a?(d=me(Yj({variant:a}),o.className),e[9]=o.className,e[10]=a,e[11]=d):d=e[11],e[12]!==n||e[13]!==i||e[14]!==o||e[15]!==l||e[16]!==d?(u=c.jsx("button",{disabled:i,...o,onClick:l,onMouseDown:Dn.preventFocus,className:d,children:n}),e[12]=n,e[13]=i,e[14]=o,e[15]=l,e[16]=d,e[17]=u):u=e[17];const h=u;if(s){let f;return e[18]!==h||e[19]!==s?(f=c.jsx(Ce,{content:s,side:"top",delayDuration:200,usePortal:!1,children:h}),e[18]=h,e[19]=s,e[20]=f):f=e[20],f}return h},Kj=t=>{const e=H.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=me("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=c.jsx(OS,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},Xj=t=>{const e=H.c(9),{connectionState:n,status:o}=t,r=wg(o==="running");let s,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Wt("global.interrupt"),e[0]=s):s=e[0],e[1]!==n||e[2]!==r?(a=Kn(n)||!r,e[1]=n,e[2]=r,e[3]=a):a=e[3];const i=r?dm:Cn.NOOP,l=r?"stale":"disabled";let d,u;return e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(tc,{strokeWidth:1.5}),e[4]=d):d=e[4],e[5]!==a||e[6]!==i||e[7]!==l?(u=c.jsx(Ls,{tooltip:s,disabled:a,onClick:i,variant:l,"data-testid":"run-button",children:d}),e[5]=a,e[6]=i,e[7]=l,e[8]=u):u=e[8],u},jr={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},Fs=br.define({combine:t=>mc(t,{onError:console.error,inputDebounceTime:300,keymaps:jr},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),or=Tt.define(),rr=gn.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(or))return n.value;return t}}),zs=Tt.define(),Bs=Tt.define(),r1=gn.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(zs)&&(n={...n,inputValue:o.value}),o.is(Bs)&&(n={...n,shouldFocus:o.value});return n}}),_i=Tt.define(),Us=gn.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(_i))return n.value;return t}}),Er=Tt.define(),s1=gn.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Er))return n.value;return t}}),a1=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const a=Math.max(1,Math.min(r.number,o.lines)),i=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[or.of({show:!0,lineFrom:a,lineTo:i}),Bs.of(!0),zs.of("")],selection:ko.cursor(r.from)}),!0},i1=t=>!!t.state.field(Us)&&(t.dispatch({effects:[_i.of(null),or.of({show:!1,lineFrom:0,lineTo:0}),Bs.of(!1),zs.of(""),Er.of(!1)]}),!0),l1=t=>{const e=t.state.field(Us);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[_i.of(null),or.of({show:!1,lineFrom:0,lineTo:0}),Bs.of(!1),zs.of(""),Er.of(!1)]}),!0)},Jj=Ge.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}}),Zj="\u2318",Qj="\u229E Win",e4="Ctrl";function Ed(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?Zj:navigator.platform.startsWith("Win")?Qj:e4).replace("-"," ").toUpperCase()}function Gt(t,e){const n=document.createElement(t);return n.className=e,n}function t4(t){var r,s;const e=t.state.facet(Fs),n={...jr,...e.keymaps},o=Gt("div","cm-ai-tooltip").appendChild(Gt("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${Ed(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",a=>{a.stopPropagation()}),(s=o.querySelector("span"))==null||s.addEventListener("click",a=>{a.preventDefault(),a1(t)}),o}const n4=br.define({combine:t=>mc(t,{render:t4})}),o4=Rn.fromClass((tk=class{constructor(t){Z(this,"view");Z(this,"suppress");Z(this,"dom");Z(this,"mousedown",()=>{this.suppress=!0});Z(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});ak(this,Pl,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;this.dom.style.display="flex";const r=this.dom.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),a=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),i=s.width-r.width,l=Math.min(o.left,i);let d=o.top-r.height;d=a?Math.max(a.y,d):d,this.dom.style.left=`${l}px`,this.dom.style.top=`${d}px`,requestAnimationFrame(()=>{this.dom&&(this.dom.ariaHidden="false")})}else this.dom.style.display="none",this.dom.ariaHidden="true"});this.view=t;const e=t.state.facet(n4);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup);const n=e.render(t);t.dom.appendChild(n),this.dom=n}update(t){this.display(t.view)}docViewUpdate(t){this.display(t)}display(t){t.state.field(rr).show?this.dom.style.display="none":t.requestMeasure({read:sk(this,Pl)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.dom.remove()}},Pl=new WeakMap,tk)),r4=Ge.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class s4 extends xs{constructor(n){super();Z(this,"oldCode");this.oldCode=n}toDOM(n){const o=Gt("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=Gt("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=Gt("div","cm-floating-buttons"),a=n.state.facet(Fs),i={...jr,...a.keymaps},l=Gt("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${Ed(i.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),i1(n)});const d=Gt("button","cm-floating-button cm-floating-reject");return d.innerHTML=`<span class="hotkey">${Ed(i.rejectEdit)}</span> Reject`,d.setAttribute("aria-label","Reject changes"),d.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),l1(n)}),s.append(l,d),o.append(r,s),o}updateDOM(n,o){return!0}}class a4 extends xs{constructor(n){super();Z(this,"complete");Z(this,"abortController",null);Z(this,"dom",null);Z(this,"input",null);Z(this,"loadingContainer",null);Z(this,"helpInfo",null);Z(this,"inputContainer",null);Z(this,"form",null);Z(this,"view",null);Z(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});Z(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[or.of({show:!1,lineFrom:0,lineTo:0}),Er.of(!1)]}),n.focus())});Z(this,"handleSubmit",async n=>{var g;const o=this.view;if(!o)return;const r=o.state.facet(Fs);n==null||n.stopPropagation();const s=o.state.field(rr),{input:a}=this;if(!a)return;const i=a.value.trim();if(!s.show||!i)return;const l=o.state.doc.line(s.lineFrom),d=o.state.doc.line(s.lineTo),u=l.from,h=d.to,f=o.state.sliceDoc(u,h),m=o.state.sliceDoc(0,u),x=o.state.sliceDoc(h);this.abortController=new AbortController,o.dispatch({effects:Er.of(!0)}),this.toggleLoading(!0);try{const p=await this.complete({prompt:i,selection:f,codeBefore:m,codeAfter:x,editorView:o,signal:this.abortController.signal});if(!o.state.field(rr).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:u,to:h,insert:p},effects:[or.of({show:!1,lineFrom:0,lineTo:0}),_i.of({from:u,to:u+p.length,oldCode:f,newCode:p}),Er.of(!1)]})}catch(p){if(p instanceof DOMException&&p.name==="AbortError")return;(g=r.onError)==null||g.call(r,p)}finally{this.cleanup(),this.toggleLoading(!1),o.focus()}});this.complete=n}toDOM(n){if(this.dom)return this.dom;this.view=n;const o=n.state.field(r1),r=n.state.field(s1),s=Gt("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const a=Gt("form","cm-ai-input-form");this.form=a,a.setAttribute("role","search"),a.setAttribute("aria-label","AI editing instructions"),a.addEventListener("submit",p=>p.preventDefault());const i=Gt("input","cm-ai-input");this.input=i,a.append(i),i.placeholder="Editing instructions...",i.setAttribute("aria-label","AI editing instructions"),i.setAttribute("autocomplete","off"),i.setAttribute("spellcheck","true"),i.value=o.inputValue;const l=Gt("div","cm-ai-loading-container");this.loadingContainer=l;const d=Gt("div","cm-ai-loading-indicator");d.setAttribute("role","status"),d.setAttribute("aria-live","polite"),d.textContent="Generating";const u=Gt("button","cm-ai-cancel-button");u.textContent="Cancel",u.setAttribute("aria-label","Cancel code generation"),u.addEventListener("click",this.onCancel),l.append(u,d);const h=Gt("div","cm-ai-help-info");this.helpInfo=h;const f=h.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);const m=Gt("button","cm-ai-generate-button");function x(p){h.replaceChildren(p?m:f)}m.textContent="\u23CE Generate",m.setAttribute("aria-label","Generate code"),m.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{i.value=o.inputValue,i.focus(),n.dispatch({effects:Bs.of(!1)})}),x(i.value),i.addEventListener("input",function(){n.dispatch({effects:zs.of(i.value)});const p=i.value.trim();p!==g&&(g=p,x(p))}),i.addEventListener("keydown",this.onKeyDown);let g="";return s}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function i4(t){if(!t.prompt)throw new Error("prompt function is required");return[Fs.of(t),rr,r1,Us,s1,[o4,r4],Jj,_n.of([{key:jr.showInput,run:a1}]),No.highest([_n.of([{key:jr.acceptEdit,run:i1},{key:jr.rejectEdit,run:l1}])]),l4,c4,d4,u4]}const l4=Ge.updateListener.of(t=>{const e=t.state.field(rr);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((s,a,i,l)=>{const d=t.state.doc.lineAt(s).number;if(d<n){const u=t.state.doc.lineAt(l).number-t.state.doc.lineAt(i).number;n+=u,o+=u,r=!0}else if(d<=o){const u=t.state.doc.lineAt(l).number-t.state.doc.lineAt(i).number;o+=u,r=!0}}),r&&t.view.dispatch({effects:[or.of({show:!0,lineFrom:n,lineTo:o})]})}),c4=Ge.decorations.of(t=>{const e=t.state.field(Us);return e?ot.set([ot.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):ot.none}),d4=Ge.decorations.compute([rr],t=>{const e=t.field(rr),n=t.facet(Fs),o=[];if(e.show){const r=e.lineFrom,s=e.lineTo;for(let a=r;a<=s;a++){const i=t.doc.line(a).from;o.push(ot.line({class:"cm-ai-selection"}).range(i)),a===r&&o.push(ot.widget({widget:new a4(n.prompt),side:-1}).range(i))}}return ot.set(o)}),u4=gn.define({create:t=>ot.none,update(t,e){const n=e.state.field(Us);return n?ot.set([ot.widget({widget:new s4(n.oldCode),block:!0}).range(n.from)]):ot.none},provide:t=>Ge.decorations.from(t)}),Ii=gn.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(Ti));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),Ti=Tt.define();class h4 extends xs{constructor(n){super();Z(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
103
- `).length-1}}class f4{constructor(e){Z(this,"cache",new Map);Z(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const m4=(t,e)=>Rn.fromClass(class{constructor(){Z(this,"abortController",null);Z(this,"cache");this.cache=new f4(e.cacheTimeout??1e3)}async update(n){var a,i,l,d,u;if(!n.docChanged||((i=(a=e.events)==null?void 0:a.beforeSuggestionFetch)==null?void 0:i.call(a,n.view))===!1)return;(l=this.abortController)==null||l.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),s=this.cache.get(r);if(s)n.view.dispatch({effects:Ti.of({text:s,doc:o})});else try{const h=await t(n.state,this.abortController.signal);if(this.abortController.signal.aborted||((u=(d=e.events)==null?void 0:d.shouldShowSuggestion)==null?void 0:u.call(d,n.view,h))===!1)return;this.cache.set(r,h),n.view.dispatch({effects:Ti.of({text:h,doc:o})})}catch(h){h instanceof Error&&h.name!=="AbortError"&&console.error("Suggestion fetch error:",h)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),p4=Rn.fromClass(class{constructor(){Z(this,"decorations");this.decorations=ot.none}update(t){var n;const e=(n=t.state.field(Ii))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,a=[],i=ot.widget({widget:new h4(r),side:1});return a.push(i.range(s)),ot.set(a)}(t.view,e):ot.none}},{decorations:t=>t.decorations});function g4(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:ko.cursor(n+e.length)};const s=o-n;return!r.empty||s&&t.sliceDoc(r.from-s,r.from)!==t.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:e},range:ko.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const c1=t=>{var o,r,s;const e=(o=t.state.field(Ii))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(_d);return t.dispatch({effects:Ti.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},x4=_n.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field(Ii))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(_d);return t.dispatch({...g4(t.state,e,t.state.selection.main.head,t.state.selection.main.head)}),(s=(r=n.events)==null?void 0:r.onSuggestionAccepted)==null||s.call(r,t,e),!0}},{key:"Escape",run:c1}]),_d=br.define({combine:t=>t.at(-1)});function d1(t){const{delay:e=500,includeKeymap:n=!0}=t,o=function(r,s,a){let i=()=>{};return(...l)=>(i(),new Promise((d,u)=>{const h=setTimeout(()=>d(r(...l)),s);i=()=>{clearTimeout(h),a!==void 0&&u(a)}}))}(t.fetchFn,e);return[Ii,_d.of(t),m4(o,t),p4,n?x4:[]]}const u1="packages-install-input",b4=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let Id;function y4(){const t=async r=>{const s=et.get(Ra),a={...s,runtime:{...s.runtime,auto_reload:r}};await pr({config:a}).then(()=>et.set(Ra,a))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(u1);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{et.set(um,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:c.jsxs(c.Fragment,{children:["The package manager sidebar has been opened.",c.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{et.set(um,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:c.jsxs(c.Fragment,{children:["The package manager sidebar has been opened.",c.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{et.set(um,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:c.jsxs(c.Fragment,{children:["The package manager sidebar has been opened.",c.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:c.jsxs(c.Fragment,{children:["Module reload mode set to ",c.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:c.jsxs(c.Fragment,{children:["Module reload mode set to ",c.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:c.jsx(c.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:c.jsxs(c.Fragment,{children:["Shell commands are not directly supported.",c.jsx("br",{}),"Use ",c.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...b4.map(r=>({match:r,onMatch:()=>{},title:c.jsx(t3,{className:"inline",children:r}),description:c.jsxs(c.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",c.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return Ge.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,a=r.state.doc,i=a.lineAt(s.head),l=a.sliceString(i.from,s.anchor).trim(),d=o.get(l);d&&(d.onMatch(),Id?Id.upsert({title:d.title,description:d.description}):Id=Xe({title:d.title,description:d.description}))}})}const v4=new Set(["Escape","Alt-`"]);function w4(){const t=n3.filter(e=>!v4.has(e.key));return No.highest(_n.of([...t,{key:"Escape",run:e=>{const n=Lf(e);return!$a(e)&&n}},{key:"Ctrl-y",run:e=>!!$a(e)&&o3(e)},{key:"Ctrl-n",run:e=>!!$a(e)&&pc(!0)(e)},{key:"Ctrl-p",run:e=>!!$a(e)&&pc(!1)(e)}]))}const Td=Tt.define(),Ad=Tt.define(),Md=Tt.define();function gt(t,e){if(!t)throw new Error(e)}function Ai(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function Od(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function h1(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const f1=Symbol("@bufbuild/protobuf/enum-type");function k4(t){const e=t[f1];return gt(e,"missing enum type on enum object"),e}function m1(t,e,n,o){t[f1]=p1(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function p1(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const a of e){const i=g1(a);s.push(i),o[a.name]=i,r[a.no]=i}return{typeName:t,values:s,findName:a=>o[a],findNumber:a=>r[a]}}function S4(t,e,n){const o={};for(const r of e){const s=g1(r);o[s.localName]=s.no,o[s.no]=s.localName}return m1(o,t,e),o}function g1(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Nt{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function N4(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Dd(t,e,n){for(let s=0;s<28;s+=7){const a=t>>>s,i=!(!(a>>>7)&&e==0),l=255&(i?128|a:a);if(n.push(l),!i)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const a=e>>>s,i=!!(a>>>7),l=255&(i?128|a:a);if(n.push(l),!i)return}n.push(e>>>31&1)}}const Mi=4294967296;function x1(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(a,i){const l=Number(t.slice(a,i));r*=n,o=o*n+l,o>=Mi&&(r+=o/Mi|0,o%=Mi)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?y1(o,r):Pd(o,r)}function b1(t,e){if({lo:t,hi:e}=function(l,d){return{lo:l>>>0,hi:d>>>0}}(t,e),e<=2097151)return String(Mi*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,a=2*o;const i=1e7;return r>=i&&(s+=Math.floor(r/i),r%=i),s>=i&&(a+=Math.floor(s/i),s%=i),a.toString()+v1(s)+v1(r)}function Pd(t,e){return{lo:0|t,hi:0|e}}function y1(t,e){return e=~e,t?t=1+~t:e+=1,Pd(t,e)}const v1=t=>{const e=String(t);return"0000000".slice(e.length)+e};function w1(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function C4(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var j4={};const ht=function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||j4.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){const l=typeof i=="bigint"?i:BigInt(i);if(l>r||l<o)throw new Error(`int64 invalid: ${i}`);return l},uParse(i){const l=typeof i=="bigint"?i:BigInt(i);if(l>a||l<s)throw new Error(`uint64 invalid: ${i}`);return l},enc(i){return t.setBigInt64(0,this.parse(i),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(i){return t.setBigInt64(0,this.uParse(i),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(i,l)=>(t.setInt32(0,i,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(i,l)=>(t.setInt32(0,i,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>gt(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>gt(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),x1(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),x1(o)),dec:(o,r)=>function(s,a){let i=Pd(s,a);const l=2147483648&i.hi;l&&(i=y1(i.lo,i.hi));const d=b1(i.lo,i.hi);return l?"-"+d:d}(o,r),uDec:(o,r)=>b1(o,r)}}();var ce,_o,kt;function Io(t,e,n){if(e===n)return!0;if(t==ce.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case ce.UINT64:case ce.FIXED64:case ce.INT64:case ce.SFIXED64:case ce.SINT64:return e==n}return!1}function _r(t,e){switch(t){case ce.BOOL:return!1;case ce.UINT64:case ce.FIXED64:case ce.INT64:case ce.SFIXED64:case ce.SINT64:return e==0?ht.zero:"0";case ce.DOUBLE:case ce.FLOAT:return 0;case ce.BYTES:return new Uint8Array(0);case ce.STRING:return"";default:return 0}}function k1(t,e){switch(t){case ce.BOOL:return e===!1;case ce.STRING:return e==="";case ce.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(ce||(ce={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(_o||(_o={})),function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(kt||(kt={}));class E4{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Od(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Ai(e),w1(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){h1(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){Od(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Ai(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Ai(e),w1(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=ht.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=ht.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=ht.enc(e);return Dd(n.lo,n.hi,this.buf),this}sint64(e){let n=ht.enc(e),o=n.hi>>31;return Dd(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=ht.uEnc(e);return Dd(n.lo,n.hi,this.buf),this}}class _4{constructor(e,n){this.varint64=N4,this.uint32=C4,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case kt.Varint:for(;128&this.buf[this.pos++];);break;case kt.Bit64:this.pos+=4;case kt.Bit32:this.pos+=4;break;case kt.LengthDelimited:let r=this.uint32();this.pos+=r;break;case kt.StartGroup:for(;;){const[s,a]=this.tag();if(a===kt.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(a,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return ht.dec(...this.varint64())}uint64(){return ht.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,ht.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return ht.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return ht.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function S1(t){const e=t.field.localName,n=Object.create(null);return n[e]=function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return _r(r.T,r.L);case"message":const s=r.T,a=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(a):a;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let Jn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Oi=[];for(let t=0;t<Jn.length;t++)Oi[Jn[t].charCodeAt(0)]=t;Oi[45]=Jn.indexOf("+"),Oi[95]=Jn.indexOf("/");const Di={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,a=0;for(let i=0;i<t.length;i++){if(n=Oi[t.charCodeAt(i)],n===void 0)switch(t[i]){case"=":s=0;case`
104
- `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:a=n,s=1;break;case 1:o[r++]=a<<2|(48&n)>>4,a=n,s=2;break;case 2:o[r++]=(15&a)<<4|(60&n)>>2,a=n,s=3;break;case 3:o[r++]=(3&a)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=Jn[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=Jn[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=Jn[r|e>>6],n+=Jn[63&e],o=0}return o&&(n+=Jn[r],n+="=",o==1&&(n+="=")),n}};function I4(t,e,n){C1(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(i,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let d=i.length-1;d>=0;--d)if(i[d].no==l.no)return[i[d]];return[]}return i.filter(d=>d.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,a]=S1(e);for(const i of r)e.runtime.bin.readField(s,o.readerFactory(i.data),e.field,i.wireType,o);return a()}function T4(t,e,n,o){C1(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(N1(t,e)){const d=t.getType().runtime.bin.listUnknownFields(t).filter(u=>u.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const u of d)t.getType().runtime.bin.onUnknownField(t,u.no,u.wireType,u.data)}const a=s.writerFactory();let i=e.field;i.opt||i.repeated||i.kind!="enum"&&i.kind!="scalar"||(i=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(i,n,a,s);const l=r.readerFactory(a.finish());for(;l.pos<l.len;){const[d,u]=l.tag(),h=l.skip(u,d);t.getType().runtime.bin.onUnknownField(t,d,u,h)}}function N1(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function C1(t,e){gt(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function j1(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!k1(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function E1(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?_r(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function Zn(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Nt.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function _1(t,e){return Zn(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}ce.DOUBLE,ce.FLOAT,ce.INT64,ce.UINT64,ce.INT32,ce.UINT32,ce.BOOL,ce.STRING,ce.BYTES;const I1={ignoreUnknownFields:!1},T1={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function A4(t){return t?Object.assign(Object.assign({},I1),t):I1}function M4(t){return t?Object.assign(Object.assign({},T1),t):T1}const Pi=Symbol(),Ri=Symbol();function Fn(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function A1(t,e,n,o,r){let s=n.localName;if(n.repeated){if(gt(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Fn(e)}`);const a=t[s];for(const i of e){if(i===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Fn(i)}`);switch(n.kind){case"message":a.push(n.T.fromJson(i,o));break;case"enum":const l=Rd(n.T,i,o.ignoreUnknownFields,!0);l!==Ri&&a.push(l);break;case"scalar":try{a.push($s(n.T,i,n.L,!0))}catch(d){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Fn(i)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Fn(e)}`);const a=t[s];for(const[i,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let d;try{d=O4(n.K,i)}catch(u){let h=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Fn(e)}`;throw u instanceof Error&&u.message.length>0&&(h+=`: ${u.message}`),new Error(h)}switch(n.V.kind){case"message":a[d]=n.V.T.fromJson(l,o);break;case"enum":const u=Rd(n.V.T,l,o.ignoreUnknownFields,!0);u!==Ri&&(a[d]=u);break;case"scalar":try{a[d]=$s(n.V.T,l,_o.BIGINT,!0)}catch(h){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Fn(e)}`;throw h instanceof Error&&h.message.length>0&&(f+=`: ${h.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const a=n.T;if(e===null&&a.typeName!="google.protobuf.Value")return;let i=t[s];Zn(i)?i.fromJson(e,o):(t[s]=i=a.fromJson(e,o),a.fieldWrapper&&!n.oneof&&(t[s]=a.fieldWrapper.unwrapField(i)));break;case"enum":const l=Rd(n.T,e,o.ignoreUnknownFields,!1);switch(l){case Pi:E1(n,t);break;case Ri:break;default:t[s]=l}break;case"scalar":try{const d=$s(n.T,e,n.L,!1);d===Pi?E1(n,t):t[s]=d}catch(d){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Fn(e)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}}}function O4(t,e){if(t===ce.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return $s(t,e,_o.BIGINT,!0).toString()}function $s(t,e,n,o){if(e===null)return o?_r(t,n):Pi;switch(t){case ce.DOUBLE:case ce.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==ce.FLOAT&&h1(r),r;case ce.INT32:case ce.FIXED32:case ce.SFIXED32:case ce.SINT32:case ce.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==ce.UINT32||t==ce.FIXED32?Od(s):Ai(s),s;case ce.INT64:case ce.SFIXED64:case ce.SINT64:if(typeof e!="number"&&typeof e!="string")break;const a=ht.parse(e);return n?a.toString():a;case ce.FIXED64:case ce.UINT64:if(typeof e!="number"&&typeof e!="string")break;const i=ht.uParse(e);return n?i.toString():i;case ce.BOOL:if(typeof e!="boolean")break;return e;case ce.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case ce.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Di.dec(e)}throw new Error}function Rd(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:Pi;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return Ri}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${Fn(e)}`)}function D4(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function M1(t,e,n){if(t.kind=="map"){gt(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[a,i]of r)o[a.toString()]=Li(t.V.T,i);break;case"message":for(const[a,i]of r)o[a.toString()]=i.toJson(n);break;case"enum":const s=t.V.T;for(const[a,i]of r)o[a.toString()]=Ld(s,i,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){gt(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(Li(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Ld(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return Li(t.T,e);case"enum":return Ld(t.T,e,n.enumAsInteger);case"message":return _1(t.T,e).toJson(n)}}function Ld(t,e,n){var o;if(gt(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function Li(t,e){switch(t){case ce.INT32:case ce.SFIXED32:case ce.SINT32:case ce.FIXED32:case ce.UINT32:return gt(typeof e=="number"),e;case ce.FLOAT:case ce.DOUBLE:return gt(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case ce.STRING:return gt(typeof e=="string"),e;case ce.BOOL:return gt(typeof e=="boolean"),e;case ce.UINT64:case ce.FIXED64:case ce.INT64:case ce.SFIXED64:case ce.SINT64:return gt(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case ce.BYTES:return gt(e instanceof Uint8Array),Di.enc(e)}}const Ir=Symbol("@bufbuild/protobuf/unknown-fields"),O1={readUnknownFields:!0,readerFactory:t=>new _4(t)},D1={writeUnknownFields:!0,writerFactory:()=>new E4};function P4(t){return t?Object.assign(Object.assign({},O1),t):O1}function R4(t){return t?Object.assign(Object.assign({},D1),t):D1}function P1(t,e,n,o,r){let{repeated:s,localName:a}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=a&&delete t.value,t.case=a,a="value"),n.kind){case"scalar":case"enum":const i=n.kind=="enum"?ce.INT32:n.T;let l=zi;if(n.kind=="scalar"&&n.L>0&&(l=L4),s){let f=t[a];if(o==kt.LengthDelimited&&i!=ce.STRING&&i!=ce.BYTES){let m=e.uint32()+e.pos;for(;e.pos<m;)f.push(l(e,i))}else f.push(l(e,i))}else t[a]=l(e,i);break;case"message":const d=n.T;s?t[a].push(Fi(e,new d,r,n)):Zn(t[a])?Fi(e,t[a],r,n):(t[a]=Fi(e,new d,r,n),!d.fieldWrapper||n.oneof||n.repeated||(t[a]=d.fieldWrapper.unwrapField(t[a])));break;case"map":let[u,h]=function(f,m,x){const g=m.uint32(),p=m.pos+g;let b,y;for(;m.pos<p;){const[v]=m.tag();switch(v){case 1:b=zi(m,f.K);break;case 2:switch(f.V.kind){case"scalar":y=zi(m,f.V.T);break;case"enum":y=m.int32();break;case"message":y=Fi(m,new f.V.T,x,void 0)}}}if(b===void 0&&(b=_r(f.K,_o.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),y===void 0)switch(f.V.kind){case"scalar":y=_r(f.V.T,_o.BIGINT);break;case"enum":y=f.V.T.values[0].no;break;case"message":y=new f.V.T}return[b,y]}(n,e,r);t[a][u]=h}}function Fi(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function L4(t,e){const n=zi(t,e);return typeof n=="bigint"?n.toString():n}function zi(t,e){switch(e){case ce.STRING:return t.string();case ce.BOOL:return t.bool();case ce.DOUBLE:return t.double();case ce.FLOAT:return t.float();case ce.INT32:return t.int32();case ce.INT64:return t.int64();case ce.UINT64:return t.uint64();case ce.FIXED64:return t.fixed64();case ce.BYTES:return t.bytes();case ce.FIXED32:return t.fixed32();case ce.SFIXED32:return t.sfixed32();case ce.SFIXED64:return t.sfixed64();case ce.SINT64:return t.sint64();case ce.UINT32:return t.uint32();case ce.SINT32:return t.sint32()}}function R1(t,e,n,o){gt(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?ce.INT32:t.T;if(r)if(gt(Array.isArray(e)),t.packed)(function(a,i,l,d){if(!d.length)return;a.tag(l,kt.LengthDelimited).fork();let[,u]=F1(i);for(let h=0;h<d.length;h++)a[u](d[h]);a.join()})(n,s,t.no,e);else for(const a of e)Vs(n,s,t.no,a);else Vs(n,s,t.no,e);break;case"message":if(r){gt(Array.isArray(e));for(const a of e)L1(n,o,t,a)}else L1(n,o,t,e);break;case"map":gt(typeof e=="object"&&e!=null);for(const[a,i]of Object.entries(e))F4(n,o,t,a,i)}}function F4(t,e,n,o,r){t.tag(n.no,kt.LengthDelimited),t.fork();let s=o;switch(n.K){case ce.INT32:case ce.FIXED32:case ce.UINT32:case ce.SFIXED32:case ce.SINT32:s=Number.parseInt(o);break;case ce.BOOL:gt(o=="true"||o=="false"),s=o=="true"}switch(Vs(t,n.K,1,s),n.V.kind){case"scalar":Vs(t,n.V.T,2,r);break;case"enum":Vs(t,ce.INT32,2,r);break;case"message":gt(r!==void 0),t.tag(2,kt.LengthDelimited).bytes(r.toBinary(e))}t.join()}function L1(t,e,n,o){const r=_1(n.T,o);n.delimited?t.tag(n.no,kt.StartGroup).raw(r.toBinary(e)).tag(n.no,kt.EndGroup):t.tag(n.no,kt.LengthDelimited).bytes(r.toBinary(e))}function Vs(t,e,n,o){gt(o!==void 0);let[r,s]=F1(e);t.tag(n,r)[s](o)}function F1(t){let e=kt.Varint;switch(t){case ce.BYTES:case ce.STRING:e=kt.LengthDelimited;break;case ce.DOUBLE:case ce.FIXED64:case ce.SFIXED64:e=kt.Bit64;break;case ce.FIXED32:case ce.SFIXED32:case ce.FLOAT:e=kt.Bit32}return[e,ce[t].toLowerCase()]}function Bi(t){if(t===void 0)return t;if(Zn(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Hs(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class z4{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function z1(t,e){const n=B1(t);return e?n:H4(V4(n))}const B4=B1;function B1(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const U4=new Set(["constructor","toString","toJSON","valueOf"]),$4=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),U1=t=>`${t}$`,V4=t=>$4.has(t)?U1(t):t,H4=t=>U4.has(t)?U1(t):t;class W4{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=z1(e,!1)}addField(e){gt(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const pe=($1=t=>new z4(t,e=>function(n){var o,r,s,a,i,l;const d=[];let u;for(const h of typeof n=="function"?n():n){const f=h;if(f.localName=z1(h.name,h.oneof!==void 0),f.jsonName=(o=h.jsonName)!==null&&o!==void 0?o:B4(h.name),f.repeated=(r=h.repeated)!==null&&r!==void 0&&r,h.kind=="scalar"&&(f.L=(s=h.L)!==null&&s!==void 0?s:_o.BIGINT),f.delimited=(a=h.delimited)!==null&&a!==void 0&&a,f.req=(i=h.req)!==null&&i!==void 0&&i,f.opt=(l=h.opt)!==null&&l!==void 0&&l,h.packed===void 0&&(f.packed=h.kind=="enum"||h.kind=="scalar"&&h.T!=ce.BYTES&&h.T!=ce.STRING),h.oneof!==void 0){const m=typeof h.oneof=="string"?h.oneof:h.oneof.name;u&&u.name==m||(u=new W4(m)),f.oneof=u,u.addField(f)}d.push(f)}return d}(e)),V1=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=_r(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:A4,makeWriteOptions:M4,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${Fn(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[a,i]of Object.entries(e)){const l=t.fields.findJsonName(a);if(l){if(l.oneof){if(i===null&&l.kind=="scalar")continue;const d=r.get(l.oneof);if(d!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${d}", "${a}"`);r.set(l.oneof,a)}A1(o,i,l,n,t)}else{let d=!1;if(s!=null&&s.findExtension&&a.startsWith("[")&&a.endsWith("]")){const u=s.findExtension(a.substring(1,a.length-1));if(u&&u.extendee.typeName==t.typeName){d=!0;const[h,f]=S1(u);A1(h,i,u.field,n,u),T4(o,u,f(),n)}}if(!d&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${a}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!j1(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!D4(r))continue}const a=M1(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);a!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=a)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const a of n.runtime.bin.listUnknownFields(t)){const i=s.findExtensionFor(n.typeName,a.no);if(i&&N1(t,i)){const l=I4(t,i,e),d=M1(i.field,l,e);d!==void 0&&(o[i.field.jsonName]=d)}}}catch(s){const a=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,i=s instanceof Error?s.message:String(s);throw new Error(a+(i.length>0?`: ${i}`:""))}return o},readScalar:(t,e,n)=>$s(t,e,n??_o.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||k1(t,e)?Li(t,e):void 0},debug:Fn},bin:{makeReadOptions:P4,makeWriteOptions:R4,listUnknownFields(t){var e;return(e=t[Ir])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Ir]},writeUnknownFields(t,e){const n=t[Ir];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[Ir])||(r[Ir]=[]),r[Ir].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),a=r?e.len:e.pos+n;let i,l;for(;e.pos<a&&([i,l]=e.tag(),r!==!0||l!=kt.EndGroup);){const d=s.fields.find(i);if(!d){const u=e.skip(l,i);o.readUnknownFields&&this.onUnknownField(t,i,l,u);continue}P1(t,e,d,l,o)}if(r&&(l!=kt.EndGroup||i!==n))throw new Error("invalid end group tag")},readField:P1,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(j1(r,t))R1(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&R1(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:m1,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,a=t;if(a[r]!=null)switch(o.kind){case"oneof":const i=a[r].case;if(i===void 0)continue;const l=o.findField(i);let d=a[r].value;l&&l.kind=="message"&&!Zn(d,l.T)?d=new l.T(d):l&&l.kind==="scalar"&&l.T===ce.BYTES&&(d=Hs(d)),s[r]={case:i,value:d};break;case"scalar":case"enum":let u=a[r];o.T===ce.BYTES&&(u=o.repeated?u.map(Hs):Hs(u)),s[r]=u;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===ce.BYTES)for(const[m,x]of Object.entries(a[r]))s[r][m]=Hs(x);else Object.assign(s[r],a[r]);break;case"message":const f=o.V.T;for(const m of Object.keys(a[r])){let x=a[r][m];f.fieldWrapper||(x=new f(x)),s[r][m]=x}}break;case"message":const h=o.T;if(o.repeated)s[r]=a[r].map(f=>Zn(f,h)?f:new h(f));else{const f=a[r];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?s[r]=Hs(f):s[r]=f:s[r]=Zn(f,h)?f:new h(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((a,i)=>o.T.equals(a,s[i]));case"scalar":return r.every((a,i)=>Io(o.T,a,s[i]));case"enum":return r.every((a,i)=>Io(ce.INT32,a,s[i]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":let a=r,i=s;return o.T.fieldWrapper&&(a===void 0||Zn(a)||(a=o.T.fieldWrapper.wrapField(a)),i===void 0||Zn(i)||(i=o.T.fieldWrapper.wrapField(i))),o.T.equals(a,i);case"enum":return Io(ce.INT32,r,s);case"scalar":return Io(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const l=o.findField(r.case);if(l===void 0)return!0;switch(l.kind){case"message":return l.T.equals(r.value,s.value);case"enum":return Io(ce.INT32,r.value,s.value);case"scalar":return Io(l.T,r.value,s.value)}throw new Error(`oneof cannot contain ${l.kind}`);case"map":const d=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const u=o.V.T;return d.every(f=>u.equals(r[f],s[f]));case"enum":return d.every(f=>Io(ce.INT32,r[f],s[f]));case"scalar":const h=o.V.T;return d.every(f=>Io(h,r[f],s[f]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let a;if(r.repeated)a=s.map(Bi);else if(r.kind=="map"){a=o[r.localName];for(const[i,l]of Object.entries(s))a[i]=Bi(l)}else a=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:Bi(s.value)}:{case:void 0}:Bi(s);o[r.localName]=a}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:$1,initFields:V1}),makeMessageType(t,e,n){return function(o,r,s,a){var i;const l=(i=a==null?void 0:a.localName)!==null&&i!==void 0?i:r.substring(r.lastIndexOf(".")+1),d={[l]:function(u){o.util.initFields(this),o.util.initPartial(u,this)}}[l];return Object.setPrototypeOf(d.prototype,new Nt),Object.assign(d,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(u,h)=>new d().fromBinary(u,h),fromJson:(u,h)=>new d().fromJson(u,h),fromJsonString:(u,h)=>new d().fromJsonString(u,h),equals:(u,h)=>o.util.equals(d,u,h)}),d}(this,t,e,n)},makeEnum:S4,makeEnumType:p1,getEnumType:k4,makeExtension(t,e,n){return function(o,r,s,a){let i;return{typeName:r,extendee:s,get field(){if(!i){const l=typeof a=="function"?a():a;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,i=o.util.newFieldList([l]).list()[0]}return i},runtime:o}}(this,t,e,n)}});var $1,V1,dn,Fd,Ui,Ws,$i,qs,To;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(dn||(dn={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(Fd||(Fd={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(Ui||(Ui={})),pe.util.setEnumType(Ui,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(Ws||(Ws={})),pe.util.setEnumType(Ws,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"}($i||($i={})),pe.util.setEnumType($i,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"}(qs||(qs={})),pe.util.setEnumType(qs,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"}(To||(To={})),pe.util.setEnumType(To,"exa.codeium_common_pb.Language",[{no:0,name:"LANGUAGE_UNSPECIFIED"},{no:1,name:"LANGUAGE_C"},{no:2,name:"LANGUAGE_CLOJURE"},{no:3,name:"LANGUAGE_COFFEESCRIPT"},{no:4,name:"LANGUAGE_CPP"},{no:5,name:"LANGUAGE_CSHARP"},{no:6,name:"LANGUAGE_CSS"},{no:7,name:"LANGUAGE_CUDACPP"},{no:8,name:"LANGUAGE_DOCKERFILE"},{no:9,name:"LANGUAGE_GO"},{no:10,name:"LANGUAGE_GROOVY"},{no:11,name:"LANGUAGE_HANDLEBARS"},{no:12,name:"LANGUAGE_HASKELL"},{no:13,name:"LANGUAGE_HCL"},{no:14,name:"LANGUAGE_HTML"},{no:15,name:"LANGUAGE_INI"},{no:16,name:"LANGUAGE_JAVA"},{no:17,name:"LANGUAGE_JAVASCRIPT"},{no:18,name:"LANGUAGE_JSON"},{no:19,name:"LANGUAGE_JULIA"},{no:20,name:"LANGUAGE_KOTLIN"},{no:21,name:"LANGUAGE_LATEX"},{no:22,name:"LANGUAGE_LESS"},{no:23,name:"LANGUAGE_LUA"},{no:24,name:"LANGUAGE_MAKEFILE"},{no:25,name:"LANGUAGE_MARKDOWN"},{no:26,name:"LANGUAGE_OBJECTIVEC"},{no:27,name:"LANGUAGE_OBJECTIVECPP"},{no:28,name:"LANGUAGE_PERL"},{no:29,name:"LANGUAGE_PHP"},{no:30,name:"LANGUAGE_PLAINTEXT"},{no:31,name:"LANGUAGE_PROTOBUF"},{no:32,name:"LANGUAGE_PBTXT"},{no:33,name:"LANGUAGE_PYTHON"},{no:34,name:"LANGUAGE_R"},{no:35,name:"LANGUAGE_RUBY"},{no:36,name:"LANGUAGE_RUST"},{no:37,name:"LANGUAGE_SASS"},{no:38,name:"LANGUAGE_SCALA"},{no:39,name:"LANGUAGE_SCSS"},{no:40,name:"LANGUAGE_SHELL"},{no:41,name:"LANGUAGE_SQL"},{no:42,name:"LANGUAGE_STARLARK"},{no:43,name:"LANGUAGE_SWIFT"},{no:44,name:"LANGUAGE_TSX"},{no:45,name:"LANGUAGE_TYPESCRIPT"},{no:46,name:"LANGUAGE_VISUALBASIC"},{no:47,name:"LANGUAGE_VUE"},{no:48,name:"LANGUAGE_XML"},{no:49,name:"LANGUAGE_XSL"},{no:50,name:"LANGUAGE_YAML"},{no:51,name:"LANGUAGE_SVELTE"},{no:52,name:"LANGUAGE_TOML"},{no:53,name:"LANGUAGE_DART"},{no:54,name:"LANGUAGE_RST"},{no:55,name:"LANGUAGE_OCAML"},{no:56,name:"LANGUAGE_CMAKE"},{no:57,name:"LANGUAGE_PASCAL"},{no:58,name:"LANGUAGE_ELIXIR"},{no:59,name:"LANGUAGE_FSHARP"},{no:60,name:"LANGUAGE_LISP"},{no:61,name:"LANGUAGE_MATLAB"},{no:62,name:"LANGUAGE_POWERSHELL"},{no:63,name:"LANGUAGE_SOLIDITY"},{no:64,name:"LANGUAGE_ADA"},{no:65,name:"LANGUAGE_OCAML_INTERFACE"}]);const eo=class eo extends Nt{constructor(n){super();Z(this,"completionId","");Z(this,"text","");Z(this,"prefix","");Z(this,"stop","");Z(this,"score",0);Z(this,"tokens",[]);Z(this,"decodedTokens",[]);Z(this,"probabilities",[]);Z(this,"adjustedProbabilities",[]);Z(this,"generatedLength",ht.zero);pe.util.initPartial(n,this)}static fromBinary(n,o){return new eo().fromBinary(n,o)}static fromJson(n,o){return new eo().fromJson(n,o)}static fromJsonString(n,o){return new eo().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(eo,n,o)}};Z(eo,"runtime",pe),Z(eo,"typeName","exa.codeium_common_pb.Completion"),Z(eo,"fields",pe.util.newFieldList(()=>[{no:1,name:"completion_id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"prefix",kind:"scalar",T:9},{no:4,name:"stop",kind:"scalar",T:9},{no:5,name:"score",kind:"scalar",T:1},{no:6,name:"tokens",kind:"scalar",T:4,repeated:!0},{no:7,name:"decoded_tokens",kind:"scalar",T:9,repeated:!0},{no:8,name:"probabilities",kind:"scalar",T:1,repeated:!0},{no:9,name:"adjusted_probabilities",kind:"scalar",T:1,repeated:!0},{no:10,name:"generated_length",kind:"scalar",T:4}]));let zd=eo;const to=class to extends Nt{constructor(n){super();Z(this,"ideName","");Z(this,"ideVersion","");Z(this,"extensionName","");Z(this,"extensionVersion","");Z(this,"apiKey","");Z(this,"locale","");Z(this,"sessionId","");Z(this,"requestId",ht.zero);Z(this,"userAgent","");Z(this,"url","");Z(this,"authSource",Ws.CODEIUM);pe.util.initPartial(n,this)}static fromBinary(n,o){return new to().fromBinary(n,o)}static fromJson(n,o){return new to().fromJson(n,o)}static fromJsonString(n,o){return new to().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(to,n,o)}};Z(to,"runtime",pe),Z(to,"typeName","exa.codeium_common_pb.Metadata"),Z(to,"fields",pe.util.newFieldList(()=>[{no:1,name:"ide_name",kind:"scalar",T:9},{no:7,name:"ide_version",kind:"scalar",T:9},{no:12,name:"extension_name",kind:"scalar",T:9},{no:2,name:"extension_version",kind:"scalar",T:9},{no:3,name:"api_key",kind:"scalar",T:9},{no:4,name:"locale",kind:"scalar",T:9},{no:10,name:"session_id",kind:"scalar",T:9},{no:9,name:"request_id",kind:"scalar",T:4},{no:13,name:"user_agent",kind:"scalar",T:9},{no:14,name:"url",kind:"scalar",T:9},{no:15,name:"auth_source",kind:"enum",T:pe.getEnumType(Ws)}]));let Vi=to;const no=class no extends Nt{constructor(n){super();Z(this,"tabSize",ht.zero);Z(this,"insertSpaces",!1);pe.util.initPartial(n,this)}static fromBinary(n,o){return new no().fromBinary(n,o)}static fromJson(n,o){return new no().fromJson(n,o)}static fromJsonString(n,o){return new no().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(no,n,o)}};Z(no,"runtime",pe),Z(no,"typeName","exa.codeium_common_pb.EditorOptions"),Z(no,"fields",pe.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let Bd=no;pe.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:pe.getEnumType($i)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class q4 extends xs{constructor(n,o){super();Z(this,"index");Z(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const Hi=br.define({combine:t=>mc(t,{language:To.TYPESCRIPT,timeout:150,widgetClass:q4,alwaysOn:!0},{})}),H1=br.define({combine:t=>mc(t,{override:()=>[]},{})}),G4=ot.mark({class:"cm-ghostText"}),sr=gn.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Hi);for(const r of e.effects){if(r.is(Td)){const{changeSpecs:s,index:a}=r.value,i=s[a].map(d=>G4.range(d.absoluteStartPos,d.absoluteEndPos)),l=(o=i.at(-1))==null?void 0:o.to;return{index:a,decorations:ot.set([...i,...l!==void 0&&s.length>1&&n.widgetClass?[ot.widget({widget:new n.widgetClass(a,s.length),side:1}).range(l)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Ad)||r.is(Md))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>Ge.decorations.from(t,e=>(e==null?void 0:e.decorations)||ot.none)}),Tr=hm.define(),Wi=hm.define();var ut;function Ud(t){const e=ut[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let qi;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(ut||(ut={}));class Ct extends Error{constructor(e,n=ut.Unknown,o,r,s){super(function(a,i){return a.length?`[${Ud(i)}] ${a}`:`[${Ud(i)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=ut.Unknown){return e instanceof Ct?e:e instanceof Error?e.name=="AbortError"?new Ct(e.message,ut.Canceled):new Ct(e.message,n,void 0,void 0,e):new Ct(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Ct.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var Y4=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(a,i){(function(l,d,u,h){Promise.resolve(h).then(function(f){l({value:f,done:u})},d)})(a,i,(s=t[r](s)).done,s.value)})}}},Gs=function(t){return this instanceof Gs?(this.v=t,this):new Gs(t)},K4=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(f){return Promise.resolve(f).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,f){r[h]&&(o[h]=function(m){return new Promise(function(x,g){s.push([h,m,x,g])>1||i(h,m)})},f&&(o[h]=f(o[h])))}function i(h,f){try{(m=r[h](f)).value instanceof Gs?Promise.resolve(m.value.v).then(l,d):u(s[0][2],m)}catch(x){u(s[0][3],x)}var m}function l(h){i("next",h)}function d(h){i("throw",h)}function u(h,f){h(f),s.shift(),s.length&&i(s[0][0],s[0][1])}},X4=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(a){return(n=!n)?{value:Gs(t[r](a)),done:!1}:s?s(a):a}:s}},W1=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(a,i){(function(l,d,u,h){Promise.resolve(h).then(function(f){l({value:f,done:u})},d)})(a,i,(s=t[r](s)).done,s.value)})}}},Ar=function(t){return this instanceof Ar?(this.v=t,this):new Ar(t)},J4=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(a){return(n=!n)?{value:Ar(t[r](a)),done:!1}:s?s(a):a}:s}},Z4=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(f){return Promise.resolve(f).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,f){r[h]&&(o[h]=function(m){return new Promise(function(x,g){s.push([h,m,x,g])>1||i(h,m)})},f&&(o[h]=f(o[h])))}function i(h,f){try{(m=r[h](f)).value instanceof Ar?Promise.resolve(m.value.v).then(l,d):u(s[0][2],m)}catch(x){u(s[0][3],x)}var m}function l(h){i("next",h)}function d(h){i("throw",h)}function u(h,f){h(f),s.shift(),s.length&&i(s[0][0],s[0][1])}};function Q4(t,e){return function(n,o){const r={};for(const[s,a]of Object.entries(n.methods)){const i=o(Object.assign(Object.assign({},a),{localName:s,service:n}));i!=null&&(r[s]=i)}return r}(t,n=>{switch(n.kind){case dn.Unary:return function(o,r,s){return async function(a,i){var l,d;const u=await o.unary(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,a,i==null?void 0:i.contextValues);return(l=i==null?void 0:i.onHeader)===null||l===void 0||l.call(i,u.header),(d=i==null?void 0:i.onTrailer)===null||d===void 0||d.call(i,u.trailer),u.message}}(e,t,n);case dn.ServerStreaming:return function(o,r,s){return function(a,i){return q1(o.stream(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,function(l){return K4(this,arguments,function*(){yield Gs(yield*X4(Y4(l)))})}([a]),i==null?void 0:i.contextValues),i)}}(e,t,n);case dn.ClientStreaming:return function(o,r,s){return async function(a,i){var l,d,u,h,f,m;const x=await o.stream(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,a,i==null?void 0:i.contextValues);let g;(f=i==null?void 0:i.onHeader)===null||f===void 0||f.call(i,x.header);let p=0;try{for(var b,y=!0,v=W1(x.message);!(l=(b=await v.next()).done);y=!0)h=b.value,y=!1,g=h,p++}catch(w){d={error:w}}finally{try{y||l||!(u=v.return)||await u.call(v)}finally{if(d)throw d.error}}if(!g)throw new Ct("protocol error: missing response message",ut.Unimplemented);if(p>1)throw new Ct("protocol error: received extra messages for client streaming method",ut.Unimplemented);return(m=i==null?void 0:i.onTrailer)===null||m===void 0||m.call(i,x.trailer),g}}(e,t,n);case dn.BiDiStreaming:return function(o,r,s){return function(a,i){return q1(o.stream(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,a,i==null?void 0:i.contextValues),i)}}(e,t,n);default:return null}})}function q1(t,e){const n=function(){return Z4(this,arguments,function*(){var o,r;const s=yield Ar(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield Ar(yield*J4(W1(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function G1(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function Y1(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function K1(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function X1(t,e){return e instanceof t?e:new t(e)}function eE(t,e){function n(o){return o.done===!0?o:{done:o.done,value:X1(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function J1(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function Z1(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function Q1(t,e,n,o){const r=e?e0(t.I,o):t0(t.I,n);return{parse:(e?e0(t.O,o):t0(t.O,n)).parse,serialize:r.serialize}}function e0(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Ct(`parse binary: ${r}`,ut.Internal)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Ct(`serialize binary: ${r}`,ut.Internal)}}}}function t0(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,a=Z1(e);return{parse(i){try{const l=s.decode(i);return t.fromJsonString(l,a)}catch(l){throw Ct.from(l,ut.InvalidArgument)}},serialize(i){try{const l=i.toJsonString(a);return r.encode(l)}catch(l){throw Ct.from(l,ut.Internal)}}}}const tE=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function n0(t,e,n){var o;if(e&&new Headers(e).forEach((i,l)=>n.metadata.append(l,i)),typeof t!="object"||t==null||Array.isArray(t))throw n;let r=n.code;"code"in t&&typeof t.code=="string"&&(r=(o=function(i){if(!qi){qi={};for(const l of Object.values(ut))typeof l!="string"&&(qi[Ud(l)]=l)}return qi[i]}(t.code))!==null&&o!==void 0?o:r);const s=t.message;if(s!=null&&typeof s!="string")throw n;const a=new Ct(s??"",r,e);if("details"in t&&Array.isArray(t.details))for(const i of t.details){if(i===null||typeof i!="object"||Array.isArray(i)||typeof i.type!="string"||typeof i.value!="string")throw n;try{a.details.push({type:i.type,value:Di.dec(i.value),debug:i.debug})}catch{throw n}}return a}function nE(t){const e=new Ct("invalid end stream",ut.Unknown);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(a=>typeof a!="string"))throw e;for(const a of s)o.append(r,a)}}return{metadata:o,error:"error"in n&&n.error!=null?n0(n.error,o,e):void 0}}const Gi="Content-Type",oE="Content-Length",o0="Content-Encoding",rE="Accept-Encoding",r0="Connect-Protocol-Version";function s0(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.append(r.substring(8),o):e.append(r,o)}),[e,n]}function a0(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(Gi,t==dn.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(r0,"1"),s}function i0(t,e,n,o){const r=o.get(Gi),s=function(l){const d=l==null?void 0:l.match(tE);if(d)return{stream:!!d[1],binary:!!d[3]}}(r);if(n!==200){const l=new Ct(`HTTP ${n}`,function(d){switch(d){case 400:return ut.Internal;case 401:return ut.Unauthenticated;case 403:return ut.PermissionDenied;case 404:return ut.Unimplemented;case 429:case 502:case 503:case 504:return ut.Unavailable;default:return ut.Unknown}}(n),o);if(t==dn.Unary&&s&&!s.binary)return{isUnaryError:!0,unaryError:l};throw l}const a=e,i=t!==dn.Unary;if((s==null?void 0:s.binary)!==a||s.stream!==i)throw new Ct(`unsupported content type ${r}`,s===void 0?ut.Unknown:ut.Internal,o);return{isUnaryError:!1}}const sE="application/";function aE(t,e,n){let o="?connect=v1";const r=t.header.get(Gi);(r==null?void 0:r.indexOf(sE))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(o0);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,d){return d?Di.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const a=t.url+o,i=new Headers(t.header);return[r0,Gi,oE,o0,rE].forEach(l=>i.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:a,header:i})}function l0(t){const{signal:e,cleanup:n}=function(r){const s=new AbortController,a=()=>{s.abort(new Ct("the operation timed out",ut.DeadlineExceeded))};let i;return r!==void 0&&(r<=0?a():i=setTimeout(a,r)),{signal:s.signal,cleanup:()=>clearTimeout(i)}}(t.timeoutMs),o=function(...r){const s=new AbortController,a=r.filter(l=>l!==void 0).concat(s.signal);for(const l of a){if(l.aborted){i.apply(l);break}l.addEventListener("abort",i)}function i(){s.signal.aborted||s.abort(G1(this));for(const l of a)l.removeEventListener("abort",i)}return s}(t.signal,e);return[o.signal,function(r){const s=Ct.from(e.aborted?G1(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var Ys,$d,Ks;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(Ys||(Ys={})),pe.util.setEnumType(Ys,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"}($d||($d={})),pe.util.setEnumType($d,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"}(Ks||(Ks={})),pe.util.setEnumType(Ks,"exa.language_server_pb.CompletionPartType",[{no:0,name:"COMPLETION_PART_TYPE_UNSPECIFIED"},{no:1,name:"COMPLETION_PART_TYPE_INLINE"},{no:2,name:"COMPLETION_PART_TYPE_BLOCK"},{no:3,name:"COMPLETION_PART_TYPE_INLINE_MASK"}]);const oo=class oo extends Nt{constructor(n){super();Z(this,"threshold",0);pe.util.initPartial(n,this)}static fromBinary(n,o){return new oo().fromBinary(n,o)}static fromJson(n,o){return new oo().fromJson(n,o)}static fromJsonString(n,o){return new oo().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(oo,n,o)}};Z(oo,"runtime",pe),Z(oo,"typeName","exa.language_server_pb.MultilineConfig"),Z(oo,"fields",pe.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let Vd=oo;const ro=class ro extends Nt{constructor(n){super();Z(this,"metadata");Z(this,"document");Z(this,"editorOptions");Z(this,"otherDocuments",[]);Z(this,"experimentConfig");Z(this,"modelName","");Z(this,"multilineConfig");pe.util.initPartial(n,this)}static fromBinary(n,o){return new ro().fromBinary(n,o)}static fromJson(n,o){return new ro().fromJson(n,o)}static fromJsonString(n,o){return new ro().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(ro,n,o)}};Z(ro,"runtime",pe),Z(ro,"typeName","exa.language_server_pb.GetCompletionsRequest"),Z(ro,"fields",pe.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Vi},{no:2,name:"document",kind:"message",T:Yi},{no:3,name:"editor_options",kind:"message",T:Bd},{no:5,name:"other_documents",kind:"message",T:Yi,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:Xd},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Vd}]));let Hd=ro;const so=class so extends Nt{constructor(n){super();Z(this,"state");Z(this,"completionItems",[]);pe.util.initPartial(n,this)}static fromBinary(n,o){return new so().fromBinary(n,o)}static fromJson(n,o){return new so().fromJson(n,o)}static fromJsonString(n,o){return new so().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(so,n,o)}};Z(so,"runtime",pe),Z(so,"typeName","exa.language_server_pb.GetCompletionsResponse"),Z(so,"fields",pe.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:Jd},{no:2,name:"completion_items",kind:"message",T:tu,repeated:!0}]));let Wd=so;const ao=class ao extends Nt{constructor(n){super();Z(this,"metadata");Z(this,"completionId","");pe.util.initPartial(n,this)}static fromBinary(n,o){return new ao().fromBinary(n,o)}static fromJson(n,o){return new ao().fromJson(n,o)}static fromJsonString(n,o){return new ao().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(ao,n,o)}};Z(ao,"runtime",pe),Z(ao,"typeName","exa.language_server_pb.AcceptCompletionRequest"),Z(ao,"fields",pe.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Vi},{no:2,name:"completion_id",kind:"scalar",T:9}]));let qd=ao;const io=class io extends Nt{constructor(e){super(),pe.util.initPartial(e,this)}static fromBinary(e,n){return new io().fromBinary(e,n)}static fromJson(e,n){return new io().fromJson(e,n)}static fromJsonString(e,n){return new io().fromJsonString(e,n)}static equals(e,n){return pe.util.equals(io,e,n)}};Z(io,"runtime",pe),Z(io,"typeName","exa.language_server_pb.AcceptCompletionResponse"),Z(io,"fields",pe.util.newFieldList(()=>[]));let Gd=io;const lo=class lo extends Nt{constructor(e){super(),pe.util.initPartial(e,this)}static fromBinary(e,n){return new lo().fromBinary(e,n)}static fromJson(e,n){return new lo().fromJson(e,n)}static fromJsonString(e,n){return new lo().fromJsonString(e,n)}static equals(e,n){return pe.util.equals(lo,e,n)}};Z(lo,"runtime",pe),Z(lo,"typeName","exa.language_server_pb.GetAuthTokenRequest"),Z(lo,"fields",pe.util.newFieldList(()=>[]));let Yd=lo;const co=class co extends Nt{constructor(n){super();Z(this,"authToken","");Z(this,"uuid","");pe.util.initPartial(n,this)}static fromBinary(n,o){return new co().fromBinary(n,o)}static fromJson(n,o){return new co().fromJson(n,o)}static fromJsonString(n,o){return new co().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(co,n,o)}};Z(co,"runtime",pe),Z(co,"typeName","exa.language_server_pb.GetAuthTokenResponse"),Z(co,"fields",pe.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let Kd=co;const uo=class uo extends Nt{constructor(n){super();Z(this,"row",ht.zero);Z(this,"col",ht.zero);pe.util.initPartial(n,this)}static fromBinary(n,o){return new uo().fromBinary(n,o)}static fromJson(n,o){return new uo().fromJson(n,o)}static fromJsonString(n,o){return new uo().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(uo,n,o)}};Z(uo,"runtime",pe),Z(uo,"typeName","exa.language_server_pb.DocumentPosition"),Z(uo,"fields",pe.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let Xs=uo;const ho=class ho extends Nt{constructor(n){super();Z(this,"absolutePath","");Z(this,"relativePath","");Z(this,"text","");Z(this,"editorLanguage","");Z(this,"language",To.UNSPECIFIED);Z(this,"cursorOffset",ht.zero);Z(this,"cursorPosition");Z(this,"lineEnding","");pe.util.initPartial(n,this)}static fromBinary(n,o){return new ho().fromBinary(n,o)}static fromJson(n,o){return new ho().fromJson(n,o)}static fromJsonString(n,o){return new ho().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(ho,n,o)}};Z(ho,"runtime",pe),Z(ho,"typeName","exa.language_server_pb.Document"),Z(ho,"fields",pe.util.newFieldList(()=>[{no:1,name:"absolute_path",kind:"scalar",T:9},{no:2,name:"relative_path",kind:"scalar",T:9},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"editor_language",kind:"scalar",T:9},{no:5,name:"language",kind:"enum",T:pe.getEnumType(To)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:Xs},{no:7,name:"line_ending",kind:"scalar",T:9}]));let Yi=ho;const fo=class fo extends Nt{constructor(n){super();Z(this,"forceEnableExperiments",[]);pe.util.initPartial(n,this)}static fromBinary(n,o){return new fo().fromBinary(n,o)}static fromJson(n,o){return new fo().fromJson(n,o)}static fromJsonString(n,o){return new fo().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(fo,n,o)}};Z(fo,"runtime",pe),Z(fo,"typeName","exa.language_server_pb.ExperimentConfig"),Z(fo,"fields",pe.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:pe.getEnumType(Ui),repeated:!0}]));let Xd=fo;const mo=class mo extends Nt{constructor(n){super();Z(this,"state",Ys.UNSPECIFIED);Z(this,"message","");pe.util.initPartial(n,this)}static fromBinary(n,o){return new mo().fromBinary(n,o)}static fromJson(n,o){return new mo().fromJson(n,o)}static fromJsonString(n,o){return new mo().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(mo,n,o)}};Z(mo,"runtime",pe),Z(mo,"typeName","exa.language_server_pb.State"),Z(mo,"fields",pe.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:pe.getEnumType(Ys)},{no:2,name:"message",kind:"scalar",T:9}]));let Jd=mo;const po=class po extends Nt{constructor(n){super();Z(this,"startOffset",ht.zero);Z(this,"endOffset",ht.zero);Z(this,"startPosition");Z(this,"endPosition");pe.util.initPartial(n,this)}static fromBinary(n,o){return new po().fromBinary(n,o)}static fromJson(n,o){return new po().fromJson(n,o)}static fromJsonString(n,o){return new po().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(po,n,o)}};Z(po,"runtime",pe),Z(po,"typeName","exa.language_server_pb.Range"),Z(po,"fields",pe.util.newFieldList(()=>[{no:1,name:"start_offset",kind:"scalar",T:4},{no:2,name:"end_offset",kind:"scalar",T:4},{no:3,name:"start_position",kind:"message",T:Xs},{no:4,name:"end_position",kind:"message",T:Xs}]));let Zd=po;const go=class go extends Nt{constructor(n){super();Z(this,"text","");Z(this,"deltaCursorOffset",ht.zero);pe.util.initPartial(n,this)}static fromBinary(n,o){return new go().fromBinary(n,o)}static fromJson(n,o){return new go().fromJson(n,o)}static fromJsonString(n,o){return new go().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(go,n,o)}};Z(go,"runtime",pe),Z(go,"typeName","exa.language_server_pb.Suffix"),Z(go,"fields",pe.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let Qd=go;const xo=class xo extends Nt{constructor(n){super();Z(this,"text","");Z(this,"offset",ht.zero);Z(this,"type",Ks.UNSPECIFIED);Z(this,"prefix","");Z(this,"line",ht.zero);pe.util.initPartial(n,this)}static fromBinary(n,o){return new xo().fromBinary(n,o)}static fromJson(n,o){return new xo().fromJson(n,o)}static fromJsonString(n,o){return new xo().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(xo,n,o)}};Z(xo,"runtime",pe),Z(xo,"typeName","exa.language_server_pb.CompletionPart"),Z(xo,"fields",pe.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"offset",kind:"scalar",T:4},{no:3,name:"type",kind:"enum",T:pe.getEnumType(Ks)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let eu=xo;const bo=class bo extends Nt{constructor(n){super();Z(this,"completion");Z(this,"suffix");Z(this,"range");Z(this,"source",qs.UNSPECIFIED);Z(this,"completionParts",[]);pe.util.initPartial(n,this)}static fromBinary(n,o){return new bo().fromBinary(n,o)}static fromJson(n,o){return new bo().fromJson(n,o)}static fromJsonString(n,o){return new bo().fromJsonString(n,o)}static equals(n,o){return pe.util.equals(bo,n,o)}};Z(bo,"runtime",pe),Z(bo,"typeName","exa.language_server_pb.CompletionItem"),Z(bo,"fields",pe.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:zd},{no:5,name:"suffix",kind:"message",T:Qd},{no:2,name:"range",kind:"message",T:Zd},{no:3,name:"source",kind:"enum",T:pe.getEnumType(qs)},{no:8,name:"completion_parts",kind:"message",T:eu,repeated:!0}]));let tu=bo;const iE={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Hd,O:Wd,kind:dn.Unary},acceptCompletion:{name:"AcceptCompletion",I:qd,O:Gd,kind:dn.Unary},getAuthToken:{name:"GetAuthToken",I:Yd,O:Kd,kind:dn.Unary}}};var Js=function(t){return this instanceof Js?(this.v=t,this):new Js(t)},lE=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(f){return Promise.resolve(f).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,f){r[h]&&(o[h]=function(m){return new Promise(function(x,g){s.push([h,m,x,g])>1||i(h,m)})},f&&(o[h]=f(o[h])))}function i(h,f){try{(m=r[h](f)).value instanceof Js?Promise.resolve(m.value.v).then(l,d):u(s[0][2],m)}catch(x){u(s[0][3],x)}var m}function l(h){i("next",h)}function d(h){i("throw",h)}function u(h,f){h(f),s.shift(),s.length&&i(s[0][0],s[0][1])}};const cE=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,a,i,l,d){var u;const{serialize:h,parse:f}=Q1(r,n,t.jsonOptions,t.binaryOptions);return a=a===void 0?t.defaultTimeoutMs:a<=0?void 0:a,await function(m){const x=J1(m.next,m.interceptors),[g,p,b]=l0(m);return x(Object.assign(Object.assign({},m.req),{message:X1(m.req.method.I,m.req.message),signal:g})).then(y=>(b(),y),p)}({interceptors:t.interceptors,signal:s,timeoutMs:a,req:{stream:!1,service:o,method:r,url:K1(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:a0(r.kind,n,a,i),contextValues:d??Y1(),message:l},next:async m=>{var x;let g=null;t.useHttpGet===!0&&r.idempotency===Fd.NoSideEffects?m=aE(m,h(m.message),n):g=h(m.message);const p=(x=t.fetch)!==null&&x!==void 0?x:globalThis.fetch,b=await p(m.url,Object.assign(Object.assign({},m.init),{headers:m.header,signal:m.signal,body:g})),{isUnaryError:y,unaryError:v}=i0(r.kind,n,b.status,b.headers);if(y)throw n0(await b.json(),function(...N){const C=new Headers;for(const j of N)j.forEach((_,A)=>{C.append(A,_)});return C}(...s0(b.headers)),v);const[w,S]=s0(b.headers);return{stream:!1,service:o,method:r,header:w,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),Z1(t.jsonOptions)),trailer:S}}})},async stream(o,r,s,a,i,l,d){var u;const{serialize:h,parse:f}=Q1(r,n,t.jsonOptions,t.binaryOptions);function m(g,p,b,y){return lE(this,arguments,function*(){const v=function(S){let N,C=new Uint8Array(0);function j(_){const A=new Uint8Array(C.length+_.length);A.set(C),A.set(_,C.length),C=A}return new ReadableStream({start(){N=S.getReader()},async pull(_){let A;for(;;){if(A===void 0&&C.byteLength>=5){let L=0;for(let M=1;M<5;M++)L=(L<<8)+C[M];A={flags:C[0],length:L}}if(A!==void 0&&C.byteLength>=A.length+5)break;const P=await N.read();if(P.done)break;j(P.value)}if(A===void 0)return C.byteLength==0?void _.close():void _.error(new Ct("premature end of stream",ut.DataLoss));const T=C.subarray(5,5+A.length);C=C.subarray(5+A.length),_.enqueue({flags:A.flags,data:T})}})}(g).getReader();let w=!1;for(;;){const S=yield Js(v.read());if(S.done)break;const{flags:N,data:C}=S.value;if(!(1&~N))throw new Ct("protocol error: received unsupported compressed output",ut.Internal);if(!(2&~N)){w=!0;const j=nE(C);if(j.error){const _=j.error;throw b.forEach((A,T)=>{_.metadata.append(T,A)}),_}j.metadata.forEach((_,A)=>p.set(A,_));continue}yield yield Js(f(C))}if("throwIfAborted"in y&&y.throwIfAborted(),!w)throw"missing EndStreamResponse"})}async function x(g){if(r.kind!=dn.ServerStreaming)throw"The fetch API does not support streaming request bodies";const p=await g[Symbol.asyncIterator]().next();if(p.done==1)throw"missing request message";return function(b,y){const v=new Uint8Array(y.length+5);v.set(y,5);const w=new DataView(v.buffer,v.byteOffset,v.byteLength);return w.setUint8(0,b),w.setUint32(1,y.length),v}(0,h(p.value))}return a=a===void 0?t.defaultTimeoutMs:a<=0?void 0:a,await function(g){const p=J1(g.next,g.interceptors),[b,y,v]=l0(g),w=Object.assign(Object.assign({},g.req),{message:eE(g.req.method.I,g.req.message),signal:b});let S=!1;return b.addEventListener("abort",function(){var N,C;const j=g.req.message[Symbol.asyncIterator]();S||(N=j.throw)===null||N===void 0||N.call(j,this.reason).catch(()=>{}),(C=j.return)===null||C===void 0||C.call(j).catch(()=>{})}),p(w).then(N=>Object.assign(Object.assign({},N),{message:{[Symbol.asyncIterator](){const C=N.message[Symbol.asyncIterator]();return{next:()=>C.next().then(j=>(j.done==1&&(S=!0,v()),j),y)}}}}),y)}({interceptors:t.interceptors,timeoutMs:a,signal:s,req:{stream:!0,service:o,method:r,url:K1(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:a0(r.kind,n,a,i),contextValues:d??Y1(),message:l},next:async g=>{var p;const b=(p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch,y=await b(g.url,Object.assign(Object.assign({},g.init),{headers:g.header,signal:g.signal,body:await x(g.message)}));if(i0(r.kind,n,y.status,y.headers),y.body===null)throw"missing response body";const v=new Headers;return Object.assign(Object.assign({},g),{header:y.headers,trailer:v,message:m(y.body,v,y.headers,g.signal)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),dE=function(t,e){return Q4(t,e)}(iE,cE);let Ki;try{Ki=crypto.randomUUID()}catch{Ki="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function uE(t,e){const n=t.state.facet(Hi),{override:o}=t.state.facet(H1),r=await o(),s=t.state,a=s.selection.main.head,i=s.doc.toString();try{const l=await async function({text:x,cursorOffset:g,config:p,otherDocuments:b}){return await dE.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:p.apiKey,sessionId:Ki,authSource:p.authSource},document:{text:x,cursorOffset:BigInt(g),language:p.language,editorLanguage:"typescript",lineEnding:`
105
- `},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:b,multilineConfig:void 0},{headers:{Authorization:`Basic ${p.apiKey}-${Ki}`}})}({text:i,cursorOffset:a,config:n,otherDocuments:r});if(!l||l.completionItems.length===0||e!==void 0&&a!==e||Va(t.state)==="active"||!t.hasFocus)return;const d=l.completionItems.map(x=>{let g=0;return x.completionParts.filter(p=>p.type!==3).map(p=>{const b=Number(p.offset),y=p.type===2?`
106
- ${p.text}`:p.text,v={absoluteStartPos:g+b,absoluteEndPos:g+b+y.length,from:b,to:b,insert:y};return g+=y.length,v})}),u=0,h=d.at(u);if(!h)return;const f=Ha.of(h,s.doc.length),m=f.invert(s.doc);t.dispatch({changes:f,effects:Td.of({index:u,reverseChangeSet:m,changeSpecs:d}),annotations:[Wi.of(null),Tr.of(null),Wa.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(d=>setTimeout(d,300))}}function hE(){let t=null,e=0;return Ge.updateListener.of(n=>{const o=n.view.state.facet(Hi);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(a=>a.effects.some(i=>i.is(Ad)||i.is(Md)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(sr)||Va(s.state)==="active")return!0;for(const a of s.transactions)if(a.annotation(Tr)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new eO(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await uE(n.view,e)},o.timeout),e=r)})}function c0(t){var r;const e=t.state.field(sr);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:Ad.of(null),annotations:[Wi.of(null),Tr.of(null),Wa.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,a,i,l)=>{o=l}),t.dispatch({changes:n,selection:ko.cursor(o),annotations:[Tr.of(null),Wa.addToHistory.of(!0)]}),!0}const d0=t=>{const{state:e}=t,n=e.field(sr);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const a=n.reverseChangeSet.apply(e.doc),i=Ha.of(n.reverseChangeSet,e.doc.length).compose(Ha.of(s,a.length)),l=Ha.of(s,a.length).invert(a);return t.dispatch({changes:i,effects:Td.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[Wi.of(null),Tr.of(null),Wa.addToHistory.of(!1)]}),!0};function nu(t){const e=t.state.field(sr);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Md.of(null),annotations:[Wi.of(null),Tr.of(null),Wa.addToHistory.of(!1)]}),!1)}function fE(){return Ge.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(sr)&&(o==="Tab"?c0(n):nu(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(d0(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var i,l;let r=!1;const s=(i=o.state.selection.asSingle().ranges.at(0))==null?void 0:i.head,a=o.state.field(sr);return!(s===void 0||!a)&&((l=a.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?c0(e):nu(e)}})}const mE=new fm,ou=ft.get("@github/copilot-language-server"),u0={delay:500,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},pE=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[Hi.of(n),sr,No.highest(_n.of([{key:"Ctrl-]",run:d0}])),No.highest(Ge.updateListener.of(o=>{o.focusChanged&&nu(o.view)})),No.high(fE()),hE()]}({apiKey:t.codeium_api_key,language:To.PYTHON}),H1.of({override:async()=>[{text:gc(""),language:To.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(d1({...u0,fetchFn:async n=>{if(!GR()||n.doc.length===0)return"";await new Promise(a=>setTimeout(a,20));const o=n.doc.toString(),r=function(a,i){const l=a.doc.toString(),d=i.split(`
107
- `).length-l.split(`
108
- `).length,u=function(h,f){const m=h.lineAt(f);return{line:m.number-1,character:f-m.from}}(a.doc,a.selection.main.head);return u.line+=d,{textDocument:{uri:`file://${YR}`,version:"replace_me"},position:u,context:{triggerKind:nO.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:a.tabSize,insertSpaces:!0}}}(n,gc(o));return function(a,i,l){if(!a)return ou.debug("No response from copilot"),"";const d=Array.isArray(a)?a[0]:a.items[0];if(!d)return ou.debug("No response from copilot"),"";const{insertText:u,range:h}=d,f=String(u);if(!h)return ou.error("No range from copilot"),f;const m=h.start.character-i.character,x=m<0?f.slice(-m):f,g=l.doc.sliceString(l.selection.main.head,l.doc.length);for(let p=0;p<x.length;p++){const b=x.slice(p);if(g.startsWith(b))return x.slice(0,p)}return x}(await hS().getCompletion(r),r.position,n)}})),t.copilot==="custom"&&e.push(d1({...u0,fetchFn:async n=>{if(n.doc.length===0)return"";const o=n.doc.sliceString(0,n.selection.main.head),r=n.doc.sliceString(n.selection.main.head,n.doc.length);if(o.length===0)return"";const s=n.field(xc).type;let a=await tO.post("/ai/inline_completion",{prefix:o,suffix:r,language:s});return o&&a.startsWith(o)&&(a=a.slice(o.length)),r&&a.endsWith(r)&&(a=a.slice(0,-r.length)),a}})),[...e,No.highest(_n.of([{key:"Escape",run:n=>{const o=c1(n);return!$a(n)&&o}}])),mE.of(qR())]};function gE(t){return[_n.of([{key:"Escape",preventDefault:!1,run:oC},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:rO},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:mg}]),oO(),cC,gi,dC]}const xE=ot.mark({class:"underline"}),h0=Tt.define(),f0=Tt.define(),m0=Tt.define(),bE=gn.define({create:()=>ot.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(h0)?n=t.update({add:[xE.range(o.value.from,o.value.to)]}):o.is(f0)?n=t.update({add:[sO.range(o.value.from,o.value.to)]}):o.is(m0)&&(n=ot.none);return n},provide:t=>Ge.decorations.from(t)});class yE{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=this.view.state.field(aO,!1),a=s==null?void 0:s.ranges.find(l=>r>=l.from&&r<=l.to);if(a){const{from:l,to:d}=a;return this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===d?void 0:(this.clearUnderline(),this.hoveredRange={from:l,to:d,position:r},void this.view.dispatch({effects:f0.of(this.hoveredRange)}))}const i=iO(this.view.state).cursorAt(r);if(i.name==="VariableName"){const{from:l,to:d}=i;if(this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===d)return;this.clearUnderline(),this.hoveredRange={from:l,to:d,position:r},this.view.dispatch({effects:h0.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:m0.of(null)}),this.hoveredRange=null)}}function vE(){return[Ge.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(s){if(!s.includes("@app.cell"))return[];const a=[],i=s.split(`
109
- `);let l=[],d=!1,u=0,h=!1,f=!1,m=0;const x=/\(/g,g=/\)/g,p=new Set(["@"]);function b(v){return(v.match(x)||[]).length-(v.match(g)||[]).length}function y(){if(l.length!==0){for(;l.length>0&&l[l.length-1].trim().startsWith("return");)l.pop();l.some(v=>v.trim()!=="")&&a.push(function(v){const w=v.split(`
110
- `);if(w.length===0)return"";const S=w.filter(j=>j.trim().length>0);if(S.length===0)return"";const N=/^\s*/,C=Math.min(...S.map(j=>{var _;return((_=j.match(N))==null?void 0:_[0].length)??Number.POSITIVE_INFINITY}));return C===0?v.trim():w.map(j=>j.slice(C)).join(`
111
- `).trim()}(l.join(`
112
- `))),l=[]}}for(const v of i){const w=v.trim();(w||d)&&(w.startsWith("@app.cell")?(y(),d=!0,u=1):u>0?(w.startsWith("def")&&w.includes("(")&&!w.includes("):")&&(h=!0,m=b(w)),u--):h?(m+=b(w),m===0&&(h=!1)):d&&(p.has(w[0])||w.startsWith("if __name__")?(y(),d=w.startsWith("@")):w.startsWith("return")?w.includes("(")&&!w.endsWith(")")&&(f=!0,m=b(w)):f?(m+=b(w),m===0&&(f=!1)):l.push(v)))}return y(),a}(n);return o.length===0?!1:(e.state.facet(uO).createManyBelow(o),!0)}})]}const Lt=({variant:t,settings:e,styles:n})=>{const o=Ge.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=hO.define(n);return[o,r3(r)]};Lt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:F.comment,color:"#404080"},{tag:[F.string,F.regexp],color:"#999999"},{tag:F.number,color:"#7090B0"},{tag:[F.bool,F.null],color:"#8080A0"},{tag:[F.punctuation,F.derefOperator],color:"#805080"},{tag:F.keyword,color:"#60B0FF"},{tag:F.definitionKeyword,color:"#B0FFF0"},{tag:F.moduleKeyword,color:"#60B0FF"},{tag:F.operator,color:"#A0A0FF"},{tag:[F.variableName,F.self],color:"#008080"},{tag:F.operatorKeyword,color:"#A0A0FF"},{tag:F.controlKeyword,color:"#80A0FF"},{tag:F.className,color:"#70E080"},{tag:[F.function(F.propertyName),F.propertyName],color:"#50A0A0"},{tag:F.tagName,color:"#009090"},{tag:F.modifier,color:"#B0FFF0"},{tag:[F.squareBracket,F.attributeName],color:"#D0D0FF"}]}),Lt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:F.comment,color:"#787b8099"},{tag:F.string,color:"#86b300"},{tag:F.regexp,color:"#4cbf99"},{tag:[F.number,F.bool,F.null],color:"#ffaa33"},{tag:F.variableName,color:"#5c6166"},{tag:[F.definitionKeyword,F.modifier],color:"#fa8d3e"},{tag:[F.keyword,F.special(F.brace)],color:"#fa8d3e"},{tag:F.operator,color:"#ed9366"},{tag:F.separator,color:"#5c6166b3"},{tag:F.punctuation,color:"#5c6166"},{tag:[F.definition(F.propertyName),F.function(F.variableName)],color:"#f2ae49"},{tag:[F.className,F.definition(F.typeName)],color:"#22a4e6"},{tag:[F.tagName,F.typeName,F.self,F.labelName],color:"#55b4d4"},{tag:F.angleBracket,color:"#55b4d480"},{tag:F.attributeName,color:"#f2ae49"}]}),Lt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:F.comment,color:"#6E6E6E"},{tag:[F.string,F.regexp,F.special(F.brace)],color:"#5C81B3"},{tag:F.number,color:"#C1E1B8"},{tag:F.bool,color:"#53667D"},{tag:[F.definitionKeyword,F.modifier,F.function(F.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[F.keyword,F.moduleKeyword,F.operatorKeyword,F.operator],color:"#697A8E",fontWeight:"bold"},{tag:[F.variableName,F.attributeName],color:"#708E67"},{tag:[F.function(F.variableName),F.definition(F.propertyName),F.derefOperator],color:"#fff"},{tag:F.tagName,color:"#A3D295"}]}),Lt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:F.comment,color:"#666666"},{tag:[F.string,F.special(F.brace)],color:"#54BE0D"},{tag:F.regexp,color:"#E9C062"},{tag:F.number,color:"#CF6A4C"},{tag:[F.keyword,F.operator],color:"#5EA6EA"},{tag:F.variableName,color:"#7587A6"},{tag:[F.definitionKeyword,F.modifier],color:"#F9EE98"},{tag:[F.propertyName,F.function(F.variableName)],color:"#937121"},{tag:[F.typeName,F.angleBracket,F.tagName],color:"#9B859D"}]}),Lt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:F.comment,color:"#6B4E32"},{tag:[F.keyword,F.operator,F.derefOperator],color:"#EF5D32"},{tag:F.className,color:"#EFAC32",fontWeight:"bold"},{tag:[F.typeName,F.propertyName,F.function(F.variableName),F.definition(F.variableName)],color:"#EFAC32"},{tag:F.definition(F.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:F.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[F.number,F.bool],color:"#6C99BB"},{tag:[F.variableName,F.self],color:"#7DAF9C"},{tag:[F.string,F.special(F.brace),F.regexp],color:"#D9D762"},{tag:[F.angleBracket,F.tagName,F.attributeName],color:"#EFCB43"}]}),Lt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:F.comment,color:"#404040"},{tag:[F.string,F.special(F.brace),F.regexp],color:"#00D8FF"},{tag:F.number,color:"#E62286"},{tag:[F.variableName,F.attributeName,F.self],color:"#E62286",fontWeight:"bold"},{tag:F.function(F.variableName),color:"#fff",fontWeight:"bold"}]}),Lt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:F.comment,color:"#BCC8BA"},{tag:[F.string,F.special(F.brace),F.regexp],color:"#5D90CD"},{tag:[F.number,F.bool,F.null],color:"#46A609"},{tag:F.keyword,color:"#AF956F"},{tag:[F.definitionKeyword,F.modifier],color:"#C52727"},{tag:[F.angleBracket,F.tagName,F.attributeName],color:"#606060"},{tag:F.self,color:"#000"}]}),Lt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:F.comment,color:"#0088FF"},{tag:F.string,color:"#3AD900"},{tag:F.regexp,color:"#80FFC2"},{tag:[F.number,F.bool,F.null],color:"#FF628C"},{tag:[F.definitionKeyword,F.modifier],color:"#FFEE80"},{tag:F.variableName,color:"#CCCCCC"},{tag:F.self,color:"#FF80E1"},{tag:[F.className,F.definition(F.propertyName),F.function(F.variableName),F.definition(F.typeName),F.labelName],color:"#FFDD00"},{tag:[F.keyword,F.operator],color:"#FF9D00"},{tag:[F.propertyName,F.typeName],color:"#80FFBB"},{tag:F.special(F.brace),color:"#EDEF7D"},{tag:F.attributeName,color:"#9EFFFF"},{tag:F.derefOperator,color:"#fff"}]}),Lt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:F.comment,color:"#AEAEAE"},{tag:[F.string,F.special(F.brace),F.regexp],color:"#8DFF8E"},{tag:[F.className,F.definition(F.propertyName),F.function(F.variableName),F.function(F.definition(F.variableName)),F.definition(F.typeName)],color:"#A3EBFF"},{tag:[F.number,F.bool,F.null],color:"#62E9BD"},{tag:[F.keyword,F.operator],color:"#2BF1DC"},{tag:[F.definitionKeyword,F.modifier],color:"#F8FBB1"},{tag:[F.variableName,F.self],color:"#B683CA"},{tag:[F.angleBracket,F.tagName,F.typeName,F.propertyName],color:"#60A4F1"},{tag:F.derefOperator,color:"#E0E0E0"},{tag:F.attributeName,color:"#7BACCA"}]}),Lt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:F.comment,color:"#6272a4"},{tag:[F.string,F.special(F.brace)],color:"#f1fa8c"},{tag:[F.number,F.self,F.bool,F.null],color:"#bd93f9"},{tag:[F.keyword,F.operator],color:"#ff79c6"},{tag:[F.definitionKeyword,F.typeName],color:"#8be9fd"},{tag:F.definition(F.typeName),color:"#f8f8f2"},{tag:[F.className,F.definition(F.propertyName),F.function(F.variableName),F.attributeName],color:"#50fa7b"}]}),Lt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:F.comment,color:"#AAAAAA"},{tag:[F.keyword,F.operator,F.typeName,F.tagName,F.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[F.attributeName,F.definition(F.propertyName)],color:"#4F9FD0"},{tag:[F.className,F.string,F.special(F.brace)],color:"#CF4F5F"},{tag:F.number,color:"#CF4F5F",fontWeight:"bold"},{tag:F.variableName,fontWeight:"bold"}]}),Lt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:F.comment,color:"#9995b7"},{tag:F.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[F.definitionKeyword,F.modifier],color:"#ff5792"},{tag:[F.className,F.tagName,F.definition(F.typeName)],color:"#0094f0"},{tag:[F.number,F.bool,F.null,F.special(F.brace)],color:"#5842ff"},{tag:[F.definition(F.propertyName),F.function(F.variableName)],color:"#0095a8"},{tag:F.typeName,color:"#b3694d"},{tag:[F.propertyName,F.variableName],color:"#fa8900"},{tag:F.operator,color:"#ff5792"},{tag:F.self,color:"#e64100"},{tag:[F.string,F.regexp],color:"#00b368"},{tag:[F.paren,F.bracket],color:"#0431fa"},{tag:F.labelName,color:"#00bdd6"},{tag:F.attributeName,color:"#e64100"},{tag:F.angleBracket,color:"#9995b7"}]}),Lt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:F.comment,color:"#9893a5"},{tag:[F.bool,F.null],color:"#286983"},{tag:F.number,color:"#d7827e"},{tag:F.className,color:"#d7827e"},{tag:[F.angleBracket,F.tagName,F.typeName],color:"#56949f"},{tag:F.attributeName,color:"#907aa9"},{tag:F.punctuation,color:"#797593"},{tag:[F.keyword,F.modifier],color:"#286983"},{tag:[F.string,F.regexp],color:"#ea9d34"},{tag:F.variableName,color:"#d7827e"}]}),Lt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:F.comment,color:"#CFCFCF"},{tag:[F.number,F.bool,F.null],color:"#E66C29"},{tag:[F.className,F.definition(F.propertyName),F.function(F.variableName),F.labelName,F.definition(F.typeName)],color:"#2EB43B"},{tag:F.keyword,color:"#D8B229"},{tag:F.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[F.definitionKeyword,F.modifier],color:"#925A47"},{tag:F.string,color:"#704D3D"},{tag:F.typeName,color:"#2F8996"},{tag:[F.variableName,F.propertyName],color:"#77ACB0"},{tag:F.self,color:"#77ACB0",fontWeight:"bold"},{tag:F.regexp,color:"#E3965E"},{tag:[F.tagName,F.angleBracket],color:"#BAA827"},{tag:F.attributeName,color:"#B06520"},{tag:F.derefOperator,color:"#000"}]}),Lt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:F.comment,color:"#93A1A1"},{tag:F.string,color:"#2AA198"},{tag:F.regexp,color:"#D30102"},{tag:F.number,color:"#D33682"},{tag:F.variableName,color:"#268BD2"},{tag:[F.keyword,F.operator,F.punctuation],color:"#859900"},{tag:[F.definitionKeyword,F.modifier],color:"#073642",fontWeight:"bold"},{tag:[F.className,F.self,F.definition(F.propertyName)],color:"#268BD2"},{tag:F.function(F.variableName),color:"#268BD2"},{tag:[F.bool,F.null],color:"#B58900"},{tag:F.tagName,color:"#268BD2",fontWeight:"bold"},{tag:F.angleBracket,color:"#93A1A1"},{tag:F.attributeName,color:"#93A1A1"},{tag:F.typeName,color:"#859900"}]}),Lt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:F.comment,color:"#8E908C"},{tag:[F.variableName,F.self,F.propertyName,F.attributeName,F.regexp],color:"#C82829"},{tag:[F.number,F.bool,F.null],color:"#F5871F"},{tag:[F.className,F.typeName,F.definition(F.typeName)],color:"#C99E00"},{tag:[F.string,F.special(F.brace)],color:"#718C00"},{tag:F.operator,color:"#3E999F"},{tag:[F.definition(F.propertyName),F.function(F.variableName)],color:"#4271AE"},{tag:F.keyword,color:"#8959A8"},{tag:F.derefOperator,color:"#4D4D4C"}]});const wE=[Lt({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:F.comment,color:"#5c6370"},{tag:F.variableName,color:"#abb2bf"},{tag:[F.string,F.special(F.brace)],color:"#98c379"},{tag:F.number,color:"#d19a66"},{tag:F.bool,color:"#d19a66"},{tag:F.null,color:"#d19a66"},{tag:F.keyword,color:"#c678dd",fontWeight:500},{tag:F.className,color:"#61afef"},{tag:F.definition(F.typeName),color:"#61afef"},{tag:F.typeName,color:"#56b6c2"},{tag:F.angleBracket,color:"#abb2bf"},{tag:F.tagName,color:"#e06c75"},{tag:F.attributeName,color:"#d19a66"},{tag:F.operator,color:"#56b6c2",fontWeight:500},{tag:[F.function(F.variableName)],color:"#61afef"},{tag:[F.propertyName],color:"#e5c07b"}]}),Ge.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#2a7aa5",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px",borderBottomColor:"#4a90a5"}})],kE=[Lt({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:F.comment,color:"#708090"},{tag:F.variableName,color:"#000000"},{tag:[F.string,F.special(F.brace)],color:"#a11"},{tag:F.number,color:"#164"},{tag:F.bool,color:"#219"},{tag:F.null,color:"#219"},{tag:F.keyword,color:"#708",fontWeight:500},{tag:F.className,color:"#00f"},{tag:F.definition(F.typeName),color:"#00f"},{tag:F.typeName,color:"#085"},{tag:F.angleBracket,color:"#000000"},{tag:F.tagName,color:"#170"},{tag:F.attributeName,color:"#00c"},{tag:F.operator,color:"#a2f",fontWeight:500},{tag:[F.function(F.variableName)],color:"#00c"},{tag:[F.propertyName],color:"#05a"}]}),Ge.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#005f87",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px"}})];function p0(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const SE=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:a,lspConfig:i,diagnosticsConfig:l,displayConfig:d}=t,u=p0(t);return[KR(n,o),[Ge.domEventHandlers({drop:(f,m)=>{var p,b;const x=(p=f.dataTransfer)==null?void 0:p.files[0];if(x!=null&&x.type.startsWith("text/"))return f.preventDefault(),cO(m,x),!0;if(x!=null&&x.type.startsWith("image/"))return f.preventDefault(),dO(m,x),!0;const g=(b=f.dataTransfer)==null?void 0:b.getData("text/plain");if(g){f.preventDefault();const y=m.posAtCoords({x:f.clientX,y:f.clientY});return y!==null&&m.dispatch({changes:{from:y,to:y,insert:g},scrollIntoView:!0}),!0}return!1},dragover:f=>{f.preventDefault()}})],vE(),y4(),fO({completionConfig:a,hotkeys:o,placeholderType:u,lspConfig:i,diagnosticsConfig:l}),mO({cellId:e,hotkeys:o,cellActions:s,keymapConfig:n}),NE(t),[bE,(h=(f,m)=>{lO(f,m)},Rn.define(f=>new yE(f,h))),Ge.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?pO():[],r&&Kf("inline_ai_tooltip")?i4({prompt:f=>async function(m){var w,S;const x=`
113
- ${m.codeBefore}
114
- <rewrite_this>
115
- ${m.selection}
116
- </rewrite_this>
117
- ${m.codeAfter}
118
- `.trim(),g=Qk();await e3();const p=await fetch(g.getAiURL("completion").toString(),{method:"POST",headers:g.headers(),body:JSON.stringify({prompt:m.prompt,code:x,selectedText:m.selection,includeOtherCode:"",language:m.language})}),b=((w=m.selection.match(/^\s*/))==null?void 0:w[0])||"",y=(S=p.body)==null?void 0:S.getReader();if(!y)throw new Error("Failed to get response reader");let v="";for(;;){const{done:N,value:C}=await y.read();if(N)break;v+=new TextDecoder().decode(C)}return v.startsWith(b)||(v=b+v),v}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:uk(f.editorView)})}):[],gO(et),xO(e,d.reference_highlighting??!1)];var h},NE=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:a}=t,i=p0(t);return[Ge.lineWrapping,bO(),yO(),vO(),wO(),kO(),SO(),NO(),CO({position:"fixed",parent:document.querySelector("#App")??void 0}),jO(),e==="dark"?wE:kE,EO(s),pE(o),_O(),IO(),w4(),No.high(_n.of(PO)),TO(),AO(),MO.of(" "),r3(RO,{fallback:!0}),_n.of(LO),OO({placeholderType:i,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:a}}),DO.of(FO()),qa.allowMultipleSelections.of(!0),gE(n),_n.of([{key:"Tab",run:l=>o3(l)||(d=>{const{from:u,to:h}=d.state.selection.main;if(u!==h)return!1;const f=d.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&$O(d)})(l)||zO(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>Va(l.state)!==null&&(pc(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>Va(l.state)!==null&&(pc(!1)(l),!0),preventDefault:!0}]),_n.of([...BO,UO])]},CE={width:void 0,height:void 0};function g0(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}let x0,b0,y0,v0;x0=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),b0=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),y0=t=>{const e=H.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:a,interrupted:i,elapsedTime:l,runStartTimestamp:d,lastRunStartTimestamp:u,uninstantiated:h}=t;if(!n)return null;const f=d??u;let m;e[0]!==f?(m=f?c.jsx(v0,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const x=m;if(r&&o==="running")return ft.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,p,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[3]=x,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:c.jsxs(_s,{children:[c.jsx(js,{className:"h-5 w-5",strokeWidth:1.5}),c.jsx(bc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(y=c.jsx(Ce,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=y):y=e[7],y}if(r){let g,p,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[9]=x,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:c.jsx(js,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(y=c.jsx(Ce,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let g,p,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[15]=x,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:c.jsxs(_s,{layerTop:!0,children:[c.jsx(si,{className:"h-5 w-5",strokeWidth:1.5}),c.jsx(js,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(y=c.jsx(Ce,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let g,p,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=g):g=e[20],e[21]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[21]=x,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:c.jsxs(_s,{children:[c.jsx(bc,{className:"h-5 w-5",strokeWidth:1}),c.jsx(js,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(y=c.jsx(Ce,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=y):y=e[25],y}if(o==="running"){let g,p,b,y,v;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[27]=x,e[28]=p):p=e[28],e[29]!==d?(b=mm.fromSeconds(d)||mm.now(),e[29]=d,e[30]=b):b=e[30],e[31]!==b?(y=c.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:c.jsx(jE,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==p||e[34]!==y?(v=c.jsx(Ce,{content:p,usePortal:!0,children:y}),e[33]=p,e[34]=y,e[35]=v):v=e[35],v}if(o==="queued"){let g,p,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[37]=x,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:c.jsx(Pm,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(y=c.jsx(Ce,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=y):y=e[41],y}if(a||i||s||h){let g;e[42]!==l?(g=Cs(l),e[42]=l,e[43]=g):g=e[43];const p=g;let b;e[44]!==l||e[45]!==p?(b=l?c.jsx(Oc,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const y=b;let v,w,S,N,C,j="";if(h)v="This cell has not yet been run";else if(i){let _;v="This cell was interrupted when it was last run",e[47]!==y?(_=c.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=_):_=e[48],j=_}else if(a){let _;v="This cell has been modified since it was last run",e[49]!==y?(_=c.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=_):_=e[50],j=_}else{let _;v="This cell has not been run with the latest inputs",e[51]!==y?(_=c.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=_):_=e[52],j=_}return e[53]===Symbol.for("react.memo_cache_sentinel")?(w=c.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:c.jsx(bc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=w):w=e[53],e[54]!==v?(S=c.jsx(Ce,{content:v,usePortal:!0,children:w}),e[54]=v,e[55]=S):S=e[55],e[56]!==l||e[57]!==p||e[58]!==x||e[59]!==j?(N=l&&c.jsx(Ce,{content:c.jsxs("div",{className:"flex flex-col gap-1",children:[j,x]}),usePortal:!0,children:c.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:c.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=x,e[59]=j,e[60]=N):N=e[60],e[61]!==S||e[62]!==N?(C=c.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[S,N]}),e[61]=S,e[62]=N,e[63]=C):C=e[63],C}if(l!==null){let g;e[64]!==l?(g=Cs(l),e[64]=l,e[65]=g):g=e[65];const p=g;let b;e[66]!==l||e[67]!==p?(b=l?c.jsx(Oc,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const y=b;let v,w,S,N;return e[69]!==y?(v=c.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=v):v=e[70],e[71]!==x||e[72]!==v?(w=c.jsxs("div",{className:"flex flex-col gap-1",children:[v,x]}),e[71]=x,e[72]=v,e[73]=w):w=e[73],e[74]!==p?(S=c.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:c.jsx("span",{children:p})}),e[74]=p,e[75]=S):S=e[75],e[76]!==w||e[77]!==S?(N=c.jsx(Ce,{content:w,usePortal:!0,children:S}),e[76]=w,e[77]=S,e[78]=N):N=e[78],N}return null},Oc=t=>{const e=H.c(2);let n;return e[0]!==t.elapsedTime?(n=c.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},v0=t=>{const e=H.c(18),n=1e3*t.lastRanTime;let o,r,s,a,i,l,d,u,h;if(e[0]!==n){const f=new Date(n),m=new Date,x=f.toDateString()===m.toDateString()?x0:b0;a="Ran at",i=" ",l=c.jsx("strong",{className:"tracking-wide font-semibold",children:x.format(f)}),d=" ",o="text-muted-foreground",r="(",s=LS(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=a,e[5]=i,e[6]=l,e[7]=d}else o=e[1],r=e[2],s=e[3],a=e[4],i=e[5],l=e[6],d=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(u=c.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=u):u=e[11],e[12]!==a||e[13]!==i||e[14]!==l||e[15]!==d||e[16]!==u?(h=c.jsxs("span",{children:[a,i,l,d,u]}),e[12]=a,e[13]=i,e[14]=l,e[15]=d,e[16]=u,e[17]=h):h=e[17],h},Cs=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const jE=t=>{const e=H.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(a){const i=O.useRef(a),[l,d]=O.useState(a);return O.useEffect(()=>{const u=setInterval(()=>{d(mm.now().toMilliseconds())},17);return()=>clearInterval(u)},[]),l-i.current}(n);let r,s;return e[2]!==o?(r=Cs(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=c.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var ru="ContextMenu",[EE,ML]=a3(ru,[s3]),Yt=s3(),[_E,w0]=EE(ru),k0=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[a,i]=O.useState(!1),l=Yt(e),d=Yo(o),u=O.useCallback(h=>{i(h),d(h)},[d]);return c.jsx(_E,{scope:e,open:a,onOpenChange:u,modal:s,children:c.jsx(nD,{...l,dir:r,open:a,onOpenChange:u,modal:s,children:n})})};k0.displayName=ru;var S0="ContextMenuTrigger",N0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=w0(S0,n),a=Yt(n),i=O.useRef({x:0,y:0}),l=O.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...i.current})}),d=O.useRef(0),u=O.useCallback(()=>window.clearTimeout(d.current),[]),h=f=>{i.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return O.useEffect(()=>u,[u]),O.useEffect(()=>{o&&u()},[o,u]),c.jsxs(c.Fragment,{children:[c.jsx(WO,{...a,virtualRef:l}),c.jsx(bs.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:In(t.onContextMenu,f=>{u(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:In(t.onPointerDown,Xi(f=>{u(),d.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:In(t.onPointerMove,Xi(u)),onPointerCancel:o?t.onPointerCancel:In(t.onPointerCancel,Xi(u)),onPointerUp:o?t.onPointerUp:In(t.onPointerUp,Xi(u))})]})});N0.displayName=S0;var C0=t=>{const{__scopeContextMenu:e,...n}=t,o=Yt(e);return c.jsx(oD,{...o,...n})};C0.displayName="ContextMenuPortal";var j0="ContextMenuContent",E0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=w0(j0,n),s=Yt(n),a=O.useRef(!1);return c.jsx(qO,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:i=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,i),!i.defaultPrevented&&a.current&&i.preventDefault(),a.current=!1},onInteractOutside:i=>{var l;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||r.modal||(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});E0.displayName=j0,O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(GO,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var _0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(YO,{...r,...o,ref:e})});_0.displayName="ContextMenuLabel";var I0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(HO,{...r,...o,ref:e})});I0.displayName="ContextMenuItem";var T0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(KO,{...r,...o,ref:e})});T0.displayName="ContextMenuCheckboxItem",O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(XO,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var A0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(JO,{...r,...o,ref:e})});A0.displayName="ContextMenuRadioItem";var M0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(ZO,{...r,...o,ref:e})});M0.displayName="ContextMenuItemIndicator";var O0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(VO,{...r,...o,ref:e})});O0.displayName="ContextMenuSeparator",O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(QO,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var D0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(eD,{...r,...o,ref:e})});D0.displayName="ContextMenuSubTrigger";var P0=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(tD,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function Xi(t){return e=>e.pointerType!=="mouse"?t(e):void 0}P0.displayName="ContextMenuSubContent";var R0=E0,L0=_0,F0=I0,z0=T0,B0=A0,U0=M0,$0=O0,V0=D0,H0=P0;const W0=k0,q0=N0,IE=aD(C0);O.forwardRef((t,e)=>{const n=H.c(14);let o,r,s,a,i,l,d;return n[0]!==t?({className:r,inset:s,children:o,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==r||n[6]!==s?(i=iD({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=i):i=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(dD,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==a||n[11]!==e||n[12]!==i?(d=c.jsxs(V0,{ref:e,className:i,...a,children:[o,l]}),n[9]=o,n[10]=a,n[11]=e,n[12]=i,n[13]=d):d=n[13],d}).displayName=V0.displayName;const G0="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";O.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,a;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=me(i3({subcontent:!0}),G0,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=c.jsx(H0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a}).displayName=H0.displayName;const su=O.forwardRef((t,e)=>{const n=H.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const a=s===void 0||s;let i;n[4]!==o||n[5]!==a?(i=me(i3(),G0,a&&"overflow-auto",o),n[4]=o,n[5]=a,n[6]=i):i=n[6];const l=a?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let d,u;return n[7]!==r.style||n[8]!==l?(d={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=d):d=n[9],n[10]!==r||n[11]!==e||n[12]!==i||n[13]!==d?(u=c.jsx(IE,{children:c.jsx(lD,{children:c.jsx(R0,{ref:e,className:i,style:d,...r})})}),n[10]=r,n[11]=e,n[12]=i,n[13]=d,n[14]=u):u=n[14],u});su.displayName=R0.displayName;const Zs=O.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,a,i,l;return n[0]!==t?({className:o,inset:r,variant:a,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==o||n[6]!==r||n[7]!==a?(i=sD({className:o,inset:r,variant:a}),n[5]=o,n[6]=r,n[7]=a,n[8]=i):i=n[8],n[9]!==s||n[10]!==e||n[11]!==i?(l=c.jsx(F0,{ref:e,className:i,...s}),n[9]=s,n[10]=e,n[11]=i,n[12]=l):l=n[12],l});Zs.displayName=F0.displayName,O.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,a,i,l,d,u;return n[0]!==t?({className:s,children:r,checked:o,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==s?(i=yc({className:s}),n[5]=s,n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=yc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx("span",{className:l,children:c.jsx(U0,{children:c.jsx(uD,{className:"h-4 w-4"})})}),n[8]=d):d=n[8],n[9]!==o||n[10]!==r||n[11]!==a||n[12]!==e||n[13]!==i?(u=c.jsxs(z0,{ref:e,className:i,checked:o,...a,children:[d,r]}),n[9]=o,n[10]=r,n[11]=a,n[12]=e,n[13]=i,n[14]=u):u=n[14],u}).displayName=z0.displayName,O.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,a,i,l,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?(a=yc({className:r}),n[4]=r,n[5]=a):a=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(i=yc(),n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("span",{className:i,children:c.jsx(U0,{children:c.jsx(hD,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==a?(d=c.jsxs(B0,{ref:e,className:a,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=a,n[12]=d):d=n[12],d}).displayName=B0.displayName,O.forwardRef((t,e)=>{const n=H.c(11);let o,r,s,a,i;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(a=cD({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=a):a=n[6],n[7]!==s||n[8]!==e||n[9]!==a?(i=c.jsx(L0,{ref:e,className:a,...s}),n[7]=s,n[8]=e,n[9]=a,n[10]=i):i=n[10],i}).displayName=L0.displayName;const Y0=O.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,a;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=me(rD({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=c.jsx($0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a});Y0.displayName=$0.displayName;const K0=t=>{const e=H.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=lc(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const a=s;let i;e[3]!==a||e[4]!==n?(i=Kn(n)?a:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("div",{children:a}),c.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=a,e[4]=n,e[5]=i):i=e[5];const l=i;let d,u,h,f,m,x;return e[6]!==o?(d=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=d):d=e[7],e[8]!==n?(u=me("shoulder-button hover-action",Kn(n)&&" inactive-button"),e[8]=n,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ko,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==d||e[12]!==u?(f=c.jsx(sn,{onClick:d,className:u,onMouseDown:Dn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=d,e[12]=u,e[13]=f):f=e[13],e[14]!==l||e[15]!==f?(m=c.jsx(Ce,{content:l,children:f}),e[14]=l,e[15]=f,e[16]=m):m=e[16],e[17]!==o||e[18]!==m?(x=c.jsx(TE,{onClick:o,children:m}),e[17]=o,e[18]=m,e[19]=x):x=e[19],x},TE=t=>{const e=H.c(26),{children:n,onClick:o}=t,{createNewCell:r}=it();if(!o)return n;let s,a,i,l,d,u,h,f,m,x,g,p;return e[0]!==n?(s=c.jsx(q0,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(a=b=>{b.stopPropagation(),o({code:""})},e[2]=o,e[3]=a):a=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx("div",{className:"mr-3 text-muted-foreground",children:c.jsx(Hl,{})}),e[4]=i):i=e[4],e[5]!==a?(l=c.jsxs(Zs,{onSelect:a,children:[i,"Python cell"]},"python"),e[5]=a,e[6]=l):l=e[6],e[7]!==r||e[8]!==o?(d=b=>{b.stopPropagation(),qn({autoInstantiate:!0,createNewCell:r}),o({code:new Oa().defaultCode,hideCode:!0})},e[7]=r,e[8]=o,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("div",{className:"mr-3 text-muted-foreground",children:c.jsx(Vl,{})}),e[10]=u):u=e[10],e[11]!==d?(h=c.jsxs(Zs,{onSelect:d,children:[u,"Markdown cell"]},"markdown"),e[11]=d,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(f=b=>{b.stopPropagation(),qn({autoInstantiate:!0,createNewCell:r}),o({code:new vc().defaultCode})},e[13]=r,e[14]=o,e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx("div",{className:"mr-3 text-muted-foreground",children:c.jsx($o,{size:13,strokeWidth:1.5})}),e[16]=m):m=e[16],e[17]!==f?(x=c.jsxs(Zs,{onSelect:f,children:[m,"SQL cell"]},"sql"),e[17]=f,e[18]=x):x=e[18],e[19]!==l||e[20]!==h||e[21]!==x?(g=c.jsxs(su,{children:[l,h,x]}),e[19]=l,e[20]=h,e[21]=x,e[22]=g):g=e[22],e[23]!==s||e[24]!==g?(p=c.jsxs(W0,{children:[s,g]}),e[23]=s,e[24]=g,e[25]=p):p=e[25],p},X0=G.memo(G.forwardRef((t,e)=>{const n=H.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const a=s===void 0||s,[i,l]=O.useState(!1);let d;n[4]!==r?(d={cell:r},n[4]=r,n[5]=d):d=n[5];const u=ed(d),h=mD();let f,m,x,g,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(AE)}),n[6]=f):f=n[6],O.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Aa,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(Kl,{children:"No results"}),n[8]=x):x=n[8],n[9]!==u){let j;n[11]!==u.length?(j=(_,A)=>c.jsxs(O.Fragment,{children:[c.jsx($f,{children:_.map(T=>{let P=c.jsxs("div",{className:"flex items-center flex-1",children:[T.icon&&c.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:T.icon}),c.jsx("div",{className:"flex-1",children:T.label}),c.jsxs("div",{className:"flex-shrink-0 text-sm",children:[T.hotkey&&l3(T.hotkey),T.rightElement]})]});return T.tooltip&&(P=c.jsx(Ce,{content:T.tooltip,delayDuration:100,children:P})),c.jsx(Gn,{className:me(T.disabled&&"!opacity-50"),onSelect:()=>{T.disableClick||T.disabled||(T.handle(),l(!1))},variant:T.variant,children:P},T.label)})},A),A<u.length-1&&c.jsx(kk,{})]},A),n[11]=u.length,n[12]=j):j=n[12],g=u.map(j),n[9]=u,n[10]=g}else g=n[10];n[13]!==g?(p=c.jsxs(ac,{children:[m,c.jsxs(pm,{children:[x,g]})]}),n[13]=g,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(b=c.jsx(fs,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=b):b=n[17];const y=b;if(!a){let j,_;return n[18]!==o?(j=c.jsx(ys,{asChild:!0,children:o}),n[18]=o,n[19]=j):j=n[19],n[20]!==y||n[21]!==i||n[22]!==j?(_=c.jsxs(xr,{open:i,onOpenChange:l,children:[j,y]}),n[20]=y,n[21]=i,n[22]=j,n[23]=_):_=n[23],_}let v;n[24]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(pD,{tabIndex:-1,children:Wt("cell.cellActions")}),n[24]=v):v=n[24];const w=!i&&v;let S,N,C;return n[25]!==o?(S=c.jsx(gD,{children:c.jsx(ys,{className:"flex",children:o})}),n[25]=o,n[26]=S):S=n[26],n[27]!==w||n[28]!==S?(N=c.jsxs(xD,{delayDuration:200,disableHoverableContent:!0,children:[w,S]}),n[27]=w,n[28]=S,n[29]=N):N=n[29],n[30]!==y||n[31]!==i||n[32]!==N?(C=c.jsxs(xr,{open:i,onOpenChange:l,children:[N,y]}),n[30]=y,n[31]=i,n[32]=N,n[33]=C):C=n[33],C})),J0=G.memo(t=>{const e=H.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=fD(o),e[0]=o,e[1]=s):s=e[1],r=s;const a=Ie(r);if(!a)return null;let i;return e[2]!==n||e[3]!==a?(i=c.jsx(X0,{showTooltip:!1,...a,children:n}),e[2]=n,e[3]=a,e[4]=i):i=e[4],i});function AE(t){return!t}J0.displayName="ConnectionCellActionsDropdown";const Z0=t=>{const e=H.c(32);let n,o,r;e[0]!==t?({children:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]),e[3]!==o?(r={cell:o},e[3]=o,e[4]=r):r=e[4];const s=ed(r),[a,i]=G.useState(),l=!!a;let d,u,h,f,m,x,g,p,b,y;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ja,{size:13,strokeWidth:1.5}),e[5]=d):d=e[5],e[6]!==o?(u=async()=>{var S;if((S=window.getSelection())==null?void 0:S.toString())return void document.execCommand("copy");const w=document.getElementById(fk.create(o.cellId));w?await on(w.textContent??""):ft.warn("cell-context-menu: output not found")},e[6]=o,e[7]=u):u=e[7],e[8]!==s||e[9]!==n||e[10]!==a||e[11]!==o||e[12]!==l||e[13]!==u){const v=[{label:"Copy",hidden:l,icon:d,handle:u},{label:"Cut",hidden:!!a,icon:c.jsx(Gc,{size:13,strokeWidth:1.5}),handle:ME},{label:"Paste",hidden:!!a,icon:c.jsx(Wm,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:N}=o,C=N();if(C)try{const j=await navigator.clipboard.readText();if(j){const{from:_,to:A}=C.state.selection.main,T=C.state.update({changes:{from:_,to:A,insert:j}});C.dispatch(T)}}catch(j){const _=j;ft.error("Failed to paste from clipboard",_),bD({command:"paste"})}}},{label:"Copy image",hidden:!a,icon:c.jsx(Fc,{size:13,strokeWidth:1.5}),handle:async()=>{if(a){const N=await fetch(a.src),C=await N.blob(),j=new ClipboardItem({[C.type]:C});await navigator.clipboard.write([j]).then(OE).catch(DE)}}},{icon:c.jsx(Dm,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!a,handle:()=>{if(a){const N=document.createElement("a");N.download="image.png",N.href=a.src,N.click()}}},{label:"Go to Definition",icon:c.jsx(vD,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:N}=o,C=N();C&&yD(C)}}],w=[v,...s];let S;f=W0,e[20]===Symbol.for("react.memo_cache_sentinel")?(S=N=>{N.target instanceof HTMLImageElement?i(N.target):i(void 0)},e[20]=S):S=e[20],e[21]!==n?(p=c.jsx(q0,{onContextMenu:S,asChild:!0,children:n}),e[21]=n,e[22]=p):p=e[22],h=su,m="w-[300px]",x=!0,g=w.map((N,C)=>c.jsxs(O.Fragment,{children:[N.map(PE),C<w.length-1&&c.jsx(Y0,{})]},C)),e[8]=s,e[9]=n,e[10]=a,e[11]=o,e[12]=l,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=x,e[18]=g,e[19]=p}else h=e[14],f=e[15],m=e[16],x=e[17],g=e[18],p=e[19];return e[23]!==h||e[24]!==m||e[25]!==x||e[26]!==g?(b=c.jsx(h,{className:m,scrollable:x,children:g}),e[23]=h,e[24]=m,e[25]=x,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==p||e[30]!==b?(y=c.jsxs(f,{children:[p,b]}),e[28]=f,e[29]=p,e[30]=b,e[31]=y):y=e[31],y};function ME(){document.execCommand("cut")}function OE(){Xe({title:"Copied image to clipboard"})}function DE(t){Xe({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),ft.error("Failed to copy image to clipboard",t)}function PE(t){if(t.hidden)return null;let e=c.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&c.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),c.jsx("div",{className:"flex-1",children:t.label}),c.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&l3(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=c.jsx(Ce,{delayDuration:100,content:t.tooltip,children:e})),c.jsx(Zs,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}if(CS)jS(EL),CS();else{const t=await gm(()=>import("./loro_wasm_bg-C3hKWL9L.js").then(async e=>(await e.__tla,e)).then(e=>e.w),[],import.meta.url);jS(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":jL}).exports)}const RE=["Map","Text","List","Tree","MovableList","Counter"];function Q0(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&RE.includes(t.kind())}ES.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(a,i)=>{if(typeof i=="string"&&i.startsWith("cid:")&&!e.has(i)){e.add(i);const d=n.getContainerById(i);if(d==null)throw new Error(`ContainerID not found: ${i}`);const u=t(a,d);if(u===d){const h=d.getShallowValue();return typeof h=="object"?r(h):h}if(Q0(u))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof u=="object"&&u!=null?r(u):u}if(typeof i=="object"&&i!=null)return r(i);const l=t(a,i);if(Q0(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=a=>{if(Array.isArray(a))return a.map((l,d)=>o(d,l)).filter(l=>l!==void 0);const i={};for(const[l,d]of Object.entries(a)){const u=o(l,d);u!==void 0&&(i[l]=u)}return i},s=n.getShallowValue();return r(s)};const LE=Ge.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),Qs=Tt.define(),au=gn.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(Qs))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),ex=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(Qs));return t.docChanged||t.viewportChanged||e.length>0};class Ji{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=Ji.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const a=e.scrollDOM.getBoundingClientRect(),i=(e.textDirection===kD.LTR?a.left:a.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=a.top-e.scrollDOM.scrollTop;return[new Ji(s.left-i,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const FE=(t,e,n,o)=>{const r=[],{updated:s,added:a}=n;for(const i of[...s,...a]){const l=tx(t,e,i,o);l&&r.push(l)}return r},tx=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return Qs.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=_S.decode(r.cursor.anchor),a=t.getCursorPos(s).offset;let i=a;if(r.cursor.head){const l=_S.decode(r.cursor.head);i=t.getCursorPos(l).offset}return Qs.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:a,head:i},user:r.user})};class zE{constructor(e,n,o,r,s,a,i){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=a,this.getUserId=i,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const d=[];for(const u of this.awareness.peers()){const h=tx(this.doc,this.awareness,u,this.scopeId);h&&d.push(h)}this.view.dispatch({effects:d})}else l.by==="checkout"&&this.view.dispatch({effects:[Qs.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=UE({doc:this.doc,getTextFromDoc:this.getTextFromDoc,anchor:n.anchor,head:n.head});this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class BE{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(a,i)=>{i!=="local"&&this.view.dispatch({effects:FE(this.doc,this.awareness,a,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const UE=({doc:t,getTextFromDoc:e,anchor:n,head:o})=>{var a,i;n===o&&(o=void 0);const r=(a=e(t).getCursor(n))==null?void 0:a.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(i=e(t).getCursor(o))==null?void 0:i.encode()),{anchor:r,head:s}},Zi=["bg-[var(--amber-6)]","bg-[var(--blue-6)]","bg-[var(--crimson-6)]","bg-[var(--cyan-6)]","bg-[var(--grass-6)]","bg-[var(--gray-6)]","bg-[var(--green-6)]","bg-[var(--lime-6)]","bg-[var(--orange-6)]","bg-[var(--purple-6)]","bg-[var(--red-6)]","bg-[var(--sage-6)]","bg-[var(--sky-6)]","bg-[var(--slate-6)]"],$E=(t,e,n)=>Rn.define(o=>new VE(o,t,e,n)),Mr=hm.define();class VE{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const a=[];let i=0;for(const{diff:l,path:d}of s.events){if(d.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const u=l.diff;for(const h of u)h.insert?a.push({from:i,to:i,insert:h.insert}):h.delete?(a.push({from:i,to:i+h.delete}),i+=h.delete):h.retain!=null&&(i+=h.retain);a.length>0&&this.view.dispatch({changes:a,annotations:[Mr.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[Mr.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),a=this.getTextFromDoc(this.doc);s!==a.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:a.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(Mr)===this||e.transactions[0].annotation(Mr)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,a,i)=>{const l=i.sliceString(0,i.length,`
119
- `);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const Kt=ft.get("rtc"),nx=Kt.get("awareness").disabled(),iu="awareness:",Or=yt(void 0),Ft=new ES,Qi=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new _L(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(Ft.peerIdStr),lu=ND(()=>{Kt.debug("creating websocket");const t=Qk().getWsSyncURL(h3()).toString(),e=new oL(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await e3(),CD()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(a,i){return new TextDecoder().decode(a.slice(0,i.length))===i}(s,iu)){const a=function(i,l){return i.slice(l.length)}(s,iu);return Qi.apply(a),void nx.debug("applied awareness update")}Ft.import(s),Kt.debug("imported doc change. new doc:",Ft.toJSON()),et.get(Or)!==Ft&&et.set(Or,Ft)}),e.addEventListener("open",()=>{Kt.debug("websocket open")}),e.addEventListener("close",n=>{Kt.warn("websocket close",n),et.get(Or)===Ft&&et.set(Or,void 0)}),e});function cu(t,e,n=""){if(Zt())return{extension:[],code:n};const o=Ft.getByPath(`codes/${t}`)!==void 0,r=Ft.getMap("codes").getOrCreateContainer(t,new Fm);o||(Kt.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return et.get(f3)||"Anonymous"},get colorClassName(){return(a=>{if(typeof a=="string"){let i=0;for(let l=0;l<a.length;l++)i=(i<<5)-i+a.charCodeAt(l),i=Math.trunc(i);return Zi[Math.abs(i)%Zi.length]}return Zi[a%Zi.length]})(this.name)}};return{code:n.toString(),extension:[HE(t),WE(t),qE(Ft,Qi,s,()=>r,t),$E(Ft,["codes",t],()=>r)]}}function HE(t){const e=(o,r)=>{const s=o.state.field(xc).type,a=r.toString();a&&a!==s&&(Kt.debug(`[incoming] setting language type: ${s} -> ${a}`),hr(o,{language:a,keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(bm),a=r.toJSON();Pa(s,a)||o.dispatch({effects:[d3.of(a)],annotations:[Mr.of(!0)]})};return Rn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Ft.getByPath(`languages/${t}`);if(!s)return void Kt.error("no language container found for cell",t);wo(s instanceof Fm,"language type is not a LoroText");const a=Ft.getByPath(`language_metadata/${t}`);a?(wo(a instanceof IS,"language metadata is not a LoroMap"),e(o,s),n(o,a),r=Ft.subscribe(i=>{if(i.origin==="local")return;const l=i.events.some(u=>u.target===s.id),d=i.events.some(u=>u.target===a.id);l&&e(o,s),d&&n(o,a)})):Kt.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function WE(t){const e=Ft.getMap("languages").getOrCreateContainer(t,new Fm),n=Ft.getMap("language_metadata").getOrCreateContainer(t,new IS);return Ge.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const a=xm(o.state).type;hr(o.view,{language:a}),Kt.debug("no initial language, setting default to",a),e.delete(0,e.length),e.insert(0,a),Kt.debug("no initial language metadata, setting default to",o.state.field(bm));const i=o.state.field(bm);for(const l of Object.keys(i))n.set(l,i[l]);return void Ft.commit()}let s=!1;for(const a of o.transactions)if(!a.annotation(Mr)){for(const i of a.effects)if(i.is(SD)&&e.toString()!==i.value.type&&(Kt.debug(`[outgoing] language change: ${e} -> ${i.value.type}`),e.delete(0,e.length),e.insert(0,i.value.type),s=!0),i.is(d3)||i.is(u3)){const l=i.value;i.is(u3)?(Kt.debug("[outgoing] setting language metadata: ",l),n.clear()):Kt.debug("[outgoing] updating language metadata: ",l);for(const d of Object.keys(l))n.set(d,l[d]);s=!0}}s&&Ft.commit()})}function qE(t,e,n,o,r,s){const a=`loro:cell:${r}`;return[au,c3({above:!0,class:"loro-cursor-layer",update:ex,markers:i=>{const{remoteCursors:l,isCheckout:d}=i.state.field(au);return d?[]:[...l.values()].flatMap(u=>{var f,m;const h=ko.cursor(u.cursor.anchor);return Ji.createCursor(i,h,((f=u.user)==null?void 0:f.name)||"unknown",((m=u.user)==null?void 0:m.colorClassName)||"")})}}),c3({above:!1,class:"loro-selection-layer",update:ex,markers:i=>{const{remoteCursors:l,isCheckout:d}=i.state.field(au);return d?[]:[...l.entries()].filter(([,u])=>u.cursor.head!==void 0&&u.cursor.anchor!==u.cursor.head).flatMap(([,u])=>{var f;const h=ko.range(u.cursor.anchor,u.cursor.head);return wD.forRange(i,`loro-selection ${((f=u.user)==null?void 0:f.colorClassName)||""}`,h)})}}),Rn.define(i=>new zE(i,t,n,e,o,a,s)),Rn.define(i=>new BE(i,t,e,a)),LE]}function el(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}wc()&&lu(),Ft.subscribeLocalUpdates(t=>{Kt.debug("local update, sending to server"),lu().send(t)}),Qi.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(nx.debug("awareness changes",n),lu().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(iu,Qi.encode(n))))});var ox={modified:{doc:""},original:{doc:""}},rx=O.createContext(ox);function GE(t,e){return vt({},t,e,{modified:vt({},t.modified,e.modified),original:vt({},t.original,e.original)})}var du=()=>O.useContext(rx),YE=t=>{var{children:e,theme:n}=t,[o,r]=O.useReducer(GE,vt({},ox,{theme:n}));return O.useEffect(()=>r({theme:n}),[n]),c.jsx(rx.Provider,{value:vt({},o,{dispatch:r}),children:e})},KE=["extensions","value","selection","onChange"],sx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Ga(t,KE),{theme:a,dispatch:i}=du(),l=vs(vt({},s,{theme:a}));return O.useEffect(()=>i({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};sx.displayName="CodeMirrorMerge.Original";var XE=["extensions","value","selection","onChange"],ax=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Ga(t,XE),{theme:a,dispatch:i}=du(),l=vs(vt({},s,{theme:a}));return O.useEffect(()=>{i({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};ax.displayName="CodeMirrorMerge.Modified";class jt{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n=e){return new jt(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function ar(t,e,n,o,r,s){if(t==o)return[];let a=mu(t,e,n,o,r,s),i=pu(t,e+a,n,o,r+a,s),l=(n-=i)-(e+=a),d=(s-=i)-(r+=a);if(!l||!d)return[new jt(e,n,r,s)];if(l>d){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new jt(e,e+h,r,r),new jt(e+h+d,n,s,s)]}else if(d>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new jt(e,e,r,r+h),new jt(n,n,r+h+l,s)]}if(l==1||d==1)return[new jt(e,n,r,s)];let u=cx(t,e,n,o,r,s);if(u){let[h,f,m]=u;return ar(t,e,h,o,r,f).concat(ar(t,h+m,n,o,f+m,s))}return function(h,f,m,x,g,p){let b=m-f,y=p-g;if(ea<1e9&&Math.min(b,y)>16*ea||ta>0&&Date.now()>ta)return Math.min(b,y)>64*ea?[new jt(f,m,g,p)]:dx(h,f,m,x,g,p);let v=Math.ceil((b+y)/2);hu.reset(v),fu.reset(v);let w=(j,_)=>h.charCodeAt(f+j)==x.charCodeAt(g+_),S=(j,_)=>h.charCodeAt(m-j-1)==x.charCodeAt(p-_-1),N=(b-y)%2!=0?fu:null,C=N?null:hu;for(let j=0;j<v;j++){if(j>ea||ta>0&&!(63&j)&&Date.now()>ta)return dx(h,f,m,x,g,p);let _=hu.advance(j,b,y,v,N,!1,w)||fu.advance(j,b,y,v,C,!0,S);if(_)return JE(h,f,m,f+_[0],x,g,p,g+_[1])}return[new jt(f,m,g,p)]}(t,e,n,o,r,s)}let ea=1e9,ta=0,uu=!1;class ix{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,a,i){for(let l=-e+this.start;l<=e-this.end;l+=2){let d=r+l,u=l==-e||l!=e&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,h=u-l;for(;u<n&&h<o&&i(u,h);)u++,h++;if(this.vec[d]=u,u>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(a){let m=s.vec[f];if(m>=n-u)return[m,r+m-f]}else if(u>=n-s.vec[f])return[u,h]}}}return null}}const hu=new ix,fu=new ix;function JE(t,e,n,o,r,s,a,i){let l=!1;return Dr(t,o)||++o!=n||(l=!0),Dr(r,i)||++i!=a||(l=!0),l?[new jt(e,n,s,a)]:ar(t,e,o,r,s,i).concat(ar(t,o,n,r,i,a))}function lx(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function mu(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let a=lx(n-e,s-r);for(let i=e,l=r;;){let d=i+a,u=l+a;if(d>n||u>s||t.slice(i,d)!=o.slice(l,u)){if(a==1)return i-e-(Dr(t,i)?0:1);a>>=1}else{if(d==n||u==s)return d-e;i=d,l=u}}}function pu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let a=lx(n-e,s-r);for(let i=n,l=s;;){let d=i-a,u=l-a;if(d<e||u<r||t.slice(d,i)!=o.slice(u,l)){if(a==1)return n-i-(Dr(t,i)?0:1);a>>=1}else{if(d==e||u==r)return n-d;i=d,l=u}}}function gu(t,e,n,o,r,s,a,i){let l=o.slice(r,s),d=null;for(;;){if(d||a<i)return d;for(let u=e+a;;){Dr(t,u)||u++;let h=u+a;if(Dr(t,h)||(h+=h==u+1?1:-1),h>=n)break;let f=t.slice(u,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let x=mu(t,h,n,o,r+m+f.length,s),g=pu(t,e,u,o,r,r+m),p=f.length+x+g;(!d||d[2]<p)&&(d=[u-g,r+m-g,p])}u=h}if(i<0)return d;a>>=1}}function cx(t,e,n,o,r,s){let a=n-e,i=s-r;if(a<i){let l=cx(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return a<4||2*i<a?null:gu(t,e,n,o,r,s,Math.floor(a/4),-1)}function dx(t,e,n,o,r,s){uu=!0;let a,i=n-e,l=s-r;if(i<l){let f=gu(o,r,s,t,e,n,Math.floor(i/6),50);a=f&&[f[1],f[0],f[2]]}else a=gu(t,e,n,o,r,s,Math.floor(l/6),50);if(!a)return[new jt(e,n,r,s)];let[d,u,h]=a;return ar(t,e,d,o,r,u).concat(ar(t,d+h,n,o,u+h,s))}function ux(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new jt(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let ir;try{ir=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function hx(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function fx(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?hx(n)?1:0:ir?vx(n)&&e!=t.length-1?ir.test(t.slice(e,e+2))?2:0:ir.test(String.fromCharCode(n))?1:0:0}function mx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?hx(n)?1:0:ir?wx(n)&&e!=1?ir.test(t.slice(e-2,e))?2:0:ir.test(String.fromCharCode(n))?1:0:0}const px=8;function gx(t,e,n){if(e==t.length||!mx(t,e))return e;for(let o=e,r=e+n,s=0;s<px;s++){let a=fx(t,o);if(!a||o+a>r)return o;o+=a}return e}function xx(t,e,n){if(!e||!fx(t,e))return e;for(let o=e,r=e-n,s=0;s<px;s++){let a=mx(t,o);if(!a||o-a<r)return o;o-=a}return e}function bx(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function yx(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const vx=t=>t>=55296&&t<=56319,wx=t=>t>=56320&&t<=57343;function Dr(t,e){return!e||e==t.length||!vx(t.charCodeAt(e-1))||!wx(t.charCodeAt(e))}function ZE(t,e,n){var o;return ea=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,ta=n!=null&&n.timeout?Date.now()+n.timeout:0,uu=!1,function(r,s,a){for(;;){ux(a,1);let i=!1;for(let l=0;l<a.length;l++){let d,u,h=a[l];(d=mu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=a[l]=new jt(h.fromA+d,h.toA,h.fromB+d,h.toB)),(u=pu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=a[l]=new jt(h.fromA,h.toA-u,h.fromB,h.toB-u));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let x=h.fromA-(l?a[l-1].toA:0),g=(l<a.length-1?a[l+1].fromA:r.length)-h.toA;if(!x||!g)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);x<=p.length&&r.slice(h.fromA-x,h.fromA)==p.slice(p.length-x)?(a[l]=new jt(h.fromA-x,h.toA-x,h.fromB-x,h.toB-x),i=!0):g<=p.length&&r.slice(h.toA,h.toA+g)==p.slice(0,g)&&(a[l]=new jt(h.fromA+g,h.toA+g,h.fromB+g,h.toB+g),i=!0)}if(!i)break}return a}(t,e,ar(t,0,t.length,e,0,e.length))}function kx(){return!uu}function Sx(t,e,n){return function(o,r,s){for(let a=0,i=0;i<o.length;i++){let l=o[i],d=l.toA-l.fromA,u=l.toB-l.fromB;if(d&&u||d>3||u>3){let h=i==o.length-1?r.length:o[i+1].fromA,f=l.fromA-a,m=h-l.toA,x=xx(r,l.fromA,f),g=gx(r,l.toA,m),p=l.fromA-x,b=g-l.toA;if((!d||!u)&&p&&b){let y=Math.max(d,u),[v,w,S]=d?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];y>p&&r.slice(x,l.fromA)==v.slice(S-p,S)?(l=o[i]=new jt(x,x+d,l.fromB-p,l.toB-p),x=l.fromA,g=gx(r,l.toA,h-l.toA)):y>b&&r.slice(l.toA,g)==v.slice(w,w+b)&&(l=o[i]=new jt(g-d,g,l.fromB+b,l.toB+b),g=l.toA,x=xx(r,l.fromA,l.fromA-a)),p=l.fromA-x,b=g-l.toA}if(p||b)l=o[i]=new jt(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b);else if(d){if(!u){let y,v=yx(r,l.fromA,l.toA),w=v<0?-1:bx(r,l.toA,l.fromA);v>-1&&(y=v-l.fromA)<=m&&r.slice(l.fromA,v)==r.slice(l.toA,l.toA+y)?l=o[i]=l.offset(y):w>-1&&(y=l.toA-w)<=f&&r.slice(l.fromA-y,l.fromA)==r.slice(w,l.toA)&&(l=o[i]=l.offset(-y))}}else{let y,v=yx(s,l.fromB,l.toB),w=v<0?-1:bx(s,l.toB,l.fromB);v>-1&&(y=v-l.fromB)<=m&&s.slice(l.fromB,v)==s.slice(l.toB,l.toB+y)?l=o[i]=l.offset(y):w>-1&&(y=l.toB-w)<=f&&s.slice(l.fromB-y,l.fromB)==s.slice(w,l.toB)&&(l=o[i]=l.offset(-y))}}a=l.toA}return ux(o,3),o}(ZE(t,e,n),t,e)}const zn=br.define({combine:t=>t[0]}),xu=Tt.define(),QE=br.define(),Pr=gn.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(xu)&&(t=n.value);for(let n of e.state.facet(QE))t=n(t,e);return t}});class Rr{constructor(e,n,o,r,s,a=!0){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s,this.precise=a}offset(e,n){return e||n?new Rr(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return jx(Sx(e.toString(),n.toString(),o),e,n,0,0,kx())}static updateA(e,n,o,r,s){return Ix(_x(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return Ix(_x(e,r,!1,n.length),e,n,o,s)}}function Nx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function Cx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function jx(t,e,n,o,r,s){let a=[];for(let i=0;i<t.length;i++){let l=t[i],[d,u]=Nx(l.fromA+o,l.fromB+r,e,n),[h,f]=Cx(l.toA+o,l.toB+r,e,n),m=[l.offset(-d+o,-u+r)];for(;i<t.length-1;){let x=t[i+1],[g,p]=Nx(x.fromA+o,x.fromB+r,e,n);if(g>h+1&&p>f+1)break;m.push(x.offset(-d+o,-u+r)),[h,f]=Cx(x.toA+o,x.toB+r,e,n),i++}a.push(new Rr(m,d,Math.max(d,h),u,Math.max(u,f),s))}return a}const tl=1e3;function Ex(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let u=0,h=0;r&&({toA:u,toB:h}=t[r-1]);let f=e-(n?u:h);return[u+f,h+f]}let a=r+s>>1,i=t[a],[l,d]=n?[i.fromA,i.toA]:[i.fromB,i.toB];if(l>e)s=a;else{if(!(d<=e))return o?[i.fromA,i.fromB]:[i.toA,i.toB];r=a+1}}}function _x(t,e,n,o){let r=[];return e.iterChangedRanges((s,a,i,l)=>{let d=0,u=n?e.length:o,h=0,f=n?o:e.length;s>tl&&([d,h]=Ex(t,s-tl,n,!0)),a<e.length-tl&&([u,f]=Ex(t,a+tl,n,!1));let m,x=l-i-(a-s),[g,p]=n?[x,0]:[0,x];r.length&&(m=r[r.length-1]).toA>=d?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+g,diffB:m.diffB+p}:r.push({fromA:d,toA:u,fromB:h,toB:f,diffA:g,diffB:p})}),r}function Ix(t,e,n,o,r){if(!t.length)return e;let s=[];for(let a=0,i=0,l=0,d=0;;a++){let u=a==t.length?null:t[a],h=u?u.fromA+i:n.length,f=u?u.fromB+l:o.length;for(;d<e.length;){let p=e[d];if(p.toA+i>h||p.toB+l>f)break;s.push(p.offset(i,l)),d++}if(!u)break;let m=u.toA+i+u.diffA,x=u.toB+l+u.diffB,g=Sx(n.sliceString(h,m),o.sliceString(f,x),r);for(let p of jx(g,n,o,h,f,kx()))s.push(p);for(i+=u.diffA,l+=u.diffB;d<e.length;){let p=e[d];if(p.fromA+i>m&&p.fromB+l>x)break;d++}}return s}const e5={scanLimit:500},Tx=Rn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Ox(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(Pr,!1)!=n.field(Pr,!1))||function(o,r){return o.facet(zn)!=r.facet(zn)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Ox(t.view))}},{decorations:t=>t.deco}),nl=No.low(ED({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Tx))===null||e===void 0?void 0:e.gutter)||_D.empty}})),Ax=ot.line({class:"cm-changedLine"}),t5=ot.mark({class:"cm-changedText"}),n5=ot.mark({tagName:"ins",class:"cm-insertedLine"}),o5=ot.mark({tagName:"del",class:"cm-deletedLine"}),Mx=new class extends ID{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function r5(t,e,n,o,r,s){let a=n?t.fromA:t.fromB,i=n?t.toA:t.toB,l=0;if(a!=i){r.add(a,a,Ax),r.add(a,i,n?o5:n5),s&&s.add(a,a,Mx);for(let d=e.iterRange(a,i-1),u=a;!d.next().done;){if(d.lineBreak){u++,r.add(u,u,Ax),s&&s.add(u,u,Mx);continue}let h=u+d.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=a+(n?f.fromA:f.fromB),x=a+(n?f.toA:f.toB),g=Math.max(u,m),p=Math.min(h,x);if(g<p&&r.add(g,p,t5),!(x<h))break;l++}u=h}}}function Ox(t){let e=t.state.field(Pr),{side:n,highlightChanges:o,markGutter:r,overrideChunk:s}=t.state.facet(zn),a=n=="a",i=new hs,l=r?new hs:null,{from:d,to:u}=t.viewport;for(let h of e){if((a?h.fromA:h.fromB)>=u)break;(a?h.toA:h.toB)>d&&(s&&s(t.state,h,i,l)||r5(h,t.state.doc,a,o,i,l))}return{deco:i.finish(),gutter:l&&l.finish()}}class ol extends xs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const rl=Tt.define({map:(t,e)=>t.map(e)}),na=gn.define({create:()=>ot.none,update:(t,e)=>{for(let n of e.effects)if(n.is(rl))return n.value;return t.map(e.changes)},provide:t=>Ge.decorations.from(t)}),bu=.01;function Dx(t,e){if(t.size!=e.size)return!1;let n=t.iter(),o=e.iter();for(;n.value;){if(n.from!=o.from||Math.abs(n.value.spec.widget.height-o.value.spec.widget.height)>1)return!1;n.next(),o.next()}return!0}const yu=Tt.define({map:(t,e)=>e.mapPos(t)});class s5 extends xs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:yu.of(r)});let{side:s,sibling:a}=e.state.facet(zn);a&&a().dispatch({effects:yu.of(a5(r,e.state.field(Pr),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function a5(t,e,n){let o=0,r=0;for(let s=0;;s++){let a=s<e.length?e[s]:null;if(!a||(n?a.fromA:a.fromB)>=t)return r+(t-o);[o,r]=n?[a.toA,a.toB]:[a.toB,a.toA]}}const i5=gn.define({create:t=>ot.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(yu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>Ge.decorations.from(t)});function Px({margin:t=3,minSize:e=4}){return i5.init(n=>function(o,r,s){let a=new hs,i=o.facet(zn).side=="a",l=o.field(Pr),d=1;for(let u=0;;u++){let h=u<l.length?l[u]:null,f=u?d+r:1,m=h?o.doc.lineAt(i?h.fromA:h.fromB).number-1-r:o.doc.lines,x=m-f+1;if(x>=s&&a.add(o.doc.line(f).from,o.doc.line(m).to,ot.replace({widget:new s5(x),block:!0})),!h)break;d=o.doc.lineAt(Math.min(o.doc.length,i?h.toA:h.toB)).number}return a.finish()}(n,t,e))}const l5=Ge.styleModule.of(new jD({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),c5=Ge.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Rx=new fm,sl=new fm;class Lx{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||e5;let n=[No.low(Tx),c5,l5,na,Ge.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(rl)))&&this.measure()})],o=[zn.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(nl);let r=qa.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Ge.editorAttributes.of({class:"cm-merge-a"}),sl.of(o),n]}),s=[zn.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(nl);let a=qa.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Ge.editorAttributes.of({class:"cm-merge-b"}),sl.of(s),n]});this.chunks=Rr.build(r.doc,a.doc,this.diffConf);let i=[Pr.init(()=>this.chunks),Rx.of(e.collapseUnchanged?Px(e.collapseUnchanged):[])];r=r.update({effects:Tt.appendConfig.of(i)}).state,a=a.update({effects:Tt.appendConfig.of(i)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",d=document.createElement("div");d.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?d:u),this.editorDOM.appendChild(l=="a-b"?u:d),this.a=new Ge({state:r,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new Ge({state:a,parent:u,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((a,i)=>a.compose(i.changes),Ha.empty(e[0].startState.doc.length));this.chunks=n==this.a?Rr.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):Rr.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:xu.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:xu.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let a=this.a.dom.parentNode,i=this.b.dom.parentNode;a.remove(),i.remove(),this.editorDOM.insertBefore(s?a:i,this.editorDOM.firstChild),this.editorDOM.appendChild(s?i:a),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,a=this.revertToA,i=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,a=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(i=e.renderRevertControl),this.setupRevertControls(s,a,i)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],a=[];if(n||o){let i=this.a.state.facet(zn),l=o?e.gutter!==!1:i.markGutter,d=n?e.highlightChanges!==!1:i.highlightChanges;s.push(sl.reconfigure([zn.of({side:"a",sibling:()=>this.b,highlightChanges:d,markGutter:l}),l?nl:[]])),a.push(sl.reconfigure([zn.of({side:"b",sibling:()=>this.a,highlightChanges:d,markGutter:l}),l?nl:[]]))}if(r){let i=Rx.reconfigure(e.collapseUnchanged?Px(e.collapseUnchanged):[]);s.push(i),a.push(i)}this.a.dispatch({effects:s}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new hs,s=new hs,a=e.state.field(na).iter(),i=n.state.field(na).iter(),l=0,d=0,u=0,h=0,f=e.viewport,m=n.viewport;for(let b=0;;b++){let y=b<o.length?o[b]:null,v=y?y.fromA:e.state.doc.length,w=y?y.fromB:n.state.doc.length;if(l<v){let S=e.lineBlockAt(l).top+u-(n.lineBlockAt(d).top+h);S<-.01?(u-=S,r.add(l,l,ot.widget({widget:new ol(-S),block:!0,side:-1}))):S>bu&&(h+=S,s.add(d,d,ot.widget({widget:new ol(S),block:!0,side:-1})))}if(v>l+1e3&&l<f.from&&v>f.from&&d<m.from&&w>m.from){let S=Math.min(f.from-l,m.from-d);l+=S,d+=S,b--}else{if(!y)break;l=y.toA,d=y.toB}for(;a.value&&a.from<l;)u-=a.value.spec.widget.height,a.next();for(;i.value&&i.from<d;)h-=i.value.spec.widget.height,i.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;i.value;)h-=i.value.spec.widget.height,i.next();let x=e.contentHeight+u-(n.contentHeight+h);x<bu?r.add(e.state.doc.length,e.state.doc.length,ot.widget({widget:new ol(-x),block:!0,side:1})):x>bu&&s.add(n.state.doc.length,n.state.doc.length,ot.widget({widget:new ol(x),block:!0,side:1}));let g=r.finish(),p=s.finish();Dx(g,e.state.field(na))||e.dispatch({effects:rl.of(g)}),Dx(p,n.state.field(na))||n.dispatch({effects:rl.of(p)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let a=this.chunks[s];if(a.fromA>o.to||a.fromB>r.to)break;if(a.fromA<o.from||a.fromB<r.from)continue;let i=this.a.lineBlockAt(a.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=Fx(n);n&&n.dataset.chunk==String(s)?(n.style.top!=i&&(n.style.top=i),n=n.nextSibling):e.insertBefore(this.renderRevertButton(i,s),n)}for(;n;)n=Fx(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,a,i,l,d]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],u=r.state.sliceDoc(a,Math.max(a,i-1));a!=i&&d<=s.state.doc.length&&(u+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,d),insert:u},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Fx(t){let e=t.nextSibling;return t.remove(),e}var d5=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig","root"],u5=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],zx=G.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:a,gutter:i,collapseUnchanged:l,destroyRerender:d=!0,renderRevertControl:u,diffConfig:h,root:f}=t,m=Ga(t,d5),x=du(),{modified:g,modifiedExtension:p,original:b,originalExtension:y,theme:v,dispatch:w}=x,S=Ga(x,u5),N=O.useRef(null),C=O.useRef(),j={orientation:r,revertControls:s,highlightChanges:a,gutter:i,collapseUnchanged:l,renderRevertControl:u,diffConfig:h,root:f};O.useImperativeHandle(e,()=>({container:N.current,view:C.current,modified:g,original:b,config:vt({a:b,b:g,parent:N.current},j)}),[N,C,g,b,j]);var _=Ge.updateListener.of(T=>{if(T.docChanged&&typeof(y==null?void 0:y.onChange)=="function"){var P=T.state.doc.toString();y==null||y.onChange(P,T)}}),A=Ge.updateListener.of(T=>{if(T.docChanged&&typeof(p==null?void 0:p.onChange)=="function"){var P=T.state.doc.toString();p==null||p.onChange(P,T)}});return O.useEffect(()=>{!C.current&&N.current&&y&&p&&(C.current=new Lx(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...vs(vt({},y==null?void 0:y.option,{theme:v})),_]}),b:vt({},g,{extensions:[...(p==null?void 0:p.extension)||[],...vs(vt({},p==null?void 0:p.option,{theme:v})),A]}),parent:N.current},j)),w({view:C.current}))},[C,N,y,p]),O.useEffect(()=>{if(b&&b.doc&&C.current){var T,P,L=(T=C.current)==null?void 0:T.a.state.doc.toString();L!==b.doc&&((P=C.current)==null||P.a.dispatch({changes:{from:0,to:L.length,insert:b.doc||""}}))}if(g&&g.doc&&C.current){var M,R,z=(M=C.current)==null?void 0:M.b.state.doc.toString();z!==g.doc&&((R=C.current)==null||R.b.dispatch({changes:{from:0,to:z.length,insert:g.doc||""}}))}if(d&&C.current){var D=C.current.a.state.selection.ranges[0].from,I=C.current.b.state.selection.ranges[0].from;C.current.destroy(),C.current=new Lx(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...vs(vt({},y==null?void 0:y.option,{theme:v}))]}),b:vt({},g,{extensions:[...(p==null?void 0:p.extension)||[],...vs(vt({},p==null?void 0:p.option,{theme:v}))]}),parent:N.current},j)),D&&(C.current.a.focus(),C.current.a.dispatch({selection:{anchor:D,head:D}})),I&&(C.current.b.focus(),C.current.b.dispatch({selection:{anchor:I,head:I}}))}},[C,v,N.current,b,g,y,p,d]),O.useEffect(()=>()=>C.current&&C.current.destroy(),[]),O.useEffect(()=>{if(C.current){var T={};S.orientation!==r&&(T.orientation=r),S.revertControls!==s&&(T.revertControls=s),S.highlightChanges!==a&&(T.highlightChanges=a),S.gutter!==i&&(T.gutter=i),S.collapseUnchanged!==l&&(T.collapseUnchanged=l),S.renderRevertControl!==u&&(T.collapseUnchanged=l),Object.keys(T).length&&w&&C.current&&(C.current.reconfigure(vt({},T)),w(vt({},T)))}},[w,C,r,s,a,i,l,u]),c.jsx("div",vt({ref:N,className:"cm-merge-theme"+(n?" "+n:"")},m,{children:o}))});zx.displayName="CodeMirrorMerge.Internal";var h5=["theme"],Lr=G.forwardRef((t,e)=>{var{theme:n}=t,o=Ga(t,h5);return c.jsx(YE,{theme:n,children:c.jsx(zx,vt({},o,{ref:e}))})});Lr.Original=sx,Lr.Modified=ax,Lr.displayName="CodeMirrorMerge";const f5=Lr.Original,m5=Lr.Modified,Bx=[AD(),Ge.lineWrapping],p5=t=>{const e=H.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:a,declineChange:i,acceptChange:l,enabled:d,children:u}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=O.useState(h),[x,g]=Ot($S),p=ym(),{completion:b,input:y,stop:v,isLoading:w,setCompletion:S,setInput:N,handleSubmit:C}=TD({api:p.getAiURL("completion").toString(),headers:p.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:x?gc(a):"",code:a,language:s},onError:g5,onFinish:($,K)=>{j(K.trimEnd())}}),j=S,_=G.useRef(null);let A,T,P,L;e[1]!==d?(A=()=>{var $;d&&(MD(()=>{const K=_.current;return!!(K!=null&&K.view)&&(K.view.focus(),!0)},{retries:3,delay:100,initialDelay:100}),OD(($=_.current)==null?void 0:$.view))},T=[d],e[1]=d,e[2]=A,e[3]=T):(A=e[2],T=e[3]),O.useEffect(A,T),e[4]!==d||e[5]!==r||e[6]!==N?(P=()=>{d&&N(r||"")},L=[d,r,N],e[4]=d,e[5]=r,e[6]=N,e[7]=P,e[8]=L):(P=e[7],L=e[8]),O.useEffect(P,L);const{theme:M}=Xo();let R;e[9]!==n?(R=me("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=R):R=e[10];const z=d&&"max-h-[400px] min-h-11 visible",D=!d&&"max-h-0 min-h-0 invisible";let I,k,B,E;e[11]!==z||e[12]!==D?(I=me("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",z,D),e[11]=z,e[12]=D,e[13]=I):I=e[13],e[14]!==l||e[15]!==b||e[16]!==i||e[17]!==d||e[18]!==C||e[19]!==x||e[20]!==y||e[21]!==w||e[22]!==j||e[23]!==g||e[24]!==N||e[25]!==v||e[26]!==M?(k=d&&c.jsxs(c.Fragment,{children:[c.jsx(Ia,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),c.jsx(kc,{inputRef:_,theme:M,onClose:()=>{i(),j("")},value:y,onChange:$=>{N($),m(p3({input:$}))},onSubmit:()=>{w||C()}}),w&&c.jsxs(ke,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:v,children:[c.jsx(Sc,{className:"animate-spin mr-1",size:14}),"Stop"]}),!w&&b&&c.jsx(ke,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:w,onClick:()=>{l(b),j("")},children:c.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),c.jsx("div",{className:"h-full w-px bg-border mx-2"}),c.jsx(Ce,{content:"Include code from other cells",children:c.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[c.jsx(g3,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:x,onCheckedChange:$=>g(!!$)}),c.jsx(fr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),c.jsx(ke,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:w,onClick:()=>{v(),i(),j("")},children:c.jsx(En,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=b,e[16]=i,e[17]=d,e[18]=C,e[19]=x,e[20]=y,e[21]=w,e[22]=j,e[23]=g,e[24]=N,e[25]=v,e[26]=M,e[27]=k):k=e[27],e[28]!==I||e[29]!==k?(B=c.jsx("div",{className:I,children:k}),e[28]=I,e[29]=k,e[30]=B):B=e[30],e[31]!==b||e[32]!==a||e[33]!==d||e[34]!==o||e[35]!==M?(E=b&&d&&c.jsxs(Lr,{className:"cm",theme:M,children:[c.jsx(f5,{onChange:o,value:a,extensions:Bx}),c.jsx(m5,{value:b,editable:!1,readOnly:!0,extensions:Bx})]}),e[31]=b,e[32]=a,e[33]=d,e[34]=o,e[35]=M,e[36]=E):E=e[36];const U=(!b||!d)&&u;let V;return e[37]!==B||e[38]!==E||e[39]!==U||e[40]!==R?(V=c.jsxs("div",{className:R,children:[B,E,U]}),e[37]=B,e[38]=E,e[39]=U,e[40]=R,e[41]=V):V=e[41],V};function g5(t){Xe({title:"Completion failed",description:m3(t)})}const al="application/x-marimo-cell",x5=dt({cells:DD(dt({code:st()})),version:mt("1.0")}),oa=yt(!1),ra=new WeakMap;function Ux(t){return{handle:e=>t(e),bulkHandle:e=>{let n=!0;try{for(const o of e)n=n&&t(o);return n}catch{return!1}}}}function Qn(t){return{handle:e=>t([e]),bulkHandle:e=>t(e)}}function $x(t,e){const n=H.c(29),{canMoveX:o,editorView:r,cellActionDropdownRef:s}=e,{saveOrNameNotebook:a}=cd(),i=St(Is),l=it(),d=Wk(),u=St(oa),h=Es(),f=Ie(PD),{copyCells:m,pasteAtCell:x}=function(){const L=it(),M=ze(async z=>{const D=mn(),I=z.map(k=>D.cellData[k]).filter(Boolean);if(I.length!==0)try{const k={cells:I.map(V=>({code:V.code})),version:"1.0"},B=I.map(V=>V.code).join(`
120
-
121
- `),E=new ClipboardItem({[al]:new Blob([JSON.stringify(k)],{type:al}),"text/plain":new Blob([B],{type:"text/plain"})});await navigator.clipboard.write([E]);const U=I.length===1?"Cell":`${I.length} cells`;Xe({title:`${U} copied`,description:`${U} ${I.length===1?"has":"have"} been copied to clipboard`})}catch(k){ft.error("Failed to copy cells to clipboard",k);try{const B=I.map(U=>U.code).join(`
122
-
123
- `);await navigator.clipboard.writeText(B);const E=I.length===1?"Cell":`${I.length} cells`;Xe({title:`${E} copied`,description:`${E} code ${I.length===1?"has":"have"} been copied to clipboard`})}catch{Xe({title:"Copy failed",description:"Failed to copy cells to clipboard",variant:"danger"})}}else Xe({title:"Error",description:"No cells found",variant:"danger"})}),R=ze(async(z,D)=>{const{before:I=!1}=D??{};try{const k=await navigator.clipboard.read();for(const E of k)if(E.types.includes(al)){const U=await E.getType(al),V=await U.text();try{const $=x5.parse(JSON.parse(V));if($.cells.length===0)break;const K=z;for(const X of $.cells)L.createNewCell({cellId:K,before:I,code:X.code,autoFocus:!1});return void $.cells.length}catch($){ft.warn("Failed to parse clipboard cell data",$)}}const B=await navigator.clipboard.readText();B.trim()?L.createNewCell({cellId:z,before:I,code:B,autoFocus:!0}):Xe({title:"Nothing to paste",description:"No cell or text found in clipboard",variant:"danger"})}catch(k){ft.error("Failed to paste from clipboard",k),Xe({title:"Paste failed",description:"Failed to read from clipboard",variant:"danger"})}});return{copyCells:M,pasteAtCell:R}}(),g=xi(),p=function(L){const M=H.c(2);let R,z;return M[0]!==L?(z=yt(D=>D(dd).selected.has(L)),M[0]=L,M[1]=z):z=M[1],R=z,Ie(R)}(t),b=Ms(),y=ui(),v=Ie(Ra);let w;n[0]!==b||n[1]!==g?(w={clear:()=>{b.clear(),g.clear()},extend:L=>{b.clear(),g.extend(L)},select:L=>{b.clear(),g.select(L)}},n[0]=b,n[1]=g,n[2]=w):w=n[2];const S=w,N=Ie(Gl);let C;n[3]!==N?(C=(L,M)=>Hf(N.getHotkey(L).key)(M.nativeEvent||M),n[3]=N,n[4]=C):C=n[4];const j=C,_=function(L){const M=H.c(11),R=b3(),z=it(),D=St(oa);let I,k,B;M[0]!==L||M[1]!==R?(I=()=>{R.focusCell({cellId:L})},M[0]=L,M[1]=R,M[2]=I):I=M[2],M[3]!==z||M[4]!==L||M[5]!==R||M[6]!==D?(k=()=>{D(!1),z.markTouched({cellId:L}),R.blurCell()},M[3]=z,M[4]=L,M[5]=R,M[6]=D,M[7]=k):k=M[7],M[8]!==I||M[9]!==k?(B={onFocusWithin:I,onBlurWithin:k},M[8]=I,M[9]=k,M[10]=B):B=M[10];const{focusWithinProps:E}=RD(B);return E}(t);let A;n[5]!==l||n[6]!==o||n[7]!==s||n[8]!==t||n[9]!==m||n[10]!==y||n[11]!==r||n[12]!==p||n[13]!==j||n[14]!==f||n[15]!==x||n[16]!==b||n[17]!==h||n[18]!==a||n[19]!==S||n[20]!==i||n[21]!==u||n[22]!==d||n[23]!==v?(A={onKeyDown:L=>{if(Dn.fromInput(L))return void L.continuePropagation();const M={"Mod+ArrowUp":()=>(l.focusTopCell(),S.clear(),!0),"Mod+ArrowDown":()=>(l.focusBottomCell(),S.clear(),!0),ArrowUp:()=>(l.focusCell({cellId:t,where:"before"}),S.clear(),!0),ArrowDown:()=>(l.focusCell({cellId:t,where:"after"}),S.clear(),!0),"Shift+ArrowUp":()=>{const D=d.get(Nc);S.extend({cellId:t,allCellIds:D});const I=D.findWithId(t).before(t);return I&&S.extend({cellId:I,allCellIds:D}),l.focusCell({cellId:t,where:"before"}),!0},"Shift+ArrowDown":()=>{const D=d.get(Nc);S.extend({cellId:t,allCellIds:D});const I=D.findWithId(t).after(t);return I&&S.extend({cellId:I,allCellIds:D}),l.focusCell({cellId:t,where:"after"}),!0},Escape:()=>!!p&&(S.clear(),!0),Enter:()=>(u(!0),v3(d,t),S.clear(),!0),s:()=>(a(),!0)};for(const[D,I]of Object.entries(M))if(Hf(D)(L)&&I())return void L.preventDefault();const R={"cell.run":Qn(D=>(h(D),!0)),"cell.runAndNewBelow":Qn(D=>{h(D);const I=D[D.length-1];return l.moveToNextCell({cellId:I,before:!1}),!0}),"cell.runAndNewAbove":Qn(D=>{h(D);const I=D[0];return l.moveToNextCell({cellId:I,before:!0}),!0}),"cell.createAbove":D=>(l.createNewCell({cellId:D,before:!0}),!0),"cell.createBelow":D=>(l.createNewCell({cellId:D,before:!1}),!0),"cell.moveUp":Qn(D=>{const I=D[0];return d.get(Pn).cellIds.findWithId(I).first()!==I&&(D.forEach(k=>{l.moveCell({cellId:k,before:!0})}),!0)}),"cell.moveDown":Qn(D=>{const I=D[D.length-1];return d.get(Pn).cellIds.findWithId(I).last()!==I&&([...D].reverse().forEach(k=>{l.moveCell({cellId:k,before:!1})}),!0)}),"cell.moveLeft":Ux(D=>!!o&&(l.moveCell({cellId:D,direction:"left"}),!0)),"cell.moveRight":Ux(D=>!!o&&(l.moveCell({cellId:D,direction:"right"}),!0)),"cell.hideCode":Qn(D=>{var k;const I=!D.map(B=>{var U;return((U=d.get(Pn).cellData[B])==null?void 0:U.config)||null}).every(b5);Vo({configs:Object.fromEntries(D.map(B=>[B,{hide_code:I}]))});for(const B of D)l.updateCellConfig({cellId:B,config:{hide_code:I}});if(D.length===1){const B=D[0];l.focusCell({cellId:B,where:"after"}),I?((k=r.current)==null||k.contentDOM.blur(),y3(B)):v3(d,B)}return!0}),"cell.focusDown":D=>(l.focusCell({cellId:D,where:"after"}),!0),"cell.focusUp":D=>(l.focusCell({cellId:D,where:"before"}),!0),"cell.sendToBottom":Qn(D=>(D.forEach(I=>{l.sendToBottom({cellId:I})}),!0)),"cell.sendToTop":Qn(D=>([...D].reverse().forEach(I=>{l.sendToTop({cellId:I})}),!0)),"cell.aiCompletion":D=>{var k;let I=!1;return i(B=>(B==null?void 0:B.cellId)===D?(I=!0,null):{cellId:D}),I&&((k=r.current)==null||k.focus()),!0},"cell.cellActions":()=>{var D;return(D=s.current)==null||D.toggle(),!0},"command.copyCell":Qn(D=>(m(D),!0)),"command.pasteCell":D=>(x(D),!0),"command.createCellBefore":D=>!Dn.hasModifier(L)&&(l.createNewCell({cellId:D,before:!0,autoFocus:!0}),!0),"command.createCellAfter":D=>!Dn.hasModifier(L)&&(l.createNewCell({cellId:D,before:!1,autoFocus:!0}),!0),"cell.delete":()=>{if(!v.keymap.destructive_delete)return!1;const D=z.size>=2?[...z]:[t],I=d.get(Pn);return!D.some(k=>{const{status:B}=I.cellRuntime[k];return B==="running"||B==="queued"})&&(b.idle?(b.submit(D),!0):(y({cellIds:D}),b.clear(),!0))}},z=function(D){return D.get(dd).selected}(d);if(f==="vim"&&function(D,I){const k=function($){if($.ctrlKey||$.metaKey||$.altKey)return"";const K=$.key.toLowerCase();return $.shiftKey?`shift+${K}`:K}(D),B=D.target;if(!k||!B)return!1;const E=ra.get(B);let U=k;E!=null&&E.timeout&&clearTimeout(E.timeout),E&&(U=`${E.sequence} ${k}`);const V=I[U];if(V)return ra.delete(B),V();if(!E){const $=I[k];if($)return $()}if(Object.keys(I).some($=>$.startsWith(`${U} `))){const $=window.setTimeout(()=>{ra.delete(B)},500);return ra.set(B,{sequence:U,timeout:$}),!0}return ra.delete(B),!1}(L.nativeEvent||L,{j:M.ArrowDown,k:M.ArrowUp,i:M.Enter,"shift+j":M["Shift+ArrowDown"],"shift+k":M["Shift+ArrowUp"],"g g":M["Mod+ArrowUp"],"shift+g":M["Mod+ArrowDown"],"d d":()=>R["cell.delete"](),"y y":()=>(m(z.size>=2?[...z]:[t]),!0),p:()=>(x(t,{before:!1}),!0),"shift+p":()=>(x(t,{before:!0}),!0),o:()=>(l.createNewCell({cellId:t,before:!1,autoFocus:!0}),!0),"shift+o":()=>(l.createNewCell({cellId:t,before:!0,autoFocus:!0}),!0),u:()=>(l.undoDeleteCell(),!0)}))L.preventDefault();else{for(const[D,I]of Object.entries(R))if(j(D,L)){if(I instanceof Function){if(I(t))return void L.preventDefault()}else if(z.size>=2?I.bulkHandle([...z]):I.handle(t))return void L.preventDefault();return}L.continuePropagation()}}},n[5]=l,n[6]=o,n[7]=s,n[8]=t,n[9]=m,n[10]=y,n[11]=r,n[12]=p,n[13]=j,n[14]=f,n[15]=x,n[16]=b,n[17]=h,n[18]=a,n[19]=S,n[20]=i,n[21]=u,n[22]=d,n[23]=v,n[24]=A):A=n[24];const{keyboardProps:T}=x3(A);let P;return n[25]!==_||n[26]!==p||n[27]!==T?(P=Of(_,T,{"data-selected":p,className:"data-[selected=true]:ring-1 data-[selected=true]:ring-[var(--blue-8)] data-[selected=true]:ring-offset-1"}),n[25]=_,n[26]=p,n[27]=T,n[28]=P):P=n[28],P}function b5(t){return t==null?void 0:t.hide_code}const y5=t=>{const e=H.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let a,i;e[0]!==o?(i=new Oa().isSupported(o)||o.trim()==="",e[0]=o,e[1]=i):i=e[1],a=i;const l=a;let d,u;e[2]!==o?(u=new vc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=u):u=e[3],d=u;const h=d&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx($o,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=c.jsx(vu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const x=l&&r==="python";let g,p,b,y,v;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx(Vl,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==x?(p=c.jsx(vu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:x,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=x,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Hl,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=c.jsx(vu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:Cn.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==p||e[21]!==y||e[22]!==m?(v=c.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,y]}),e[20]=p,e[21]=y,e[22]=m,e[23]=v):v=e[23],v},vu=t=>{const e=H.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:a,displayName:i,onAfterToggle:l}=t;let d;e[0]!==n||e[1]!==l||e[2]!==a?(d=()=>{n&&(hr(n,{language:a}),l())},e[0]=n,e[1]=l,e[2]=a,e[3]=d):d=e[3];const u=d;if(!r||o===a)return null;const h=`View as ${i}`;let f,m;return e[4]!==u||e[5]!==s?(f=c.jsx(ke,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:u,children:s}),e[4]=u,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=c.jsx(Ce,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},Vx=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:a,setEditorView:i,runCell:l,userConfig:d,editorViewRef:u,editorViewParentRef:h,hidden:f,hasOutput:m,showHiddenCode:x,languageAdapter:g,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var K;const[y,v]=Ot(Is),w=di(),{saveOrNameNotebook:S}=cd(),N=Ms(),C=s==="running"||s==="queued",j=it(),_=Rp(),A=g==="markdown",T=ze(()=>!C&&(N.idle&&d.keymap.destructive_delete?(N.submit([n]),!0):(w({cellId:n}),!0))),P=ze(()=>!C&&(l(),!0)),L=ze(()=>{const X=!o.hide_code;return Vo({configs:{[n]:{hide_code:X}}}),j.updateCellConfig({cellId:n,config:{hide_code:X}}),X}),M=Ie($l),R=ze(()=>{qn({autoInstantiate:M,createNewCell:j.createNewCell})}),z=LD(d),D=O.useMemo(()=>{const X=SE({cellId:n,showPlaceholder:e,enableAI:z,cellActions:{...j,afterToggleMarkdown:R,onRun:P,deleteCell:T,saveNotebook:S,createManyBelow:J=>{for(const ee of[...J].reverse())j.createNewCell({code:ee,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:_,toggleHideCode:L,aiCellCompletion:()=>{let J=!1;return v(ee=>(ee==null?void 0:ee.cellId)===n?(J=!0,null):{cellId:n}),J}},completionConfig:d.completion,keymapConfig:d.keymap,lspConfig:d.language_servers,theme:t,hotkeys:new w3(d.keymap.overrides??{}),diagnosticsConfig:d.diagnostics,displayConfig:d.display});return X.push(Rn.define(J=>{const ee=J.state.field(xc);return p(ee.type),{update(q){const Y=q.state.field(xc);p(Y.type)}}}),Ge.updateListener.of(J=>{J.selectionSet&&J.state.selection.ranges.some(ee=>ee.from!==ee.to)&&x({focus:!1})})),X},[n,d.keymap,d.completion,d.language_servers,d.display,d.diagnostics,z,t,e,j,_,L,T,P,v,R,p,x,S]),I=wc(),k=ze(()=>{if(I){const J=cu(n,0,r);D.push(J.extension),r=J.code}const X=new Ge({state:qa.create({doc:r,extensions:D})});i(X),I||hr(X,{language:xm(X.state).type})}),B=ze(()=>{if(wo(u.current!==null,"Editor view is not initialized"),I){const X=cu(n);D.push(X.extension)}u.current.dispatch({effects:[Tt.reconfigure.of([D]),FD(u.current,{completionConfig:d.completion,hotkeysProvider:new w3(d.keymap.overrides??{}),lspConfig:{...d.language_servers,diagnostics:d.diagnostics}})]})}),E=ze(()=>{if(wo(a,"Editor view is not initialized"),I){const J=cu(n,0,r);D.push(J.extension),r=J.code}const X=new Ge({state:qa.fromJSON(a,{doc:r,extensions:D},{history:zD})});I||hr(X,{language:xm(X.state).type}),i(X),j.clearSerializedEditorState({cellId:n})});O.useEffect(()=>{a===null?u.current===null?k():B():E(),u.current!==null&&h&&h.current!==null&&h.current.replaceChildren(u.current.dom)},[k,B,E,u,h,a,D]),O.useEffect(()=>{const X=u.current;return()=>{X==null||X.destroy()}},[u]);const U=function(X){const J=H.c(3),ee=St(oa);let q;J[0]!==X||J[1]!==ee?(q={onKeyDown:oe=>{oe.key==="Escape"&&(ee(!1),y3(X)),oe.continuePropagation()}},J[0]=X,J[1]=ee,J[2]=q):q=J[2];const{keyboardProps:Y}=x3(q);return Y}(n),V=f&&!A||f&&A&&!m;let $="";return A&&f&&m?$="h-0 overflow-hidden":f&&($="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden"),c.jsx(p5,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((K=u.current)==null?void 0:K.state.doc.toString())??r,currentLanguageAdapter:g,declineChange:ze(()=>{var X;v(null),(X=u.current)==null||X.focus()}),onChange:ze(X=>{var J;(J=u.current)==null||J.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:X}})}),acceptChange:ze(X=>{var J,ee;(J=u.current)==null||J.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:X}}),(ee=u.current)==null||ee.focus(),v(null)}),children:c.jsxs("div",{className:"relative w-full",...U,children:[V&&c.jsx(k3,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:x}),c.jsx(Hx,{className:$,editorView:u.current,ref:h}),!f&&b&&c.jsx("div",{className:"absolute top-1 right-5",children:c.jsx(y5,{code:r,editorView:u.current,currentLanguageAdapter:g,onAfterToggle:R})})]})})},Hx=G.forwardRef((t,e)=>{const n=H.c(10),{className:o,editorView:r}=t,s=O.useRef(null);let a,i,l,d,u;return n[0]!==r?(a=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},i=[r,s],n[0]=r,n[1]=a,n[2]=i):(a=n[1],i=n[2]),O.useEffect(a,i),n[3]!==o?(l=me("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(d=h=>{e?el(e,s)(h):el(s)(h)},n[5]=e,n[6]=d):d=n[6],n[7]!==l||n[8]!==d?(u=c.jsx("div",{className:l,ref:d,"data-testid":"cell-editor"}),n[7]=l,n[8]=d,n[9]=u):u=n[9],u});Hx.displayName="CellCodeMirrorEditor";const wu=wc()?function(t){const e=n=>{const o=H.c(5),r=Ie(Yn),[s,a]=Ot(Or);if(r.state===Ut.CONNECTING||s===void 0){let l,d;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==a?(d=c.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:c.jsxs(Cc,{milliseconds:1e3,fallback:null,children:[l,c.jsx(ke,{variant:"link",onClick:()=>{a("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=a,o[2]=d):d=o[2],d}let i;return o[3]!==n?(i=c.jsx(t,{...n}),o[3]=n,o[4]=i):i=o[4],i};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(O.memo(Vx)):O.memo(Vx),v5=t=>{const e=H.c(10);let n,o,r,s;return e[0]!==t.left?(n=c.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=c.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=c.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=c.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},w5=t=>{const e=H.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=c.jsx("span",{children:c.jsx(k5,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=c.jsx(Ce,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=c.jsx(ke,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},k5=t=>{const e=H.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?c.jsx(Ta,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(vo,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},Wx=O.memo(t=>{const e=H.c(24),{onClick:n,count:o,cellId:r}=t,s=ms();let a;e[0]!==r||e[1]!==s?(a=BD(s,r),e[0]=r,e[1]=s,e[2]=a):a=e[2];const i=a;let l,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=me("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(UD,{className:"w-4 h-4 flex-shrink-0"}),e[4]=d):d=e[4];const u=o===1?"cell":"cells";let h,f,m,x,g,p,b;return e[5]!==o||e[6]!==u?(h=c.jsxs(c.Fragment,{children:[d,c.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",u," collapsed"]})]}),e[5]=o,e[6]=u,e[7]=h):h=e[7],e[8]!==i.errored?(f=i.errored&&c.jsx(Ce,{content:"Has errors",delayDuration:100,children:c.jsx(hp,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=i.errored,e[9]=f):f=e[9],e[10]!==i.stale?(m=i.stale&&c.jsx(Ce,{content:"Has stale cells",delayDuration:100,children:c.jsx(S3,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=i.stale,e[11]=m):m=e[11],e[12]!==i.runningOrQueued?(x=i.runningOrQueued&&c.jsx(Ce,{content:"Running",delayDuration:100,children:c.jsx(Sc,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=i.runningOrQueued,e[13]=x):x=e[13],e[14]!==f||e[15]!==m||e[16]!==x?(g=c.jsxs(c.Fragment,{children:[f,m,x]}),e[14]=f,e[15]=m,e[16]=x,e[17]=g):g=e[17],e[18]!==h||e[19]!==g?(p=c.jsx(v5,{center:h,right:g}),e[18]=h,e[19]=g,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=c.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});Wx.displayName="CollapsedCellBanner";const qx=t=>{const e=H.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let a,i,l,d,u,h,f,m,x,g,p,b,y,v;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const w=Kn(o);let S;if(w){let N;e[14]!==o?(N=lc(o),e[14]=o,e[15]=N):N=e[15],S=N}else S=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";i=Ce,x=S,g=!1,a=ke,l="ghost",d="icon",u=r,h="delete-button",f=Dn.preventFocus,m=me("hover:bg-transparent text-destructive/60 hover:text-destructive",(w||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=a,e[5]=i,e[6]=l,e[7]=d,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=x,e[13]=g}else a=e[4],i=e[5],l=e[6],d=e[7],u=e[8],h=e[9],f=e[10],m=e[11],x=e[12],g=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=c.jsx(ql,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==a||e[19]!==l||e[20]!==d||e[21]!==u||e[22]!==h||e[23]!==f||e[24]!==m?(y=c.jsx(a,{variant:l,size:d,onClick:u,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=a,e[19]=l,e[20]=d,e[21]=u,e[22]=h,e[23]=f,e[24]=m,e[25]=y):y=e[25],e[26]!==i||e[27]!==y||e[28]!==x||e[29]!==g?(v=c.jsx(i,{content:x,usePortal:g,children:y}),e[26]=i,e[27]=y,e[28]=x,e[29]=g,e[30]=v):v=e[30],v},S5=t=>{const e=H.c(22),{cellId:n}=t,o=function(b){const y=H.c(22),[v,w]=Ot(kg),S=di(),N=ui();let C;y[0]!==b||y[1]!==v?(C=v.get(b),y[0]=b,y[1]=v,y[2]=C):C=y[2];const j=C;let _,A,T,P,L;if(y[3]!==S||y[4]!==N||y[5]!==w||y[6]!==v?(_=()=>{if(v.size===0)return;const M=[...v.values()];M.every(VC)&&(v.size===1?S({cellId:M[0].cellId}):N({cellIds:M.map($C)}),w(new Map))},A=[v,S,N,w],y[3]=S,y[4]=N,y[5]=w,y[6]=v,y[7]=_,y[8]=A):(_=y[7],A=y[8]),O.useEffect(_,A),!j){let M;return y[9]===Symbol.for("react.memo_cache_sentinel")?(M={isPending:!1},y[9]=M):M=y[9],M}if(v.size!==1){let M;return y[10]!==j?(M={isPending:!0,shouldConfirmDelete:!1,...j},y[10]=j,y[11]=M):M=y[11],M}return y[12]!==N||y[13]!==w||y[14]!==v?(T=()=>{N({cellIds:[...v.values()].map(UC)}),w(new Map)},y[12]=N,y[13]=w,y[14]=v,y[15]=T):T=y[15],y[16]!==w?(P=()=>w(new Map),y[16]=w,y[17]=P):P=y[17],y[18]!==j||y[19]!==T||y[20]!==P?(L={isPending:!0,...j,shouldConfirmDelete:!0,confirm:T,cancel:P},y[18]=j,y[19]=T,y[20]=P,y[21]=L):L=y[21],L}(n);if(!o.isPending)return null;if(o.type==="simple"){let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=me("px-3 py-1.5","bg-[var(--amber-2)] border-t border-[var(--amber-6)]","animate-in slide-in-from-top-2 duration-200"),e[0]=b):b=e[0];const y=`pending-delete-${n}`;let v,w;return e[1]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sm,{className:"w-3 h-3 text-[var(--amber-11)] flex-shrink-0"}),c.jsx("span",{className:"text-[var(--amber-11)] text-xs",children:"Pending deletion"})]}),e[1]=v):v=e[1],e[2]!==y?(w=c.jsx("div",{className:b,"data-testid":y,children:v}),e[2]=y,e[3]=w):w=e[3],w}const r=o.executionDurationMs!==void 0,s=o.defs.size>0,a=Cs(o.executionDurationMs??0);let i,l="Pending deletion";r&&s?l=`This cell took ${a} to run and contains variables referenced by other cells.`:r?l=`This cell took ${a} to run.`:s&&(l="This cell contains variables referenced by other cells."),e[4]===Symbol.for("react.memo_cache_sentinel")?(i=me("px-4 py-3","bg-[var(--amber-2)] border-t border-[var(--amber-6)]","animate-in slide-in-from-top-2 duration-200"),e[4]=i):i=e[4];const d=`pending-delete-${n}`;let u,h,f,m,x,g,p;return e[5]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(sm,{className:"w-4 h-4 text-[var(--amber-11)] mt-0.5 flex-shrink-0"}),e[5]=u):u=e[5],e[6]!==l?(h=c.jsx("p",{className:"text-[var(--amber-11)] font-medium",children:l}),e[6]=l,e[7]=h):h=e[7],e[8]!==s||e[9]!==o.defs?(f=s&&[...o.defs.entries()].map(C5),e[8]=s,e[9]=o.defs,e[10]=f):f=e[10],e[11]!==h||e[12]!==f?(m=c.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13],e[14]!==o?(x=o.shouldConfirmDelete&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-[var(--amber-11)] mt-2 mb-3",children:"Are you sure you want to delete?"}),c.jsx(om,{autoFocus:!0,children:c.jsxs("div",{className:"flex items-center gap-2",onKeyDown:j5,children:[c.jsx(ke,{size:"xs",variant:"ghost",onClick:()=>o.cancel(),className:"text-[var(--amber-11)] hover:bg-[var(--amber-4)] hover:text-[var(--amber-11)]",children:"Cancel"}),c.jsx(ke,{size:"xs",variant:"secondary",onClick:()=>o.confirm(),className:"bg-[var(--amber-11)] hover:bg-[var(--amber-12)] text-white border-[var(--amber-11)]",children:"Delete"})]})})]}),e[14]=o,e[15]=x):x=e[15],e[16]!==m||e[17]!==x?(g=c.jsxs("div",{className:"flex items-start gap-3",children:[u,c.jsxs("div",{className:"flex-1",children:[m,x]})]}),e[16]=m,e[17]=x,e[18]=g):g=e[18],e[19]!==d||e[20]!==g?(p=c.jsx("div",{className:i,"data-testid":d,children:g}),e[19]=d,e[20]=g,e[21]=p):p=e[21],p};function N5(t){return c.jsx("li",{className:"my-0.5 ml-8 text-[var(--amber-11)]/60",children:c.jsx(Co,{cellId:t})},t)}function C5(t){const[e,n]=t;return c.jsxs("div",{children:[c.jsxs("p",{className:"text-[var(--amber-11)] mt-2",children:["'",c.jsx("span",{className:"font-mono",children:e}),"' is referenced by:"]}),c.jsx("ul",{className:"list-disc",children:n.map(N5)})]},e)}function j5(t){t.stopPropagation()}const E5=t=>{const e=H.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:a,edited:i}=t,l=s==="disabled-transitively",d=s==="running"||s==="queued";let u,h;e[0]!==l||e[1]!==a.disabled||e[2]!==o||e[3]!==i||e[4]!==d||e[5]!==r?(u=Kn(o)||d||!a.disabled&&l&&!i,h=function({connectionState:p,needsRun:b,loading:y,inactive:v}){return Kn(p)?"disabled":b&&!y?"stale":y||v?"disabled":"green"}({connectionState:o,needsRun:r,loading:d,inactive:u}),e[0]=l,e[1]=a.disabled,e[2]=o,e[3]=i,e[4]=d,e[5]=r,e[6]=u,e[7]=h):(u=e[6],h=e[7]);const f=h;if(a.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(tp,{}),e[8]=p):p=e[8],e[9]!==u||e[10]!==n||e[11]!==f?(b=c.jsx(Ls,{tooltip:"Add code to notebook",disabled:u,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=u,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!a.disabled&&l&&!i){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(kr,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==u||e[15]!==n||e[16]!==f?(b=c.jsx(Ls,{disabled:u,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=u,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,x,g;if(Kn(o)){let p;e[18]!==o?(p=lc(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=Wt("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(kr,{strokeWidth:1.2}),e[21]=x):x=e[21],e[22]!==u||e[23]!==n||e[24]!==m||e[25]!==f?(g=c.jsx(Ls,{tooltip:m,disabled:u,onClick:n,variant:f,"data-testid":"run-button",children:x}),e[22]=u,e[23]=n,e[24]=m,e[25]=f,e[26]=g):g=e[26],g},Gx=G.createContext(null),Yx=O.memo(()=>O.use(Gx));Yx.displayName="DragHandle";const Kx=G.forwardRef((t,e)=>{const n=H.c(21);let o,r,s,a,i;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(a=r.toString(),n[4]=r,n[5]=a):a=n[5],n[6]!==a?(i={id:a},n[6]=a,n[7]=i):i=n[7];const{attributes:l,listeners:d,setNodeRef:u,transform:h,transition:f,isDragging:m}=n1(i);let x;n[8]!==h?(x=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=x):x=n[9];const g=x,p=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==d||n[15]!==s||n[16]!==e||n[17]!==u||n[18]!==g||n[19]!==p?(b=c.jsx(Xx,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:d,setNodeRef:u,transform:g,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=d,n[15]=s,n[16]=e,n[17]=u,n[18]=g,n[19]=p,n[20]=b):b=n[20],b});Kx.displayName="SortableCell";const Xx=G.forwardRef((t,e)=>{const n=H.c(37);let o,r,s,a,i,l,d,u,h,f;if(n[0]!==t){const{cellId:_,canMoveX:A,children:T,attributes:P,listeners:L,setNodeRef:M,transform:R,transition:z,isDragging:D,...I}=t;r=A,s=T,o=P,i=L,d=M,u=R,h=z,a=D,l=I,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=i,n[6]=l,n[7]=d,n[8]=u,n[9]=h}else o=n[1],r=n[2],s=n[3],a=n[4],i=n[5],l=n[6],d=n[7],u=n[8],h=n[9];n[10]!==r||n[11]!==u?(f=u?fc.Transform.toString({x:r?u.x:0,y:u.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=u,n[12]=f):f=n[12];const m=a?2:void 0;let x;n[13]!==f||n[14]!==m||n[15]!==h?(x={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=x):x=n[16];const g=x;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(ep,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==i?(b=c.jsx("div",{...o,...i,onMouseDown:Dn.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=i,n[20]=b):b=n[20];const y=b,v=!!u;let w;n[21]!==e||n[22]!==d?(w=_=>{el(e,d)(_)},n[21]=e,n[22]=d,n[23]=w):w=n[23];const S=v&&"is-moving";let N,C,j;return n[24]!==l.className||n[25]!==S?(N=me(l.className,S,"outline-none rounded-lg"),n[24]=l.className,n[25]=S,n[26]=N):N=n[26],n[27]!==s||n[28]!==y?(C=c.jsx(Gx.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=C):C=n[29],n[30]!==a||n[31]!==l||n[32]!==g||n[33]!==w||n[34]!==N||n[35]!==C?(j=c.jsx("div",{tabIndex:-1,ref:w,...l,"data-is-dragging":a,className:N,style:g,children:C}),n[30]=a,n[31]=l,n[32]=g,n[33]=w,n[34]=N,n[35]=C,n[36]=j):j=n[36],j});function Jx(t,e){const n=H.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||Lf(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=ze(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&Va(e.current.state)==="active"){for(const d of n3)if(l.key===d.key&&d.run){d.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const a=ze(s);let i;return n[6]!==r||n[7]!==a?(i={closeCompletionHandler:r,resumeCompletionHandler:a},n[6]=r,n[7]=a,n[8]=i):i=n[8],i}Xx.displayName="SortableCellInternal";const Zx=O.forwardRef((t,e)=>{const n=H.c(13),{id:o,output:r,interrupted:s,errored:a,stopped:i,name:l,outputStale:d,outputLoading:u}=t;let h;n[0]===Symbol.for("react.memo_cache_sentinel")?(h=jc("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=h):h=n[0];const f=h,m=j3(r==null?void 0:r.mimetype);if(a||s||i||m)return null;let x,g,p;return n[1]!==o||n[2]!==l?(x=Rm(o,l),n[1]=o,n[2]=l,n[3]=x):x=n[3],n[4]!==o||n[5]!==r||n[6]!==u||n[7]!==d?(g=c.jsx(Ec,{allowExpand:!1,forceExpand:!0,output:r,className:"output-area",cellId:o,stale:d,loading:u}),n[4]=o,n[5]=r,n[6]=u,n[7]=d,n[8]=g):g=n[8],n[9]!==e||n[10]!==x||n[11]!==g?(p=c.jsx("div",{tabIndex:-1,ref:e,className:f,...x,children:g}),n[9]=e,n[10]=x,n[11]=g,n[12]=p):p=n[12],p});Zx.displayName="ReadonlyCellComponent";const _5=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:a,runStartTimestamp:i,lastRunStartTimestamp:l,runElapsedTimeMs:d,edited:u,interrupted:h,errored:f,stopped:m,staleInputs:x,serializedEditorState:g,serialization:p,debuggerActive:b,connectionState:y,canDelete:v,actions:w,deleteCell:S,userConfig:N,outline:C,isCollapsed:j,collapseCount:_,config:A,canMoveX:T,name:P,editorView:L,setEditorView:M,outputStale:R})=>{const z=O.useRef(null),D=O.useRef(null),I=O.useRef(null),k=O.useRef(null),B=St(Is),E=Jc(n),[U,V]=O.useState(),$=A.disabled||a==="disabled-transitively",K=E3({executionTime:d,status:a,errored:f,interrupted:h,stopped:m}),X=u||h||x&&!$,J=N3(a),ee=(a==="queued"||u||x)&&!h,q=O.useCallback(()=>L.current,[L]),{closeCompletionHandler:Y,resumeCompletionHandler:oe}=Jx(z,L),{isCellCodeShown:se,isMarkdown:re,isMarkdownCodeHidden:ae,showHiddenCode:te,showHiddenCodeIfMarkdown:be}=function(W){const ne=H.c(15),{cellId:ue,cellConfig:de,languageAdapter:ge,editorView:Me}=W,[Re,He]=Ot(oa);let le,Ne;ne[0]!==ue?(Ne=WD(ue),ne[0]=ue,ne[1]=Ne):Ne=ne[1],le=Ne;const je=Ie(le),Le=!de.hide_code||Re||je,Ve=ge==="markdown",Ae=Ve&&!Le;let Ue;ne[2]!==Me||ne[3]!==Le||ne[4]!==He?(Ue=It=>{var Bt;if(Le)return;const Jt=(It==null?void 0:It.focus)??!0;He(!0),Jt&&((Bt=Me.current)==null||Bt.focus())},ne[2]=Me,ne[3]=Le,ne[4]=He,ne[5]=Ue):Ue=ne[5];const Je=ze(Ue);let We;ne[6]!==Ae||ne[7]!==Je?(We=()=>{Ae&&Je({focus:!0})},ne[6]=Ae,ne[7]=Je,ne[8]=We):We=ne[8];const nt=ze(We);let bt;return ne[9]!==Le||ne[10]!==Ve||ne[11]!==Ae||ne[12]!==Je||ne[13]!==nt?(bt={isCellCodeShown:Le,isMarkdown:Ve,isMarkdownCodeHidden:Ae,showHiddenCode:Je,showHiddenCodeIfMarkdown:nt},ne[9]=Le,ne[10]=Ve,ne[11]=Ae,ne[12]=Je,ne[13]=nt,ne[14]=bt):bt=ne[14],bt}({cellId:n,cellConfig:A,languageAdapter:U,editorView:L}),ye=$x(n,{canMoveX:T,editorView:L,cellActionDropdownRef:D}),ie=HD(C),ve=!C3(r),he=s.length>0,Se=N.display.cell_output,De=ve&&Se==="above",_e=ve&&Se==="below",[Fe,Oe]=O.useState(!1),[Qe,qe]=O.useState(!1);(function(W){const{ref:ne,box:ue="content-box",skip:de}=W,ge=O.useRef({...CE}),Me=O.useRef(void 0);Me.current=W.onResize,O.useEffect(()=>{if(!ne.current||de||typeof window>"u"||!("ResizeObserver"in window))return;const Re=new ResizeObserver(([He])=>{const le=ue==="border-box"?"borderBoxSize":ue==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ne=g0(He,le,"inlineSize"),je=g0(He,le,"blockSize");if(ge.current.width!==Ne||ge.current.height!==je){const Le={width:Ne,height:je};ge.current.width=Ne,ge.current.height=je,Me.current&&Me.current(Le)}});return Re.observe(ne.current,{box:ue}),()=>{Re.disconnect()}},[ue,ne,de])})({ref:k,skip:!re,onResize:W=>{const ne=W.height&&W.height<68,ue=ae&&(ne||Se==="below");Oe(ue),ie&&ue?qe(!0):Qe&&qe(!1)}});const Ke=W=>c.jsx(k3,{tooltip:"Edit markdown",className:me("z-20 relative",W),onClick:te}),Q=ve&&c.jsxs("div",{className:"relative",onDoubleClick:be,children:[c.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:c.jsx(w5,{isCollapsed:j,onClick:()=>{j?w.expandCell({cellId:n}):w.collapseCell({cellId:n})},canCollapse:ie})}),ae&&_e&&Ke("top-3"),c.jsx(Ec,{allowExpand:!0,forceExpand:ae,output:r,className:"output-area",cellId:n,stale:R,loading:J}),ae&&De&&Ke("bottom-3")]}),xe=jc("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":X,"has-error":f,stopped:m,disabled:A.disabled,stale:a==="disabled-transitively",borderless:ae&&ve&&!ye["data-selected"]}),we=ze(W=>{B({cellId:n,initialPrompt:W.prompt})}),Te=!(!p||p.toLowerCase()!=="valid");return c.jsx(vm,{children:c.jsx(Z0,{cellId:n,config:A,status:a,getEditorView:q,hasOutput:ve,hasConsoleOutput:he,name:P,children:c.jsxs(Kx,{tabIndex:-1,ref:z,"data-status":a,onBlur:Y,onKeyDown:oe,cellId:n,canMoveX:T,title:A.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[c.jsxs("div",{tabIndex:-1,...ye,className:me(xe,ye.className,"focus:ring-1 focus:ring-[var(--blue-7)] focus:ring-offset-0"),ref:k,...Rm(n,P),children:[Se==="above"&&Q,c.jsxs("div",{className:me("tray"),"data-hidden":ae,children:[c.jsx("div",{className:"absolute right-2 -top-4 z-10",children:c.jsx(eb,{edited:u,connectionState:y,status:a,cellConfig:A,needsRun:X,hasOutput:ve,hasConsoleOutput:he,cellActionDropdownRef:D,cellId:n,name:P,getEditorView:q,onRun:E})}),c.jsx(I5,{cellId:n,className:me(ae&&De&&"-top-7",ae&&_e&&"-bottom-8",ae&&Qe&&"-left-[3.8rem]"),connectionState:y,actions:w}),c.jsx(wu,{theme:t,showPlaceholder:e,id:n,code:o,config:A,status:a,serializedEditorState:g,runCell:E,setEditorView:M,userConfig:N,editorViewRef:L,editorViewParentRef:I,hidden:!se,hasOutput:ve,showHiddenCode:te,languageAdapter:U,setLanguageAdapter:V}),c.jsx(Qx,{className:me(ae&&Se==="below"&&"top-14"),edited:u,status:a,isCellStatusInline:Fe,uninstantiated:K,disabled:A.disabled,runElapsedTimeMs:d,runStartTimestamp:i,lastRunStartTimestamp:l,staleInputs:x,interrupted:h}),c.jsx("div",{className:"shoulder-bottom hover-action",children:v&&se&&c.jsx(qx,{connectionState:y,status:a,onClick:()=>{J||Kn(y)||S({cellId:n})}})})]}),Se==="below"&&Q,p&&c.jsxs("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",rel:"noopener",children:[Te&&c.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),c.jsx(Ce,{content:c.jsx("span",{className:"max-w-16 text-xs",children:Te?"This function or class can be imported into other Python notebooks or modules.":c.jsxs(c.Fragment,{children:["This definition can't be reused in other Python modules:",c.jsx("br",{}),c.jsx("br",{}),c.jsx("pre",{children:p}),c.jsx("br",{}),"Click this icon to learn more."]})}),children:Te&&c.jsx(Ll,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||c.jsx(wm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),c.jsx(Lm,{consoleOutputs:s,stale:ee,cellName:p?"_":P,onRefactorWithAI:we,onClear:()=>{w.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(W,ne)=>{w.setStdinResponse({cellId:n,response:W,outputIndex:ne}),_3({text:W})},cellId:n,debuggerActive:b}),c.jsx(S5,{cellId:n})]}),j&&c.jsx(Wx,{onClick:()=>w.expandCell({cellId:n}),count:_,cellId:n})]})})})},Qx=t=>{const e=H.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:a,lastRunStartTimestamp:i,runElapsedTimeMs:l,runStartTimestamp:d,staleInputs:u,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let x;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==l||e[5]!==d||e[6]!==u||e[7]!==h||e[8]!==f?(x=c.jsx(y0,{status:h,staleInputs:u,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:d,uninstantiated:f,lastRunStartTimestamp:i}),e[0]=m,e[1]=r,e[2]=s,e[3]=i,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=x):x=e[9];const g=x;let p;e[10]!==n?(p=me("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!a&&g;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(Yx,{}),e[12]=y):y=e[12];const v=a&&g;let w,S;return e[13]!==v?(w=c.jsxs("div",{className:"flex gap-2 items-end",children:[y,v]}),e[13]=v,e[14]=w):w=e[14],e[15]!==p||e[16]!==b||e[17]!==w?(S=c.jsxs("div",{className:p,children:[b,w]}),e[15]=p,e[16]=b,e[17]=w,e[18]=S):S=e[18],S},I5=t=>{const e=H.c(21),{className:n,connectionState:o,actions:r,cellId:s}=t;let a;e[0]!==r||e[1]!==s?(a=w=>{const S=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!1,...S})},e[0]=r,e[1]=s,e[2]=a):a=e[2];const i=ze(a);let l;e[3]!==r||e[4]!==s?(l=w=>{const S=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!0,...S})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const d=ze(l),u=I3(o);let h,f;e[6]!==n?(h=me("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=Wt("cell.createAbove"),e[8]=f):f=e[8];const m=u?d:void 0;let x,g,p;e[9]!==o||e[10]!==m?(x=c.jsx(K0,{tooltipContent:f,connectionState:o,onClick:m}),e[9]=o,e[10]=m,e[11]=x):x=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("div",{className:"flex-1"}),e[12]=g):g=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=Wt("cell.createBelow"),e[13]=p):p=e[13];const b=u?i:void 0;let y,v;return e[14]!==o||e[15]!==b?(y=c.jsx(K0,{tooltipContent:p,connectionState:o,onClick:b}),e[14]=o,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==x||e[19]!==y?(v=c.jsxs("div",{className:h,children:[x,g,y]}),e[17]=h,e[18]=x,e[19]=y,e[20]=v):v=e[20],v},eb=t=>{const e=H.c(27),{edited:n,connectionState:o,status:r,cellConfig:s,needsRun:a,hasOutput:i,hasConsoleOutput:l,onRun:d,cellActionDropdownRef:u,cellId:h,getEditorView:f,name:m,includeCellActions:x}=t,g=x===void 0||x,p=I3(o),b=!a&&"hover-action";let y;e[0]!==b?(y=me(b),e[0]=b,e[1]=y):y=e[1];const v=p?d:Cn.NOOP;let w,S,N,C;return e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==a||e[6]!==r||e[7]!==v?(w=c.jsx(E5,{edited:n,onClick:v,connectionState:o,status:r,config:s,needsRun:a}),e[2]=s,e[3]=o,e[4]=n,e[5]=a,e[6]=r,e[7]=v,e[8]=w):w=e[8],e[9]!==o||e[10]!==r?(S=c.jsx(Xj,{status:r,connectionState:o}),e[9]=o,e[10]=r,e[11]=S):S=e[11],e[12]!==u||e[13]!==s||e[14]!==h||e[15]!==f||e[16]!==l||e[17]!==i||e[18]!==g||e[19]!==m||e[20]!==r?(N=g&&c.jsx(X0,{ref:u,cellId:h,status:r,getEditorView:f,name:m,config:s,hasOutput:i,hasConsoleOutput:l,children:c.jsx(Ls,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:c.jsx(Pm,{strokeWidth:1.5})})}),e[12]=u,e[13]=s,e[14]=h,e[15]=f,e[16]=l,e[17]=i,e[18]=g,e[19]=m,e[20]=r,e[21]=N):N=e[21],e[22]!==y||e[23]!==w||e[24]!==S||e[25]!==N?(C=c.jsxs(Kj,{className:y,children:[w,S,N]}),e[22]=y,e[23]=w,e[24]=S,e[25]=N,e[26]=C):C=e[26],C},T5=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:a,runStartTimestamp:i,lastRunStartTimestamp:l,runElapsedTimeMs:d,edited:u,interrupted:h,errored:f,stopped:m,staleInputs:x,serializedEditorState:g,debuggerActive:p,connectionState:b,canDelete:y,actions:v,deleteCell:w,userConfig:S,config:N,canMoveX:C,name:j,editorView:_,setEditorView:A})=>{const T=O.useRef(null),P=O.useRef(null),L=O.useRef(null),M=St(Is),R=Jc(n),z=N.disabled||a==="disabled-transitively",D=E3({executionTime:d,status:a,errored:f,interrupted:h,stopped:m}),I=u||h||x&&!z,k=a==="running"||a==="queued",B=(a==="queued"||u||x)&&!h,E=O.useCallback(()=>_.current,[_]),{closeCompletionHandler:U,resumeCompletionHandler:V}=Jx(T,_),$=$x(n,{canMoveX:C,editorView:_,cellActionDropdownRef:P}),K=!C3(r),X=s.length>0,J=j3(r==null?void 0:r.mimetype),ee=jc("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":I,"has-error":f,stopped:m}),q=ze(Y=>{M({cellId:n,initialPrompt:Y.prompt})});return c.jsx(vm,{children:c.jsx(Z0,{cellId:n,config:N,status:a,getEditorView:E,hasOutput:K,hasConsoleOutput:X,name:j,children:c.jsxs("div",{"data-status":a,ref:T,...Of($,{className:ee,onBlur:U,onKeyDown:V}),...Rm(n,j),title:N.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-setup-cell":!0,children:[c.jsxs("div",{className:me("tray"),"data-hidden":!1,children:[c.jsx("div",{className:"absolute right-2 -top-4 z-10",children:c.jsx(eb,{edited:u,connectionState:b,status:a,cellConfig:N,needsRun:I,hasOutput:K,hasConsoleOutput:X,cellActionDropdownRef:P,cellId:n,name:j,getEditorView:E,onRun:R,includeCellActions:!1})}),c.jsx(wu,{theme:t,showPlaceholder:e,id:n,code:o,config:N,status:a,serializedEditorState:g,runCell:R,setEditorView:A,userConfig:S,editorViewRef:_,editorViewParentRef:L,hidden:!1,hasOutput:K,showHiddenCode:Cn.NOOP,languageAdapter:"python",setLanguageAdapter:Cn.NOOP,showLanguageToggles:!1}),c.jsx(Qx,{edited:u,status:a,isCellStatusInline:!1,uninstantiated:D,disabled:N.disabled,runElapsedTimeMs:d,runStartTimestamp:i,lastRunStartTimestamp:l,staleInputs:x,interrupted:h}),c.jsx("div",{className:"shoulder-bottom hover-action",children:y&&c.jsx(qx,{connectionState:b,status:a,onClick:()=>{k||Kn(b)||w({cellId:n})}})})]}),c.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[c.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),c.jsx(Ce,{content:c.jsxs("span",{className:"max-w-16",children:["This ",c.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",c.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:c.jsx(wm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),J&&c.jsx(Ec,{allowExpand:!0,forceExpand:!0,output:r,className:"output-area",cellId:n,stale:!1,loading:k}),c.jsx(Lm,{consoleOutputs:s,stale:B,cellName:"_",onRefactorWithAI:q,onClear:()=>{v.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(Y,oe)=>{v.setStdinResponse({cellId:n,response:Y,outputIndex:oe}),_3({text:Y})},cellId:n,debuggerActive:p})]})})})},tb=O.memo(O.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:a,edited:i,id:l,mode:d}=t;ft.debug("Rendering Cell",l);const u=O.useRef(null);O.useImperativeHandle(e,()=>({get editorView(){return function(m){const x=m.current;if(x===null)throw new ReferenceError("Attempting to dereference null object.");return x}(u)},get editorViewOrNull(){return u.current}}),[u]);const h=$D({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:a},i),f=N3(n);return l===jo?c.jsx(T5,{...t,editorView:u,setEditorView:m=>{u.current=m},outputStale:h}):d==="edit"?c.jsx(VD,{atoms:[oa],children:c.jsx(_5,{...t,editorView:u,setEditorView:m=>{u.current=m},outputStale:h})}):c.jsx(Zx,{...t,outputStale:h,outputLoading:f})})),A5=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=a=>{const i=a.match(r);if(!i)return null;const[,l,d,u,h]=i;return{major:Number.parseInt(l,10),minor:Number.parseInt(d,10),patch:Number.parseInt(u,10),preRelease:h||""}};try{const a=s(n),i=s(o);return a&&i?a.major!==i.major?a.major-i.major:a.minor!==i.minor?a.minor-i.minor:a.patch!==i.patch?a.patch-i.patch:a.preRelease===""&&i.preRelease!==""?1:a.preRelease!==""&&i.preRelease===""?-1:a.preRelease.localeCompare(i.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),nb=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),M5=dt({info:dt({provides_extra:st().array().nullable()}),releases:qD(st(),GD())});function ob(t){const e=H.c(5);let n;e[0]!==t?(n=function(a){return a.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const a=nb.get(o);if(a)return a;const i=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);const l=M5.transform(O5).parse(await i.json());return nb.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),jn(r,s)}function O5(t){return{versions:Object.keys(t.releases).toSorted(A5),extras:t.info.provides_extra??[]}}function rb(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const D5=()=>{const t=H.c(70),{packageAlert:e}=rL(),{clearPackageAlert:n}=sL(),[o]=mr();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,a]=O.useState(r);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={},t[1]=i):i=t[1];const[l,d]=O.useState(i);if(e===null)return null;const u=o.package_management.manager!=="pixi";if(aL(e)){let h,f,m,x,g,p,b,y,v,w;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[c.jsx(Wc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(En,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(x=c.jsxs("div",{className:"flex justify-between",children:[h,c.jsx(ke,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=x):x=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("p",{children:"The following packages were not found:"}),t[9]=g):g=t[9],t[10]!==s||t[11]!==u||t[12]!==e.packages||t[13]!==l){let S;t[15]!==s||t[16]!==u||t[17]!==l?(S=(N,C)=>{const j=rb(N),_=l[N]||j.extras;return c.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[c.jsx(Ss,{size:"1rem"}),c.jsx(F5,{packageName:j.name,selectedExtras:_,onExtrasChange:A=>d(T=>({...T,[N]:A}))}),u&&c.jsx(z5,{value:s[N]??"latest",onChange:A=>a(T=>({...T,[N]:A})),packageName:j.name})]},C)},t[15]=s,t[16]=u,t[17]=l,t[18]=S):S=t[18],p=e.packages.map(S),t[10]=s,t[11]=u,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=c.jsxs("div",{children:[g,c.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=c.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?c.jsxs(c.Fragment,{children:[c.jsx(R5,{manager:o.package_management.manager,packages:e.packages.map(S=>{const N=rb(S),C=l[S]||N.extras;return function(j,_){return _.length===0?j:`${j}[${_.join(",")}]`}(N.name,C)}),versions:s,clearPackageAlert:()=>n(e.id)}),!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"px-2 text-sm",children:"with"})," ",c.jsx(L5,{})]})]}):c.jsxs("p",{children:["If you set up a"," ",c.jsx(Yf,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(v=c.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=v):v=t[31],t[32]!==v||t[33]!==x?(w=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:c.jsxs(Ya,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[x,v]})}),t[32]=v,t[33]=x,t[34]=w):w=t[34],w}if(iL(e)){let h;t[35]!==e.packages?(h=function(M){const R=new Set(Object.values(M)),z=R.has("queued")||R.has("installing")?"installing":R.has("failed")?"failed":"installed";return z==="installing"?{status:"installing",title:"Installing packages",titleIcon:c.jsx(ti,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:z==="installed"?{status:"installed",title:"All packages installed!",titleIcon:c.jsx(fp,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:c.jsx(Wc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:x,description:g}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,y,v,w,S;t[37]!==m||t[38]!==x?(b=c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[x,m]}),t[37]=m,t[38]=x,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(En,{className:"w-5 h-5"}),t[43]=v):v=t[43],t[44]!==y?(w=c.jsx(ke,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:v}),t[44]=y,t[45]=w):w=t[45],t[46]!==b||t[47]!==w?(S=c.jsxs("div",{className:"flex justify-between",children:[b,w]}),t[46]=b,t[47]=w,t[48]=S):S=t[48];const N=f==="installed"&&"text-accent-foreground";let C,j,_,A,T,P,L;if(t[49]!==N?(C=me("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",N),t[49]=N,t[50]=C):C=t[50],t[51]!==g?(j=c.jsx("p",{children:g}),t[51]=g,t[52]=j):j=t[52],t[53]!==e.packages||t[54]!==f){let M;t[56]!==f?(M=(R,z)=>{const[D,I]=R;return c.jsxs("li",{className:me("flex items-center gap-1 font-mono text-sm",I==="installing"&&"font-semibold",I==="failed"&&"text-destructive",I==="installed"&&"text-accent-foreground",I==="installed"&&f==="failed"&&"text-muted-foreground"),children:[c.jsx(P5,{status:I}),D]},z)},t[56]=f,t[57]=M):M=t[57],_=Object.entries(e.packages).map(M),t[53]=e.packages,t[54]=f,t[55]=_}else _=t[55];return t[58]!==_?(A=c.jsx("ul",{className:"list-disc ml-4 mt-1",children:_}),t[58]=_,t[59]=A):A=t[59],t[60]!==j||t[61]!==A?(T=c.jsxs("div",{children:[j,A]}),t[60]=j,t[61]=A,t[62]=T):T=t[62],t[63]!==C||t[64]!==T?(P=c.jsx("div",{className:C,children:T}),t[63]=C,t[64]=T,t[65]=P):P=t[65],t[66]!==P||t[67]!==p||t[68]!==S?(L=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:c.jsxs(Ya,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[S,P]})}),t[66]=P,t[67]=p,t[68]=S,t[69]=L):L=t[69],L}return ec(e),null},P5=t=>{const e=H.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(Ss,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(ti,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(oc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(En,{size:"1rem"}),e[3]=o):o=e[3],o}default:return ec(n),null}},R5=t=>{const e=H.c(9),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t;let a,i,l,d;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r?(a=async()=>{s();const u={...r};for(const h of o)u[h]=u[h]??"";await JD({manager:n,versions:u}).catch(B5)},e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(ti,{className:"w-4 h-4 mr-2"}),l=c.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=i,e[6]=l):(i=e[5],l=e[6]),e[7]!==a?(d=c.jsxs(ke,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:a,children:[i,l]}),e[7]=a,e[8]=d):d=e[8],d},L5=()=>{const t=H.c(16),[e,n]=mr();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=Ak(YD),t[0]=o):o=t[0],t[1]!==e?(r={resolver:o,defaultValues:e},t[1]=e,t[2]=r):r=t[2];const s=Mk(r);let a;t[3]!==n?(a=async f=>{await pr({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=a):a=t[4];const i=a;let l,d,u,h;return t[5]!==s||t[6]!==i?(l=s.handleSubmit(i),t[5]=s,t[6]=i,t[7]=l):l=t[7],t[8]!==s.control?(d=c.jsx("div",{className:"flex flex-col gap-3",children:c.jsx(Ck,{control:s.control,name:"package_management.manager",render:$5})}),t[8]=s.control,t[9]=d):d=t[9],t[10]!==l||t[11]!==d?(u=c.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:d}),t[10]=l,t[11]=d,t[12]=u):u=t[12],t[13]!==s||t[14]!==u?(h=c.jsx(KD,{...s,children:u}),t[13]=s,t[14]=u,t[15]=h):h=t[15],h},F5=t=>{const e=H.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,a]=O.useState(!1),{isPending:i,error:l,data:d}=ob(n);let u;e[0]!==r||e[1]!==o?(u=(g,p)=>{r(p?[...o,g]:o.filter(b=>b!==g))},e[0]=r,e[1]=o,e[2]=u):u=e[2];const h=u,f=!i&&!l;let m,x;if(e[3]!==(d==null?void 0:d.extras)?(m=(d==null?void 0:d.extras)??[],e[3]=d==null?void 0:d.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const g=m.filter(V5);let p;e[12]!==n?(p=c.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],x=c.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?c.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[c.jsx("span",{className:"shrink-0",children:"["}),c.jsxs(Ho,{open:s&&f,onOpenChange:b=>{f&&a(b)},children:[c.jsx(Wo,{asChild:!0,children:c.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),c.jsxs(qo,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&c.jsx("div",{className:"p-2 bg-popover border-b border-border",children:c.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>c.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,c.jsx(En,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),c.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>c.jsx(T3,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:H5,children:b},b))})]})]}),c.jsx("span",{className:"shrink-0",children:"]"})]}):g.length>0?c.jsxs(Ho,{open:s&&f,onOpenChange:b=>{f&&a(b)},children:[c.jsx(Wo,{asChild:!0,children:c.jsx("button",{disabled:!f,className:me("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:c.jsx(Ko,{className:"w-3 h-3 flex-shrink-0"})})}),c.jsxs(qo,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[c.jsx("div",{className:"p-2 bg-popover border-b border-border",children:c.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),c.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>c.jsx(T3,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:W5,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=x}else x=e[11];return x},z5=t=>{const e=H.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:a,data:i}=ob(r);if(s){let h,f,m;return e[0]!==o?(h=x=>o(x.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=c.jsx(Ce,{content:"Failed to fetch package versions",children:c.jsx(km,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,d,u;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==a||e[9]!==i?(d=a?c.jsx("option",{value:"latest",children:"latest"}):["latest",...i.versions.slice(0,100)].map(q5),e[8]=a,e[9]=i,e[10]=d):d=e[10],e[11]!==a||e[12]!==l||e[13]!==d||e[14]!==n?(u=c.jsx(km,{value:n,onChange:l,disabled:a,className:"inline-flex ml-2 w-24 text-ellipsis",children:d}),e[11]=a,e[12]=l,e[13]=d,e[14]=n,e[15]=u):u=e[15],u};function B5(t){ft.error(t)}function U5(t){return c.jsx("option",{value:t,children:t},t)}function $5(t){const{field:e}=t;return c.jsxs(jk,{children:[c.jsx(Ek,{children:c.jsx(km,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:XD.map(U5)})}),c.jsx(Tk,{})]})}function V5(t){return!/^(dev|test|testing)$/i.test(t)}function H5(t){return t.preventDefault()}function W5(t){return t.preventDefault()}function q5(t){return c.jsx("option",{value:t,children:t},t)}const G5=t=>{let{transform:e}=t;return{...e,x:0}},Y5={threshold:{x:0,y:.1}},K5=G.memo(t=>{const e=H.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:a,compactColumns:i}=it(),[l,d]=O.useState(null),[u,h]=O.useState(null),[f]=wk();let m;e:{if(f.width==="columns"){m=Sm.EMPTY;break e}let M;e[0]===Symbol.for("react.memo_cache_sentinel")?(M=[G5],e[0]=M):M=e[0],m=M}const x=m;let g,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},e[1]=g):g=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:Gj},e[2]=p):p=e[2];const b=function(){for(var M=arguments.length,R=new Array(M),z=0;z<M;z++)R[z]=arguments[z];return O.useMemo(()=>[...R].filter(D=>D!=null),[...R])}(Cg(Sd,g),Cg(wd,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=M=>{d(M.active.id);const R=mn();h(R.cellIds)},e[3]=y):y=e[3];const v=ze(y);let w;e[4]!==u?(w=()=>{d(null),h(null)},e[4]=u,e[5]=w):w=e[5];const S=ze(w);let N;e[6]!==l?(N=M=>{const R=M.droppableContainers.filter(X5);if(l&&Fr(l))return gd({...M,droppableContainers:R});const z=(E=>{let{droppableContainers:U,droppableRects:V,pointerCoordinates:$}=E;if(!$)return[];const K=[];for(const X of U){const{id:J}=X,ee=V.get(J);if(ee&&uj($,ee)){const q=md(ee).reduce((oe,se)=>oe+hd($,se),0),Y=Number((q/4).toFixed(4));K.push({id:J,data:{droppableContainer:X,value:Y}})}}return K.sort(fd)})({...M,droppableContainers:R}),D=pd(z.length>0?z:Eg({...M,droppableContainers:R}),"id");if(!D)return[];wo(Fr(D),`Expected column id. Got: ${D}`);const I=mn().cellIds.get(D);if(wo(I,`Expected column. Got: ${D}`),I&&I.topLevelIds.length===0)return[{id:D}];const k=new Set(I.topLevelIds),B=gd({...M,droppableContainers:M.droppableContainers.filter(E=>E.id!==D&&k.has(E.id))});if(B.length>0){const E=B[0].id;return wo(ku(E),`Expected cell id. Got: ${E}`),[{id:E}]}return[]},e[6]=l,e[7]=N):N=e[7];const C=N;let j;e[8]!==r||e[9]!==s||e[10]!==a?(j=M=>{const{active:R,over:z}=M,D=z==null?void 0:z.id;if(D!=null&&R.id!==D){if(ku(R.id)){if(Fr(D))return void s({cellId:R.id,columnId:D});if(ku(D))return void r({cellId:R.id,overCellId:D})}Fr(R.id)&&Fr(D)&&a({column:R.id,overColumn:D})}},e[8]=r,e[9]=s,e[10]=a,e[11]=j):j=e[11];const _=ze(j);let A;e[12]!==i?(A=M=>{const{active:R,over:z}=M;z!==null&&R.id!==z.id&&i()},e[12]=i,e[13]=A):A=e[13];const T=ze(A),P=o?C:gd;let L;return e[14]!==n||e[15]!==S||e[16]!==T||e[17]!==_||e[18]!==v||e[19]!==x||e[20]!==b||e[21]!==P?(L=c.jsx(Dj,{autoScroll:Y5,sensors:b,collisionDetection:P,modifiers:x,onDragEnd:T,onDragStart:v,onDragCancel:S,onDragOver:_,children:n}),e[14]=n,e[15]=S,e[16]=T,e[17]=_,e[18]=v,e[19]=x,e[20]=b,e[21]=P,e[22]=L):L=e[22],L});function ku(t){return typeof t=="string"&&!t.startsWith("tree_")}function Fr(t){return typeof t=="string"&&t.startsWith("tree_")}function X5(t){return Fr(t.id)}const J5=t=>{const e=H.c(13),{className:n,size:o,gap:r,durationMs:s}=t,a=o===void 0?8:o,i=r===void 0?"gap-1":r,l=s===void 0?1200:s,d=`${l}ms`;let u;e[0]!==d?(u={animationDuration:d},e[0]=d,e[1]=u):u=e[1];const h=u;let f,m,x,g;return e[2]!==n||e[3]!==i?(f=jc("flex",i,n),e[2]=n,e[3]=i,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==a?(x=m.map(p=>c.jsx(ZD,{width:a,height:a,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=a,e[9]=x):x=e[9],e[10]!==f||e[11]!==x?(g=c.jsx("div",{className:f,"aria-label":"Loading",children:x}),e[10]=f,e[11]=x,e[12]=g):g=e[12],g},sb=t=>{const e=H.c(11),{title:n,children:o,show:r,delayMs:s,kind:a}=t,i=s===void 0?2e3:s,l=a===void 0?"info":a;if(!r)return null;let d,u,h;e[0]!==n?(d=n&&c.jsx("div",{className:"flex justify-between",children:c.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:n})}),e[0]=n,e[1]=d):d=e[1],e[2]!==o?(u=c.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:c.jsx("div",{children:o})}),e[2]=o,e[3]=u):u=e[3],e[4]!==l||e[5]!==d||e[6]!==u?(h=c.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:c.jsxs(Ya,{kind:l,className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[d,u]})}),e[4]=l,e[5]=d,e[6]=u,e[7]=h):h=e[7];const f=h;let m;return e[8]!==f||e[9]!==i?(m=c.jsx(Cc,{milliseconds:i,children:f}),e[8]=f,e[9]=i,e[10]=m):m=e[10],m},Z5=()=>{const t=H.c(3),e=Ie(QD),n=Ie(eP);let o;return t[0]!==n||t[1]!==e?(o=e&&c.jsxs(c.Fragment,{children:[c.jsx(Cc,{milliseconds:1e3,children:c.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-[200] ",children:c.jsx(Ce,{content:"Connecting to a marimo runtime",children:c.jsx("div",{className:"flex items-center",children:c.jsx(J5,{size:5,className:"text-yellow-500"})})})})}),c.jsx(sb,{show:e,delayMs:5e3,children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(xn,{className:"h-4 w-4"}),c.jsx("p",{children:"Connecting to a marimo runtime ..."})]})})]})||n&&c.jsx(sb,{show:n,kind:"danger",children:c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("p",{children:"Failed to connect."})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o},ab=G.forwardRef((t,e)=>{const n=H.c(62);let o,r,s,a,i,l;n[0]!==t?({columnId:a,canDelete:o,canMoveLeft:r,canMoveRight:s,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=i):(o=n[1],r=n[2],s=n[3],a=n[4],i=n[5]),n[6]!==a?(l={id:a},n[6]=a,n[7]=l):l=n[7];const{attributes:d,listeners:u,setNodeRef:h,transform:f,transition:m,isDragging:x,isOver:g}=n1(l);let p;n[8]!==f?(p=f?fc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=p):p=n[9];const b=x?2:void 0;let y;n[10]!==p||n[11]!==b||n[12]!==m?(y={transform:p,transition:m,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=p,n[11]=b,n[12]=m,n[13]=y):y=n[13];const v=y,{deleteColumn:w,moveColumn:S,addColumn:N}=it();let C;n[14]===Symbol.for("react.memo_cache_sentinel")?(C=me("h-full hover:bg-muted rounded-none"),n[14]=C):C=n[14];const j=C,_=e_;let A;n[15]!==a||n[16]!==S?(A=()=>S({column:a,overColumn:"_left_"}),n[15]=a,n[16]=S,n[17]=A):A=n[17];const T=!r;let P,L,M;n[18]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(vk,{className:"size-4"}),n[18]=P):P=n[18],n[19]!==A||n[20]!==T?(L=c.jsx(Ce,{content:"Move column left",side:"top",delayDuration:300,children:c.jsx(ke,{variant:"text",size:"sm",className:j,onClick:A,disabled:T,children:P})}),n[19]=A,n[20]=T,n[21]=L):L=n[21],n[22]!==a||n[23]!==S?(M=()=>S({column:a,overColumn:"_right_"}),n[22]=a,n[23]=S,n[24]=M):M=n[24];const R=!s;let z,D,I,k,B,E,U,V;n[25]===Symbol.for("react.memo_cache_sentinel")?(z=c.jsx(Ta,{className:"size-4"}),n[25]=z):z=n[25],n[26]!==M||n[27]!==R?(D=c.jsx(Ce,{content:"Move column right",side:"top",delayDuration:300,children:c.jsx(ke,{variant:"text",size:"sm",className:j,onClick:M,disabled:R,children:z})}),n[26]=M,n[27]=R,n[28]=D):D=n[28],n[29]!==d||n[30]!==u?(I=c.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...d,...u,"data-testid":"column-drag-button"}),n[29]=d,n[30]=u,n[31]=I):I=n[31],n[32]!==o||n[33]!==a||n[34]!==w?(k=o&&c.jsx(Ce,{content:"Delete column",side:"top",delayDuration:300,children:c.jsx(ke,{variant:"text",size:"sm",className:"opacity-0 group-hover:opacity-70 group-hover:hover:opacity-100 text-destructive h-full hover:bg-destructive/20 rounded-none",onClick:()=>w({columnId:a}),children:c.jsx(En,{className:"size-4"})})}),n[32]=o,n[33]=a,n[34]=w,n[35]=k):k=n[35],n[36]!==N||n[37]!==a?(B=()=>{N({columnId:a}),requestAnimationFrame(_)},n[36]=N,n[37]=a,n[38]=B):B=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(Ko,{className:"size-4"}),n[39]=E):E=n[39],n[40]!==B?(U=c.jsx(Ce,{content:"Add column",side:"top",delayDuration:300,children:c.jsx(ke,{variant:"text",size:"sm",className:j,onClick:B,children:E})}),n[40]=B,n[41]=U):U=n[41],n[42]!==D||n[43]!==I||n[44]!==k||n[45]!==U||n[46]!==L?(V=c.jsxs("div",{className:"h-6 group flex items-center rounded-t-lg border hover:border-border border-[var(--slate-3)] overflow-hidden bg-[var(--slate-1)]",children:[L,D,I,k,U]}),n[42]=D,n[43]=I,n[44]=k,n[45]=U,n[46]=L,n[47]=V):V=n[47];const $=V;let K;n[48]!==e||n[49]!==h?(K=oe=>{el(e,h)(oe)},n[48]=e,n[49]=h,n[50]=K):K=n[50];const X=x?"":i.className,J=x?"z-20":"z-1 hover:z-10 focus-within:z-10",ee=g&&"bg-accent/20";let q,Y;return n[51]!==X||n[52]!==J||n[53]!==ee?(q=me(X,J,ee),n[51]=X,n[52]=J,n[53]=ee,n[54]=q):q=n[54],n[55]!==$||n[56]!==x||n[57]!==i||n[58]!==v||n[59]!==K||n[60]!==q?(Y=c.jsxs("div",{tabIndex:-1,ref:K,...i,style:v,"data-is-dragging":x,className:q,children:[$,i.children]}),n[55]=$,n[56]=x,n[57]=i,n[58]=v,n[59]=K,n[60]=q,n[61]=Y):Y=n[61],Y});ab.displayName="SortableColumn";const Q5=O.memo(ab);function e_(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:t_,saveColumnWidth:n_}=tP,ib=O.memo(t=>{const e=H.c(20),n=O.useRef(null);if(t.width==="columns"){const s=t.canDelete,a=t.columnId,i=t.canMoveLeft,l=t.canMoveRight;let d,u,h,f;return e[0]!==t.index?(d=t_(t.index),e[0]=t.index,e[1]=d):d=e[1],e[2]!==t.index?(u=m=>{n_(t.index,m)},e[2]=t.index,e[3]=u):u=e[3],e[4]!==t.children||e[5]!==d||e[6]!==u?(h=c.jsx(o_,{startingWidth:d,onResize:u,children:t.children}),e[4]=t.children,e[5]=d,e[6]=u,e[7]=h):h=e[7],e[8]!==t.canDelete||e[9]!==t.canMoveLeft||e[10]!==t.canMoveRight||e[11]!==t.columnId||e[12]!==t.footer||e[13]!==h?(f=c.jsxs(Q5,{tabIndex:-1,ref:n,canDelete:s,columnId:a,canMoveLeft:i,canMoveRight:l,className:"group/column",children:[h,t.footer]}),e[8]=t.canDelete,e[9]=t.canMoveLeft,e[10]=t.canMoveRight,e[11]=t.columnId,e[12]=t.footer,e[13]=h,e[14]=f):f=e[14],f}let o,r;return e[15]!==t.children?(o=c.jsx("div",{"data-testid":"cell-column",className:"flex flex-col gap-5",children:t.children}),e[15]=t.children,e[16]=o):o=e[16],e[17]!==t.footer||e[18]!==o?(r=c.jsxs(c.Fragment,{children:[o,t.footer]}),e[17]=t.footer,e[18]=o,e[19]=r):r=e[19],r});ib.displayName="Column";const o_=t=>{const e=H.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:a,handleRefs:i,style:l}=nP(s),d=r_;let u,h,f,m;return e[3]!==i.left?(u=d(i.left),e[3]=i.left,e[4]=u):u=e[4],e[5]!==r||e[6]!==a||e[7]!==l?(h=c.jsx("div",{ref:a,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 py-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=a,e[7]=l,e[8]=h):h=e[8],e[9]!==i.right?(f=d(i.right),e[9]=i.right,e[10]=f):f=e[10],e[11]!==u||e[12]!==h||e[13]!==f?(m=c.jsxs("div",{className:"flex flex-row",children:[u,h,f]}),e[11]=u,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function r_(t){return c.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-[100]
124
- relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
125
- before:right-[-3px] before:w-[9px] before:z-[-1]
126
- hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
127
- hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const s_=t=>{const e=H.c(10),{width:n}=t,{banners:o}=lL(),{removeBanner:r}=cL();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let a,i,l;if(e[0]!==s?(a=me("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=a):a=e[1],e[2]!==o||e[3]!==r){let d;e[5]!==r?(d=u=>c.jsxs(Ya,{kind:u.variant||"info",className:"flex flex-col rounded p-3",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[c.jsx(A3,{className:"w-5 h-5 inline-block mr-2"}),u.title]}),c.jsx(ke,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(u.id),children:c.jsx(En,{className:"w-5 h-5"})})]}),c.jsxs("div",{className:"flex justify-between items-end",children:[c.jsx("span",{children:Nm({html:u.description})}),u.action==="restart"&&c.jsx(a_,{})]})]},u.id),e[5]=r,e[6]=d):d=e[6],i=o.map(d),e[2]=o,e[3]=r,e[4]=i}else i=e[4];return e[7]!==a||e[8]!==i?(l=c.jsx("div",{className:a,children:i}),e[7]=a,e[8]=i,e[9]=l):l=e[9],l},a_=()=>{const t=H.c(3),e=hg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx(bp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=c.jsxs(ke,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},i_=yt(t=>{const e=t(Pn);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}),l_=()=>{const t=H.c(3),e=c_;if(!Ie(i_))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx("div",{className:"flex justify-between",children:c.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=c.jsx(t3,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=c.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:c.jsxs(Ya,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,c.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:c.jsx("div",{children:c.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",c.jsx(ke,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=c.jsx(Cc,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function c_(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):ft.error("No element with data-stdin-blocking found")}function d_(){const t=setTimeout(u_,100);return()=>clearTimeout(t)}function u_(){requestAnimationFrame(h_)}function h_(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(cb)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),cb=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=mn(),a=n.dataset.cellId;if(!a)return void ft.error(`Missing cellId for cell with name ${e}`);const i=(r=(o=s[a])==null?void 0:o.current)==null?void 0:r.editorView;i&&i.focus()}}else ft.warn(`Cannot focus cell with name ${e} because it was not found`),lb()})(t);else try{lb()}catch(e){const n=e;ft.warn("Error focusing first editor",n)}}function lb(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=mn();for(const s of t.iterateTopLevelIds){const a=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=a==null?void 0:a.current)!=null&&r.editorView))return void a.current.editorView.focus()}}let cb=!1;const f_=t=>{const e=H.c(8),n=Ie(oP),o=t.appConfig.width==="columns";let r,s,a;return e[0]!==t?(r=c.jsx(m_,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=c.jsx(e1,{id:"column-container",items:n,strategy:zj,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(a=c.jsx(K5,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=a):a=e[7],a},m_=t=>{const e=H.c(52),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,a=ms(),i=it(),{theme:l}=Xo(),{toggleSidebarPanel:d}=gr();M3(d_),Pt("global.focusTop",i.focusTopCell),Pt("global.focusBottom",i.focusBottomCell),Pt("global.toggleSidebar",d),Pt("global.foldCode",i.foldAll),Pt("global.unfoldCode",i.unfoldAll),Pt("global.formatAll",x_),Pt("cell.hideCode",Cn.NOOP),Pt("cell.format",Cn.NOOP);const u=di(),h=i.scrollToTarget;let f,m,x,g,p,b,y,v,w,S,N,C,j,_,A,T;if(e[0]!==a.scrollKey||e[1]!==h?(f=()=>{a.scrollKey!==null&&h()},e[0]=a.scrollKey,e[1]=h,e[2]=f):f=e[2],e[3]!==a.cellIds||e[4]!==a.scrollKey||e[5]!==h?(m=[a.cellIds,a.scrollKey,h],e[3]=a.cellIds,e[4]=a.scrollKey,e[5]=h,e[6]=m):m=e[6],O.useEffect(f,m),e[7]!==i||e[8]!==r||e[9]!==s||e[10]!==n||e[11]!==a||e[12]!==u||e[13]!==l||e[14]!==o){const P=a.cellIds.getColumns();let L;e[26]!==a.cellIds?(L=a.cellIds.hasOnlyOneId(),e[26]=a.cellIds,e[27]=L):L=e[27];const M=L;let R;e[28]!==a.cellIds.inOrderIds?(R=a.cellIds.inOrderIds.includes(jo),e[28]=a.cellIds.inOrderIds,e[29]=R):R=e[29];const z=R;x=dL,w="pb-[40vh]",S=!1,N=r,C="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsx(D5,{}),g=c.jsx(l_,{}),p=c.jsx(Z5,{}),e[30]=g,e[31]=p,e[32]=j):(g=e[30],p=e[31],j=e[32]),e[33]!==r.width?(b=c.jsx(s_,{width:r.width}),e[33]=r.width,e[34]=b):b=e[34];const D=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[35]!==D?(y=me(D),e[35]=D,e[36]=y):y=e[36],v=P.map((I,k)=>c.jsx(p_,{column:I,index:k,columnsLength:P.length,appConfig:r,notebook:a,mode:n,userConfig:o,connStatus:s,actions:i,theme:l,hasOnlyOneCell:M,hasSetupCell:z,onDeleteCell:u},I.id)),e[7]=i,e[8]=r,e[9]=s,e[10]=n,e[11]=a,e[12]=u,e[13]=l,e[14]=o,e[15]=x,e[16]=g,e[17]=p,e[18]=b,e[19]=y,e[20]=v,e[21]=w,e[22]=S,e[23]=N,e[24]=C,e[25]=j}else x=e[15],g=e[16],p=e[17],b=e[18],y=e[19],v=e[20],w=e[21],S=e[22],N=e[23],C=e[24],j=e[25];return e[37]!==y||e[38]!==v?(_=c.jsx("div",{className:y,children:v}),e[37]=y,e[38]=v,e[39]=_):_=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx(uL,{}),e[40]=A):A=e[40],e[41]!==x||e[42]!==g||e[43]!==p||e[44]!==b||e[45]!==_||e[46]!==w||e[47]!==S||e[48]!==N||e[49]!==C||e[50]!==j?(T=c.jsxs(x,{className:w,invisible:S,appConfig:N,innerClassName:C,children:[j,g,p,b,_,A]}),e[41]=x,e[42]=g,e[43]=p,e[44]=b,e[45]=_,e[46]=w,e[47]=S,e[48]=N,e[49]=C,e[50]=j,e[51]=T):T=e[51],T},p_=t=>{const e=H.c(40),{column:n,index:o,columnsLength:r,appConfig:s,notebook:a,mode:i,userConfig:l,connStatus:d,actions:u,theme:h,hasOnlyOneCell:f,hasSetupCell:m,onDeleteCell:x}=t,g=d.state,p=n.id,b=o>0,y=o<r-1,v=s.width,w=r>1,S=n.id,N=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let C,j;e[0]!==N?(C=me(N),e[0]=N,e[1]=C):C=e[1],e[2]!==n.id||e[3]!==C?(j=c.jsx(g_,{columnId:S,className:C}),e[2]=n.id,e[3]=C,e[4]=j):j=e[4];const _=`column-${o+1}`,A=n.topLevelIds;let T,P,L,M;return e[5]!==u||e[6]!==g||e[7]!==m||e[8]!==o||e[9]!==i||e[10]!==a||e[11]!==x||e[12]!==h||e[13]!==l?(T=o===0&&m&&c.jsx(tb,{theme:h,showPlaceholder:!1,...a.cellData[jo],...a.cellRuntime[jo],...u,runElapsedTimeMs:a.cellRuntime[jo].runElapsedTimeMs??a.cellData[jo].lastExecutionTime,canDelete:!0,mode:i,connectionState:g,ref:a.cellHandles[jo],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:u,deleteCell:x},jo),e[5]=u,e[6]=g,e[7]=m,e[8]=o,e[9]=i,e[10]=a,e[11]=x,e[12]=h,e[13]=l,e[14]=T):T=e[14],e[15]!==u||e[16]!==s.width||e[17]!==n||e[18]!==g||e[19]!==f||e[20]!==i||e[21]!==a||e[22]!==x||e[23]!==h||e[24]!==l?(P=n.topLevelIds.map(R=>{if(R===jo)return null;const z=a.cellData[R],D=a.cellRuntime[R];return c.jsx(tb,{theme:h,showPlaceholder:f,...z,...D,runElapsedTimeMs:D.runElapsedTimeMs??z.lastExecutionTime,canDelete:!f,mode:i,connectionState:g,ref:a.cellHandles[R],userConfig:l,config:z.config,name:z.name,isCollapsed:n.isCollapsed(R),collapseCount:n.getCount(R),canMoveX:s.width==="columns",actions:u,deleteCell:x},z.id.toString())}),e[15]=u,e[16]=s.width,e[17]=n,e[18]=g,e[19]=f,e[20]=i,e[21]=a,e[22]=x,e[23]=h,e[24]=l,e[25]=P):P=e[25],e[26]!==n.topLevelIds||e[27]!==_||e[28]!==T||e[29]!==P?(L=c.jsxs(e1,{id:_,items:A,strategy:Bj,children:[T,P]}),e[26]=n.topLevelIds,e[27]=_,e[28]=T,e[29]=P,e[30]=L):L=e[30],e[31]!==s.width||e[32]!==n.id||e[33]!==o||e[34]!==L||e[35]!==b||e[36]!==y||e[37]!==w||e[38]!==j?(M=c.jsx(ib,{columnId:p,index:o,canMoveLeft:b,canMoveRight:y,width:v,canDelete:w,footer:j,children:L}),e[31]=s.width,e[32]=n.id,e[33]=o,e[34]=L,e[35]=b,e[36]=y,e[37]=w,e[38]=j,e[39]=M):M=e[39],M},g_=t=>{const e=H.c(17),{columnId:n,className:o}=t,{createNewCell:r}=it(),[s,a]=rP(!1),i=Ie(Ul),l=Ie(Xk);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=me("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]=d):d=e[0];const u=d;let h;e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==a.toggle||e[6]!==l?(h=()=>s?c.jsx(sP,{onClose:a.toggle}):c.jsxs(c.Fragment,{children:[c.jsxs(ke,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[c.jsx(wp,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),c.jsxs(ke,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{qn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Oa().defaultCode,hideCode:!0})},children:[c.jsx(Np,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),c.jsxs(ke,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{qn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new vc().defaultCode})},children:[c.jsx($o,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),c.jsx(Ce,{content:i?null:c.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:c.jsxs(ke,{className:u,variant:"text",size:"sm",disabled:!i||!l,onClick:a.toggle,children:[c.jsx(Ia,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a.toggle,e[6]=l,e[7]=h):h=e[7];const f=h,m=!s&&"w-fit",x=s&&"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]!==x?(g=me("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,x,o),e[8]=o,e[9]=m,e[10]=x,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=c.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:c.jsx("div",{className:g,children:p})}),e[14]=g,e[15]=p,e[16]=b):b=e[16],b};function x_(){Yk()}const b_=aP(iP,400),y_=(t,e)=>{et.get(is)||t.isEmpty()||e.isEmpty()||Pa(t.inOrderIds,e.inOrderIds)||b_({cell_ids:t.inOrderIds})},db=t=>{const e=H.c(66),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;lP(Nc,y_);const{setCells:a,mergeAllColumns:i,collapseAllCells:l,expandAllCells:d}=it(),u=Ie(Pf),h=Ie(cP),f=Ie(dP),m=Jf(),x=St(ld),g=u.mode==="edit",p=u.mode==="present",b=Ie(uP);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],O.useEffect(w_,y);const v=n.runtime.auto_instantiate;let w,S,N;e[1]!==a||e[2]!==x?(w=(se,re)=>{a(se);const ae=se.map(k_),te=se.map(S_),be=se.map(N_);x({names:ae,codes:te,configs:be,layout:re})},e[1]=a,e[2]=x,e[3]=w):w=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(S=h3(),e[4]=S):S=e[4],e[5]!==w||e[6]!==n.runtime.auto_instantiate?(N={autoInstantiate:v,setCells:w,sessionId:S},e[5]=w,e[6]=n.runtime.auto_instantiate,e[7]=N):N=e[7];const{connection:C}=hL(N);let j,_;e[8]!==o.app_title||e[9]!==m?(j=()=>{document.title=o.app_title||pn.basename(m??"")||"Untitled Notebook"},_=[o.app_title,m],e[8]=o.app_title,e[9]=m,e[10]=j,e[11]=_):(j=e[10],_=e[11]),O.useEffect(j,_);const A=hc(o.width);let T,P;e[12]!==o.width||e[13]!==i||e[14]!==A?(T=()=>{A==="columns"&&o.width!=="columns"&&i()},e[12]=o.width,e[13]=i,e[14]=A,e[15]=T):T=e[15],e[16]!==o.width||e[17]!==i||e[18]!==h||e[19]!==A?(P=[o.width,A,i,h],e[16]=o.width,e[17]=i,e[18]=h,e[19]=A,e[20]=P):P=e[20],O.useEffect(T,P);const L=function(){const se=H.c(2),re=Es();let ae;return se[0]!==re?(ae=()=>re(Z7(mn())),se[0]=re,se[1]=ae):ae=se[1],ze(ae)}(),M=Op(),R=Mp();let z,D,I,k,B,E;e[21]!==L?(z=()=>{L()},e[21]=L,e[22]=z):z=e[22],Pt("global.runStale",z),Pt("global.interrupt",C_),e[23]!==R?(D=()=>{R()},e[23]=R,e[24]=D):D=e[24],Pt("global.hideCode",D),e[25]!==M?(I=()=>{M()},e[25]=M,e[26]=I):I=e[26],Pt("global.runAll",I),e[27]!==l?(k=()=>{l()},e[27]=l,e[28]=k):k=e[28],Pt("global.collapseAllSections",k),e[29]!==d?(B=()=>{d()},e[29]=d,e[30]=B):B=e[30],Pt("global.expandAllSections",B),e[31]!==o||e[32]!==C||e[33]!==n||e[34]!==u.mode?(E=c.jsx(f_,{connStatus:C,mode:u.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=C,e[33]=n,e[34]=u.mode,e[35]=E):E=e[35];const U=E,V=o.width;let $,K,X,J,ee,q,Y,oe;return e[36]===Symbol.for("react.memo_cache_sentinel")?($=me("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=$):$=e[36],e[37]!==m||e[38]!==g?(K=g&&c.jsx("div",{className:"flex items-center justify-center container",children:c.jsx(BC,{filename:m})}),e[37]=m,e[38]=g,e[39]=K):K=e[39],e[40]!==C||e[41]!==K?(X=c.jsx(mL,{connection:C,className:$,children:K}),e[40]=C,e[41]=K,e[42]=X):X=e[42],e[43]!==o||e[44]!==U||e[45]!==f||e[46]!==u.mode?(J=f&&c.jsx(fL,{appConfig:o,mode:u.mode,children:U}),e[43]=o,e[44]=U,e[45]=f,e[46]=u.mode,e[47]=J):J=e[47],e[48]!==o.width||e[49]!==C||e[50]!==b||e[51]!==X||e[52]!==J?(ee=c.jsxs(pL,{connection:C,isRunning:b,width:V,children:[X,J]}),e[48]=o.width,e[49]=C,e[50]=b,e[51]=X,e[52]=J,e[53]=ee):ee=e[53],e[54]===Symbol.for("react.memo_cache_sentinel")?(q=c.jsx(QC,{}),e[54]=q):q=e[54],e[55]!==o||e[56]!==C||e[57]!==s||e[58]!==p||e[59]!==b||e[60]!==L||e[61]!==R?(Y=!s&&c.jsx(_c,{children:c.jsx(PC,{presenting:p,onTogglePresenting:R,onInterrupt:dm,onRun:L,connectionState:C.state,running:b,appConfig:o})}),e[55]=o,e[56]=C,e[57]=s,e[58]=p,e[59]=b,e[60]=L,e[61]=R,e[62]=Y):Y=e[62],e[63]!==ee||e[64]!==Y?(oe=c.jsxs(c.Fragment,{children:[ee,q,Y]}),e[63]=ee,e[64]=Y,e[65]=oe):oe=e[65],oe};function v_(){NS.INSTANCE.stop()}function w_(){return NS.INSTANCE.start(hP),v_}function k_(t){return t.name}function S_(t){return t.code}function N_(t){return t.config}function C_(){dm()}const ub=t=>Ie(fP)[t.capability]?t.children:null,un=O.forwardRef((t,e)=>{const n=H.c(18);let o,r,s,a,i;n[0]!==t?({children:o,tooltip:i,selected:a,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=i):(o=n[1],r=n[2],s=n[3],a=n[4],i=n[5]);const l=!a&&"hover:bg-[var(--sage-3)]",d=a&&"bg-[var(--sage-4)]";let u,h;n[6]!==r||n[7]!==l||n[8]!==d?(u=me("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,d,r),n[6]=r,n[7]=l,n[8]=d,n[9]=u):u=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==u?(h=c.jsx("div",{ref:e,className:u,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=u,n[14]=h):h=n[14];const f=h;if(i){let m;return n[15]!==f||n[16]!==i?(m=c.jsx(Ce,{content:i,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=i,n[17]=m):m=n[17],m}return f});un.displayName="FooterItem";const j_=()=>{var u;const t=H.c(14),e=Ie(O3),n=Ie(Ul),o=((u=e==null?void 0:e.open_ai)==null?void 0:u.model)||"gpt-4-turbo",{handleClick:r}=Ja();if(!n){let h,f,m;return t[0]!==r?(h=()=>r("ai"),t[0]=r,t[1]=h):h=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Ia,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==h?(m=c.jsx(un,{tooltip:"Assist is disabled",selected:!1,onClick:h,"data-testid":"footer-ai-disabled",children:f}),t[3]=h,t[4]=m):m=t[4],m}let s,a,i,l,d;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(a=c.jsxs(c.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=a):a=t[7],t[8]!==r?(i=()=>r("ai"),t[8]=r,t[9]=i):i=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Ia,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==a||t[12]!==i?(d=c.jsx(un,{tooltip:a,onClick:i,selected:!1,"data-testid":"footer-ai-enabled",children:l}),t[11]=a,t[12]=i,t[13]=d):d=t[13],d},E_=()=>{const t=H.c(26),e=Ie(Yn).state,n=ym();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===Ut.OPEN){if(Zt())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(w){const S=w;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{isFetching:s,error:a,data:i,refetch:l}=jn(o,r),d=e===Ut.OPEN?3e4:null;let u,h;t[4]!==d?(u={delayMs:d,whenVisible:!0},t[4]=d,t[5]=u):u=t[5],Xa(l,u),t[6]!==e||t[7]!==i||t[8]!==a?(h=()=>[Xf(e.toLowerCase()),i!=null&&i.lastChecked?i.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",a?`Error: ${a}`:""].filter(Boolean).join(`
128
- `),t[6]=e,t[7]=i,t[8]=a,t[9]=h):h=t[9];const f=h;let m;t[10]!==e||t[11]!==(i==null?void 0:i.isHealthy)||t[12]!==(i==null?void 0:i.lastChecked)||t[13]!==s?(m=()=>s||e===Ut.CONNECTING?c.jsx(xn,{size:"small"}):e===Ut.CLOSING?c.jsx(xn,{className:"text-destructive",size:"small"}):e===Ut.OPEN?i!=null&&i.isHealthy?c.jsx(Dc,{className:"w-4 h-4 text-[var(--green-9)]"}):i!=null&&i.lastChecked?c.jsx(A3,{className:"w-4 h-4 text-[var(--yellow-9)]"}):c.jsx(Dc,{className:"w-4 h-4"}):c.jsx(Za,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=i==null?void 0:i.isHealthy,t[12]=i==null?void 0:i.lastChecked,t[13]=s,t[14]=m):m=t[14];const x=m,g=f();let p,b,y,v;return t[15]!==e?(p=e===Ut.OPEN&&c.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=c.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?(y=x(),t[20]=x,t[21]=y):y=t[21],t[22]!==l||t[23]!==b||t[24]!==y?(v=c.jsx(un,{tooltip:b,selected:!1,onClick:l,"data-testid":"footer-backend-status",children:y}),t[22]=l,t[23]=b,t[24]=y,t[25]=v):v=t[25],v},__=t=>{const e=H.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.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=c.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},I_=yt(t=>t(mP).completion.copilot),T_=()=>{const t=H.c(1);if(Ie(I_)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(A_,{}),t[0]=e):e=t[0],e}return null},hb=ft.get("[copilot-status-bar]"),A_=()=>{const t=Ie(fS),e=Ie(XR)!==null,{handleClick:n}=Ja(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=St(fS),a=St(JR);return M3(()=>{const i=hS();let l=!0;return(async()=>{try{if(await i.initializePromise.catch(u=>{throw hb.error("Failed to initialize",u),i.close(),u}),!l)return;const d=await i.signedIn();if(!l)return;s(d),a(d?"signedIn":"signedOut")}catch(d){if(!l)return;hb.warn("Connection failed",d),s(!1),a("connectionError"),Xe({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:c.jsx(ke,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),c.jsx(un,{tooltip:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:c.jsx("span",{children:e?c.jsx(xn,{className:"h-4 w-4"}):c.jsx(__,{className:me("h-4 w-4",!t&&"opacity-60")})})})},M_=t=>{const e=H.c(17),[n,o]=O.useState(0),r=Ie(Yn);let s,a,i,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o(R_),a={delayMs:1e4,whenVisible:!0},e[0]=s,e[1]=a):(s=e[0],a=e[1]),Xa(s,a),e[2]!==r.state?(i=async()=>Zt()||r.state!==Ut.OPEN?null:pP(),e[2]=r.state,e[3]=i):i=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:d}=jn(i,l);let u,h,f,m;return e[7]!==d?(u=(d==null?void 0:d.gpu)&&d.gpu.length>0&&c.jsx(P_,{gpus:d.gpu}),e[7]=d,e[8]=u):u=e[8],e[9]!==d?(h=d&&c.jsx(O_,{memory:d.memory,kernel:d.kernel,server:d.server}),e[9]=d,e[10]=h):h=e[10],e[11]!==d?(f=d&&c.jsx(D_,{cpu:d.cpu}),e[11]=d,e[12]=f):f=e[12],e[13]!==u||e[14]!==h||e[15]!==f?(m=c.jsxs("div",{className:"flex gap-2 items-center px-1",children:[u,h,f]}),e[13]=u,e[14]=h,e[15]=f,e[16]=m):m=e[16],m},O_=t=>{const e=H.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:a,available:i}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const d=l;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("b",{children:"computer memory:"}),e[2]=u):u=e[2];const h=a-i;let f,m,x,g,p,b,y,v,w;return e[3]!==h?(f=Nu(h),e[3]=h,e[4]=f):f=e[4],e[5]!==a?(m=Nu(a),e[5]=a,e[6]=m):m=e[6],e[7]!==d||e[8]!==f||e[9]!==m?(x=c.jsxs("span",{children:[u," ",f," / ",m," GB (",d,"%)"]}),e[7]=d,e[8]=f,e[9]=m,e[10]=x):x=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&c.jsxs("span",{children:[c.jsx("b",{children:"marimo server:"})," ",il(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&c.jsxs("span",{children:[c.jsx("b",{children:"kernel:"})," ",il(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==x||e[16]!==g||e[17]!==p?(b=c.jsxs("div",{className:"flex flex-col gap-1",children:[x,g,p]}),e[15]=x,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(cp,{className:"w-4 h-4"}),e[19]=y):y=e[19],e[20]!==d?(v=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[y,c.jsx(Su,{percent:d,colorClassName:"bg-primary"})]}),e[20]=d,e[21]=v):v=e[21],e[22]!==v||e[23]!==b?(w=c.jsx(Ce,{delayDuration:200,content:b,children:v}),e[22]=v,e[23]=b,e[24]=w):w=e[24],w},D_=t=>{const e=H.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 a,i,l,d,u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("b",{children:"CPU:"}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs("span",{children:[a," ",s,"%"]}),e[3]=s,e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ZR,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(d=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,c.jsx(Su,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=d):d=e[7],e[8]!==i||e[9]!==d?(u=c.jsx(Ce,{delayDuration:200,content:i,children:d}),e[8]=i,e[9]=d,e[10]=u):u=e[10],u},P_=t=>{const e=H.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(L_,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,a,i,l,d;return e[2]!==n?(s=n.map(F_),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(a=c.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(up,{className:"w-4 h-4"}),e[6]=i):i=e[6],e[7]!==r?(l=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[i,c.jsx(Su,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==a||e[10]!==l?(d=c.jsx(Ce,{delayDuration:200,content:a,children:l}),e[9]=a,e[10]=l,e[11]=d):d=e[11],d},Su=t=>{const e=H.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=me("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let a,i;return e[2]!==s?(a={width:s},e[2]=s,e[3]=a):a=e[3],e[4]!==r||e[5]!==a?(i=c.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:c.jsx("div",{className:r,style:a})}),e[4]=r,e[5]=a,e[6]=i):i=e[6],i};function il(t){return t>1073741824?`${Nu(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Nu(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function R_(t){return t+1}function L_(t,e){return t+e.memory.percent}function F_(t){return c.jsxs("span",{children:[c.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",il(t.memory.used)," / ",il(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const z_=()=>{const t=H.c(6),{isMinimapOpen:e}=ds(),{toggleMinimap:n}=gr();let o,r,s;return t[0]!==n?(o=()=>n(),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(lp,{className:"h-4 w-4"}),t[2]=r):r=t[2],t[3]!==e||t[4]!==o?(s=c.jsx(un,{tooltip:"Toggle Minimap",selected:e,onClick:o,"data-testid":"footer-minimap",children:r}),t[3]=e,t[4]=o,t[5]=s):s=t[5],s},B_=()=>{const t=H.c(13),e=Ie(Or),[n,o]=Ot(f3),[r,s]=O.useState(!1);if(!wc()||e==="disabled")return null;const a=e?"Real-time collaboration active":"Connecting to real-time collaboration";let i,l,d,u,h,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Ip,{className:"w-4 h-4"}),t[0]=i):i=t[0],t[1]!==a?(l=c.jsx(ys,{asChild:!0,children:c.jsx(un,{tooltip:a,selected:!1,"data-testid":"footer-rtc-status",children:i})}),t[1]=a,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"font-medium leading-none",children:"Username"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=d):d=t[3],t[4]!==o?(u=m=>o(m.target.value),t[4]=o,t[5]=u):u=t[5],t[6]!==u||t[7]!==n?(h=c.jsx(fs,{className:"w-80",children:c.jsxs("div",{className:"space-y-4",children:[d,c.jsx(Bo,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:u,placeholder:"Enter your username"})]})}),t[6]=u,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==l||t[11]!==h?(f=c.jsxs(xr,{open:r,onOpenChange:s,children:[l,h]}),t[9]=r,t[10]=l,t[11]=h,t[12]=f):f=t[12],f},U_=t=>{const e=H.c(101),{className:n}=t,[o,r]=gP(),s=mr()[0],[a,i]=O.useState(!1);let l,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{const _e=window.matchMedia("(min-width: 768px)"),Fe=()=>{_e.matches&&i(!1)};return _e.addEventListener("change",Fe),()=>_e.removeEventListener("change",Fe)},d=[],e[0]=l,e[1]=d):(l=e[0],d=e[1]),O.useEffect(l,d),e[2]!==s||e[3]!==r?(u=async _e=>{const Fe={...s,runtime:{...s.runtime,auto_instantiate:_e}};await pr({config:Fe}).then(()=>r(Fe))},e[2]=s,e[3]=r,e[4]=u):u=e[4];const h=u;let f;e[5]!==r||e[6]!==o?(f=async _e=>{const Fe={...o,runtime:{...o.runtime,on_cell_change:_e?"autorun":"lazy"}};await pr({config:Fe}).then(()=>r(Fe))},e[5]=r,e[6]=o,e[7]=f):f=e[7];const m=f;let x;e[8]!==r||e[9]!==o?(x=async _e=>{const Fe={...o,runtime:{...o.runtime,auto_reload:_e}};await pr({config:Fe}).then(()=>r(Fe))},e[8]=r,e[9]=o,e[10]=x):x=e[10];const g=x;let p;e[11]!==s.runtime.auto_instantiate||e[12]!==s.runtime.auto_reload||e[13]!==s.runtime.on_cell_change?(p=!s.runtime.auto_instantiate&&s.runtime.on_cell_change==="lazy"&&(Zt()||s.runtime.auto_reload!=="autorun"),e[11]=s.runtime.auto_instantiate,e[12]=s.runtime.auto_reload,e[13]=s.runtime.on_cell_change,e[14]=p):p=e[14];const b=p;let y;e[15]!==n?(y=me("flex items-center",n),e[15]=n,e[16]=y):y=e[16];const v=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let w,S,N;e[17]!==s.runtime.auto_instantiate||e[18]!==h?(w=()=>h(!s.runtime.auto_instantiate),e[17]=s.runtime.auto_instantiate,e[18]=h,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx("span",{children:"on startup: "}),e[20]=S):S=e[20],e[21]!==s.runtime.auto_instantiate?(N=s.runtime.auto_instantiate?c.jsx(cn,{size:14}):c.jsx(ln,{size:14}),e[21]=s.runtime.auto_instantiate,e[22]=N):N=e[22];const C=s.runtime.auto_instantiate?"autorun":"lazy";let j,_,A,T;e[23]!==C?(j=c.jsx("span",{children:C}),e[23]=C,e[24]=j):j=e[24],e[25]!==N||e[26]!==j?(_=c.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[S,N,j]}),e[25]=N,e[26]=j,e[27]=_):_=e[27],e[28]!==_||e[29]!==v||e[30]!==w?(A=c.jsx(Ns,{name:"runtime.auto_instantiate",children:c.jsx(un,{tooltip:v,selected:!1,onClick:w,"data-testid":"footer-autorun-startup",children:_})}),e[28]=_,e[29]=v,e[30]=w,e[31]=A):A=e[31],e[32]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[32]=T):T=e[32];const P=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let L,M,R,z,D,I,k,B,E,U,V,$,K;e[33]!==s.runtime.on_cell_change||e[34]!==m?(L=()=>m(s.runtime.on_cell_change!=="autorun"),e[33]=s.runtime.on_cell_change,e[34]=m,e[35]=L):L=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsx("span",{children:"on cell change: "}),e[36]=M):M=e[36],e[37]!==s.runtime.on_cell_change?(R=c.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[M,s.runtime.on_cell_change==="autorun"?c.jsx(cn,{size:14}):c.jsx(ln,{size:14}),c.jsx("span",{children:s.runtime.on_cell_change})]}),e[37]=s.runtime.on_cell_change,e[38]=R):R=e[38],e[39]!==P||e[40]!==L||e[41]!==R?(z=c.jsx(Ns,{name:"runtime.on_cell_change",children:c.jsx(un,{tooltip:P,selected:!1,onClick:L,"data-testid":"footer-autorun-cell-change",children:R})}),e[39]=P,e[40]=L,e[41]=R,e[42]=z):z=e[42],e[43]!==s.runtime.auto_reload||e[44]!==g?(D=!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-r border-border h-6 mx-1"}),c.jsx(Ns,{name:"runtime.auto_reload",children:c.jsx(un,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:c.jsxs(Ho,{children:[c.jsxs(Wo,{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[c.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&c.jsx(Za,{size:14}),s.runtime.auto_reload==="lazy"&&c.jsx(ln,{size:14}),s.runtime.auto_reload==="autorun"&&c.jsx(cn,{size:14}),c.jsx("span",{children:s.runtime.auto_reload}),c.jsx(vo,{size:14})]}),c.jsx(qo,{children:["off","lazy","autorun"].map(_e=>c.jsxs(Dt,{onClick:()=>g(_e),children:[_e==="off"&&c.jsx(Za,{size:14,className:"mr-2 text-muted-foreground"}),_e==="lazy"&&c.jsx(ln,{size:14,className:"mr-2 text-muted-foreground"}),_e==="autorun"&&c.jsx(cn,{size:14,className:"mr-2 text-muted-foreground"}),_e]},_e))})]})})})]}),e[43]=s.runtime.auto_reload,e[44]=g,e[45]=D):D=e[45],e[46]!==A||e[47]!==z||e[48]!==D?(I=c.jsxs("div",{className:"hidden md:flex md:items-center",children:[A,T,z,D]}),e[46]=A,e[47]=z,e[48]=D,e[49]=I):I=e[49],e[50]!==b?(k=b?c.jsx(ln,{size:16,className:"text-muted-foreground"}):c.jsx(cn,{size:16,className:"text-amber-500"}),e[50]=b,e[51]=k):k=e[51],e[52]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(vo,{size:14}),e[52]=B):B=e[52],e[53]!==k?(E=c.jsx(Wo,{asChild:!0,children:c.jsx(un,{tooltip:"Runtime reactivity",selected:!1,"data-testid":"footer-runtime-settings",children:c.jsxs("div",{className:"flex items-center gap-1",children:[k,B]})})}),e[53]=k,e[54]=E):E=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(Ik,{children:"Runtime reactivity"}),V=c.jsx(rn,{}),e[55]=U,e[56]=V):(U=e[55],V=e[56]),e[57]!==s.runtime.auto_instantiate?($=s.runtime.auto_instantiate?c.jsx(cn,{size:14,className:"text-amber-500"}):c.jsx(ln,{size:14,className:"text-muted-foreground"}),e[57]=s.runtime.auto_instantiate,e[58]=$):$=e[58],e[59]===Symbol.for("react.memo_cache_sentinel")?(K=c.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[59]=K):K=e[59];const X=s.runtime.auto_instantiate?"autorun":"lazy";let J,ee,q,Y,oe,se,re,ae,te;e[60]!==X?(J=c.jsxs("div",{children:[K,c.jsx("div",{className:"text-xs text-muted-foreground",children:X})]}),e[60]=X,e[61]=J):J=e[61],e[62]!==$||e[63]!==J?(ee=c.jsxs("div",{className:"flex items-center space-x-2",children:[$,J]}),e[62]=$,e[63]=J,e[64]=ee):ee=e[64],e[65]!==s.runtime.auto_instantiate||e[66]!==h?(q=c.jsx(Uf,{checked:s.runtime.auto_instantiate,onCheckedChange:h,size:"sm"}),e[65]=s.runtime.auto_instantiate,e[66]=h,e[67]=q):q=e[67],e[68]!==ee||e[69]!==q?(Y=c.jsx(Ns,{name:"runtime.auto_instantiate",children:c.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[ee,q]})}),e[68]=ee,e[69]=q,e[70]=Y):Y=e[70],e[71]===Symbol.for("react.memo_cache_sentinel")?(oe=c.jsx(rn,{}),e[71]=oe):oe=e[71],e[72]!==s.runtime.on_cell_change?(se=s.runtime.on_cell_change==="autorun"?c.jsx(cn,{size:14,className:"text-amber-500"}):c.jsx(ln,{size:14,className:"text-muted-foreground"}),e[72]=s.runtime.on_cell_change,e[73]=se):se=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(re=c.jsx("div",{className:"text-sm font-medium",children:"On cell change"}),e[74]=re):re=e[74],e[75]!==s.runtime.on_cell_change?(ae=c.jsxs("div",{children:[re,c.jsx("div",{className:"text-xs text-muted-foreground",children:s.runtime.on_cell_change})]}),e[75]=s.runtime.on_cell_change,e[76]=ae):ae=e[76],e[77]!==se||e[78]!==ae?(te=c.jsxs("div",{className:"flex items-center space-x-2",children:[se,ae]}),e[77]=se,e[78]=ae,e[79]=te):te=e[79];const be=s.runtime.on_cell_change==="autorun";let ye,ie,ve,he,Se,De;return e[80]!==m||e[81]!==be?(ye=c.jsx(Uf,{checked:be,onCheckedChange:m,size:"sm"}),e[80]=m,e[81]=be,e[82]=ye):ye=e[82],e[83]!==te||e[84]!==ye?(ie=c.jsx(Ns,{name:"runtime.on_cell_change",children:c.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[te,ye]})}),e[83]=te,e[84]=ye,e[85]=ie):ie=e[85],e[86]!==s.runtime.auto_reload||e[87]!==g?(ve=!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsx(Ns,{name:"runtime.auto_reload",children:c.jsxs("div",{className:"px-2 py-1",children:[c.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[s.runtime.auto_reload==="off"&&c.jsx(Za,{size:14,className:"text-muted-foreground"}),s.runtime.auto_reload==="lazy"&&c.jsx(ln,{size:14,className:"text-muted-foreground"}),s.runtime.auto_reload==="autorun"&&c.jsx(cn,{size:14,className:"text-amber-500"}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"On module change"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:s.runtime.auto_reload})]})]}),c.jsx("div",{className:"space-y-1",children:["off","lazy","autorun"].map(_e=>c.jsxs("button",{onClick:()=>g(_e),className:me("w-full flex items-center px-2 py-1 text-sm rounded hover:bg-accent",_e===s.runtime.auto_reload&&"bg-accent"),children:[_e==="off"&&c.jsx(Za,{size:12,className:"mr-2"}),_e==="lazy"&&c.jsx(ln,{size:12,className:"mr-2"}),_e==="autorun"&&c.jsx(cn,{size:12,className:"mr-2"}),c.jsx("span",{className:"capitalize",children:_e}),_e===s.runtime.auto_reload&&c.jsx("span",{className:"ml-auto",children:"\u2713"})]},_e))})]})})]}),e[86]=s.runtime.auto_reload,e[87]=g,e[88]=ve):ve=e[88],e[89]!==Y||e[90]!==ie||e[91]!==ve?(he=c.jsxs(qo,{align:"start",className:"w-64",children:[U,V,Y,oe,ie,ve]}),e[89]=Y,e[90]=ie,e[91]=ve,e[92]=he):he=e[92],e[93]!==a||e[94]!==E||e[95]!==he?(Se=c.jsx("div",{className:"flex md:hidden",children:c.jsxs(Ho,{open:a,onOpenChange:i,children:[E,he]})}),e[93]=a,e[94]=E,e[95]=he,e[96]=Se):Se=e[96],e[97]!==I||e[98]!==Se||e[99]!==y?(De=c.jsxs("div",{className:y,children:[I,Se]}),e[97]=I,e[98]=Se,e[99]=y,e[100]=De):De=e[100],De},$_=()=>{const t=H.c(24),{selectedPanel:e,isTerminalOpen:n}=ds(),{toggleApplication:o,toggleTerminal:r}=gr(),s=Ie(xP),a=V_,i=Zc.find(H_);let l;wo(i,"Error panel not found"),t[0]!==r?(l=()=>{r()},t[0]=r,t[1]=l):l=t[1],Pt("global.toggleTerminal",l);const d=un,u=i.tooltip,h=e===i.type,f=()=>o(i.type),m=a(i,s>0?"text-destructive":"");let x,g,p,b,y,v,w,S,N,C;return t[2]!==s?(x=c.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:s}),t[2]=s,t[3]=x):x=t[3],t[4]!==d||t[5]!==i||t[6]!==h||t[7]!==f||t[8]!==m||t[9]!==x?(g=c.jsxs(d,{tooltip:u,selected:h,onClick:f,"data-testid":"footer-errors",children:[m,x]}),t[4]=d,t[5]=i,t[6]=h,t[7]=f,t[8]=m,t[9]=x,t[10]=g):g=t[10],t[11]!==r?(p=()=>r(),t[11]=r,t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Ep,{className:"h-5 w-5"}),t[13]=b):b=t[13],t[14]!==n||t[15]!==p?(y=c.jsx(ub,{capability:"terminal",children:c.jsx(un,{tooltip:"Open terminal",selected:n,onClick:p,"data-testid":"footer-terminal",children:b})}),t[14]=n,t[15]=p,t[16]=y):y=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(U_,{}),w=c.jsx("div",{className:"mx-auto"}),t[17]=v,t[18]=w):(v=t[17],w=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(MC,{children:c.jsx(Ce,{content:c.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:c.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[19]=S):S=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsxs("div",{className:"flex items-center flex-shrink-0 min-w-0",children:[c.jsx(M_,{}),c.jsx(z_,{}),c.jsx(j_,{}),c.jsx(T_,{}),c.jsx(B_,{}),c.jsx(E_,{})]}),t[20]=N):N=t[20],t[21]!==y||t[22]!==g?(C=c.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 overflow-x-auto overflow-y-hidden scrollbar-thin",children:[g,y,v,w,S,N]}),t[21]=y,t[22]=g,t[23]=C):C=t[23],C};function V_(t,e){const{Icon:n}=t;return c.jsx(n,{className:me("h-5 w-5",e)})}function H_(t){return t.type==="errors"}const W_=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Nn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(q_,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(D3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},q_=t=>{const e=H.c(9),{onClose:n}=t;let o,r,s,a,i,l,d;return e[0]!==n?(o=async u=>{u.preventDefault();const h=new FormData(u.target),f=h.get("rating"),m=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),Xe({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=c.jsx(zo,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.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")?(a=c.jsxs("li",{className:"my-0",children:["Take our"," ",c.jsx("a",{href:On.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("li",{className:"my-0",children:["File a"," ",c.jsx("a",{href:On.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(ss,{children:[r,c.jsxs(as,{children:[s,c.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[a,i,c.jsxs("li",{className:"my-0",children:["Chat with us on"," ",c.jsx("a",{href:On.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),c.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?(d=c.jsx(Uo,{className:"w-fit",children:c.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=d):d=e[8],d},G_=()=>{const t=H.c(10),{selectedPanel:e}=ds(),{toggleApplication:n}=gr(),o=K_;let r,s,a,i,l,d;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=Zc.filter(X_).map(u=>c.jsx(fb,{tooltip:u.tooltip,selected:e===u.type,onClick:()=>n(u.type),children:o(u)},u.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")?(a=c.jsx(W_,{children:c.jsx(fb,{tooltip:"Send feedback!",selected:!1,children:c.jsx(dp,{className:"h-5 w-5"})})}),i=c.jsx("div",{className:"flex-1"}),l=c.jsx(Y_,{}),t[4]=a,t[5]=i,t[6]=l):(a=t[4],i=t[5],l=t[6]),t[7]!==r||t[8]!==s?(d=c.jsxs("div",{className:r,children:[s,a,i,l]}),t[7]=r,t[8]=s,t[9]=d):d=t[9],d},Y_=()=>{const t=H.c(7),e=Ie(bP);let n,o,r;return t[0]!==e?(n=e>0?c.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=c.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(J_)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=c.jsx(Ce,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},fb=t=>{const e=H.c(17);let n,o,r,s,a;e[0]!==t?({children:n,tooltip:a,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=a):(n=e[1],o=e[2],r=e[3],s=e[4],a=e[5]);const i=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let d,u,h;return e[6]!==o||e[7]!==i||e[8]!==l?(d=me("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",i,l,o),e[6]=o,e[7]=i,e[8]=l,e[9]=d):d=e[9],e[10]!==n||e[11]!==r||e[12]!==d?(u=c.jsx("button",{className:d,...r,children:n}),e[10]=n,e[11]=r,e[12]=d,e[13]=u):u=e[13],e[14]!==u||e[15]!==a?(h=c.jsx(Ce,{content:a,side:"right",delayDuration:200,children:u}),e[14]=u,e[15]=a,e[16]=h):h=e[16],h};function K_(t,e){const{Icon:n}=t;return c.jsx(n,{className:me("h-5 w-5",e)})}function X_(t){return!t.hidden&&t.position==="sidebar"}function J_(t,e){return c.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}var Cu="ScrollArea",[mb,OL]=a3(Cu),[Z_,yn]=mb(Cu),pb=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...a}=t,[i,l]=O.useState(null),[d,u]=O.useState(null),[h,f]=O.useState(null),[m,x]=O.useState(null),[g,p]=O.useState(null),[b,y]=O.useState(0),[v,w]=O.useState(0),[S,N]=O.useState(!1),[C,j]=O.useState(!1),_=ws(e,T=>l(T)),A=yP(r);return c.jsx(Z_,{scope:n,type:o,dir:A,scrollHideDelay:s,scrollArea:i,viewport:d,onViewportChange:u,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:x,scrollbarXEnabled:S,onScrollbarXEnabledChange:N,scrollbarY:g,onScrollbarYChange:p,scrollbarYEnabled:C,onScrollbarYEnabledChange:j,onCornerWidthChange:y,onCornerHeightChange:w,children:c.jsx(bs.div,{dir:A,...a,ref:_,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":v+"px",...t.style}})})});pb.displayName=Cu;var gb="ScrollAreaViewport",xb=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,a=yn(gb,n),i=O.useRef(null),l=ws(e,i,a.onViewportChange);return c.jsxs(c.Fragment,{children:[c.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}),c.jsx(bs.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:c.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});xb.displayName=gb;var Bn="ScrollAreaScrollbar",ju=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=yn(Bn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:a}=r,i=t.orientation==="horizontal";return O.useEffect(()=>(i?s(!0):a(!0),()=>{i?s(!1):a(!1)}),[i,s,a]),r.type==="hover"?c.jsx(Q_,{...o,ref:e,forceMount:n}):r.type==="scroll"?c.jsx(e6,{...o,ref:e,forceMount:n}):r.type==="auto"?c.jsx(bb,{...o,ref:e,forceMount:n}):r.type==="always"?c.jsx(Eu,{...o,ref:e}):null});ju.displayName=Bn;var Q_=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=yn(Bn,t.__scopeScrollArea),[s,a]=O.useState(!1);return O.useEffect(()=>{const i=r.scrollArea;let l=0;if(i){const d=()=>{window.clearTimeout(l),a(!0)},u=()=>{l=window.setTimeout(()=>a(!1),r.scrollHideDelay)};return i.addEventListener("pointerenter",d),i.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),i.removeEventListener("pointerenter",d),i.removeEventListener("pointerleave",u)}}},[r.scrollArea,r.scrollHideDelay]),c.jsx(Ic,{present:n||s,children:c.jsx(bb,{"data-state":s?"visible":"hidden",...o,ref:e})})}),e6=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=yn(Bn,t.__scopeScrollArea),s=t.orientation==="horizontal",a=ul(()=>l("SCROLL_END"),100),[i,l]=function(d,u){return O.useReducer((h,f)=>u[h][f]??h,d)}("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 O.useEffect(()=>{if(i==="idle"){const d=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(d)}},[i,r.scrollHideDelay,l]),O.useEffect(()=>{const d=r.viewport,u=s?"scrollLeft":"scrollTop";if(d){let h=d[u];const f=()=>{const m=d[u];h!==m&&(l("SCROLL"),a()),h=m};return d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[r.viewport,s,l,a]),c.jsx(Ic,{present:n||i!=="hidden",children:c.jsx(Eu,{"data-state":i==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:In(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:In(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),bb=O.forwardRef((t,e)=>{const n=yn(Bn,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,a]=O.useState(!1),i=t.orientation==="horizontal",l=ul(()=>{if(n.viewport){const d=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;a(i?d:u)}},10);return zr(n.viewport,l),zr(n.content,l),c.jsx(Ic,{present:o||s,children:c.jsx(Eu,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Eu=O.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=yn(Bn,t.__scopeScrollArea),s=O.useRef(null),a=O.useRef(0),[i,l]=O.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Sb(i.viewport,i.content),u={...o,sizes:i,onSizesChange:l,hasThumb:d>0&&d<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function h(f,m){return function(x,g,p,b="ltr"){const y=dl(p),v=y/2,w=g||v,S=y-w,N=p.scrollbar.paddingStart+w,C=p.scrollbar.size-p.scrollbar.paddingEnd-S,j=p.content-p.viewport,_=b==="ltr"?[0,j]:[-1*j,0];return Cb([N,C],_)(x)}(f,a.current,i,m)}return n==="horizontal"?c.jsx(t6,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=Nb(r.viewport.scrollLeft,i,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=h(f,r.dir))}}):n==="vertical"?c.jsx(n6,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=Nb(r.viewport.scrollTop,i);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=h(f))}}):null}),t6=O.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=yn(Bn,t.__scopeScrollArea),[a,i]=O.useState(),l=O.useRef(null),d=ws(e,l,s.onScrollbarXChange);return O.useEffect(()=>{l.current&&i(getComputedStyle(l.current))},[l]),c.jsx(vb,{"data-orientation":"horizontal",...r,ref:d,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":dl(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),jb(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:cl(a.paddingLeft),paddingEnd:cl(a.paddingRight)}})}})}),n6=O.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=yn(Bn,t.__scopeScrollArea),[a,i]=O.useState(),l=O.useRef(null),d=ws(e,l,s.onScrollbarYChange);return O.useEffect(()=>{l.current&&i(getComputedStyle(l.current))},[l]),c.jsx(vb,{"data-orientation":"vertical",...r,ref:d,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":dl(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),jb(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:cl(a.paddingTop),paddingEnd:cl(a.paddingBottom)}})}})}),[o6,yb]=mb(Bn),vb=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:a,onThumbPointerDown:i,onThumbPositionChange:l,onDragScroll:d,onWheelScroll:u,onResize:h,...f}=t,m=yn(Bn,n),[x,g]=O.useState(null),p=ws(e,_=>g(_)),b=O.useRef(null),y=O.useRef(""),v=m.viewport,w=o.content-o.viewport,S=Yo(u),N=Yo(l),C=ul(h,10);function j(_){if(b.current){const A=_.clientX-b.current.left,T=_.clientY-b.current.top;d({x:A,y:T})}}return O.useEffect(()=>{const _=A=>{const T=A.target;(x==null?void 0:x.contains(T))&&S(A,w)};return document.addEventListener("wheel",_,{passive:!1}),()=>document.removeEventListener("wheel",_,{passive:!1})},[v,x,w,S]),O.useEffect(N,[o,N]),zr(x,C),zr(m.content,C),c.jsx(o6,{scope:n,scrollbar:x,hasThumb:r,onThumbChange:Yo(s),onThumbPointerUp:Yo(a),onThumbPositionChange:N,onThumbPointerDown:Yo(i),children:c.jsx(bs.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:In(t.onPointerDown,_=>{_.button===0&&(_.target.setPointerCapture(_.pointerId),b.current=x.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),j(_))}),onPointerMove:In(t.onPointerMove,j),onPointerUp:In(t.onPointerUp,_=>{const A=_.target;A.hasPointerCapture(_.pointerId)&&A.releasePointerCapture(_.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),ll="ScrollAreaThumb",wb=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=yb(ll,t.__scopeScrollArea);return c.jsx(Ic,{present:n||r.hasThumb,children:c.jsx(r6,{ref:e,...o})})}),r6=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=yn(ll,n),a=yb(ll,n),{onThumbPositionChange:i}=a,l=ws(e,h=>a.onThumbChange(h)),d=O.useRef(void 0),u=ul(()=>{d.current&&(d.current(),d.current=void 0)},100);return O.useEffect(()=>{const h=s.viewport;if(h){const f=()=>{if(u(),!d.current){const m=a6(h,i);d.current=m,i()}};return i(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[s.viewport,u,i]),c.jsx(bs.div,{"data-state":a.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:In(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),m=h.clientX-f.left,x=h.clientY-f.top;a.onThumbPointerDown({x:m,y:x})}),onPointerUp:In(t.onPointerUp,a.onThumbPointerUp)})});wb.displayName=ll;var _u="ScrollAreaCorner",kb=O.forwardRef((t,e)=>{const n=yn(_u,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?c.jsx(s6,{...t,ref:e}):null});kb.displayName=_u;var s6=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=yn(_u,n),[s,a]=O.useState(0),[i,l]=O.useState(0),d=!!(s&&i);return zr(r.scrollbarX,()=>{var h;const u=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(u),l(u)}),zr(r.scrollbarY,()=>{var h;const u=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(u),a(u)}),d?c.jsx(bs.div,{...o,ref:e,style:{width:s,height:i,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function cl(t){return t?parseInt(t,10):0}function Sb(t,e){const n=t/e;return isNaN(n)?0:n}function dl(t){const e=Sb(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function Nb(t,e,n="ltr"){const o=dl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,i=s-o,l=wP(t,n==="ltr"?[0,a]:[-1*a,0]);return Cb([0,a],[0,i])(l)}function Cb(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 jb(t,e){return t>0&&t<e}var a6=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},a=n.left!==s.left,i=n.top!==s.top;(a||i)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function ul(t,e){const n=Yo(t),o=O.useRef(0);return O.useEffect(()=>()=>window.clearTimeout(o.current),[]),O.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function zr(t,e){const n=Yo(e);vP(()=>{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 Eb=pb,i6=xb,l6=kb;const _b=O.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,a,i,l,d,u;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?(a=me("relative overflow-hidden",r),n[4]=r,n[5]=a):a=n[5],n[6]!==o?(i=c.jsx(i6,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=i):i=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Ib,{}),d=c.jsx(l6,{}),n[8]=l,n[9]=d):(l=n[8],d=n[9]),n[10]!==s||n[11]!==e||n[12]!==a||n[13]!==i?(u=c.jsxs(Eb,{ref:e,className:a,...s,children:[i,l,d]}),n[10]=s,n[11]=e,n[12]=a,n[13]=i,n[14]=u):u=n[14],u});_b.displayName=Eb.displayName;const Ib=O.forwardRef((t,e)=>{const n=H.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 a=s===void 0?"vertical":s,i=a==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let d,u,h;return n[4]!==o||n[5]!==i||n[6]!==l?(d=me("flex touch-none select-none transition-colors",i,l,o),n[4]=o,n[5]=i,n[6]=l,n[7]=d):d=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(wb,{className:"relative flex-1 rounded-full bg-border"}),n[8]=u):u=n[8],n[9]!==a||n[10]!==r||n[11]!==e||n[12]!==d?(h=c.jsx(ju,{ref:e,orientation:a,className:d,...r,children:u}),n[9]=a,n[10]=r,n[11]=e,n[12]=d,n[13]=h):h=n[13],h});Ib.displayName=ju.displayName;let Iu;Iu=(t,e,n,o,r,s)=>{if(!e)return ft.warn("No active chat"),t;const a=t.chats.findIndex(h=>h.id===e);if(a===-1)return ft.warn("No active chat"),t;const i=t.chats[a],l=i.messages.findIndex(h=>h.id===n),d=[...t.chats],u=Date.now();if(l===-1)d[a]={...i,messages:[...i.messages,{id:n,role:o,content:r,timestamp:u,parts:s}],updatedAt:u};else{const h=[...i.messages];h[l]={...h[l],content:r,parts:s},d[a]={...i,messages:h,updatedAt:u}}return{...t,chats:d}},an=t=>{const e=H.c(15),{title:n,description:o,icon:r,action:s}=t;let a,i,l,d,u,h;return e[0]!==r?(a=r&&G.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=a):a=e[1],e[2]!==n?(i=c.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=i):i=e[3],e[4]!==a||e[5]!==i?(l=c.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[a,i]}),e[4]=a,e[5]=i,e[6]=l):l=e[6],e[7]!==o?(d=c.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=d):d=e[8],e[9]!==s?(u=s&&c.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=u):u=e[10],e[11]!==l||e[12]!==d||e[13]!==u?(h=c.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,d,u]}),e[11]=l,e[12]=d,e[13]=u,e[14]=h):h=e[14],h};function DL(){}function PL(){}const c6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,d6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,u6={};function Tb(t,e){return(u6.jsx?d6:c6).test(t)}const h6=/[ \t\n\f\r]/g;function Ab(t){return t.replace(h6,"")===""}class sa{constructor(e,n,o){this.normal=n,this.property=e,o&&(this.space=o)}}function Mb(t,e){const n={},o={};for(const r of t)Object.assign(n,r.property),Object.assign(o,r.normal);return new sa(n,o,e)}function Tu(t){return t.toLowerCase()}sa.prototype.normal={},sa.prototype.property={},sa.prototype.space=void 0;class en{constructor(e,n){this.attribute=n,this.property=e}}en.prototype.attribute="",en.prototype.booleanish=!1,en.prototype.boolean=!1,en.prototype.commaOrSpaceSeparated=!1,en.prototype.commaSeparated=!1,en.prototype.defined=!1,en.prototype.mustUseProperty=!1,en.prototype.number=!1,en.prototype.overloadedBoolean=!1,en.prototype.property="",en.prototype.spaceSeparated=!1,en.prototype.space=void 0;let f6=0;const Ye=lr(),Et=lr(),Au=lr(),fe=lr(),lt=lr(),Br=lr(),hn=lr();function lr(){return 2**++f6}const Mu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Et,commaOrSpaceSeparated:hn,commaSeparated:Br,number:fe,overloadedBoolean:Au,spaceSeparated:lt},Symbol.toStringTag,{value:"Module"})),Ou=Object.keys(Mu);class Du extends en{constructor(e,n,o,r){let s=-1;if(super(e,n),Ob(this,"space",r),typeof o=="number")for(;++s<Ou.length;){const a=Ou[s];Ob(this,Ou[s],(o&Mu[a])===Mu[a])}}}function Ob(t,e,n){n&&(t[e]=n)}function Ur(t){const e={},n={};for(const[o,r]of Object.entries(t.properties)){const s=new Du(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[Tu(o)]=o,n[Tu(s.attribute)]=o}return new sa(e,n,t.space)}Du.prototype.defined=!0;const Db=Ur({properties:{ariaActiveDescendant:null,ariaAtomic:Et,ariaAutoComplete:null,ariaBusy:Et,ariaChecked:Et,ariaColCount:fe,ariaColIndex:fe,ariaColSpan:fe,ariaControls:lt,ariaCurrent:null,ariaDescribedBy:lt,ariaDetails:null,ariaDisabled:Et,ariaDropEffect:lt,ariaErrorMessage:null,ariaExpanded:Et,ariaFlowTo:lt,ariaGrabbed:Et,ariaHasPopup:null,ariaHidden:Et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lt,ariaLevel:fe,ariaLive:null,ariaModal:Et,ariaMultiLine:Et,ariaMultiSelectable:Et,ariaOrientation:null,ariaOwns:lt,ariaPlaceholder:null,ariaPosInSet:fe,ariaPressed:Et,ariaReadOnly:Et,ariaRelevant:null,ariaRequired:Et,ariaRoleDescription:lt,ariaRowCount:fe,ariaRowIndex:fe,ariaRowSpan:fe,ariaSelected:Et,ariaSetSize:fe,ariaSort:null,ariaValueMax:fe,ariaValueMin:fe,ariaValueNow:fe,ariaValueText:null,role:null},transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase()});function Pb(t,e){return e in t?t[e]:e}function Rb(t,e){return Pb(t,e.toLowerCase())}const m6=Ur({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Br,acceptCharset:lt,accessKey:lt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:lt,autoFocus:Ye,autoPlay:Ye,blocking:lt,capture:null,charSet:null,checked:Ye,cite:null,className:lt,cols:fe,colSpan:null,content:null,contentEditable:Et,controls:Ye,controlsList:lt,coords:fe|Br,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:Au,draggable:Et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:lt,height:fe,hidden:Au,high:fe,href:null,hrefLang:null,htmlFor:lt,httpEquiv:lt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:lt,itemRef:lt,itemScope:Ye,itemType:lt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:fe,manifest:null,max:null,maxLength:fe,media:null,method:null,min:null,minLength:fe,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:fe,pattern:null,ping:lt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:lt,required:Ye,reversed:Ye,rows:fe,rowSpan:fe,sandbox:lt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:fe,sizes:null,slot:null,span:fe,spellCheck:Et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:fe,step:null,style:null,tabIndex:fe,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:Et,width:fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lt,axis:null,background:null,bgColor:null,border:fe,borderColor:null,bottomMargin:fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:fe,leftMargin:fe,link:null,longDesc:null,lowSrc:null,marginHeight:fe,marginWidth:fe,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:fe,rules:null,scheme:null,scrolling:Et,standby:null,summary:null,text:null,topMargin:fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:fe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:fe,security:null,unselectable:null},space:"html",transform:Rb}),p6=Ur({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"},properties:{about:hn,accentHeight:fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:fe,amplitude:fe,arabicForm:null,ascent:fe,attributeName:null,attributeType:null,azimuth:fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:fe,by:null,calcMode:null,capHeight:fe,className:lt,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:fe,diffuseConstant:fe,direction:null,display:null,dur:null,divisor:fe,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:fe,enableBackground:null,end:null,event:null,exponent:fe,externalResourcesRequired:null,fill:null,fillOpacity:fe,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:Br,g2:Br,glyphName:Br,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:fe,horizOriginX:fe,horizOriginY:fe,id:null,ideographic:fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:fe,k:fe,k1:fe,k2:fe,k3:fe,k4:fe,kernelMatrix:hn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:fe,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:fe,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:fe,overlineThickness:fe,paintOrder:null,panose1:null,path:null,pathLength:fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:lt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:fe,pointsAtY:fe,pointsAtZ:fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:hn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:hn,rev:hn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:hn,requiredFeatures:hn,requiredFonts:hn,requiredFormats:hn,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:fe,specularExponent:fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:fe,strikethroughThickness:fe,string:null,stroke:null,strokeDashArray:hn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:fe,strokeOpacity:fe,strokeWidth:null,style:null,surfaceScale:fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:hn,tabIndex:fe,tableValues:null,target:null,targetX:fe,targetY:fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:hn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:fe,underlineThickness:fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:fe,values:null,vAlphabetic:fe,vMathematical:fe,vectorEffect:null,vHanging:fe,vIdeographic:fe,version:null,vertAdvY:fe,vertOriginX:fe,vertOriginY:fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Pb}),Lb=Ur({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase()}),Fb=Ur({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Rb}),zb=Ur({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase()}),g6={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"},x6=/[A-Z]/g,Bb=/-[a-z]/g,b6=/^data[-\w.:]+$/i;function y6(t){return"-"+t.toLowerCase()}function v6(t){return t.charAt(1).toUpperCase()}const w6=Mb([Db,m6,Lb,Fb,zb],"html"),Pu=Mb([Db,p6,Lb,Fb,zb],"svg");var Ub,$r={},$b,hl,Vb,aa={};function k6(){if($b)return aa;$b=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,s=function(i,l){return l.toUpperCase()},a=function(i,l){return"".concat(l,"-")};return aa.camelCase=function(i,l){return l===void 0&&(l={}),function(d){return!d||n.test(d)||t.test(d)}(i)?i:(i=i.toLowerCase(),(i=l.reactCompat?i.replace(r,a):i.replace(o,a)).replace(e,s))},aa}var S6=function(){if(Vb)return hl;Vb=1;var t=(hl&&hl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}})(function(){if(Ub)return $r;Ub=1;var o=$r&&$r.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty($r,"__esModule",{value:!0}),$r.default=function(s,a){var i=null;if(!s||typeof s!="string")return i;var l=(0,r.default)(s),d=typeof a=="function";return l.forEach(function(u){if(u.type==="declaration"){var h=u.property,f=u.value;d?a(h,f,u):f&&((i=i||{})[h]=f)}}),i};var r=o(kP());return $r}()),e=k6();function n(o,r){var s={};return o&&typeof o=="string"&&(0,t.default)(o,function(a,i){a&&i&&(s[(0,e.camelCase)(a,r)]=i)}),s}return n.default=n,hl=n}();const N6=P3(S6),Hb=Wb("end"),Ru=Wb("start");function Wb(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 ia(t){return t&&typeof t=="object"?"position"in t||"type"in t?qb(t.position):"start"in t||"end"in t?qb(t):"line"in t||"column"in t?Lu(t):"":""}function Lu(t){return Gb(t&&t.line)+":"+Gb(t&&t.column)}function qb(t){return Lu(t&&t.start)+"-"+Lu(t&&t.end)}function Gb(t){return t&&typeof t=="number"?t:1}class Vt extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},a=!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&&(a=!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 i=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=i?i.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=i?i.line:void 0,this.name=ia(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=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}Vt.prototype.file="",Vt.prototype.name="",Vt.prototype.reason="",Vt.prototype.message="",Vt.prototype.stack="",Vt.prototype.column=void 0,Vt.prototype.line=void 0,Vt.prototype.ancestors=void 0,Vt.prototype.cause=void 0,Vt.prototype.fatal=void 0,Vt.prototype.place=void 0,Vt.prototype.ruleId=void 0,Vt.prototype.source=void 0;const Fu={}.hasOwnProperty,C6=new Map,j6=/[A-Z]/g,E6=new Set(["table","tbody","thead","tfoot","tr"]),_6=new Set(["td","th"]),Yb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function I6(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(a,i){return l;function l(d,u,h,f){const m=Array.isArray(h.children),x=Ru(d);return i(u,h,f,m,{columnNumber:x?x.column-1:void 0,fileName:a,lineNumber:x?x.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(a,i,l){return d;function d(u,h,f,m){const x=Array.isArray(f.children)?l:i;return m?x(h,f,m):x(h,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"?Pu:w6,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Kb(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function Kb(t,e,n){return e.type==="element"?function(o,r,s){const a=o.schema;let i=a;r.tagName.toLowerCase()==="svg"&&a.space==="html"&&(i=Pu,o.schema=i),o.ancestors.push(r);const l=Jb(o,r.tagName,!1),d=function(h,f){const m={};let x,g;for(g in f.properties)if(g!=="children"&&Fu.call(f.properties,g)){const p=T6(h,g,f.properties[g]);if(p){const[b,y]=p;h.tableCellAlignToStyle&&b==="align"&&typeof y=="string"&&_6.has(f.tagName)?x=y:m[b]=y}}return x&&((m.style||(m.style={}))[h.stylePropertyNameCase==="css"?"text-align":"textAlign"]=x),m}(o,r);let u=Bu(o,r);return E6.has(r.tagName)&&(u=u.filter(function(h){return typeof h!="string"||!(typeof(f=h)=="object"?f.type==="text"&&Ab(f.value):Ab(f));var f})),Xb(o,d,l,r),zu(d,u),o.ancestors.pop(),o.schema=a,o.create(r,l,d,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)}la(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const a=o.schema;let i=a;r.name==="svg"&&a.space==="html"&&(i=Pu,o.schema=i),o.ancestors.push(r);const l=r.name===null?o.Fragment:Jb(o,r.name,!0),d=function(h,f){const m={};for(const x of f.attributes)if(x.type==="mdxJsxExpressionAttribute")if(x.data&&x.data.estree&&h.evaluater){const g=x.data.estree.body[0];g.type;const p=g.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,h.evaluater.evaluateExpression(b.argument))}else la(h,f.position);else{const g=x.name;let p;if(x.value&&typeof x.value=="object")if(x.value.data&&x.value.data.estree&&h.evaluater){const b=x.value.data.estree.body[0];b.type,p=h.evaluater.evaluateExpression(b.expression)}else la(h,f.position);else p=x.value===null||x.value;m[g]=p}return m}(o,r),u=Bu(o,r);return Xb(o,d,l,r),zu(d,u),o.ancestors.pop(),o.schema=a,o.create(r,l,d,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);la(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const a={};return zu(a,Bu(o,r)),o.create(r,o.Fragment,a,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function Xb(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function zu(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Bu(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:C6;for(;++o<e.children.length;){const s=e.children[o];let a;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const d=r.get(l)||0;a=l+"-"+d,r.set(l,d+1)}}const i=Kb(t,s,a);i!==void 0&&n.push(i)}return n}function T6(t,e,n){const o=function(r,s){const a=Tu(s);let i=s,l=en;if(a in r.normal)return r.property[r.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&b6.test(s)){if(s.charAt(4)==="-"){const d=s.slice(5).replace(Bb,v6);i="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=s.slice(4);if(!Bb.test(d)){let u=d.replace(x6,y6);u.charAt(0)!=="-"&&(u="-"+u),s="data"+u}}l=Du}return new l(i,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,a){try{return N6(a,{reactCompat:!0})}catch(i){if(s.ignoreInvalidStyle)return{};const l=i,d=new Vt("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw d.file=s.filePath||void 0,d.url=Yb+"#cannot-parse-style-attribute",d}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const a={};let i;for(i in s)Fu.call(s,i)&&(a[A6(i)]=s[i]);return a}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?g6[o.property]||o.property:o.attribute,n]}}function Jb(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,a=-1;for(;++a<r.length;){const i=Tb(r[a])?{type:"Identifier",name:r[a]}:{type:"Literal",value:r[a]};s=s?{type:"MemberExpression",object:s,property:i,computed:!!(a&&i.type==="Literal"),optional:!1}:i}o=s}else o=Tb(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 Fu.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);la(t)}function la(t,e){const n=new Vt("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=Yb+"#cannot-handle-mdx-estrees-without-createevaluater",n}function A6(t){let e=t.replace(j6,M6);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function M6(t){return"-"+t.toLowerCase()}const Uu={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"]},fl={};function Zb(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 Qb(t.children,e,n)}return Array.isArray(t)?Qb(t,e,n):""}function Qb(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=Zb(t[r],e,n);return o.join("")}const ey=document.createElement("i");function $u(t){const e="&"+t+";";ey.innerHTML=e;const n=ey.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function Un(t,e,n,o){const r=t.length;let s,a=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);a<o.length;)s=o.slice(a,a+1e4),s.unshift(e,0),t.splice(...s),a+=1e4,e+=1e4}function vn(t,e){return t.length>0?(Un(t,t.length,0,e),t):e}const ty={}.hasOwnProperty;function O6(t,e){let n;for(n in e){const o=(ty.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){ty.call(o,s)||(o[s]=[]);const a=r[s];D6(o[s],Array.isArray(a)?a:a?[a]:[])}}}function D6(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);Un(t,0,0,o)}function ny(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 Vr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $n=Ao(/[A-Za-z]/),fn=Ao(/[\dA-Za-z]/),P6=Ao(/[#-'*+\--9=?A-Z^-~]/);function Vu(t){return t!==null&&(t<32||t===127)}const Hu=Ao(/\d/),R6=Ao(/[\dA-Fa-f]/),L6=Ao(/[!-/:-@[-`{-~]/);function $e(t){return t!==null&&t<-2}function tn(t){return t!==null&&(t<0||t===32)}function rt(t){return t===-2||t===-1||t===32}const F6=Ao(new RegExp("\\p{P}|\\p{S}","u")),z6=Ao(/\s/);function Ao(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function Hr(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let a="";if(s===37&&fn(t.charCodeAt(n+1))&&fn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const i=t.charCodeAt(n+1);s<56320&&i>56319&&i<57344?(a=String.fromCharCode(s,i),r=1):a="\uFFFD"}else a=String.fromCharCode(s);a&&(e.push(t.slice(o,n),encodeURIComponent(a)),o=n+r+1,a=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function ct(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(i){return rt(i)?(t.enter(n),a(i)):e(i)};function a(i){return rt(i)&&s++<r?(t.consume(i),a):(t.exit(n),e(i))}}const B6={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"),ct(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const a=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):$e(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},U6={tokenize:function(t){const e=this,n=[];let o,r,s,a=0;return i;function i(v){if(a<n.length){const w=n[a];return e.containerState=w[1],t.attempt(w[0].continuation,l,d)(v)}return d(v)}function l(v){if(a++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&y();const w=e.events.length;let S,N=w;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){S=e.events[N][1].end;break}b(a);let C=w;for(;C<e.events.length;)e.events[C][1].end={...S},C++;return Un(e.events,N+1,0,e.events.slice(w)),e.events.length=C,d(v)}return i(v)}function d(v){if(a===n.length){if(!o)return f(v);if(o.currentConstruct&&o.currentConstruct.concrete)return x(v);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(oy,u,h)(v)}function u(v){return o&&y(),b(a),f(v)}function h(v){return e.parser.lazy[e.now().line]=a!==n.length,s=e.now().offset,x(v)}function f(v){return e.containerState={},t.attempt(oy,m,x)(v)}function m(v){return a++,n.push([e.currentConstruct,e.containerState]),f(v)}function x(v){return v===null?(o&&y(),b(0),void t.consume(v)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(v))}function g(v){return v===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(v)):$e(v)?(t.consume(v),p(t.exit("chunkFlow")),a=0,e.interrupt=void 0,i):(t.consume(v),g)}function p(v,w){const S=e.sliceStream(v);if(w&&S.push(null),v.previous=r,r&&(r.next=v),r=v,o.defineSkip(v.start),o.write(S),e.parser.lazy[v.start.line]){let N=o.events.length;for(;N--;)if(o.events[N][1].start.offset<s&&(!o.events[N][1].end||o.events[N][1].end.offset>s))return;const C=e.events.length;let j,_,A=C;for(;A--;)if(e.events[A][0]==="exit"&&e.events[A][1].type==="chunkFlow"){if(j){_=e.events[A][1].end;break}j=!0}for(b(a),N=C;N<e.events.length;)e.events[N][1].end={..._},N++;Un(e.events,A+1,0,e.events.slice(C)),e.events.length=N}}function b(v){let w=n.length;for(;w-- >v;){const S=n[w];e.containerState=S[1],S[0].exit.call(e,t)}n.length=v}function y(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},oy={tokenize:function(t,e,n){return ct(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function ry(t){return t===null||tn(t)||z6(t)?1:F6(t)?2:void 0}function Wu(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 qu={name:"attention",resolveAll:function(t,e){let n,o,r,s,a,i,l,d,u=-1;for(;++u<t.length;)if(t[u][0]==="enter"&&t[u][1].type==="attentionSequence"&&t[u][1]._close){for(n=u;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[u][1]).charCodeAt(0)){if((t[n][1]._close||t[u][1]._open)&&(t[u][1].end.offset-t[u][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[u][1].end.offset-t[u][1].start.offset)%3))continue;i=t[n][1].end.offset-t[n][1].start.offset>1&&t[u][1].end.offset-t[u][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[u][1].start};sy(h,-i),sy(f,i),s={type:i>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},a={type:i>1?"strongSequence":"emphasisSequence",start:{...t[u][1].start},end:f},r={type:i>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[u][1].start}},o={type:i>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},t[n][1].end={...s.start},t[u][1].start={...a.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=vn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=vn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=vn(l,Wu(e.parser.constructs.insideSpan.null,t.slice(n+1,u),e)),l=vn(l,[["exit",r,e],["enter",a,e],["exit",a,e],["exit",o,e]]),t[u][1].end.offset-t[u][1].start.offset?(d=2,l=vn(l,[["enter",t[u][1],e],["exit",t[u][1],e]])):d=0,Un(t,n-1,u-n+3,l),u=n+l.length-d-2;break}}for(u=-1;++u<t.length;)t[u][1].type==="attentionSequence"&&(t[u][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=ry(o);let s;return function(i){return s=i,t.enter("attentionSequence"),a(i)};function a(i){if(i===s)return t.consume(i),a;const l=t.exit("attentionSequence"),d=ry(i),u=!d||d===2&&r||n.includes(i),h=!r||r===2&&d||n.includes(o);return l._open=!!(s===42?u:u&&(r||!h)),l._close=!!(s===42?h:h&&(d||!u)),e(i)}}};function sy(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const $6={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 $n(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||fn(f)?(o=1,a(f)):l(f)}function a(f){return f===58?(t.consume(f),o=0,i):(f===43||f===45||f===46||fn(f))&&o++<32?(t.consume(f),a):(o=0,l(f))}function i(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||Vu(f)?n(f):(t.consume(f),i)}function l(f){return f===64?(t.consume(f),d):P6(f)?(t.consume(f),l):n(f)}function d(f){return fn(f)?u(f):n(f)}function u(f){return f===46?(t.consume(f),o=0,d):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||fn(f))&&o++<63){const m=f===45?h:u;return t.consume(f),m}return n(f)}}},ml={partial:!0,tokenize:function(t,e,n){return function(r){return rt(r)?ct(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||$e(r)?e(r):n(r)}}},ay={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return rt(s)?ct(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(ay,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 a=o.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return rt(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},iy={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 L6(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},ly={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,a=0;return function(u){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),i};function i(u){return u===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(u),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=fn,d(u))}function l(u){return u===88||u===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(u),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=R6,d):(t.enter("characterReferenceValue"),r=7,s=Hu,d(u))}function d(u){if(u===59&&a){const h=t.exit("characterReferenceValue");return s!==fn||$u(o.sliceSerialize(h))?(t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(u)}return s(u)&&a++<r?(t.consume(u),d):n(u)}}},cy={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)}}},dy={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(v,w,S){let N=0;return C;function C(P){return v.enter("lineEnding"),v.consume(P),v.exit("lineEnding"),j}function j(P){return v.enter("codeFencedFence"),rt(P)?ct(v,_,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):_(P)}function _(P){return P===s?(v.enter("codeFencedFenceSequence"),A(P)):S(P)}function A(P){return P===s?(N++,v.consume(P),A):N>=i?(v.exit("codeFencedFenceSequence"),rt(P)?ct(v,T,"whitespace")(P):T(P)):S(P)}function T(P){return P===null||$e(P)?(v.exit("codeFencedFence"),w(P)):S(P)}}};let s,a=0,i=0;return function(v){return function(w){const S=o.events[o.events.length-1];return a=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,s=w,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(w)}(v)};function l(v){return v===s?(i++,t.consume(v),l):i<3?n(v):(t.exit("codeFencedFenceSequence"),rt(v)?ct(t,d,"whitespace")(v):d(v))}function d(v){return v===null||$e(v)?(t.exit("codeFencedFence"),o.interrupt?e(v):t.check(cy,m,y)(v)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),u(v))}function u(v){return v===null||$e(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(v)):rt(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ct(t,h,"whitespace")(v)):v===96&&v===s?n(v):(t.consume(v),u)}function h(v){return v===null||$e(v)?d(v):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===null||$e(v)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(v)):v===96&&v===s?n(v):(t.consume(v),f)}function m(v){return t.attempt(r,y,x)(v)}function x(v){return t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g}function g(v){return a>0&&rt(v)?ct(t,p,"linePrefix",a+1)(v):p(v)}function p(v){return v===null||$e(v)?t.check(cy,m,y)(v):(t.enter("codeFlowValue"),b(v))}function b(v){return v===null||$e(v)?(t.exit("codeFlowValue"),p(v)):(t.consume(v),b)}function y(v){return t.exit("codeFenced"),e(v)}}},Gu={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),ct(t,r,"linePrefix",5)(l)};function r(l){const d=o.events[o.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?i(l):$e(l)?t.attempt(V6,s,i)(l):(t.enter("codeFlowValue"),a(l))}function a(l){return l===null||$e(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),a)}function i(l){return t.exit("codeIndented"),e(l)}}},V6={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(a){return o.parser.lazy[o.now().line]?n(a):$e(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),r):ct(t,s,"linePrefix",5)(a)}function s(a){const i=o.events[o.events.length-1];return i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(a):$e(a)?r(a):n(a)}}},H6={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(u){return t.enter("codeText"),t.enter("codeTextSequence"),a(u)};function a(u){return u===96?(t.consume(u),s++,a):(t.exit("codeTextSequence"),i(u))}function i(u){return u===null?n(u):u===32?(t.enter("space"),t.consume(u),t.exit("space"),i):u===96?(r=t.enter("codeTextSequence"),o=0,d(u)):$e(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),i):(t.enter("codeTextData"),l(u))}function l(u){return u===null||u===32||u===96||$e(u)?(t.exit("codeTextData"),i(u)):(t.consume(u),l)}function d(u){return u===96?(t.consume(u),o++,d):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(u)):(r.type="codeTextData",l(u))}}};class W6{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&&ca(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),ca(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ca(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);ca(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);ca(this.left,n.reverse())}}}function ca(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 uy(t){const e={};let n,o,r,s,a,i,l,d=-1;const u=new W6(t);for(;++d<u.length;){for(;d in e;)d=e[d];if(n=u.get(d),d&&n[1].type==="chunkFlow"&&u.get(d-1)[1].type==="listItemPrefix"&&(i=n[1]._tokenizer.events,r=0,r<i.length&&i[r][1].type==="lineEndingBlank"&&(r+=2),r<i.length&&i[r][1].type==="content"))for(;++r<i.length&&i[r][1].type!=="content";)i[r][1].type==="chunkText"&&(i[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,q6(u,d)),d=e[d],l=!0);else if(n[1]._container){for(r=d,o=void 0;r--;)if(s=u.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(u.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);else if(s[1].type!=="linePrefix"&&s[1].type!=="listItemIndent")break;o&&(n[1].end={...u.get(o)[1].start},a=u.slice(o,d),a.unshift(n),u.splice(o,d-o+1,a))}}return Un(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function q6(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[];let a=n._tokenizer;a||(a=o.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const i=a.events,l=[],d={};let u,h,f=-1,m=n,x=0,g=0;const p=[g];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(u=o.sliceStream(m),m.next||u.push(null),h&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<i.length;)i[f][0]==="exit"&&i[f-1][0]==="enter"&&i[f][1].type===i[f-1][1].type&&i[f][1].start.line!==i[f][1].end.line&&(g=f+1,p.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=i.slice(p[f],p[f+1]),y=s.pop();l.push([y,y+b.length-1]),t.splice(y,2,b)}for(l.reverse(),f=-1;++f<l.length;)d[x+l[f][0]]=x+l[f][1],x+=l[f][1]-l[f][0]-1;return d}const G6={resolve:function(t){return uy(t),t},tokenize:function(t,e){let n;return function(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(a)};function o(a){return a===null?r(a):$e(a)?t.check(Y6,s,r)(a):(t.consume(a),o)}function r(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function s(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},Y6={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"),ct(t,r,"linePrefix")};function r(s){if(s===null||$e(s))return n(s);const a=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function hy(t,e,n,o,r,s,a,i,l){const d=l||Number.POSITIVE_INFINITY;let u=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),h):p===null||p===32||p===41||Vu(p)?n(p):(t.enter(o),t.enter(a),t.enter(i),t.enter("chunkString",{contentType:"string"}),x(p))};function h(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(i),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(i),h(p)):p===null||p===60||$e(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 x(p){return u||p!==null&&p!==41&&!tn(p)?u<d&&p===40?(t.consume(p),u++,x):p===41?(t.consume(p),u--,x):p===null||p===32||p===40||Vu(p)?n(p):(t.consume(p),p===92?g:x):(t.exit("chunkString"),t.exit(i),t.exit(a),t.exit(o),e(p))}function g(p){return p===40||p===41||p===92?(t.consume(p),x):x(p)}}function fy(t,e,n,o,r,s){const a=this;let i,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),d};function d(f){return l>999||f===null||f===91||f===93&&!i||f===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):$e(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||$e(f)||l++>999?(t.exit("chunkString"),d(f)):(t.consume(f),i||(i=!rt(f)),f===92?h:u)}function h(f){return f===91||f===92||f===93?(t.consume(f),l++,u):u(f)}}function my(t,e,n,o,r,s){let a;return function(h){return h===34||h===39||h===40?(t.enter(o),t.enter(r),t.consume(h),t.exit(r),a=h===40?41:h,i):n(h)};function i(h){return h===a?(t.enter(r),t.consume(h),t.exit(r),t.exit(o),e):(t.enter(s),l(h))}function l(h){return h===a?(t.exit(s),i(a)):h===null?n(h):$e(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),ct(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||$e(h)?(t.exit("chunkString"),l(h)):(t.consume(h),h===92?u:d)}function u(h){return h===a||h===92?(t.consume(h),d):d(h)}}function da(t,e){let n;return function o(r){return $e(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):rt(r)?ct(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const K6={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(h){return t.enter("definition"),function(f){return fy.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(h)};function s(h){return r=Vr(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),a):n(h)}function a(h){return tn(h)?da(t,i)(h):i(h)}function i(h){return hy(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function l(h){return t.attempt(X6,d,d)(h)}function d(h){return rt(h)?ct(t,u,"whitespace")(h):u(h)}function u(h){return h===null||$e(h)?(t.exit("definition"),o.parser.defined.push(r),e(h)):n(h)}}},X6={partial:!0,tokenize:function(t,e,n){return function(a){return tn(a)?da(t,o)(a):n(a)};function o(a){return my(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function r(a){return rt(a)?ct(t,s,"whitespace")(a):s(a)}function s(a){return a===null||$e(a)?e(a):n(a)}}},J6={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return $e(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},Z6={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"},Un(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(d){return t.enter("atxHeadingSequence"),r(d)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||tn(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),a(l)):l===null||$e(l)?(t.exit("atxHeading"),e(l)):rt(l)?ct(t,s,"whitespace")(l):(t.enter("atxHeadingText"),i(l))}function a(l){return l===35?(t.consume(l),a):(t.exit("atxHeadingSequence"),s(l))}function i(l){return l===null||l===35||tn(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),i)}}},Q6=["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"],py=["pre","script","style","textarea"],eI={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,a,i,l;return function(E){return function(U){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(U),d}(E)};function d(E){return E===33?(t.consume(E),u):E===47?(t.consume(E),s=!0,m):E===63?(t.consume(E),r=3,o.interrupt?e:I):$n(E)?(t.consume(E),a=String.fromCharCode(E),x):n(E)}function u(E){return E===45?(t.consume(E),r=2,h):E===91?(t.consume(E),r=5,i=0,f):$n(E)?(t.consume(E),r=4,o.interrupt?e:I):n(E)}function h(E){return E===45?(t.consume(E),o.interrupt?e:I):n(E)}function f(E){return E==="CDATA[".charCodeAt(i++)?(t.consume(E),i===6?o.interrupt?e:A:f):n(E)}function m(E){return $n(E)?(t.consume(E),a=String.fromCharCode(E),x):n(E)}function x(E){if(E===null||E===47||E===62||tn(E)){const U=E===47,V=a.toLowerCase();return U||s||!py.includes(V)?Q6.includes(a.toLowerCase())?(r=6,U?(t.consume(E),g):o.interrupt?e(E):A(E)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(E):s?p(E):b(E)):(r=1,o.interrupt?e(E):A(E))}return E===45||fn(E)?(t.consume(E),a+=String.fromCharCode(E),x):n(E)}function g(E){return E===62?(t.consume(E),o.interrupt?e:A):n(E)}function p(E){return rt(E)?(t.consume(E),p):j(E)}function b(E){return E===47?(t.consume(E),j):E===58||E===95||$n(E)?(t.consume(E),y):rt(E)?(t.consume(E),b):j(E)}function y(E){return E===45||E===46||E===58||E===95||fn(E)?(t.consume(E),y):v(E)}function v(E){return E===61?(t.consume(E),w):rt(E)?(t.consume(E),v):b(E)}function w(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(t.consume(E),l=E,S):rt(E)?(t.consume(E),w):N(E)}function S(E){return E===l?(t.consume(E),l=null,C):E===null||$e(E)?n(E):(t.consume(E),S)}function N(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||tn(E)?v(E):(t.consume(E),N)}function C(E){return E===47||E===62||rt(E)?b(E):n(E)}function j(E){return E===62?(t.consume(E),_):n(E)}function _(E){return E===null||$e(E)?A(E):rt(E)?(t.consume(E),_):n(E)}function A(E){return E===45&&r===2?(t.consume(E),M):E===60&&r===1?(t.consume(E),R):E===62&&r===4?(t.consume(E),k):E===63&&r===3?(t.consume(E),I):E===93&&r===5?(t.consume(E),D):!$e(E)||r!==6&&r!==7?E===null||$e(E)?(t.exit("htmlFlowData"),T(E)):(t.consume(E),A):(t.exit("htmlFlowData"),t.check(tI,B,T)(E))}function T(E){return t.check(nI,P,B)(E)}function P(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),L}function L(E){return E===null||$e(E)?T(E):(t.enter("htmlFlowData"),A(E))}function M(E){return E===45?(t.consume(E),I):A(E)}function R(E){return E===47?(t.consume(E),a="",z):A(E)}function z(E){if(E===62){const U=a.toLowerCase();return py.includes(U)?(t.consume(E),k):A(E)}return $n(E)&&a.length<8?(t.consume(E),a+=String.fromCharCode(E),z):A(E)}function D(E){return E===93?(t.consume(E),I):A(E)}function I(E){return E===62?(t.consume(E),k):E===45&&r===2?(t.consume(E),I):A(E)}function k(E){return E===null||$e(E)?(t.exit("htmlFlowData"),B(E)):(t.consume(E),k)}function B(E){return t.exit("htmlFlow"),e(E)}}},tI={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(ml,e,n)}}},nI={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return $e(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)}}},oI={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,a;return function(k){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(k),i};function i(k){return k===33?(t.consume(k),l):k===47?(t.consume(k),w):k===63?(t.consume(k),y):$n(k)?(t.consume(k),C):n(k)}function l(k){return k===45?(t.consume(k),d):k===91?(t.consume(k),s=0,m):$n(k)?(t.consume(k),b):n(k)}function d(k){return k===45?(t.consume(k),f):n(k)}function u(k){return k===null?n(k):k===45?(t.consume(k),h):$e(k)?(a=u,z(k)):(t.consume(k),u)}function h(k){return k===45?(t.consume(k),f):u(k)}function f(k){return k===62?R(k):k===45?h(k):u(k)}function m(k){return k==="CDATA[".charCodeAt(s++)?(t.consume(k),s===6?x:m):n(k)}function x(k){return k===null?n(k):k===93?(t.consume(k),g):$e(k)?(a=x,z(k)):(t.consume(k),x)}function g(k){return k===93?(t.consume(k),p):x(k)}function p(k){return k===62?R(k):k===93?(t.consume(k),p):x(k)}function b(k){return k===null||k===62?R(k):$e(k)?(a=b,z(k)):(t.consume(k),b)}function y(k){return k===null?n(k):k===63?(t.consume(k),v):$e(k)?(a=y,z(k)):(t.consume(k),y)}function v(k){return k===62?R(k):y(k)}function w(k){return $n(k)?(t.consume(k),S):n(k)}function S(k){return k===45||fn(k)?(t.consume(k),S):N(k)}function N(k){return $e(k)?(a=N,z(k)):rt(k)?(t.consume(k),N):R(k)}function C(k){return k===45||fn(k)?(t.consume(k),C):k===47||k===62||tn(k)?j(k):n(k)}function j(k){return k===47?(t.consume(k),R):k===58||k===95||$n(k)?(t.consume(k),_):$e(k)?(a=j,z(k)):rt(k)?(t.consume(k),j):R(k)}function _(k){return k===45||k===46||k===58||k===95||fn(k)?(t.consume(k),_):A(k)}function A(k){return k===61?(t.consume(k),T):$e(k)?(a=A,z(k)):rt(k)?(t.consume(k),A):j(k)}function T(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(t.consume(k),r=k,P):$e(k)?(a=T,z(k)):rt(k)?(t.consume(k),T):(t.consume(k),L)}function P(k){return k===r?(t.consume(k),r=void 0,M):k===null?n(k):$e(k)?(a=P,z(k)):(t.consume(k),P)}function L(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||tn(k)?j(k):(t.consume(k),L)}function M(k){return k===47||k===62||tn(k)?j(k):n(k)}function R(k){return k===62?(t.consume(k),t.exit("htmlTextData"),t.exit("htmlText"),e):n(k)}function z(k){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),D}function D(k){return rt(k)?ct(t,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):I(k)}function I(k){return t.enter("htmlTextData"),a(k)}}},Yu={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&&Un(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,a=t.length,i=0;for(;a--;)if(n=t[a][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[a][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[a][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=a,n.type!=="labelLink")){i=2;break}}else n.type==="labelEnd"&&(r=a);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},u={type:"labelText",start:{...t[o+i+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",d,e]],s=vn(s,t.slice(o+1,o+i+3)),s=vn(s,[["enter",u,e]]),s=vn(s,Wu(e.parser.constructs.insideSpan.null,t.slice(o+i+4,r-3),e)),s=vn(s,[["exit",u,e],t[r-2],t[r-1],["exit",d,e]]),s=vn(s,t.slice(r+1)),s=vn(s,[["exit",l,e]]),Un(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,a=o.events.length;for(;a--;)if((o.events[a][1].type==="labelImage"||o.events[a][1].type==="labelLink")&&!o.events[a][1]._balanced){r=o.events[a][1];break}return function(h){return r?r._inactive?u(h):(s=o.parser.defined.includes(Vr(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),i):n(h)};function i(h){return h===40?t.attempt(rI,d,s?d:u)(h):h===91?t.attempt(sI,d,s?l:u)(h):s?d(h):u(h)}function l(h){return t.attempt(aI,d,u)(h)}function d(h){return e(h)}function u(h){return r._balanced=!0,n(h)}}},rI={tokenize:function(t,e,n){return function(u){return t.enter("resource"),t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),o};function o(u){return tn(u)?da(t,r)(u):r(u)}function r(u){return u===41?d(u):hy(t,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function s(u){return tn(u)?da(t,i)(u):d(u)}function a(u){return n(u)}function i(u){return u===34||u===39||u===40?my(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):d(u)}function l(u){return tn(u)?da(t,d)(u):d(u)}function d(u){return u===41?(t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),t.exit("resource"),e):n(u)}}},sI={tokenize:function(t,e,n){const o=this;return function(a){return fy.call(o,t,r,s,"reference","referenceMarker","referenceString")(a)};function r(a){return o.parser.defined.includes(Vr(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function s(a){return n(a)}}},aI={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)}}},iI={name:"labelStartImage",resolveAll:Yu.resolveAll,tokenize:function(t,e,n){const o=this;return function(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),r};function r(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(a):e(a)}}},lI={name:"labelStartLink",resolveAll:Yu.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)}}},Ku={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),ct(t,e,"linePrefix")}}},pl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(i){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(i)};function s(i){return i===o?(t.enter("thematicBreakSequence"),a(i)):r>=3&&(i===null||$e(i))?(t.exit("thematicBreak"),e(i)):n(i)}function a(i){return i===o?(t.consume(i),r++,a):(t.exit("thematicBreakSequence"),rt(i)?ct(t,s,"whitespace")(i):s(i))}}},nn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(ml,r,s);function r(i){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,ct(t,e,"listItemIndent",o.containerState.size+1)(i)}function s(i){return o.containerState.furtherBlankLines||!rt(i)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,a(i)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(dI,e,a)(i))}function a(i){return o.containerState._closeFlow=!0,o.interrupt=void 0,ct(t,t.attempt(nn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},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,a=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:Hu(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(pl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),i(f)}return n(f)};function i(f){return Hu(f)&&++a<10?(t.consume(f),i):(!o.interrupt||a<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(ml,o.interrupt?n:d,t.attempt(cI,h,u))}function d(f){return o.containerState.initialBlankLine=!0,s++,h(f)}function u(f){return rt(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},cI={partial:!0,tokenize:function(t,e,n){const o=this;return ct(t,function(r){const s=o.events[o.events.length-1];return!rt(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},dI={partial:!0,tokenize:function(t,e,n){const o=this;return ct(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)}},gy={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 a={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",a,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=a,t.push(["exit",a,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(i){let l,d=o.events.length;for(;d--;)if(o.events[d][1].type!=="lineEnding"&&o.events[d][1].type!=="linePrefix"&&o.events[d][1].type!=="content"){l=o.events[d][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=i,function(u){return t.enter("setextHeadingLineSequence"),s(u)}(i)):n(i)};function s(i){return i===r?(t.consume(i),s):(t.exit("setextHeadingLineSequence"),rt(i)?ct(t,a,"lineSuffix")(i):a(i))}function a(i){return i===null||$e(i)?(t.exit("setextHeadingLine"),e(i)):n(i)}}},uI={tokenize:function(t){const e=this,n=t.attempt(ml,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,ct(t,t.attempt(this.parser.constructs.flow,o,t.attempt(G6,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)}}},hI={resolveAll:by()},fI=xy("string"),mI=xy("text");function xy(t){return{resolveAll:by(t==="text"?pI:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,a);return s;function s(d){return l(d)?r(d):a(d)}function a(d){if(d!==null)return e.enter("data"),e.consume(d),i;e.consume(d)}function i(d){return l(d)?(e.exit("data"),r(d)):(e.consume(d),i)}function l(d){if(d===null)return!0;const u=o[d];let h=-1;if(u)for(;++h<u.length;){const f=u[h];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function by(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 pI(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,a=r.length,i=-1,l=0;for(;a--;){const d=r[a];if(typeof d=="string"){for(i=d.length;d.charCodeAt(i-1)===32;)l++,i--;if(i)break;i=-1}else if(d===-2)s=!0,l++;else if(d!==-1){a++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const d={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?i:o.start._bufferIndex+i,_index:o.start._index+a,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...d.start},o.start.offset===o.end.offset?Object.assign(o,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const gI={42:nn,43:nn,45:nn,48:nn,49:nn,50:nn,51:nn,52:nn,53:nn,54:nn,55:nn,56:nn,57:nn,62:ay},xI={91:K6},bI={[-2]:Gu,[-1]:Gu,32:Gu},yI={35:Z6,42:pl,45:[gy,pl],60:eI,61:gy,95:pl,96:dy,126:dy},vI={38:ly,92:iy},wI={[-5]:Ku,[-4]:Ku,[-3]:Ku,33:iI,38:ly,42:qu,60:[$6,oI],91:lI,92:[J6,iy],93:Yu,95:qu,96:H6},kI={null:[qu,hI]},SI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:xI,disable:{null:[]},document:gI,flow:yI,flowInitial:bI,insideSpan:kI,string:vI,text:wI},Symbol.toStringTag,{value:"Module"}));function NI(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 a=[],i=[];const l={attempt:p(function(v,w){b(v,w.from)}),check:p(g),consume:function(v){$e(v)?(o.line++,o.column=1,o.offset+=v===-3?2:1,y()):v!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===a[o._index].length&&(o._bufferIndex=-1,o._index++)),d.previous=v},enter:function(v,w){const S=w||{};return S.type=v,S.start=f(),d.events.push(["enter",S,d]),i.push(S),S},exit:function(v){const w=i.pop();return w.end=f(),d.events.push(["exit",w,d]),w},interrupt:p(g,{interrupt:!0})},d={code:null,containerState:{},defineSkip:function(v){r[v.line]=v.column,y()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(v,w){return function(S,N){let C=-1;const j=[];let _;for(;++C<S.length;){const A=S[C];let T;if(typeof A=="string")T=A;else switch(A){case-5:T="\r";break;case-4:T=`
129
- `;break;case-3:T=`\r
130
- `;break;case-2:T=N?" ":" ";break;case-1:if(!N&&_)continue;T=" ";break;default:T=String.fromCharCode(A)}_=A===-2,j.push(T)}return j.join("")}(h(v),w)},sliceStream:h,write:function(v){return a=vn(a,v),m(),a[a.length-1]!==null?[]:(b(e,0),d.events=Wu(s,d.events,d),d.events)}};let u=e.tokenize.call(d,l);return e.resolveAll&&s.push(e),d;function h(v){return function(w,S){const N=S.start._index,C=S.start._bufferIndex,j=S.end._index,_=S.end._bufferIndex;let A;if(N===j)A=[w[N].slice(C,_)];else{if(A=w.slice(N,j),C>-1){const T=A[0];typeof T=="string"?A[0]=T.slice(C):A.shift()}_>0&&A.push(w[j].slice(0,_))}return A}(a,v)}function f(){const{_bufferIndex:v,_index:w,line:S,column:N,offset:C}=o;return{_bufferIndex:v,_index:w,line:S,column:N,offset:C}}function m(){let v;for(;o._index<a.length;){const w=a[o._index];if(typeof w=="string")for(v=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===v&&o._bufferIndex<w.length;)x(w.charCodeAt(o._bufferIndex));else x(w)}}function x(v){u=u(v)}function g(v,w){w.restore()}function p(v,w){return function(S,N,C){let j,_,A,T;return Array.isArray(S)?P(S):"tokenize"in S?P([S]):function(z){return D;function D(I){const k=I!==null&&z[I],B=I!==null&&z.null;return P([...Array.isArray(k)?k:k?[k]:[],...Array.isArray(B)?B:B?[B]:[]])(I)}}(S);function P(z){return j=z,_=0,z.length===0?C:L(z[_])}function L(z){return function(D){return T=function(){const I=f(),k=d.previous,B=d.currentConstruct,E=d.events.length,U=Array.from(i);return{from:E,restore:V};function V(){o=I,d.previous=k,d.currentConstruct=B,d.events.length=E,i=U,y()}}(),A=z,z.partial||(d.currentConstruct=z),z.name&&d.parser.constructs.disable.null.includes(z.name)?R():z.tokenize.call(w?Object.assign(Object.create(d),w):d,l,M,R)(D)}}function M(z){return v(A,T),N}function R(z){return T.restore(),++_<j.length?L(j[_]):C}}}function b(v,w){v.resolveAll&&!s.includes(v)&&s.push(v),v.resolve&&Un(d.events,w,d.events.length-w,v.resolve(d.events.slice(w),d)),v.resolveTo&&(d.events=v.resolveTo(d.events,d))}function y(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function CI(t){const e=function(r){const s={};let a=-1;for(;++a<r.length;)O6(s,r[a]);return s}([SI,...(t||{}).extensions||[]]),n={constructs:e,content:o(B6),defined:[],document:o(U6),flow:o(uI),lazy:{},string:o(fI),text:o(mI)};return n;function o(r){return function(s){return NI(n,r,s)}}}const yy=/[\0\t\n\r]/g,jI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function EI(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return ny(n.slice(r?2:1),r?16:10)}return $u(n)||t}const vy={}.hasOwnProperty;function _I(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(De),autolinkProtocol:P,autolinkEmail:P,atxHeading:l(ie),blockQuote:l(re),characterEscape:P,characterReference:P,codeFenced:l(ae),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:l(ae,d),codeText:l(te,d),codeTextData:P,data:P,codeFlowValue:P,definition:l(be),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:l(ye),hardBreakEscape:l(ve),hardBreakTrailing:l(ve),htmlFlow:l(he,d),htmlFlowData:P,htmlText:l(he,d),htmlTextData:P,image:l(Se),label:d,link:l(De),listItem:l(Fe),listItemValue:g,listOrdered:l(_e,x),listUnordered:l(_e),paragraph:l(Oe),reference:X,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:l(ie),strong:l(Qe),thematicBreak:l(Ke)},exit:{atxHeading:h(),atxHeadingSequence:j,autolink:h(),autolinkEmail:se,autolinkProtocol:oe,blockQuote:h(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:q,characterReference:Y,codeFenced:h(v),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:b,codeFlowValue:L,codeIndented:h(w),codeText:h(I),codeTextData:L,data:L,definition:h(),definitionDestinationString:C,definitionLabelString:S,definitionTitleString:N,emphasis:h(),hardBreakEscape:h(R),hardBreakTrailing:h(R),htmlFlow:h(z),htmlFlowData:L,htmlText:h(D),htmlTextData:L,image:h(B),label:U,labelText:E,lineEnding:M,link:h(k),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:J,resourceDestinationString:V,resourceTitleString:$,resource:K,setextHeading:h(T),setextHeadingLineSequence:A,setextHeadingText:_,strong:h(),thematicBreak:h()}};wy(r,(o||{}).mdastExtensions||[]);const s={};return a;function a(Q){let xe={type:"root",children:[]};const we={stack:[xe],tokenStack:[],config:r,enter:u,exit:f,buffer:d,resume:m,data:s},Te=[];let W=-1;for(;++W<Q.length;)(Q[W][1].type==="listOrdered"||Q[W][1].type==="listUnordered")&&(Q[W][0]==="enter"?Te.push(W):W=i(Q,Te.pop(),W));for(W=-1;++W<Q.length;){const ne=r[Q[W][0]];vy.call(ne,Q[W][1].type)&&ne[Q[W][1].type].call(Object.assign({sliceSerialize:Q[W][2].sliceSerialize},we),Q[W][1])}if(we.tokenStack.length>0){const ne=we.tokenStack[we.tokenStack.length-1];(ne[1]||ky).call(we,void 0,ne[0])}for(xe.position={start:Mo(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:Mo(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},W=-1;++W<r.transforms.length;)xe=r.transforms[W](xe)||xe;return xe}function i(Q,xe,we){let Te,W,ne,ue,de=xe-1,ge=-1,Me=!1;for(;++de<=we;){const Re=Q[de];switch(Re[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Re[0]==="enter"?ge++:ge--,ue=void 0;break;case"lineEndingBlank":Re[0]==="enter"&&(!Te||ue||ge||ne||(ne=de),ue=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!ge&&Re[0]==="enter"&&Re[1].type==="listItemPrefix"||ge===-1&&Re[0]==="exit"&&(Re[1].type==="listUnordered"||Re[1].type==="listOrdered")){if(Te){let He=de;for(W=void 0;He--;){const le=Q[He];if(le[1].type==="lineEnding"||le[1].type==="lineEndingBlank"){if(le[0]==="exit")continue;W&&(Q[W][1].type="lineEndingBlank",Me=!0),le[1].type="lineEnding",W=He}else if(le[1].type!=="linePrefix"&&le[1].type!=="blockQuotePrefix"&&le[1].type!=="blockQuotePrefixWhitespace"&&le[1].type!=="blockQuoteMarker"&&le[1].type!=="listItemIndent")break}ne&&(!W||ne<W)&&(Te._spread=!0),Te.end=Object.assign({},W?Q[W][1].start:Re[1].end),Q.splice(W||de,0,["exit",Te,Re[2]]),de++,we++}if(Re[1].type==="listItemPrefix"){const He={type:"listItem",_spread:!1,start:Object.assign({},Re[1].start),end:void 0};Te=He,Q.splice(de,0,["enter",He,Re[2]]),de++,we++,ne=void 0,ue=!0}}}return Q[xe][1]._spread=Me,we}function l(Q,xe){return we;function we(Te){u.call(this,Q(Te),Te),xe&&xe.call(this,Te)}}function d(){this.stack.push({type:"fragment",children:[]})}function u(Q,xe,we){this.stack[this.stack.length-1].children.push(Q),this.stack.push(Q),this.tokenStack.push([xe,we||void 0]),Q.position={start:Mo(xe.start),end:void 0}}function h(Q){return xe;function xe(we){Q&&Q.call(this,we),f.call(this,we)}}function f(Q,xe){const we=this.stack.pop(),Te=this.tokenStack.pop();if(!Te)throw new Error("Cannot close `"+Q.type+"` ("+ia({start:Q.start,end:Q.end})+"): it\u2019s not open");Te[0].type!==Q.type&&(xe?xe.call(this,Q,Te[0]):(Te[1]||ky).call(this,Q,Te[0])),we.position.end=Mo(Q.end)}function m(){return function(Q){return Zb(Q,typeof fl.includeImageAlt!="boolean"||fl.includeImageAlt,typeof fl.includeHtml!="boolean"||fl.includeHtml)}(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function g(Q){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(Q),10),this.data.expectingFirstListItemValue=void 0)}function p(){const Q=this.resume();this.stack[this.stack.length-1].lang=Q}function b(){const Q=this.resume();this.stack[this.stack.length-1].meta=Q}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const Q=this.resume();this.stack[this.stack.length-1].value=Q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const Q=this.resume();this.stack[this.stack.length-1].value=Q.replace(/(\r?\n|\r)$/g,"")}function S(Q){const xe=this.resume(),we=this.stack[this.stack.length-1];we.label=xe,we.identifier=Vr(this.sliceSerialize(Q)).toLowerCase()}function N(){const Q=this.resume();this.stack[this.stack.length-1].title=Q}function C(){const Q=this.resume();this.stack[this.stack.length-1].url=Q}function j(Q){const xe=this.stack[this.stack.length-1];if(!xe.depth){const we=this.sliceSerialize(Q).length;xe.depth=we}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function A(Q){this.stack[this.stack.length-1].depth=this.sliceSerialize(Q).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function P(Q){const xe=this.stack[this.stack.length-1].children;let we=xe[xe.length-1];we&&we.type==="text"||(we=qe(),we.position={start:Mo(Q.start),end:void 0},xe.push(we)),this.stack.push(we)}function L(Q){const xe=this.stack.pop();xe.value+=this.sliceSerialize(Q),xe.position.end=Mo(Q.end)}function M(Q){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak)return xe.children[xe.children.length-1].position.end=Mo(Q.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(xe.type)&&(P.call(this,Q),L.call(this,Q))}function R(){this.data.atHardBreak=!0}function z(){const Q=this.resume();this.stack[this.stack.length-1].value=Q}function D(){const Q=this.resume();this.stack[this.stack.length-1].value=Q}function I(){const Q=this.resume();this.stack[this.stack.length-1].value=Q}function k(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=xe,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function B(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=xe,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function E(Q){const xe=this.sliceSerialize(Q),we=this.stack[this.stack.length-2];we.label=function(Te){return Te.replace(jI,EI)}(xe),we.identifier=Vr(xe).toLowerCase()}function U(){const Q=this.stack[this.stack.length-1],xe=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Te=Q.children;we.children=Te}else we.alt=xe}function V(){const Q=this.resume();this.stack[this.stack.length-1].url=Q}function $(){const Q=this.resume();this.stack[this.stack.length-1].title=Q}function K(){this.data.inReference=void 0}function X(){this.data.referenceType="collapsed"}function J(Q){const xe=this.resume(),we=this.stack[this.stack.length-1];we.label=xe,we.identifier=Vr(this.sliceSerialize(Q)).toLowerCase(),this.data.referenceType="full"}function ee(Q){this.data.characterReferenceType=Q.type}function q(Q){const xe=this.sliceSerialize(Q),we=this.data.characterReferenceType;let Te;we?(Te=ny(xe,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=$u(xe),this.stack[this.stack.length-1].value+=Te}function Y(Q){this.stack.pop().position.end=Mo(Q.end)}function oe(Q){L.call(this,Q),this.stack[this.stack.length-1].url=this.sliceSerialize(Q)}function se(Q){L.call(this,Q),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(Q)}function re(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function te(){return{type:"inlineCode",value:""}}function be(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ye(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function he(){return{type:"html",value:""}}function Se(){return{type:"image",title:null,url:"",alt:null}}function De(){return{type:"link",title:null,url:"",children:[]}}function _e(Q){return{type:"list",ordered:Q.type==="listOrdered",start:null,spread:Q._spread,children:[]}}function Fe(Q){return{type:"listItem",spread:Q._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function Ke(){return{type:"thematicBreak"}}}(n)(function(o){for(;!uy(o););return o}(CI(n).document().write(function(){let o,r=1,s="",a=!0;return function(i,l,d){const u=[];let h,f,m,x,g;for(i=s+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),m=0,s="",a&&(i.charCodeAt(0)===65279&&m++,a=void 0);m<i.length;){if(yy.lastIndex=m,h=yy.exec(i),x=h&&h.index!==void 0?h.index:i.length,g=i.charCodeAt(x),!h){s=i.slice(m);break}if(g===10&&m===x&&o)u.push(-3),o=void 0;else switch(o&&(u.push(-5),o=void 0),m<x&&(u.push(i.slice(m,x)),r+=x-m),g){case 0:u.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),u.push(-2);r++<f;)u.push(-1);break;case 10:u.push(-4),r=1;break;default:o=!0,r=1}m=x+1}return d&&(o&&u.push(-5),s&&u.push(s),u.push(null)),u}}()(t,e,!0))))}function Mo(t){return{line:t.line,column:t.column,offset:t.offset}}function wy(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?wy(t,o):II(t,o)}}function II(t,e){let n;for(n in e)if(vy.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function ky(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ia({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ia({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ia({start:e.start,end:e.end})+") is still open")}function TI(t){const e=this;e.parser=function(n){return _I(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Sy(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const a=r[r.length-1];return a&&a.type==="text"?a.value+=o:r.push({type:"text",value:o}),r}function Ny(t){const e=t.spread;return e??t.children.length>1}function AI(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(Cy(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(Cy(e.slice(r),r>0,!1)),s.join("")}function Cy(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const MI={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
131
- `}]},code:function(t,e){const n=e.value?e.value+`
132
- `:"",o={};e.lang&&(o.className=["language-"+e.lang]);let r={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return e.meta&&(r.data={meta:e.meta}),t.patch(e,r),r=t.applyData(e,r),r={type:"element",tagName:"pre",properties:{},children:[r]},t.patch(e,r),r},delete:function(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},emphasis:function(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},footnoteReference:function(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",o=String(e.identifier).toUpperCase(),r=Hr(o.toLowerCase()),s=t.footnoteOrder.indexOf(o);let a,i=t.footnoteCounts.get(o);i===void 0?(i=0,t.footnoteOrder.push(o),a=t.footnoteOrder.length):a=s+1,i+=1,t.footnoteCounts.set(o,i);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(i>1?"-"+i:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const d={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,d),t.applyData(e,d)},heading:function(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},html:function(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}},imageReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Sy(t,e);const r={src:Hr(o.url||""),alt:e.alt};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,s),t.applyData(e,s)},image:function(t,e){const n={src:Hr(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,o),t.applyData(e,o)},inlineCode:function(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const o={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,o),t.applyData(e,o)},linkReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Sy(t,e);const r={href:Hr(o.url||"")};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)},link:function(t,e){const n={href:Hr(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)},listItem:function(t,e,n){const o=t.all(e),r=n?function(u){let h=!1;if(u.type==="list"){h=u.spread||!1;const f=u.children;let m=-1;for(;!h&&++m<f.length;)h=Ny(f[m])}return h}(n):Ny(e),s={},a=[];if(typeof e.checked=="boolean"){const u=o[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},o.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let i=-1;for(;++i<o.length;){const u=o[i];(r||i!==0||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
133
- `}),u.type!=="element"||u.tagName!=="p"||r?a.push(u):a.push(...u.children)}const l=o[o.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
134
- `});const d={type:"element",tagName:"li",properties:s,children:a};return t.patch(e,d),t.applyData(e,d)},list:function(t,e){const n={},o=t.all(e);let r=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++r<o.length;){const a=o[r];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(o,!0)};return t.patch(e,s),t.applyData(e,s)},paragraph:function(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},root:function(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)},strong:function(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},table:function(t,e){const n=t.all(e),o=n.shift(),r=[];if(o){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([o],!0)};t.patch(e.children[0],a),r.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},i=Ru(e.children[1]),l=Hb(e.children[e.children.length-1]);i&&l&&(a.position={start:i,end:l}),r.push(a)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)},tableCell:function(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},tableRow:function(t,e,n){const o=n?n.children:void 0,r=(o?o.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length;let i=-1;const l=[];for(;++i<a;){const u=e.children[i],h={},f=s?s[i]:void 0;f&&(h.align=f);let m={type:"element",tagName:r,properties:h,children:[]};u&&(m.children=t.all(u),t.patch(u,m),m=t.applyData(u,m)),l.push(m)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(l,!0)};return t.patch(e,d),t.applyData(e,d)},text:function(t,e){const n={type:"text",value:AI(String(e.value))};return t.patch(e,n),t.applyData(e,n)},thematicBreak:function(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)},toml:gl,yaml:gl,definition:gl,footnoteDefinition:gl};function gl(){}const jy=typeof self=="object"?self:globalThis,Ey=t=>((e,n)=>{const o=(s,a)=>(e.set(a,s),s),r=s=>{if(e.has(s))return e.get(s);const[a,i]=n[s];switch(a){case 0:case-1:return o(i,s);case 1:{const l=o([],s);for(const d of i)l.push(r(d));return l}case 2:{const l=o({},s);for(const[d,u]of i)l[r(d)]=r(u);return l}case 3:return o(new Date(i),s);case 4:{const{source:l,flags:d}=i;return o(new RegExp(l,d),s)}case 5:{const l=o(new Map,s);for(const[d,u]of i)l.set(r(d),r(u));return l}case 6:{const l=o(new Set,s);for(const d of i)l.add(r(d));return l}case 7:{const{name:l,message:d}=i;return o(new jy[l](d),s)}case 8:return o(BigInt(i),s);case"BigInt":return o(Object(BigInt(i)),s);case"ArrayBuffer":return o(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:l}=new Uint8Array(i);return o(new DataView(l),i)}}return o(new jy[a](i),s)};return r})(new Map,t)(0),Wr="",{toString:OI}={},{keys:DI}=Object,ua=t=>{const e=typeof t;if(e!=="object"||!t)return[0,e];const n=OI.call(t).slice(8,-1);switch(n){case"Array":return[1,Wr];case"Object":return[2,Wr];case"Date":return[3,Wr];case"RegExp":return[4,Wr];case"Map":return[5,Wr];case"Set":return[6,Wr];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},xl=([t,e])=>t===0&&(e==="function"||e==="symbol"),_y=(t,{json:e,lossy:n}={})=>{const o=[];return((r,s,a,i)=>{const l=(u,h)=>{const f=i.push(u)-1;return a.set(h,f),f},d=u=>{if(a.has(u))return a.get(u);let[h,f]=ua(u);switch(h){case 0:{let x=u;switch(f){case"bigint":h=8,x=u.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+f);x=null;break;case"undefined":return l([-1],u)}return l([h,x],u)}case 1:{if(f){let p=u;return f==="DataView"?p=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(p=new Uint8Array(u)),l([f,[...p]],u)}const x=[],g=l([h,x],u);for(const p of u)x.push(d(p));return g}case 2:{if(f)switch(f){case"BigInt":return l([f,u.toString()],u);case"Boolean":case"Number":case"String":return l([f,u.valueOf()],u)}if(s&&"toJSON"in u)return d(u.toJSON());const x=[],g=l([h,x],u);for(const p of DI(u))!r&&xl(ua(u[p]))||x.push([d(p),d(u[p])]);return g}case 3:return l([h,u.toISOString()],u);case 4:{const{source:x,flags:g}=u;return l([h,{source:x,flags:g}],u)}case 5:{const x=[],g=l([h,x],u);for(const[p,b]of u)(r||!xl(ua(p))&&!xl(ua(b)))&&x.push([d(p),d(b)]);return g}case 6:{const x=[],g=l([h,x],u);for(const p of u)!r&&xl(ua(p))||x.push(d(p));return g}}const{message:m}=u;return l([h,{name:f,message:m}],u)};return d})(!(e||n),!!e,new Map,o)(t),o},bl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Ey(_y(t,e)):structuredClone(t):(t,e)=>Ey(_y(t,e));function PI(t,e){const n=[{type:"text",value:"\u21A9"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function RI(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}const Iy=function(t){if(t==null)return LI;if(typeof t=="function")return yl(t);if(typeof t=="object")return Array.isArray(t)?function(e){const n=[];let o=-1;for(;++o<e.length;)n[o]=Iy(e[o]);return yl(r);function r(...s){let a=-1;for(;++a<n.length;)if(n[a].apply(this,s))return!0;return!1}}(t):function(e){const n=e;return yl(o);function o(r){const s=r;let a;for(a in e)if(s[a]!==n[a])return!1;return!0}}(t);if(typeof t=="string")return function(e){return yl(n);function n(o){return o&&o.type===e}}(t);throw new Error("Expected function, string, or object as test")};function yl(t){return function(e,n,o){return!!(function(r){return r!==null&&typeof r=="object"&&"type"in r}(e)&&t.call(this,e,typeof n=="number"?n:void 0,o||void 0))}}function LI(){return!0}const Ty=[],FI=!0,Ay=!1;function zI(t,e,n,o){let r;typeof e=="function"&&typeof n!="function"?(o=n,n=e):r=e;const s=Iy(r),a=o?-1:1;(function i(l,d,u){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+l.type+(m?"<"+m+">":"")+")"})}return f;function f(){let m,x,g,p=Ty;if((!e||s(l,d,u[u.length-1]||void 0))&&(p=function(b){return Array.isArray(b)?b:typeof b=="number"?[FI,b]:b==null?Ty:[b]}(n(l,u)),p[0]===Ay))return p;if("children"in l&&l.children){const b=l;if(b.children&&p[0]!=="skip")for(x=(o?b.children.length:-1)+a,g=u.concat(b);x>-1&&x<b.children.length;){const y=b.children[x];if(m=i(y,x,g)(),m[0]===Ay)return m;x=typeof m[1]=="number"?m[1]:x+a}}return p}})(t,void 0,[])()}function My(t,e,n,o){let r,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,r=n):(s=e,a=n,r=o),zI(t,s,function(i,l){const d=l[l.length-1],u=d?d.children.indexOf(i):void 0;return a(i,u,d)},r)}const Xu={}.hasOwnProperty,BI={};function UI(t,e){t.position&&(e.position=function(n){const o=Ru(n),r=Hb(n);if(o&&r)return{start:o,end:r}}(t))}function $I(t,e){let n=e;if(t&&t.data){const o=t.data.hName,r=t.data.hChildren,s=t.data.hProperties;typeof o=="string"&&(n.type==="element"?n.tagName=o:n={type:"element",tagName:o,properties:{},children:"children"in n?n.children:[n]}),n.type==="element"&&s&&Object.assign(n.properties,bl(s)),"children"in n&&n.children&&r!=null&&(n.children=r)}return n}function VI(t,e){const n=e.data||{},o=!("value"in e)||Xu.call(n,"hProperties")||Xu.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:t.all(e)}:{type:"text",value:e.value};return t.patch(e,o),t.applyData(e,o)}function HI(t,e){const n=[];let o=-1;for(e&&n.push({type:"text",value:`
135
- `});++o<t.length;)o&&n.push({type:"text",value:`
136
- `}),n.push(t[o]);return e&&t.length>0&&n.push({type:"text",value:`
137
- `}),n}function Oy(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Dy(t,e){const n=function(a,i){const l=i||BI,d=new Map,u=new Map,h=new Map,f={...MI,...l.handlers},m={all:function(x){const g=[];if("children"in x){const p=x.children;let b=-1;for(;++b<p.length;){const y=m.one(p[b],x);if(y){if(b&&p[b-1].type==="break"&&(Array.isArray(y)||y.type!=="text"||(y.value=Oy(y.value)),!Array.isArray(y)&&y.type==="element")){const v=y.children[0];v&&v.type==="text"&&(v.value=Oy(v.value))}Array.isArray(y)?g.push(...y):g.push(y)}}}return g},applyData:$I,definitionById:d,footnoteById:u,footnoteCounts:h,footnoteOrder:[],handlers:f,one:function(x,g){const p=x.type,b=m.handlers[p];if(Xu.call(m.handlers,p)&&b)return b(m,x,g);if(m.options.passThrough&&m.options.passThrough.includes(p)){if("children"in x){const{children:y,...v}=x,w=bl(v);return w.children=m.all(x),w}return bl(x)}return(m.options.unknownHandler||VI)(m,x,g)},options:l,patch:UI,wrap:HI};return My(a,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const g=x.type==="definition"?d:u,p=String(x.identifier).toUpperCase();g.has(p)||g.set(p,x)}}),m}(t,e),o=n.one(t,void 0),r=function(a){const i=typeof a.options.clobberPrefix=="string"?a.options.clobberPrefix:"user-content-",l=a.options.footnoteBackContent||PI,d=a.options.footnoteBackLabel||RI,u=a.options.footnoteLabel||"Footnotes",h=a.options.footnoteLabelTagName||"h2",f=a.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let x=-1;for(;++x<a.footnoteOrder.length;){const g=a.footnoteById.get(a.footnoteOrder[x]);if(!g)continue;const p=a.all(g),b=String(g.identifier).toUpperCase(),y=Hr(b.toLowerCase());let v=0;const w=[],S=a.footnoteCounts.get(b);for(;S!==void 0&&++v<=S;){w.length>0&&w.push({type:"text",value:" "});let j=typeof l=="string"?l:l(x,v);typeof j=="string"&&(j={type:"text",value:j}),w.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+y+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof d=="string"?d:d(x,v),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const N=p[p.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const j=N.children[N.children.length-1];j&&j.type==="text"?j.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...w)}else p.push(...w);const C={type:"element",tagName:"li",properties:{id:i+"fn-"+y},children:a.wrap(p,!0)};a.patch(g,C),m.push(C)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:h,properties:{...bl(f),id:"footnote-label"},children:[{type:"text",value:u}]},{type:"text",value:`
138
- `},{type:"element",tagName:"ol",properties:{},children:a.wrap(m,!0)},{type:"text",value:`
139
- `}]}}(n),s=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return r&&s.children.push({type:"text",value:`
140
- `},r),s}function WI(t,e){return t&&"run"in t?async function(n,o){const r=Dy(n,{file:o,...e});await t.run(r,o)}:function(n,o){return Dy(n,{file:o,...t||e})}}function Py(t){if(t)throw t}var Ju,Ry,qI=function(){if(Ry)return Ju;Ry=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=function(l){return typeof Array.isArray=="function"?Array.isArray(l):e.call(l)==="[object Array]"},s=function(l){if(!l||e.call(l)!=="[object Object]")return!1;var d,u=t.call(l,"constructor"),h=l.constructor&&l.constructor.prototype&&t.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!u&&!h)return!1;for(d in l);return d===void 0||t.call(l,d)},a=function(l,d){n&&d.name==="__proto__"?n(l,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):l[d.name]=d.newValue},i=function(l,d){if(d==="__proto__"){if(!t.call(l,d))return;if(o)return o(l,d).value}return l[d]};return Ju=function l(){var d,u,h,f,m,x,g=arguments[0],p=1,b=arguments.length,y=!1;for(typeof g=="boolean"&&(y=g,g=arguments[1]||{},p=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});p<b;++p)if((d=arguments[p])!=null)for(u in d)h=i(g,u),g!==(f=i(d,u))&&(y&&f&&(s(f)||(m=r(f)))?(m?(m=!1,x=h&&r(h)?h:[]):x=h&&s(h)?h:{},a(g,{name:u,newValue:l(y,x,f)})):f!==void 0&&a(g,{name:u,newValue:f}));return g},Ju}();const Zu=P3(qI);function Qu(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return!(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.toStringTag in t||Symbol.iterator in t)}function GI(){const t=[],e={run:function(...n){let o=-1;const r=n.pop();if(typeof r!="function")throw new TypeError("Expected function as last argument, not "+r);(function s(a,...i){const l=t[++o];let d=-1;if(a)r(a);else{for(;++d<n.length;)i[d]!==null&&i[d]!==void 0||(i[d]=n[d]);n=i,l?function(u,h){let f;return m;function m(...p){const b=u.length>p.length;let y;b&&p.push(x);try{y=u.apply(this,p)}catch(v){if(b&&f)throw v;return x(v)}b||(y&&y.then&&typeof y.then=="function"?y.then(g,x):y instanceof Error?x(y):g(y))}function x(p,...b){f||(f=!0,h(p,...b))}function g(p){x(null,p)}}(l,s)(...i):r(null,...i)}})(null,...n)},use:function(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return t.push(n),e}};return e}const Vn={basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ha(t);let n,o=0,r=-1,s=t.length;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else r<0&&(n=!0,r=s+1);return r<0?"":t.slice(o,r)}if(e===t)return"";let a=-1,i=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else a<0&&(n=!0,a=s+1),i>-1&&(t.codePointAt(s)===e.codePointAt(i--)?i<0&&(r=s):(i=-1,r=a));return o===r?r=a:r<0&&(r=t.length),t.slice(o,r)},dirname:function(t){if(ha(t),t.length===0)return".";let e,n=-1,o=t.length;for(;--o;)if(t.codePointAt(o)===47){if(e){n=o;break}}else e||(e=!0);return n<0?t.codePointAt(0)===47?"/":".":n===1&&t.codePointAt(0)===47?"//":t.slice(0,n)},extname:function(t){ha(t);let e,n=t.length,o=-1,r=0,s=-1,a=0;for(;n--;){const i=t.codePointAt(n);if(i!==47)o<0&&(e=!0,o=n+1),i===46?s<0?s=n:a!==1&&(a=1):s>-1&&(a=-1);else if(e){r=n+1;break}}return s<0||o<0||a===0||a===1&&s===o-1&&s===r+1?"":t.slice(s,o)},join:function(...t){let e,n=-1;for(;++n<t.length;)ha(t[n]),t[n]&&(e=e===void 0?t[n]:e+"/"+t[n]);return e===void 0?".":function(o){ha(o);const r=o.codePointAt(0)===47;let s=function(a,i){let l,d,u="",h=0,f=-1,m=0,x=-1;for(;++x<=a.length;){if(x<a.length)l=a.codePointAt(x);else{if(l===47)break;l=47}if(l===47){if(!(f===x-1||m===1))if(f!==x-1&&m===2){if(u.length<2||h!==2||u.codePointAt(u.length-1)!==46||u.codePointAt(u.length-2)!==46){if(u.length>2){if(d=u.lastIndexOf("/"),d!==u.length-1){d<0?(u="",h=0):(u=u.slice(0,d),h=u.length-1-u.lastIndexOf("/")),f=x,m=0;continue}}else if(u.length>0){u="",h=0,f=x,m=0;continue}}i&&(u=u.length>0?u+"/..":"..",h=2)}else u.length>0?u+="/"+a.slice(f+1,x):u=a.slice(f+1,x),h=x-f-1;f=x,m=0}else l===46&&m>-1?m++:m=-1}return u}(o,!r);return s.length!==0||r||(s="."),s.length>0&&o.codePointAt(o.length-1)===47&&(s+="/"),r?"/"+s:s}(e)},sep:"/"};function ha(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const YI={cwd:function(){return"/"}};function eh(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function KI(t){if(typeof t=="string")t=new URL(t);else if(!eh(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let o=-1;for(;++o<n.length;)if(n.codePointAt(o)===37&&n.codePointAt(o+1)===50){const r=n.codePointAt(o+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}(t)}const th=["history","path","basename","stem","extname","dirname"];class Ly{constructor(e){let n;n=e?eh(e)?{path:e}:typeof e=="string"||function(s){return!!(s&&typeof s=="object"&&"byteLength"in s&&"byteOffset"in s)}(e)?{value:e}:e:{},this.cwd="cwd"in n?"":YI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o,r=-1;for(;++r<th.length;){const s=th[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}for(o in n)th.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Vn.basename(this.path):void 0}set basename(e){oh(e,"basename"),nh(e,"basename"),this.path=Vn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Vn.dirname(this.path):void 0}set dirname(e){Fy(this.basename,"dirname"),this.path=Vn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Vn.extname(this.path):void 0}set extname(e){if(nh(e,"extname"),Fy(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Vn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){eh(e)&&(e=KI(e)),oh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Vn.basename(this.path,this.extname):void 0}set stem(e){oh(e,"stem"),nh(e,"stem"),this.path=Vn.join(this.dirname||"",e+(this.extname||""))}fail(e,n,o){const r=this.message(e,n,o);throw r.fatal=!0,r}info(e,n,o){const r=this.message(e,n,o);return r.fatal=void 0,r}message(e,n,o){const r=new Vt(e,n,o);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function nh(t,e){if(t&&t.includes(Vn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Vn.sep+"`")}function oh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Fy(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}const XI=function(t){const e=this.constructor.prototype,n=e[t],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,e),o},JI={}.hasOwnProperty;class rh extends XI{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=GI()}copy(){const e=new rh;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];e.use(...o)}return e.data(Zu(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(ih("data",this.frozen),this.namespace[e]=n,this):JI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ih("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const r=n.call(e,...o);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=vl(e),o=this.parser||this.Parser;return sh("parse",o),o(String(n),n)}process(e,n){const o=this;return this.freeze(),sh("process",this.parser||this.Parser),ah("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(s,a){const i=vl(e),l=o.parse(i);function d(u,h){u||!h?a(u):s?s(h):n(void 0,h)}o.run(l,i,function(u,h,f){if(u||!h||!f)return d(u);const m=h,x=o.stringify(m,f);var g;typeof(g=x)=="string"||function(p){return!!(p&&typeof p=="object"&&"byteLength"in p&&"byteOffset"in p)}(g)?f.value=x:f.result=x,d(u,f)})}}processSync(e){let n,o=!1;return this.freeze(),sh("processSync",this.parser||this.Parser),ah("processSync",this.compiler||this.Compiler),this.process(e,function(r,s){o=!0,Py(r),n=s}),By("processSync","process",o),n}run(e,n,o){zy(e),this.freeze();const r=this.transformers;return o||typeof n!="function"||(o=n,n=void 0),o?s(void 0,o):new Promise(s);function s(a,i){const l=vl(n);r.run(e,l,function(d,u,h){const f=u||e;d?i(d):a?a(f):o(void 0,f,h)})}}runSync(e,n){let o,r=!1;return this.run(e,n,function(s,a){Py(s),o=a,r=!0}),By("runSync","run",r),o}stringify(e,n){this.freeze();const o=vl(n),r=this.compiler||this.Compiler;return ah("stringify",r),zy(e),r(e,o)}use(e,...n){const o=this.attachers,r=this.namespace;if(ih("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else{if(typeof e!="object")throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?i(e):a(e)}return this;function s(d){if(typeof d=="function")l(d,[]);else{if(typeof d!="object")throw new TypeError("Expected usable value, not `"+d+"`");if(Array.isArray(d)){const[u,...h]=d;l(u,h)}else a(d)}}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");i(d.plugins),d.settings&&(r.settings=Zu(!0,r.settings,d.settings))}function i(d){let u=-1;if(d!=null){if(!Array.isArray(d))throw new TypeError("Expected a list of plugins, not `"+d+"`");for(;++u<d.length;)s(d[u])}}function l(d,u){let h=-1,f=-1;for(;++h<o.length;)if(o[h][0]===d){f=h;break}if(f===-1)o.push([d,...u]);else if(u.length>0){let[m,...x]=u;const g=o[f][1];Qu(g)&&Qu(m)&&(m=Zu(!0,g,m)),o[f]=[d,m,...x]}}}}const ZI=new rh().freeze();function sh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ah(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ih(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zy(t){if(!Qu(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function By(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function vl(t){return function(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}(t)?t:new Ly(t)}const Uy=[],$y={allowDangerousHtml:!0},QI=/^(https?|ircs?|mailto|xmpp)$/i,e8=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function t8(t){const e=function(o){const r=o.rehypePlugins||Uy,s=o.remarkPlugins||Uy,a=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...$y}:$y;return ZI().use(TI).use(s).use(WI,a).use(r)}(t),n=function(o){const r=o.children||"",s=new Ly;return typeof r=="string"&&(s.value=r),s}(t);return function(o,r){const s=r.allowedElements,a=r.allowElement,i=r.components,l=r.disallowedElements,d=r.skipHtml,u=r.unwrapDisallowed,h=r.urlTransform||n8;for(const m of e8)Object.hasOwn(r,m.from)&&(m.from,m.to&&m.to,m.id,void 0);return r.className&&(o={type:"element",tagName:"div",properties:{className:r.className},children:o.type==="root"?o.children:[o]}),My(o,f),I6(o,{Fragment:c.Fragment,components:i,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function f(m,x,g){if(m.type==="raw"&&g&&typeof x=="number")return d?g.children.splice(x,1):g.children[x]={type:"text",value:m.value},x;if(m.type==="element"){let p;for(p in Uu)if(Object.hasOwn(Uu,p)&&Object.hasOwn(m.properties,p)){const b=m.properties[p],y=Uu[p];(y===null||y.includes(m.tagName))&&(m.properties[p]=h(String(b||""),p,m))}}if(m.type==="element"){let p=s?!s.includes(m.tagName):!!l&&l.includes(m.tagName);if(!p&&a&&typeof x=="number"&&(p=!a(m,x,g)),p&&g&&typeof x=="number")return u&&m.children?g.children.splice(x,1,...m.children):g.children.splice(x,1),x}}}(e.runSync(e.parse(n),n),t)}function n8(t){const e=t.indexOf(":"),n=t.indexOf("?"),o=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||o!==-1&&e>o||QI.test(t.slice(0,e))?t:""}const o8=[Ge.lineWrapping],r8=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),s8=t=>{const e=H.c(26),{code:n,language:o}=t,{theme:r}=Xo(),{createNewCell:s}=it(),a=cs(),i=Ie($l),[l,d]=O.useState(n);let u,h,f;e[0]!==n?(u=()=>{d(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),O.useEffect(u,h),e[3]!==i||e[4]!==s||e[5]!==o||e[6]!==a||e[7]!==l?(f=()=>{const j=function(_,A){return _?_==="python"?{language:_,code:A}:_==="sql"?{language:"python",code:vc.fromQuery(A)}:_==="markdown"?{language:"python",code:Oa.fromMarkdown(A)}:_==="shell"||_==="bash"?{language:"python",code:`import subprocess
141
- subprocess.run("${A}")`}:{language:"python",code:`_${_} = """
142
- ${A}
143
- """`}:{language:"python",code:A}}(o,l);o==="sql"&&qn({autoInstantiate:i,createNewCell:s,fromCellId:a}),s({code:j.code,before:!1,cellId:a??"__end__"})},e[3]=i,e[4]=s,e[5]=o,e[6]=a,e[7]=l,e[8]=f):f=e[8];const m=f;let x;e[9]!==l?(x=async()=>{await on(l)},e[9]=l,e[10]=x):x=e[10];const g=x,p=r==="dark"?"dark":"light",b=o&&r8.has(o)?o:void 0;let y,v,w,S,N,C;return e[11]!==p||e[12]!==b||e[13]!==l?(y=c.jsx(O.Suspense,{children:c.jsx(Ka,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:o8,value:l,onChange:d})}),e[11]=p,e[12]=b,e[13]=l,e[14]=y):y=e[14],e[15]!==g?(v=c.jsx(a8,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=v):v=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(w=c.jsx(Sr,{className:"ml-2 h-4 w-4"}),e[17]=w):w=e[17],e[18]!==m?(S=c.jsxs(ke,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",w]}),e[18]=m,e[19]=S):S=e[19],e[20]!==S||e[21]!==v?(N=c.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[v,S]}),e[20]=S,e[21]=v,e[22]=N):N=e[22],e[23]!==N||e[24]!==y?(C=c.jsxs("div",{className:"relative",children:[y,N]}),e[23]=N,e[24]=y,e[25]=C):C=e[25],C},a8=t=>{const e=H.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]=O.useState(!1);let a,i,l;e[3]!==r?(a=()=>{r&&setTimeout(()=>s(!1),1e3)},i=[r],e[3]=r,e[4]=a,e[5]=i):(a=e[4],i=e[5]),O.useEffect(a,i),e[6]!==n?(l=h=>{n==null||n(h),s(!0)},e[6]=n,e[7]=l):l=e[7];const d=r?"Copied":"Copy";let u;return e[8]!==o||e[9]!==l||e[10]!==d?(u=c.jsx(ke,{...o,onClick:l,children:d}),e[8]=o,e[9]=l,e[10]=d,e[11]=u):u=e[11],u},i8={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),c.jsx(s8,{code:t.trim(),language:n})]}):c.jsx("code",{className:e,children:t})}},Vy=O.memo(t=>{const e=H.c(2),{content:n}=t;let o;return e[0]!==n?(o=c.jsx(t8,{components:i8,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);Vy.displayName="MemoizedMarkdownBlock";const lh=O.memo(({content:t})=>{const e=O.useMemo(()=>{return n=t,SP.lexer(n).map(o=>o.raw);var n},[t]);return c.jsx(c.Fragment,{children:e.map((n,o)=>c.jsx(Vy,{content:n},`markdown-block-${o}`))})});lh.displayName="MarkdownRenderer";const l8=t=>{const e=H.c(13),{reasoning:n,index:o,isStreaming:r}=t,s=o===void 0?0:o,a=r!==void 0&&r,i=a?"reasoning":void 0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Fl,{className:"h-3 w-3"}),e[0]=l):l=e[0];const d=a?"Thinking":"View reasoning";let u,h,f,m;return e[1]!==n.length||e[2]!==d?(u=c.jsx(R3,{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:c.jsxs("span",{className:"flex items-center gap-2",children:[l,d," (",n.length," ","chars)"]})}),e[1]=n.length,e[2]=d,e[3]=u):u=e[3],e[4]!==n?(h=c.jsx(L3,{className:"pb-2 px-2",children:c.jsx("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:c.jsx("div",{className:"pr-6",children:c.jsx(lh,{content:n})})})}),e[4]=n,e[5]=h):h=e[5],e[6]!==u||e[7]!==h?(f=c.jsxs(F3,{value:"reasoning",className:"border-0",children:[u,h]}),e[6]=u,e[7]=h,e[8]=f):f=e[8],e[9]!==s||e[10]!==i||e[11]!==f?(m=c.jsx(z3,{type:"single",collapsible:!0,className:"w-full mb-2",value:i,children:f},s),e[9]=s,e[10]=i,e[11]=f,e[12]=m):m=e[12],m},c8=t=>{const e=H.c(32),{toolName:n,result:o,error:r,index:s,state:a}=t,i=s===void 0?0:s,l=a==="result"&&(o||r),d=r?"error":l?"success":"loading";let u;e[0]!==d?(u=()=>{switch(d){case"loading":return c.jsx(Sc,{className:"h-3 w-3 animate-spin"});case"error":return c.jsx(Ea,{className:"h-3 w-3 text-destructive"});case"success":return c.jsx(QR,{className:"h-3 w-3 text-green-600"});default:return c.jsx(NP,{className:"h-3 w-3"})}},e[0]=d,e[1]=u):u=e[1];const h=u;let f;e[2]!==r||e[3]!==l||e[4]!==d?(f=()=>d==="loading"?"Running: ":r?"Failed: ":l?"Done: ":"Tool call",e[2]=r,e[3]=l,e[4]=d,e[5]=f):f=e[5];const m=f,x=`tool-${i}`,g=d==="error"&&"text-destructive/80",p=d==="success"&&"text-green-600/80";let b,y;e[6]!==g||e[7]!==p?(b=me("h-6 text-xs border-border !shadow-none !ring-0 bg-muted hover:bg-muted/30 py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180",g,p),e[6]=g,e[7]=p,e[8]=b):b=e[8],e[9]!==h?(y=h(),e[9]=h,e[10]=y):y=e[10];const v=m();let w,S,N,C,j,_,A;return e[11]!==n?(w=c.jsx("code",{className:"font-mono text-xs",children:n}),e[11]=n,e[12]=w):w=e[12],e[13]!==w||e[14]!==y||e[15]!==v?(S=c.jsxs("span",{className:"flex items-center gap-1",children:[y,v,":"," ",w]}),e[13]=w,e[14]=y,e[15]=v,e[16]=S):S=e[16],e[17]!==S||e[18]!==b?(N=c.jsx(R3,{className:b,children:S}),e[17]=S,e[18]=b,e[19]=N):N=e[19],e[20]!==r||e[21]!==l||e[22]!==o?(C=l&&c.jsxs("div",{className:"space-y-3",children:[o&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:"Result:"}),c.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:typeof o=="string"?o:JSON.stringify(o,null,2)})]}),r&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-medium text-destructive mb-1",children:"Error:"}),c.jsx("div",{className:"bg-destructive/10 border border-destructive/20 rounded-md p-3 text-sm text-destructive",children:r})]})]}),e[20]=r,e[21]=l,e[22]=o,e[23]=C):C=e[23],e[24]!==C?(j=c.jsx(L3,{className:"pb-2 px-2",children:C}),e[24]=C,e[25]=j):j=e[25],e[26]!==N||e[27]!==j?(_=c.jsxs(F3,{value:"tool-call",className:"border-0",children:[N,j]}),e[26]=N,e[27]=j,e[28]=_):_=e[28],e[29]!==_||e[30]!==x?(A=c.jsx(z3,{type:"single",collapsible:!0,className:"w-full my-4",children:_},x),e[29]=_,e[30]=x,e[31]=A):A=e[31],A},d8=t=>{const e=H.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,{handleClick:a}=Ja();let i,l,d,u,h,f,m,x,g,p,b;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Ko,{className:"h-4 w-4"}),e[0]=i):i=e[0],e[1]!==n?(l=c.jsx(Ce,{content:"New chat",children:c.jsx(ke,{variant:"text",size:"icon",onClick:n,children:i})}),e[1]=n,e[2]=l):l=e[2],e[3]!==a?(d=()=>a("ai"),e[3]=a,e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(Qf,{className:"h-4 w-4"}),e[5]=u):u=e[5],e[6]!==d?(h=c.jsx(Ce,{content:"AI Settings",children:c.jsx(ke,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:d,children:u})}),e[6]=d,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Ce,{content:"Previous chats",children:c.jsx(ys,{asChild:!0,children:c.jsx(ke,{variant:"text",size:"icon",children:c.jsx(_P,{className:"h-4 w-4"})})})}),e[8]=f):f=e[8],e[9]!==s.length?(m=s.length===0&&c.jsx(an,{title:"No chats yet",description:"Start a new chat to get started",icon:c.jsx(Fl,{})}),e[9]=s.length,e[10]=m):m=e[10],e[11]!==o||e[12]!==s||e[13]!==r){let y;e[15]!==o||e[16]!==r?(y=v=>c.jsxs("button",{className:me("w-full p-3 rounded-md cursor-pointer hover:bg-accent text-left",v.id===o&&"bg-accent"),onClick:()=>{r(v.id)},type:"button",children:[c.jsx("div",{className:"font-medium",children:v.title}),c.jsx("div",{className:"text-sm text-muted-foreground",children:IP(v.updatedAt)})]},v.id),e[15]=o,e[16]=r,e[17]=y):y=e[17],x=s.map(y),e[11]=o,e[12]=s,e[13]=r,e[14]=x}else x=e[14];return e[18]!==m||e[19]!==x?(g=c.jsxs(xr,{children:[f,c.jsx(fs,{className:"w-[520px] p-0",align:"start",side:"right",children:c.jsx(_b,{className:"h-[500px] p-4",children:c.jsxs("div",{className:"space-y-4",children:[m,x]})})})]}),e[18]=m,e[19]=x,e[20]=g):g=e[20],e[21]!==h||e[22]!==g?(p=c.jsxs("div",{className:"flex items-center gap-2",children:[h,g]}),e[21]=h,e[22]=g,e[23]=p):p=e[23],e[24]!==p||e[25]!==l?(b=c.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0 items-center",children:[l,p]}),e[24]=p,e[25]=l,e[26]=b):b=e[26],b},Hy=O.memo(t=>{var f;const e=H.c(15),{message:n,index:o,theme:r,onEdit:s,isStreamingReasoning:a,totalMessages:i}=t,l=n.role==="user"?"justify-end":"justify-start";let d,u,h;return e[0]!==l?(d=me("flex group relative",l),e[0]=l,e[1]=d):d=e[1],e[2]!==o||e[3]!==a||e[4]!==n.content||e[5]!==n.id||e[6]!==n.parts||e[7]!==n.role||e[8]!==s||e[9]!==r||e[10]!==i?(u=n.role==="user"?c.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:c.jsx(kc,{value:n.content,theme:r,placeholder:"Type your message...",onChange:f8,onSubmit:(m,x)=>{x.trim()&&s(o,x)},onClose:m8},n.id)}):c.jsxs("div",{className:"w-[95%] break-words",children:[c.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsx(B3,{className:"h-3 w-3",value:n.content})}),(f=n.parts)==null?void 0:f.map((m,x)=>{var g;switch(m.type){case"text":return c.jsx(lh,{content:m.text},x);case"reasoning":return c.jsx(l8,{reasoning:m.reasoning,index:x,isStreaming:o===i-1&&a&&x===(((g=n.parts)==null?void 0:g.length)||0)-1},x);case"tool-invocation":return c.jsx(c8,{index:x,toolName:m.toolInvocation.toolName,result:m.toolInvocation.state==="result"?m.toolInvocation.result:null,state:m.toolInvocation.state},x);default:return null}})]}),e[2]=o,e[3]=a,e[4]=n.content,e[5]=n.id,e[6]=n.parts,e[7]=n.role,e[8]=s,e[9]=r,e[10]=i,e[11]=u):u=e[11],e[12]!==d||e[13]!==u?(h=c.jsx("div",{className:d,children:u}),e[12]=d,e[13]=u,e[14]=h):h=e[14],h});Hy.displayName="ChatMessage";const ch=O.memo(t=>{var S;const e=H.c(22),{input:n,onSendClick:o,isLoading:r,onStop:s}=t,a=Ie(O3),[i,l]=Ot(Ra),d=((S=a==null?void 0:a.open_ai)==null?void 0:S.model)||"o4-mini";let u,h,f,m,x,g;if(e[0]!==l||e[1]!==i){u=async C=>{var _;const j={...i,ai:{...i.ai,open_ai:{...(_=i.ai)==null?void 0:_.open_ai,model:C}}};N(j)};const N=async C=>{await pr({config:C}).then(()=>{l(C)})};e[0]=l,e[1]=i,e[2]=u}else u=e[2];e[3]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Jl,{className:"h-6 text-xs border-border !shadow-none !ring-0 bg-muted hover:bg-muted/30 py-0 px-2 gap-1",children:c.jsx(Zl,{placeholder:"Model"})}),e[3]=h):h=e[3],e[4]!==d?(f=!mS.includes(d)&&c.jsx(Ma,{value:d,className:"text-sm",children:d},d),e[4]=d,e[5]=f):f=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=mS.map(p8),e[6]=m):m=e[6],e[7]!==f?(x=c.jsxs(Ql,{children:[f,m]}),e[7]=f,e[8]=x):x=e[8],e[9]!==d||e[10]!==u||e[11]!==x?(g=c.jsx("div",{className:"flex items-center gap-2",children:c.jsxs(Xl,{value:d,onValueChange:u,children:[h,x]})}),e[9]=d,e[10]=u,e[11]=x,e[12]=g):g=e[12];const p=r?s:o,b=!r&&!n.trim();let y,v,w;return e[13]!==r?(y=r?c.jsx(tc,{className:"h-3 w-3 fill-current"}):c.jsx(CP,{className:"h-3 w-3"}),e[13]=r,e[14]=y):y=e[14],e[15]!==p||e[16]!==b||e[17]!==y?(v=c.jsx(ke,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted/30",onClick:p,disabled:b,children:y}),e[15]=p,e[16]=b,e[17]=y,e[18]=v):v=e[18],e[19]!==g||e[20]!==v?(w=c.jsxs("div",{className:"px-3 py-2 border-t border-border/20 flex items-center justify-between",children:[g,v]}),e[19]=g,e[20]=v,e[21]=w):w=e[21],w});ch.displayName="ChatInputFooter";const Wy=O.memo(t=>{var g,p;const e=H.c(19),{input:n,setInput:o,onSubmit:r,theme:s,inputRef:a,isLoading:i,onStop:l}=t;let d;e[0]!==n||e[1]!==r?(d=()=>{n.trim()&&r(void 0,n)},e[0]=n,e[1]=r,e[2]=d):d=e[2];const u=d;let h,f,m,x;return e[3]!==((g=a.current)==null?void 0:g.editor)?(h=()=>{var b,y;return(y=(b=a.current)==null?void 0:b.editor)==null?void 0:y.blur()},e[3]=(p=a.current)==null?void 0:p.editor,e[4]=h):h=e[4],e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==h||e[9]!==s?(f=c.jsx("div",{className:"px-2 py-3 flex-1",children:c.jsx(kc,{value:n,onChange:o,onSubmit:r,onClose:h,theme:s,placeholder:"Type your message..."})}),e[5]=n,e[6]=r,e[7]=o,e[8]=h,e[9]=s,e[10]=f):f=e[10],e[11]!==u||e[12]!==n||e[13]!==i||e[14]!==l?(m=c.jsx(ch,{input:n,onSendClick:u,isLoading:i,onStop:l}),e[11]=u,e[12]=n,e[13]=i,e[14]=l,e[15]=m):m=e[15],e[16]!==f||e[17]!==m?(x=c.jsxs("div",{className:"border-t relative flex-shrink-0 min-h-[80px] flex flex-col",children:[f,m]}),e[16]=f,e[17]=m,e[18]=x):x=e[18],x});Wy.displayName="ChatInput";const u8=()=>{const t=H.c(6),e=Ie(Ul),{handleClick:n}=Ja();if(!e){let r,s,a;return t[0]!==n?(r=c.jsx(ke,{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=c.jsx(Fl,{}),t[2]=s):s=t[2],t[3]!==r?(a=c.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]=a):a=t[4],a}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(h8,{}),t[5]=o):o=t[5],o},h8=()=>{const[t,e]=Ot(Qc),[n,o]=Ot(VS),[r,s]=O.useState(""),a=O.useRef(null),i=O.useRef(null),l=O.useRef(null),d=O.useRef(null),{theme:u}=Xo(),h=ym(),{messages:f,input:m,setInput:x,setMessages:g,append:p,handleSubmit:b,error:y,status:v,reload:w,stop:S}=jP({id:n==null?void 0:n.id,maxSteps:10,initialMessages:(n==null?void 0:n.messages)||[],keepLastMessageOnError:!0,api:h.getAiURL("chat").toString(),headers:h.headers(),experimental_prepareRequestBody:A=>({...A,...p3({input:A.messages.map(T=>T.content).join(`
144
- `)}),includeOtherCode:gc("")}),onFinish:A=>{e(T=>Iu(T,T.activeChatId,A.id,"assistant",A.content,A.parts))},onToolCall:async({toolCall:A})=>{try{const T=await EP({toolName:A.toolName,arguments:A.args});return T.result||T.error}catch(T){return ft.error("Tool call failed:",T),`Error: ${T instanceof Error?T.message:String(T)}`}},onError:A=>{ft.error("An error occurred:",A)},onResponse:A=>{ft.debug("Received HTTP response from server:",A)}}),N=v==="submitted"||v==="streaming";O.useEffect(()=>{if(!t.activeChatId||f.length===0)return;const A=f[f.length-1];if((A==null?void 0:A.role)!=="user")return;const T=t.chats.find(M=>M.id===t.activeChatId);if(!T)return;const P=new Set(T.messages.map(M=>M.id)),L=f.filter(M=>M.role==="user"&&!P.has(M.id));L.length>0&&e(M=>{let R=M;for(const z of L)R=Iu(R,M.activeChatId,z.id,"user",z.content);return R})},[f,t.activeChatId,t.chats,e]);const C=N&&f.length>0&&(A=>{if(A.length===0)return!1;const T=A.at(-1);if(!T||T.role!=="assistant"||!T.parts)return!1;const P=T.parts;return P.length===0?!1:P[P.length-1].type==="reasoning"})(f);O.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const A=l.current;A.scrollTop=A.scrollHeight}})},[t.activeChatId]);const j=(A,T)=>{g(P=>P.slice(0,A)),t.activeChatId&&e(P=>({...P,chats:P.chats.map(L=>L.id===t.activeChatId?{...L,messages:L.messages.slice(0,A),updatedAt:Date.now()}:L)})),p({role:"user",content:T})},_=()=>{r.trim()&&(A=>{const T=Date.now(),P={id:U3(),title:A.length>50?`${A.slice(0,50)}...`:A,messages:[],createdAt:T,updatedAt:T};e(M=>({...M,chats:[...M.chats,P],activeChatId:P.id}));const L=U3();p({id:L,role:"user",content:A}),x("")})(r.trim())};return c.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[c.jsx(vm,{children:c.jsx(d8,{onNewChat:()=>{o(null),x(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((A,T)=>T.updatedAt-A.updatedAt)})}),c.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&c.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[c.jsx("div",{className:"px-1",children:c.jsx(kc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:()=>{var A,T;return(T=(A=a.current)==null?void 0:A.editor)==null?void 0:T.blur()},onChange:s,onSubmit:_},"new-thread-input")}),c.jsx(ch,{input:r,onSendClick:_,isLoading:N,onStop:S})]}),f.map((A,T)=>c.jsx(Hy,{message:A,index:T,theme:u,onEdit:j,setChatState:e,chatState:t,isStreamingReasoning:C,totalMessages:f.length},T)),N&&c.jsx("div",{className:"flex justify-center py-4",children:c.jsx(Sc,{className:"h-4 w-4 animate-spin"})}),y&&c.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[c.jsx(yr,{error:y}),c.jsx(ke,{variant:"outline",size:"sm",onClick:()=>{w()},children:"Retry"})]}),c.jsx("div",{ref:d})]}),N&&c.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:c.jsx(ke,{variant:"linkDestructive",size:"sm",onClick:S,children:"Stop"})}),f&&f.length>0&&c.jsx(Wy,{input:m,setInput:x,onSubmit:(A,T)=>{T.trim()&&b(A)},theme:u,inputRef:i,isLoading:N,onStop:S})]})};function f8(){}function m8(){}function p8(t){return c.jsx(Ma,{value:t,className:"text-sm",children:t},t)}function Xt(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=Xt(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:g8}=G,{useSyncExternalStoreWithSelector:x8}=TP,b8=t=>t;function qy(t,e=b8,n){const o=x8(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return g8(o),o}const Gy=(t,e)=>{const n=AP(t),o=(r,s=e)=>qy(n,r,s);return Object.assign(o,n),o};function Ht(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function Hn(t,e){if(t=function(s){let a;for(;a=s.sourceEvent;)s=a;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const y8={passive:!1},fa={capture:!0,passive:!1};function dh(t){t.stopImmediatePropagation()}function qr(t){t.preventDefault(),t.stopImmediatePropagation()}function Yy(t){var e=t.document.documentElement,n=Ln(t).on("dragstart.drag",qr,fa);"onselectstart"in e?n.on("selectstart.drag",qr,fa):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ky(t,e){var n=t.document.documentElement,o=Ln(t).on("dragstart.drag",null);e&&(o.on("click.drag",qr,fa),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 wl=t=>()=>t;function uh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:a,y:i,dx:l,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}function v8(t){return!t.ctrlKey&&!t.button}function w8(){return this.parentNode}function k8(t,e){return e??{x:t.x,y:t.y}}function S8(){return navigator.maxTouchPoints||"ontouchstart"in this}uh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const kl=t=>()=>t;function N8(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function hh(t){t.stopImmediatePropagation()}function ma(t){t.preventDefault(),t.stopImmediatePropagation()}function C8(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function j8(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Xy(){return this.__zoom||Zo}function E8(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function _8(){return navigator.maxTouchPoints||"ontouchstart"in this}function I8(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}const Sl=O.createContext(null),T8=Sl.Provider,A8=t=>`Node type "${t}" not found. Using fallback type "default".`,M8=()=>"The React Flow parent container needs a width and a height to render the graph.",O8=()=>"Only child nodes can use a parent extent.",D8=t=>`Marker type "${t}" doesn't exist.`,P8=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,R8=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",L8=t=>`Edge type "${t}" not found. Using fallback type "default".`,F8=t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,Jy="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function at(t,e){const n=O.useContext(Sl);if(n===null)throw new Error(Jy);return qy(n,t,e)}const zt=()=>{const t=O.useContext(Sl);if(t===null)throw new Error(Jy);return O.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},z8=t=>t.userSelectionActive?"none":"all";function Nl({position:t,children:e,className:n,style:o,...r}){const s=at(z8),a=`${t}`.split("-");return G.createElement("div",{className:Xt(["react-flow__panel",n,...a]),style:{...o,pointerEvents:s},...r},e)}function B8({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:G.createElement(Nl,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},G.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var U8=O.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:a=[2,4],labelBgBorderRadius:i=2,children:l,className:d,...u})=>{const h=O.useRef(null),[f,m]=O.useState({x:0,y:0,width:0,height:0}),x=Xt(["react-flow__edge-textwrapper",d]);return O.useEffect(()=>{if(h.current){const g=h.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?G.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:x,visibility:f.width?"visible":"hidden",...u},r&&G.createElement("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:i,ry:i}),G.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const fh=t=>({width:t.offsetWidth,height:t.offsetHeight}),Gr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),mh=(t={x:0,y:0},e)=>({x:Gr(t.x,e[0][0],e[1][0]),y:Gr(t.y,e[0][1],e[1][1])}),Zy=(t,e,n)=>t<e?Gr(Math.abs(t-e),1,50)/50:t>n?-Gr(Math.abs(t-n),1,50)/50:0,Qy=(t,e)=>[20*Zy(t.x,35,e.width-35),20*Zy(t.y,35,e.height-35)],ev=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},ph=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),tv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),gh=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},wn=t=>!isNaN(t)&&isFinite(t),xt=Symbol.for("internals"),nv=["Enter"," ","Escape"];function xh(t){var o,r;const e=(s=>"nativeEvent"in s)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const ov=t=>"clientX"in t,Oo=(t,e)=>{var s,a;const n=ov(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(a=t.touches)==null?void 0:a[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Cl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},pa=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m=20})=>G.createElement(G.Fragment,null,G.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&G.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&wn(n)&&wn(o)?G.createElement(U8,{x:n,y:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d}):null);function ga(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function rv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,a=Math.abs(o-e)/2;return[s,o<e?o+a:o-a,r,a]}function sv({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:i}){const l=.125*t+.375*r+.375*a+.125*n,d=.125*e+.375*s+.375*i+.125*o;return[l,d,Math.abs(l-t),Math.abs(d-e)]}var cr,av,Do,bh,xa,iv,Po,ba,Yr,lv,Pe,jl;function cv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Pe.Left||t===Pe.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function dv({sourceX:t,sourceY:e,sourcePosition:n=Pe.Bottom,targetX:o,targetY:r,targetPosition:s=Pe.Top}){const[a,i]=cv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,d]=cv({pos:s,x1:o,y1:r,x2:t,y2:e}),[u,h,f,m]=sv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${i} ${l},${d} ${o},${r}`,u,h,f,m]}pa.displayName="BaseEdge",(av=cr||(cr={})).Strict="strict",av.Loose="loose",(bh=Do||(Do={})).Free="free",bh.Vertical="vertical",bh.Horizontal="horizontal",(iv=xa||(xa={})).Partial="partial",iv.Full="full",(ba=Po||(Po={})).Bezier="default",ba.Straight="straight",ba.Step="step",ba.SmoothStep="smoothstep",ba.SimpleBezier="simplebezier",(lv=Yr||(Yr={})).Arrow="arrow",lv.ArrowClosed="arrowclosed",(jl=Pe||(Pe={})).Left="left",jl.Top="top",jl.Right="right",jl.Bottom="bottom";const yh=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Pe.Bottom,targetPosition:s=Pe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})=>{const[p,b,y]=dv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return G.createElement(pa,{path:p,labelX:b,labelY:y,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})});yh.displayName="SimpleBezierEdge";const uv={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},hv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function $8({source:t,sourcePosition:e=Pe.Bottom,target:n,targetPosition:o=Pe.Top,center:r,offset:s}){const a=uv[e],i=uv[o],l={x:t.x+a.x*s,y:t.y+a.y*s},d={x:n.x+i.x*s,y:n.y+i.y*s},u=(({source:N,sourcePosition:C=Pe.Bottom,target:j})=>C===Pe.Left||C===Pe.Right?N.x<j.x?{x:1,y:0}:{x:-1,y:0}:N.y<j.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:d}),h=u.x!==0?"x":"y",f=u[h];let m,x,g=[];const p={x:0,y:0},b={x:0,y:0},[y,v,w,S]=rv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[h]*i[h]===-1){m=r.x??y,x=r.y??v;const N=[{x:m,y:l.y},{x:m,y:d.y}],C=[{x:l.x,y:x},{x:d.x,y:x}];g=a[h]===f?h==="x"?N:C:h==="x"?C:N}else{const N=[{x:l.x,y:d.y}],C=[{x:d.x,y:l.y}];if(g=h==="x"?a.x===f?C:N:a.y===f?N:C,e===o){const A=Math.abs(t[h]-n[h]);if(A<=s){const T=Math.min(s-1,s-A);a[h]===f?p[h]=(l[h]>t[h]?-1:1)*T:b[h]=(d[h]>n[h]?-1:1)*T}}if(e!==o){const A=h==="x"?"y":"x",T=a[h]===i[A],P=l[A]>d[A],L=l[A]<d[A];(a[h]===1&&(!T&&P||T&&L)||a[h]!==1&&(!T&&L||T&&P))&&(g=h==="x"?N:C)}const j={x:l.x+p.x,y:l.y+p.y},_={x:d.x+b.x,y:d.y+b.y};Math.max(Math.abs(j.x-g[0].x),Math.abs(_.x-g[0].x))>=Math.max(Math.abs(j.y-g[0].y),Math.abs(_.y-g[0].y))?(m=(j.x+_.x)/2,x=g[0].y):(m=g[0].x,x=(j.y+_.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:d.x+b.x,y:d.y+b.y},n],m,x,w,S]}function vh({sourceX:t,sourceY:e,sourcePosition:n=Pe.Bottom,targetX:o,targetY:r,targetPosition:s=Pe.Top,borderRadius:a=5,centerX:i,centerY:l,offset:d=20}){const[u,h,f,m,x]=$8({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:i,y:l},offset:d});return[u.reduce((g,p,b)=>{let y="";return y=b>0&&b<u.length-1?function(v,w,S,N){const C=Math.min(hv(v,w)/2,hv(w,S)/2,N),{x:j,y:_}=w;if(v.x===j&&j===S.x||v.y===_&&_===S.y)return`L${j} ${_}`;if(v.y===_)return`L ${j+C*(v.x<S.x?-1:1)},${_}Q ${j},${_} ${j},${_+C*(v.y<S.y?1:-1)}`;const A=v.x<S.x?1:-1;return`L ${j},${_+C*(v.y<S.y?-1:1)}Q ${j},${_} ${j+C*A},${_}`}(u[b-1],p,u[b+1],a):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=y},""),h,f,m,x]}const El=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,sourcePosition:h=Pe.Bottom,targetPosition:f=Pe.Top,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=vh({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return G.createElement(pa,{path:b,labelX:y,labelY:v,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:m,markerStart:x,interactionWidth:p})});El.displayName="SmoothStepEdge";const wh=O.memo(t=>{var e;return G.createElement(El,{...t,pathOptions:O.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});wh.displayName="StepEdge";const kh=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[x,g,p]=function({sourceX:b,sourceY:y,targetX:v,targetY:w}){const[S,N,C,j]=rv({sourceX:b,sourceY:y,targetX:v,targetY:w});return[`M ${b},${y}L ${v},${w}`,S,N,C,j]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return G.createElement(pa,{path:x,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})});function _l(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function fv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Pe.Left:return[e-_l(e-o,s),n];case Pe.Right:return[e+_l(o-e,s),n];case Pe.Top:return[e,n-_l(n-r,s)];case Pe.Bottom:return[e,n+_l(r-n,s)]}}function mv({sourceX:t,sourceY:e,sourcePosition:n=Pe.Bottom,targetX:o,targetY:r,targetPosition:s=Pe.Top,curvature:a=.25}){const[i,l]=fv({pos:n,x1:t,y1:e,x2:o,y2:r,c:a}),[d,u]=fv({pos:s,x1:o,y1:r,x2:t,y2:e,c:a}),[h,f,m,x]=sv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:d,targetControlY:u});return[`M${t},${e} C${i},${l} ${d},${u} ${o},${r}`,h,f,m,x]}kh.displayName="StraightEdge";const Il=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Pe.Bottom,targetPosition:s=Pe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=mv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return G.createElement(pa,{path:b,labelX:y,labelY:v,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:p})});Il.displayName="BezierEdge";const Sh=O.createContext(null),V8=Sh.Provider;Sh.Consumer;const H8=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Nh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,Ch=({x:t,y:e},[n,o,r],s,[a,i])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:a*Math.round(l.x/a),y:i*Math.round(l.y/i)}:l},pv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),Kr=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],o=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-o};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-o}:r}},jh=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:a}=Kr(r,e).positionAbsolute;return i=o,l=ph({x:s,y:a,width:r.width||0,height:r.height||0}),{x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x2,l.x2),y2:Math.max(i.y2,l.y2)};var i,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:a})=>({x:o,y:r,width:s-o,height:a-r}))(n)},gv=(t,e,[n,o,r]=[0,0,1],s=!1,a=!1,i=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},d=[];return t.forEach(u=>{const{width:h,height:f,selectable:m=!0,hidden:x=!1}=u;if(a&&!m||x)return!1;const{positionAbsolute:g}=Kr(u,i),p={x:g.x,y:g.y,width:h||0,height:f||0},b=gh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||u.dragging)&&d.push(u)}),d},xv=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},bv=(t,e,n,o,r,s=.1)=>{const a=e/(t.width*(1+s)),i=n/(t.height*(1+s)),l=Math.min(a,i),d=Gr(l,o,r);return{x:e/2-(t.x+t.width/2)*d,y:n/2-(t.y+t.height/2)*d,zoom:d}},dr=(t,e=0)=>t.transition().duration(e);function yv(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var a,i;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((a=t.positionAbsolute)==null?void 0:a.x)??0)+s.x+s.width/2,y:(((i=t.positionAbsolute)==null?void 0:i.y)??0)+s.y+s.height/2}),r},[])}const W8={source:null,target:null,sourceHandle:null,targetHandle:null},vv=()=>({handleDomNode:null,isValid:!1,connection:W8,endHandle:null});function wv(t,e,n,o,r,s,a){const i=r==="target",l=a.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),d={...vv(),handleDomNode:l};if(l){const u=Eh(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),x=l.classList.contains("connectableend"),g={source:i?h:n,sourceHandle:i?f:o,target:i?n:h,targetHandle:i?o:f};d.connection=g,m&&x&&(e===cr.Strict?i&&u==="source"||!i&&u==="target":h!==n||f!==o)&&(d.endHandle={nodeId:h,handleId:f,type:u},d.isValid=s(g))}return d}function Eh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function _h(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function q8(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function kv({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:a,isValidConnection:i,edgeUpdaterType:l,onReconnectEnd:d}){const u=ev(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:x,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:y}=s();let v,w=0;const{x:S,y:N}=Oo(t),C=u==null?void 0:u.elementFromPoint(S,N),j=Eh(l,C),_=f==null?void 0:f.getBoundingClientRect();if(!_||!j)return;let A,T=Oo(t,_),P=!1,L=null,M=!1,R=null;const z=function({nodes:B,nodeId:E,handleId:U,handleType:V}){return B.reduce(($,K)=>{if(K[xt]){const{handleBounds:X}=K[xt];let J=[],ee=[];X&&(J=yv(K,X,"source",`${E}-${U}-${V}`),ee=yv(K,X,"target",`${E}-${U}-${V}`)),$.push(...J,...ee)}return $},[])}({nodes:b(),nodeId:n,handleId:e,handleType:j}),D=()=>{if(!m)return;const[B,E]=Qy(T,_);p({x:B,y:E}),w=requestAnimationFrame(D)};function I(B){const{transform:E}=s();T=Oo(B,_);const{handle:U,validHandleResult:V}=function($,K,X,J,ee,q){const{x:Y,y:oe}=Oo($),se=K.elementsFromPoint(Y,oe).find(ye=>ye.classList.contains("react-flow__handle"));if(se){const ye=se.getAttribute("data-nodeid");if(ye){const ie=Eh(void 0,se),ve=se.getAttribute("data-handleid"),he=q({nodeId:ye,id:ve,type:ie});if(he){const Se=ee.find(De=>De.nodeId===ye&&De.type===ie&&De.id===ve);return{handle:{id:ve,type:ie,nodeId:ye,x:(Se==null?void 0:Se.x)||X.x,y:(Se==null?void 0:Se.y)||X.y},validHandleResult:he}}}}let re=[],ae=1/0;if(ee.forEach(ye=>{const ie=Math.sqrt((ye.x-X.x)**2+(ye.y-X.y)**2);if(ie<=J){const ve=q(ye);ie<=ae&&(ie<ae?re=[{handle:ye,validHandleResult:ve}]:ie===ae&&re.push({handle:ye,validHandleResult:ve}),ae=ie)}}),!re.length)return{handle:null,validHandleResult:vv()};if(re.length===1)return re[0];const te=re.some(({validHandleResult:ye})=>ye.isValid),be=re.some(({handle:ye})=>ye.type==="target");return re.find(({handle:ye,validHandleResult:ie})=>be?ye.type==="target":!te||ie.isValid)||re[0]}(B,u,Ch(T,E,!1,[1,1]),x,z,$=>wv($,h,n,e,r?"target":"source",i,u));if(v=U,P||(D(),P=!0),R=V.handleDomNode,L=V.connection,M=V.isValid,a({connectionPosition:v&&M?pv({x:v.x,y:v.y},E):T,connectionStatus:q8(!!v,M),connectionEndHandle:V.endHandle}),!v&&!M&&!R)return _h(A);L.source!==L.target&&R&&(_h(A),A=R,R.classList.add("connecting","react-flow__handle-connecting"),R.classList.toggle("valid",M),R.classList.toggle("react-flow__handle-valid",M))}function k(B){var E,U;(v||R)&&L&&M&&(o==null||o(L)),(U=(E=s()).onConnectEnd)==null||U.call(E,B),l&&(d==null||d(B)),_h(A),y(),cancelAnimationFrame(w),P=!1,M=!1,L=null,R=null,u.removeEventListener("mousemove",I),u.removeEventListener("mouseup",k),u.removeEventListener("touchmove",I),u.removeEventListener("touchend",k)}a({connectionPosition:T,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}),u.addEventListener("mousemove",I),u.addEventListener("mouseup",k),u.addEventListener("touchmove",I),u.addEventListener("touchend",k)}const Sv=()=>!0,G8=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Nv=O.forwardRef(({type:t="source",position:e=Pe.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:i,children:l,className:d,onMouseDown:u,onTouchStart:h,...f},m)=>{var j,_;const x=a||null,g=t==="target",p=zt(),b=O.useContext(Sh),{connectOnClick:y,noPanClassName:v}=at(G8,Ht),{connecting:w,clickConnecting:S}=at(((A,T,P)=>L=>{const{connectionStartHandle:M,connectionEndHandle:R,connectionClickStartHandle:z}=L;return{connecting:(M==null?void 0:M.nodeId)===A&&(M==null?void 0:M.handleId)===T&&(M==null?void 0:M.type)===P||(R==null?void 0:R.nodeId)===A&&(R==null?void 0:R.handleId)===T&&(R==null?void 0:R.type)===P,clickConnecting:(z==null?void 0:z.nodeId)===A&&(z==null?void 0:z.handleId)===T&&(z==null?void 0:z.type)===P}})(b,x,t),Ht);b||((_=(j=p.getState()).onError)==null||_.call(j,"010",R8()));const N=A=>{const{defaultEdgeOptions:T,onConnect:P,hasDefaultEdges:L}=p.getState(),M={...T,...A};if(L){const{edges:R,setEdges:z}=p.getState();z(((D,I)=>{if(!D.source||!D.target)return I;let k;return k=(B=>"id"in B&&"source"in B&&"target"in B)(D)?{...D}:{...D,id:H8(D)},((B,E)=>E.some(U=>!(U.source!==B.source||U.target!==B.target||U.sourceHandle!==B.sourceHandle&&(U.sourceHandle||B.sourceHandle)||U.targetHandle!==B.targetHandle&&(U.targetHandle||B.targetHandle))))(k,I)?I:I.concat(k)})(M,R))}P==null||P(M),i==null||i(M)},C=A=>{if(!b)return;const T=ov(A);r&&(T&&A.button===0||!T)&&kv({event:A,handleId:x,nodeId:b,onConnect:N,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||Sv}),T?u==null||u(A):h==null||h(A)};return G.createElement("div",{"data-handleid":x,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${x}-${t}`,className:Xt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,d,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:S,connectionindicator:o&&(r&&!w||s&&w)}]),onMouseDown:C,onTouchStart:C,onClick:y?A=>{const{onClickConnectStart:T,onClickConnectEnd:P,connectionClickStartHandle:L,connectionMode:M,isValidConnection:R}=p.getState();if(!b||!L&&!r)return;if(!L)return T==null||T(A,{nodeId:b,handleId:x,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:x}});const z=ev(A.target),D=n||R||Sv,{connection:I,isValid:k}=wv({nodeId:b,id:x,type:t},M,L.nodeId,L.handleId||null,L.type,D,z);k&&N(I),P==null||P(A),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});Nv.displayName="Handle";var Ro=O.memo(Nv);const Cv=({data:t,isConnectable:e,targetPosition:n=Pe.Top,sourcePosition:o=Pe.Bottom})=>G.createElement(G.Fragment,null,G.createElement(Ro,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,G.createElement(Ro,{type:"source",position:o,isConnectable:e}));Cv.displayName="DefaultNode";var Ih=O.memo(Cv);const jv=({data:t,isConnectable:e,sourcePosition:n=Pe.Bottom})=>G.createElement(G.Fragment,null,t==null?void 0:t.label,G.createElement(Ro,{type:"source",position:n,isConnectable:e}));jv.displayName="InputNode";var Ev=O.memo(jv);const _v=({data:t,isConnectable:e,targetPosition:n=Pe.Top})=>G.createElement(G.Fragment,null,G.createElement(Ro,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);_v.displayName="OutputNode";var Iv=O.memo(_v);const Th=()=>null;Th.displayName="GroupNode";const Y8=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Tl=t=>t.id;function K8(t,e){return Ht(t.selectedNodes.map(Tl),e.selectedNodes.map(Tl))&&Ht(t.selectedEdges.map(Tl),e.selectedEdges.map(Tl))}const Tv=O.memo(({onSelectionChange:t})=>{const e=zt(),{selectedNodes:n,selectedEdges:o}=at(Y8,K8);return O.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});Tv.displayName="SelectionListener";const X8=t=>!!t.onSelectionChange;function J8({onSelectionChange:t}){const e=at(X8);return t||e?G.createElement(Tv,{onSelectionChange:t}):null}const Z8=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function Xr(t,e){O.useEffect(()=>{t!==void 0&&e(t)},[t])}function Ze(t,e,n){O.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const Q8=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:a,onClickConnectStart:i,onClickConnectEnd:l,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:x,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:v,elementsSelectable:w,connectionMode:S,snapGrid:N,snapToGrid:C,translateExtent:j,connectOnClick:_,defaultEdgeOptions:A,fitView:T,fitViewOptions:P,onNodesDelete:L,onEdgesDelete:M,onNodeDrag:R,onNodeDragStart:z,onNodeDragStop:D,onSelectionDrag:I,onSelectionDragStart:k,onSelectionDragStop:B,noPanClassName:E,nodeOrigin:U,rfId:V,autoPanOnConnect:$,autoPanOnNodeDrag:K,onError:X,connectionRadius:J,isValidConnection:ee,nodeDragThreshold:q})=>{const{setNodes:Y,setEdges:oe,setDefaultNodesAndEdges:se,setMinZoom:re,setMaxZoom:ae,setTranslateExtent:te,setNodeExtent:be,reset:ye}=at(Z8,Ht),ie=zt();return O.useEffect(()=>{const ve=o==null?void 0:o.map(he=>({...he,...A}));return se(n,ve),()=>{ye()}},[]),Ze("defaultEdgeOptions",A,ie.setState),Ze("connectionMode",S,ie.setState),Ze("onConnect",r,ie.setState),Ze("onConnectStart",s,ie.setState),Ze("onConnectEnd",a,ie.setState),Ze("onClickConnectStart",i,ie.setState),Ze("onClickConnectEnd",l,ie.setState),Ze("nodesDraggable",d,ie.setState),Ze("nodesConnectable",u,ie.setState),Ze("nodesFocusable",h,ie.setState),Ze("edgesFocusable",f,ie.setState),Ze("edgesUpdatable",m,ie.setState),Ze("elementsSelectable",w,ie.setState),Ze("elevateNodesOnSelect",x,ie.setState),Ze("snapToGrid",C,ie.setState),Ze("snapGrid",N,ie.setState),Ze("onNodesChange",y,ie.setState),Ze("onEdgesChange",v,ie.setState),Ze("connectOnClick",_,ie.setState),Ze("fitViewOnInit",T,ie.setState),Ze("fitViewOnInitOptions",P,ie.setState),Ze("onNodesDelete",L,ie.setState),Ze("onEdgesDelete",M,ie.setState),Ze("onNodeDrag",R,ie.setState),Ze("onNodeDragStart",z,ie.setState),Ze("onNodeDragStop",D,ie.setState),Ze("onSelectionDrag",I,ie.setState),Ze("onSelectionDragStart",k,ie.setState),Ze("onSelectionDragStop",B,ie.setState),Ze("noPanClassName",E,ie.setState),Ze("nodeOrigin",U,ie.setState),Ze("rfId",V,ie.setState),Ze("autoPanOnConnect",$,ie.setState),Ze("autoPanOnNodeDrag",K,ie.setState),Ze("onError",X,ie.setState),Ze("connectionRadius",J,ie.setState),Ze("isValidConnection",ee,ie.setState),Ze("nodeDragThreshold",q,ie.setState),Xr(t,Y),Xr(e,oe),Xr(g,re),Xr(p,ae),Xr(j,te),Xr(b,be),null},Av={display:"none"},eT={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mv="react-flow__node-desc",Ov="react-flow__edge-desc",tT=t=>t.ariaLiveMessage;function nT({rfId:t}){const e=at(tT);return G.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:eT},e)}function oT({rfId:t,disableKeyboardA11y:e}){return G.createElement(G.Fragment,null,G.createElement("div",{id:`${Mv}-${t}`,style:Av},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),G.createElement("div",{id:`${Ov}-${t}`,style:Av},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&G.createElement(nT,{rfId:t}))}var ya=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=O.useState(!1),r=O.useRef(!1),s=O.useRef(new Set([])),[a,i]=O.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.split("+")),d=l.reduce((u,h)=>u.concat(...h),[]);return[l,d]}return[[],[]]},[t]);return O.useEffect(()=>{const l=typeof document<"u"?document:null,d=(e==null?void 0:e.target)||l;if(t!==null){const u=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&xh(m))return!1;const x=Pv(m.code,i);s.current.add(m[x]),Dv(a,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&xh(m))return!1;const x=Pv(m.code,i);Dv(a,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[x]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return d==null||d.addEventListener("keydown",u),d==null||d.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{d==null||d.removeEventListener("keydown",u),d==null||d.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function Dv(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function Pv(t,e){return e.includes(t)?"code":"key"}function Rv(t,e,n,o){var i,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),a=Kr(s,o);return Rv(s,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(((i=s[xt])==null?void 0:i.z)??0)>(n.z??0)?((l=s[xt])==null?void 0:l.z)??0:n.z??0},o)}function Lv(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:a,y:i,z:l}=Rv(o,t,{...o.position,z:((s=o[xt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:a,y:i},o[xt].z=l,n!=null&&n[o.id]&&(o[xt].isParent=!0)}})}function Ah(t,e,n,o){const r=new Map,s={},a=o?1e3:0;return t.forEach(i=>{var m;const l=(wn(i.zIndex)?i.zIndex:0)+(i.selected?a:0),d=e.get(i.id),u={...i,positionAbsolute:{x:i.position.x,y:i.position.y}},h=i.parentNode||i.parentId;h&&(s[h]=!0);const f=(d==null?void 0:d.type)&&(d==null?void 0:d.type)!==i.type;Object.defineProperty(u,xt,{enumerable:!1,value:{handleBounds:f||(m=d==null?void 0:d[xt])==null?void 0:m.handleBounds,z:l}}),r.set(i.id,u)}),Lv(r,n,s),r}function Fv(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:a,d3Zoom:i,d3Selection:l,fitViewOnInitDone:d,fitViewOnInit:u,nodeOrigin:h}=t(),f=e.initial&&!d&&u;if(i&&l&&(f||!e.initial)){const m=n().filter(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(y=>y.id===g.id):p}),x=m.every(g=>g.width&&g.height);if(m.length>0&&x){const g=jh(m,h),{x:p,y:b,zoom:y}=bv(g,o,r,e.minZoom??s,e.maxZoom??a,e.padding??.1),v=Zo.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?i.transform(dr(l,e.duration),v):i.transform(l,v),!0}}return!1}function rT(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[xt]:o[xt],selected:n.selected})}),new Map(e)}function sT(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Al({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:a,onEdgesChange:i,hasDefaultNodes:l,hasDefaultEdges:d}=n();t!=null&&t.length&&(l&&o({nodeInternals:rT(t,r)}),a==null||a(t)),e!=null&&e.length&&(d&&o({edges:sT(e,s)}),i==null||i(e))}const Jr=()=>{},aT={zoomIn:Jr,zoomOut:Jr,zoomTo:Jr,getZoom:()=>1,setViewport:Jr,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Jr,fitBounds:Jr,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},iT=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function va(){const t=(()=>{const g=zt(),{d3Zoom:p,d3Selection:b}=at(iT,Ht);return O.useMemo(()=>b&&p?{zoomIn:v=>p.scaleBy(dr(b,v==null?void 0:v.duration),1.2),zoomOut:v=>p.scaleBy(dr(b,v==null?void 0:v.duration),1/1.2),zoomTo:(v,w)=>p.scaleTo(dr(b,w==null?void 0:w.duration),v),getZoom:()=>g.getState().transform[2],setViewport:(v,w)=>{const[S,N,C]=g.getState().transform,j=Zo.translate(v.x??S,v.y??N).scale(v.zoom??C);p.transform(dr(b,w==null?void 0:w.duration),j)},getViewport:()=>{const[v,w,S]=g.getState().transform;return{x:v,y:w,zoom:S}},fitView:v=>Fv(g.getState,v),setCenter:(v,w,S)=>{const{width:N,height:C,maxZoom:j}=g.getState(),_=(S==null?void 0:S.zoom)!==void 0?S.zoom:j,A=N/2-v*_,T=C/2-w*_,P=Zo.translate(A,T).scale(_);p.transform(dr(b,S==null?void 0:S.duration),P)},fitBounds:(v,w)=>{const{width:S,height:N,minZoom:C,maxZoom:j}=g.getState(),{x:_,y:A,zoom:T}=bv(v,S,N,C,j,(w==null?void 0:w.padding)??.1),P=Zo.translate(_,A).scale(T);p.transform(dr(b,w==null?void 0:w.duration),P)},project:v=>{const{transform:w,snapToGrid:S,snapGrid:N}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Ch(v,w,S,N)},screenToFlowPosition:v=>{const{transform:w,snapToGrid:S,snapGrid:N,domNode:C}=g.getState();if(!C)return v;const{x:j,y:_}=C.getBoundingClientRect(),A={x:v.x-j,y:v.y-_};return Ch(A,w,S,N)},flowToScreenPosition:v=>{const{transform:w,domNode:S}=g.getState();if(!S)return v;const{x:N,y:C}=S.getBoundingClientRect(),j=pv(v,w);return{x:j.x+N,y:j.y+C}},viewportInitialized:!0}:aT,[p,b])})(),e=zt(),n=O.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=O.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=O.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=O.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),a=O.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:v}=e.getState(),w=p(),S=typeof g=="function"?g(w):g;if(y)b(S);else if(v){const N=S.length===0?w.map(C=>({type:"remove",id:C.id})):S.map(C=>({item:C,type:"reset"}));v(N)}},[]),i=O.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:v}=e.getState(),w=typeof g=="function"?g(p):g;y?b(w):v&&v(w.length===0?p.map(S=>({type:"remove",id:S.id})):w.map(S=>({item:S,type:"reset"})))},[]),l=O.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:v,onNodesChange:w}=e.getState();if(v)y([...b(),...p]);else if(w){const S=p.map(N=>({item:N,type:"add"}));w(S)}},[]),d=O.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:v,onEdgesChange:w}=e.getState();v?y([...b,...p]):w&&w(p.map(S=>({item:S,type:"add"})))},[]),u=O.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[y,v,w]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x:y,y:v,zoom:w}}},[]),h=O.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:v,hasDefaultNodes:w,hasDefaultEdges:S,onNodesDelete:N,onEdgesDelete:C,onNodesChange:j,onEdgesChange:_}=e.getState(),A=(g||[]).map(R=>R.id),T=(p||[]).map(R=>R.id),P=y().reduce((R,z)=>{const D=z.parentNode||z.parentId,I=!A.includes(z.id)&&D&&R.find(k=>k.id===D);return(typeof z.deletable!="boolean"||z.deletable)&&(A.includes(z.id)||I)&&R.push(z),R},[]),L=v.filter(R=>typeof R.deletable!="boolean"||R.deletable),M=L.filter(R=>T.includes(R.id));if(P||M){const R=xv(P,L),z=[...M,...R],D=z.reduce((I,k)=>(I.includes(k.id)||I.push(k.id),I),[]);(S||w)&&(S&&e.setState({edges:v.filter(I=>!D.includes(I.id))}),w&&(P.forEach(I=>{b.delete(I.id)}),e.setState({nodeInternals:new Map(b)}))),D.length>0&&(C==null||C(z),_&&_(D.map(I=>({id:I,type:"remove"})))),P.length>0&&(N==null||N(P),j)&&j(P.map(I=>({id:I.id,type:"remove"})))}},[]),f=O.useCallback(g=>{const p=wn((b=g).width)&&wn(b.height)&&wn(b.x)&&wn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(g.id);return!p&&!y?[null,null,p]:[p?g:tv(y),y,p]},[]),m=O.useCallback((g,p=!0,b)=>{const[y,v,w]=f(g);return y?(b||e.getState().getNodes()).filter(S=>{if(!(w||S.id!==v.id&&S.positionAbsolute))return!1;const N=tv(S),C=gh(N,y);return p&&C>0||C>=y.width*y.height}):[]},[]),x=O.useCallback((g,p,b=!0)=>{const[y]=f(g);if(!y)return!1;const v=gh(y,p);return b&&v>0||v>=y.width*y.height},[]);return O.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:a,setEdges:i,addNodes:l,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:x}),[t,n,o,r,s,a,i,l,d,u,h,m,x])}const lT={actInsideInputWithModifier:!1},Mh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ml=t=>({x:t.x,y:t.y,zoom:t.k}),Zr=(t,e)=>t.target.closest(`.${e}`),zv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Bv=t=>{const e=t.ctrlKey&&Cl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},cT=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),dT=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:a=!1,panOnScrollSpeed:i=.5,panOnScrollMode:l=Do.Free,zoomOnDoubleClick:d=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:x,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:v,noPanClassName:w})=>{const S=O.useRef(),N=zt(),C=O.useRef(!1),j=O.useRef(!1),_=O.useRef(null),A=O.useRef({x:0,y:0,zoom:0}),{d3Zoom:T,d3Selection:P,d3ZoomHandler:L,userSelectionActive:M}=at(cT,Ht),R=ya(p),z=O.useRef(0),D=O.useRef(!1),I=O.useRef();return function(k){const B=zt();O.useEffect(()=>{let E;const U=()=>{var $,K;if(!k.current)return;const V=fh(k.current);V.height!==0&&V.width!==0||((K=($=B.getState()).onError)==null||K.call($,"004",M8())),B.setState({width:V.width||500,height:V.height||500})};return U(),window.addEventListener("resize",U),k.current&&(E=new ResizeObserver(()=>U()),E.observe(k.current)),()=>{window.removeEventListener("resize",U),E&&k.current&&E.unobserve(k.current)}},[])}(_),O.useEffect(()=>{if(_.current){const k=_.current.getBoundingClientRect(),B=function(){var K,X,J,ee=C8,q=j8,Y=I8,oe=E8,se=_8,re=[0,1/0],ae=[[-1/0,-1/0],[1/0,1/0]],te=250,be=TL,ye=TS("start","zoom","end"),ie=0,ve=10;function he(W){W.property("__zoom",Xy).on("wheel.zoom",qe,{passive:!1}).on("mousedown.zoom",Ke).on("dblclick.zoom",Q).filter(se).on("touchstart.zoom",xe).on("touchmove.zoom",we).on("touchend.zoom touchcancel.zoom",Te).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Se(W,ne){return(ne=Math.max(re[0],Math.min(re[1],ne)))===W.k?W:new zm(ne,W.x,W.y)}function De(W,ne,ue){var de=ne[0]-ue[0]*W.k,ge=ne[1]-ue[1]*W.k;return de===W.x&&ge===W.y?W:new zm(W.k,de,ge)}function _e(W){return[(+W[0][0]+ +W[1][0])/2,(+W[0][1]+ +W[1][1])/2]}function Fe(W,ne,ue,de){W.on("start.zoom",function(){Oe(this,arguments).event(de).start()}).on("interrupt.zoom end.zoom",function(){Oe(this,arguments).event(de).end()}).tween("zoom",function(){var ge=this,Me=arguments,Re=Oe(ge,Me).event(de),He=q.apply(ge,Me),le=ue==null?_e(He):typeof ue=="function"?ue.apply(ge,Me):ue,Ne=Math.max(He[1][0]-He[0][0],He[1][1]-He[0][1]),je=ge.__zoom,Le=typeof ne=="function"?ne.apply(ge,Me):ne,Ve=be(je.invert(le).concat(Ne/je.k),Le.invert(le).concat(Ne/Le.k));return function(Ae){if(Ae===1)Ae=Le;else{var Ue=Ve(Ae),Je=Ne/Ue[2];Ae=new zm(Je,le[0]-Ue[0]*Je,le[1]-Ue[1]*Je)}Re.zoom(null,Ae)}})}function Oe(W,ne,ue){return!ue&&W.__zooming||new Qe(W,ne)}function Qe(W,ne){this.that=W,this.args=ne,this.active=0,this.sourceEvent=null,this.extent=q.apply(W,ne),this.taps=0}function qe(W,...ne){if(ee.apply(this,arguments)){var ue=Oe(this,ne).event(W),de=this.__zoom,ge=Math.max(re[0],Math.min(re[1],de.k*Math.pow(2,oe.apply(this,arguments)))),Me=Hn(W);if(ue.wheel)ue.mouse[0][0]===Me[0]&&ue.mouse[0][1]===Me[1]||(ue.mouse[1]=de.invert(ue.mouse[0]=Me)),clearTimeout(ue.wheel);else{if(de.k===ge)return;ue.mouse=[Me,de.invert(Me)],Bm(this),ue.start()}ma(W),ue.wheel=setTimeout(function(){ue.wheel=null,ue.end()},150),ue.zoom("mouse",Y(De(Se(de,ge),ue.mouse[0],ue.mouse[1]),ue.extent,ae))}}function Ke(W,...ne){if(!J&&ee.apply(this,arguments)){var ue=W.currentTarget,de=Oe(this,ne,!0).event(W),ge=Ln(W.view).on("mousemove.zoom",function(le){if(ma(le),!de.moved){var Ne=le.clientX-Re,je=le.clientY-He;de.moved=Ne*Ne+je*je>ie}de.event(le).zoom("mouse",Y(De(de.that.__zoom,de.mouse[0]=Hn(le,ue),de.mouse[1]),de.extent,ae))},!0).on("mouseup.zoom",function(le){ge.on("mousemove.zoom mouseup.zoom",null),Ky(le.view,de.moved),ma(le),de.event(le).end()},!0),Me=Hn(W,ue),Re=W.clientX,He=W.clientY;Yy(W.view),hh(W),de.mouse=[Me,this.__zoom.invert(Me)],Bm(this),de.start()}}function Q(W,...ne){if(ee.apply(this,arguments)){var ue=this.__zoom,de=Hn(W.changedTouches?W.changedTouches[0]:W,this),ge=ue.invert(de),Me=ue.k*(W.shiftKey?.5:2),Re=Y(De(Se(ue,Me),de,ge),q.apply(this,ne),ae);ma(W),te>0?Ln(this).transition().duration(te).call(Fe,Re,de,W):Ln(this).call(he.transform,Re,de,W)}}function xe(W,...ne){if(ee.apply(this,arguments)){var ue,de,ge,Me,Re=W.touches,He=Re.length,le=Oe(this,ne,W.changedTouches.length===He).event(W);for(hh(W),de=0;de<He;++de)Me=[Me=Hn(ge=Re[de],this),this.__zoom.invert(Me),ge.identifier],le.touch0?le.touch1||le.touch0[2]===Me[2]||(le.touch1=Me,le.taps=0):(le.touch0=Me,ue=!0,le.taps=1+!!K);K&&(K=clearTimeout(K)),ue&&(le.taps<2&&(X=Me[0],K=setTimeout(function(){K=null},500)),Bm(this),le.start())}}function we(W,...ne){if(this.__zooming){var ue,de,ge,Me,Re=Oe(this,ne).event(W),He=W.changedTouches,le=He.length;for(ma(W),ue=0;ue<le;++ue)ge=Hn(de=He[ue],this),Re.touch0&&Re.touch0[2]===de.identifier?Re.touch0[0]=ge:Re.touch1&&Re.touch1[2]===de.identifier&&(Re.touch1[0]=ge);if(de=Re.that.__zoom,Re.touch1){var Ne=Re.touch0[0],je=Re.touch0[1],Le=Re.touch1[0],Ve=Re.touch1[1],Ae=(Ae=Le[0]-Ne[0])*Ae+(Ae=Le[1]-Ne[1])*Ae,Ue=(Ue=Ve[0]-je[0])*Ue+(Ue=Ve[1]-je[1])*Ue;de=Se(de,Math.sqrt(Ae/Ue)),ge=[(Ne[0]+Le[0])/2,(Ne[1]+Le[1])/2],Me=[(je[0]+Ve[0])/2,(je[1]+Ve[1])/2]}else{if(!Re.touch0)return;ge=Re.touch0[0],Me=Re.touch0[1]}Re.zoom("touch",Y(De(de,ge,Me),Re.extent,ae))}}function Te(W,...ne){if(this.__zooming){var ue,de,ge=Oe(this,ne).event(W),Me=W.changedTouches,Re=Me.length;for(hh(W),J&&clearTimeout(J),J=setTimeout(function(){J=null},500),ue=0;ue<Re;++ue)de=Me[ue],ge.touch0&&ge.touch0[2]===de.identifier?delete ge.touch0:ge.touch1&&ge.touch1[2]===de.identifier&&delete ge.touch1;if(ge.touch1&&!ge.touch0&&(ge.touch0=ge.touch1,delete ge.touch1),ge.touch0)ge.touch0[1]=this.__zoom.invert(ge.touch0[0]);else if(ge.end(),ge.taps===2&&(de=Hn(de,this),Math.hypot(X[0]-de[0],X[1]-de[1])<ve)){var He=Ln(this).on("dblclick.zoom");He&&He.apply(this,arguments)}}}return he.transform=function(W,ne,ue,de){var ge=W.selection?W.selection():W;ge.property("__zoom",Xy),W!==ge?Fe(W,ne,ue,de):ge.interrupt().each(function(){Oe(this,arguments).event(de).start().zoom(null,typeof ne=="function"?ne.apply(this,arguments):ne).end()})},he.scaleBy=function(W,ne,ue,de){he.scaleTo(W,function(){return this.__zoom.k*(typeof ne=="function"?ne.apply(this,arguments):ne)},ue,de)},he.scaleTo=function(W,ne,ue,de){he.transform(W,function(){var ge=q.apply(this,arguments),Me=this.__zoom,Re=ue==null?_e(ge):typeof ue=="function"?ue.apply(this,arguments):ue,He=Me.invert(Re),le=typeof ne=="function"?ne.apply(this,arguments):ne;return Y(De(Se(Me,le),Re,He),ge,ae)},ue,de)},he.translateBy=function(W,ne,ue,de){he.transform(W,function(){return Y(this.__zoom.translate(typeof ne=="function"?ne.apply(this,arguments):ne,typeof ue=="function"?ue.apply(this,arguments):ue),q.apply(this,arguments),ae)},null,de)},he.translateTo=function(W,ne,ue,de,ge){he.transform(W,function(){var Me=q.apply(this,arguments),Re=this.__zoom,He=de==null?_e(Me):typeof de=="function"?de.apply(this,arguments):de;return Y(Zo.translate(He[0],He[1]).scale(Re.k).translate(typeof ne=="function"?-ne.apply(this,arguments):-ne,typeof ue=="function"?-ue.apply(this,arguments):-ue),Me,ae)},de,ge)},Qe.prototype={event:function(W){return W&&(this.sourceEvent=W),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(W,ne){return this.mouse&&W!=="mouse"&&(this.mouse[1]=ne.invert(this.mouse[0])),this.touch0&&W!=="touch"&&(this.touch0[1]=ne.invert(this.touch0[0])),this.touch1&&W!=="touch"&&(this.touch1[1]=ne.invert(this.touch1[0])),this.that.__zoom=ne,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(W){var ne=Ln(this.that).datum();ye.call(W,this.that,new N8(W,{sourceEvent:this.sourceEvent,target:he,transform:this.that.__zoom,dispatch:ye}),ne)}},he.wheelDelta=function(W){return arguments.length?(oe=typeof W=="function"?W:kl(+W),he):oe},he.filter=function(W){return arguments.length?(ee=typeof W=="function"?W:kl(!!W),he):ee},he.touchable=function(W){return arguments.length?(se=typeof W=="function"?W:kl(!!W),he):se},he.extent=function(W){return arguments.length?(q=typeof W=="function"?W:kl([[+W[0][0],+W[0][1]],[+W[1][0],+W[1][1]]]),he):q},he.scaleExtent=function(W){return arguments.length?(re[0]=+W[0],re[1]=+W[1],he):[re[0],re[1]]},he.translateExtent=function(W){return arguments.length?(ae[0][0]=+W[0][0],ae[1][0]=+W[1][0],ae[0][1]=+W[0][1],ae[1][1]=+W[1][1],he):[[ae[0][0],ae[0][1]],[ae[1][0],ae[1][1]]]},he.constrain=function(W){return arguments.length?(Y=W,he):Y},he.duration=function(W){return arguments.length?(te=+W,he):te},he.interpolate=function(W){return arguments.length?(be=W,he):be},he.on=function(){var W=ye.on.apply(ye,arguments);return W===ye?he:W},he.clickDistance=function(W){return arguments.length?(ie=(W=+W)*W,he):Math.sqrt(ie)},he.tapDistance=function(W){return arguments.length?(ve=+W,he):ve},he}().scaleExtent([x,g]).translateExtent(m),E=Ln(_.current).call(B),U=Zo.translate(f.x,f.y).scale(Gr(f.zoom,x,g)),V=[[0,0],[k.width,k.height]],$=B.constrain()(U,V,m);B.transform(E,$),B.wheelDelta(Bv),N.setState({d3Zoom:B,d3Selection:E,d3ZoomHandler:E.on("wheel.zoom"),transform:[$.x,$.y,$.k],domNode:_.current.closest(".react-flow")})}},[]),O.useEffect(()=>{P&&T&&(!a||R||M?L!==void 0&&P.on("wheel.zoom",function(k,B){if(!b&&k.type==="wheel"&&!k.ctrlKey||Zr(k,v))return null;k.preventDefault(),L.call(this,k,B)},{passive:!1}):P.on("wheel.zoom",k=>{if(Zr(k,v))return!1;k.preventDefault(),k.stopImmediatePropagation();const B=P.property("__zoom").k||1;if(k.ctrlKey&&s){const ee=Hn(k),q=Bv(k),Y=B*Math.pow(2,q);return void T.scaleTo(P,Y,ee,k)}const E=k.deltaMode===1?20:1;let U=l===Do.Vertical?0:k.deltaX*E,V=l===Do.Horizontal?0:k.deltaY*E;!Cl()&&k.shiftKey&&l!==Do.Vertical&&(U=k.deltaY*E,V=0),T.translateBy(P,-U/B*i,-V/B*i,{internal:!0});const $=Ml(P.property("__zoom")),{onViewportChangeStart:K,onViewportChange:X,onViewportChangeEnd:J}=N.getState();clearTimeout(I.current),D.current||(D.current=!0,e==null||e(k,$),K==null||K($)),D.current&&(t==null||t(k,$),X==null||X($),I.current=setTimeout(()=>{n==null||n(k,$),J==null||J($),D.current=!1},150))},{passive:!1}))},[M,a,l,P,T,L,R,s,b,v,e,t,n]),O.useEffect(()=>{T&&T.on("start",k=>{var U,V;if(!k.sourceEvent||k.sourceEvent.internal)return null;z.current=(U=k.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:B}=N.getState(),E=Ml(k.transform);C.current=!0,A.current=E,((V=k.sourceEvent)==null?void 0:V.type)==="mousedown"&&N.setState({paneDragging:!0}),B==null||B(E),e==null||e(k.sourceEvent,E)})},[T,e]),O.useEffect(()=>{T&&(M&&!C.current?T.on("zoom",null):M||T.on("zoom",k=>{var E;const{onViewportChange:B}=N.getState();if(N.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),j.current=!(!o||!zv(h,z.current??0)),(t||B)&&!((E=k.sourceEvent)!=null&&E.internal)){const U=Ml(k.transform);B==null||B(U),t==null||t(k.sourceEvent,U)}}))},[M,T,t,h,o]),O.useEffect(()=>{T&&T.on("end",k=>{if(!k.sourceEvent||k.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=N.getState();if(C.current=!1,N.setState({paneDragging:!1}),o&&zv(h,z.current??0)&&!j.current&&o(k.sourceEvent),j.current=!1,(n||B)&&(E=A.current,U=k.transform,E.x!==U.x||E.y!==U.y||E.zoom!==U.k)){const V=Ml(k.transform);A.current=V,clearTimeout(S.current),S.current=setTimeout(()=>{B==null||B(V),n==null||n(k.sourceEvent,V)},a?150:0)}var E,U})},[T,a,h,n,o]),O.useEffect(()=>{T&&T.filter(k=>{const B=R||r,E=s&&k.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&k.button===1&&k.type==="mousedown"&&(Zr(k,"react-flow__node")||Zr(k,"react-flow__edge")))return!0;if(!(h||B||a||d||s)||M||!d&&k.type==="dblclick"||Zr(k,v)&&k.type==="wheel"||Zr(k,w)&&(k.type!=="wheel"||a&&k.type==="wheel"&&!R)||!s&&k.ctrlKey&&k.type==="wheel"||!B&&!a&&!E&&k.type==="wheel"||!h&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(h)&&!h.includes(k.button)&&k.type==="mousedown")return!1;const U=Array.isArray(h)&&h.includes(k.button)||!k.button||k.button<=1;return(!k.ctrlKey||k.type==="wheel")&&U})},[M,T,r,s,a,d,h,u,R]),G.createElement("div",{className:"react-flow__renderer",ref:_,style:Mh},y)},uT=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function hT(){const{userSelectionActive:t,userSelectionRect:e}=at(uT,Ht);return t&&e?G.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Uv(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const a=Math.abs(e.position.x);o.position.x=o.position.x-a,o.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);o.position.y=o.position.y-a,o.style.height+=a,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function $v(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(i=>i.id===r.id);if(s.length===0)return o.push(r),o;const a={...r};for(const i of s)if(i)switch(i.type){case"select":a.selected=i.selected;break;case"position":i.position!==void 0&&(a.position=i.position),i.positionAbsolute!==void 0&&(a.positionAbsolute=i.positionAbsolute),i.dragging!==void 0&&(a.dragging=i.dragging),a.expandParent&&Uv(o,a);break;case"dimensions":i.dimensions!==void 0&&(a.width=i.dimensions.width,a.height=i.dimensions.height),i.updateStyle!==void 0&&(a.style={...a.style||{},...i.dimensions}),typeof i.resizing=="boolean"&&(a.resizing=i.resizing),a.expandParent&&Uv(o,a);break;case"remove":return o}return o.push(a),o},n)}function Vv(t,e){return $v(t,e)}const Lo=(t,e)=>({id:t,type:"select",selected:e});function Qr(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Lo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Lo(o.id,!1))),n},[])}const Oh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},fT=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Hv=O.memo(({isSelecting:t,selectionMode:e=xa.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:a,onPaneScroll:i,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:u,children:h})=>{const f=O.useRef(null),m=zt(),x=O.useRef(0),g=O.useRef(0),p=O.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:v}=at(fT,Ht),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,g.current=0},S=j=>{s==null||s(j),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},N=i?j=>i(j):void 0,C=y&&(t||b);return G.createElement("div",{className:Xt(["react-flow__pane",{dragging:v,selection:t}]),onClick:C?void 0:Oh(S,f),onContextMenu:Oh(j=>{Array.isArray(n)&&(n!=null&&n.includes(2))?j.preventDefault():a==null||a(j)},f),onWheel:Oh(N,f),onMouseEnter:C?void 0:l,onMouseDown:C?j=>{const{resetSelectedElements:_,domNode:A}=m.getState();if(p.current=A==null?void 0:A.getBoundingClientRect(),!y||!t||j.button!==0||j.target!==f.current||!p.current)return;const{x:T,y:P}=Oo(j,p.current);_(),m.setState({userSelectionRect:{width:0,height:0,startX:T,startY:P,x:T,y:P}}),o==null||o(j)}:void 0,onMouseMove:C?j=>{const{userSelectionRect:_,nodeInternals:A,edges:T,transform:P,onNodesChange:L,onEdgesChange:M,nodeOrigin:R,getNodes:z}=m.getState();if(!t||!p.current||!_)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const D=Oo(j,p.current),I=_.startX??0,k=_.startY??0,B={..._,x:D.x<I?D.x:I,y:D.y<k?D.y:k,width:Math.abs(D.x-I),height:Math.abs(D.y-k)},E=z(),U=gv(A,B,P,e===xa.Partial,!0,R),V=xv(U,T).map(K=>K.id),$=U.map(K=>K.id);if(x.current!==$.length){x.current=$.length;const K=Qr(E,$);K.length&&(L==null||L(K))}if(g.current!==V.length){g.current=V.length;const K=Qr(T,V);K.length&&(M==null||M(K))}m.setState({userSelectionRect:B})}:d,onMouseUp:C?j=>{if(j.button!==0)return;const{userSelectionRect:_}=m.getState();!b&&_&&j.target===f.current&&(S==null||S(j)),m.setState({nodesSelectionActive:x.current>0}),w(),r==null||r(j)}:void 0,onMouseLeave:C?j=>{b&&(m.setState({nodesSelectionActive:x.current>0}),r==null||r(j)),w()}:u,ref:f,style:Mh},h,G.createElement(hT,null))});function Wv(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Wv(o,e))}function qv(t,e,n){let o=t;do{if(o!=null&&o.matches(e))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function mT(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Wv(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,a;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((a=r.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function Gv(t,e,n,o,r=[0,0],s){const a=function(h,f){return f&&f!=="parent"?[f[0],[f[1][0]-(h.width||0),f[1][1]-(h.height||0)]]:f}(t,t.extent||o);let i=a;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:m}=Kr(h,r).positionAbsolute;i=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=Kr(h,r).positionAbsolute;i=h&&wn(f)&&wn(m)&&wn(h.width)&&wn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:i}else s==null||s("005",O8()),i=a;let d={x:0,y:0};if(l){const h=n.get(l);d=Kr(h,r).positionAbsolute}const u=i&&i!=="parent"?mh(e,i):e;return{position:{x:u.x-d.x,y:u.y-d.y},positionAbsolute:u}}function Dh({nodeId:t,dragItems:e,nodeInternals:n}){const o=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?o.find(r=>r.id===t):o[0],o]}Hv.displayName="Pane";const Yv=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),a=e.getBoundingClientRect(),i=a.width*o[0],l=a.height*o[1];return s.map(d=>{const u=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(u.left-a.left-i)/n,y:(u.top-a.top-l)/n,...fh(d)}})};function wa(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function Ph({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeInternals:i,onError:l}=e.getState(),d=i.get(t);d?(e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([t])):l==null||l("012",F8(t))}function Rh(t){return(e,n,o)=>t==null?void 0:t(e,o)}function Kv({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:a}){const i=zt(),[l,d]=O.useState(!1),u=O.useRef([]),h=O.useRef({x:null,y:null}),f=O.useRef(0),m=O.useRef(null),x=O.useRef({x:0,y:0}),g=O.useRef(null),p=O.useRef(!1),b=O.useRef(!1),y=O.useRef(!1),v=function(){const w=zt();return O.useCallback(({sourceEvent:N})=>{const{transform:C,snapGrid:j,snapToGrid:_}=w.getState(),A=N.touches?N.touches[0].clientX:N.clientX,T=N.touches?N.touches[0].clientY:N.clientY,P={x:(A-C[0])/C[2],y:(T-C[1])/C[2]};return{xSnapped:_?j[0]*Math.round(P.x/j[0]):P.x,ySnapped:_?j[1]*Math.round(P.y/j[1]):P.y,...P}},[])}();return O.useEffect(()=>{if(t!=null&&t.current){const w=Ln(t.current),S=({x:j,y:_})=>{const{nodeInternals:A,onNodeDrag:T,onSelectionDrag:P,updateNodePositions:L,nodeExtent:M,snapGrid:R,snapToGrid:z,nodeOrigin:D,onError:I}=i.getState();h.current={x:j,y:_};let k=!1,B={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&M){const U=jh(u.current,D);B=ph(U)}if(u.current=u.current.map(U=>{const V={x:j-U.distance.x,y:_-U.distance.y};z&&(V.x=R[0]*Math.round(V.x/R[0]),V.y=R[1]*Math.round(V.y/R[1]));const $=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];u.current.length>1&&M&&!U.extent&&($[0][0]=U.positionAbsolute.x-B.x+M[0][0],$[1][0]=U.positionAbsolute.x+(U.width??0)-B.x2+M[1][0],$[0][1]=U.positionAbsolute.y-B.y+M[0][1],$[1][1]=U.positionAbsolute.y+(U.height??0)-B.y2+M[1][1]);const K=Gv(U,V,A,$,D,I);return k=k||U.position.x!==K.position.x||U.position.y!==K.position.y,U.position=K.position,U.positionAbsolute=K.positionAbsolute,U}),!k)return;L(u.current,!0,!0),d(!0);const E=r?T:Rh(P);if(E&&g.current){const[U,V]=Dh({nodeId:r,dragItems:u.current,nodeInternals:A});E(g.current,U,V)}},N=()=>{if(!m.current)return;const[j,_]=Qy(x.current,m.current);if(j!==0||_!==0){const{transform:A,panBy:T}=i.getState();h.current.x=(h.current.x??0)-j/A[2],h.current.y=(h.current.y??0)-_/A[2],T({x:j,y:_})&&S(h.current)}f.current=requestAnimationFrame(N)},C=j=>{var D;const{nodeInternals:_,multiSelectionActive:A,nodesDraggable:T,unselectNodesAndEdges:P,onNodeDragStart:L,onSelectionDragStart:M}=i.getState();b.current=!0;const R=r?L:Rh(M);a&&s||A||!r||(D=_.get(r))!=null&&D.selected||P(),r&&s&&a&&Ph({id:r,store:i,nodeRef:t});const z=v(j);if(h.current=z,u.current=mT(_,T,z,r),R&&u.current){const[I,k]=Dh({nodeId:r,dragItems:u.current,nodeInternals:_});R(j.sourceEvent,I,k)}};if(!e){const j=function(){var _,A,T,P,L=v8,M=w8,R=k8,z=S8,D={},I=TS("start","drag","end"),k=0,B=0;function E(q){q.on("mousedown.drag",U).filter(z).on("touchstart.drag",K).on("touchmove.drag",X,y8).on("touchend.drag touchcancel.drag",J).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U(q,Y){if(!P&&L.call(this,q,Y)){var oe=ee(this,M.call(this,q,Y),q,Y,"mouse");oe&&(Ln(q.view).on("mousemove.drag",V,fa).on("mouseup.drag",$,fa),Yy(q.view),dh(q),T=!1,_=q.clientX,A=q.clientY,oe("start",q))}}function V(q){if(qr(q),!T){var Y=q.clientX-_,oe=q.clientY-A;T=Y*Y+oe*oe>B}D.mouse("drag",q)}function $(q){Ln(q.view).on("mousemove.drag mouseup.drag",null),Ky(q.view,T),qr(q),D.mouse("end",q)}function K(q,Y){if(L.call(this,q,Y)){var oe,se,re=q.changedTouches,ae=M.call(this,q,Y),te=re.length;for(oe=0;oe<te;++oe)(se=ee(this,ae,q,Y,re[oe].identifier,re[oe]))&&(dh(q),se("start",q,re[oe]))}}function X(q){var Y,oe,se=q.changedTouches,re=se.length;for(Y=0;Y<re;++Y)(oe=D[se[Y].identifier])&&(qr(q),oe("drag",q,se[Y]))}function J(q){var Y,oe,se=q.changedTouches,re=se.length;for(P&&clearTimeout(P),P=setTimeout(function(){P=null},500),Y=0;Y<re;++Y)(oe=D[se[Y].identifier])&&(dh(q),oe("end",q,se[Y]))}function ee(q,Y,oe,se,re,ae){var te,be,ye,ie=I.copy(),ve=Hn(ae||oe,Y);if((ye=R.call(q,new uh("beforestart",{sourceEvent:oe,target:E,identifier:re,active:k,x:ve[0],y:ve[1],dx:0,dy:0,dispatch:ie}),se))!=null)return te=ye.x-ve[0]||0,be=ye.y-ve[1]||0,function he(Se,De,_e){var Fe,Oe=ve;switch(Se){case"start":D[re]=he,Fe=k++;break;case"end":delete D[re],--k;case"drag":ve=Hn(_e||De,Y),Fe=k}ie.call(Se,q,new uh(Se,{sourceEvent:De,subject:ye,target:E,identifier:re,active:Fe,x:ve[0]+te,y:ve[1]+be,dx:ve[0]-Oe[0],dy:ve[1]-Oe[1],dispatch:ie}),se)}}return E.filter=function(q){return arguments.length?(L=typeof q=="function"?q:wl(!!q),E):L},E.container=function(q){return arguments.length?(M=typeof q=="function"?q:wl(q),E):M},E.subject=function(q){return arguments.length?(R=typeof q=="function"?q:wl(q),E):R},E.touchable=function(q){return arguments.length?(z=typeof q=="function"?q:wl(!!q),E):z},E.on=function(){var q=I.on.apply(I,arguments);return q===I?E:q},E.clickDistance=function(q){return arguments.length?(B=(q=+q)*q,E):Math.sqrt(B)},E}().on("start",_=>{const{domNode:A,nodeDragThreshold:T}=i.getState();T===0&&C(_),y.current=!1;const P=v(_);h.current=P,m.current=(A==null?void 0:A.getBoundingClientRect())||null,x.current=Oo(_.sourceEvent,m.current)}).on("drag",_=>{var L,M;const A=v(_),{autoPanOnNodeDrag:T,nodeDragThreshold:P}=i.getState();if(_.sourceEvent.type==="touchmove"&&_.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&T&&(p.current=!0,N()),!b.current){const R=A.xSnapped-(((L=h==null?void 0:h.current)==null?void 0:L.x)??0),z=A.ySnapped-(((M=h==null?void 0:h.current)==null?void 0:M.y)??0);Math.sqrt(R*R+z*z)>P&&C(_)}(h.current.x!==A.xSnapped||h.current.y!==A.ySnapped)&&u.current&&b.current&&(g.current=_.sourceEvent,x.current=Oo(_.sourceEvent,m.current),S(A))}}).on("end",_=>{if(b.current&&!y.current&&(d(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:A,nodeInternals:T,onNodeDragStop:P,onSelectionDragStop:L}=i.getState(),M=r?P:Rh(L);if(A(u.current,!1,!1),M){const[R,z]=Dh({nodeId:r,dragItems:u.current,nodeInternals:T});M(_.sourceEvent,R,z)}}}).filter(_=>{const A=_.target;return!_.button&&(!n||!qv(A,`.${n}`,t))&&(!o||qv(A,o,t))});return w.call(j),()=>{w.on(".drag",null)}}w.on(".drag",null)}},[t,e,n,o,s,i,r,a,v]),l}function Xv(){const t=zt();return O.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:a,snapToGrid:i,snapGrid:l,onError:d,nodesDraggable:u}=t.getState(),h=a().filter(y=>y.selected&&(y.draggable||u&&y.draggable===void 0)),f=i?l[0]:5,m=i?l[1]:5,x=n.isShiftPressed?4:1,g=n.x*f*x,p=n.y*m*x,b=h.map(y=>{if(y.positionAbsolute){const v={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+p};i&&(v.x=l[0]*Math.round(v.x/l[0]),v.y=l[1]*Math.round(v.y/l[1]));const{positionAbsolute:w,position:S}=Gv(y,v,o,r,void 0,d);y.position=S,y.positionAbsolute=w}return y});s(b,!0,!1)},[])}const es={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ka=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:a,xPosOrigin:i,yPosOrigin:l,selected:d,onClick:u,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:x,onDoubleClick:g,style:p,className:b,isDraggable:y,isSelectable:v,isConnectable:w,isFocusable:S,selectNodesOnDrag:N,sourcePosition:C,targetPosition:j,hidden:_,resizeObserver:A,dragHandle:T,zIndex:P,isParent:L,noDragClassName:M,noPanClassName:R,initialized:z,disableKeyboardA11y:D,ariaLabel:I,rfId:k,hasHandleBounds:B})=>{const E=zt(),U=O.useRef(null),V=O.useRef(null),$=O.useRef(C),K=O.useRef(j),X=O.useRef(o),J=v||y||u||h||f||m,ee=Xv(),q=wa(n,E.getState,h),Y=wa(n,E.getState,f),oe=wa(n,E.getState,m),se=wa(n,E.getState,x),re=wa(n,E.getState,g);O.useEffect(()=>()=>{V.current&&(A==null||A.unobserve(V.current),V.current=null)},[]),O.useEffect(()=>{if(U.current&&!_){const te=U.current;z&&B&&V.current===te||(V.current&&(A==null||A.unobserve(V.current)),A==null||A.observe(te),V.current=te)}},[_,z,B]),O.useEffect(()=>{const te=X.current!==o,be=$.current!==C,ye=K.current!==j;U.current&&(te||be||ye)&&(te&&(X.current=o),be&&($.current=C),ye&&(K.current=j),E.getState().updateNodeDimensions([{id:n,nodeElement:U.current,forceUpdate:!0}]))},[n,o,C,j]);const ae=Kv({nodeRef:U,disabled:_||!y,noDragClassName:M,handleSelector:T,nodeId:n,isSelectable:v,selectNodesOnDrag:N});return _?null:G.createElement("div",{className:Xt(["react-flow__node",`react-flow__node-${o}`,{[R]:y},b,{selected:d,selectable:v,parent:L,dragging:ae}]),ref:U,style:{zIndex:P,transform:`translate(${i}px,${l}px)`,pointerEvents:J?"all":"none",visibility:z?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:q,onMouseMove:Y,onMouseLeave:oe,onContextMenu:se,onClick:te=>{const{nodeDragThreshold:be}=E.getState();if(v&&(!N||!y||be>0)&&Ph({id:n,store:E,nodeRef:U}),u){const ye=E.getState().nodeInternals.get(n);ye&&u(te,{...ye})}},onDoubleClick:re,onKeyDown:S?te=>{if(!xh(te)&&!D)if(nv.includes(te.key)&&v){const be=te.key==="Escape";Ph({id:n,store:E,unselect:be,nodeRef:U})}else y&&d&&Object.prototype.hasOwnProperty.call(es,te.key)&&(E.setState({ariaLiveMessage:`Moved selected node ${te.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~a}`}),ee({x:es[te.key].x,y:es[te.key].y,isShiftPressed:te.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":D?void 0:`${Mv}-${k}`,"aria-label":I},G.createElement(V8,{value:n},G.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:a,selected:d,isConnectable:w,sourcePosition:C,targetPosition:j,dragging:ae,dragHandle:T,zIndex:P})))};return e.displayName="NodeWrapper",O.memo(e)};const pT=t=>{const e=t.getNodes().filter(n=>n.selected);return{...jh(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var gT=O.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=zt(),{width:r,height:s,x:a,y:i,transformString:l,userSelectionActive:d}=at(pT,Ht),u=Xv(),h=O.useRef(null);if(O.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),Kv({nodeRef:h}),d||!r||!s)return null;const f=t?m=>{const x=o.getState().getNodes().filter(g=>g.selected);t(m,x)}:void 0;return G.createElement("div",{className:Xt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},G.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(es,m.key)&&u({x:es[m.key].x,y:es[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:i,left:a}}))});const xT=t=>t.nodesSelectionActive,Jv=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,deleteKeyCode:i,onMove:l,onMoveStart:d,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:x,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:N,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:_,panOnDrag:A,defaultViewport:T,translateExtent:P,minZoom:L,maxZoom:M,preventScrolling:R,onSelectionContextMenu:z,noWheelClassName:D,noPanClassName:I,disableKeyboardA11y:k})=>{const B=at(xT),E=ya(h),U=ya(b),V=U||A,$=U||N,K=E||f&&V!==!0;return(({deleteKeyCode:X,multiSelectionKeyCode:J})=>{const ee=zt(),{deleteElements:q}=va(),Y=ya(X,lT),oe=ya(J);O.useEffect(()=>{if(Y){const{edges:se,getNodes:re}=ee.getState(),ae=re().filter(be=>be.selected),te=se.filter(be=>be.selected);q({nodes:ae,edges:te}),ee.setState({nodesSelectionActive:!1})}},[Y]),O.useEffect(()=>{ee.setState({multiSelectionActive:oe})},[oe])})({deleteKeyCode:i,multiSelectionKeyCode:p}),G.createElement(dT,{onMove:l,onMoveStart:d,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:$,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:_,panOnDrag:!E&&V,defaultViewport:T,translateExtent:P,minZoom:L,maxZoom:M,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:D,noPanClassName:I},G.createElement(Hv,{onSelectionStart:x,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:V,isSelecting:!!K,selectionMode:m},t,B&&G.createElement(gT,{onSelectionContextMenu:z,noPanClassName:I,disableKeyboardA11y:k})))};Jv.displayName="FlowRenderer";var bT=O.memo(Jv);function yT(t){return{input:ka(t.input||Ev),default:ka(t.default||Ih),output:ka(t.output||Iv),group:ka(t.group||Th),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=ka(t[n]||Ih),e),{})}}const vT=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Zv=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:a}=at(vT,Ht),i=(l=t.onlyRenderVisibleElements,at(O.useCallback(h=>l?gv(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const d=O.useRef(),u=O.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));s(m)});return d.current=h,h},[]);return O.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),G.createElement("div",{className:"react-flow__nodes",style:Mh},i.map(h=>{var N,C,j;let f=h.type||"default";t.nodeTypes[f]||(a==null||a("003",A8(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,x=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?mh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,v=(y==null?void 0:y.x)??0,w=(y==null?void 0:y.y)??0,S=(({x:_,y:A,width:T,height:P,origin:L})=>T&&P?L[0]<0||L[1]<0||L[0]>1||L[1]>1?{x:_,y:A}:{x:_-T*L[0],y:A-P*L[1]}:{x:_,y:A})({x:v,y:w,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return G.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Pe.Bottom,targetPosition:h.targetPosition||Pe.Top,hidden:h.hidden,xPos:v,yPos:w,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:x,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:u,dragHandle:h.dragHandle,zIndex:((N=h[xt])==null?void 0:N.z)??0,isParent:!!((C=h[xt])!=null&&C.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((j=h[xt])!=null&&j.handleBounds)})}))};Zv.displayName="NodeRenderer";var wT=O.memo(Zv);const kT=(t,e,n)=>n===Pe.Left?t-e:n===Pe.Right?t+e:t,ST=(t,e,n)=>n===Pe.Top?t-e:n===Pe.Bottom?t+e:t,Qv="react-flow__edgeupdater",e2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:i})=>G.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Xt([Qv,`${Qv}-${i}`]),cx:kT(e,o,t),cy:ST(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),NT=()=>!0;var ts=t=>{const e=({id:n,className:o,type:r,data:s,onClick:a,onEdgeDoubleClick:i,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,style:p,source:b,target:y,sourceX:v,sourceY:w,targetX:S,targetY:N,sourcePosition:C,targetPosition:j,elementsSelectable:_,hidden:A,sourceHandleId:T,targetHandleId:P,onContextMenu:L,onMouseEnter:M,onMouseMove:R,onMouseLeave:z,reconnectRadius:D,onReconnect:I,onReconnectStart:k,onReconnectEnd:B,markerEnd:E,markerStart:U,rfId:V,ariaLabel:$,isFocusable:K,isReconnectable:X,pathOptions:J,interactionWidth:ee,disableKeyboardA11y:q})=>{const Y=O.useRef(null),[oe,se]=O.useState(!1),[re,ae]=O.useState(!1),te=zt(),be=O.useMemo(()=>`url('#${Nh(U,V)}')`,[U,V]),ye=O.useMemo(()=>`url('#${Nh(E,V)}')`,[E,V]);if(A)return null;const ie=ga(n,te.getState,i),ve=ga(n,te.getState,L),he=ga(n,te.getState,M),Se=ga(n,te.getState,R),De=ga(n,te.getState,z),_e=(qe,Ke)=>{if(qe.button!==0)return;const{edges:Q,isValidConnection:xe}=te.getState(),we=Ke?y:b,Te=(Ke?P:T)||null,W=Ke?"target":"source",ne=xe||NT,ue=Ke,de=Q.find(ge=>ge.id===n);ae(!0),k==null||k(qe,de,W),kv({event:qe,handleId:Te,nodeId:we,onConnect:ge=>I==null?void 0:I(de,ge),isTarget:ue,getState:te.getState,setState:te.setState,isValidConnection:ne,edgeUpdaterType:W,onReconnectEnd:ge=>{ae(!1),B==null||B(ge,de,W)}})},Fe=()=>se(!0),Oe=()=>se(!1),Qe=!_&&!a;return G.createElement("g",{className:Xt(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:d,inactive:Qe,updating:oe}]),onClick:qe=>{var W;const{edges:Ke,addSelectedEdges:Q,unselectNodesAndEdges:xe,multiSelectionActive:we}=te.getState(),Te=Ke.find(ne=>ne.id===n);Te&&(_&&(te.setState({nodesSelectionActive:!1}),Te.selected&&we?(xe({nodes:[],edges:[Te]}),(W=Y.current)==null||W.blur()):Q([n])),a&&a(qe,Te))},onDoubleClick:ie,onContextMenu:ve,onMouseEnter:he,onMouseMove:Se,onMouseLeave:De,onKeyDown:K?qe=>{var Ke;if(!q&&nv.includes(qe.key)&&_){const{unselectNodesAndEdges:Q,addSelectedEdges:xe,edges:we}=te.getState();qe.key==="Escape"?((Ke=Y.current)==null||Ke.blur(),Q({edges:[we.find(Te=>Te.id===n)]})):xe([n])}}:void 0,tabIndex:K?0:void 0,role:K?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":$===null?void 0:$||`Edge from ${b} to ${y}`,"aria-describedby":K?`${Ov}-${V}`:void 0,ref:Y},!re&&G.createElement(t,{id:n,source:b,target:y,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,data:s,style:p,sourceX:v,sourceY:w,targetX:S,targetY:N,sourcePosition:C,targetPosition:j,sourceHandleId:T,targetHandleId:P,markerStart:be,markerEnd:ye,pathOptions:J,interactionWidth:ee}),X&&G.createElement(G.Fragment,null,(X==="source"||X===!0)&&G.createElement(e2,{position:C,centerX:v,centerY:w,radius:D,onMouseDown:qe=>_e(qe,!0),onMouseEnter:Fe,onMouseOut:Oe,type:"source"}),(X==="target"||X===!0)&&G.createElement(e2,{position:j,centerX:S,centerY:N,radius:D,onMouseDown:qe=>_e(qe,!1),onMouseEnter:Fe,onMouseOut:Oe,type:"target"})))};return e.displayName="EdgeWrapper",O.memo(e)};function CT(t){return{default:ts(t.default||Il),straight:ts(t.bezier||kh),step:ts(t.step||wh),smoothstep:ts(t.step||El),simplebezier:ts(t.simplebezier||yh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ts(t[n]||Il),e),{})}}function t2(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,a=(n==null?void 0:n.height)||e.height;switch(t){case Pe.Top:return{x:o+s/2,y:r};case Pe.Right:return{x:o+s,y:r+a/2};case Pe.Bottom:return{x:o+s/2,y:r+a};case Pe.Left:return{x:o,y:r+a/2}}}function n2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function o2(t){var o,r,s,a,i;const e=((o=t==null?void 0:t[xt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.x)||0,y:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const jT=[{level:0,isMaxLevel:!0,edges:[]}];function ET(t,e,n){return function(o,r,s=!1){let a=-1;const i=o.reduce((d,u)=>{var m,x;const h=wn(u.zIndex);let f=h?u.zIndex:0;if(s){const g=r.get(u.target),p=r.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),y=Math.max(((m=p==null?void 0:p[xt])==null?void 0:m.z)||0,((x=g==null?void 0:g[xt])==null?void 0:x.z)||0,1e3);f=(h?u.zIndex:0)+(b?y:0)}return d[f]?d[f].push(u):d[f]=[u],a=f>a?f:a,d},{}),l=Object.entries(i).map(([d,u])=>{const h=+d;return{edges:u,level:h,isMaxLevel:h===a}});return l.length===0?jT:l}(at(O.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),a=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&function({sourcePos:i,targetPos:l,sourceWidth:d,sourceHeight:u,targetWidth:h,targetHeight:f,width:m,height:x,transform:g}){const p={x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x+d,l.x+h),y2:Math.max(i.y+u,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=ph({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:x/g[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),v=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*v)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const r2={[Yr.Arrow]:({color:t="none",strokeWidth:e=1})=>G.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[Yr.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>G.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},_T=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:i="auto-start-reverse"})=>{const l=function(d){const u=zt();return O.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(r2,d)?r2[d]:((f=(h=u.getState()).onError)==null||f.call(h,"009",D8(d)),null)},[d])}(e);return l?G.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:i,refX:"0",refY:"0"},G.createElement(l,{color:n,strokeWidth:a})):null},s2=({defaultColor:t,rfId:e})=>{const n=at(O.useCallback((({defaultColor:o,rfId:r})=>s=>{const a=[];return s.edges.reduce((i,l)=>([l.markerStart,l.markerEnd].forEach(d=>{if(d&&typeof d=="object"){const u=Nh(d,r);a.includes(u)||(i.push({id:u,color:d.color||o,...d}),a.push(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,a)=>s.id!==r[a].id)));return G.createElement("defs",null,n.map(o=>G.createElement(_T,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};s2.displayName="MarkerDefinitions";var IT=O.memo(s2);const TT=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),a2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:a,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:v,elementsSelectable:w,width:S,height:N,connectionMode:C,nodeInternals:j,onError:_}=at(TT,Ht),A=ET(e,j,n);return S?G.createElement(G.Fragment,null,A.map(({level:T,edges:P,isMaxLevel:L})=>G.createElement("svg",{key:T,style:{zIndex:T},width:S,height:N,className:"react-flow__edges react-flow__container"},L&&G.createElement(IT,{defaultColor:t,rfId:o}),G.createElement("g",null,P.map(M=>{const[R,z,D]=o2(j.get(M.source)),[I,k,B]=o2(j.get(M.target));if(!D||!B)return null;let E=M.type||"default";r[E]||(_==null||_("011",L8(E)),E="default");const U=r[E]||r.default,V=C===cr.Strict?k.target:(k.target??[]).concat(k.source??[]),$=n2(z.source,M.sourceHandle),K=n2(V,M.targetHandle),X=($==null?void 0:$.position)||Pe.Bottom,J=(K==null?void 0:K.position)||Pe.Top,ee=!!(M.focusable||y&&M.focusable===void 0),q=M.reconnectable||M.updatable,Y=f!==void 0&&(q||v&&q===void 0);if(!$||!K)return _==null||_("008",P8($,M)),null;const{sourceX:oe,sourceY:se,targetX:re,targetY:ae}=((te,be,ye,ie,ve,he)=>{const Se=t2(ye,te,be),De=t2(he,ie,ve);return{sourceX:Se.x,sourceY:Se.y,targetX:De.x,targetY:De.y}})(R,$,X,I,K,J);return G.createElement(U,{key:M.id,id:M.id,className:Xt([M.className,s]),type:E,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:oe,sourceY:se,targetX:re,targetY:ae,sourcePosition:X,targetPosition:J,elementsSelectable:w,onContextMenu:a,onMouseEnter:i,onMouseMove:l,onMouseLeave:d,onClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,rfId:o,ariaLabel:M.ariaLabel,isFocusable:ee,isReconnectable:Y,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:b})})))),p):null};a2.displayName="EdgeRenderer";var AT=O.memo(a2);const MT=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function OT({children:t}){const e=at(MT);return G.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const DT={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top},i2=({nodeId:t,handleType:e,style:n,type:o=Po.Bezier,CustomComponent:r,connectionStatus:s})=>{var N,C,j;const{fromNode:a,handleId:i,toX:l,toY:d,connectionMode:u}=at(O.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.connectionMode}),[t]),Ht),h=(N=a==null?void 0:a[xt])==null?void 0:N.handleBounds;let f=h==null?void 0:h[e];if(u===cr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!a||!f)return null;const m=i?f.find(_=>_.id===i):f[0],x=m?m.x+m.width/2:(a.width??0)/2,g=m?m.y+m.height/2:a.height??0,p=(((C=a.positionAbsolute)==null?void 0:C.x)??0)+x,b=(((j=a.positionAbsolute)==null?void 0:j.y)??0)+g,y=m==null?void 0:m.position,v=y?DT[y]:null;if(!y||!v)return null;if(r)return G.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:a,fromHandle:m,fromX:p,fromY:b,toX:l,toY:d,fromPosition:y,toPosition:v,connectionStatus:s});let w="";const S={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:d,targetPosition:v};return o===Po.Bezier?[w]=mv(S):o===Po.Step?[w]=vh({...S,borderRadius:0}):o===Po.SmoothStep?[w]=vh(S):o===Po.SimpleBezier?[w]=dv(S):w=`M${p},${b} ${l},${d}`,G.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};i2.displayName="ConnectionLine";const PT=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function RT({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:a,width:i,height:l,connectionStatus:d}=at(PT,Ht);return r&&s&&i&&a?G.createElement("svg",{style:t,width:i,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},G.createElement("g",{className:Xt(["react-flow__connection",d])},G.createElement(i2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:d}))):null}function l2(t,e){return O.useRef(null),zt(),O.useMemo(()=>e(t),[t])}const c2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:a,onEdgeClick:i,onNodeDoubleClick:l,onEdgeDoubleClick:d,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:x,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:S,selectionOnDrag:N,selectionMode:C,multiSelectionKeyCode:j,panActivationKeyCode:_,zoomActivationKeyCode:A,deleteKeyCode:T,onlyRenderVisibleElements:P,elementsSelectable:L,selectNodesOnDrag:M,defaultViewport:R,translateExtent:z,minZoom:D,maxZoom:I,preventScrolling:k,defaultMarkerColor:B,zoomOnScroll:E,zoomOnPinch:U,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:K,zoomOnDoubleClick:X,panOnDrag:J,onPaneClick:ee,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:oe,onPaneScroll:se,onPaneContextMenu:re,onEdgeContextMenu:ae,onEdgeMouseEnter:te,onEdgeMouseMove:be,onEdgeMouseLeave:ye,onReconnect:ie,onReconnectStart:ve,onReconnectEnd:he,reconnectRadius:Se,noDragClassName:De,noWheelClassName:_e,noPanClassName:Fe,elevateEdgesOnSelect:Oe,disableKeyboardA11y:Qe,nodeOrigin:qe,nodeExtent:Ke,rfId:Q})=>{const xe=l2(t,yT),we=l2(e,CT);return function(Te){const W=va(),ne=O.useRef(!1);O.useEffect(()=>{!ne.current&&W.viewportInitialized&&Te&&(setTimeout(()=>Te(W),1),ne.current=!0)},[Te,W.viewportInitialized])}(s),G.createElement(bT,{onPaneClick:ee,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:oe,onPaneContextMenu:re,onPaneScroll:se,deleteKeyCode:T,selectionKeyCode:S,selectionOnDrag:N,selectionMode:C,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:_,zoomActivationKeyCode:A,elementsSelectable:L,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:E,zoomOnPinch:U,zoomOnDoubleClick:X,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:K,panOnDrag:J,defaultViewport:R,translateExtent:z,minZoom:D,maxZoom:I,onSelectionContextMenu:x,preventScrolling:k,noDragClassName:De,noWheelClassName:_e,noPanClassName:Fe,disableKeyboardA11y:Qe},G.createElement(OT,null,G.createElement(AT,{edgeTypes:we,onEdgeClick:i,onEdgeDoubleClick:d,onlyRenderVisibleElements:P,onEdgeContextMenu:ae,onEdgeMouseEnter:te,onEdgeMouseMove:be,onEdgeMouseLeave:ye,onReconnect:ie,onReconnectStart:ve,onReconnectEnd:he,reconnectRadius:Se,defaultMarkerColor:B,noPanClassName:Fe,elevateEdgesOnSelect:!!Oe,disableKeyboardA11y:Qe,rfId:Q},G.createElement(RT,{style:y,type:b,component:v,containerStyle:w})),G.createElement("div",{className:"react-flow__edgelabel-renderer"}),G.createElement(wT,{nodeTypes:xe,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:M,onlyRenderVisibleElements:P,noPanClassName:Fe,noDragClassName:De,disableKeyboardA11y:Qe,nodeOrigin:qe,nodeExtent:Ke,rfId:Q})))};c2.displayName="GraphView";var LT=O.memo(c2);const Lh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Fo={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Lh,nodeExtent:Lh,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:cr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:(t,e)=>{},isValidConnection:void 0},FT=()=>((t,e)=>t?Gy(t,e):Gy)((t,e)=>({...Fo,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:Ah(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,a=r?Ah(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:a,fitViewOnInitOptions:i,domNode:l,nodeOrigin:d}=e(),u=l==null?void 0:l.querySelector(".react-flow__viewport");if(!u)return;const h=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[xt]:{...b[xt],handleBounds:void 0}});else if(b){const y=fh(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[xt]:{...b[xt],handleBounds:{source:Yv(".source",p.nodeElement,f,d),target:Yv(".target",p.nodeElement,f,d)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);Lv(r,d);const x=a||s&&!a&&Fv(e,{initial:!0,...i});t({nodeInternals:new Map(r),fitViewOnInitDone:x}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),a=n.map(i=>{const l={id:i.id,type:"position",dragging:r};return o&&(l.positionAbsolute=i.positionAbsolute,l.position=i.position),l});s(a)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:a,getNodes:i,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const d=Ah(Vv(n,i()),r,a,l);t({nodeInternals:d})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>Lo(l,!0)):(a=Qr(s(),n),i=Qr(r,[])),Al({changedNodes:a,changedEdges:i,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>Lo(l,!0)):(a=Qr(r,n),i=Qr(s(),[])),Al({changedNodes:i,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),a=o||r;Al({changedNodes:(n||s()).map(i=>(i.selected=!1,Lo(i.id,!1))),changedEdges:a.map(i=>Lo(i.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();Al({changedNodes:o().filter(r=>r.selected).map(r=>Lo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>Lo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=mh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:a,d3Selection:i,translateExtent:l}=e();if(!a||!i||!n.x&&!n.y)return!1;const d=Zo.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),u=[[0,0],[r,s]],h=a==null?void 0:a.constrain()(d,u,l);return a.transform(i,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Fo.connectionNodeId,connectionHandleId:Fo.connectionHandleId,connectionHandleType:Fo.connectionHandleType,connectionStatus:Fo.connectionStatus,connectionStartHandle:Fo.connectionStartHandle,connectionEndHandle:Fo.connectionEndHandle}),reset:()=>t({...Fo})}),Object.is),Fh=({children:t})=>{const e=O.useRef(null);return e.current||(e.current=FT()),G.createElement(T8,{value:e.current},t)};Fh.displayName="ReactFlowProvider";const d2=({children:t})=>O.useContext(Sl)?G.createElement(G.Fragment,null,t):G.createElement(Fh,null,t);d2.displayName="ReactFlowWrapper";const zT={input:Ev,default:Ih,output:Iv,group:Th},BT={default:Il,straight:kh,step:wh,smoothstep:El,simplebezier:yh},UT=[0,0],$T=[15,15],VT={x:0,y:0,zoom:1},HT={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},zh=O.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=zT,edgeTypes:a=BT,onNodeClick:i,onEdgeClick:l,onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:j,onNodeDragStop:_,onNodesDelete:A,onEdgesDelete:T,onSelectionChange:P,onSelectionDragStart:L,onSelectionDrag:M,onSelectionDragStop:R,onSelectionContextMenu:z,onSelectionStart:D,onSelectionEnd:I,connectionMode:k=cr.Strict,connectionLineType:B=Po.Bezier,connectionLineStyle:E,connectionLineComponent:U,connectionLineContainerStyle:V,deleteKeyCode:$="Backspace",selectionKeyCode:K="Shift",selectionOnDrag:X=!1,selectionMode:J=xa.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:q=Cl()?"Meta":"Control",zoomActivationKeyCode:Y=Cl()?"Meta":"Control",snapToGrid:oe=!1,snapGrid:se=$T,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:ae=!0,nodesDraggable:te,nodesConnectable:be,nodesFocusable:ye,nodeOrigin:ie=UT,edgesFocusable:ve,edgesUpdatable:he,elementsSelectable:Se,defaultViewport:De=VT,minZoom:_e=.5,maxZoom:Fe=2,translateExtent:Oe=Lh,preventScrolling:Qe=!0,nodeExtent:qe,defaultMarkerColor:Ke="#b1b1b7",zoomOnScroll:Q=!0,zoomOnPinch:xe=!0,panOnScroll:we=!1,panOnScrollSpeed:Te=.5,panOnScrollMode:W=Do.Free,zoomOnDoubleClick:ne=!0,panOnDrag:ue=!0,onPaneClick:de,onPaneMouseEnter:ge,onPaneMouseMove:Me,onPaneMouseLeave:Re,onPaneScroll:He,onPaneContextMenu:le,children:Ne,onEdgeContextMenu:je,onEdgeDoubleClick:Le,onEdgeMouseEnter:Ve,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ue,onEdgeUpdate:Je,onEdgeUpdateStart:We,onEdgeUpdateEnd:nt,onReconnect:bt,onReconnectStart:It,onReconnectEnd:Jt,reconnectRadius:Bt=10,edgeUpdaterRadius:Mn=10,onNodesChange:os,onEdgesChange:Wn,noDragClassName:yo="nodrag",noWheelClassName:Sn="nowheel",noPanClassName:rs="nopan",fitView:Na=!1,fitViewOptions:S7,connectOnClick:N7=!0,attributionPosition:C7,proOptions:j7,defaultEdgeOptions:E7,elevateNodesOnSelect:_7=!0,elevateEdgesOnSelect:I7=!1,disableKeyboardA11y:nk=!1,autoPanOnConnect:T7=!0,autoPanOnNodeDrag:A7=!0,connectionRadius:M7=20,isValidConnection:O7,onError:D7,style:P7,id:ok,nodeDragThreshold:R7,...L7},F7)=>{const Mf=ok||"1";return G.createElement("div",{...L7,style:{...P7,...HT},ref:F7,className:Xt(["react-flow",r]),"data-testid":"rf__wrapper",id:ok},G.createElement(d2,null,G.createElement(LT,{onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:N,nodeTypes:s,edgeTypes:a,connectionLineType:B,connectionLineStyle:E,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:K,selectionOnDrag:X,selectionMode:J,deleteKeyCode:$,multiSelectionKeyCode:q,panActivationKeyCode:ee,zoomActivationKeyCode:Y,onlyRenderVisibleElements:re,selectNodesOnDrag:ae,defaultViewport:De,translateExtent:Oe,minZoom:_e,maxZoom:Fe,preventScrolling:Qe,zoomOnScroll:Q,zoomOnPinch:xe,zoomOnDoubleClick:ne,panOnScroll:we,panOnScrollSpeed:Te,panOnScrollMode:W,panOnDrag:ue,onPaneClick:de,onPaneMouseEnter:ge,onPaneMouseMove:Me,onPaneMouseLeave:Re,onPaneScroll:He,onPaneContextMenu:le,onSelectionContextMenu:z,onSelectionStart:D,onSelectionEnd:I,onEdgeContextMenu:je,onEdgeDoubleClick:Le,onEdgeMouseEnter:Ve,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ue,onReconnect:bt??Je,onReconnectStart:It??We,onReconnectEnd:Jt??nt,reconnectRadius:Bt??Mn,defaultMarkerColor:Ke,noDragClassName:yo,noWheelClassName:Sn,noPanClassName:rs,elevateEdgesOnSelect:I7,rfId:Mf,disableKeyboardA11y:nk,nodeOrigin:ie,nodeExtent:qe}),G.createElement(Q8,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:te,nodesConnectable:be,nodesFocusable:ye,edgesFocusable:ve,edgesUpdatable:he,elementsSelectable:Se,elevateNodesOnSelect:_7,minZoom:_e,maxZoom:Fe,nodeExtent:qe,onNodesChange:os,onEdgesChange:Wn,snapToGrid:oe,snapGrid:se,connectionMode:k,translateExtent:Oe,connectOnClick:N7,defaultEdgeOptions:E7,fitView:Na,fitViewOptions:S7,onNodesDelete:A,onEdgesDelete:T,onNodeDragStart:C,onNodeDrag:j,onNodeDragStop:_,onSelectionDrag:M,onSelectionDragStart:L,onSelectionDragStop:R,noPanClassName:rs,nodeOrigin:ie,rfId:Mf,autoPanOnConnect:T7,autoPanOnNodeDrag:A7,onError:D7,connectionRadius:M7,isValidConnection:O7,nodeDragThreshold:R7}),G.createElement(J8,{onSelectionChange:P}),Ne,G.createElement(B8,{proOptions:j7,position:C7}),G.createElement(oT,{rfId:Mf,disableKeyboardA11y:nk})))});function u2(t){return e=>{const[n,o]=O.useState(e),r=O.useCallback(s=>o(a=>t(s,a)),[]);return[n,o,r]}}zh.displayName="ReactFlow";const h2=u2(Vv),f2=u2(function(t,e){return $v(t,e)});function WT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},G.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function qT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},G.createElement("path",{d:"M0 0h32v4.2H0z"}))}function GT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},G.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function YT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function KT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ns=({children:t,className:e,...n})=>G.createElement("button",{type:"button",className:Xt(["react-flow__controls-button",e]),...n},t);ns.displayName="ControlButton";const XT=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),m2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:i,onInteractiveChange:l,className:d,children:u,position:h="bottom-left"})=>{const f=zt(),[m,x]=O.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=at(XT,Ht),{zoomIn:y,zoomOut:v,fitView:w}=va();return O.useEffect(()=>{x(!0)},[]),m?G.createElement(Nl,{className:Xt(["react-flow__controls",d]),position:h,style:t,"data-testid":"rf__controls"},e&&G.createElement(G.Fragment,null,G.createElement(ns,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},G.createElement(WT,null)),G.createElement(ns,{onClick:()=>{v(),a==null||a()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},G.createElement(qT,null))),n&&G.createElement(ns,{className:"react-flow__controls-fitview",onClick:()=>{w(r),i==null||i()},title:"fit view","aria-label":"fit view"},G.createElement(GT,null)),o&&G.createElement(ns,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?G.createElement(KT,null):G.createElement(YT,null)),u):null};m2.displayName="Controls";var kn,JT=O.memo(m2);function ZT({color:t,dimensions:e,lineWidth:n}){return G.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function QT({color:t,radius:e}){return G.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(kn||(kn={}));const eA={[kn.Dots]:"#91919a",[kn.Lines]:"#eee",[kn.Cross]:"#e2e2e2"},tA={[kn.Dots]:1,[kn.Lines]:1,[kn.Cross]:6},nA=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function p2({id:t,variant:e=kn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:a,style:i,className:l}){const d=O.useRef(null),{transform:u,patternId:h}=at(nA,Ht),f=a||eA[e],m=o||tA[e],x=e===kn.Dots,g=e===kn.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*u[2]||1,p[1]*u[2]||1],y=m*u[2],v=g?[y,y]:b,w=x?[y/s,y/s]:[v[0]/s,v[1]/s];return G.createElement("svg",{className:Xt(["react-flow__background",l]),style:{...i,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},G.createElement("pattern",{id:h+t,x:u[0]%b[0],y:u[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},x?G.createElement(QT,{color:f,radius:y/s}):G.createElement(ZT,{dimensions:v,color:f,lineWidth:r})),G.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}p2.displayName="Background";var oA=O.memo(p2);function Bh(t){return Math.min(11*t+35,200)}const g2=G.createContext("LR"),x2=O.memo(t=>{const e=H.c(51),{data:n,selected:o}=t,r=Ie(n.atom),s=Tc().inOrderIds.indexOf(r.id),a=o?"var(--gray-9)":"var(--gray-3)",i=at(rA),l=O.use(g2);let d,u,h,f,m;if(e[0]!==r.code||e[1]!==a||e[2]!==l||e[3]!==o){const T=r.code.split(`
145
- `).length,P=l==="LR"?Pe.Left:Pe.Top;let L;e[8]!==a?(L={background:a},e[8]=a,e[9]=L):L=e[9],e[10]!==P||e[11]!==L?(h=c.jsx(Ro,{type:"target",id:"inputs",position:P,style:L}),e[10]=P,e[11]=L,e[12]=h):h=e[12];const M=l==="LR"?Pe.Left:Pe.Top;let R;e[13]!==a?(R={background:a},e[13]=a,e[14]=R):R=e[14],e[15]!==M||e[16]!==R?(f=c.jsx(Ro,{type:"source",id:"inputs",position:M,style:R}),e[15]=M,e[16]=R,e[17]=f):f=e[17];const z=o&&"border-primary";e[18]!==z?(u=me("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",z),e[18]=z,e[19]=u):u=e[19],d=Bh(T),e[0]=r.code,e[1]=a,e[2]=l,e[3]=o,e[4]=d,e[5]=u,e[6]=h,e[7]=f}else d=e[4],u=e[5],h=e[6],f=e[7];var x;let g;e[20]!==n.forceWidth||e[21]!==i?(m=n.forceWidth||(x=i,Math.min(Math.max(x-100,100),400)),e[20]=n.forceWidth,e[21]=i,e[22]=m):m=e[22],e[23]!==d||e[24]!==m?(g={height:d,width:m},e[23]=d,e[24]=m,e[25]=g):g=e[25];const p=MP(r.name,s);let b,y,v;e[26]!==p?(b=c.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(y=c.jsx(gL,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==u||e[31]!==g||e[32]!==b||e[33]!==y?(v=c.jsxs("div",{className:u,style:g,children:[b,y]}),e[30]=u,e[31]=g,e[32]=b,e[33]=y,e[34]=v):v=e[34];const w=l==="LR"?Pe.Right:Pe.Bottom;let S,N;e[35]!==a?(S={background:a},e[35]=a,e[36]=S):S=e[36],e[37]!==w||e[38]!==S?(N=c.jsx(Ro,{type:"source",id:"outputs",position:w,style:S}),e[37]=w,e[38]=S,e[39]=N):N=e[39];const C=l==="LR"?Pe.Right:Pe.Bottom;let j,_,A;return e[40]!==a?(j={background:a},e[40]=a,e[41]=j):j=e[41],e[42]!==C||e[43]!==j?(_=c.jsx(Ro,{type:"target",id:"outputs",position:C,style:j}),e[42]=C,e[43]=j,e[44]=_):_=e[44],e[45]!==v||e[46]!==N||e[47]!==_||e[48]!==h||e[49]!==f?(A=c.jsxs("div",{children:[h,f,v,N,_]}),e[45]=v,e[46]=N,e[47]=_,e[48]=h,e[49]=f,e[50]=A):A=e[50],A},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));x2.displayName="CustomNode";const b2={custom:x2};function rA(t){const{width:e}=t;return e}const y2=t=>{const e=H.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,a=Tc();let i,l,d,u;if(e[0]!==o||e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s){d=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==a?(h=(x,g)=>a.inOrderIds.indexOf(x)-a.inOrderIds.indexOf(g),e[8]=a,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=x):x=e[10],d=x;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(x,g)=>c.jsxs("span",{className:"truncate",children:[c.jsx(Co,{variant:"focus",cellId:x,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x),g<o.length-1&&", "]},x),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],i=f.slice(0,n).map(m),l=o.length>n&&c.jsxs(xr,{children:[c.jsx(ys,{asChild:!0,children:c.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),c.jsx(fs,{className:"w-auto",children:c.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(x=>c.jsx(Co,{variant:"focus",cellId:x,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x))})})]})}e[0]=o,e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i,e[6]=l,e[7]=d}else i=e[5],l=e[6],d=e[7];return d!==Symbol.for("react.early_return_sentinel")?d:(e[15]!==i||e[16]!==l?(u=c.jsxs(c.Fragment,{children:[i,l]}),e[15]=i,e[16]=l,e[17]=u):u=e[17],u)},Uh=t=>{const e=H.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const a=n.length>1?"destructive":"outline";let i,l,d;return e[5]!==o||e[6]!==r?(i=async u=>{r?r(u):(await on(o),Xe({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=i):i=e[7],e[8]!==o||e[9]!==a||e[10]!==i?(l=c.jsx($3,{title:o,variant:a,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:i,children:o}),e[8]=o,e[9]=a,e[10]=i,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(d=c.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=d):d=e[14],d},$h=O.memo(t=>{const e=H.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let a;e[0]!==s||e[1]!==r?(a=(M,R)=>{s({...r,[M]:R})},e[0]=s,e[1]=r,e[2]=a):a=e[2];const i=a;let l,d,u,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ys,{asChild:!0,children:c.jsx(ke,{variant:"text",size:"xs",children:c.jsx(Qf,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=d):d=e[4],e[5]!==i?(u=M=>i("hidePureMarkdown",!!M),e[5]=i,e[6]=u):u=e[6],e[7]!==r.hidePureMarkdown||e[8]!==u?(h=c.jsx(g3,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:u}),e[7]=r.hidePureMarkdown,e[8]=u,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(fr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=c.jsxs(xr,{children:[l,c.jsxs(fs,{className:"w-auto p-2 text-muted-foreground",children:[d,c.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const x=m,g=o==="_minimap_";let p,b,y;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(yp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(y=c.jsxs(ke,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=y):y=e[18];const v=o==="TB";let w,S,N;e[19]!==n?(w=()=>n("TB"),e[19]=n,e[20]=w):w=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(oi,{className:"w-4 h-4 mr-1"}),e[21]=S):S=e[21],e[22]!==v||e[23]!==w?(N=c.jsxs(ke,{variant:"outline",className:"bg-background","aria-selected":v,size:"xs",onClick:w,children:[S,"Vertical Tree"]}),e[22]=v,e[23]=w,e[24]=N):N=e[24];const C=o==="LR";let j,_,A,T;e[25]!==n?(j=()=>n("LR"),e[25]=n,e[26]=j):j=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(oi,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=_):_=e[27],e[28]!==C||e[29]!==j?(A=c.jsxs(ke,{variant:"outline",className:"bg-background","aria-selected":C,size:"xs",onClick:j,children:[_," ","Horizontal Tree"]}),e[28]=C,e[29]=j,e[30]=A):A=e[30],e[31]!==y||e[32]!==N||e[33]!==A?(T=c.jsxs("div",{className:"flex gap-2",children:[y,N,A]}),e[31]=y,e[32]=N,e[33]=A,e[34]=T):T=e[34];const P=o!=="_minimap_"&&x;let L;return e[35]!==T||e[36]!==P?(L=c.jsxs(Nl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[T,P]}),e[35]=T,e[36]=P,e[37]=L):L=e[37],L});$h.displayName="GraphToolbar";const Ol=O.memo(t=>{const e=H.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=sA;let a;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(a=()=>{if(n.type==="node"){const u=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,x)=>c.jsxs(c.Fragment,{children:[m.length===0&&c.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),c.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>c.jsxs(G.Fragment,{children:[c.jsx(Uh,{declaredBy:g.declaredBy,name:g.name}),c.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,c.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),c.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:c.jsx(y2,{skipScroll:!0,onClick:()=>s(x==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(Ll,{className:"w-5 h-5"}),c.jsx(Co,{cellId:n.id}),c.jsx("div",{className:"flex-1"}),c.jsx(J0,{cellId:n.id,children:c.jsx(ke,{variant:"ghost",size:"icon",children:c.jsx(Bc,{className:"w-4 h-4"})})}),c.jsx(ke,{variant:"text",size:"icon",onClick:()=>{r()},children:c.jsx(En,{className:"w-4 h-4"})})]}),c.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx($m,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),c.jsx("hr",{className:"border-divider my-3"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(Qt,{className:"w-4 h-4"}),"Inputs"]}),f(u,"in")]})]})]})}if(n.type==="edge"){const u=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(si,{className:"w-4 h-4"}),c.jsx(Co,{cellId:n.source}),c.jsx(Pc,{className:"w-4 h-4"}),c.jsx(Co,{cellId:n.target})]}),c.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:u.map(h=>c.jsxs(G.Fragment,{children:[c.jsx(Uh,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),c.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),c.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=a):a=e[6];const i=a;let l,d;return e[7]!==i?(l=i(),e[7]=i,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx(Nl,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:c.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=d):d=e[10],d});function sA(t,e){const n=_a(t);n&&Cm(n,e)}function v2(){const t=H.c(7),e=va(),n=at(iA),o=at(aA);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=OP(r,100);let a,i;t[2]!==s||t[3]!==o||t[4]!==n?(a=()=>{n&&o&&s()},i=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=a,t[6]=i):(a=t[5],i=t[6]),O.useEffect(a,i)}function aA(t){const{height:e}=t;return e}function iA(t){const{width:e}=t;return e}Ol.displayName="GraphSelectionPanel";const w2=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:Yr.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:Bh(et.get(e).code.trim().split(`
146
- `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],a=[];for(const[l,d]of Sm.zip(t,e)){const u=this.createNode(l,d,r);s.push(u),r=u.position.y+(u.height||0)}const i=new Set;for(const l of Object.values(n)){const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:a}}},lA=t=>{const e=H.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let a;e[0]!==r||e[1]!==n||e[2]!==o?(a=w2.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=a):a=e[3];const{nodes:i,edges:l}=a;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[4]=d):d=e[4];const[u,h]=f2(d),[f,m]=h2(i),[x,g]=O.useState(),[p,b]=O.useState(),y=O.useRef(!1);v2();const v=at(cA);let w;e[5]!==h||e[6]!==m?(w=k=>{m(k.nodes),h([])},e[5]=h,e[6]=m,e[7]=w):w=e[7];const S=ze(w);let N,C,j,_;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(N=()=>{y.current?S(w2.createElements(n,r,o,!1)):y.current=!0},C=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,e[11]=o,e[12]=N,e[13]=C):(N=e[12],C=e[13]),O.useEffect(N,C),e[14]!==l||e[15]!==x||e[16]!==h?(j=()=>{if(x){const k=l.filter(B=>{const{source:E,target:U,data:V}=B;return E===x&&V.direction==="outputs"||U===x&&V.direction==="inputs"});h(k)}},_=[x,h,l],e[14]=l,e[15]=x,e[16]=h,e[17]=j,e[18]=_):(j=e[17],_=e[18]),O.useEffect(j,_);const A=function(k,B){const E=H.c(17);let U,V;if(E[0]!==B||E[1]!==k){let Y;E[3]!==B?(Y=(oe,se)=>{const{position:re}=se;return Math.min(oe,re.y-B/2-10)},E[3]=B,E[4]=Y):Y=E[4],V=k.reduce(Y,Number.POSITIVE_INFINITY),E[0]=B,E[1]=k,E[2]=V}else V=E[2];const $=V;let K;if(E[5]!==B||E[6]!==k){let Y;E[8]!==B?(Y=(oe,se)=>{const{position:re}=se;return Math.max(oe,re.y+B/2+10)},E[8]=B,E[9]=Y):Y=E[9],K=k.reduce(Y,Number.NEGATIVE_INFINITY),E[5]=B,E[6]=k,E[7]=K}else K=E[7];const X=K;let J,ee,q;return E[10]!==$?(J=[Number.NEGATIVE_INFINITY,$],E[10]=$,E[11]=J):J=E[11],E[12]!==X?(ee=[Number.POSITIVE_INFINITY,X],E[12]=X,E[13]=ee):ee=E[13],E[14]!==J||E[15]!==ee?(q=[J,ee],E[14]=J,E[15]=ee,E[16]=q):q=E[16],U=q,U}(f,v);let T;e[19]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{g(void 0),b(void 0)},e[19]=T):T=e[19];const P=T;let L;e[20]!==u||e[21]!==p||e[22]!==x||e[23]!==o?(L=()=>p?c.jsx(Ol,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:P,variables:o,edges:u}):x?c.jsx(Ol,{selection:{type:"node",id:x},variables:o,edges:u,onClearSelection:P}):null,e[20]=u,e[21]=p,e[22]=x,e[23]=o,e[24]=L):L=e[24];const M=L;let R,z,D,I;return e[25]!==h?(R=(k,B)=>{const E=B.id;g(E),b(void 0),h([])},e[25]=h,e[26]=R):R=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(z=(k,B)=>{b(B)},e[27]=z):z=e[27],e[28]!==M?(D=M(),e[28]=M,e[29]=D):D=e[29],e[30]!==s||e[31]!==u||e[32]!==f||e[33]!==R||e[34]!==D||e[35]!==A?(I=c.jsxs(zh,{nodes:f,edges:u,nodeTypes:b2,translateExtent:A,onNodeClick:R,onNodeDoubleClick:dA,onEdgeClick:z,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Do.Vertical,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,selectNodesOnDrag:!1,panOnDrag:!1,preventScrolling:!1,zoomOnPinch:!1,panOnScroll:!0,autoPanOnNodeDrag:!1,autoPanOnConnect:!1,children:[D,s]}),e[30]=s,e[31]=u,e[32]=f,e[33]=R,e[34]=D,e[35]=A,e[36]=I):I=e[36],I};function cA(t){const{height:e}=t;return e}function dA(t,e){V3(e.id,"focus")}var Vh,k2,S2,N2,C2,j2,Hh,E2,Wh,_2,qh,I2,Gh,T2,Yh,A2,Kh,M2,Xh,O2,Jh,D2,Zh,P2,Qh,R2,ef,L2,tf,F2,nf,z2,of,B2,U2,$2,V2,H2,W2,q2,rf,G2,sf,Y2,af,K2,lf,X2,cf,J2,df,Z2,uf,Q2,hf,ew,ff,tw,mf,nw,pf,ow,gf,rw,xf,sw,bf,aw,iw,lw,cw,dw,uw,hw,yf,fw,vf,mw,pw,gw,wf,xw,kf,bw,Sf,yw,Nf,vw,Cf,ww,kw,Sw,Nw,Cw;function jf(){if(k2)return Vh;k2=1;var t="\0";function e(s,a){s[a]?s[a]++:s[a]=1}function n(s,a){--s[a]||delete s[a]}function o(s,a,i,l){var d=""+a,u=""+i;if(!s&&d>u){var h=d;d=u,u=h}return d+""+u+""+(l===void 0?"\0":l)}function r(s,a){return o(s,a.v,a.w,a.name)}return Vh=class{constructor(s){Z(this,"_isDirected",!0);Z(this,"_isMultigraph",!1);Z(this,"_isCompound",!1);Z(this,"_label");Z(this,"_defaultNodeLabelFn",()=>{});Z(this,"_defaultEdgeLabelFn",()=>{});Z(this,"_nodes",{});Z(this,"_in",{});Z(this,"_preds",{});Z(this,"_out",{});Z(this,"_sucs",{});Z(this,"_edgeObjs",{});Z(this,"_edgeLabels",{});Z(this,"_nodeCount",0);Z(this,"_edgeCount",0);Z(this,"_parent");Z(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(a=>Object.keys(s._in[a]).length===0)}sinks(){var s=this;return this.nodes().filter(a=>Object.keys(s._out[a]).length===0)}setNodes(s,a){var i=arguments,l=this;return s.forEach(function(d){i.length>1?l.setNode(d,a):l.setNode(d)}),this}setNode(s,a){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=a),this):(this._nodes[s]=arguments.length>1?a:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var a=this;if(Object.hasOwn(this._nodes,s)){var i=l=>a.removeEdge(a._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){a.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(i),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(i),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,a){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(a===void 0)a=t;else{for(var i=a+="";i!==void 0;i=this.parent(i))if(i===s)throw new Error("Setting "+a+" as parent of "+s+" would create a cycle");this.setNode(a)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=a,this._children[a][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var a=this._parent[s];if(a!==t)return a}}children(s=t){if(this._isCompound){var a=this._children[s];if(a)return Object.keys(a)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var a=this._preds[s];if(a)return Object.keys(a)}successors(s){var a=this._sucs[s];if(a)return Object.keys(a)}neighbors(s){var a=this.predecessors(s);if(a){const l=new Set(a);for(var i of this.successors(s))l.add(i);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var a=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});a.setGraph(this.graph());var i=this;Object.entries(this._nodes).forEach(function([u,h]){s(u)&&a.setNode(u,h)}),Object.values(this._edgeObjs).forEach(function(u){a.hasNode(u.v)&&a.hasNode(u.w)&&a.setEdge(u,i.edge(u))});var l={};function d(u){var h=i.parent(u);return h===void 0||a.hasNode(h)?(l[u]=h,h):h in l?l[h]:d(h)}return this._isCompound&&a.nodes().forEach(u=>a.setParent(u,d(u))),a}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,a){var i=this,l=arguments;return s.reduce(function(d,u){return l.length>1?i.setEdge(d,u,a):i.setEdge(d,u),u}),this}setEdge(){var s,a,i,l,d=!1,u=arguments[0];typeof u=="object"&&u!==null&&"v"in u?(s=u.v,a=u.w,i=u.name,arguments.length===2&&(l=arguments[1],d=!0)):(s=u,a=arguments[1],i=arguments[3],arguments.length>2&&(l=arguments[2],d=!0)),s=""+s,a=""+a,i!==void 0&&(i=""+i);var h=o(this._isDirected,s,a,i);if(Object.hasOwn(this._edgeLabels,h))return d&&(this._edgeLabels[h]=l),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[h]=d?l:this._defaultEdgeLabelFn(s,a,i);var f=function(m,x,g,p){var b=""+x,y=""+g;if(!m&&b>y){var v=b;b=y,y=v}var w={v:b,w:y};return p&&(w.name=p),w}(this._isDirected,s,a,i);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[a],s),e(this._sucs[s],a),this._in[a][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i),d=this._edgeObjs[l];return d&&(s=d.v,a=d.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[a],s),n(this._sucs[s],a),delete this._in[a][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,a){var i=this._in[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.v===a):l}}outEdges(s,a){var i=this._out[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.w===a):l}}nodeEdges(s,a){var i=this.inEdges(s,a);if(i)return i.concat(this.outEdges(s,a))}},Vh}function uA(){return j2?C2:(j2=1,C2={Graph:jf(),version:N2?S2:(N2=1,S2="2.2.4")})}function hA(){if(E2)return Hh;E2=1;var t=jf();function e(o){return o.nodes().map(function(r){var s=o.node(r),a=o.parent(r),i={v:r};return s!==void 0&&(i.value=s),a!==void 0&&(i.parent=a),i})}function n(o){return o.edges().map(function(r){var s=o.edge(r),a={v:r.v,w:r.w};return r.name!==void 0&&(a.name=r.name),s!==void 0&&(a.value=s),a})}return Hh={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(s){r.setNode(s.v,s.value),s.parent&&r.setParent(s.v,s.parent)}),o.edges.forEach(function(s){r.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),r}},Hh}function fA(){return _2||(_2=1,Wh=function(t){var e,n={},o=[];function r(s){Object.hasOwn(n,s)||(n[s]=!0,e.push(s),t.successors(s).forEach(r),t.predecessors(s).forEach(r))}return t.nodes().forEach(function(s){e=[],r(s),e.length&&o.push(e)}),o}),Wh}function jw(){return I2?qh:(I2=1,qh=class{constructor(){Z(this,"_arr",[]);Z(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},qh)}function Ew(){if(T2)return Gh;T2=1;var t=jw();Gh=function(n,o,r,s){return function(a,i,l,d){var u,h,f={},m=new t,x=function(g){var p=g.v!==u?g.v:g.w,b=f[p],y=l(g),v=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);v<b.distance&&(b.distance=v,b.predecessor=u,m.decrease(p,v))};for(a.nodes().forEach(function(g){var p=g===i?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(u=m.removeMin(),(h=f[u]).distance!==Number.POSITIVE_INFINITY);)d(u).forEach(x);return f}(n,String(o),r||e,s||function(a){return n.outEdges(a)})};var e=()=>1;return Gh}function mA(){if(A2)return Yh;A2=1;var t=Ew();return Yh=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Yh}function _w(){return M2||(M2=1,Kh=function(t){var e=0,n=[],o={},r=[];function s(a){var i=o[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach(function(u){Object.hasOwn(o,u)?o[u].onStack&&(i.lowlink=Math.min(i.lowlink,o[u].index)):(s(u),i.lowlink=Math.min(i.lowlink,o[u].lowlink))}),i.lowlink===i.index){var l,d=[];do l=n.pop(),o[l].onStack=!1,d.push(l);while(a!==l);r.push(d)}}return t.nodes().forEach(function(a){Object.hasOwn(o,a)||s(a)}),r}),Kh}function pA(){if(O2)return Xh;O2=1;var t=_w();return Xh=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Xh}function gA(){if(D2)return Jh;D2=1,Jh=function(e,n,o){return function(r,s,a){var i={},l=r.nodes();return l.forEach(function(d){i[d]={},i[d][d]={distance:0},l.forEach(function(u){d!==u&&(i[d][u]={distance:Number.POSITIVE_INFINITY})}),a(d).forEach(function(u){var h=u.v===d?u.w:u.v,f=s(u);i[d][h]={distance:f,predecessor:d}})}),l.forEach(function(d){var u=i[d];l.forEach(function(h){var f=i[h];l.forEach(function(m){var x=f[d],g=u[m],p=f[m],b=x.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),i}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Jh}function Iw(){if(P2)return Zh;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new e;Object.hasOwn(o,i)||(r[i]=!0,o[i]=!0,n.predecessors(i).forEach(a),delete r[i],s.push(i))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}P2=1;class e extends Error{constructor(){super(...arguments)}}return Zh=t,t.CycleException=e,Zh}function xA(){if(R2)return Qh;R2=1;var t=Iw();return Qh=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Qh}function Tw(){if(L2)return ef;function t(o,r,s,a){for(var i=[[o,!1]];i.length>0;){var l=i.pop();l[1]?a.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,i.push([l[0],!0]),n(r(l[0]),d=>i.push([d,!1])))}}function e(o,r,s,a){for(var i=[o];i.length>0;){var l=i.pop();Object.hasOwn(s,l)||(s[l]=!0,a.push(l),n(r(l),d=>i.push(d)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return L2=1,ef=function(o,r,s){Array.isArray(r)||(r=[r]);var a=o.isDirected()?u=>o.successors(u):u=>o.neighbors(u),i=s==="post"?t:e,l=[],d={};return r.forEach(u=>{if(!o.hasNode(u))throw new Error("Graph does not have node: "+u);i(u,a,d,l)}),l},ef}function bA(){if(F2)return tf;F2=1;var t=Tw();return tf=function(e,n){return t(e,n,"post")},tf}function yA(){if(z2)return nf;z2=1;var t=Tw();return nf=function(e,n){return t(e,n,"pre")},nf}function vA(){if(B2)return of;B2=1;var t=jf(),e=jw();return of=function(n,o){var r,s=new t,a={},i=new e;function l(u){var h=u.v===r?u.w:u.v,f=i.priority(h);if(f!==void 0){var m=o(u);m<f&&(a[h]=r,i.decrease(h,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(u){i.add(u,Number.POSITIVE_INFINITY),s.setNode(u)}),i.decrease(n.nodes()[0],0);for(var d=!1;i.size()>0;){if(r=i.removeMin(),Object.hasOwn(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+n);d=!0}n.nodeEdges(r).forEach(l)}return s},of}function An(){if(H2)return V2;H2=1;var t=uA();return V2={Graph:t.Graph,json:hA(),alg:$2?U2:($2=1,U2={components:fA(),dijkstra:Ew(),dijkstraAll:mA(),findCycles:pA(),floydWarshall:gA(),isAcyclic:xA(),postorder:bA(),preorder:yA(),prim:vA(),tarjan:_w(),topsort:Iw()}),version:t.version}}function wA(){if(G2)return rf;G2=1;let t=An().Graph,e=function(){if(q2)return W2;function s(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function a(i,l){if(i!=="_next"&&i!=="_prev")return l}return q2=1,W2=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,l=i._prev;if(l!==i)return s(l),l}enqueue(i){let l=this._sentinel;i._prev&&i._next&&s(i),i._next=l._next,l._next._prev=i,l._next=i,i._prev=l}toString(){let i=[],l=this._sentinel,d=l._prev;for(;d!==l;)i.push(JSON.stringify(d,a)),d=d._prev;return"["+i.join(", ")+"]"}}}();rf=function(s,a){if(s.nodeCount()<=1)return[];let i=function(l,d){let u=new t,h=0,f=0;l.nodes().forEach(g=>{u.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=u.edge(g.v,g.w)||0,b=d(g),y=p+b;u.setEdge(g.v,g.w,y),f=Math.max(f,u.node(g.v).out+=b),h=Math.max(h,u.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+h+3).map(()=>new e),x=h+1;return u.nodes().forEach(g=>{r(m,x,u.node(g))}),{graph:u,buckets:m,zeroIdx:x}}(s,a||n);return function(l,d,u){let h,f=[],m=d[d.length-1],x=d[0];for(;l.nodeCount();){for(;h=x.dequeue();)o(l,d,u,h);for(;h=m.dequeue();)o(l,d,u,h);if(l.nodeCount()){for(let g=d.length-2;g>0;--g)if(h=d[g].dequeue(),h){f=f.concat(o(l,d,u,h,!0));break}}}return f}(i.graph,i.buckets,i.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,a,i,l,d){let u=d?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);d&&u.push({v:h.v,w:h.w}),m.out-=f,r(a,i,m)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),m=h.w,x=s.node(m);x.in-=f,r(a,i,x)}),s.removeNode(l.v),u}function r(s,a,i){i.out?i.in?s[i.out-i.in+a].enqueue(i):s[s.length-1].enqueue(i):s[0].enqueue(i)}return rf}function _t(){if(Y2)return sf;Y2=1;let t=An().Graph;function e(d,u,h,f){for(var m=f;d.hasNode(m);)m=a(f);return h.dummy=u,d.setNode(m,h),m}sf={addBorderNode:function(d,u,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(d,"border",m,u)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(d){let u=new t({multigraph:d.isMultigraph()}).setGraph(d.graph());return d.nodes().forEach(h=>{d.children(h).length||u.setNode(h,d.node(h))}),d.edges().forEach(h=>{u.setEdge(h,d.edge(h))}),u},buildLayerMatrix:function(d){let u=i(r(d)+1).map(()=>[]);return d.nodes().forEach(h=>{let f=d.node(h),m=f.rank;m!==void 0&&(u[m][f.order]=h)}),u},intersectRect:function(d,u){let h,f,m=d.x,x=d.y,g=u.x-m,p=u.y-x,b=d.width/2,y=d.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*y?(p<0&&(y=-y),h=y*g/p,f=y):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:x+f}},mapValues:function(d,u){let h=u;return typeof u=="string"&&(h=f=>f[u]),Object.entries(d).reduce((f,[m,x])=>(f[m]=h(x,m),f),{})},maxRank:r,normalizeRanks:function(d){let u=d.nodes().map(f=>{let m=d.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,u);d.nodes().forEach(f=>{let m=d.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(d,u){return u()},partition:function(d,u){let h={lhs:[],rhs:[]};return d.forEach(f=>{u(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(d,u){const h={};for(const f of u)d[f]!==void 0&&(h[f]=d[f]);return h},predecessorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},range:i,removeEmptyRanks:function(d){let u=d.nodes().map(g=>d.node(g).rank),h=o(Math.min,u),f=[];d.nodes().forEach(g=>{let p=d.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,x=d.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%x!==0?--m:g!==void 0&&m&&g.forEach(b=>d.node(b).rank+=m)})},simplify:function(d){let u=new t().setGraph(d.graph());return d.nodes().forEach(h=>u.setNode(h,d.node(h))),d.edges().forEach(h=>{let f=u.edge(h.v,h.w)||{weight:0,minlen:1},m=d.edge(h);u.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),u},successorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},time:function(d,u){let h=Date.now();try{return u()}finally{console.log(d+" time: "+(Date.now()-h)+"ms")}},uniqueId:a,zipObject:l};const n=65535;function o(d,u){if(u.length>n){const h=function(f,m=n){const x=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);x.push(p)}return x}(u);return d.apply(null,h.map(f=>d.apply(null,f)))}return d.apply(null,u)}function r(d){const u=d.nodes().map(h=>{let f=d.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,u)}let s=0;function a(d){return d+""+ ++s}function i(d,u,h=1){u==null&&(u=d,d=0);let f=x=>x<u;h<0&&(f=x=>u<x);const m=[];for(let x=d;f(x);x+=h)m.push(x);return m}function l(d,u){return d.reduce((h,f,m)=>(h[f]=u[m],h),{})}return sf}function kA(){if(K2)return af;K2=1;let t=wA(),e=_t().uniqueId;return af={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],a={},i={};function l(d){Object.hasOwn(i,d)||(i[d]=!0,a[d]=!0,r.outEdges(d).forEach(u=>{Object.hasOwn(a,u.w)?s.push(u):l(u.w)}),delete a[d])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},af}function SA(){if(X2)return lf;X2=1;let t=_t();return lf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,a,i,l=r.v,d=o.node(l).rank,u=r.w,h=o.node(u).rank,f=r.name,m=o.edge(r),x=m.labelRank;if(h!==d+1){for(o.removeEdge(r),i=0,++d;d<h;++i,++d)m.points=[],a={width:0,height:0,edgeLabel:m,edgeObj:r,rank:d},s=t.addDummyNode(o,"edge",a,"_d"),d===x&&(a.width=m.width,a.height=m.height,a.dummy="edge-label",a.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),i===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,u,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},lf}function Dl(){if(J2)return cf;J2=1;const{applyWithChunking:t}=_t();return cf={longestPath:function(e){var n={};e.sources().forEach(function o(r){var s=e.node(r);if(Object.hasOwn(n,r))return s.rank;n[r]=!0;let a=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var i=t(Math.min,a);return i===Number.POSITIVE_INFINITY&&(i=0),s.rank=i})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},cf}function Aw(){if(Z2)return df;Z2=1;var t=An().Graph,e=Dl().slack;function n(s,a){return s.nodes().forEach(function i(l){a.nodeEdges(l).forEach(d=>{var u=d.v,h=l===u?d.w:u;s.hasNode(h)||e(a,d)||(s.setNode(h,{}),s.setEdge(l,h,{}),i(h))})}),s.nodeCount()}function o(s,a){return a.edges().reduce((i,l)=>{let d=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(d=e(a,l)),d<i[0]?[d,l]:i},[Number.POSITIVE_INFINITY,null])[1]}function r(s,a,i){s.nodes().forEach(l=>a.node(l).rank+=i)}return df=function(s){var a,i,l=new t({directed:!1}),d=s.nodes()[0],u=s.nodeCount();for(l.setNode(d,{});n(l,s)<u;)a=o(l,s),i=l.hasNode(a.v)?e(s,a):-e(s,a),r(l,s,i);return l},df}function NA(){if(Q2)return uf;Q2=1;var t=Aw(),e=Dl().slack,n=Dl().longestPath,o=An().alg.preorder,r=An().alg.postorder,s=_t().simplify;function a(g){g=s(g),n(g);var p,b=t(g);for(d(b),i(b,g);p=h(b);)m(b,g,p,f(b,g,p))}function i(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(v,w,S){var N=v.node(S),C=N.parent;v.edge(S,C).cutvalue=l(v,w,S)}(g,p,y))}function l(g,p,b){var y=g.node(b).parent,v=!0,w=p.edge(b,y),S=0;return w||(v=!1,w=p.edge(y,b)),S=w.weight,p.nodeEdges(b).forEach(N=>{var C,j,_=N.v===b,A=_?N.w:N.v;if(A!==y){var T=_===v,P=p.edge(N).weight;if(S+=T?P:-P,C=b,j=A,g.hasEdge(C,j)){var L=g.edge(b,A).cutvalue;S+=T?-L:L}}}),S}function d(g,p){arguments.length<2&&(p=g.nodes()[0]),u(g,{},1,p)}function u(g,p,b,y,v){var w=b,S=g.node(y);return p[y]=!0,g.neighbors(y).forEach(N=>{Object.hasOwn(p,N)||(b=u(g,p,b,N,y))}),S.low=w,S.lim=b++,v?S.parent=v:delete S.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var y=b.v,v=b.w;p.hasEdge(y,v)||(y=b.w,v=b.v);var w=g.node(y),S=g.node(v),N=w,C=!1;w.lim>S.lim&&(N=S,C=!0);var j=p.edges().filter(_=>C===x(g,g.node(_.v),N)&&C!==x(g,g.node(_.w),N));return j.reduce((_,A)=>e(p,A)<e(p,_)?A:_)}function m(g,p,b,y){var v=b.v,w=b.w;g.removeEdge(v,w),g.setEdge(y.v,y.w,{}),d(g),i(g,p),function(S,N){var C=S.nodes().find(_=>!N.node(_).parent),j=o(S,C);(j=j.slice(1)).forEach(_=>{var A=S.node(_).parent,T=N.edge(_,A),P=!1;T||(T=N.edge(A,_),P=!0),N.node(_).rank=N.node(A).rank+(P?T.minlen:-T.minlen)})}(g,p)}function x(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return uf=a,a.initLowLimValues=d,a.initCutValues=i,a.calcCutValue=l,a.leaveEdge=h,a.enterEdge=f,a.exchangeEdges=m,uf}function CA(){if(ew)return hf;ew=1;var t=Dl().longestPath,e=Aw(),n=NA();hf=function(s){var a=s.graph().ranker;if(a instanceof Function)return a(s);switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(i){t(i),e(i)})(s);break;case"longest-path":o(s);case"none":}};var o=t;function r(s){n(s)}return hf}function jA(){return tw||(tw=1,ff=function(t){let e=function(n){let o={},r=0;function s(a){let i=r;n.children(a).forEach(s),o[a]={low:i,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(h,f,m,x){let g,p,b=[],y=[],v=Math.min(f[m].low,f[x].low),w=Math.max(f[m].lim,f[x].lim);g=m;do g=h.parent(g),b.push(g);while(g&&(f[g].low>v||w>f[g].lim));for(p=g,g=x;(g=h.parent(g))!==p;)y.push(g);return{path:b.concat(y.reverse()),lca:p}}(t,e,r.v,r.w),a=s.path,i=s.lca,l=0,d=a[l],u=!0;for(;n!==r.w;){if(o=t.node(n),u){for(;(d=a[l])!==i&&t.node(d).maxRank<o.rank;)l++;d===i&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(d=a[l+1]).minRank<=o.rank;)l++;d=a[l]}t.setParent(n,d),n=t.successors(n)[0]}})}),ff}function EA(){if(nw)return mf;nw=1;let t=_t();function e(n,o,r,s,a,i,l){let d=n.children(l);if(!d.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(h,l),f.borderBottom=h,d.forEach(m=>{e(n,o,r,s,a,i,m);let x=n.node(m),g=x.borderTop?x.borderTop:m,p=x.borderBottom?x.borderBottom:m,b=x.borderTop?s:2*s,y=g!==p?1:a-i[l]+1;n.setEdge(u,g,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:a+i[l]})}return mf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(d){var u={};function h(f,m){var x=d.children(f);x&&x.length&&x.forEach(g=>h(g,m+1)),u[f]=m}return d.children().forEach(f=>h(f,1)),u}(n),s=Object.values(r),a=t.applyWithChunking(Math.max,s)-1,i=2*a+1;n.graph().nestingRoot=o,n.edges().forEach(d=>n.edge(d).minlen*=i);let l=function(d){return d.edges().reduce((u,h)=>u+d.edge(h).weight,0)}(n)+1;n.children().forEach(d=>e(n,o,i,l,a,r,d)),n.graph().nodeRankFactor=i},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},mf}function _A(){if(rw)return gf;function t(r){r.nodes().forEach(s=>e(r.node(s))),r.edges().forEach(s=>e(r.edge(s)))}function e(r){let s=r.width;r.width=r.height,r.height=s}function n(r){r.y=-r.y}function o(r){let s=r.x;r.x=r.y,r.y=s}return rw=1,gf={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(a){a.nodes().forEach(i=>n(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(a){a.nodes().forEach(i=>o(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},gf}function IA(){if(dw)return cw;dw=1;let t=_t();return cw=function(e,n){let o={};return e.forEach((r,s)=>{let a=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(a.barycenter=r.barycenter,a.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],a=o[r.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function a(l){return d=>{d.merged||(d.barycenter===void 0||l.barycenter===void 0||d.barycenter>=l.barycenter)&&function(u,h){let f=0,m=0;u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),u.vs=h.vs.concat(u.vs),u.barycenter=f/m,u.weight=m,u.i=Math.min(h.i,u.i),h.merged=!0}(l,d)}}function i(l){return d=>{d.in.push(l),--d.indegree===0&&r.push(d)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(a(l)),l.out.forEach(i(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function TA(){if(fw)return yf;fw=1;let t=(lw||(lw=1,iw=function(o,r=[]){return r.map(s=>{let a=o.inEdges(s);if(a.length){let i=a.reduce((l,d)=>{let u=o.edge(d),h=o.node(d.v);return{sum:l.sum+u.weight*h.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:s,barycenter:i.sum/i.weight,weight:i.weight}}return{v:s}})}),iw),e=IA(),n=function(){if(hw)return uw;hw=1;let o=_t();function r(s,a,i){let l;for(;a.length&&(l=a[a.length-1]).i<=i;)a.pop(),s.push(l.vs),i++;return i}return uw=function(s,a){let i=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=i.lhs,d=i.rhs.sort((p,b)=>b.i-p.i),u=[],h=0,f=0,m=0;var x;l.sort((x=!!a,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:x?b.i-p.i:p.i-b.i)),m=r(u,d,m),l.forEach(p=>{m+=p.vs.length,u.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(u,d,m)});let g={vs:u.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return yf=function o(r,s,a,i){let l=r.children(s),d=r.node(s),u=d?d.borderLeft:void 0,h=d?d.borderRight:void 0,f={};u&&(l=l.filter(p=>p!==u&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let v=o(r,p.v,a,i);f[p.v]=v,Object.hasOwn(v,"barycenter")&&(y=v,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+y.barycenter*y.weight)/(b.weight+y.weight),b.weight+=y.weight):(b.barycenter=y.barycenter,b.weight=y.weight))}var b,y});let x=e(m,a);(function(p,b){p.forEach(y=>{y.vs=y.vs.flatMap(v=>b[v]?b[v].vs:v)})})(x,f);let g=n(x,i);if(u&&(g.vs=[u,g.vs,h].flat(!0),r.predecessors(u).length)){let p=r.node(r.predecessors(u)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},yf}function AA(){if(mw)return vf;mw=1;let t=An().Graph,e=_t();return vf=function(n,o,r){let s=function(i){for(var l;i.hasNode(l=e.uniqueId("_root")););return l}(n),a=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(i=>n.node(i));return n.nodes().forEach(i=>{let l=n.node(i),d=n.parent(i);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(a.setNode(i),a.setParent(i,d||s),n[r](i).forEach(u=>{let h=u.v===i?u.w:u.v,f=a.edge(h,i),m=f!==void 0?f.weight:0;a.setEdge(h,i,{weight:n.edge(u).weight+m})}),Object.hasOwn(l,"minRank")&&a.setNode(i,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),a},vf}function MA(){if(xw)return wf;xw=1;let t=function(){if(sw)return xf;sw=1;let u=_t();return xf=function(h){let f={},m=h.nodes().filter(y=>!h.children(y).length),x=m.map(y=>h.node(y).rank),g=u.applyWithChunking(Math.max,x),p=u.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let v=h.node(y);p[v.rank].push(y),h.successors(y).forEach(b)}return m.sort((y,v)=>h.node(y).rank-h.node(v).rank).forEach(b),p},xf}(),e=function(){if(aw)return bf;aw=1;let u=_t().zipObject;function h(f,m,x){let g=u(x,x.map((S,N)=>N)),p=m.flatMap(S=>f.outEdges(S).map(N=>({pos:g[N.w],weight:f.edge(N).weight})).sort((N,C)=>N.pos-C.pos)),b=1;for(;b<x.length;)b<<=1;let y=2*b-1;b-=1;let v=new Array(y).fill(0),w=0;return p.forEach(S=>{let N=S.pos+b;v[N]+=S.weight;let C=0;for(;N>0;)N%2&&(C+=v[N+1]),N=N-1>>1,v[N]+=S.weight;w+=S.weight*C}),w}return bf=function(f,m){let x=0;for(let g=1;g<m.length;++g)x+=h(f,m[g-1],m[g]);return x},bf}(),n=TA(),o=AA(),r=(gw||(gw=1,pw=function(u,h,f){let m,x={};f.forEach(g=>{let p,b,y=u.parent(g);for(;y;){if(p=u.parent(y),p?(b=x[p],x[p]=y):(b=m,m=y),b&&b!==y)return void h.setEdge(b,y);y=p}})}),pw),s=An().Graph,a=_t();function i(u,h,f){return h.map(function(m){return o(u,m,f)})}function l(u,h){let f=new s;u.forEach(function(m){let x=m.graph().root,g=n(m,x,f,h);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function d(u,h){Object.values(h).forEach(f=>f.forEach((m,x)=>u.node(m).order=x))}return wf=function u(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,u);let m=a.maxRank(h),x=i(h,a.range(1,m+1),"inEdges"),g=i(h,a.range(m-1,-1,-1),"outEdges"),p=t(h);if(d(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let v=0,w=0;w<4;++v,++w){l(v%2?x:g,v%4>=2),p=a.buildLayerMatrix(h);let S=e(h,p);S<y&&(w=0,b=Object.assign({},p),y=S)}d(h,b)},wf}function OA(){if(bw)return kf;bw=1;let t=An().Graph,e=_t();function n(h,f){let m={};return f.length&&f.reduce(function(x,g){let p=0,b=0,y=x.length,v=g[g.length-1];return g.forEach((w,S)=>{let N=function(j,_){if(j.node(_).dummy)return j.predecessors(_).find(A=>j.node(A).dummy)}(h,w),C=N?h.node(N).order:y;(N||w===v)&&(g.slice(b,S+1).forEach(j=>{h.predecessors(j).forEach(_=>{let A=h.node(_),T=A.order;!(T<p||C<T)||A.dummy&&h.node(j).dummy||r(m,_,j)})}),b=S+1,p=C)}),g}),m}function o(h,f){let m={};function x(g,p,b,y,v){let w;e.range(p,b).forEach(S=>{w=g[S],h.node(w).dummy&&h.predecessors(w).forEach(N=>{let C=h.node(N);C.dummy&&(C.order<y||C.order>v)&&r(m,N,w)})})}return f.length&&f.reduce(function(g,p){let b,y=-1,v=0;return p.forEach((w,S)=>{if(h.node(w).dummy==="border"){let N=h.predecessors(w);N.length&&(b=h.node(N[0]).order,x(p,v,S,y,b),v=S,y=b)}x(p,v,p.length,b,g.length)}),p}),m}function r(h,f,m){if(f>m){let g=f;f=m,m=g}let x=h[f];x||(h[f]=x={}),x[m]=!0}function s(h,f,m){if(f>m){let x=f;f=m,m=x}return!!h[f]&&Object.hasOwn(h[f],m)}function a(h,f,m,x){let g={},p={},b={};return f.forEach(y=>{y.forEach((v,w)=>{g[v]=v,p[v]=v,b[v]=w})}),f.forEach(y=>{let v=-1;y.forEach(w=>{let S=x(w);if(S.length){S=S.sort((C,j)=>b[C]-b[j]);let N=(S.length-1)/2;for(let C=Math.floor(N),j=Math.ceil(N);C<=j;++C){let _=S[C];p[w]===w&&v<b[_]&&!s(m,w,_)&&(p[_]=w,p[w]=g[w]=g[_],v=b[_])}}})}),{root:g,align:p}}function i(h,f,m,x,g){let p={},b=function(w,S,N,C){let j=new t,_=w.graph(),A=function(T,P,L){return(M,R,z)=>{let D,I=M.node(R),k=M.node(z),B=0;if(B+=I.width/2,Object.hasOwn(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":D=-I.width/2;break;case"r":D=I.width/2}if(D&&(B+=L?D:-D),D=0,B+=(I.dummy?P:T)/2,B+=(k.dummy?P:T)/2,B+=k.width/2,Object.hasOwn(k,"labelpos"))switch(k.labelpos.toLowerCase()){case"l":D=k.width/2;break;case"r":D=-k.width/2}return D&&(B+=L?D:-D),D=0,B}}(_.nodesep,_.edgesep,C);return S.forEach(T=>{let P;T.forEach(L=>{let M=N[L];if(j.setNode(M),P){var R=N[P],z=j.edge(R,M);j.setEdge(R,M,Math.max(A(w,L,P),z||0))}P=L})}),j}(h,f,m,g),y=g?"borderLeft":"borderRight";function v(w,S){let N=b.nodes(),C=N.pop(),j={};for(;C;)j[C]?w(C):(j[C]=!0,N.push(C),N=N.concat(S(C))),C=N.pop()}return v(function(w){p[w]=b.inEdges(w).reduce((S,N)=>Math.max(S,p[N.v]+b.edge(N)),0)},b.predecessors.bind(b)),v(function(w){let S=b.outEdges(w).reduce((C,j)=>Math.min(C,p[j.w]-b.edge(j)),Number.POSITIVE_INFINITY),N=h.node(w);S!==Number.POSITIVE_INFINITY&&N.borderType!==y&&(p[w]=Math.max(p[w],S))},b.successors.bind(b)),Object.keys(x).forEach(w=>p[w]=p[m[w]]),p}function l(h,f){return Object.values(f).reduce((m,x)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(x).forEach(([y,v])=>{let w=function(S,N){return S.node(N).width}(h,y)/2;g=Math.max(v+w,g),p=Math.min(v-w,p)});const b=g-p;return b<m[0]&&(m=[b,x]),m},[Number.POSITIVE_INFINITY,null])[1]}function d(h,f){let m=Object.values(f),x=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let y=p+b,v=h[y];if(v===f)return;let w=Object.values(v),S=x-e.applyWithChunking(Math.min,w);b!=="l"&&(S=g-e.applyWithChunking(Math.max,w)),S&&(h[y]=e.mapValues(v,N=>N+S))})})}function u(h,f){return e.mapValues(h.ul,(m,x)=>{if(f)return h[f.toLowerCase()][x];{let g=Object.values(h).map(p=>p[x]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return kf={positionX:function(h){let f,m=e.buildLayerMatrix(h),x=Object.assign(n(h,m),o(h,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(N=>Object.values(N).reverse()));let v=(b==="u"?h.predecessors:h.successors).bind(h),w=a(h,f,x,v),S=i(h,f,w.root,w.align,y==="r");y==="r"&&(S=e.mapValues(S,N=>-N)),g[b+y]=S})});let p=l(h,g);return d(g,p),u(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:a,horizontalCompaction:i,alignCoordinates:d,findSmallestWidthAlignment:l,balance:u},kf}function DA(){if(yw)return Sf;yw=1;let t=_t(),e=OA().positionX;return Sf=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,a=0;r.forEach(i=>{const l=i.reduce((d,u)=>{const h=o.node(u).height;return d>h?d:h},0);i.forEach(d=>o.node(d).y=a+l/2),a+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Sf}function PA(){if(vw)return Nf;vw=1;let t=kA(),e=SA(),n=CA(),o=_t().normalizeRanks,r=jA(),s=_t().removeEmptyRanks,a=EA(),i=function(){if(ow)return pf;ow=1;let C=_t();function j(_,A,T,P,L,M){let R={width:0,height:0,rank:M,borderType:A},z=L[A][M-1],D=C.addDummyNode(_,"border",R,T);L[A][M]=D,_.setParent(D,P),z&&_.setEdge(z,D,{weight:1})}return pf=function(_){_.children().forEach(function A(T){let P=_.children(T),L=_.node(T);if(P.length&&P.forEach(A),Object.hasOwn(L,"minRank")){L.borderLeft=[],L.borderRight=[];for(let M=L.minRank,R=L.maxRank+1;M<R;++M)j(_,"borderLeft","_bl",T,L,M),j(_,"borderRight","_br",T,L,M)}})},pf}(),l=_A(),d=MA(),u=DA(),h=_t(),f=An().Graph;Nf=function(C,j){let _=j&&j.debugTiming?h.time:h.notime;_("layout",()=>{let A=_(" buildLayoutGraph",()=>function(T){let P=new f({multigraph:!0,compound:!0}),L=N(T.graph());return P.setGraph(Object.assign({},x,S(L,m),h.pick(L,g))),T.nodes().forEach(M=>{const R=S(N(T.node(M)),p);Object.keys(b).forEach(z=>{R[z]===void 0&&(R[z]=b[z])}),P.setNode(M,R),P.setParent(M,T.parent(M))}),T.edges().forEach(M=>{let R=N(T.edge(M));P.setEdge(M,Object.assign({},v,S(R,y),h.pick(R,w)))}),P}(C));_(" runLayout",()=>function(T,P,L){P(" makeSpaceForEdgeLabels",()=>function(M){let R=M.graph();R.ranksep/=2,M.edges().forEach(z=>{let D=M.edge(z);D.minlen*=2,D.labelpos.toLowerCase()!=="c"&&(R.rankdir==="TB"||R.rankdir==="BT"?D.width+=D.labeloffset:D.height+=D.labeloffset)})}(T)),P(" removeSelfEdges",()=>function(M){M.edges().forEach(R=>{if(R.v===R.w){var z=M.node(R.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:R,label:M.edge(R)}),M.removeEdge(R)}})}(T)),P(" acyclic",()=>t.run(T)),P(" nestingGraph.run",()=>a.run(T)),P(" rank",()=>n(h.asNonCompoundGraph(T))),P(" injectEdgeLabelProxies",()=>function(M){M.edges().forEach(R=>{let z=M.edge(R);if(z.width&&z.height){let D=M.node(R.v),I={rank:(M.node(R.w).rank-D.rank)/2+D.rank,e:R};h.addDummyNode(M,"edge-proxy",I,"_ep")}})}(T)),P(" removeEmptyRanks",()=>s(T)),P(" nestingGraph.cleanup",()=>a.cleanup(T)),P(" normalizeRanks",()=>o(T)),P(" assignRankMinMax",()=>function(M){let R=0;M.nodes().forEach(z=>{let D=M.node(z);D.borderTop&&(D.minRank=M.node(D.borderTop).rank,D.maxRank=M.node(D.borderBottom).rank,R=Math.max(R,D.maxRank))}),M.graph().maxRank=R}(T)),P(" removeEdgeLabelProxies",()=>function(M){M.nodes().forEach(R=>{let z=M.node(R);z.dummy==="edge-proxy"&&(M.edge(z.e).labelRank=z.rank,M.removeNode(R))})}(T)),P(" normalize.run",()=>e.run(T)),P(" parentDummyChains",()=>r(T)),P(" addBorderSegments",()=>i(T)),P(" order",()=>d(T,L)),P(" insertSelfEdges",()=>function(M){var R=h.buildLayerMatrix(M);R.forEach(z=>{var D=0;z.forEach((I,k)=>{var B=M.node(I);B.order=k+D,(B.selfEdges||[]).forEach(E=>{h.addDummyNode(M,"selfedge",{width:E.label.width,height:E.label.height,rank:B.rank,order:k+ ++D,e:E.e,label:E.label},"_se")}),delete B.selfEdges})})}(T)),P(" adjustCoordinateSystem",()=>l.adjust(T)),P(" position",()=>u(T)),P(" positionSelfEdges",()=>function(M){M.nodes().forEach(R=>{var z=M.node(R);if(z.dummy==="selfedge"){var D=M.node(z.e.v),I=D.x+D.width/2,k=D.y,B=z.x-I,E=D.height/2;M.setEdge(z.e,z.label),M.removeNode(R),z.label.points=[{x:I+2*B/3,y:k-E},{x:I+5*B/6,y:k-E},{x:I+B,y:k},{x:I+5*B/6,y:k+E},{x:I+2*B/3,y:k+E}],z.label.x=z.x,z.label.y=z.y}})}(T)),P(" removeBorderNodes",()=>function(M){M.nodes().forEach(R=>{if(M.children(R).length){let z=M.node(R),D=M.node(z.borderTop),I=M.node(z.borderBottom),k=M.node(z.borderLeft[z.borderLeft.length-1]),B=M.node(z.borderRight[z.borderRight.length-1]);z.width=Math.abs(B.x-k.x),z.height=Math.abs(I.y-D.y),z.x=k.x+z.width/2,z.y=D.y+z.height/2}}),M.nodes().forEach(R=>{M.node(R).dummy==="border"&&M.removeNode(R)})}(T)),P(" normalize.undo",()=>e.undo(T)),P(" fixupEdgeLabelCoords",()=>function(M){M.edges().forEach(R=>{let z=M.edge(R);if(Object.hasOwn(z,"x"))switch(z.labelpos!=="l"&&z.labelpos!=="r"||(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset}})}(T)),P(" undoCoordinateSystem",()=>l.undo(T)),P(" translateGraph",()=>function(M){let R=Number.POSITIVE_INFINITY,z=0,D=Number.POSITIVE_INFINITY,I=0,k=M.graph(),B=k.marginx||0,E=k.marginy||0;function U(V){let $=V.x,K=V.y,X=V.width,J=V.height;R=Math.min(R,$-X/2),z=Math.max(z,$+X/2),D=Math.min(D,K-J/2),I=Math.max(I,K+J/2)}M.nodes().forEach(V=>U(M.node(V))),M.edges().forEach(V=>{let $=M.edge(V);Object.hasOwn($,"x")&&U($)}),R-=B,D-=E,M.nodes().forEach(V=>{let $=M.node(V);$.x-=R,$.y-=D}),M.edges().forEach(V=>{let $=M.edge(V);$.points.forEach(K=>{K.x-=R,K.y-=D}),Object.hasOwn($,"x")&&($.x-=R),Object.hasOwn($,"y")&&($.y-=D)}),k.width=z-R+B,k.height=I-D+E}(T)),P(" assignNodeIntersects",()=>function(M){M.edges().forEach(R=>{let z,D,I=M.edge(R),k=M.node(R.v),B=M.node(R.w);I.points?(z=I.points[0],D=I.points[I.points.length-1]):(I.points=[],z=B,D=k),I.points.unshift(h.intersectRect(k,z)),I.points.push(h.intersectRect(B,D))})}(T)),P(" reversePoints",()=>function(M){M.edges().forEach(R=>{let z=M.edge(R);z.reversed&&z.points.reverse()})}(T)),P(" acyclic.undo",()=>t.undo(T))}(A,_,j)),_(" updateInputGraph",()=>function(T,P){T.nodes().forEach(L=>{let M=T.node(L),R=P.node(L);M&&(M.x=R.x,M.y=R.y,M.rank=R.rank,P.children(L).length&&(M.width=R.width,M.height=R.height))}),T.edges().forEach(L=>{let M=T.edge(L),R=P.edge(L);M.points=R.points,Object.hasOwn(R,"x")&&(M.x=R.x,M.y=R.y)}),T.graph().width=P.graph().width,T.graph().height=P.graph().height}(C,A))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],x={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height","rank"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],v={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},w=["labelpos"];function S(C,j){return h.mapValues(h.pick(C,j),Number)}function N(C){var j={};return C&&Object.entries(C).forEach(([_,A])=>{typeof _=="string"&&(_=_.toLowerCase()),j[_]=A}),j}return Nf}function RA(){if(ww)return Cf;ww=1;let t=_t(),e=An().Graph;return Cf={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,a)=>{let i="layer"+a;r.setNode(i,{rank:"same"}),s.reduce((l,d)=>(r.setEdge(l,d,{style:"invis"}),d))}),r}},Cf}var Mw=Cw?Nw:(Cw=1,Nw={graphlib:An(),layout:PA(),debug:RA(),util:{time:_t().time,notime:_t().notime},version:Sw?kw:(Sw=1,kw="1.1.5")});const Sa=new Mw.graphlib.Graph().setDefaultEdgeLabel(()=>({})),Ow=({nodes:t,edges:e,direction:n})=>(Sa.setGraph({rankdir:n,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Sa.setEdge(o.source,o.target)),t.forEach(o=>Sa.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),Mw.layout(Sa),{nodes:t.map(o=>{const{x:r,y:s}=Sa.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),Dw=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:Yr.ArrowClosed},id:`${t}-${e}`,style:{strokeWidth:2},source:t,sourceHandle:"outputs",targetHandle:"inputs",target:e}}createNode(t,e){return{id:t,data:{atom:e,forceWidth:300},width:300,type:"custom",height:Bh(et.get(e).code.trim().split(`
147
- `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],a=new Set,i=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.add(h),a.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of Sm.zip(t,e)){o||r.push(this.createNode(l,d));const u=a.has(l),h=et.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},LA=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:a,settings:i}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a||e[3]!==i.hidePureMarkdown||e[4]!==o?(l=()=>{let k=Dw.createElements(n,r,o,i.hidePureMarkdown);return k=Ow({nodes:k.nodes,edges:k.edges,direction:a}),k},e[0]=r,e[1]=n,e[2]=a,e[3]=i.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=O.useState(l),[u,h,f]=h2(d.nodes),[m,x,g]=f2(d.edges),p=va();let b;e[6]!==a||e[7]!==x||e[8]!==h?(b=k=>{const B=Ow({nodes:k.nodes,edges:k.edges,direction:a});h(B.nodes),x(B.edges)},e[6]=a,e[7]=x,e[8]=h,e[9]=b):b=e[9];const y=ze(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==i.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(Dw.createElements(n,r,o,i.hidePureMarkdown))},w=[n,o,r,y,i.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=i.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),O.useEffect(v,w);const[S,N]=O.useState();let C;v2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{N(void 0)},e[17]=C):C=e[17];const j=C;let _,A,T,P,L,M,R,z,D,I;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},A=(k,B)=>{N({type:"node",id:B.id})},T=(k,B)=>{const{source:E,target:U}=B;N({type:"edge",source:E,target:U})},e[18]=_,e[19]=A,e[20]=T):(_=e[18],A=e[19],T=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(oA,{color:"#ccc",variant:kn.Dots}),e[21]=P):P=e[21],e[22]!==p||e[23]!==u?(L=()=>{const k=et.get(DP);if(k){const B=u.find(E=>E.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),N({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=L):L=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsx(ip,{className:"size-4"}),e[25]=M):M=e[25],e[26]!==L?(R=c.jsx(JT,{position:"bottom-right",showInteractive:!1,children:c.jsx(Ce,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(ns,{onMouseDown:Dn.preventFocus,onClick:L,children:M})})}),e[26]=L,e[27]=R):R=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(z=c.jsx(Ol,{selection:S,variables:o,edges:m,onClearSelection:j}),e[28]=m,e[29]=S,e[30]=o,e[31]=z):z=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==R||e[38]!==z?(D=c.jsxs(zh,{nodes:u,edges:m,nodeTypes:b2,minZoom:.2,fitViewOptions:_,onNodeClick:A,onEdgeClick:T,onNodeDoubleClick:FA,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[P,R,z,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=R,e[38]=z,e[39]=D):D=e[39],e[40]!==a||e[41]!==D?(I=c.jsx(g2,{value:a,children:D}),e[40]=a,e[41]=D,e[42]=I):I=e[42],I};function FA(t,e){V3(e.id,"focus")}const zA=yt("_minimap_"),BA=yt({hidePureMarkdown:!0}),UA=t=>{const e=H.c(11),[n,o]=Ot(zA),[r,s]=Ot(BA);let a;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(a=()=>n==="_minimap_"?c.jsx(lA,{...t,children:c.jsx($h,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(LA,{...t,settings:r,layoutDirection:n,children:c.jsx($h,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=a):a=e[5];const i=a;let l,d;return e[6]!==i?(l=i(),e[6]=i,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(Fh,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},$A=()=>{const t=H.c(5),e=jm(),n=Tc(),[o]=PP();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=me("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx(UA,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},VA=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=G.useState(!1);let a,i;return e[0]!==r||e[1]!==n?(a=()=>{n&&!r&&s(!0)},i=[n,r],e[0]=r,e[1]=n,e[2]=a,e[3]=i):(a=e[2],i=e[3]),G.useEffect(a,i),r?o:null},HA=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=et.get(cc)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=_a(l);d&&Cm(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let a,i;return e[2]!==o?(a=me("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a||e[6]!==n?(i=c.jsx("button",{type:"button",onClick:s,className:a,children:n}),e[4]=s,e[5]=a,e[6]=n,e[7]=i):i=e[7],i},WA=yt(t=>{const e=t(RP),n=t(cc),o=t(Nc);return Qa(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(i=>i.name===r.variable_name);if(!s)return 0;const a=o.inOrderIds.indexOf(s.declaredBy[0]);return a===-1?0:a})}),qA=yt(t=>{const e=new Map(t(LP));for(const n of H3){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return Qa([...e.values()],n=>H3.has(n.name)?1:0)}),GA=()=>{const t=H.c(32),[e,n]=G.useState(""),o=St(W3),r=Ie(WA),s=Ie(qA);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(lg,{children:c.jsxs(ke,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(Ko,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx($o,{})}),t[0]=b):b=t[0],b}const a=!!e.trim();let i,l,d,u,h,f,m,x,g,p;if(t[1]!==o?(i=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=i):i=t[2],t[3]!==e||t[4]!==i?(l=c.jsx(Aa,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:i,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=i,t[5]=l):l=t[5],t[6]!==a?(d=a&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(En,{className:"h-4 w-4"})}),t[6]=a,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(lg,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Ko,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==a||t[14]!==e){let b;t[16]!==a||t[17]!==e?(b=y=>c.jsx(YA,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>c.jsx(KA,{engineName:y.name,database:v,hasSearch:a,children:c.jsx(XA,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:a,searchValue:e})},v.name))},y.name),t[16]=a,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=a,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&c.jsxs(q3,{children:[c.jsx(Hl,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(x=r.length>0&&c.jsx(Pw,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=x):x=t[24],t[25]!==f||t[26]!==m||t[27]!==x?(g=c.jsxs(pm,{className:"flex flex-col",children:[f,m,x]}),t[25]=f,t[26]=m,t[27]=x,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(ac,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},YA=t=>{const e=H.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===FP,a=s?"In-Memory":n.name,[i,l]=G.useState(!1);let d;e[0]!==n.name?(d=async()=>{l(!0),await BP({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=d):d=e[1];const u=d;let h,f,m;e[2]!==n.dialect?(h=c.jsx(Dk,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=h):h=e[3],e[4]!==n.dialect?(f=zP(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=c.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const x=a;let g,p,b,y,v;return e[8]!==x?(g=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(HA,{variableName:x}),")"]}),e[8]=x,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==i?(p=!s&&c.jsx(Ce,{content:"Refresh connection",children:c.jsx(ke,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:c.jsx(bc,{className:me("h-4 w-4 text-muted-foreground hover:text-foreground",i&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=i,e[13]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=c.jsxs(q3,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:c.jsx(Ac,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(v=c.jsxs(c.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=v):v=e[24],v},KA=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[a,i]=G.useState(!1),[l,d]=G.useState(!1);let u,h,f;e[0]!==n?(u=()=>{i(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),G.useEffect(u,h),e[3]!==a||e[4]!==l?(f=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let x;e[6]!==a?(x=c.jsx(Z3,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=me("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx($o,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S,N;e[12]!==y?(v=me(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(S=c.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==x||e[23]!==b?(N=c.jsxs(Gn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[x,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=x,e[23]=b,e[24]=N):N=e[24];const C=a&&s;let j;return e[25]!==N||e[26]!==C?(j=c.jsxs(c.Fragment,{children:[N,C]}),e[25]=N,e[26]=C,e[27]=j):j=e[27],j},XA=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:a,hasSearch:i,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ac,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,u;if(e[1]!==a||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=x=>!l||x.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==a||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==i||e[16]!==l?(m=x=>c.jsx(JA,{databaseName:a,schema:x,hasSearch:i,children:c.jsx(Pw,{tables:x.tables,searchValue:l,sqlTableContext:{engine:s,database:a,schema:x.name,defaultSchema:o,defaultDatabase:r}})},x.name),e[11]=a,e[12]=r,e[13]=o,e[14]=s,e[15]=i,e[16]=l,e[17]=m):m=e[17],d=f.map(m),e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},JA=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[a,i]=G.useState(!1),[l,d]=G.useState(!1),u=`${n}:${o.name}`;let h,f,m,x;if(e[0]!==s?(h=()=>{i(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),G.useEffect(h,f),J3(o.name))return r;e[3]!==a||e[4]!==l?(m=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=m):m=e[5],e[6]!==a?(x=c.jsx(Z3,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a&&"text-foreground";let p,b;e[8]!==g?(p=me("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(GP,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S;e[12]!==y?(v=me(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=c.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==x||e[20]!==b||e[21]!==u?(S=c.jsxs(Gn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[x,b,w]}),e[17]=w,e[18]=m,e[19]=x,e[20]=b,e[21]=u,e[22]=S):S=e[22];const N=a&&r;let C;return e[23]!==S||e[24]!==N?(C=c.jsxs(c.Fragment,{children:[S,N]}),e[23]=S,e[24]=N,e[25]=C):C=e[25],C},Pw=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=G3(),[a,i]=G.useState(!1),[l,d]=G.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==a?(u=async()=>{if(n.length===0&&o&&!a){i(!0),d(!0);const{engine:p,database:b,schema:y}=o,v=await xL.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw d(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),d(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=a,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==a?(h=[n.length,o,a],e[5]=o,e[6]=n.length,e[7]=a,e[8]=h):h=e[8];const{isPending:f,error:m}=jn(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Y3,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(K3,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Ac,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let x,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>c.jsx(ZA,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],x=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=x}else x=e[16];return e[22]!==x?(g=c.jsx(c.Fragment,{children:x}),e[22]=x,e[23]=g):g=e[23],g},ZA=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=G3(),[a,i]=G.useState(!1),[l,d]=G.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==a||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(a&&!u&&o&&!l){d(!0);const{engine:J,database:ee,schema:q}=o,Y=await bL.request({engine:J,database:ee,schema:q,tableName:n.name});if(!(Y!=null&&Y.table))throw new Error("No table details available");s({table:Y.table,sqlTableContext:o})}},e[0]=s,e[1]=a,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==a||e[8]!==u?(f=[a,u],e[7]=a,e[8]=u,e[9]=f):f=e[9];const{isFetching:m,isPending:x,error:g}=jn(h,f),p=Ie($l),b=cs(),{createNewCell:y}=it(),v=X3();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{qn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const J=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${J}")`}if(o)return Q3({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return Q3({table:n,columnName:"*",sqlTableContext:o});default:return ec(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const S=w;let N;e[17]!==n.num_columns||e[18]!==n.num_rows?(N=()=>{const J=[];return n.num_rows!=null&&J.push(`${n.num_rows} rows`),n.num_columns!=null&&J.push(`${n.num_columns} columns`),J.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:J.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=N):N=e[19];const C=N;let j;e[20]!==g||e[21]!==m||e[22]!==x||e[23]!==o||e[24]!==n?(j=()=>{if(x||m)return c.jsx(Y3,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(K3,{error:g,className:"pl-12"});const J=n.columns;return J.length===0?c.jsx(Ac,{content:"No columns found",className:"pl-12"}):J.map(ee=>c.jsx(QA,{table:n,column:ee,sqlTableContext:o},ee.name))},e[20]=g,e[21]=m,e[22]=x,e[23]=o,e[24]=n,e[25]=j):j=e[25];const _=j;let A;e[26]!==a||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(A=()=>{if(n.source_type==="local")return;const J=n.type==="table"?UP:zf;return c.jsx(J,{className:"h-3 w-3",strokeWidth:a||r?2.5:void 0})},e[26]=a,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=A):A=e[30];const T=A,P=o?`${o.database}.${o.schema}.${n.name}`:n.name,L=o&&(J3(o.schema)?"pl-9":"pl-12"),M=(a||r)&&"font-semibold";let R,z,D,I,k,B,E,U,V,$,K,X;return e[31]!==L||e[32]!==M?(R=me("rounded-none group h-8 cursor-pointer",L,M),e[31]=L,e[32]=M,e[33]=R):R=e[33],e[34]!==a?(z=()=>i(!a),e[34]=a,e[35]=z):z=e[35],e[36]!==T?(D=T(),e[36]=T,e[37]=D):D=e[37],e[38]!==n.name?(I=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=I):I=e[39],e[40]!==D||e[41]!==I?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[D,I]}),e[40]=D,e[41]=I,e[42]=k):k=e[42],e[43]!==C?(B=C(),e[43]=C,e[44]=B):B=e[44],e[45]!==S?(E=Dn.stopPropagation(()=>S()),e[45]=S,e[46]=E):E=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx($P,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==E?(V=c.jsx(Ce,{content:"Add table to notebook",delayDuration:400,children:c.jsx(ke,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:E,children:U})}),e[48]=E,e[49]=V):V=e[49],e[50]!==a||e[51]!==z||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==R||e[56]!==P?($=c.jsxs(Gn,{className:R,value:P,"aria-selected":a,forceMount:!0,onSelect:z,children:[k,B,V]}),e[50]=a,e[51]=z,e[52]=k,e[53]=B,e[54]=V,e[55]=R,e[56]=P,e[57]=$):$=e[57],e[58]!==a||e[59]!==_?(K=a&&_(),e[58]=a,e[59]=_,e[60]=K):K=e[60],e[61]!==$||e[62]!==K?(X=c.jsxs(c.Fragment,{children:[$,K]}),e[61]=$,e[62]=K,e[63]=X):X=e[63],X},QA=t=>{var E,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,a]=G.useState(!1),i=Ie(W3),l=St(VP);let d,u;e[0]!==i?(d=()=>{i&&a(!1)},u=[i],e[0]=i,e[1]=d,e[2]=u):(d=e[1],u=e[2]),G.useEffect(d,u),l(s?V=>new Set([...V,`${n.name}:${o.name}`]):V=>(V.delete(`${n.name}:${o.name}`),new Set(V)));const h=X3(),{columnsPreviews:f}=HP();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((E=n.primary_keys)==null?void 0:E.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const x=m;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const p=g;let b;e[9]!==h?(b=V=>{h(V)},e[9]=h,e[10]=b):b=e[10];const y=b,v=eM,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=c.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const N=S,C=`${n.name}.${o.name}`,j=`${n.name}.${o.name}`;let _;e[14]!==s?(_=()=>a(!s),e[14]=s,e[15]=_):_=e[15];const A=r?"pl-14":"pl-7";let T,P,L,M,R,z,D,I,k,B;return e[16]!==A?(T=me("flex flex-row gap-2 items-center flex-1",A),e[16]=A,e[17]=T):T=e[17],e[18]!==o.type||e[19]!==N?(P=c.jsx(WP,{columnName:N,dataType:o.type}),e[18]=o.type,e[19]=N,e[20]=P):P=e[20],e[21]!==x?(L=x&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=x,e[22]=L):L=e[22],e[23]!==p?(M=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=M):M=e[24],e[25]!==T||e[26]!==P||e[27]!==L||e[28]!==M?(R=c.jsxs("div",{className:T,children:[P,L,M]}),e[25]=T,e[26]=P,e[27]=L,e[28]=M,e[29]=R):R=e[29],e[30]!==o.name?(z=c.jsx(Ce,{content:"Copy column name",delayDuration:400,children:c.jsx(ke,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(B3,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=z):z=e[31],e[32]!==o.external_type?(D=c.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=D):D=e[33],e[34]!==_||e[35]!==R||e[36]!==z||e[37]!==D||e[38]!==C||e[39]!==j?(I=c.jsxs(Gn,{className:"rounded-none py-1 group cursor-pointer",value:j,onSelect:_,children:[R,z,D]},C),e[34]=_,e[35]=R,e[36]=z,e[37]=D,e[38]=C,e[39]=j,e[40]=I):I=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:c.jsx(ic,{children:c.jsx(qP,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==I||e[49]!==k?(B=c.jsxs(c.Fragment,{children:[I,k]}),e[48]=I,e[49]=k,e[50]=B):B=e[50],B};function eM(t){const{tooltipContent:e,content:n}=t;return c.jsx(Ce,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const tM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(GA,{}),t[0]=e):e=t[0],e},nM=()=>{const t=H.c(5),{documentation:e}=Ie(YP);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(Kc,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Nm({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},oM=()=>{const t=H.c(5),e=KP();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No errors!",icon:c.jsx(pp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(rM),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function rM(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(XP,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(JP,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const Ef=new Map,sM=({file:t,onOpenNotebook:e})=>{const{theme:n}=Xo(),o=Ie(Gl),[r,s]=O.useState(""),{data:a,isPending:i,error:l,setData:d}=jn(async()=>{const g=await Em({path:t.path}),p=g.contents||"";return s(Ef.get(t.path)||p),g},[t.path]),u=async()=>{r!==(a==null?void 0:a.contents)&&await sR({path:t.path,contents:r}).then(g=>{g.success&&(d(p=>({...p,contents:r})),s(r))})},h=O.useRef(r);if(h.current=r,O.useEffect(()=>()=>{if(!(a!=null&&a.contents))return;const g=h.current;g===a.contents?Ef.delete(t.path):Ef.set(t.path,g)},[t.path,a==null?void 0:a.contents]),l)return c.jsx(yr,{error:l});if(i||!a)return null;const f=a.mimeType||"text/plain",m=f in _f;if(!a.contents&&!m)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:a.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:f})]});const x=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Zt()&&c.jsx(Ce,{content:"Open notebook",children:c.jsx(sn,{size:"small",onClick:g=>e(g),children:c.jsx(rc,{})})}),c.jsx(Ce,{content:"Download",children:c.jsx(sn,{size:"small",onClick:()=>{if(Rw(f)){const g=oR(a.contents,f);return void rR(g,a.file.name)}Da(new Blob([a.contents||r],{type:f}),a.file.name)},children:c.jsx(Zf,{})})}),!Rw(f)&&c.jsxs(c.Fragment,{children:[c.jsx(Ce,{content:"Copy contents to clipboard",children:c.jsx(sn,{size:"small",onClick:async()=>{await on(r)},children:c.jsx(ja,{})})}),c.jsx(Ce,{content:Wt("global.save"),children:c.jsx(sn,{size:"small",color:r===a.contents?void 0:"green",onClick:u,disabled:r===a.contents,children:c.jsx(ri,{})})})]})]});return f.startsWith("image/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(ZP,{base64:a.contents,mime:f})})]}):f==="text/csv"&&a.contents?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(QP,{contents:a.contents})})]}):f.startsWith("audio/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(eR,{base64:a.contents,mime:f})})]}):f.startsWith("video/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(tR,{base64:a.contents,mime:f})})]}):f.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(nR,{base64:a.contents,mime:f})})]}):c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(O.Suspense,{children:c.jsx(Ka,{theme:n==="dark"?"dark":"light",language:_f[f]||_f.default,className:"border-b",extensions:[Ge.lineWrapping,_n.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==a.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},Rw=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),_f={"application/javascript":"javascript","text/markdown":"markdown","text/html":"html","text/css":"css","text/x-python":"python","application/json":"json","application/xml":"xml","text/x-yaml":"yaml","text/csv":"markdown","text/plain":"markdown",default:"markdown"},Lw=yt(new class{constructor(t){this.callbacks=t,this.delegate=new Om([]),this.rootPath="",this.onChange=Cn.NOOP,this.path=new nc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new Om(n.files),this.rootPath=n.root,this.path=nc.guessDeliminator(n.root)}catch(n){Xe({title:"Failed",description:m3(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const a=o[r];s===this.rootPath?this.delegate=new Om(a.files):this.delegate.update({id:s,changes:{children:a.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(Xe({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const a=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:a}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:a}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:$k,createFileOrFolder:_m,deleteFileOrFolder:iR,renameFileOrFolder:aR})),aM=yt({});function iM(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function Fw(t){const e=H.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:hM,onDropRejected:cM,onDrop:lM,...o},e[2]=o,e[3]=r):r=e[3],lR(r)}async function lM(t){for(const e of t){const n=mM(fM(e));let o="";n&&(o=nc.guessDeliminator(n).dirname(n));const r=(await iM(e)).split(",")[1];await _m({path:o,type:"file",name:e.name,contents:r})}await async function(){await et.get(Lw).refreshAll([])}()}function cM(t){Xe({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(dM)}),variant:"danger"})}function dM(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(uM).join(", "),")"]},t.file.name)}function uM(t){return t.message}function hM(t){ft.error(t),Xe({title:"File upload failed",description:t.message,variant:"danger"})}function fM(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function mM(t){if(t)return t.replace(/^\/+/,"")}const zw=G.createContext(null),pM=t=>{const e=H.c(60),{height:n}=t,o=O.useRef(null),[r]=Ot(Lw);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[a,i]=O.useState(s),[l,d]=O.useState(null),{openPrompt:u}=Nn(),[h,f]=Ot(aM);let m,x;e[1]!==r?(m=()=>r.initialize(i),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[3]=x):x=e[3];const{isPending:g,error:p}=jn(m,x);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=ze(b);let v;e[7]!==u||e[8]!==r?(v=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=v):v=e[9];const w=ze(v);let S;e[10]!==u||e[11]!==r?(S=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=S):S=e[12];const N=ze(S);let C;e[13]!==f?(C=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=C):C=e[14];const j=ze(C);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(xn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(yr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,E,U,V,$;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(ke,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(wt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(E=c.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[B,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=E):E=e[21],e[22]!==l.path||e[23]!==r?(U=K=>Bw(K,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?(V=c.jsx(O.Suspense,{children:c.jsx(sM,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==E||e[29]!==V?($=c.jsxs(c.Fragment,{children:[E,V]}),e[28]=E,e[29]=V,e[30]=$):$=e[30],$}let _;e[31]!==j||e[32]!==N||e[33]!==w||e[34]!==y||e[35]!==r?(_=c.jsx(xM,{onRefresh:y,onCreateFile:N,onCreateFolder:w,onCollapseAll:j,tree:r}),e[31]=j,e[32]=N,e[33]=w,e[34]=y,e[35]=r,e[36]=_):_=e[36];const A=n-33;let T,P,L,M,R,z,D,I;return e[37]!==r?(T=async k=>{const{ids:B}=k;for(const E of B)await r.delete(E)},P=async k=>{const{id:B,name:E}=k;await r.rename(B,E)},L=async k=>{const{dragIds:B,parentId:E}=k;await r.move(B,E)},e[37]=r,e[38]=T,e[39]=P,e[40]=L):(T=e[38],P=e[39],L=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(M=k=>{const B=k[0];B&&(B.data.isDirectory||d(B.data))},e[41]=M):M=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(R=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=R):R=e[45],e[46]!==a||e[47]!==h||e[48]!==T||e[49]!==P||e[50]!==L||e[51]!==R||e[52]!==A?(z=c.jsx(eL,{width:"100%",ref:o,height:A,className:"h-full",data:a,initialOpenState:h,openByDefault:!1,renderCursor:kM,disableDrop:SM,onDelete:T,onRename:P,onMove:L,onSelect:M,onToggle:R,padding:15,rowHeight:30,indent:gM,overscanCount:1e3,disableMultiSelection:!0,children:vM}),e[46]=a,e[47]=h,e[48]=T,e[49]=P,e[50]=L,e[51]=R,e[52]=A,e[53]=z):z=e[53],e[54]!==z||e[55]!==r?(D=c.jsx(zw,{value:r,children:z}),e[54]=z,e[55]=r,e[56]=D):D=e[56],e[57]!==D||e[58]!==_?(I=c.jsxs(c.Fragment,{children:[_,D]}),e[57]=D,e[58]=_,e[59]=I):I=e[59],I},gM=15,xM=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={noDrag:!0,noDragEventsBubbling:!0},e[0]=a):a=e[0];const{getRootProps:i,getInputProps:l}=Fw(a);let d,u,h,f,m,x,g,p,b,y,v,w,S,N,C;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ni,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(Ce,{content:"Add file",children:c.jsx(ke,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Uc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(Ce,{content:"Add folder",children:c.jsx(ke,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==i?(m=i({}),e[7]=i,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(x=cR({variant:"text",size:"xs"}),g=c.jsx(uR,{size:16}),e[9]=x,e[10]=g):(x=e[9],g=e[10]),e[11]!==m?(p=c.jsx(Ce,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:x,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(S3,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=c.jsx(Ce,{content:"Refresh",children:c.jsx(ke,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(Gm,{size:16}),e[20]=S):S=e[20],e[21]!==s?(N=c.jsx(Ce,{content:"Collapse all folders",children:c.jsx(ke,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=N):N=e[22],e[23]!==y||e[24]!==w||e[25]!==N||e[26]!==u||e[27]!==f||e[28]!==p?(C=c.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,y,w,N]}),e[23]=y,e[24]=w,e[25]=N,e[26]=u,e[27]=f,e[28]=p,e[29]=C):C=e[29],C},bM=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,a;return e[0]!==n?(r=i=>{n.data.isDirectory||(i.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Zt()&&c.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(rc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(a=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=a):a=e[8],a},yM=t=>{const e=H.c(10),{node:n}=t,o=O.useRef(null);let r,s,a,i,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),e[3]!==n?(a=()=>n.reset(),i=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.currentTarget.value)},e[3]=n,e[4]=a,e[5]=i):(a=e[4],i=e[5]),e[6]!==n.data.name||e[7]!==a||e[8]!==i?(l=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:NM,onBlur:a,onKeyDown:i}),e[6]=n.data.name,e[7]=a,e[8]=i,e[9]=l):l=e[9],l},vM=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":Bk(t.data.name),r=Uk[o],{openConfirm:s,openPrompt:a}=Nn(),{createNewCell:i}=it(),l=cs(),d=O.use(zw),u=async g=>{Bw(g,d?d.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(Pk,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=ze(async()=>{t.open(),a({title:"Folder name",onConfirm:async g=>{d==null||d.createFolder(g,t.id)}})}),m=ze(async()=>{t.open(),a({title:"File name",onConfirm:async g=>{d==null||d.createFile(g,t.id)}})}),x=ze(async()=>{var y;if(!d||t.data.isDirectory)return;const[g,p]=dR(t.data.name),b=`${g}_copy${p}`;try{const v=await Em({path:t.data.path}),w=((y=t.parent)==null?void 0:y.data.path)||"";await _m({path:w,type:"file",name:b,contents:v.contents?btoa(v.contents):void 0}),await d.refreshAll([w])}catch{Xe({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:me("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(wM,{node:t}),c.jsxs("span",{className:me("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx(yM,{node:t}):c.jsx(bM,{node:t,onOpenMarimoFile:u}),c.jsxs(Ho,{modal:!1,children:[c.jsx(Wo,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:c.jsx(ke,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx(Bc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(qo,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(Dt,{onSelect:()=>t.select(),children:[c.jsx(Tp,{...g}),"Open file"]}),!t.data.isDirectory&&!Zt()&&c.jsxs(Dt,{onSelect:()=>{hR({path:t.data.path})},children:[c.jsx(rc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Dt,{onSelect:()=>m(),children:[c.jsx(ni,{...g}),"Create file"]}),c.jsxs(Dt,{onSelect:()=>f(),children:[c.jsx(Uc,{...g}),"Create folder"]}),c.jsx(rn,{})]}),c.jsxs(Dt,{onSelect:()=>t.edit(),children:[c.jsx(gp,{...g}),"Rename"]}),!t.data.isDirectory&&c.jsxs(Dt,{onSelect:x,children:[c.jsx(ja,{...g}),"Duplicate"]}),c.jsxs(Dt,{onSelect:async()=>{await on(t.data.path),Xe({title:"Copied to clipboard"})},children:[c.jsx(Hc,{...g}),"Copy path"]}),d&&c.jsxs(Dt,{onSelect:async()=>{await on(d.relativeFromRoot(t.data.path)),Xe({title:"Copied to clipboard"})},children:[c.jsx(Hc,{...g}),"Copy relative path"]}),c.jsx(rn,{}),c.jsxs(Dt,{onSelect:()=>{const{path:p}=t.data;(b=>{i({code:b,before:!1,cellId:l??"__end__"})})(eS[o](p))},children:[c.jsx(Sr,{...g}),"Insert snippet for reading file"]}),c.jsxs(Dt,{onSelect:async()=>{Xe({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=eS[o](p);await on(b)},children:[c.jsx(fR,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsxs(Dt,{onSelect:u,children:[c.jsx(Cp,{...g}),"Open notebook"]})]}),c.jsx(rn,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Dt,{onSelect:async()=>{const p=(await Em({path:t.data.path})).contents||"";Da(new Blob([p]),t.data.name)},children:[c.jsx(Zf,{...g}),"Download"]}),c.jsx(rn,{})]}),c.jsxs(Dt,{onSelect:h,variant:"danger",children:[c.jsx(ql,{...g}),"Delete"]})]})})()]})]})]})},wM=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(vo,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(Ta,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function Bw(t,e){t.stopPropagation(),t.preventDefault(),dS(e)}function kM(){return null}function SM(t){const{parentNode:e}=t;return!e.data.isDirectory}function NM(t){return t.stopPropagation()}let Uw,$w,Vw;Uw=()=>{const t=H.c(20),{ref:e,height:n}=mR(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:a,isDragActive:i}=Fw(r);let l,d,u,h,f,m,x,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=me("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==a?(u=a(),t[4]=a,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==i?(f=i&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=i,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(pM,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(x=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=x):x=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==x?(g=c.jsxs("div",{...l,className:d,children:[h,f,x]}),t[15]=l,t[16]=h,t[17]=f,t[18]=x,t[19]=g):g=t[19],g},Um=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=me("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},$w=()=>{const t=H.c(9),e=pR(),{clearLogs:n}=it();if(e.length===0){let a,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=a):a=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No logs",description:c.jsxs("span",{children:[a," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx(Ff,{})}),t[1]=i):i=t[1],i}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(Um,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(Vw,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},Vw=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,a,i,l;return e[0]!==o?(r=me("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(a=n.map(EM),e[3]=n,e[4]=a):a=e[4],e[5]!==a?(i=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:a})}),e[5]=a,e[6]=i):i=e[6],e[7]!==r||e[8]!==i?(l=c.jsx("div",{className:r,children:i}),e[7]=r,e[8]=i,e[9]=l):l=e[9],l};function CM(t){const e=gR(t.timestamp),n=jM[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),c.jsx("span",{className:me("flex-shrink-0",n),children:o}),c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",c.jsx(Co,{cellId:t.cellId}),")"]}),t.message]})}const jM={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function EM(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:me("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:me("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:CM(t)})]},e)}const _M=()=>{const t=H.c(7),{items:e}=Ie(xR);let n,o;t[0]!==e?(o=yL(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:a}=vL(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(an,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(Yc,{})}),t[2]=l):l=t[2],l}let i;return t[3]!==s||t[4]!==a||t[5]!==e?(i=c.jsx(wL,{items:e,activeHeaderId:s,activeOccurrences:a}),t[3]=s,t[4]=a,t[5]=e,t[6]=i):i=t[6],i},Hw=yt(null),Ww=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(xn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let a,i,l;return e[1]!==s?(a=me("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=a):a=e[2],e[3]!==n?(i=Dn.stopPropagation(n),e[3]=n,e[4]=i):i=e[4],e[5]!==r||e[6]!==a||e[7]!==i?(l=c.jsx("button",{type:"button",className:a,onClick:i,children:r}),e[5]=r,e[6]=a,e[7]=i,e[8]=l):l=e[8],l},IM=()=>{var w,S;const t=H.c(27),[e]=mr(),n=e.package_management.manager,[o,r]=G.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:a,error:i,refetch:l,isPending:d}=jn(OM,s);if(d){let N;return t[2]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(xn,{size:"medium",centered:!0}),t[2]=N):N=t[2],N}if(i){let N;return t[3]!==i?(N=c.jsx(yr,{error:i}),t[3]=i,t[4]=N):N=t[4],N}const u=a.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(N,C){return N==="list"?"list":C?N||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(w=a.tree)==null?void 0:w.name,x=(S=a==null?void 0:a.tree)==null?void 0:S.version,g=m==="<root>";let p,b,y,v;return t[8]!==n||t[9]!==l?(p=c.jsx(TM,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==x||t[15]!==f?(b=u&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:me("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),c.jsx("button",{type:"button",className:me("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,x&&` v${x}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,t[14]=x,t[15]=f,t[16]=b):b=t[16],t[17]!==a.list||t[18]!==a.tree||t[19]!==i||t[20]!==l||t[21]!==f?(y=f==="list"?c.jsx(AM,{packages:a.list,onSuccess:l}):c.jsx(MM,{tree:a.tree,error:i,onSuccess:l}),t[17]=a.list,t[18]=a.tree,t[19]=i,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(v=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=v):v=t[26],v},TM=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=G.useState(""),{handleClick:a}=Ja(),i=Ie(Hw),l=St(Hw);let d,u;e[0]!==i||e[1]!==l?(d=()=>{i&&(s(i),l(null))},u=[i,l],e[0]=i,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),G.useEffect(d,u);const{loading:h,handleInstallPackages:f}=vR();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const x=m;let g;e[6]!==f||e[7]!==r||e[8]!==x?(g=()=>{f(r.split(",").map(DM),x)},e[6]=f,e[7]=r,e[8]=x,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let y,v,w,S,N,C,j,_,A,T,P,L,M,R;e[10]!==h||e[11]!==a?(y=h?c.jsx(xn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(Ce,{content:"Change package manager",children:c.jsx(Ss,{onClick:()=>a("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=a,e[12]=y):y=e[12],e[13]!==p?(v=E=>{E.key==="Enter"&&(E.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=E=>s(E.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=c.jsx(tS,{placeholder:b,id:u1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=S):S=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=N):N=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsxs("div",{children:[N," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),j=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=C,e[23]=j):(C=e[22],j=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsxs("div",{children:[j," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),A=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=_,e[25]=A):(_=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsxs("div",{children:[A," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),P=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=T,e[27]=P):(T=e[26],P=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsxs("div",{children:[P," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),M=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=L,e[29]=M):(L=e[28],M=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(Ce,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[C,_,T,L,c.jsxs("div",{children:[M," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(wm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=R):R=e[30];const z=r&&"bg-accent text-accent-foreground";let D;e[31]!==z?(D=me("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",z,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=z,e[32]=D):D=e[32];const I=!r;let k,B;return e[33]!==p||e[34]!==D||e[35]!==I?(k=c.jsx("button",{type:"button",className:D,onClick:p,disabled:I,children:"Add"}),e[33]=p,e[34]=D,e[35]=I,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=c.jsxs("div",{className:"flex items-center w-full border-b",children:[S,R,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},AM=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(Ss,{})}),e[0]=i):i=e[0],i}let r,s,a;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Im,{children:c.jsxs(ks,{children:[c.jsx(vr,{children:"Name"}),c.jsx(vr,{children:"Version"}),c.jsx(vr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let i;e[5]!==n?(i=l=>c.jsxs(ks,{className:"group",onClick:async()=>{await on(`${l.name}==${l.version}`),Xe({title:"Copied to clipboard"})},children:[c.jsx(wr,{children:l.name}),c.jsx(wr,{children:l.version}),c.jsxs(wr,{className:"flex justify-end",children:[c.jsx(qw,{packageName:l.name,onSuccess:n}),c.jsx(Gw,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=i):i=e[6],s=o.map(i),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(a=c.jsxs(Tm,{className:"overflow-auto flex-1",children:[r,c.jsx(Am,{children:s})]}),e[7]=s,e[8]=a):a=e[8],a},qw=({packageName:t,onSuccess:e})=>{const[n,o]=G.useState(!1);return Zt()?null:c.jsx(Ww,{onClick:async()=>{try{o(!0);const r=await wR({package:t,upgrade:!0});r.success?(e(),nS(t)):nS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},Gw=({packageName:t,onSuccess:e})=>{const[n,o]=G.useState(!1);return c.jsx(Ww,{onClick:async()=>{try{o(!0);const r=await kR({package:t});r.success?(e(),oS(t)):oS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},MM=t=>{const e=H.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[a,i]=G.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{i(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],G.useEffect(l,d),o){let x;return e[4]!==o?(x=c.jsx(yr,{error:o}),e[4]=o,e[5]=x):x=e[5],x}if(!n){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(xn,{size:"medium",centered:!0}),e[6]=x):x=e[6],x}if(n.dependencies.length===0){let x;return e[7]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(an,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(Ss,{})}),e[7]=x):x=e[7],x}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=x=>{i(g=>{const p=new Set(g);return p.has(x)?p.delete(x):p.add(x),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==a||e[10]!==r||e[11]!==n.dependencies){let x;e[13]!==a||e[14]!==r?(x=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(Yw,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:a,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=a,e[14]=r,e[15]=x):x=e[15],f=n.dependencies.map(x),e[9]=a,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},Yw=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:a,onToggle:i,onSuccess:l}=t,d=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==a||e[1]!==n?(h=a.has(n),e[0]=a,e[1]=n,e[2]=h):h=e[2];const f=h,m=d?0:16+16*r;let x;e[3]!==u||e[4]!==n||e[5]!==i?(x=D=>{D.key!=="Enter"&&D.key!==" "||(D.preventDefault(),u&&i(n))},e[3]=u,e[4]=n,e[5]=i,e[6]=x):x=e[6];const g=x;let p;e[7]!==u||e[8]!==n||e[9]!==i?(p=D=>{D.stopPropagation(),u&&i(n)},e[7]=u,e[8]=n,e[9]=i,e[10]=p):p=e[10];const b=p,y=u&&"select-none",v=d?"px-2 py-0.5":"";let w,S;e[11]!==y||e[12]!==v?(w=me("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==d?(S=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=S):S=e[16];const N=u?f:void 0;let C,j,_,A,T,P,L,M,R,z;return e[17]!==u||e[18]!==f?(C=u?f?c.jsx(vo,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx(Ta,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=C):C=e[19],e[20]!==o.name?(j=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=j):j=e[21],e[22]!==o.version?(_=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=_):_=e[23],e[24]!==j||e[25]!==_?(A=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[j,_]}),e[24]=j,e[25]=_,e[26]=A):A=e[26],e[27]!==o.tags?(T=o.tags.map(PM),e[27]=o.tags,e[28]=T):T=e[28],e[29]!==T?(P=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:T}),e[29]=T,e[30]=P):P=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(L=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(qw,{packageName:o.name,onSuccess:l}),c.jsx(Gw,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=L):L=e[34],e[35]!==b||e[36]!==g||e[37]!==C||e[38]!==A||e[39]!==P||e[40]!==L||e[41]!==w||e[42]!==S||e[43]!==N?(M=c.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":N,children:[C,A,P,L]}),e[35]=b,e[36]=g,e[37]=C,e[38]=A,e[39]=P,e[40]=L,e[41]=w,e[42]=S,e[43]=N,e[44]=M):M=e[44],e[45]!==a||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==i?(R=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((D,I)=>c.jsx(Yw,{nodeId:`${n}-${I}`,node:D,level:r+1,isTopLevel:!1,expandedNodes:a,onToggle:i,onSuccess:l},`${D.name}-${I}`))}),e[45]=a,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=i,e[53]=R):R=e[53],e[54]!==M||e[55]!==R?(z=c.jsxs("div",{children:[M,R]}),e[54]=M,e[55]=R,e[56]=z):z=e[56],z};async function OM(){const[t,e]=await Promise.all([bR(),yR()]);return{list:t.packages,tree:e.tree}}function DM(t){return t.trim()}function PM(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const If=pk("marimo:scratchpadHistory:v1",[]),RM=yt(!1),LM=yt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(If),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(If,r)}),FM={hide_code:!1,disabled:!1},zM=()=>{const t=H.c(69),e=ms(),[n]=mr(),{theme:o}=Xo(),r=O.useRef(null),s=cs(),{createNewCell:a,updateCellCode:i}=it(),l=e.cellRuntime[Jo],d=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[Jo],m=(f==null?void 0:f.code)??"",x=St(LM),[g,p]=Ot(RM),b=Ie(If);let y;t[0]!==x||t[1]!==m?(y=()=>{rS({code:m}),x(m)},t[0]=x,t[1]=m,t[2]=y):y=t[2];const v=ze(y);let w;t[3]!==m||t[4]!==a||t[5]!==s?(w=()=>{m.trim()&&a({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=a,t[5]=s,t[6]=w):w=t[6];const S=ze(w);let N;t[7]!==i?(N=()=>{i({cellId:Jo,code:"",formattingChange:!1}),rS({code:""});const ie=r.current;ie&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:""}})},t[7]=i,t[8]=N):N=t[8];const C=ze(N);let j;t[9]!==p||t[10]!==i?(j=ie=>{p(!1),i({cellId:Jo,code:ie,formattingChange:!1});const ve=r.current;ve&&ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ie}})},t[9]=p,t[10]=i,t[11]=j):j=t[11];const _=ze(j),[A,T]=O.useState();let P;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==A||t[16]!==d||t[17]!==o||t[18]!==n?(P=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:c.jsx(wu,{theme:o,showPlaceholder:!1,id:Jo,code:m,config:FM,status:"idle",serializedEditorState:null,runCell:v,userConfig:n,editorViewRef:r,setEditorView:ie=>{r.current=ie},hidden:!1,showHiddenCode:Cn.NOOP,languageAdapter:A,setLanguageAdapter:T})}),c.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:c.jsx(Ec,{allowExpand:!1,output:d,className:"output-area",cellId:Jo,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:c.jsx(Lm,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:gk,onSubmitDebugger:Cn.NOOP,cellId:Jo,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=v,t[15]=A,t[16]=d,t[17]=o,t[18]=n,t[19]=P):P=t[19];const L=P;let M;t[20]!==_||t[21]!==b||t[22]!==g||t[23]!==o?(M=()=>g?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ie,ve)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>_(ie),children:c.jsx(O.Suspense,{children:c.jsx(Ka,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ie.trim(),editable:!1,readOnly:!0})})},ve))})}):null,t[20]=_,t[21]=b,t[22]=g,t[23]=o,t[24]=M):M=t[24];const R=M;let z,D,I,k,B,E,U,V,$,K,X;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=Rf.create(Jo),D=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=z,t[26]=D):(z=t[25],D=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(I=Wt("cell.run"),t[27]=I):I=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(kr,{color:"var(--grass-11)",size:16}),t[28]=k):k=t[28],t[29]!==v||t[30]!==g?(B=c.jsx(Ce,{content:I,children:c.jsx(ke,{"data-testid":"scratchpad-run-button",onClick:v,disabled:g,variant:"text",size:"xs",children:k})}),t[29]=v,t[30]=g,t[31]=B):B=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(Km,{size:16}),t[32]=E):E=t[32],t[33]!==C||t[34]!==g?(U=c.jsx(Ce,{content:"Clear code and outputs",children:c.jsx(ke,{disabled:g,size:"xs",variant:"text",onClick:C,children:E})}),t[33]=C,t[34]=g,t[35]=U):U=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(V=c.jsx(Sr,{size:16}),t[36]=V):V=t[36],t[37]!==S||t[38]!==g?($=c.jsx(As,{children:c.jsx(Ce,{content:"Insert code",children:c.jsx(ke,{disabled:g,size:"xs",variant:"text",onClick:S,children:V})})}),t[37]=S,t[38]=g,t[39]=$):$=t[39],t[40]!==u?(K=(u==="running"||u==="queued")&&c.jsx(xn,{className:"inline",size:"small"}),t[40]=u,t[41]=K):K=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(X=c.jsx("div",{className:"flex-1"}),t[42]=X):X=t[42];const J=g&&"bg-[var(--sky-3)] rounded-none";let ee,q;t[43]!==J?(ee=me(J),t[43]=J,t[44]=ee):ee=t[44],t[45]!==g||t[46]!==p?(q=()=>p(!g),t[45]=g,t[46]=p,t[47]=q):q=t[47];const Y=b.length===0;let oe,se,re,ae,te,be,ye;return t[48]===Symbol.for("react.memo_cache_sentinel")?(oe=c.jsx(np,{size:16}),t[48]=oe):oe=t[48],t[49]!==ee||t[50]!==q||t[51]!==Y?(se=c.jsx(Ce,{content:"Toggle history",children:c.jsx(ke,{size:"xs",variant:"text",className:ee,onClick:q,disabled:Y,children:oe})}),t[49]=ee,t[50]=q,t[51]=Y,t[52]=se):se=t[52],t[53]!==B||t[54]!==U||t[55]!==$||t[56]!==K||t[57]!==se?(re=c.jsxs("div",{className:"flex items-center flex-shrink-0",children:[B,U,$,K,X,se]}),t[53]=B,t[54]=U,t[55]=$,t[56]=K,t[57]=se,t[58]=re):re=t[58],t[59]!==L?(ae=L(),t[59]=L,t[60]=ae):ae=t[60],t[61]!==R?(te=R(),t[61]=R,t[62]=te):te=t[62],t[63]!==ae||t[64]!==te?(be=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ae,te]}),t[63]=ae,t[64]=te,t[65]=be):be=t[65],t[66]!==re||t[67]!==be?(ye=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:z,children:[D,re,be]}),t[66]=re,t[67]=be,t[68]=ye):ye=t[68],ye},BM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(zM,{}),t[0]=e):e=t[0],e},UM=()=>{const t=H.c(23),{openModal:e,closeModal:n}=Nn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:a,refetch:i}=jn(VM,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(xn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(a){let b;return t[2]!==a?(b=c.jsx(yr,{error:a}),t[2]=a,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(HM).map(WM),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx($c,{})}),t[6]=b):b=t[6],b}let u,h,f,m,x,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==i?(u=()=>e(c.jsx(rg,{providerNames:d,onSuccess:()=>{i(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=i,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ko,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Im,{children:c.jsxs(ks,{children:[c.jsx(vr,{children:"Environment Variable"}),c.jsx(vr,{children:"Source"}),c.jsx(vr,{})]})}),t[15]=m):m=t[15],t[16]!==r?(x=r.map(qM),t[16]=r,t[17]=x):x=t[17],t[18]!==x?(g=c.jsxs(Tm,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(Am,{children:x})]}),t[18]=x,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},$M=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,a]=G.useState(!1);let i;e[0]!==r?(i=()=>{r(),a(!0),setTimeout(()=>a(!1),1e3)},e[0]=r,e[1]=i):i=e[1];const l=i;let d,u;return e[2]!==s?(d=s?c.jsx(oc,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(ja,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function VM(){return og((await xS.request({})).secrets)}function HM(t){return t.provider!=="env"}function WM(t){return t.name}function qM(t){return t.keys.map(e=>c.jsxs(ks,{className:"group",children:[c.jsx(wr,{children:e}),c.jsx(wr,{children:t.provider!=="env"&&c.jsx($3,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(wr,{children:c.jsx($M,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await on(`os.environ["${e}"]`),Xe({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:me("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const GM=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Nn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(KM,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(D3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},YM=[Ge.lineWrapping],KM=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=O.useState(""),{theme:s}=Xo();let a,i,l,d,u,h;e[0]!==n?(a=async v=>{v.preventDefault();const w=new FormData(v.target),S=w.get("title"),N=w.get("description"),C=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:N,code:C})}),n(),Xe({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(zo,{children:"Contribute a Snippet"}),e[2]=i):i=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(ss,{children:[i,c.jsxs(as,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:On.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Bo,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(SR,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,x,g,p,b,y;return e[8]!==o||e[9]!==f?(m=c.jsx(Ka,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:YM,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==n?(g=c.jsx(ke,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(ke,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==a||e[20]!==b||e[21]!==x?(y=c.jsx(Uo,{className:"w-fit",children:c.jsxs("form",{onSubmit:a,children:[l,x,b]})}),e[19]=a,e[20]=b,e[21]=x,e[22]=y):y=e[22],y},XM=[Ge.lineWrapping],JM=()=>{const t=H.c(20),[e,n]=G.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:a}=jn(e7,o);if(s){let b;return t[1]!==s?(b=c.jsx(yr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(a||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(xn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const i=e?"h-1/3":"h-full";let l,d,u,h,f,m,x,g,p;return t[4]!==i?(l=me("border-b rounded-none",i),t[4]=i,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Aa,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=d):d=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs("div",{className:"flex items-center w-full",children:[d,c.jsx(GM,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Ko,{className:"h-4 w-4"})})})]}),h=c.jsx(Kl,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=c.jsx(QM,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(x=c.jsxs(ac,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=x):x=t[14],t[15]!==e?(g=c.jsx(O.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?c.jsx(ZM,{snippet:e},e.title):c.jsx(an,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==x||t[18]!==g?(p=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[x,g]}),t[17]=x,t[18]=g,t[19]=p):p=t[19],p},ZM=t=>{const e=H.c(27),{snippet:n}=t,{theme:o}=Xo(),{createNewCell:r}=it(),s=cs();let a;e[0]!==r||e[1]!==s||e[2]!==n.sections?(a=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=a):a=e[3];const i=a;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const d=l;let u,h,f,m,x,g;if(e[7]!==n.title?(u=c.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Sr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==i?(f=c.jsx("div",{className:"flex justify-end",children:c.jsx(As,{children:c.jsxs(ke,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",h]})})}),e[10]=i,e[11]=f):f=e[11],e[12]!==d||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==d||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:v,id:w}=b;return v?c.jsx("div",{children:Nm({html:v})},`${n.title}-${w}`):y?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(As,{children:c.jsx(Ce,{content:"Insert snippet",children:c.jsx(ke,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(y)},children:c.jsx(Sr,{className:"h-5 w-5"})})})}),c.jsx(O.Suspense,{children:c.jsx(Ka,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:XM,value:y,readOnly:!0},`${n.title}-${w}`)})]},`${n.title}-${w}`):null},e[17]=d,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=d,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(x=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=x):x=e[23],e[24]!==u||e[25]!==x?(g=c.jsxs(c.Fragment,{children:[u,x]}),e[24]=u,e[25]=x,e[26]=g):g=e[26],g},QM=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let a;e[3]!==o?(a=i=>c.jsx(Gn,{className:"rounded-none",onSelect:()=>o(i),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.jsx("span",{className:"mt-1 text-accent-foreground",children:i.title})})},i.title),e[3]=o,e[4]=a):a=e[4],r=n.map(a),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=c.jsx(pm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function e7(){return NR()}const t7=G.lazy(()=>gm(()=>import("./tracing-DQ_WtPZ3.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),n7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(G.Suspense,{fallback:c.jsx(o7,{}),children:c.jsx(t7,{})}),t[0]=e):e=t[0],e},o7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(xn,{})}),t[0]=e):e=t[0],e},Kw="name",Xw="type-value",Tf="defs-refs",r7=[{id:Kw,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Mm,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Uh,{name:e,declaredBy:n})}},{id:Xw,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Mm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Tf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(Mm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const a=_a(s);a&&Cm(a,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(Sp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(Co,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,a)=>c.jsxs("span",{className:"flex",children:[c.jsx(Co,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),a<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(si,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(y2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],Jw=O.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=G.useState([]),[s,a]=G.useState(""),i=CR(),l=O.useMemo(()=>{const h=f=>{const m=i[f];return TR(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,i,e]),d=O.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:x}){m||(m={id:Tf,desc:!1});let g=[];switch(m.id){case Kw:g=Qa(f,p=>p.name);break;case Xw:g=Qa(f,p=>p.dataType);break;case Tf:g=Qa(f,p=>x.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=jR({data:d,columns:r7,getCoreRowModel:IR(),onGlobalFilterChange:a,getFilteredRowModel:_R(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:ER(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(tS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>a(h.target.value)}),c.jsxs(Tm,{className:me("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(Im,{children:c.jsx(ks,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx(vr,{className:"sticky top-0 bg-background border-b",children:sS(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(Am,{children:u.getRowModel().rows.map(h=>c.jsx(ks,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(wr,{className:"border-b",children:sS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});Jw.displayName="VariableTable";const s7=()=>{const t=H.c(4),e=jm(),n=Tc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(Ll,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(Jw,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o};function Af(t,e,n=new Set){if(n.has(t))return new Set;n.add(t);const o=new Set;for(const r of e(t)){o.add(r);for(const s of Af(r,e,n))o.add(s)}return o}const a7=yt(t=>{const e=t(Pn),n=t(cc);return function(o,r){var i,l,d;const s=new Map;for(const u of o)s.set(u,{variables:new Set,parents:new Set,children:new Set});for(const u of Object.values(r))if(u.dataType!=="module")for(const h of u.declaredBy){(i=s.get(h))==null||i.variables.add(u.name);for(const f of u.usedBy)h!==f&&((l=s.get(f))==null||l.parents.add(h),(d=s.get(h))==null||d.children.add(f))}const a={};for(const[u,h]of s.entries())a[u]={parents:h.parents,children:h.children,variables:[...h.variables],ancestors:Af(u,f=>{var m;return((m=s.get(f))==null?void 0:m.parents)??new Set}),descendants:Af(u,f=>{var m;return((m=s.get(f))==null?void 0:m.children)??new Set})};return a}(e.cellIds.inOrderIds,n)});function i7(t,e){return t.usedBy.includes(e.selectedCellId)||t.declaredBy.includes(e.selectedCellId)?!0:t.declaredBy.some(n=>e.selectedGraph.parents.has(n))?t.usedBy.some(n=>e.selectedGraph.parents.has(n)):!!t.declaredBy.some(n=>e.selectedGraph.children.has(n))}const l7=t=>{const e=H.c(39),{cellId:n,cellPositions:o}=t,r=ms(),s=Ie(AR).focusedCellId,a=Ie(a7),i=it(),l=b3(),d=r.cellData[n],u=r.cellRuntime[n],h=a[n],f=s?a[s]:void 0,m=s===n;let x;e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==m?(x=()=>{m?l.blurCell():(i.focusCell({cellId:n,where:"exact"}),l.focusCell({cellId:n}))},e[0]=i,e[1]=n,e[2]=l,e[3]=m,e[4]=x):x=e[4];const g=x,p=m?"text-primary-foreground":"text-[var(--gray-8)] hover:text-[var(--gray-9)]";let b;e[5]!==p?(b=me("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",p),e[5]=p,e[6]=b):b=e[6];const y=m&&"bg-primary group-hover:bg-primary";let v,w,S,N;e[7]!==y?(v=me("group-hover:bg-[var(--gray-2)] flex h-full w-full px-0.5 items-center rounded",y),e[7]=y,e[8]=v):v=e[8],e[9]!==d.code||e[10]!==n||e[11]!==h.variables||e[12]!==s||e[13]!==f?(w=h.variables.length>0?c.jsx(h7,{cellId:n,variableNames:h.variables,selectedCellId:s,selectedGraph:f}):c.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:u7(d.code)??c.jsx("span",{className:"italic",children:"empty"})}),e[9]=d.code,e[10]=n,e[11]=h.variables,e[12]=s,e[13]=f,e[14]=w):w=e[14],e[15]!==d.code||e[16]!==w?(S=c.jsx("div",{className:"truncate px-1 font-mono text-sm flex gap-1",title:d.code,children:w}),e[15]=d.code,e[16]=w,e[17]=S):S=e[17],e[18]!==v||e[19]!==S?(N=c.jsx("div",{className:v,children:S}),e[18]=v,e[19]=S,e[20]=N):N=e[20];const C=m?"z-30":"z-20",j=u.errored?"text-destructive":s===null?"text-foreground":m||f!=null&&f.parents.has(n)||f!=null&&f.children.has(n)?"text-primary":"text-[var(--gray-8)]";let _,A,T,P;return e[21]!==C||e[22]!==j?(_=me("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)_+_17px)] pointer-events-none",C,j),e[21]=C,e[22]=j,e[23]=_):_=e[23],e[24]!==n||e[25]!==o||e[26]!==h||e[27]!==m||e[28]!==f?(A=m?c.jsx(f7,{cellId:n,cellPositions:o,graph:h}):c.jsx(m7,{cellId:n,graph:h,selectedGraph:f}),e[24]=n,e[25]=o,e[26]=h,e[27]=m,e[28]=f,e[29]=A):A=e[29],e[30]!==_||e[31]!==A?(T=c.jsx("svg",{className:_,width:"1",height:"1",children:A}),e[30]=_,e[31]=A,e[32]=T):T=e[32],e[33]!==n||e[34]!==g||e[35]!==T||e[36]!==b||e[37]!==N?(P=c.jsxs("button",{"data-node-id":n,className:b,onClick:g,onMouseDown:p7,children:[N,T]}),e[33]=n,e[34]=g,e[35]=T,e[36]=b,e[37]=N,e[38]=P):P=e[38],P},c7=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=ms();let s;e[0]!==r.cellIds.inOrderIds?(s=Object.fromEntries(r.cellIds.inOrderIds.map(g7)),e[0]=r.cellIds.inOrderIds,e[1]=s):s=e[1];const a=s;let i;if(e[2]!==r.cellIds){i=[];let v=0;for(const[w,S]of r.cellIds.getColumns().entries())w>0&&i.push(v),v+=S.inOrderIds.length;e[2]=r.cellIds,e[3]=i}else i=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let d,u,h,f,m,x,g,p,b,y;if(e[4]!==l?(d=me("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=d):d=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=u):u=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(En,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[u,c.jsx(ke,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==a||e[13]!==i||e[14]!==r.cellIds.inOrderIds){let v;e[16]!==a||e[17]!==i?(v=(w,S)=>{const N=i.includes(S);return c.jsxs(O.Fragment,{children:[N&&c.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-[var(--gray-4)] pointer-events-none","aria-hidden":"true"}),c.jsx(l7,{cellId:w,cellPositions:a})]},w)},e[16]=a,e[17]=i,e[18]=v):v=e[18],x=r.cellIds.inOrderIds.map(v),e[12]=a,e[13]=i,e[14]=r.cellIds.inOrderIds,e[15]=x}else x=e[15];return e[19]!==x?(g=c.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:x}),e[19]=x,e[20]=g):g=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==g?(b=c.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[g,p]}),e[22]=g,e[23]=b):b=e[23],e[24]!==b||e[25]!==d||e[26]!==m?(y=c.jsxs("div",{className:d,children:[m,b]}),e[24]=b,e[25]=d,e[26]=m,e[27]=y):y=e[27],y},d7=()=>{const t=H.c(5),{setIsMinimapOpen:e,toggleMinimap:n}=gr(),{isMinimapOpen:o}=ds();let r,s;return t[0]!==n?(r=()=>n(),t[0]=n,t[1]=r):r=t[1],Pt("global.toggleMinimap",r),t[2]!==o||t[3]!==e?(s=c.jsx(c7,{open:o,setOpen:e}),t[2]=o,t[3]=e,t[4]=s):s=t[4],s};function u7(t){return t.split(`
148
- `)[0].trim()||void 0}const h7=t=>{const e=H.c(13),{variableNames:n,selectedGraph:o,cellId:r,selectedCellId:s}=t,a=jm(),i=r===s;let l,d;if(e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n||e[4]!==a){let u;e[6]!==i||e[7]!==s||e[8]!==o||e[9]!==a?(u=(h,f)=>{const m=a[h];return c.jsxs(O.Fragment,{children:[f>0&&", ",c.jsx("span",{className:me({"text-foreground":o===void 0,"font-bold":i,"text-primary font-medium":!i&&o&&s&&i7(m,{selectedCellId:s,selectedGraph:o})}),children:h})]},h)},e[6]=i,e[7]=s,e[8]=o,e[9]=a,e[10]=u):u=e[10],l=n.map(u),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=a,e[5]=l}else l=e[5];return e[11]!==l?(d=c.jsx(c.Fragment,{children:l}),e[11]=l,e[12]=d):d=e[12],d},f7=t=>{const e=H.c(14),{cellId:n,cellPositions:o,graph:r}=t;let s,a,i,l,d;if(e[0]!==n||e[1]!==o||e[2]!==r.children||e[3]!==r.parents){s=[];const u=o[n]??0,h=new Set;for(const f of r.parents)r.children.has(f)&&h.add(f);for(const f of h){const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${x} h 14 v ${-x} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-cycle-${f}`))}}for(const f of r.parents){if(h.has(f))continue;const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${x} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-up-${f}`))}}for(const f of r.children){if(h.has(f))continue;const m=o[f];if(m!==void 0){const x=21*(m-u);s.push(c.jsx("path",{d:`M 3 0 H 7 v ${x} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n}-down-${f}`))}}e[0]=n,e[1]=o,e[2]=r.children,e[3]=r.parents,e[4]=s}else s=e[4];return e[5]!==r?(a=Zw(r),e[5]=r,e[6]=a):a=e[6],e[7]!==a?(i=c.jsx("circle",{r:a,fill:"currentColor",className:"pointer-events-auto"}),e[7]=a,e[8]=i):i=e[8],e[9]!==s?(l=c.jsx("g",{className:"pen pointer-events-auto",children:s}),e[9]=s,e[10]=l):l=e[10],e[11]!==i||e[12]!==l?(d=c.jsxs("g",{transform:"translate(0, 0)",children:[i,l]}),e[11]=i,e[12]=l,e[13]=d):d=e[13],d};function Zw(t){return function(e){return e.ancestors.size===0&&e.descendants.size===0}(t)?1.5:3}function m7(t){const{cellId:e,graph:n,selectedGraph:o}=t,r=Zw(n),s=n.ancestors.size>0,a=n.descendants.size>0;if(!o)return Qw({circleRadius:r,leftWisker:s,rightWisker:a});const i=o.ancestors.has(e),l=o.descendants.has(e);return Qw(i||l?{circleRadius:r,leftWisker:s,rightWisker:a,shift:i&&l?void 0:i?"left":"right"}:{circleRadius:r,leftWisker:!1,rightWisker:!1})}function Qw(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return c.jsxs("g",{transform:`translate(${s}, 0)`,children:[c.jsxs("g",{children:[n&&c.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&c.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),c.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function p7(t){return t.preventDefault()}function g7(t,e){return[t,e]}const x7=G.lazy(()=>gm(()=>import("./terminal-CPxRVQ6J.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),b7=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=ds(),{setIsSidebarOpen:a,setIsTerminalOpen:i}=gr(),l=G.useRef(null),d=G.useRef(null);let u,h,f,m,x;e[0]!==o?(u=()=>{if(!l.current)return;const Me=l.current.isCollapsed();o&&Me&&l.current.expand(),o||Me||l.current.collapse(),requestAnimationFrame(v7)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),O.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const Me=d.current.isCollapsed();r&&Me&&d.current.expand(),r||Me||d.current.collapse(),requestAnimationFrame(k7)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),O.useEffect(f,m),e[6]!==n?(x=c.jsx(Mc,{id:"app",className:"relative h-full",children:c.jsx(O.Suspense,{children:n})},"app"),e[6]=n,e[7]=x):x=e[7];const g=x,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=me("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=c.jsx(aS,{onDragging:iS,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,N;e[12]!==w?(S=me("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(N=c.jsx(aS,{onDragging:iS,className:S}),e[14]=S,e[15]=N):N=e[15];const C=N;let j,_,A,T,P,L,M,R,z,D,I,k,B,E,U,V,$,K,X,J,ee;e[16]!==s?(j=c.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]!==a?(_=()=>a(!1),e[18]=a,e[19]=_):_=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx(En,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==_?(T=c.jsx(ke,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:_,children:A}),e[21]=_,e[22]=T):T=e[22],e[23]!==j||e[24]!==T?(P=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,T]}),e[23]=j,e[24]=T,e[25]=P):P=e[25],e[26]!==s?(L=s==="files"&&c.jsx(Uw,{}),e[26]=s,e[27]=L):L=e[27],e[28]!==s?(M=s==="errors"&&c.jsx(oM,{}),e[28]=s,e[29]=M):M=e[29],e[30]!==s?(R=s==="variables"&&c.jsx(s7,{}),e[30]=s,e[31]=R):R=e[31],e[32]!==s?(z=s==="dependencies"&&c.jsx($A,{}),e[32]=s,e[33]=z):z=e[33],e[34]!==s?(D=s==="packages"&&c.jsx(IM,{}),e[34]=s,e[35]=D):D=e[35],e[36]!==s?(I=s==="outline"&&c.jsx(_M,{}),e[36]=s,e[37]=I):I=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(tM,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&c.jsx(nM,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(E=s==="snippets"&&c.jsx(JM,{}),e[42]=s,e[43]=E):E=e[43],e[44]!==s?(U=s==="scratchpad"&&c.jsx(BM,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&c.jsx(u8,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?($=s==="logs"&&c.jsx($w,{}),e[48]=s,e[49]=$):$=e[49],e[50]!==s?(K=s==="tracing"&&c.jsx(n7,{}),e[50]=s,e[51]=K):K=e[51],e[52]!==s?(X=s==="secrets"&&c.jsx(UM,{}),e[52]=s,e[53]=X):X=e[53],e[54]!==L||e[55]!==M||e[56]!==R||e[57]!==z||e[58]!==D||e[59]!==I||e[60]!==k||e[61]!==B||e[62]!==E||e[63]!==U||e[64]!==V||e[65]!==$||e[66]!==K||e[67]!==X?(J=c.jsx(O.Suspense,{children:c.jsxs(_c,{children:[L,M,R,z,D,I,k,B,E,U,V,$,K,X]})}),e[54]=L,e[55]=M,e[56]=R,e[57]=z,e[58]=D,e[59]=I,e[60]=k,e[61]=B,e[62]=E,e[63]=U,e[64]=V,e[65]=$,e[66]=K,e[67]=X,e[68]=J):J=e[68],e[69]!==P||e[70]!==J?(ee=c.jsx(ic,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[P,J]})}),e[69]=P,e[70]=J,e[71]=ee):ee=e[71];const q=ee,Y=o&&"border-r border-l border-[var(--slate-7)]";let oe,se,re,ae,te,be;e[72]!==Y?(oe=me("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Y),e[72]=Y,e[73]=oe):oe=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(se=(Me,Re)=>{var He;Re===0&&Me===10&&((He=l.current)==null||He.resize(30))},e[74]=se):se=e[74],e[75]!==a?(re=()=>a(!1),ae=()=>a(!0),e[75]=a,e[76]=re,e[77]=ae):(re=e[76],ae=e[77]),e[78]!==q||e[79]!==v?(te=c.jsxs("span",{className:"flex flex-row h-full",children:[q," ",v]}),e[78]=q,e[79]=v,e[80]=te):te=e[80],e[81]!==oe||e[82]!==re||e[83]!==ae||e[84]!==te?(be=c.jsx(Mc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:se,onCollapse:re,onExpand:ae,children:te},"helper"),e[81]=oe,e[82]=re,e[83]=ae,e[84]=te,e[85]=be):be=e[85];const ye=be,ie=r&&"border-[var(--slate-7)]";let ve,he,Se,De,_e,Fe,Oe,Qe,qe;e[86]!==ie?(ve=me("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ie),e[86]=ie,e[87]=ve):ve=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(he=(Me,Re)=>{var He;Re===0&&Me===10&&((He=d.current)==null||He.resize(30))},e[88]=he):he=e[88],e[89]!==i?(Se=()=>i(!1),De=()=>i(!0),e[89]=i,e[90]=Se,e[91]=De):(Se=e[90],De=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=c.jsx("div",{}),e[92]=_e):_e=e[92],e[93]!==i?(Fe=()=>i(!1),e[93]=i,e[94]=Fe):Fe=e[94],e[95]!==r||e[96]!==Fe?(Oe=c.jsx(O.Suspense,{fallback:_e,children:c.jsx(x7,{visible:r,onClose:Fe})}),e[95]=r,e[96]=Fe,e[97]=Oe):Oe=e[97],e[98]!==r||e[99]!==Oe?(Qe=c.jsx(VA,{isOpen:r,children:Oe}),e[98]=r,e[99]=Oe,e[100]=Qe):Qe=e[100],e[101]!==ve||e[102]!==Se||e[103]!==De||e[104]!==Qe||e[105]!==C?(qe=c.jsxs(Mc,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:ve,minSize:10,defaultSize:0,maxSize:75,onResize:he,onCollapse:Se,onExpand:De,children:[C,Qe]},"terminal"),e[101]=ve,e[102]=Se,e[103]=De,e[104]=Qe,e[105]=C,e[106]=qe):qe=e[106];const Ke=qe;let Q,xe,we,Te,W,ne,ue,de,ge;return e[107]===Symbol.for("react.memo_cache_sentinel")?(Q=kL(),e[107]=Q):Q=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(xe=c.jsx(_c,{children:c.jsx(G_,{})}),e[108]=xe):xe=e[108],e[109]!==Ke?(we=c.jsx(ub,{capability:"terminal",children:Ke}),e[109]=Ke,e[110]=we):we=e[110],e[111]!==g||e[112]!==we?(Te=c.jsx(Mc,{children:c.jsxs(lS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,we]})}),e[111]=g,e[112]=we,e[113]=Te):Te=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(W=c.jsx(MR,{}),e[114]=W):W=e[114],e[115]!==ye||e[116]!==Te?(ne=c.jsxs(lS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:Q,children:[xe,ye,Te,W]}),e[115]=ye,e[116]=Te,e[117]=ne):ne=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(ue=c.jsx(d7,{}),e[118]=ue):ue=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(de=c.jsx(ic,{children:c.jsx(_c,{children:c.jsx($_,{})})}),e[119]=de):de=e[119],e[120]!==ne?(ge=c.jsxs(SL,{children:[ne,ue,de]}),e[120]=ne,e[121]=ge):ge=e[121],ge};function y7(){window.dispatchEvent(new Event("resize"))}function v7(){requestAnimationFrame(y7)}function w7(){window.dispatchEvent(new Event("resize"))}function k7(){requestAnimationFrame(w7)}let ek;ek=new URL(window.location.href).searchParams.get(OR.showChrome)==="false",AS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(ek){let s,a,i;return e[0]!==t?(s=c.jsx(db,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Lp,{}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs(c.Fragment,{children:[s,a]}),e[3]=s,e[4]=i):i=e[4],i}let n,o,r;return e[5]!==t?(n=c.jsx(db,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(Lp,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(b7,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Um as C,Oc as E,an as P,AL as __tla,Dc as a,AS as e,Cs as f};