@marimo-team/frontend 0.14.11-dev34 → 0.14.11-dev36

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 (93) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-bUN80_ih.js → ConnectedDataExplorerComponent-CWG5nz1x.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-B_df-yps.js → ImageComparisonComponent-CfRrH1Jg.js} +1 -1
  3. package/dist/assets/{VegaLite-D4xDrYyM.js → VegaLite-QF3g-Lep.js} +1 -1
  4. package/dist/assets/{_baseEach-Dltt-w_B.js → _baseEach-iXjsozEK.js} +1 -1
  5. package/dist/assets/_baseMap-CFSo7H5d.js +1 -0
  6. package/dist/assets/{_baseUniq-DfS0Ssf6.js → _baseUniq-CIXXnV06.js} +1 -1
  7. package/dist/assets/{_createAggregator-BxxX1OlM.js → _createAggregator-CEOx6Mv_.js} +1 -1
  8. package/dist/assets/{any-language-editor-DWufnd_2.js → any-language-editor-dvn0jXIm.js} +1 -1
  9. package/dist/assets/{architectureDiagram-NQ2NVSRB-B6igHf-3.js → architectureDiagram-NQ2NVSRB-CFapovxN.js} +1 -1
  10. package/dist/assets/{blockDiagram-PHRCVELO-BJLO1sW6.js → blockDiagram-PHRCVELO-CeJys_Vy.js} +1 -1
  11. package/dist/assets/{c4Diagram-6F6E4RAY-BU7fmlOj.js → c4Diagram-6F6E4RAY-Dr9lJT7D.js} +1 -1
  12. package/dist/assets/channel-BChhPVO9.js +1 -0
  13. package/dist/assets/{chunk-353BL4L5-DPdHUZ4C.js → chunk-353BL4L5-DpA0sHdE.js} +1 -1
  14. package/dist/assets/{chunk-67H74DCK-CUQaQOjI.js → chunk-67H74DCK-a6sjvQrN.js} +1 -1
  15. package/dist/assets/{chunk-6OLS64BW-BrtaWVQq.js → chunk-6OLS64BW-CtRiAe-s.js} +1 -1
  16. package/dist/assets/{chunk-AACKK3MU-7iWp2ygA.js → chunk-AACKK3MU-oiGiewoc.js} +1 -1
  17. package/dist/assets/{chunk-BFAMUDN2-Cf44f9b_.js → chunk-BFAMUDN2-BcH_w1MX.js} +1 -1
  18. package/dist/assets/{chunk-E2GYISFI-C0U67kx3.js → chunk-E2GYISFI-DALCxiNa.js} +1 -1
  19. package/dist/assets/{chunk-QEP2MXWD-Bxtgz2JY.js → chunk-QEP2MXWD-DKhdgr8i.js} +1 -1
  20. package/dist/assets/{chunk-SKB7J2MH-BZwlh5kT.js → chunk-SKB7J2MH-D-OZdgah.js} +1 -1
  21. package/dist/assets/{circle-play-DztHV2mT.js → circle-play-c_TN-Uet.js} +1 -1
  22. package/dist/assets/classDiagram-BGRH5UQR-ytQpgpI-.js +1 -0
  23. package/dist/assets/classDiagram-v2-O24JOBDK-ytQpgpI-.js +1 -0
  24. package/dist/assets/clone-BiHmz0Cp.js +1 -0
  25. package/dist/assets/{compile-B-R519nb.js → compile-d4_So9Wd.js} +1 -1
  26. package/dist/assets/{dagre-FFZHY6LT-z4SZNoY-.js → dagre-FFZHY6LT-CTtvbJD7.js} +1 -1
  27. package/dist/assets/{data-editor-DC7kKj8L.js → data-editor-BYRA0Z35.js} +1 -1
  28. package/dist/assets/{diagram-3EMPZRKU-BIHgHmgi.js → diagram-3EMPZRKU-BrvS7S6k.js} +1 -1
  29. package/dist/assets/{diagram-5UYTHUR4-D-3SPDI0.js → diagram-5UYTHUR4-DdF-4K9j.js} +1 -1
  30. package/dist/assets/{diagram-ZTM2IBQH-CQS3FAPu.js → diagram-ZTM2IBQH-BPhCaqwi.js} +1 -1
  31. package/dist/assets/{edit-page-DhG0gJ0x.js → edit-page-CNQxB001.js} +3 -3
  32. package/dist/assets/{erDiagram-R3QVA2FD-X1pyIK3y.js → erDiagram-R3QVA2FD-BKh8Yt5g.js} +1 -1
  33. package/dist/assets/{flowDiagram-PKI6S5ZS-DHc9ftR2.js → flowDiagram-PKI6S5ZS-Cbk9b1pv.js} +1 -1
  34. package/dist/assets/{ganttDiagram-EK5VF46D-BUjn0bJ4.js → ganttDiagram-EK5VF46D-gVLWczYq.js} +1 -1
  35. package/dist/assets/{gitGraphDiagram-GW3U2K7C-DoasUuRn.js → gitGraphDiagram-GW3U2K7C-ZEUTs3M0.js} +1 -1
  36. package/dist/assets/{graph-MZ-nIJA2.js → graph-jcBhwogT.js} +1 -1
  37. package/dist/assets/{home-page-C3FBcBF-.js → home-page-B0J68aZX.js} +1 -1
  38. package/dist/assets/{index-BFG3UDcz.js → index-B3bNwjTZ.js} +1 -1
  39. package/dist/assets/{index-BlcLf0z7.js → index-BHBxrreJ.js} +1 -1
  40. package/dist/assets/{index-DsZ6EdmC.js → index-BQhe2kkf.js} +1 -1
  41. package/dist/assets/{index-DSNqx2PG.js → index-ByAB5vqI.js} +1 -1
  42. package/dist/assets/{index-CGvy-jXz.js → index-C08ZoK5W.js} +1 -1
  43. package/dist/assets/{index-DECiXEU1.js → index-C3UQadfc.js} +1 -1
  44. package/dist/assets/{index-CjU87QDC.js → index-C5eTVpXk.js} +1 -1
  45. package/dist/assets/{index-bXn5Ht5K.js → index-CE6dVo4s.js} +1 -1
  46. package/dist/assets/{index-CR9FW0Wm.js → index-CHyVAvwp.js} +1 -1
  47. package/dist/assets/{index-DmcZAU56.js → index-CTcbLmMr.js} +1 -1
  48. package/dist/assets/{index-qw98GvuM.js → index-CiFsZ8jm.js} +1 -1
  49. package/dist/assets/{index-CVVfkMNo.js → index-Cjln_Oqz.js} +1 -1
  50. package/dist/assets/{index-CFwjsdSI.js → index-CrCStvOz.js} +1 -1
  51. package/dist/assets/{index-BvsoLT88.js → index-DG5XtgdS.js} +1 -1
  52. package/dist/assets/{index-B6-ULkNY.js → index-DT10yvPX.js} +1 -1
  53. package/dist/assets/{index-BCB-2T1U.js → index-GZ4F9LuZ.js} +1 -1
  54. package/dist/assets/{index-B7Dq-6Eb.js → index-KEegLFWn.js} +1 -1
  55. package/dist/assets/{index-5_FgE_hJ.js → index-cNKrt3_y.js} +1 -1
  56. package/dist/assets/{index-hY-TVbau.js → index-j8CmuYN5.js} +12 -12
  57. package/dist/assets/infoDiagram-RLU2ROGC-Dz0yMiT1.js +2 -0
  58. package/dist/assets/{journeyDiagram-EWQZEKCU-BNszQBQS.js → journeyDiagram-EWQZEKCU-CRgGSvWg.js} +1 -1
  59. package/dist/assets/{kanban-definition-ILFWEQ3N-cnaXuNGE.js → kanban-definition-ILFWEQ3N-EtDZYHre.js} +1 -1
  60. package/dist/assets/{layout-G1k5ZlwX.js → layout-BTu8P8H0.js} +1 -1
  61. package/dist/assets/{linear-BykHQG6m.js → linear-Besjv1F6.js} +1 -1
  62. package/dist/assets/{links--aNXkRJy.js → links-B2AS4wbN.js} +2 -2
  63. package/dist/assets/{mermaid-CEnds-v7.js → mermaid-xvSMEDMp.js} +4 -4
  64. package/dist/assets/{min-CN6F-Wak.js → min-CL8kGbaN.js} +1 -1
  65. package/dist/assets/{mindmap-definition-CZNETY7S-CBtZB6ID.js → mindmap-definition-CZNETY7S-CwcoCTfM.js} +1 -1
  66. package/dist/assets/{pieDiagram-NIOCPIFQ-CgrXrj8C.js → pieDiagram-NIOCPIFQ-CoZakTgV.js} +1 -1
  67. package/dist/assets/{quadrantDiagram-2OG54O6I-CDngCmlF.js → quadrantDiagram-2OG54O6I-BSH8puU7.js} +1 -1
  68. package/dist/assets/{react-plotly-BsD4Y8bg.js → react-plotly-o0JYqZSX.js} +1 -1
  69. package/dist/assets/{requirementDiagram-SO3GGRV7-DNjM6uoU.js → requirementDiagram-SO3GGRV7-zZREz3U_.js} +1 -1
  70. package/dist/assets/{run-page-D-mcpw6q.js → run-page-BXejL4hK.js} +1 -1
  71. package/dist/assets/{sankeyDiagram-4UZDY2LN-CCBO0h7j.js → sankeyDiagram-4UZDY2LN-B95arVFY.js} +1 -1
  72. package/dist/assets/{sequenceDiagram-ZIKVLSP4-CGEjEdDd.js → sequenceDiagram-ZIKVLSP4-718sQZWu.js} +1 -1
  73. package/dist/assets/{slides-component-AClPxNTA.js → slides-component-DB6kLL9e.js} +1 -1
  74. package/dist/assets/{sortBy-ivQLE_rw.js → sortBy-CWBD-dXG.js} +1 -1
  75. package/dist/assets/{stateDiagram-XX37X6EN-c_6rJzBh.js → stateDiagram-XX37X6EN-DYxjVLKQ.js} +1 -1
  76. package/dist/assets/stateDiagram-v2-GD6S3NHB-BhxEBY-a.js +1 -0
  77. package/dist/assets/{storage-DPQi4ucw.js → storage-BaEQKmhG.js} +3 -3
  78. package/dist/assets/{terminal-BS7wwx8O.js → terminal-Ct8pIhb9.js} +1 -1
  79. package/dist/assets/{time-CxHzdJhN.js → time-BwucAGDv.js} +1 -1
  80. package/dist/assets/{timeline-definition-RI47OAVP-DNny8b3c.js → timeline-definition-RI47OAVP-DtHza-tv.js} +1 -1
  81. package/dist/assets/{tracing-d_os5FRh.js → tracing-BuELwTiu.js} +2 -2
  82. package/dist/assets/{treemap-FKARHQ26-BT8Hnvg4.js → treemap-FKARHQ26-BrbeZviV.js} +1 -1
  83. package/dist/assets/{vega-component-0-gNnSCs.js → vega-component-DjYGkUm0.js} +1 -1
  84. package/dist/assets/{xychartDiagram-H2YORKM3-DTnprJ9M.js → xychartDiagram-H2YORKM3-D1SgsQKX.js} +1 -1
  85. package/dist/index.html +1 -1
  86. package/package.json +1 -1
  87. package/dist/assets/_baseMap-DOildTF2.js +0 -1
  88. package/dist/assets/channel-BQe9yl_h.js +0 -1
  89. package/dist/assets/classDiagram-BGRH5UQR-DW-y-2cH.js +0 -1
  90. package/dist/assets/classDiagram-v2-O24JOBDK-DW-y-2cH.js +0 -1
  91. package/dist/assets/clone-TZOZrpCW.js +0 -1
  92. package/dist/assets/infoDiagram-RLU2ROGC-B4q5BeVD.js +0 -2
  93. package/dist/assets/stateDiagram-v2-GD6S3NHB-oNalqyuu.js +0 -1
@@ -1,4 +1,4 @@
1
- import{cj as ts,aP as ns,u as Q,S,a as ze,j as s,fr as rs,fs as is,c as J,cG as ss,W as St,ft as os,fu as xn,f6 as as,fv as bn,fw as T,fx as jn,fy as E,fz as N,fA as _,fB as ce,fC as A,bt as oe,fD as wn,fE as z,fF as xe,as as Pe,fG as ue,bu as fe,fH as In,fI as ls,e1 as Sn,fJ as On,fK as cs,fL as us,dO as et,$ as Ue,fM as ds,fN as kn,b6 as hs,fO as fs,L as B,fP as ps,fQ as gs,fR as ms,fS as Ae,fT as vs,fU as ys,cr as xs,bh as qe,bv as tt,es as nt,X as pe,ep as bs,dK as Cn,at as js,ar as ws,fV as Is,fW as je,fX as Nn,fY as Ss,fZ as Dn,f_ as rt,f$ as Tn,g0 as Os,g1 as it,g2 as X,g3 as ks,g4 as Cs,dz as Ot,fh as Ns,g5 as kt,g6 as Ds,g7 as Ts,g8 as En,g9 as _n,ga as Es,eM as Pn,_ as st,gb as _s,gc as Ps,gd as An,ge as As,gf as Ms,gg as Mn,gh as Rs,al as Ct,gi as Ls,gj as Fs,an as Rn,ao as Hs,ap as zs,aK as Us,gk as Ln,gl as Nt,a8 as qs,gm as Bs,aw as Be,af as Fn,gn as Vs,E as Ws,go as Ks,gp as ot,gq as Gs,gr as $s,gs as Ys,a1 as Dt,ff as Xs,gt as Qs,gu as Js,gv as Zs,gw as eo,gx as to,gy as no,en as at,dJ as Hn,br as ro,gz as io,gA as so,cm as zn,gB as oo,a5 as Tt,gC as Un,am as ao,gD as lo,gE as co,gF as uo,be as ho,bm as fo,gG as po,bc as go}from"./index-hY-TVbau.js";import{e as mo}from"./index-B7Dq-6Eb.js";/**
1
+ import{cj as ts,aP as ns,u as Q,S,a as ze,j as s,fr as rs,fs as is,c as J,cG as ss,W as St,ft as os,fu as xn,f6 as as,fv as bn,fw as T,fx as jn,fy as E,fz as N,fA as _,fB as ce,fC as A,bt as oe,fD as wn,fE as z,fF as xe,as as Pe,fG as ue,bu as fe,fH as In,fI as ls,e1 as Sn,fJ as On,fK as cs,fL as us,dO as et,$ as Ue,fM as ds,fN as kn,b6 as hs,fO as fs,L as B,fP as ps,fQ as gs,fR as ms,fS as Ae,fT as vs,fU as ys,cr as xs,bh as qe,bv as tt,es as nt,X as pe,ep as bs,dK as Cn,at as js,ar as ws,fV as Is,fW as je,fX as Nn,fY as Ss,fZ as Dn,f_ as rt,f$ as Tn,g0 as Os,g1 as it,g2 as X,g3 as ks,g4 as Cs,dz as Ot,fh as Ns,g5 as kt,g6 as Ds,g7 as Ts,g8 as En,g9 as _n,ga as Es,eM as Pn,_ as st,gb as _s,gc as Ps,gd as An,ge as As,gf as Ms,gg as Mn,gh as Rs,al as Ct,gi as Ls,gj as Fs,an as Rn,ao as Hs,ap as zs,aK as Us,gk as Ln,gl as Nt,a8 as qs,gm as Bs,aw as Be,af as Fn,gn as Vs,E as Ws,go as Ks,gp as ot,gq as Gs,gr as $s,gs as Ys,a1 as Dt,ff as Xs,gt as Qs,gu as Js,gv as Zs,gw as eo,gx as to,gy as no,en as at,dJ as Hn,br as ro,gz as io,gA as so,cm as zn,gB as oo,a5 as Tt,gC as Un,am as ao,gD as lo,gE as co,gF as uo,be as ho,bm as fo,gG as po,bc as go}from"./index-j8CmuYN5.js";import{e as mo}from"./index-KEegLFWn.js";/**
2
2
  * @license lucide-react v0.525.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -14,4 +14,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
14
14
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ci(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ui(t){var e=null;return function(){return e==null&&(e=t()),e}}function fl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function di(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var pl=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),di(this,"entered",[]),di(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return fl(t,[{key:"enter",value:function(e){var n=this,r=this.entered.length;return this.entered=function(i,o){var a=new Set,l=function(u){return a.add(u)};i.forEach(l),o.forEach(l);var c=[];return a.forEach(function(u){return c.push(u)}),c}(this.entered.filter(function(i){return n.isNodeInDocument(i)&&(!i.contains||i.contains(e))}),[e]),r===0&&this.entered.length>0}},{key:"leave",value:function(e){var n,r,i=this.entered.length;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=e,n.filter(function(o){return o!==r})),i>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),t}(),gl=ui(function(){return/firefox/i.test(navigator.userAgent)}),hi=ui(function(){return!!window.safari});function ml(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function $e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var fi=function(){function t(e,n){(function(L,H){if(!(L instanceof H))throw new TypeError("Cannot call a class as a function")})(this,t),$e(this,"xs",void 0),$e(this,"ys",void 0),$e(this,"c1s",void 0),$e(this,"c2s",void 0),$e(this,"c3s",void 0);for(var r=e.length,i=[],o=0;o<r;o++)i.push(o);i.sort(function(L,H){return e[L]<e[H]?-1:1});for(var a,l,c=[],u=[],d=0;d<r-1;d++)a=e[d+1]-e[d],l=n[d+1]-n[d],c.push(a),u.push(l/a);for(var h=[u[0]],y=0;y<c.length-1;y++){var g=u[y],f=u[y+1];if(g*f<=0)h.push(0);else{a=c[y];var p=c[y+1],v=a+p;h.push(3*v/((v+p)/g+(v+a)/f))}}h.push(u[u.length-1]);for(var x,b=[],j=[],O=0;O<h.length-1;O++){x=u[O];var k=h[O],C=1/c[O],P=k+h[O+1]-x-x;b.push((x-k-P)*C),j.push(P*C*C)}this.xs=e,this.ys=n,this.c1s=h,this.c2s=b,this.c3s=j}return ml(t,[{key:"interpolate",value:function(e){var n=this.xs,r=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,l=n.length-1;if(e===n[l])return r[l];for(var c,u=0,d=a.length-1;u<=d;){var h=n[c=Math.floor(.5*(u+d))];if(h<e)u=c+1;else{if(!(h>e))return r[c];d=c-1}}var y=e-n[l=Math.max(0,d)],g=y*y;return r[l]+i[l]*y+o[l]*g+a[l]*y*g}}]),t}();function pi(t){var e=t.nodeType===1?t:t.parentElement;if(!e)return null;var n=e.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function pt(t){return{x:t.clientX,y:t.clientY}}function vl(t,e,n,r,i){var o,a,l,c=(o=e).nodeName==="IMG"&&(gl()||!((a=document.documentElement)!==null&&a!==void 0&&a.contains(o))),u=pi(c?t:e),d={x:n.x-u.x,y:n.y-u.y},h=t.offsetWidth,y=t.offsetHeight,g=r.anchorX,f=r.anchorY,p=function(k,C,P,L){var H=k?C.width:P,U=k?C.height:L;return hi()&&k&&(U/=window.devicePixelRatio,H/=window.devicePixelRatio),{dragPreviewWidth:H,dragPreviewHeight:U}}(c,e,h,y),v=p.dragPreviewWidth,x=p.dragPreviewHeight,b=i.offsetX,j=i.offsetY,O=j===0||j;return{x:b===0||b?b:new fi([0,.5,1],[d.x,d.x/h*v,d.x+v-h]).interpolate(g),y:O?j:(l=new fi([0,.5,1],[d.y,d.y/y*x,d.y+x-y]).interpolate(f),hi()&&c&&(l+=(window.devicePixelRatio-1)*x),l)}}var gi="__NATIVE_FILE__",mi="__NATIVE_URL__",vi="__NATIVE_TEXT__",yi="__NATIVE_HTML__";const xi=Object.freeze(Object.defineProperty({__proto__:null,FILE:gi,HTML:yi,TEXT:vi,URL:mi},Symbol.toStringTag,{value:"Module"}));function on(t,e,n){var r=e.reduce(function(i,o){return i||t.getData(o)},"");return r??n}var Ye;function gt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var an=(gt(Ye={},gi,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),gt(Ye,yi,{exposeProperties:{html:function(t,e){return on(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),gt(Ye,mi,{exposeProperties:{urls:function(t,e){return on(t,e,"").split(`
15
15
  `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),gt(Ye,vi,{exposeProperties:{text:function(t,e){return on(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Ye);function yl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function bi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var xl=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),bi(this,"item",void 0),bi(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return yl(t,[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(e.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var n=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach(function(i){r[i]={value:n.config.exposeProperties[i](e,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,n){return n===e.getSourceId()}},{key:"endDrag",value:function(){}}]),t}();function ln(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys(an).filter(function(n){return an[n].matchesTypes.some(function(r){return e.indexOf(r)>-1})})[0]||null}function bl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function cn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var jl=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),cn(this,"ownerDocument",null),cn(this,"globalContext",void 0),cn(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=n}return bl(t,[{key:"window",get:function(){return this.globalContext?this.globalContext:typeof window<"u"?window:void 0}},{key:"document",get:function(){var e;return(e=this.globalContext)!==null&&e!==void 0&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return((e=this.optionsArgs)===null||e===void 0?void 0:e.rootElement)||this.window}}]),t}();function ji(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ji(Object(n),!0).forEach(function(r){M(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ji(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function M(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var un,Il=function(){function t(e,n,r){var i=this;(function(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")})(this,t),M(this,"options",void 0),M(this,"actions",void 0),M(this,"monitor",void 0),M(this,"registry",void 0),M(this,"enterLeaveCounter",void 0),M(this,"sourcePreviewNodes",new Map),M(this,"sourcePreviewNodeOptions",new Map),M(this,"sourceNodes",new Map),M(this,"sourceNodeOptions",new Map),M(this,"dragStartSourceIds",null),M(this,"dropTargetIds",[]),M(this,"dragEnterTargetIds",[]),M(this,"currentNativeSource",null),M(this,"currentNativeHandle",null),M(this,"currentDragSourceNode",null),M(this,"altKeyPressed",!1),M(this,"mouseMoveTimeoutTimer",null),M(this,"asyncEndDragFrameId",null),M(this,"dragOverTargetIds",null),M(this,"lastClientOffset",null),M(this,"hoverRafId",null),M(this,"getSourceClientOffset",function(o){var a=i.sourceNodes.get(o);return a&&pi(a)||null}),M(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),M(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),M(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),M(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),M(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var a=i.dragStartSourceIds;i.dragStartSourceIds=null;var l=pt(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:l});var c=o.dataTransfer,u=ln(c);if(i.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var d=i.monitor.getSourceId(),h=i.sourceNodes.get(d),y=i.sourcePreviewNodes.get(d)||h;if(y){var g=i.getCurrentSourcePreviewNodeOptions(),f=vl(h,y,l,{anchorX:g.anchorX,anchorY:g.anchorY},{offsetX:g.offsetX,offsetY:g.offsetY});c.setDragImage(y,f.x,f.y)}}try{c==null||c.setData("application/json",{})}catch{}i.setCurrentDragSourceNode(o.target),i.getCurrentSourcePreviewNodeOptions().captureDraggingState?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(u)i.beginDragNativeItem(u);else{if(c&&!c.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}}}),M(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),M(this,"handleTopDragEnterCapture",function(o){if(i.dragEnterTargetIds=[],i.enterLeaveCounter.enter(o.target)&&!i.monitor.isDragging()){var a=o.dataTransfer,l=ln(a);l&&i.beginDragNativeItem(l,a)}}),M(this,"handleTopDragEnter",function(o){var a=i.dragEnterTargetIds;i.dragEnterTargetIds=[],i.monitor.isDragging()&&(i.altKeyPressed=o.altKey,a.length>0&&i.actions.hover(a,{clientOffset:pt(o)}),a.some(function(l){return i.monitor.canDropOnTarget(l)})&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),M(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),M(this,"handleTopDragOver",function(o){var a=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging())return o.preventDefault(),void(o.dataTransfer&&(o.dataTransfer.dropEffect="none"));i.altKeyPressed=o.altKey,i.lastClientOffset=pt(o),i.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(a||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null})),(a||[]).some(function(l){return i.monitor.canDropOnTarget(l)})?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))}),M(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault(),i.enterLeaveCounter.leave(o.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),M(this,"handleTopDropCapture",function(o){var a;i.dropTargetIds=[],i.isDraggingNativeItem()?(o.preventDefault(),(a=i.currentNativeSource)===null||a===void 0||a.loadDataTransfer(o.dataTransfer)):ln(o.dataTransfer)&&o.preventDefault(),i.enterLeaveCounter.reset()}),M(this,"handleTopDrop",function(o){var a=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(a,{clientOffset:pt(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),M(this,"handleSelectStart",function(o){var a=o.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(o.preventDefault(),a.dragDrop()))}),this.options=new jl(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new pl(this.isNodeInDocument)}return wl(t,[{key:"profile",value:function(){var e,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((e=this.dragStartSourceIds)===null||e===void 0?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,n=this.rootElement;n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&((e=this.window)===null||e===void 0||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,n,r){var i=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,n),function(){i.sourcePreviewNodes.delete(e),i.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,n,r){var i=this;this.sourceNodes.set(e,n),this.sourceNodeOptions.set(e,r);var o=function(l){return i.handleDragStart(l,e)},a=function(l){return i.handleSelectStart(l)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(e),i.sourceNodeOptions.delete(e),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,n){var r=this,i=function(l){return r.handleDragEnter(l,e)},o=function(l){return r.handleDragOver(l,e)},a=function(l){return r.handleDrop(l,e)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(e);return wi({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return wi({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(xi).some(function(n){return xi[n]===e})}},{key:"beginDragNativeItem",value:function(e,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(r,i){var o=new xl(an[r]);return o.loadDataTransfer(i),o}(e,n),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var r;return(r=n.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){var e;return this.currentDragSourceNode=null,this.rootElement&&((e=this.window)===null||e===void 0||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,n){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(e,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(e,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(e,n){this.dropTargetIds.unshift(n)}}]),t}(),Sl=function(t,e,n){return new Il(t,e,n)};function Ol(t){const e=de(),n=e.selectedIds,[r,i,o]=ol(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const a=e.isSelected(t.id)?Array.from(n):[t.id];return e.dispatch(Le.dragStart(t.id,a)),{id:t.id,dragIds:a}},end:()=>{e.hideCursor(),e.dispatch(Le.dragEnd())}}),[n,t]);return S.useEffect(()=>{o((un||((un=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),un))},[o]),i}function mt(t,e){return{parentId:t||null,index:e}}function He(t,e){return{type:"line",index:t,level:e}}function dn(t,e){var n;let r=t;for(;r.parent&&r.level>e;)r=r.parent;return{parentId:((n=r.parent)===null||n===void 0?void 0:n.id)||null,index:nr(r)+1}}function Ii(t){var e;const n=function(h,y){const g=h.getBoundingClientRect(),f=y.x-Math.round(g.x),p=y.y-Math.round(g.y),v=g.height,x=p<v/2,b=!x,j=v/4,O=p>j&&p<v-j;return{x:f,inTopHalf:x,inBottomHalf:b,inMiddle:O,atTop:!O&&x,atBottom:!O&&b}}(t.element,t.offset),r=t.indent,i=Math.round(Math.max(0,n.x-r)/r),{node:o,nextNode:a,prevNode:l}=t,[c,u]=function(h,y,g,f){return h?h.isInternal?f.atTop?[y,h]:f.inMiddle?[h,h]:[h,g]:f.inTopHalf?[y,h]:[h,g]:[y,null]}(o,l,a,n);if(o&&o.isInternal&&n.inMiddle)return{drop:mt(o.id,null),cursor:(d=o.id,{type:"highlight",id:d})};var d;if(!c)return{drop:mt((e=u==null?void 0:u.parent)===null||e===void 0?void 0:e.id,0),cursor:He(0,0)};if(Jn(c)){const h=lt(i,(u==null?void 0:u.level)||0,c.level);return{drop:dn(c,h),cursor:He(c.rowIndex+1,h)}}if(Zn(c)){const h=lt(i,(u==null?void 0:u.level)||0,c.level);return{drop:dn(c,h),cursor:He(c.rowIndex+1,h)}}if(er(c)){const h=lt(i,0,c.level+1);return h>c.level?{drop:mt(c.id,0),cursor:He(c.rowIndex+1,h)}:{drop:dn(c,h),cursor:He(c.rowIndex+1,h)}}return{drop:mt(c==null?void 0:c.id,0),cursor:He(c.rowIndex+1,c.level+1)}}const kl=ze.memo(function({index:t,style:e}){Qn(),function(){if(S.useContext($n)===null)throw new Error("Provide a NodesContext")}();const n=de(),r=function(f){const p=de(),v=p.at(f);if(!v)throw new Error(`Could not find node for index: ${f}`);return S.useMemo(()=>{const x=v.clone();return p.visibleNodes[f]=x,x},[...Object.values(v.state),v])}(t),i=S.useRef(null),o=Ol(r),a=function(f,p){const v=de(),[x,b]=li(()=>({accept:"NODE",canDrop:()=>v.canDrop(),hover:(j,O)=>{const k=O.getClientOffset();if(!f.current||!k)return;const{cursor:C,drop:P}=Ii({element:f.current,offset:k,indent:v.indent,node:p,prevNode:p.prev,nextNode:p.next});P&&v.dispatch(Le.hovering(P.parentId,P.index)),O.canDrop()?C&&v.showCursor(C):v.hideCursor()},drop:(j,O)=>{if(!O.canDrop())return null;let{parentId:k,index:C,dragIds:P}=v.state.dnd;ar(v.props.onMove,{dragIds:P,parentId:k===We?null:k,index:C===null?0:C,dragNodes:v.dragNodes,parentNode:v.get(k)}),v.open(k)}}),[p,f.current,v.props]);return b}(i,r),l=S.useCallback(f=>{i.current=f,a(f)},[a]),c=n.indent*r.level,u=S.useMemo(()=>({paddingLeft:c}),[c]),d=S.useMemo(()=>{var f,p;return Object.assign(Object.assign({},e),{top:parseFloat(e.top)+((p=(f=n.props.padding)!==null&&f!==void 0?f:n.props.paddingTop)!==null&&p!==void 0?p:0)})},[e,n.props.padding,n.props.paddingTop]),h={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:d,tabIndex:-1,className:n.props.rowClassName};S.useEffect(()=>{var f;!r.isEditing&&r.isFocused&&((f=i.current)===null||f===void 0||f.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);const y=n.renderNode,g=n.renderRow;return s.jsx(g,{node:r,innerRef:l,attrs:h,children:s.jsx(y,{node:r,tree:n,style:u,dragHandle:o})})});let hn="",Si=null;function Oi(){Qn();const t=de();return s.jsx("div",{role:"tree",style:{height:t.height,width:t.width,minHeight:0,minWidth:0},onContextMenu:t.props.onContextMenu,onClick:t.props.onClick,tabIndex:0,onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||t.onFocus()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t.onBlur()},onKeyDown:e=>{var n;if(t.isEditing)return;if(e.key==="Backspace"){if(!t.props.onDelete)return;const i=Array.from(t.selectedIds);if(i.length>1){let o=t.mostRecentNode;for(;o&&o.isSelected;)o=o.nextSibling;o||(o=t.lastNode),t.focus(o,{scroll:!1}),t.delete(Array.from(i))}else{const o=t.focusedNode;if(o){const a=o.nextSibling,l=o.parent;t.focus(a||l,{scroll:!1}),t.delete(o)}}return}if(e.key==="Tab"&&!e.shiftKey)return e.preventDefault(),void rr(e.currentTarget);if(e.key==="Tab"&&e.shiftKey)return e.preventDefault(),void ir(e.currentTarget);if(e.key==="ArrowDown"){e.preventDefault();const i=t.nextNode;if(e.metaKey)return t.select(t.focusedNode),void t.activate(t.focusedNode);if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.firstNode))}}if(e.key==="ArrowUp"){e.preventDefault();const i=t.prevNode;if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.lastNode))}}if(e.key==="ArrowRight"){const i=t.focusedNode;return i?void(i.isInternal&&i.isOpen?t.focus(t.nextNode):i.isInternal&&t.open(i.id)):void 0}if(e.key==="ArrowLeft"){const i=t.focusedNode;return!i||i.isRoot?void 0:void(i.isInternal&&i.isOpen?t.close(i.id):((n=i.parent)===null||n===void 0?void 0:n.isRoot)||t.focus(i.parent))}if(e.key==="a"&&e.metaKey&&!t.props.disableMultiSelection)return e.preventDefault(),void t.selectAll();if(e.key==="a"&&!e.metaKey&&t.props.onCreate)return void t.createLeaf();if(e.key==="A"&&!e.metaKey)return t.props.onCreate?void t.createInternal():void 0;if(e.key==="Home")return e.preventDefault(),void t.focus(t.firstNode);if(e.key==="End")return e.preventDefault(),void t.focus(t.lastNode);if(e.key==="Enter"){const i=t.focusedNode;return!i||!i.isEditable||!t.props.onRename?void 0:void setTimeout(()=>{i&&t.edit(i)})}if(e.key===" "){e.preventDefault();const i=t.focusedNode;return i?void(i.isLeaf?(i.select(),i.activate()):i.toggle()):void 0}if(e.key==="*"){const i=t.focusedNode;return i?void t.openSiblings(i):void 0}if(e.key==="PageUp")return e.preventDefault(),void t.pageUp();e.key==="PageDown"&&(e.preventDefault(),t.pageDown()),clearTimeout(Si),hn+=e.key,Si=setTimeout(()=>{hn=""},600);const r=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"&&o.toLowerCase().startsWith(hn)});r&&t.focus(r.id)},children:s.jsx(ea,{className:t.props.className,outerRef:t.listEl,itemCount:t.visibleNodes.length,height:t.height,width:t.width,itemSize:t.rowHeight,overscanCount:t.overscanCount,itemKey:e=>{var n;return((n=t.visibleNodes[e])===null||n===void 0?void 0:n.id)||e},outerElementType:ra,innerElementType:oa,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:kl})})}function ki(t){return t.isFiltered?function(e,n){const r={},i=[];function o(l){if(!l.isRoot&&n(l)){r[l.id]=!0;let c=l.parent;for(;c;)r[c.id]=!0,c=c.parent}if(l.children)for(let c of l.children)o(c)}function a(l){var c;l.level>=0&&r[l.id]&&i.push(l),l.isOpen&&((c=l.children)===null||c===void 0||c.forEach(a))}return o(e),a(e),i.forEach(Ci),i}(t.root,t.isMatch.bind(t)):function(e){const n=[];function r(i){var o;i.level>=0&&n.push(i),i.isOpen&&((o=i.children)===null||o===void 0||o.forEach(r))}return r(e),n.forEach(Ci),n}(t.root)}function Ci(t,e){t.rowIndex=e}const Ni=t=>t.reduce((e,n,r)=>(e[n.id]=r,e),{});var fn=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){var d;u.done?i(u.value):(d=u.value,d instanceof n?d:new n(function(h){h(d)})).then(a,l)}c((r=r.apply(t,e||[])).next())})};const{safeRun:G,identify:Se,identifyNull:be}=Eo;class Qe{constructor(e,n,r,i){this.store=e,this.props=n,this.list=r,this.listEl=i,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=dr(this),this.visibleNodes=ki(this),this.idToIndex=Ni(this.visibleNodes)}update(e){this.props=e,this.root=dr(this),this.visibleNodes=ki(this),this.idToIndex=Ni(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return(e=this.props.width)!==null&&e!==void 0?e:300}get height(){var e;return(e=this.props.height)!==null&&e!==void 0?e:500}get indent(){var e;return(e=this.props.indent)!==null&&e!==void 0?e:24}get rowHeight(){var e;return(e=this.props.rowHeight)!==null&&e!==void 0?e:24}get overscanCount(){var e;return(e=this.props.overscanCount)!==null&&e!==void 0?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const n=(e=this.props.searchMatch)!==null&&e!==void 0?e:(r,i)=>JSON.stringify(Object.values(r.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return r=>n(r,this.searchTerm)}accessChildren(e){var n;return(n=Ve(e,this.props.childrenAccessor||"children"))!==null&&n!==void 0?n:null}accessId(e){const n=Ve(e,this.props.idAccessor||"id");if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}get firstNode(){var e;return(e=this.visibleNodes[0])!==null&&e!==void 0?e:null}get lastNode(){var e;return(e=this.visibleNodes[this.visibleNodes.length-1])!==null&&e!==void 0?e:null}get focusedNode(){var e;return(e=this.get(this.state.nodes.focus.id))!==null&&e!==void 0?e:null}get mostRecentNode(){var e;return(e=this.get(this.state.nodes.selection.mostRecent))!==null&&e!==void 0?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,n){var r;if(e===null||n===null)return[];const i=(r=this.indexOf(e))!==null&&r!==void 0?r:0,o=this.indexOf(n);if(o===null)return[];const a=Math.min(i,o),l=Math.max(i,o);return this.visibleNodes.slice(a,l+1)}indexOf(e){const n=or(e);return n?this.idToIndex[n]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return fn(this,arguments,void 0,function*(e={}){var n,r;const i=e.parentId===void 0?ur(this):e.parentId,o=(n=e.index)!==null&&n!==void 0?n:cr(this),a=(r=e.type)!==null&&r!==void 0?r:"leaf",l=yield G(this.props.onCreate,{type:a,parentId:i,index:o,parentNode:this.get(i)});l&&(this.focus(l),setTimeout(()=>{this.edit(l).then(()=>{this.select(l),this.activate(l)})}))})}delete(e){return fn(this,void 0,void 0,function*(){if(!e)return;const n=(Array.isArray(e)?e:[e]).map(Se),r=n.map(i=>this.get(i)).filter(i=>!!i);yield G(this.props.onDelete,{nodes:r,ids:n})})}edit(e){const n=Se(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(Pt(n)),new Promise(r=>{Qe.editPromise=r})}submit(e,n){return fn(this,void 0,void 0,function*(){if(!e)return;const r=Se(e);yield G(this.props.onRename,{id:r,name:n,node:this.get(r)}),this.dispatch(Pt(null)),this.resolveEdit({cancelled:!1,value:n}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Pt(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const n=this.get(be(e));n&&G(this.props.onActivate,n)}resolveEdit(e){const n=Qe.editPromise;n&&n(e),Qe.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let n of Array.from(this.selectedIds)){const r=this.get(n);r&&e.push(r)}return e}focus(e,n={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Me(Se(e))),n.scroll!==!1&&this.scrollTo(e),this.focusedNode&&G(this.props.onFocus,this.focusedNode)))}pageUp(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex-r;let o=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;o=o>r?r:Math.max(r-i,0),this.focus(this.at(o))}pageDown(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex,o=i-r;let a=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;a=a<i?i:Math.min(a+o,this.visibleNodes.length-1),this.focus(this.at(a))}select(e,n={}){if(!e)return;const r=n.focus!==!1,i=Se(e);r&&this.dispatch(Me(i)),this.dispatch(zo(i)),this.dispatch(gr(i)),this.dispatch(Mt(i)),this.scrollTo(i,n.align),this.focusedNode&&r&&G(this.props.onFocus,this.focusedNode),G(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const n=Se(e);this.dispatch(pr(n)),G(this.props.onSelect,this.selectedNodes)}selectMulti(e){const n=this.get(be(e));n&&(this.dispatch(Me(n.id)),this.dispatch(fr(n.id)),this.dispatch(gr(n.id)),this.dispatch(Mt(n.id)),this.scrollTo(n),this.focusedNode&&G(this.props.onFocus,this.focusedNode),G(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const n=Se(e),{anchor:r,mostRecent:i}=this.state.nodes.selection;this.dispatch(Me(n)),this.dispatch(pr(this.nodesBetween(r,i))),this.dispatch(fr(this.nodesBetween(r,be(n)))),this.dispatch(Mt(n)),this.scrollTo(n),this.focusedNode&&G(this.props.onFocus,this.focusedNode),G(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),G(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Me((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&G(this.props.onFocus,this.focusedNode),G(this.props.onSelect,this.selectedNodes)}setSelection(e){var n;const r=new Set((n=e.ids)===null||n===void 0?void 0:n.map(Se)),i=be(e.anchor),o=be(e.mostRecent);this.dispatch(Uo({ids:r,anchor:i,mostRecent:o})),G(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;return e.type==="highlight"?e.id:null}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var e;if(this.isFiltered)return!1;const n=(e=this.get(this.state.dnd.parentId))!==null&&e!==void 0?e:this.root,r=this.dragNodes,i=this.props.disableDrop;for(const o of r)if(!o||!n||o.isInternal&&tr(n,o))return!1;return typeof i=="function"?!i({parentNode:n,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof i=="string"?!n.data[i]:typeof i!="boolean"||!i}hideCursor(){this.dispatch(Le.cursor({type:"none"}))}showCursor(e){this.dispatch(Le.cursor(e))}open(e){const n=be(e);n&&(this.isOpen(n)||(this.dispatch(At.open(n,this.isFiltered)),G(this.props.onToggle,n)))}close(e){const n=be(e);n&&this.isOpen(n)&&(this.dispatch(At.close(n,this.isFiltered)),G(this.props.onToggle,n))}toggle(e){const n=be(e);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(e){const n=be(e);if(!n)return;const r=_t(this.root,n);let i=r==null?void 0:r.parent;for(;i;)this.open(i.id),i=i.parent}openSiblings(e){const n=e.parent;if(n){if(n.children){const r=e.isOpen;for(let i of n.children)i.isInternal&&(r?this.close(i.id):this.open(i.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){ct(this.root,e=>{e.isInternal&&e.open()})}closeAll(){ct(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,n="smart"){if(!e)return;const r=Se(e);return this.openParents(r),lr(()=>r in this.idToIndex).then(()=>{var i;const o=this.idToIndex[r];o!==void 0&&((i=this.list.current)===null||i===void 0||i.scrollToItem(o,n))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var e;return!!(!((e=this.props.searchTerm)===null||e===void 0)&&e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var n,r,i;if(!e)return!1;if(e===We)return!0;const o=(n=this.props.openByDefault)===null||n===void 0||n;return this.isFiltered?(r=this.state.nodes.open.filtered[e])===null||r===void 0||r:(i=this.state.nodes.open.unfiltered[e])!==null&&i!==void 0?i:o}isEditable(e){return!Ve(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!Ve(e,this.props.disableDrag||(()=>!1))}isDragging(e){const n=be(e);return!!n&&this.state.nodes.drag.id===n}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const n=be(e);if(!n)return!1;const{destinationParentId:r,destinationIndex:i}=this.state.nodes.drag;return n===r&&i===null}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(Me(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Oi}get renderRow(){return this.props.renderRow||Ro}get renderNode(){return this.props.children||Lo}get renderDragPreview(){return this.props.renderDragPreview||mr}get renderCursor(){return this.props.renderCursor||Mo}}function ee(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Di=typeof Symbol=="function"&&Symbol.observable||"@@observable",pn=()=>Math.random().toString(36).substring(7).split("").join("."),vt={INIT:`@@redux/INIT${pn()}`,REPLACE:`@@redux/REPLACE${pn()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${pn()}`};function Ti(t,e,n){if(typeof t!="function")throw new Error(ee(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(ee(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(ee(1));return n(Ti)(t,e)}let r=t,i=e,o=new Map,a=o,l=0,c=!1;function u(){a===o&&(a=new Map,o.forEach((g,f)=>{a.set(f,g)}))}function d(){if(c)throw new Error(ee(3));return i}function h(g){if(typeof g!="function")throw new Error(ee(4));if(c)throw new Error(ee(5));let f=!0;u();const p=l++;return a.set(p,g),function(){if(f){if(c)throw new Error(ee(6));f=!1,u(),a.delete(p),o=null}}}function y(g){if(!function(f){if(typeof f!="object"||f===null)return!1;let p=f;for(;Object.getPrototypeOf(p)!==null;)p=Object.getPrototypeOf(p);return Object.getPrototypeOf(f)===p||Object.getPrototypeOf(f)===null}(g))throw new Error(ee(7));if(g.type===void 0)throw new Error(ee(8));if(typeof g.type!="string")throw new Error(ee(17));if(c)throw new Error(ee(9));try{c=!0,i=r(i,g)}finally{c=!1}return(o=a).forEach(f=>{f()}),g}return y({type:vt.INIT}),{dispatch:y,subscribe:h,getState:d,replaceReducer:function(g){if(typeof g!="function")throw new Error(ee(10));r=g,y({type:vt.REPLACE})},[Di]:function(){const g=h;return{subscribe(f){if(typeof f!="object"||f===null)throw new Error(ee(11));function p(){const v=f;v.next&&v.next(d())}return p(),{unsubscribe:g(p)}},[Di](){return this}}}}}function Ei(t){const e=Object.keys(t),n={};for(let o=0;o<e.length;o++){const a=e[o];typeof t[a]=="function"&&(n[a]=t[a])}const r=Object.keys(n);let i;try{(function(o){Object.keys(o).forEach(a=>{const l=o[a];if(l(void 0,{type:vt.INIT})===void 0)throw new Error(ee(12));if(l(void 0,{type:vt.PROBE_UNKNOWN_ACTION()})===void 0)throw new Error(ee(13))})})(n)}catch(o){i=o}return function(o={},a){if(i)throw i;let l=!1;const c={};for(let u=0;u<r.length;u++){const d=r[u],h=n[d],y=o[d],g=h(y,a);if(g===void 0)throw a&&a.type,new Error(ee(14));c[d]=g,l=l||g!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}const Cl=Ei({nodes:Ei({focus:function(t={id:null,treeFocused:!1},e){return e.type==="FOCUS"?Object.assign(Object.assign({},t),{id:e.id,treeFocused:!0}):e.type==="TREE_BLUR"?Object.assign(Object.assign({},t),{treeFocused:!1}):t},edit:function(t={id:null},e){return e.type==="EDIT"?Object.assign(Object.assign({},t),{id:e.id}):t},open:function(t={filtered:{},unfiltered:{}},e){return e.type.startsWith("VISIBILITY")?e.filtered?Object.assign(Object.assign({},t),{filtered:hr(t.filtered,e)}):Object.assign(Object.assign({},t),{unfiltered:hr(t.unfiltered,e)}):t},selection:function(t=Re().nodes.selection,e){const n=t.ids;switch(e.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},t),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},t),{ids:new Set([e.id])});case"SELECTION_ADD":return e.ids.length===0?t:(e.ids.forEach(r=>n.add(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_REMOVE":return e.ids.length===0?t:(e.ids.forEach(r=>n.delete(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},t),{ids:e.ids,mostRecent:e.mostRecent,anchor:e.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},t),{mostRecent:e.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},t),{anchor:e.id});default:return t}},drag:function(t=Re().nodes.drag,e){switch(e.type){case"DND_DRAG_START":return Object.assign(Object.assign({},t),{id:e.id,selectedIds:e.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},t),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return e.parentId!==t.destinationParentId||e.index!=t.destinationIndex?Object.assign(Object.assign({},t),{destinationParentId:e.parentId,destinationIndex:e.index}):t;default:return t}}}),dnd:function(t=Re().dnd,e){switch(e.type){case"DND_CURSOR":return Object.assign(Object.assign({},t),{cursor:e.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},t),{dragId:e.id,dragIds:e.dragIds});case"DND_DRAG_END":return Re().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},t),{parentId:e.parentId,index:e.index});default:return t}}}),Nl=Re();function Dl({treeProps:t,imperativeHandle:e,children:n}){const r=S.useRef(null),i=S.useRef(null),o=S.useRef(Ti(Cl,Re(t))),a=is.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>Nl),l=S.useMemo(()=>new Qe(o.current,t,r,i),[]),c=S.useRef(0);return S.useMemo(()=>{c.current+=1,l.update(t)},[...Object.values(t),a.nodes.open]),S.useImperativeHandle(e,()=>l),S.useEffect(()=>{l.props.selection?l.select(l.props.selection,{focus:!1}):l.deselectAll()},[l.props.selection]),S.useEffect(()=>{l.props.searchTerm||o.current.dispatch(At.clear(!0))},[l.props.searchTerm]),s.jsx(Gn.Provider,{value:l,children:s.jsx(Xn.Provider,{value:c.current,children:s.jsx($n.Provider,{value:a.nodes,children:s.jsx(Yn.Provider,{value:a.dnd,children:s.jsx(Ua,Object.assign({backend:Sl,options:{rootElement:l.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:n}))})})})})}function Tl(t){return function(){const e=de(),[,n]=li(()=>({accept:"NODE",canDrop:(r,i)=>!!i.isOver({shallow:!0})&&e.canDrop(),hover:(r,i)=>{if(!i.isOver({shallow:!0}))return;const o=i.getClientOffset();if(!e.listEl.current||!o)return;const{cursor:a,drop:l}=Ii({element:e.listEl.current,offset:o,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});l&&e.dispatch(Le.hovering(l.parentId,l.index)),i.canDrop()?a&&e.showCursor(a):e.hideCursor()}}),[e]);n(e.listEl)}(),t.children}function El(){const t=de().props.renderContainer||Oi;return s.jsx(s.Fragment,{children:s.jsx(t,{})})}function _l(){const t=de(),{offset:e,mouse:n,item:r,isDragging:i}=(o=h=>({offset:h.getSourceClientOffset(),mouse:h.getClientOffset(),item:h.getItem(),isDragging:h.isDragging()}),a=De().getMonitor(),l=hl(ri(a,o),2),c=l[0],u=l[1],S.useEffect(function(){return a.subscribeToOffsetChange(u)}),S.useEffect(function(){return a.subscribeToStateChange(u)}),c);var o,a,l,c,u;const d=t.props.renderDragPreview||mr;return s.jsx(d,{offset:e,mouse:n,id:(r==null?void 0:r.id)||null,dragIds:(r==null?void 0:r.dragIds)||[],isDragging:i})}class _i{constructor(e){this.root=function(n){const r=new Pi({id:"ROOT"},null);return r.children=n.map(i=>gn(i,r)),r}(e)}get data(){var e,n;return(n=(e=this.root.children)===null||e===void 0?void 0:e.map(r=>r.data))!==null&&n!==void 0?n:[]}create(e){const n=e.parentId?this.find(e.parentId):this.root;if(!n)return null;n.addChild(e.data,e.index)}move(e){const n=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;n&&r&&(r.addChild(n.data,e.index),n.drop())}update(e){const n=this.find(e.id);n&&n.update(e.changes)}drop(e){const n=this.find(e.id);n&&n.drop()}find(e,n=this.root){if(!n)return null;if(n.id===e)return n;if(n.children){for(let r of n.children){const i=this.find(e,r);if(i)return i}return null}return null}}function gn(t,e){const n=new Pi(t,e);return t.children&&(n.children=t.children.map(r=>gn(r,n))),n}class Pi{constructor(e,n){this.data=e,this.parent=n,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,n){var r,i;const o=gn(e,this);this.children=(r=this.children)!==null&&r!==void 0?r:[],this.children.splice(n,0,o),this.data.children=(i=this.data.children)!==null&&i!==void 0?i:[],this.data.children.splice(n,0,e)}removeChild(e){var n,r;(n=this.children)===null||n===void 0||n.splice(e,1),(r=this.data.children)===null||r===void 0||r.splice(e,1)}update(e){if(this.hasParent()){const n=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),n),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let Pl=0;function Al(t){if(t.initialData&&t.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(t.initialData&&(t.onCreate||t.onDelete||t.onMove||t.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
16
16
  Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,n]=function(r){const[i,o]=S.useState(r),a=S.useMemo(()=>new _i(i),[i]);return[i,{onMove:c=>{for(const u of c.dragIds)a.move({id:u,parentId:c.parentId,index:c.index});o(a.data)},onRename:({name:c,id:u})=>{a.update({id:u,changes:{name:c}}),o(a.data)},onCreate:({parentId:c,index:u,type:d})=>{const h={id:"simple-tree-id-"+Pl++,name:""};return d==="internal"&&(h.children=[]),a.create({parentId:c,index:u,data:h}),o(a.data),h},onDelete:c=>{c.ids.forEach(u=>a.drop({id:u})),o(a.data)}}]}(t.initialData);return Object.assign(Object.assign(Object.assign({},t),n),{data:e})}return t}const Ml=S.forwardRef(function(t,e){const n=Al(t);return s.jsxs(Dl,{treeProps:n,imperativeHandle:e,children:[s.jsx(Tl,{children:s.jsx(El,{})}),s.jsx(_l,{})]})});function Rl(t,e){const n=J.c(11),{delayMs:r,whenVisible:i,disabled:o}=e,a=o!==void 0&&o,l=S.useRef(void 0);let c,u,d,h,y;return n[0]!==t?(c=()=>{l.current=t},u=[t],n[0]=t,n[1]=c,n[2]=u):(c=n[1],u=n[2]),S.useEffect(c,u),n[3]!==r||n[4]!==a||n[5]!==i?(d=()=>{if(r===null||a)return;const g=setInterval(()=>{var f;i&&document.visibilityState!=="visible"||((f=l.current)==null||f.call(l))},r);return()=>clearInterval(g)},h=[r,i,a],n[3]=r,n[4]=a,n[5]=i,n[6]=d,n[7]=h):(d=n[6],h=n[7]),S.useEffect(d,h),n[8]!==a||n[9]!==i?(y=()=>{var g;document.visibilityState==="visible"&&i&&!a&&((g=l.current)==null||g.call(l))},n[8]=a,n[9]=i,n[10]=y):y=n[10],ss(document,"visibilitychange",y),null}function Ll(){return["compact","medium","full","columns"]}const Fl=t=>{const e=J.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:n}),e[0]=n,e[1]=r):r=e[1],r},Ai=t=>{const e=J.c(10);let n,r,i,o,a;return e[0]!==t?({children:n,className:r,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]),e[4]!==r?(o=St("text-base font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",r),e[4]=r,e[5]=o):o=e[5],e[6]!==n||e[7]!==i||e[8]!==o?(a=s.jsx("div",{...i,className:o,children:n}),e[6]=n,e[7]=i,e[8]=o,e[9]=a):a=e[9],a},Hl=t=>{const e=J.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r},Mi=[{label:"Auto (Default)",value:"auto"},{label:"Native",value:"native"},{label:"Polars",value:"polars"},{label:"Lazy Polars",value:"lazy-polars"},{label:"Pandas",value:"pandas"}],zl=()=>{const t=J.c(30),[e,n]=os();let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=xn(as),t[0]=r):r=t[0],t[1]!==e?(i={resolver:r,defaultValues:e},t[1]=e,t[2]=i):i=t[2];const o=bn(i);let a;t[3]!==n?(a=async b=>{await ls({config:b}).then(()=>{n(b)}).catch(()=>{n(b)})},t[3]=n,t[4]=a):a=t[4];const l=a;let c,u,d,h,y,g,f,p,v,x;return t[5]!==e.width?(c=[e.width],t[5]=e.width,t[6]=c):c=t[6],S.useEffect(Ul,c),t[7]!==o||t[8]!==l?(u=o.handleSubmit(l),t[7]=o,t[8]=l,t[9]=u):u=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs("div",{children:[s.jsx(Fl,{children:"Notebook Settings"}),s.jsx(Hl,{children:"Configure how your notebook or application looks and behaves."})]}),t[10]=d):d=t[10],t[11]!==o.control?(h=s.jsxs(yt,{title:"Display",children:[s.jsx(T,{control:o.control,name:"width",render:Bl}),s.jsx(T,{control:o.control,name:"app_title",render:Vl})]}),t[11]=o.control,t[12]=h):h=t[12],t[13]!==o.control?(y=s.jsxs(yt,{title:"Custom Files",children:[s.jsx(T,{control:o.control,name:"css_file",render:Wl}),s.jsx(T,{control:o.control,name:"html_head_file",render:Kl})]}),t[13]=o.control,t[14]=y):y=t[14],t[15]!==o.control?(g=s.jsx(yt,{title:"Data",children:s.jsx(T,{control:o.control,name:"sql_output",render:$l})}),t[15]=o.control,t[16]=g):g=t[16],t[17]!==o.control?(f=s.jsx(yt,{title:"Exporting outputs",children:s.jsx(T,{control:o.control,name:"auto_download",render:Yl})}),t[17]=o.control,t[18]=f):f=t[18],t[19]!==h||t[20]!==y||t[21]!==g||t[22]!==f?(p=s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[h,y,g,f]}),t[19]=h,t[20]=y,t[21]=g,t[22]=f,t[23]=p):p=t[23],t[24]!==p||t[25]!==u?(v=s.jsxs("form",{onChange:u,className:"flex flex-col gap-6",children:[d,p]}),t[24]=p,t[25]=u,t[26]=v):v=t[26],t[27]!==o||t[28]!==v?(x=s.jsx(jn,{...o,children:v}),t[27]=o,t[28]=v,t[29]=x):x=t[29],x},yt=t=>{const e=J.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx("h3",{className:"text-base font-semibold mb-1",children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-y-2",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function Ul(){window.dispatchEvent(new Event("resize"))}function ql(t){return s.jsx("option",{value:t,children:t},t)}function Bl(t){const{field:e}=t;return s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(N,{children:"Width"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"app-width-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(ql)})}),s.jsx(A,{})]})}function Vl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(N,{children:"App title"}),s.jsx(_,{children:s.jsx(oe,{...e,value:e.value??"",onChange:n=>{e.onChange(n.target.value),wn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(A,{})]}),s.jsx(z,{children:"The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window."})]})}function Wl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(N,{className:"flex-shrink-0",children:"Custom CSS"}),s.jsx(_,{children:s.jsx(oe,{...e,value:e.value??"",placeholder:"custom.css",onChange:n=>{e.onChange(n.target.value),wn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(A,{})]}),s.jsx(z,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function Kl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(N,{className:"flex-shrink-0",children:"HTML Head"}),s.jsx(_,{children:s.jsx(oe,{...e,value:e.value??"",placeholder:"head.html",onChange:n=>{e.onChange(n.target.value)}})}),s.jsx(A,{})]}),s.jsxs(z,{children:["A filepath to an HTML file to be injected into the"," ",s.jsx(xe,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function Gl(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function $l(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(N,{children:"SQL Output Type"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"sql-output-select",onChange:n=>{e.onChange(n.target.value),Pe({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:Mi.map(Gl)})}),s.jsx(A,{})]}),s.jsxs(z,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",s.jsx(xe,{className:"inline",children:"native"}),". See the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}function Yl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:"flex flex-col gap-2",children:[s.jsx(_,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(fe,{id:"html-checkbox",checked:e.value.includes("html"),onCheckedChange:()=>{e.onChange(In(e.value,"html"))}}),s.jsx(N,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(fe,{id:"ipynb-checkbox",checked:e.value.includes("ipynb"),onCheckedChange:()=>{e.onChange(In(e.value,"ipynb"))}}),s.jsx(N,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(A,{})]}),s.jsxs(z,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(xe,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}const Xl=Sn("flex items-center justify-center m-0 leading-none font-medium border border-foreground/10 shadow-xsSolid hover:cursor-pointer active:shadow-none dark:border-border text-sm",{variants:{color:{gray:"mo-button gray",white:"mo-button white",green:"mo-button green",red:"mo-button red",yellow:"mo-button yellow","hint-green":"mo-button hint-green",disabled:"mo-button disabled active:shadow-xsSolid"},shape:{rectangle:"rounded",circle:"rounded-full"},size:{small:"",medium:""}},compoundVariants:[{size:"small",shape:"circle",class:"h-[24px] w-[24px] px-[5.5px] py-[5.5px]"},{size:"medium",shape:"circle",class:"px-2 py-2"},{size:"small",shape:"rectangle",class:"px-1 py-1 h-[24px] w-[24px]"},{size:"medium",shape:"rectangle",class:"px-3 py-2"}],defaultVariants:{color:"gray",size:"medium",shape:"rectangle"}}),Ql=Sn("font-mono w-full flex-1 inline-flex items-center justify-center rounded px-2.5 text-foreground/60 h-[36px] hover:shadow-md hover:cursor-pointer focus:shadow-md focus:outline-none text-[hsl(0, 0%, 43.5%)] bg-transparent hover:bg-background focus:bg-background"),xt=ze.forwardRef((t,e)=>{const n=J.c(15);let r,i,o,a,l,c,u;return n[0]!==t?({color:i,shape:a,size:l,className:r,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=a,n[5]=l):(r=n[1],i=n[2],o=n[3],a=n[4],l=n[5]),n[6]!==r||n[7]!==i||n[8]!==a||n[9]!==l?(c=On(Xl({color:i,shape:a,size:l}),r),n[6]=r,n[7]=i,n[8]=a,n[9]=l,n[10]=c):c=n[10],n[11]!==o||n[12]!==e||n[13]!==c?(u=s.jsx("button",{ref:e,className:c,...o,children:o.children}),n[11]=o,n[12]=e,n[13]=c,n[14]=u):u=n[14],u});xt.displayName="Button",ze.forwardRef((t,e)=>{const n=J.c(9);let r,i,o,a;return n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]),n[3]!==r?(o=On(Ql(),r),n[3]=r,n[4]=o):o=n[4],n[5]!==i||n[6]!==e||n[7]!==o?(a=s.jsx("input",{ref:e,className:o,...i}),n[5]=i,n[6]=e,n[7]=o,n[8]=a):a=n[8],a}).displayName="Input";var Jl=cs();const Ri="marimo:copilot:signedIn",Li=hs(Ri,null,void 0,{getOnInit:!0}),Fi=Ue(null),bt=Ue(null);function Hi(){const t=localStorage.getItem(Ri)==="true",e=us();return t&&e.completion.copilot==="github"}const ye=B.get("@github/copilot-language-server");class Zl extends fs{constructor(...e){super(...e),this.documentVersion=0,this.hasOpenedDocument=!1,this.getCompletionInternal=async(n,r)=>await this._request("textDocument/inlineCompletion",{...n,textDocument:{...n.textDocument,version:r}}),this.throttledGetCompletionInternal=function(n,r,i){var o=!0,a=!0;if(typeof n!="function")throw new TypeError("Expected a function");return ts(i)&&(o="leading"in i?!!i.leading:o,a="trailing"in i?!!i.trailing:a),ns(n,r,{leading:o,maxWait:r,trailing:a})}(this.getCompletionInternal,200)}async _request(e,n){try{return await this.request(e,n)}catch(r){throw ye.error("#request: Error",r),r}}async notify(e,n){return ye.debug("#notify",e,n),super.notify(e,n)}getInitializationOptions(){const e={name:"marimo",version:"0.1.0"};return{...super.getInitializationOptions(),workspaceFolders:[],capabilities:{workspace:{workspaceFolders:!1}},initializationOptions:{editorInfo:e,editorPluginInfo:e}}}isDisabled(){return!Hi()}async textDocumentDidOpen(e){return this.isDisabled()?e:(this.hasOpenedDocument=!0,super.textDocumentDidOpen(e))}async textDocumentCompletion(e){return[]}async textDocumentDidChange(e){if(this.isDisabled())return e;this.hasOpenedDocument||await this.textDocumentDidOpen({textDocument:{uri:e.textDocument.uri,languageId:"python",version:e.textDocument.version,text:e.contentChanges[0].text}});const n=e.contentChanges;n.length!==1&&ye.warn("#textDocumentDidChange: Multiple changes detected. This is not supported.",n);const r=n[0];"range"in r&&ye.warn("#textDocumentDidChange: Copilot doesn't support range changes.",r);const i=ps(r.text);return super.textDocumentDidChange({...e,contentChanges:[{text:i}],textDocument:gs.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return Promise.resolve({contents:[]})}signOut(){return this._request("signOut",{})}async signInInitiate(){ye.log("#signInInitiate: Starting sign-in flow");try{const e=await this._request("signIn",{});return ye.log("#signInInitiate: Sign-in flow started successfully"),e}catch(e){throw ye.warn("#signInInitiate: Failed to start sign-in flow",e),e}}async signInConfirm(e){ye.log("#signInConfirm: Confirming sign-in");try{const n=await this._request("signInConfirm",e);return ye.log("#signInConfirm: Sign-in confirmed successfully"),n}catch(n){throw ye.warn("#signInConfirm: Failed to confirm sign-in",n),n}}async signedIn(){try{const{status:e}=await this._request("checkStatus",{});return ye.log("#checkStatus: Status check completed",{status:e}),e==="SignedIn"||e==="AlreadySignedIn"||e==="OK"}catch(e){throw ye.warn("#signedIn: Failed to check sign-in status",e),e}}async getCompletion(e){if(this.isDisabled())return null;const n=this.documentVersion;if(e.textDocument.version=n,n===0)return null;var r;r=n,et.set(bt,r);const i=await this.throttledGetCompletionInternal(e,n);var o;return o=n,et.get(bt)===o&&et.set(bt,null),n!==this.documentVersion?null:i??null}}const zi="/__marimo_copilot__.py",Ui=`file://${zi}`,ec=Ae(()=>new tc);class tc extends Jl.Transport{constructor(){super(),this.delegate=void 0,this.delegate=void 0}getWsUrl(){return vs().getLSPURL("copilot").toString()}async tryConnect(e=3,n=1e3){for(let r=1;r<=e;r++)try{return this.delegate||(this.delegate=new ys.WebSocketTransport(this.getWsUrl())),await this.delegate.connect(),void B.log("Copilot#connect: Connected successfully")}catch(i){if(B.warn(`Copilot#connect: Connection attempt ${r}/${e} failed`,i),r===e)throw this.delegate=void 0,Pe({variant:"danger",title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Please check settings and try again."}),i;await new Promise(o=>setTimeout(o,n))}}async connect(){return await ds(kn,e=>e.completion.copilot==="github"),await xs(),this.tryConnect()}close(){var e;(e=this.delegate)==null||e.close(),this.delegate=void 0}async sendData(e,n){var r;return n=Math.min(n??5e3,5e3),(r=this.delegate)==null?void 0:r.sendData(e,n)}}const Xe=Ae(()=>new Zl({rootUri:Ui,workspaceFolders:null,transport:ec()}));function nc(){return ms({documentUri:Ui,client:Xe(),languageId:"copilot",hoverEnabled:!1,completionEnabled:!1,definitionEnabled:!1,renameEnabled:!1,codeActionsEnabled:!1,signatureHelpEnabled:!1,diagnosticsEnabled:!1,sendIncrementalChanges:!1})}const qi=S.memo(()=>{const[t,e]=qe(Li),[n,r]=qe(Fi),[i,o]=S.useState(),[a,l]=S.useState(!1),c=async h=>{h.preventDefault(),l(!0);try{const{verificationUri:y,status:g,userCode:f}=await async function(){return await Xe().signInInitiate()}();Wi(g)?e(!0):(r("signingIn"),o({url:y,code:f}))}finally{l(!1)}},u=async h=>{if(h.preventDefault(),i){l(!0);try{const y=await async function(g){const f=Xe();try{B.log("Copilot#tryFinishSignIn: Attempting to confirm sign-in");const{status:p}=await f.signInConfirm({userCode:g});return Wi(p)?(B.log("Copilot#tryFinishSignIn: Sign-in confirmed successfully"),{success:!0}):(B.warn("Copilot#tryFinishSignIn: Sign-in confirmation returned unexpected status",{status:p}),{success:!1})}catch(p){return Vi(p)?(B.error("Copilot#tryFinishSignIn: Connection error during sign-in",p),{success:!1,error:"connection"}):await async function(v){for(let x=0;x<Bi;x++)try{if(await new Promise(b=>setTimeout(b,rc)),await v.signedIn())return B.log("Copilot#tryFinishSignIn: Successfully signed in after retry"),{success:!0}}catch(b){if(B.warn("Copilot#tryFinishSignIn: Retry attempt failed",{attempt:x+1,maxRetries:Bi}),Vi(b))return{success:!1,error:"connection"}}return B.error("Copilot#tryFinishSignIn: All sign-in attempts failed"),{success:!1}}(f)}}(i.code);y.success?(e(!0),r("signedIn")):y.error==="connection"?(r("connectionError"),Pe({title:"GitHub Copilot Connection Error",description:"Lost connection during sign-in. Please try again.",variant:"danger",action:s.jsx(pe,{onClick:c,children:"Retry"})})):r("signInFailed")}finally{l(!1)}}},d=async h=>{h.preventDefault(),await async function(){await Xe().signOut()}(),e(!1),r("signedOut")};return(()=>{switch(n??(t?"signedIn":"connecting")){case"connecting":return s.jsx(tt,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return s.jsx(pe,{onClick:c,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return s.jsxs("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[s.jsx("li",{children:s.jsxs("div",{className:"flex items-center",children:["Copy this code:",s.jsx("strong",{className:"ml-2",children:i==null?void 0:i.code}),s.jsx(js,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{i&&(await ws(i.code),Pe({description:"Copied to clipboard"}))}})]})}),s.jsxs("li",{children:["Enter the code at this link:",s.jsx("a",{href:i==null?void 0:i.url,target:"_blank",rel:"noreferrer",className:Is({variant:"link",size:"xs"}),children:i==null?void 0:i.url})]}),s.jsxs("li",{children:["Click here when done:",s.jsxs(pe,{size:"xs",onClick:u,className:"ml-1",children:[a&&s.jsx(Cn,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),a?s.jsx(Cn,{className:"h-3 w-3 mr-1 animate-spin"}):s.jsx(pe,{onClick:c,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return s.jsxs("div",{className:"flex items-center gap-5",children:[s.jsxs(tt,{className:"font-normal flex items-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center bg-[var(--grass-7)] rounded-full p-1 mr-2",children:s.jsx(bs,{className:"h-3 w-3 text-white"})}),"Connected"]}),s.jsx(pe,{onClick:d,size:"xs",variant:"text",children:"Disconnect"})]});case"connectionError":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(tt,{className:"font-normal flex",children:[s.jsx(nt,{className:"h-4 w-4 mr-1"}),"Connection Error"]}),s.jsx("div",{className:"text-sm",children:"Unable to connect to GitHub Copilot."}),s.jsx(pe,{onClick:c,size:"xs",variant:"link",children:"Retry Connection"})]});case"notConnected":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(tt,{className:"font-normal flex",children:[s.jsx(nt,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),s.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",s.jsx(ue,{href:"https://docs.marimo.io/getting_started/index.html#github-copilot",children:"docs"}),"."]})]})}})()});qi.displayName="CopilotConfig";const Bi=5,rc=3e3;function Vi(t){return t instanceof Error&&(t.message.includes("ECONNREFUSED")||t.message.includes("WebSocket")||t.message.includes("network"))}function Wi(t){return t==="SignedIn"||t==="AlreadySignedIn"||t==="OK"}let jt=null;class ic{constructor(e){this.view=void 0,this.abortController=new AbortController,this.view=e.view,this.view.dom.addEventListener("focus",()=>{jt=new WeakRef(this.view)},{signal:this.abortController.signal,capture:!0}),this.update()}update(){const e=this.view.dom.querySelector(".cm-vimCursorLayer");if(e instanceof HTMLElement){const n=(jt==null?void 0:jt.deref())===this.view;e.style.display=n?"":"none"}}destroy(){this.abortController.abort()}}const Ki={map:{args:["lhs","rhs"]},nmap:{mode:"normal",args:["lhs","rhs"]},vmap:{mode:"visual",args:["lhs","rhs"]},imap:{mode:"insert",args:["lhs","rhs"]},noremap:{args:["lhs","rhs"]},nnoremap:{mode:"normal",args:["lhs","rhs"]},vnoremap:{mode:"visual",args:["lhs","rhs"]},inoremap:{mode:"insert",args:["lhs","rhs"]},unmap:{args:["lhs"]},nunmap:{mode:"normal",args:["lhs"]},vunmap:{mode:"visual",args:["lhs"]},iunmap:{mode:"insert",args:["lhs"]},mapclear:{},nmapclear:{mode:"normal"},vmapclear:{mode:"visual"},imapclear:{mode:"insert"}};function sc(t,e){const n=t.split(/\s+/),r=n[0];let i=0;if(r in Ki){const o=Ki[r],a={};for(const c of o.args||[]){if(i+=1,!(i<n.length))return void(e&&e(`Not enough arguments for "${r}" command: "${t}"`));a[c]=n[i]}const l={name:r};return"args"in o&&(l.args=a),"mode"in o&&(l.mode=o.mode),l}e&&e(`Unknown vimrc command: "${t}"`)}var Gi;const oc=Ae(()=>{X.defineAction("goToDefinition",t=>{const e=t.cm6;return ks(e)}),X.mapCommand("gd","action","goToDefinition",{},{context:"normal"}),X.defineEx("write","w",t=>{const e=t.cm6;e&&e.state.facet(rt).saveNotebook()})}),ac=Ae(async()=>{var n;const t=et.get(kn),e=(n=t.keymap)==null?void 0:n.vimrc;if(e)try{B.log(`Loading vimrc from ${e}`);const r=(await Cs({path:e})).contents;if(!r)return void B.error(`Failed to load vimrc from ${e}`);const i=function(o,a){const l=[];for(const c of o.split(`
17
- `)){if(c.startsWith('"')||c.trim()==="")continue;const u=sc(c,a);u&&l.push(u)}return l}(r,B.warn);(function(o){function a(d){d.args&&d.args.lhs&&d.args.rhs?d.mode?X.map(d.args.lhs,d.args.rhs,d.mode):X.map(d.args.lhs,d.args.rhs):B.warn(`Could not execute vimrc command "${d.name}: expected arguments"`)}function l(d){d.args&&d.args.lhs&&d.args.rhs?d.mode?X.noremap(d.args.lhs,d.args.rhs,d.mode):X.noremap(d.args.lhs,d.args.rhs):B.warn(`Could not execute vimrc command "${d.name}: expected arguments"`)}function c(d){d.args&&d.args.lhs?d.mode?X.unmap(d.args.lhs,d.mode):X.unmap(d.args.lhs):B.warn(`Could not execute vimrc command "${d.name}: expected arguments"`)}function u(d){d.mode?X.mapclear(d.mode):X.mapclear()}for(const d of o)"map|nmap|vmap|imap".split("|").includes(d.name)?a(d):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(d.name)?l(d):"unmap|nunmap|vunmap|iunmap".split("|").includes(d.name)?c(d):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(d.name)?u(d):B.warn(`Could not execute vimrc command "${d.name}: unknown command"`)})(i)}catch(r){B.error("Failed to load vimrc:",r)}});class wt{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=it(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(Ot("mode"in r,'Expected event to have a "mode" property'),this.isBroadcasting=!0,i=()=>{this.broadcastModeChange(e,r.mode,r.subMode),this.isBroadcasting=!1},"scheduler"in window?window.scheduler.postTask(i,{priority:"background"}):"requestIdleCallback"in window?requestIdleCallback(i):setTimeout(i,0))}):B.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,n,r){Ot("exitInsertMode"in X,"Vim does not have an exitInsertMode method"),Ot("exitVisualMode"in X,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=it(i);if(!o){B.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const a=o.setSelections.bind(o);if(o.setSelections=()=>[],!$i(o)){B.warn("Expected CodeMirror instance to have Vim state");continue}const l=o.state.vim;switch(n){case"normal":l.insertMode&&X.exitInsertMode(o,!0),l.visualMode&&X.exitVisualMode(o,!0);break;case"insert":l.insertMode||X.handleKey(o,"i","")}o.setSelections=a}}}function $i(t){return t.state.vim!==void 0}Gi=wt,wt.INSTANCES=new Gi;const lc=["default","vim"];function cc(t,e){switch(t.preset){case"default":return[je.of(Yi()),je.of(Xi(e)),kt.low(je.of([{key:"Escape",preventDefault:!0,run:n=>(n.contentDOM.blur(),!0)}]))];case"vim":return[je.of(dc()),je.of(Xi(e)),je.of([{key:"Enter",run:n=>{var i;const r=it(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&Ts(n)}}]),kt.high(hc("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(rt).deleteCell(),!0):!1)),Ds({status:!1}),kt.high((oc(),ac(),[je.of([{key:"j",run:n=>{if(Ss(n,!0)&&Dn(n)){const r=n.state.facet(rt),i=n.state.facet(Tn);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),je.of([{key:"k",run:n=>{if(Os(n)&&Dn(n)){const r=n.state.facet(rt),i=n.state.facet(Tn);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),je.of([{linux:"Ctrl-[",run:n=>{const r=it(n);return r?$i(r)?!!r.state.vim.insertMode&&(X.exitInsertMode(r,!0),!0):(B.warn("Expected CodeMirror instance to have Vim state"),!1):(B.warn("Expected CodeMirror instance to have CodeMirror instance state"),!1)}}]),Nn.define(n=>(requestAnimationFrame(()=>{wt.INSTANCES.addInstance(n)}),{destroy(){wt.INSTANCES.removeInstance(n)}})),Nn.define(n=>new ic({view:n}))]))];default:return Ns(t.preset),[]}}const uc=new Set([En,_n]),Yi=Ae(()=>Es.filter(t=>!uc.has(t.run))),Xi=t=>[{key:t.getHotkey("cell.toggleComment").key,run:En},{key:t.getHotkey("cell.toggleBlockComment").key,run:_n}],dc=Ae(()=>{const t=new Set(["Enter","Ctrl-v"]);return Yi().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function hc(t,e,n){let r="",i=0;return je.of([{any:(o,a)=>{const l=a.key,c=a.timeStamp;return l!==t||!e(o)?(r="",i=0,!1):r===t&&c-i<500&&n(o)?(r="",i=0,!0):(r=l,i=c,!1)}}])}const mn=Ue(!1),fc=()=>{const t=J.c(78),[e,n]=qe(mn),[r,i]=S.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[a,l]=S.useState(o),[c,u]=Pn(),d=st(_s);let h,y;t[1]!==n?(h=()=>n(pc),t[1]=n,t[2]=h):h=t[2],Ps("global.showHelp",h),t[3]!==c||t[4]!==u?(y=async Oe=>{const ie={...c};u(Oe),await An({config:Oe}).catch(W=>{throw u(ie),W})},t[3]=c,t[4]=u,t[5]=y):y=t[5];const g=y;let f;t[6]!==c||t[7]!==r||t[8]!==g?(f=async Oe=>{if(!r)return;const ie=Oe.join("-"),W={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides,[r]:ie}}};i(null),l([]),await g(W)},t[6]=c,t[7]=r,t[8]=g,t[9]=f):f=t[9];const p=f;let v,x,b;if(t[10]!==c||t[11]!==r||t[12]!==p||t[13]!==d||t[14]!==e||t[15]!==a||t[16]!==g){b=Symbol.for("react.early_return_sentinel");{const Oe=async()=>{if(!r)return;const W={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides}}};delete W.keymap.overrides[r],i(null),l([]),await g(W)};let ie;t[20]!==c||t[21]!==g?(ie=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const W={...c,keymap:{...c.keymap,overrides:{}}};i(null),l([]),await g(W)},t[20]=c,t[21]=g,t[22]=ie):ie=t[22],v=ie,e?x=W=>{const _e=d.getHotkey(W);if(r===W){const Ze=As(W);return s.jsxs("div",{children:[s.jsx(oe,{defaultValue:a.join("+"),placeholder:_e.name,onKeyDown:le=>{le.preventDefault();const ke=[];if(le.key==="Meta"||le.key==="Control"||le.key==="Alt"||le.key==="Shift"||(le.metaKey&&ke.push(Ms()?"Cmd":"Meta"),le.ctrlKey&&ke.push("Ctrl"),le.altKey&&ke.push("Alt"),le.shiftKey&&ke.push("Shift"),le.key==="-"))return;if(le.key==="Escape"&&ke.length===0)return i(null),void l([]);let yn=le.key.toLowerCase();le.key===" "&&(yn="Space"),ke.push(yn),p(ke)},autoFocus:!0,endAdornment:s.jsx(pe,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),l([])},children:s.jsx(nt,{className:"w-4 h-4"})})}),s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),Ze.key!==_e.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:Oe,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:Ze.key})]})]})]},W)}return s.jsxs("div",{className:"grid grid-cols-[auto,2fr,3fr] gap-2 items-center",children:[d.isEditable(W)?s.jsx(Mn,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),i(W)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx(Rs,{className:"justify-end",shortcut:_e.key}),s.jsx("span",{children:_e.name.toLowerCase()})]},W)}:b=null}t[10]=c,t[11]=r,t[12]=p,t[13]=d,t[14]=e,t[15]=a,t[16]=g,t[17]=v,t[18]=x,t[19]=b}else v=t[17],x=t[18],b=t[19];if(b!==Symbol.for("react.early_return_sentinel"))return b;const j=x;let O,k,C,P,L,H,U,q,te,ae,$,ne,K,Y,re,se,w,m,I,V,Ie,Te,Ee,Je;if(t[23]!==d||t[24]!==e||t[25]!==j||t[26]!==n){const Oe=d.getHotkeyGroups(),ie=W=>{const _e=Oe[W];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsx("h3",{className:"text-lg font-medium",children:W}),_e.map(Ze=>j(Ze))]})};C=Ct,ne=e,t[44]!==n?(K=W=>n(W),t[44]=n,t[45]=K):K=t[45],k=Ls,ae="sm:items-center sm:top-0",t[46]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(Fs,{}),t[46]=$):$=t[46],O=Rn,U=!1,q="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[47]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx(Hs,{children:s.jsx(zs,{children:"Shortcuts"})}),t[47]=te):te=t[47],L="flex flex-row gap-3",H=s.jsxs("div",{className:"w-1/2",children:[ie("Editing"),ie("Markdown")]}),Y="w-1/2",re=ie("Navigation"),se=ie("Running Cells"),w=ie("Creation and Ordering"),P=ie("Other"),t[23]=d,t[24]=e,t[25]=j,t[26]=n,t[27]=O,t[28]=k,t[29]=C,t[30]=P,t[31]=L,t[32]=H,t[33]=U,t[34]=q,t[35]=te,t[36]=ae,t[37]=$,t[38]=ne,t[39]=K,t[40]=Y,t[41]=re,t[42]=se,t[43]=w}else O=t[27],k=t[28],C=t[29],P=t[30],L=t[31],H=t[32],U=t[33],q=t[34],te=t[35],ae=t[36],$=t[37],ne=t[38],K=t[39],Y=t[40],re=t[41],se=t[42],w=t[43];return t[48]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[48]=m):m=t[48],t[49]!==v?(I=s.jsx(pe,{className:"mt-4 hover:bg-destructive/10 hover:border-destructive",variant:"outline",size:"xs",onClick:v,tabIndex:-1,children:m}),t[49]=v,t[50]=I):I=t[50],t[51]!==P||t[52]!==I||t[53]!==Y||t[54]!==re||t[55]!==se||t[56]!==w?(V=s.jsxs("div",{className:Y,children:[re,se,w,P,I]}),t[51]=P,t[52]=I,t[53]=Y,t[54]=re,t[55]=se,t[56]=w,t[57]=V):V=t[57],t[58]!==L||t[59]!==H||t[60]!==V?(Ie=s.jsxs("div",{className:L,children:[H,V]}),t[58]=L,t[59]=H,t[60]=V,t[61]=Ie):Ie=t[61],t[62]!==O||t[63]!==U||t[64]!==q||t[65]!==te||t[66]!==Ie?(Te=s.jsxs(O,{usePortal:U,className:q,children:[te,Ie]}),t[62]=O,t[63]=U,t[64]=q,t[65]=te,t[66]=Ie,t[67]=Te):Te=t[67],t[68]!==k||t[69]!==ae||t[70]!==$||t[71]!==Te?(Ee=s.jsxs(k,{className:ae,children:[$,Te]}),t[68]=k,t[69]=ae,t[70]=$,t[71]=Te,t[72]=Ee):Ee=t[72],t[73]!==C||t[74]!==ne||t[75]!==K||t[76]!==Ee?(Je=s.jsx(C,{open:ne,onOpenChange:K,children:Ee}),t[73]=C,t[74]=ne,t[75]=K,t[76]=Ee,t[77]=Je):Je=t[77],Je};function pc(t){return!t}const Qi=["claude-opus-4-20250514","claude-sonnet-4-20250514","claude-3-7-sonnet-latest","claude-3-5-sonnet-latest","claude-3-5-haiku-latest","deepseek-v3","deepseek-r1","gemini-2.5-flash-preview-05-20","gemini-2.5-pro-preview-06-05","gemini-2.0-flash","gemini-2.0-flash-lite","o3","o4-mini","gpt-4.5-preview","gpt-4.1","gpt-4o","gpt-3.5-turbo","bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0","bedrock/anthropic.claude-3-sonnet-20240229","bedrock/anthropic.claude-3-haiku-20240307","bedrock/meta.llama3-8b-instruct-v1:0","bedrock/amazon.titan-text-express-v1","bedrock/us.amazon.nova-pro-v1:0","bedrock/cohere.command-r-plus-v1","bedrock/ai21.j2-ultra-v1"],gc=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"],Ji=[{id:"sql",packagesRequired:[{name:"duckdb"},{name:"sqlglot"}],additionalPackageInstalls:[{name:"polars[pyarrow]"}],description:"SQL cells"},{id:"charts",packagesRequired:[{name:"altair"}],additionalPackageInstalls:[],description:"Charts in datasource viewer"},{id:"fast-charts",packagesRequired:[{name:"vegafusion"},{name:"vl-convert-python"}],additionalPackageInstalls:[],description:"Fast server-side charts"},{id:"formatting",packagesRequired:[Be()?{name:"black"}:{name:"ruff"}],additionalPackageInstalls:[],description:"Formatting"},{id:"ai",packagesRequired:[{name:"openai"}],additionalPackageInstalls:[],description:"AI features"},{id:"ipy-export",packagesRequired:[{name:"nbformat"}],additionalPackageInstalls:[],description:"Export as IPYNB"},{id:"testing",packagesRequired:[{name:"pytest"}],additionalPackageInstalls:[],description:"Autorun unit tests"}];Be()||Ji.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const mc=()=>{const t=J.c(21),[e]=Pn(),n=e.package_management.manager;let r;t[0]!==n?(r=[n],t[0]=n,t[1]=r):r=t[1];const{data:i,error:o,refetch:a,isPending:l}=Us(yc,r);if(l){let j;return t[2]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Fn,{size:"medium",centered:!0}),t[2]=j):j=t[2],j}if(o){let j;return t[3]!==o?(j=s.jsx(Ws,{error:o}),t[3]=o,t[4]=j):j=t[4],j}let c;t[5]!==(i==null?void 0:i.packages)?(c=(i==null?void 0:i.packages)||[],t[5]=i==null?void 0:i.packages,t[6]=c):c=t[6];const u=c;let d;t[7]!==u?(d=new Set(u.map(xc)),t[7]=u,t[8]=d):d=t[8];const h=d;let y,g,f,p,v,x,b;return t[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Ai,{children:"Optional Features"}),t[9]=y):y=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["marimo is lightweight, with few dependencies, to maximize compatibility with your own environments.",s.jsx("br",{}),"To unlock additional features in the marimo editor, you can install these optional dependencies:"]}),t[10]=g):g=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ks,{children:s.jsxs(Ln,{children:[s.jsx(ot,{children:"Dependency"}),s.jsx(ot,{children:"Feature"}),s.jsx(ot,{children:"Status"}),s.jsx(ot,{})]})}),t[11]=f):f=t[11],t[12]!==h||t[13]!==n||t[14]!==a?(p=Ji.map(j=>{const O=j.packagesRequired.every(C=>h.has(C.name.split("[")[0])),k=j.packagesRequired.map(bc).join(", ");return s.jsxs(Ln,{className:"text-sm",children:[s.jsx(Nt,{children:j.description}),s.jsx(Nt,{className:"font-mono text-xs",children:k}),s.jsx(Nt,{children:O?s.jsxs("div",{className:"flex items-center",children:[s.jsx(Bn,{className:"h-4 w-4 text-[var(--grass-10)] mr-2"}),s.jsx("span",{children:"Installed"})]}):s.jsxs("div",{className:"flex items-center",children:[s.jsx(qs,{className:"h-4 w-4 text-[var(--red-10)] mr-2"}),s.jsx(vc,{packageSpecs:[...j.packagesRequired,...j.additionalPackageInstalls],packageManager:n,onSuccess:a})]})})]},j.id)}),t[12]=h,t[13]=n,t[14]=a,t[15]=p):p=t[15],t[16]!==p?(v=s.jsxs(Gs,{children:[f,s.jsx($s,{children:p})]}),t[16]=p,t[17]=v):v=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("p",{className:"text-muted-foreground mt-2",children:"*Requires server restart"}),t[18]=x):x=t[18],t[19]!==v?(b=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[y,g,v,x]}),t[19]=v,t[20]=b):b=t[20],b},vc=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=ze.useState(!1);return s.jsxs(pe,{size:"xs",variant:"outline",className:St("text-xs",r&&"opacity-50 cursor-not-allowed"),onClick:async()=>{try{i(!0);const o=t.map(l=>l.minVersion?`${l.name}>=${l.minVersion}`:l.name).join(" "),a=await Vs({package:o});a.success?(n(),Pe({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(xe,{className:"inline",children:t.map(l=>l.name).join(", ")})," ","have been added to your environment."]})})):Pe({title:"Failed to install package",description:a.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(Fn,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(qn,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function yc(){return Bs()}function xc(t){return t.name}function bc(t){return t.name}const R="flex flex-row items-center space-x-1 space-y-0",Zi=[{id:"editor",label:"Editor",Icon:Mn,className:"bg-[var(--blue-4)]"},{id:"display",label:"Display",Icon:Oo,className:"bg-[var(--grass-4)]"},{id:"packageManagement",label:"Package Management",Icon:ko,className:"bg-[var(--red-4)]"},{id:"runtime",label:"Runtime",Icon:Vn,className:"bg-[var(--amber-4)]"},{id:"ai",label:"AI",Icon:xo,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:Wn,className:"bg-[var(--orange-4)]"},{id:"labs",label:"Labs",Icon:bo,className:"bg-[var(--slate-4)]"}],es=Ue(Zi[0].id),jc=()=>{const t=J.c(48),[e,n]=Ys(),r=S.useRef(null),i=Dt(mn),[o,a]=qe(es),l=st(Xs),c=st(Qs);let u,d;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=xn(Js),t[0]=u):u=t[0],t[1]!==e?(d={resolver:u,defaultValues:e},t[1]=e,t[2]=d):d=t[2];const h=bn(d);let y;t[3]!==n?(y=async w=>{await An({config:w}).then(()=>{n(w)})},t[3]=n,t[4]=y):y=t[4];const g=y;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=Be(),t[5]=f):f=t[5];const p=f;let v;t[6]!==e||t[7]!==h?(v=()=>{const w=h.getValues("completion.copilot");return w===!1?null:w==="codeium"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Codeium API key, follow"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#codeium-copilot",children:"these instructions"}),"."]}),s.jsx(T,{control:h.control,name:"completion.codeium_api_key",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"codeium-api-key-input",className:"m-0 inline-flex",placeholder:"key",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.codeium_api_key"})]})}})]}):w==="github"?s.jsx(qi,{}):w==="custom"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm text-muted-secondary",children:"Configure your custom AI completion provider with the following settings."}),s.jsx(T,{control:h.control,name:"completion.model",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Model"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"custom-model-input",className:"m-0 inline-flex",placeholder:"Qwen2.5-Coder-7B",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.model"})]})}}),s.jsx(T,{control:h.control,name:"completion.base_url",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Base URL"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"custom-base-url-input",className:"m-0 inline-flex",placeholder:"http://localhost:11434/v1",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.base_url"})]})}}),s.jsx(T,{control:h.control,name:"completion.api_key",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"custom-api-key-input",className:"m-0 inline-flex",placeholder:"key",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.api_key"})]})}})]}):void 0},t[6]=e,t[7]=h,t[8]=v):v=t[8];const x=v;let b;t[9]!==o||t[10]!==l||t[11]!==e||t[12]!==h||t[13]!==g||t[14]!==x||t[15]!==a||t[16]!==i?(b=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(he,{title:"Autosave",children:[s.jsx(T,{control:h.control,name:"save.autosave",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autosave enabled"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"autosave-checkbox",checked:m.value==="after_delay",disabled:m.disabled,onCheckedChange:I=>{m.onChange(I?"after_delay":"off")}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(T,{control:h.control,name:"save.autosave_delay",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Autosave delay (seconds)"}),s.jsx(_,{children:s.jsx(at,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:h.getValues("save.autosave")!=="after_delay",...m,value:m.value/1e3,minValue:1,onChange:I=>{m.onChange(1e3*I),Number.isNaN(I)||g(h.getValues())}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"save.autosave_delay"})]})}})]}),s.jsxs(he,{title:"Formatting",children:[s.jsx(T,{control:h.control,name:"save.format_on_save",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Format on save"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"format-on-save-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(T,{control:h.control,name:"formatting.line_length",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Line length"}),s.jsx(_,{children:s.jsx(at,{"data-testid":"line-length-input",className:"m-0 w-24",...m,value:m.value,minValue:1,maxValue:1e3,onChange:I=>{m.onChange(I),Number.isNaN(I)||g(h.getValues())}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(z,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(he,{title:"Autocomplete",children:s.jsx(T,{control:h.control,name:"completion.activate_on_typing",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autocomplete"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"autocomplete-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(!!I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(z,{children:"When unchecked, code completion is still available through a hotkey."}),s.jsx("div",{children:s.jsx(pe,{variant:"link",className:"mb-0 px-0",type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),a("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(he,{title:"Language Servers",children:[s.jsx(T,{control:h.control,name:"language_servers.pylsp.enabled",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(E,{className:R,children:[s.jsxs(N,{children:[s.jsx(Hn,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(ue,{href:"https://github.com/python-lsp/python-lsp-server",children:"pylsp"}),")"]}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"pylsp-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(!!I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),m.value&&!l.pylsp&&s.jsxs(ro,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(xe,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsxs(z,{children:["See the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsx(T,{control:h.control,name:"diagnostics.enabled",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsxs(N,{children:[s.jsx(Hn,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"diagnostics-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(!!I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsx(he,{title:"Keymap",children:s.jsx(T,{control:h.control,name:"keymap.preset",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Keymap"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"keymap-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:lc.map(wc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"keymap.preset"})]}),s.jsx("div",{children:s.jsx(pe,{variant:"link",className:"mb-0 px-0",type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(he,{title:"Display",children:[s.jsx(T,{control:h.control,name:"display.default_width",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Default width"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"user-config-width-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Ic)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.default_width"})]}),s.jsx(z,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(T,{control:h.control,name:"display.theme",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Theme"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"theme-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:no.map(Sc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.theme"})]}),s.jsx(z,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(T,{control:h.control,name:"display.code_editor_font_size",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Code editor font size (px)"}),s.jsx(_,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(at,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...m,value:m.value,minValue:8,maxValue:32,onChange:I=>{m.onChange(I),g(h.getValues())}})})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(T,{control:h.control,name:"display.reference_highlighting",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Reference highlighting"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"reference-highlighting-checkbox",checked:m.value,onCheckedChange:m.onChange})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(z,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(he,{title:"Outputs",children:[s.jsx(T,{control:h.control,name:"display.cell_output",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Cell output area"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"cell-output-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["above","below"].map(Oc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.cell_output"})]}),s.jsx(z,{children:"Where to display cell's output."})]})}}),s.jsx(T,{control:h.control,name:"display.dataframes",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Dataframe viewer"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"display-dataframes-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(kc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.dataframes"})]}),s.jsx(z,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(T,{control:h.control,name:"display.default_table_page_size",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Default table page size"}),s.jsx(_,{children:s.jsx(at,{"data-testid":"default-table-page-size-input",className:"m-0 w-24",...m,value:m.value,minValue:1,step:1,onChange:I=>{m.onChange(I),Number.isNaN(I)||g(h.getValues())}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(z,{children:"The default number of rows displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(he,{title:"Package Management",children:s.jsx(T,{control:h.control,disabled:p,name:"package_management.manager",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Manager"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"package-manager-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:to.map(Cc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(z,{children:["When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager. Learn more in the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/package_management.html",children:"docs"}),".",s.jsx("br",{}),s.jsx("br",{}),"Running marimo in a"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",children:"sandboxed environment"})," ","is only supported by ",s.jsx(xe,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(he,{title:"Runtime configuration",children:[s.jsx(T,{control:h.control,name:"runtime.default_sql_output",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Default SQL output"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"user-config-sql-output-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:Mi.map(Nc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(z,{children:'The default SQL output format for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(T,{control:h.control,name:"runtime.auto_instantiate",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autorun on startup"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"auto-instantiate-checkbox",disabled:m.disabled,checked:m.value,onCheckedChange:m.onChange})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(z,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(T,{control:h.control,name:"runtime.on_cell_change",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"On cell change"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"on-cell-change-select",onChange:I=>m.onChange(I.target.value),value:m.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(Dc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(z,{children:`Whether marimo should automatically run cells or just mark them as stale. If "autorun", marimo will automatically run affected cells when a cell is run or a UI element is interacted with; if "lazy", marimo will mark affected cells as stale but won't re-run them.`})]})}}),s.jsx(T,{control:h.control,name:"runtime.auto_reload",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"On module change"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"auto-reload-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:p,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(Tc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(z,{children:'Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by module modifications as stale; if "autorun", affected cells will be automatically re-run.'})]})}}),s.jsx(T,{control:h.control,name:"runtime.reactive_tests",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"reactive-test-checkbox",checked:m.value,onCheckedChange:m.onChange})})]}),s.jsx(F,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(A,{}),s.jsx(z,{children:"Enable reactive pytest tests in notebook. When a cell contains only test functions (test_*) and classes (Test_*), marimo will automatically run them with pytest (requires notebook restart)."})," "]})}}),s.jsxs(z,{children:["Learn more in the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsxs(s.Fragment,{children:[s.jsxs(he,{title:"AI Code Completion",children:[s.jsx("p",{className:"text-sm text-muted-secondary",children:"You may use GitHub Copilot, Codeium, or a custom provider (e.g. Ollama) for AI code completion."}),s.jsx(T,{control:h.control,name:"completion.copilot",render:w=>{const{field:m}=w;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Provider"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"copilot-select",onChange:I=>{I.target.value==="none"?m.onChange(!1):m.onChange(I.target.value)},value:m.value===!0?"github":m.value===!1?"none":m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["none","github","codeium","custom"].map(Ec)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.copilot"})]})})}}),x()]}),s.jsxs(he,{title:"AI Keys",children:[s.jsx(T,{control:h.control,name:"ai.open_ai.api_key",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"OpenAI API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-openai-api-key-input",className:"m-0 inline-flex",placeholder:"sk-proj...",...m,onChange:I=>{const V=I.target.value;V.includes("*")||m.onChange(V)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.open_ai.api_key"})]}),s.jsxs(z,{children:["Your OpenAI API key from"," ",s.jsx(ue,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]})]})}}),s.jsx(T,{control:h.control,name:"ai.anthropic.api_key",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Anthropic API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-anthropic-api-key-input",className:"m-0 inline-flex",placeholder:"sk-ant...",...m,onChange:I=>{const V=I.target.value;V.includes("*")||m.onChange(V)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.anthropic.api_key"})]}),s.jsxs(z,{children:["Your Anthropic API key from"," ",s.jsx(ue,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]})]})}}),s.jsx(T,{control:h.control,name:"ai.google.api_key",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Google AI API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-google-api-key-input",className:"m-0 inline-flex",placeholder:"AI...",...m,onChange:I=>{const V=I.target.value;V.includes("*")||m.onChange(V)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.google.api_key"})]}),s.jsxs(z,{children:["Your Google AI API key from"," ",s.jsx(ue,{href:"https://aistudio.google.com/app/apikey",children:"aistudio.google.com"}),"."]})]})}}),s.jsx("p",{className:"text-sm font-semibold mt-3",children:"AWS Bedrock Configuration"}),s.jsxs("p",{className:"text-sm text-muted-secondary mb-2",children:["To use AWS Bedrock, you need to configure AWS credentials and region. See the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),s.jsx(T,{control:h.control,disabled:p,name:"ai.bedrock.region_name",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"AWS Region"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"bedrock-region-select",onChange:I=>m.onChange(I.target.value),value:typeof m.value=="string"?m.value:"us-east-1",disabled:m.disabled,className:"inline-flex mr-2",children:gc.map(_c)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.bedrock.region_name"})]}),s.jsx(z,{children:"The AWS region where Bedrock service is available."})]})}}),s.jsx(T,{control:h.control,disabled:p,name:"ai.bedrock.profile_name",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"AWS Profile Name (Optional)"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"bedrock-profile-input",className:"m-0 inline-flex",placeholder:"default",...m,value:m.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.bedrock.profile_name"})]}),s.jsx(z,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})}})]}),s.jsxs(he,{title:"AI Assist",children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add an API key to ",s.jsx(xe,{className:"inline",children:"marimo.toml"})," to activate marimo's AI assistant; see"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html",children:"docs"})," ","for more info."]}),s.jsx(T,{control:h.control,disabled:p,name:"ai.open_ai.base_url",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Base URL"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-base-url-input",className:"m-0 inline-flex",placeholder:"https://api.openai.com/v1",...m})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.open_ai.base_url"})]}),s.jsx(z,{children:"This URL can be any OpenAI-compatible API endpoint."})]})}}),s.jsx(T,{control:h.control,disabled:p,name:"ai.open_ai.model",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Model"}),s.jsx(_,{children:s.jsx(oe,{list:"ai-model-datalist","data-testid":"ai-model-input",className:"m-0 inline-flex",placeholder:"gpt-4-turbo",...m})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.open_ai.model"})]}),s.jsx("datalist",{id:"ai-model-datalist",children:Qi.map(Pc)}),s.jsx(z,{children:'If the model starts with "claude-", we will use your Anthropic API key. If the model starts with "gemini-", we will use your Google AI API key. If the model starts with a "bedrock/" prefix followed by a model id (e.g., "bedrock/anthropic.claude-3-sonnet-20240229"), we will use your AWS Bedrock configuration. Otherwise, we will use your OpenAI API key.'})]})}}),s.jsx(T,{control:h.control,name:"ai.rules",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(E,{children:[s.jsx(N,{children:"Custom Rules"}),s.jsx(_,{children:s.jsx(eo,{"data-testid":"ai-rules-input",className:"m-0 inline-flex w-full h-32 p-2 text-sm",placeholder:"e.g. Always use type hints; prefer polars over pandas",...m,value:m.value})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.rules"})]}),s.jsx(z,{children:"Custom rules to include in all AI completion prompts."})]})}})]})]});case"optionalDeps":return s.jsx(mc,{});case"labs":return s.jsxs(he,{title:"Experimental Features",children:[s.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"\u26A0\uFE0F These features are experimental and may require restarting your notebook to take effect."}),s.jsx(T,{control:h.control,name:"experimental.inline_ai_tooltip",render:Ac}),s.jsx(T,{control:h.control,name:"experimental.rtc_v2",render:Mc})]})}},t[9]=o,t[10]=l,t[11]=e,t[12]=h,t[13]=g,t[14]=x,t[15]=a,t[16]=i,t[17]=b):b=t[17];const j=b;let O,k,C;t[18]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(xe,{className:"inline",children:"marimo.toml"}),k=s.jsx("br",{}),t[18]=O,t[19]=k):(O=t[18],k=t[19]),t[20]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",O,k,"Run ",s.jsx(xe,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[20]=C):C=t[20];const P=C;let L,H,U,q,te,ae,$,ne,K,Y,re,se;return t[21]!==h||t[22]!==g?(L=h.handleSubmit(g),t[21]=h,t[22]=g,t[23]=L):L=t[23],t[24]!==a?(H=w=>a(w),t[24]=a,t[25]=H):H=t[25],t[26]===Symbol.for("react.memo_cache_sentinel")?(U=Zi.map(Rc),t[26]=U):U=t[26],t[27]!==c?(q=s.jsx("div",{className:"p-2 text-xs text-muted-foreground self-start",children:s.jsxs("span",{children:["Version: ",c]})}),t[27]=c,t[28]=q):q=t[28],t[29]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx("div",{className:"flex-1"}),ae=!Be()&&P,t[29]=te,t[30]=ae):(te=t[29],ae=t[30]),t[31]!==q?($=s.jsxs(io,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[U,q,te,ae]}),t[31]=q,t[32]=$):$=t[32],t[33]!==o||t[34]!==H||t[35]!==$?(ne=s.jsx(so,{value:o,onValueChange:H,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:$}),t[33]=o,t[34]=H,t[35]=$,t[36]=ne):ne=t[36],t[37]!==j?(K=j(),t[37]=j,t[38]=K):K=t[38],t[39]!==K?(Y=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:K}),t[39]=K,t[40]=Y):Y=t[40],t[41]!==ne||t[42]!==Y||t[43]!==L?(re=s.jsxs("form",{ref:r,onChange:L,className:"flex text-pretty overflow-hidden",children:[ne,Y]}),t[41]=ne,t[42]=Y,t[43]=L,t[44]=re):re=t[44],t[45]!==h||t[46]!==re?(se=s.jsx(jn,{...h,children:re}),t[45]=h,t[46]=re,t[47]=se):se=t[47],se},he=t=>{const e=J.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Ai,{children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o},F=t=>{const e=J.c(24),{userConfig:n,name:r}=t;let i;e[0]!==r||e[1]!==n?(i=zn(n,r),e[0]=r,e[1]=n,e[2]=i):i=e[2];const o=i,a=st(oo);let l;e[3]!==r||e[4]!==a?(l=zn(a,r),e[3]=r,e[4]=a,e[5]=l):l=e[5];const c=l;if(c==null||o===c)return null;let u,d,h,y;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(xe,{className:"inline",children:"pyproject.toml"}),"."]}),d=s.jsx("br",{}),e[6]=u,e[7]=d):(u=e[6],d=e[7]),e[8]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsxs("span",{children:["Edit the ",s.jsx(xe,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),y=s.jsx("br",{}),e[8]=h,e[9]=y):(h=e[8],y=e[9]);const g=String(o);let f,p;e[10]!==g?(f=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:g})]}),e[10]=g,e[11]=f):f=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("br",{}),e[12]=p):p=e[12];const v=String(c);let x,b,j;e[13]!==v?(x=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:v})]}),e[13]=v,e[14]=x):x=e[14],e[15]!==x||e[16]!==f?(b=s.jsxs(s.Fragment,{children:[u,d,h,y,f,p,x]}),e[15]=x,e[16]=f,e[17]=b):b=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Wn,{className:"w-3 h-3"}),e[18]=j):j=e[18];const O=String(c);let k,C;return e[19]!==O?(k=s.jsxs("span",{className:"text-[var(--amber-12)] text-xs flex items-center gap-1 border rounded px-2 py-1 bg-[var(--amber-2)] border-[var(--amber-6)] ml-1",children:[j,"Overridden by pyproject.toml [",O,"]"]}),e[19]=O,e[20]=k):k=e[20],e[21]!==b||e[22]!==k?(C=s.jsx(Tt,{content:b,children:k}),e[21]=b,e[22]=k,e[23]=C):C=e[23],C};function wc(t){return s.jsx("option",{value:t,children:t},t)}function Ic(t){return s.jsx("option",{value:t,children:t},t)}function Sc(t){return s.jsx("option",{value:t,children:t},t)}function Oc(t){return s.jsx("option",{value:t,children:t},t)}function kc(t){return s.jsx("option",{value:t,children:t},t)}function Cc(t){return s.jsx("option",{value:t,children:t},t)}function Nc(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function Dc(t){return s.jsx("option",{value:t,children:t},t)}function Tc(t){return s.jsx("option",{value:t,children:t},t)}function Ec(t){return s.jsx("option",{value:t,children:t},t)}function _c(t){return s.jsx("option",{value:t,children:t},t)}function Pc(t){return s.jsx("option",{value:t,children:t},t)}function Ac(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(z,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function Mc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(z,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function Rc(t){return s.jsx(Zs,{value:t.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:s.jsxs("div",{className:"flex gap-4 items-center text-lg overflow-hidden",children:[s.jsx("span",{className:St(t.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground flex-shrink-0"),children:s.jsx(t.Icon,{className:"w-4 h-4"})}),s.jsx("span",{className:"truncate",children:t.label})]})},t.id)}const vn=Ue(!1);function Lc(){const t=J.c(5),e=Dt(es),n=Dt(vn);let r;t[0]!==e||t[1]!==n?(r=a=>{e(a),n(!0)},t[0]=e,t[1]=n,t[2]=r):r=t[2];const i=r;let o;return t[3]!==i?(o={handleClick:i},t[3]=i,t[4]=o):o=t[4],o}const Fc=t=>{const e=J.c(32),{showAppConfig:n,disabled:r,tooltip:i}=t,o=n===void 0||n,a=r!==void 0&&r,l=i===void 0?"Settings":i,[c,u]=qe(vn),d=a?"disabled":"hint-green";let h,y,g;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Un,{strokeWidth:1.8}),e[0]=h):h=e[0],e[1]!==l?(y=s.jsx(Tt,{content:l,children:h}),e[1]=l,e[2]=y):y=e[2],e[3]!==a||e[4]!==d||e[5]!==y?(g=s.jsx(xt,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:a,color:d,children:y}),e[3]=a,e[4]=d,e[5]=y,e[6]=g):g=e[6];const f=g;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Rn,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:s.jsx(jc,{})}),e[7]=p):p=e[7];const v=p;if(!o){let U,q;return e[8]!==f?(U=s.jsx(ao,{children:f}),e[8]=f,e[9]=U):U=e[9],e[10]!==u||e[11]!==c||e[12]!==U?(q=s.jsxs(Ct,{open:c,onOpenChange:u,children:[U,v]}),e[10]=u,e[11]=c,e[12]=U,e[13]=q):q=e[13],q}let x,b,j,O,k,C,P,L,H;return e[14]!==f?(x=s.jsx(lo,{asChild:!0,children:f}),e[14]=f,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(zl,{}),j=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=b,e[17]=j):(b=e[16],j=e[17]),e[18]!==u?(O=()=>u(!0),e[18]=u,e[19]=O):O=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Un,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=k):k=e[20],e[21]!==O?(C=s.jsxs(co,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Hc,children:[b,j,s.jsxs(pe,{onClick:O,variant:"link",className:"px-0",children:[k,"User settings"]})]}),e[21]=O,e[22]=C):C=e[22],e[23]!==C||e[24]!==x?(P=s.jsxs(uo,{children:[x,C]}),e[23]=C,e[24]=x,e[25]=P):P=e[25],e[26]!==u||e[27]!==c?(L=s.jsx(Ct,{open:c,onOpenChange:u,children:v}),e[26]=u,e[27]=c,e[28]=L):L=e[28],e[29]!==P||e[30]!==L?(H=s.jsxs(s.Fragment,{children:[P,L]}),e[29]=P,e[30]=L,e[31]=H):H=e[31],H};function Hc(t){return t.preventDefault()}const zc=t=>{const e=J.c(12),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,a=i===void 0?"Shutdown":i,{openConfirm:l,closeModal:c}=ho(),u=qc;if(Be())return null;const d=o?"disabled":"red";let h,y,g,f;return e[0]!==c||e[1]!==n||e[2]!==l?(h=p=>{p.stopPropagation(),l({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(fo,{onClick:v=>{u(),c()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=c,e[1]=n,e[2]=l,e[3]=h):h=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(nt,{strokeWidth:1}),e[4]=y):y=e[4],e[5]!==o||e[6]!==d||e[7]!==h?(g=s.jsx(xt,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:d,className:"h-[27px] w-[27px]",disabled:o,onClick:h,children:y}),e[5]=o,e[6]=d,e[7]=h,e[8]=g):g=e[8],e[9]!==g||e[10]!==a?(f=s.jsx(Tt,{content:a,children:g}),e[9]=g,e[10]=a,e[11]=f):f=e[11],f};function Uc(){window.close()}function qc(){po(),setTimeout(Uc,200)}function Bc(t){window.open(go(`?file=${t}`).toString(),"_blank")}export{vo as A,yo as B,Fc as C,wo as G,fc as K,Io as L,So as M,Co as P,zc as S,Ml as T,No as Y,jo as a,qn as b,xt as c,nc as d,Xe as e,zi as f,Ll as g,cc as h,Hi as i,Lc as j,mn as k,Li as l,bt as m,Fi as n,Bc as o,Vn as p,Bn as q,Qi as r,vn as s,_i as t,Rl as u};
17
+ `)){if(c.startsWith('"')||c.trim()==="")continue;const u=sc(c,a);u&&l.push(u)}return l}(r,B.warn);(function(o){function a(d){d.args&&d.args.lhs&&d.args.rhs?d.mode?X.map(d.args.lhs,d.args.rhs,d.mode):X.map(d.args.lhs,d.args.rhs):B.warn(`Could not execute vimrc command "${d.name}: expected arguments"`)}function l(d){d.args&&d.args.lhs&&d.args.rhs?d.mode?X.noremap(d.args.lhs,d.args.rhs,d.mode):X.noremap(d.args.lhs,d.args.rhs):B.warn(`Could not execute vimrc command "${d.name}: expected arguments"`)}function c(d){d.args&&d.args.lhs?d.mode?X.unmap(d.args.lhs,d.mode):X.unmap(d.args.lhs):B.warn(`Could not execute vimrc command "${d.name}: expected arguments"`)}function u(d){d.mode?X.mapclear(d.mode):X.mapclear()}for(const d of o)"map|nmap|vmap|imap".split("|").includes(d.name)?a(d):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(d.name)?l(d):"unmap|nunmap|vunmap|iunmap".split("|").includes(d.name)?c(d):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(d.name)?u(d):B.warn(`Could not execute vimrc command "${d.name}: unknown command"`)})(i)}catch(r){B.error("Failed to load vimrc:",r)}});class wt{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=it(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(Ot("mode"in r,'Expected event to have a "mode" property'),this.isBroadcasting=!0,i=()=>{this.broadcastModeChange(e,r.mode,r.subMode),this.isBroadcasting=!1},"scheduler"in window?window.scheduler.postTask(i,{priority:"background"}):"requestIdleCallback"in window?requestIdleCallback(i):setTimeout(i,0))}):B.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,n,r){Ot("exitInsertMode"in X,"Vim does not have an exitInsertMode method"),Ot("exitVisualMode"in X,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=it(i);if(!o){B.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const a=o.setSelections.bind(o);if(o.setSelections=()=>[],!$i(o)){B.warn("Expected CodeMirror instance to have Vim state");continue}const l=o.state.vim;switch(n){case"normal":l.insertMode&&X.exitInsertMode(o,!0),l.visualMode&&X.exitVisualMode(o,!0);break;case"insert":l.insertMode||X.handleKey(o,"i","")}o.setSelections=a}}}function $i(t){return t.state.vim!==void 0}Gi=wt,wt.INSTANCES=new Gi;const lc=["default","vim"];function cc(t,e){switch(t.preset){case"default":return[je.of(Yi()),je.of(Xi(e)),kt.low(je.of([{key:"Escape",preventDefault:!0,run:n=>(n.contentDOM.blur(),!0)}]))];case"vim":return[je.of(dc()),je.of(Xi(e)),je.of([{key:"Enter",run:n=>{var i;const r=it(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&Ts(n)}}]),kt.high(hc("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(rt).deleteCell(),!0):!1)),Ds({status:!1}),kt.high((oc(),ac(),[je.of([{key:"j",run:n=>{if(Ss(n,!0)&&Dn(n)){const r=n.state.facet(rt),i=n.state.facet(Tn);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),je.of([{key:"k",run:n=>{if(Os(n)&&Dn(n)){const r=n.state.facet(rt),i=n.state.facet(Tn);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),je.of([{linux:"Ctrl-[",run:n=>{const r=it(n);return r?$i(r)?!!r.state.vim.insertMode&&(X.exitInsertMode(r,!0),!0):(B.warn("Expected CodeMirror instance to have Vim state"),!1):(B.warn("Expected CodeMirror instance to have CodeMirror instance state"),!1)}}]),Nn.define(n=>(requestAnimationFrame(()=>{wt.INSTANCES.addInstance(n)}),{destroy(){wt.INSTANCES.removeInstance(n)}})),Nn.define(n=>new ic({view:n}))]))];default:return Ns(t.preset),[]}}const uc=new Set([En,_n]),Yi=Ae(()=>Es.filter(t=>!uc.has(t.run))),Xi=t=>[{key:t.getHotkey("cell.toggleComment").key,run:En},{key:t.getHotkey("cell.toggleBlockComment").key,run:_n}],dc=Ae(()=>{const t=new Set(["Enter","Ctrl-v"]);return Yi().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function hc(t,e,n){let r="",i=0;return je.of([{any:(o,a)=>{const l=a.key,c=a.timeStamp;return l!==t||!e(o)?(r="",i=0,!1):r===t&&c-i<500&&n(o)?(r="",i=0,!0):(r=l,i=c,!1)}}])}const mn=Ue(!1),fc=()=>{const t=J.c(78),[e,n]=qe(mn),[r,i]=S.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[a,l]=S.useState(o),[c,u]=Pn(),d=st(_s);let h,y;t[1]!==n?(h=()=>n(pc),t[1]=n,t[2]=h):h=t[2],Ps("global.showHelp",h),t[3]!==c||t[4]!==u?(y=async Oe=>{const ie={...c};u(Oe),await An({config:Oe}).catch(W=>{throw u(ie),W})},t[3]=c,t[4]=u,t[5]=y):y=t[5];const g=y;let f;t[6]!==c||t[7]!==r||t[8]!==g?(f=async Oe=>{if(!r)return;const ie=Oe.join("-"),W={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides,[r]:ie}}};i(null),l([]),await g(W)},t[6]=c,t[7]=r,t[8]=g,t[9]=f):f=t[9];const p=f;let v,x,b;if(t[10]!==c||t[11]!==r||t[12]!==p||t[13]!==d||t[14]!==e||t[15]!==a||t[16]!==g){b=Symbol.for("react.early_return_sentinel");{const Oe=async()=>{if(!r)return;const W={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides}}};delete W.keymap.overrides[r],i(null),l([]),await g(W)};let ie;t[20]!==c||t[21]!==g?(ie=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const W={...c,keymap:{...c.keymap,overrides:{}}};i(null),l([]),await g(W)},t[20]=c,t[21]=g,t[22]=ie):ie=t[22],v=ie,e?x=W=>{const _e=d.getHotkey(W);if(r===W){const Ze=As(W);return s.jsxs("div",{children:[s.jsx(oe,{defaultValue:a.join("+"),placeholder:_e.name,onKeyDown:le=>{le.preventDefault();const ke=[];if(le.key==="Meta"||le.key==="Control"||le.key==="Alt"||le.key==="Shift"||(le.metaKey&&ke.push(Ms()?"Cmd":"Meta"),le.ctrlKey&&ke.push("Ctrl"),le.altKey&&ke.push("Alt"),le.shiftKey&&ke.push("Shift"),le.key==="-"))return;if(le.key==="Escape"&&ke.length===0)return i(null),void l([]);let yn=le.key.toLowerCase();le.key===" "&&(yn="Space"),ke.push(yn),p(ke)},autoFocus:!0,endAdornment:s.jsx(pe,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),l([])},children:s.jsx(nt,{className:"w-4 h-4"})})}),s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),Ze.key!==_e.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:Oe,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:Ze.key})]})]})]},W)}return s.jsxs("div",{className:"grid grid-cols-[auto,2fr,3fr] gap-2 items-center",children:[d.isEditable(W)?s.jsx(Mn,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),i(W)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx(Rs,{className:"justify-end",shortcut:_e.key}),s.jsx("span",{children:_e.name.toLowerCase()})]},W)}:b=null}t[10]=c,t[11]=r,t[12]=p,t[13]=d,t[14]=e,t[15]=a,t[16]=g,t[17]=v,t[18]=x,t[19]=b}else v=t[17],x=t[18],b=t[19];if(b!==Symbol.for("react.early_return_sentinel"))return b;const j=x;let O,k,C,P,L,H,U,q,te,ae,$,ne,K,Y,re,se,w,m,I,V,Ie,Te,Ee,Je;if(t[23]!==d||t[24]!==e||t[25]!==j||t[26]!==n){const Oe=d.getHotkeyGroups(),ie=W=>{const _e=Oe[W];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsx("h3",{className:"text-lg font-medium",children:W}),_e.map(Ze=>j(Ze))]})};C=Ct,ne=e,t[44]!==n?(K=W=>n(W),t[44]=n,t[45]=K):K=t[45],k=Ls,ae="sm:items-center sm:top-0",t[46]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(Fs,{}),t[46]=$):$=t[46],O=Rn,U=!1,q="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[47]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx(Hs,{children:s.jsx(zs,{children:"Shortcuts"})}),t[47]=te):te=t[47],L="flex flex-row gap-3",H=s.jsxs("div",{className:"w-1/2",children:[ie("Editing"),ie("Markdown")]}),Y="w-1/2",re=ie("Navigation"),se=ie("Running Cells"),w=ie("Creation and Ordering"),P=ie("Other"),t[23]=d,t[24]=e,t[25]=j,t[26]=n,t[27]=O,t[28]=k,t[29]=C,t[30]=P,t[31]=L,t[32]=H,t[33]=U,t[34]=q,t[35]=te,t[36]=ae,t[37]=$,t[38]=ne,t[39]=K,t[40]=Y,t[41]=re,t[42]=se,t[43]=w}else O=t[27],k=t[28],C=t[29],P=t[30],L=t[31],H=t[32],U=t[33],q=t[34],te=t[35],ae=t[36],$=t[37],ne=t[38],K=t[39],Y=t[40],re=t[41],se=t[42],w=t[43];return t[48]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[48]=m):m=t[48],t[49]!==v?(I=s.jsx(pe,{className:"mt-4 hover:bg-destructive/10 hover:border-destructive",variant:"outline",size:"xs",onClick:v,tabIndex:-1,children:m}),t[49]=v,t[50]=I):I=t[50],t[51]!==P||t[52]!==I||t[53]!==Y||t[54]!==re||t[55]!==se||t[56]!==w?(V=s.jsxs("div",{className:Y,children:[re,se,w,P,I]}),t[51]=P,t[52]=I,t[53]=Y,t[54]=re,t[55]=se,t[56]=w,t[57]=V):V=t[57],t[58]!==L||t[59]!==H||t[60]!==V?(Ie=s.jsxs("div",{className:L,children:[H,V]}),t[58]=L,t[59]=H,t[60]=V,t[61]=Ie):Ie=t[61],t[62]!==O||t[63]!==U||t[64]!==q||t[65]!==te||t[66]!==Ie?(Te=s.jsxs(O,{usePortal:U,className:q,children:[te,Ie]}),t[62]=O,t[63]=U,t[64]=q,t[65]=te,t[66]=Ie,t[67]=Te):Te=t[67],t[68]!==k||t[69]!==ae||t[70]!==$||t[71]!==Te?(Ee=s.jsxs(k,{className:ae,children:[$,Te]}),t[68]=k,t[69]=ae,t[70]=$,t[71]=Te,t[72]=Ee):Ee=t[72],t[73]!==C||t[74]!==ne||t[75]!==K||t[76]!==Ee?(Je=s.jsx(C,{open:ne,onOpenChange:K,children:Ee}),t[73]=C,t[74]=ne,t[75]=K,t[76]=Ee,t[77]=Je):Je=t[77],Je};function pc(t){return!t}const Qi=["claude-opus-4-20250514","claude-sonnet-4-20250514","claude-3-7-sonnet-latest","claude-3-5-sonnet-latest","claude-3-5-haiku-latest","deepseek-v3","deepseek-r1","gemini-2.5-flash-preview-05-20","gemini-2.5-pro-preview-06-05","gemini-2.0-flash","gemini-2.0-flash-lite","o3","o4-mini","gpt-4.5-preview","gpt-4.1","gpt-4o","gpt-3.5-turbo","bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0","bedrock/anthropic.claude-3-sonnet-20240229","bedrock/anthropic.claude-3-haiku-20240307","bedrock/meta.llama3-8b-instruct-v1:0","bedrock/amazon.titan-text-express-v1","bedrock/us.amazon.nova-pro-v1:0","bedrock/cohere.command-r-plus-v1","bedrock/ai21.j2-ultra-v1"],gc=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"],Ji=[{id:"sql",packagesRequired:[{name:"duckdb"},{name:"sqlglot"}],additionalPackageInstalls:[{name:"polars[pyarrow]"}],description:"SQL cells"},{id:"charts",packagesRequired:[{name:"altair"}],additionalPackageInstalls:[],description:"Charts in datasource viewer"},{id:"fast-charts",packagesRequired:[{name:"vegafusion"},{name:"vl-convert-python"}],additionalPackageInstalls:[],description:"Fast server-side charts"},{id:"formatting",packagesRequired:[Be()?{name:"black"}:{name:"ruff"}],additionalPackageInstalls:[],description:"Formatting"},{id:"ai",packagesRequired:[{name:"openai"}],additionalPackageInstalls:[],description:"AI features"},{id:"ipy-export",packagesRequired:[{name:"nbformat"}],additionalPackageInstalls:[],description:"Export as IPYNB"},{id:"testing",packagesRequired:[{name:"pytest"}],additionalPackageInstalls:[],description:"Autorun unit tests"}];Be()||Ji.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const mc=()=>{const t=J.c(21),[e]=Pn(),n=e.package_management.manager;let r;t[0]!==n?(r=[n],t[0]=n,t[1]=r):r=t[1];const{data:i,error:o,refetch:a,isPending:l}=Us(yc,r);if(l){let j;return t[2]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Fn,{size:"medium",centered:!0}),t[2]=j):j=t[2],j}if(o){let j;return t[3]!==o?(j=s.jsx(Ws,{error:o}),t[3]=o,t[4]=j):j=t[4],j}let c;t[5]!==(i==null?void 0:i.packages)?(c=(i==null?void 0:i.packages)||[],t[5]=i==null?void 0:i.packages,t[6]=c):c=t[6];const u=c;let d;t[7]!==u?(d=new Set(u.map(xc)),t[7]=u,t[8]=d):d=t[8];const h=d;let y,g,f,p,v,x,b;return t[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Ai,{children:"Optional Features"}),t[9]=y):y=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["marimo is lightweight, with few dependencies, to maximize compatibility with your own environments.",s.jsx("br",{}),"To unlock additional features in the marimo editor, you can install these optional dependencies:"]}),t[10]=g):g=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ks,{children:s.jsxs(Ln,{children:[s.jsx(ot,{children:"Dependency"}),s.jsx(ot,{children:"Feature"}),s.jsx(ot,{children:"Status"}),s.jsx(ot,{})]})}),t[11]=f):f=t[11],t[12]!==h||t[13]!==n||t[14]!==a?(p=Ji.map(j=>{const O=j.packagesRequired.every(C=>h.has(C.name.split("[")[0])),k=j.packagesRequired.map(bc).join(", ");return s.jsxs(Ln,{className:"text-sm",children:[s.jsx(Nt,{children:j.description}),s.jsx(Nt,{className:"font-mono text-xs",children:k}),s.jsx(Nt,{children:O?s.jsxs("div",{className:"flex items-center",children:[s.jsx(Bn,{className:"h-4 w-4 text-[var(--grass-10)] mr-2"}),s.jsx("span",{children:"Installed"})]}):s.jsxs("div",{className:"flex items-center",children:[s.jsx(qs,{className:"h-4 w-4 text-[var(--red-10)] mr-2"}),s.jsx(vc,{packageSpecs:[...j.packagesRequired,...j.additionalPackageInstalls],packageManager:n,onSuccess:a})]})})]},j.id)}),t[12]=h,t[13]=n,t[14]=a,t[15]=p):p=t[15],t[16]!==p?(v=s.jsxs(Gs,{children:[f,s.jsx($s,{children:p})]}),t[16]=p,t[17]=v):v=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("p",{className:"text-muted-foreground mt-2",children:"*Requires server restart"}),t[18]=x):x=t[18],t[19]!==v?(b=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[y,g,v,x]}),t[19]=v,t[20]=b):b=t[20],b},vc=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=ze.useState(!1);return s.jsxs(pe,{size:"xs",variant:"outline",className:St("text-xs",r&&"opacity-50 cursor-not-allowed"),onClick:async()=>{try{i(!0);const o=t.map(l=>l.minVersion?`${l.name}>=${l.minVersion}`:l.name).join(" "),a=await Vs({package:o});a.success?(n(),Pe({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(xe,{className:"inline",children:t.map(l=>l.name).join(", ")})," ","have been added to your environment."]})})):Pe({title:"Failed to install package",description:a.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(Fn,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(qn,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function yc(){return Bs()}function xc(t){return t.name}function bc(t){return t.name}const R="flex flex-row items-center space-x-1 space-y-0",Zi=[{id:"editor",label:"Editor",Icon:Mn,className:"bg-[var(--blue-4)]"},{id:"display",label:"Display",Icon:Oo,className:"bg-[var(--grass-4)]"},{id:"packageManagement",label:"Package Management",Icon:ko,className:"bg-[var(--red-4)]"},{id:"runtime",label:"Runtime",Icon:Vn,className:"bg-[var(--amber-4)]"},{id:"ai",label:"AI",Icon:xo,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:Wn,className:"bg-[var(--orange-4)]"},{id:"labs",label:"Labs",Icon:bo,className:"bg-[var(--slate-4)]"}],es=Ue(Zi[0].id),jc=()=>{const t=J.c(48),[e,n]=Ys(),r=S.useRef(null),i=Dt(mn),[o,a]=qe(es),l=st(Xs),c=st(Qs);let u,d;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=xn(Js),t[0]=u):u=t[0],t[1]!==e?(d={resolver:u,defaultValues:e},t[1]=e,t[2]=d):d=t[2];const h=bn(d);let y;t[3]!==n?(y=async w=>{await An({config:w}).then(()=>{n(w)})},t[3]=n,t[4]=y):y=t[4];const g=y;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=Be(),t[5]=f):f=t[5];const p=f;let v;t[6]!==e||t[7]!==h?(v=()=>{const w=h.getValues("completion.copilot");return w===!1?null:w==="codeium"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Windsurf API key, follow"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),s.jsx(T,{control:h.control,name:"completion.codeium_api_key",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"codeium-api-key-input",className:"m-0 inline-flex",placeholder:"key",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.codeium_api_key"})]})}})]}):w==="github"?s.jsx(qi,{}):w==="custom"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm text-muted-secondary",children:"Configure your custom AI completion provider with the following settings."}),s.jsx(T,{control:h.control,name:"completion.model",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Model"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"custom-model-input",className:"m-0 inline-flex",placeholder:"Qwen2.5-Coder-7B",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.model"})]})}}),s.jsx(T,{control:h.control,name:"completion.base_url",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Base URL"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"custom-base-url-input",className:"m-0 inline-flex",placeholder:"http://localhost:11434/v1",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.base_url"})]})}}),s.jsx(T,{control:h.control,name:"completion.api_key",render:m=>{const{field:I}=m;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"custom-api-key-input",className:"m-0 inline-flex",placeholder:"key",...I,value:I.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.api_key"})]})}})]}):void 0},t[6]=e,t[7]=h,t[8]=v):v=t[8];const x=v;let b;t[9]!==o||t[10]!==l||t[11]!==e||t[12]!==h||t[13]!==g||t[14]!==x||t[15]!==a||t[16]!==i?(b=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(he,{title:"Autosave",children:[s.jsx(T,{control:h.control,name:"save.autosave",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autosave enabled"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"autosave-checkbox",checked:m.value==="after_delay",disabled:m.disabled,onCheckedChange:I=>{m.onChange(I?"after_delay":"off")}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(T,{control:h.control,name:"save.autosave_delay",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Autosave delay (seconds)"}),s.jsx(_,{children:s.jsx(at,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:h.getValues("save.autosave")!=="after_delay",...m,value:m.value/1e3,minValue:1,onChange:I=>{m.onChange(1e3*I),Number.isNaN(I)||g(h.getValues())}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"save.autosave_delay"})]})}})]}),s.jsxs(he,{title:"Formatting",children:[s.jsx(T,{control:h.control,name:"save.format_on_save",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Format on save"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"format-on-save-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(T,{control:h.control,name:"formatting.line_length",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Line length"}),s.jsx(_,{children:s.jsx(at,{"data-testid":"line-length-input",className:"m-0 w-24",...m,value:m.value,minValue:1,maxValue:1e3,onChange:I=>{m.onChange(I),Number.isNaN(I)||g(h.getValues())}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(z,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(he,{title:"Autocomplete",children:s.jsx(T,{control:h.control,name:"completion.activate_on_typing",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autocomplete"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"autocomplete-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(!!I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(z,{children:"When unchecked, code completion is still available through a hotkey."}),s.jsx("div",{children:s.jsx(pe,{variant:"link",className:"mb-0 px-0",type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),a("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(he,{title:"Language Servers",children:[s.jsx(T,{control:h.control,name:"language_servers.pylsp.enabled",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(E,{className:R,children:[s.jsxs(N,{children:[s.jsx(Hn,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(ue,{href:"https://github.com/python-lsp/python-lsp-server",children:"pylsp"}),")"]}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"pylsp-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(!!I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),m.value&&!l.pylsp&&s.jsxs(ro,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(xe,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsxs(z,{children:["See the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsx(T,{control:h.control,name:"diagnostics.enabled",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsxs(N,{children:[s.jsx(Hn,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"diagnostics-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:I=>{m.onChange(!!I)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsx(he,{title:"Keymap",children:s.jsx(T,{control:h.control,name:"keymap.preset",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Keymap"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"keymap-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:lc.map(wc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"keymap.preset"})]}),s.jsx("div",{children:s.jsx(pe,{variant:"link",className:"mb-0 px-0",type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(he,{title:"Display",children:[s.jsx(T,{control:h.control,name:"display.default_width",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Default width"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"user-config-width-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Ic)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.default_width"})]}),s.jsx(z,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(T,{control:h.control,name:"display.theme",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Theme"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"theme-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:no.map(Sc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.theme"})]}),s.jsx(z,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(T,{control:h.control,name:"display.code_editor_font_size",render:w=>{const{field:m}=w;return s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Code editor font size (px)"}),s.jsx(_,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(at,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...m,value:m.value,minValue:8,maxValue:32,onChange:I=>{m.onChange(I),g(h.getValues())}})})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(T,{control:h.control,name:"display.reference_highlighting",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Reference highlighting"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"reference-highlighting-checkbox",checked:m.value,onCheckedChange:m.onChange})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(z,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(he,{title:"Outputs",children:[s.jsx(T,{control:h.control,name:"display.cell_output",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Cell output area"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"cell-output-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["above","below"].map(Oc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.cell_output"})]}),s.jsx(z,{children:"Where to display cell's output."})]})}}),s.jsx(T,{control:h.control,name:"display.dataframes",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Dataframe viewer"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"display-dataframes-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(kc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.dataframes"})]}),s.jsx(z,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(T,{control:h.control,name:"display.default_table_page_size",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Default table page size"}),s.jsx(_,{children:s.jsx(at,{"data-testid":"default-table-page-size-input",className:"m-0 w-24",...m,value:m.value,minValue:1,step:1,onChange:I=>{m.onChange(I),Number.isNaN(I)||g(h.getValues())}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(z,{children:"The default number of rows displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(he,{title:"Package Management",children:s.jsx(T,{control:h.control,disabled:p,name:"package_management.manager",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Manager"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"package-manager-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:to.map(Cc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(z,{children:["When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager. Learn more in the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/package_management.html",children:"docs"}),".",s.jsx("br",{}),s.jsx("br",{}),"Running marimo in a"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",children:"sandboxed environment"})," ","is only supported by ",s.jsx(xe,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(he,{title:"Runtime configuration",children:[s.jsx(T,{control:h.control,name:"runtime.default_sql_output",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Default SQL output"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"user-config-sql-output-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:Mi.map(Nc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(z,{children:'The default SQL output format for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(T,{control:h.control,name:"runtime.auto_instantiate",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autorun on startup"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"auto-instantiate-checkbox",disabled:m.disabled,checked:m.value,onCheckedChange:m.onChange})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(z,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(T,{control:h.control,name:"runtime.on_cell_change",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"On cell change"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"on-cell-change-select",onChange:I=>m.onChange(I.target.value),value:m.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(Dc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(z,{children:`Whether marimo should automatically run cells or just mark them as stale. If "autorun", marimo will automatically run affected cells when a cell is run or a UI element is interacted with; if "lazy", marimo will mark affected cells as stale but won't re-run them.`})]})}}),s.jsx(T,{control:h.control,name:"runtime.auto_reload",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"On module change"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"auto-reload-select",onChange:I=>m.onChange(I.target.value),value:m.value,disabled:p,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(Tc)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(z,{children:'Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by module modifications as stale; if "autorun", affected cells will be automatically re-run.'})]})}}),s.jsx(T,{control:h.control,name:"runtime.reactive_tests",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"reactive-test-checkbox",checked:m.value,onCheckedChange:m.onChange})})]}),s.jsx(F,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(A,{}),s.jsx(z,{children:"Enable reactive pytest tests in notebook. When a cell contains only test functions (test_*) and classes (Test_*), marimo will automatically run them with pytest (requires notebook restart)."})," "]})}}),s.jsxs(z,{children:["Learn more in the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsxs(s.Fragment,{children:[s.jsxs(he,{title:"AI Code Completion",children:[s.jsx("p",{className:"text-sm text-muted-secondary",children:"You may use GitHub Copilot, Codeium, or a custom provider (e.g. Ollama) for AI code completion."}),s.jsx(T,{control:h.control,name:"completion.copilot",render:w=>{const{field:m}=w;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Provider"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"copilot-select",onChange:I=>{I.target.value==="none"?m.onChange(!1):m.onChange(I.target.value)},value:m.value===!0?"github":m.value===!1?"none":m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["none","github","codeium","custom"].map(Ec)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"completion.copilot"})]})})}}),x()]}),s.jsxs(he,{title:"AI Keys",children:[s.jsx(T,{control:h.control,name:"ai.open_ai.api_key",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"OpenAI API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-openai-api-key-input",className:"m-0 inline-flex",placeholder:"sk-proj...",...m,onChange:I=>{const V=I.target.value;V.includes("*")||m.onChange(V)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.open_ai.api_key"})]}),s.jsxs(z,{children:["Your OpenAI API key from"," ",s.jsx(ue,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]})]})}}),s.jsx(T,{control:h.control,name:"ai.anthropic.api_key",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Anthropic API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-anthropic-api-key-input",className:"m-0 inline-flex",placeholder:"sk-ant...",...m,onChange:I=>{const V=I.target.value;V.includes("*")||m.onChange(V)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.anthropic.api_key"})]}),s.jsxs(z,{children:["Your Anthropic API key from"," ",s.jsx(ue,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]})]})}}),s.jsx(T,{control:h.control,name:"ai.google.api_key",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Google AI API Key"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-google-api-key-input",className:"m-0 inline-flex",placeholder:"AI...",...m,onChange:I=>{const V=I.target.value;V.includes("*")||m.onChange(V)}})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.google.api_key"})]}),s.jsxs(z,{children:["Your Google AI API key from"," ",s.jsx(ue,{href:"https://aistudio.google.com/app/apikey",children:"aistudio.google.com"}),"."]})]})}}),s.jsx("p",{className:"text-sm font-semibold mt-3",children:"AWS Bedrock Configuration"}),s.jsxs("p",{className:"text-sm text-muted-secondary mb-2",children:["To use AWS Bedrock, you need to configure AWS credentials and region. See the"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),s.jsx(T,{control:h.control,disabled:p,name:"ai.bedrock.region_name",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"AWS Region"}),s.jsx(_,{children:s.jsx(ce,{"data-testid":"bedrock-region-select",onChange:I=>m.onChange(I.target.value),value:typeof m.value=="string"?m.value:"us-east-1",disabled:m.disabled,className:"inline-flex mr-2",children:gc.map(_c)})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.bedrock.region_name"})]}),s.jsx(z,{children:"The AWS region where Bedrock service is available."})]})}}),s.jsx(T,{control:h.control,disabled:p,name:"ai.bedrock.profile_name",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"AWS Profile Name (Optional)"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"bedrock-profile-input",className:"m-0 inline-flex",placeholder:"default",...m,value:m.value||""})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.bedrock.profile_name"})]}),s.jsx(z,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})}})]}),s.jsxs(he,{title:"AI Assist",children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add an API key to ",s.jsx(xe,{className:"inline",children:"marimo.toml"})," to activate marimo's AI assistant; see"," ",s.jsx(ue,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html",children:"docs"})," ","for more info."]}),s.jsx(T,{control:h.control,disabled:p,name:"ai.open_ai.base_url",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Base URL"}),s.jsx(_,{children:s.jsx(oe,{"data-testid":"ai-base-url-input",className:"m-0 inline-flex",placeholder:"https://api.openai.com/v1",...m})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.open_ai.base_url"})]}),s.jsx(z,{children:"This URL can be any OpenAI-compatible API endpoint."})]})}}),s.jsx(T,{control:h.control,disabled:p,name:"ai.open_ai.model",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{children:"Model"}),s.jsx(_,{children:s.jsx(oe,{list:"ai-model-datalist","data-testid":"ai-model-input",className:"m-0 inline-flex",placeholder:"gpt-4-turbo",...m})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.open_ai.model"})]}),s.jsx("datalist",{id:"ai-model-datalist",children:Qi.map(Pc)}),s.jsx(z,{children:'If the model starts with "claude-", we will use your Anthropic API key. If the model starts with "gemini-", we will use your Google AI API key. If the model starts with a "bedrock/" prefix followed by a model id (e.g., "bedrock/anthropic.claude-3-sonnet-20240229"), we will use your AWS Bedrock configuration. Otherwise, we will use your OpenAI API key.'})]})}}),s.jsx(T,{control:h.control,name:"ai.rules",render:w=>{const{field:m}=w;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(E,{children:[s.jsx(N,{children:"Custom Rules"}),s.jsx(_,{children:s.jsx(eo,{"data-testid":"ai-rules-input",className:"m-0 inline-flex w-full h-32 p-2 text-sm",placeholder:"e.g. Always use type hints; prefer polars over pandas",...m,value:m.value})}),s.jsx(A,{}),s.jsx(F,{userConfig:e,name:"ai.rules"})]}),s.jsx(z,{children:"Custom rules to include in all AI completion prompts."})]})}})]})]});case"optionalDeps":return s.jsx(mc,{});case"labs":return s.jsxs(he,{title:"Experimental Features",children:[s.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"\u26A0\uFE0F These features are experimental and may require restarting your notebook to take effect."}),s.jsx(T,{control:h.control,name:"experimental.inline_ai_tooltip",render:Ac}),s.jsx(T,{control:h.control,name:"experimental.rtc_v2",render:Mc})]})}},t[9]=o,t[10]=l,t[11]=e,t[12]=h,t[13]=g,t[14]=x,t[15]=a,t[16]=i,t[17]=b):b=t[17];const j=b;let O,k,C;t[18]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(xe,{className:"inline",children:"marimo.toml"}),k=s.jsx("br",{}),t[18]=O,t[19]=k):(O=t[18],k=t[19]),t[20]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",O,k,"Run ",s.jsx(xe,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[20]=C):C=t[20];const P=C;let L,H,U,q,te,ae,$,ne,K,Y,re,se;return t[21]!==h||t[22]!==g?(L=h.handleSubmit(g),t[21]=h,t[22]=g,t[23]=L):L=t[23],t[24]!==a?(H=w=>a(w),t[24]=a,t[25]=H):H=t[25],t[26]===Symbol.for("react.memo_cache_sentinel")?(U=Zi.map(Rc),t[26]=U):U=t[26],t[27]!==c?(q=s.jsx("div",{className:"p-2 text-xs text-muted-foreground self-start",children:s.jsxs("span",{children:["Version: ",c]})}),t[27]=c,t[28]=q):q=t[28],t[29]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx("div",{className:"flex-1"}),ae=!Be()&&P,t[29]=te,t[30]=ae):(te=t[29],ae=t[30]),t[31]!==q?($=s.jsxs(io,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[U,q,te,ae]}),t[31]=q,t[32]=$):$=t[32],t[33]!==o||t[34]!==H||t[35]!==$?(ne=s.jsx(so,{value:o,onValueChange:H,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:$}),t[33]=o,t[34]=H,t[35]=$,t[36]=ne):ne=t[36],t[37]!==j?(K=j(),t[37]=j,t[38]=K):K=t[38],t[39]!==K?(Y=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:K}),t[39]=K,t[40]=Y):Y=t[40],t[41]!==ne||t[42]!==Y||t[43]!==L?(re=s.jsxs("form",{ref:r,onChange:L,className:"flex text-pretty overflow-hidden",children:[ne,Y]}),t[41]=ne,t[42]=Y,t[43]=L,t[44]=re):re=t[44],t[45]!==h||t[46]!==re?(se=s.jsx(jn,{...h,children:re}),t[45]=h,t[46]=re,t[47]=se):se=t[47],se},he=t=>{const e=J.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Ai,{children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o},F=t=>{const e=J.c(24),{userConfig:n,name:r}=t;let i;e[0]!==r||e[1]!==n?(i=zn(n,r),e[0]=r,e[1]=n,e[2]=i):i=e[2];const o=i,a=st(oo);let l;e[3]!==r||e[4]!==a?(l=zn(a,r),e[3]=r,e[4]=a,e[5]=l):l=e[5];const c=l;if(c==null||o===c)return null;let u,d,h,y;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(xe,{className:"inline",children:"pyproject.toml"}),"."]}),d=s.jsx("br",{}),e[6]=u,e[7]=d):(u=e[6],d=e[7]),e[8]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsxs("span",{children:["Edit the ",s.jsx(xe,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),y=s.jsx("br",{}),e[8]=h,e[9]=y):(h=e[8],y=e[9]);const g=String(o);let f,p;e[10]!==g?(f=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:g})]}),e[10]=g,e[11]=f):f=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("br",{}),e[12]=p):p=e[12];const v=String(c);let x,b,j;e[13]!==v?(x=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:v})]}),e[13]=v,e[14]=x):x=e[14],e[15]!==x||e[16]!==f?(b=s.jsxs(s.Fragment,{children:[u,d,h,y,f,p,x]}),e[15]=x,e[16]=f,e[17]=b):b=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Wn,{className:"w-3 h-3"}),e[18]=j):j=e[18];const O=String(c);let k,C;return e[19]!==O?(k=s.jsxs("span",{className:"text-[var(--amber-12)] text-xs flex items-center gap-1 border rounded px-2 py-1 bg-[var(--amber-2)] border-[var(--amber-6)] ml-1",children:[j,"Overridden by pyproject.toml [",O,"]"]}),e[19]=O,e[20]=k):k=e[20],e[21]!==b||e[22]!==k?(C=s.jsx(Tt,{content:b,children:k}),e[21]=b,e[22]=k,e[23]=C):C=e[23],C};function wc(t){return s.jsx("option",{value:t,children:t},t)}function Ic(t){return s.jsx("option",{value:t,children:t},t)}function Sc(t){return s.jsx("option",{value:t,children:t},t)}function Oc(t){return s.jsx("option",{value:t,children:t},t)}function kc(t){return s.jsx("option",{value:t,children:t},t)}function Cc(t){return s.jsx("option",{value:t,children:t},t)}function Nc(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function Dc(t){return s.jsx("option",{value:t,children:t},t)}function Tc(t){return s.jsx("option",{value:t,children:t},t)}function Ec(t){return s.jsx("option",{value:t,children:t},t)}function _c(t){return s.jsx("option",{value:t,children:t},t)}function Pc(t){return s.jsx("option",{value:t,children:t},t)}function Ac(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(z,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function Mc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(E,{className:R,children:[s.jsx(N,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(_,{children:s.jsx(fe,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(z,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function Rc(t){return s.jsx(Zs,{value:t.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:s.jsxs("div",{className:"flex gap-4 items-center text-lg overflow-hidden",children:[s.jsx("span",{className:St(t.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground flex-shrink-0"),children:s.jsx(t.Icon,{className:"w-4 h-4"})}),s.jsx("span",{className:"truncate",children:t.label})]})},t.id)}const vn=Ue(!1);function Lc(){const t=J.c(5),e=Dt(es),n=Dt(vn);let r;t[0]!==e||t[1]!==n?(r=a=>{e(a),n(!0)},t[0]=e,t[1]=n,t[2]=r):r=t[2];const i=r;let o;return t[3]!==i?(o={handleClick:i},t[3]=i,t[4]=o):o=t[4],o}const Fc=t=>{const e=J.c(32),{showAppConfig:n,disabled:r,tooltip:i}=t,o=n===void 0||n,a=r!==void 0&&r,l=i===void 0?"Settings":i,[c,u]=qe(vn),d=a?"disabled":"hint-green";let h,y,g;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Un,{strokeWidth:1.8}),e[0]=h):h=e[0],e[1]!==l?(y=s.jsx(Tt,{content:l,children:h}),e[1]=l,e[2]=y):y=e[2],e[3]!==a||e[4]!==d||e[5]!==y?(g=s.jsx(xt,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:a,color:d,children:y}),e[3]=a,e[4]=d,e[5]=y,e[6]=g):g=e[6];const f=g;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Rn,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:s.jsx(jc,{})}),e[7]=p):p=e[7];const v=p;if(!o){let U,q;return e[8]!==f?(U=s.jsx(ao,{children:f}),e[8]=f,e[9]=U):U=e[9],e[10]!==u||e[11]!==c||e[12]!==U?(q=s.jsxs(Ct,{open:c,onOpenChange:u,children:[U,v]}),e[10]=u,e[11]=c,e[12]=U,e[13]=q):q=e[13],q}let x,b,j,O,k,C,P,L,H;return e[14]!==f?(x=s.jsx(lo,{asChild:!0,children:f}),e[14]=f,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(zl,{}),j=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=b,e[17]=j):(b=e[16],j=e[17]),e[18]!==u?(O=()=>u(!0),e[18]=u,e[19]=O):O=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Un,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=k):k=e[20],e[21]!==O?(C=s.jsxs(co,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Hc,children:[b,j,s.jsxs(pe,{onClick:O,variant:"link",className:"px-0",children:[k,"User settings"]})]}),e[21]=O,e[22]=C):C=e[22],e[23]!==C||e[24]!==x?(P=s.jsxs(uo,{children:[x,C]}),e[23]=C,e[24]=x,e[25]=P):P=e[25],e[26]!==u||e[27]!==c?(L=s.jsx(Ct,{open:c,onOpenChange:u,children:v}),e[26]=u,e[27]=c,e[28]=L):L=e[28],e[29]!==P||e[30]!==L?(H=s.jsxs(s.Fragment,{children:[P,L]}),e[29]=P,e[30]=L,e[31]=H):H=e[31],H};function Hc(t){return t.preventDefault()}const zc=t=>{const e=J.c(12),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,a=i===void 0?"Shutdown":i,{openConfirm:l,closeModal:c}=ho(),u=qc;if(Be())return null;const d=o?"disabled":"red";let h,y,g,f;return e[0]!==c||e[1]!==n||e[2]!==l?(h=p=>{p.stopPropagation(),l({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(fo,{onClick:v=>{u(),c()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=c,e[1]=n,e[2]=l,e[3]=h):h=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(nt,{strokeWidth:1}),e[4]=y):y=e[4],e[5]!==o||e[6]!==d||e[7]!==h?(g=s.jsx(xt,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:d,className:"h-[27px] w-[27px]",disabled:o,onClick:h,children:y}),e[5]=o,e[6]=d,e[7]=h,e[8]=g):g=e[8],e[9]!==g||e[10]!==a?(f=s.jsx(Tt,{content:a,children:g}),e[9]=g,e[10]=a,e[11]=f):f=e[11],f};function Uc(){window.close()}function qc(){po(),setTimeout(Uc,200)}function Bc(t){window.open(go(`?file=${t}`).toString(),"_blank")}export{vo as A,yo as B,Fc as C,wo as G,fc as K,Io as L,So as M,Co as P,zc as S,Ml as T,No as Y,jo as a,qn as b,xt as c,nc as d,Xe as e,zi as f,Ll as g,cc as h,Hi as i,Lc as j,mn as k,Li as l,bt as m,Fi as n,Bc as o,Vn as p,Bn as q,Qi as r,vn as s,_i as t,Rl as u};