@marimo-team/frontend 0.14.16 → 0.14.17-dev31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ConnectedDataExplorerComponent-CJnMAC06.js → ConnectedDataExplorerComponent-DBpkhaEi.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-CsBDwSJz.js → ImageComparisonComponent-DQuZgtac.js} +1 -1
- package/dist/assets/{VegaLite-BVPLoKVT.js → VegaLite-D86nhhim.js} +1 -1
- package/dist/assets/{_baseEach-DGd582mx.js → _baseEach-BMoM4tyJ.js} +1 -1
- package/dist/assets/_baseMap-dBPxxH1_.js +1 -0
- package/dist/assets/{_baseUniq-3dgyUdOn.js → _baseUniq-CAAmm6SN.js} +1 -1
- package/dist/assets/{_createAggregator-FrHfH_H0.js → _createAggregator-CAMCvi8g.js} +1 -1
- package/dist/assets/{any-language-editor-CYKv-TNa.js → any-language-editor-DaxL8_sN.js} +1 -1
- package/dist/assets/{architectureDiagram-SUXI7LT5-oJaFkRfa.js → architectureDiagram-SUXI7LT5-BhRXBcSy.js} +1 -1
- package/dist/assets/{blockDiagram-6J76NXCF-BYMyn0hq.js → blockDiagram-6J76NXCF-BlE489sw.js} +1 -1
- package/dist/assets/{c4Diagram-6F6E4RAY-bkS32hqz.js → c4Diagram-6F6E4RAY-Cy6LRuaV.js} +1 -1
- package/dist/assets/channel-B6JXO3fs.js +1 -0
- package/dist/assets/{chunk-353BL4L5-BksYHD-a.js → chunk-353BL4L5-CJ2IY4ap.js} +1 -1
- package/dist/assets/{chunk-67H74DCK-CBG_04-r.js → chunk-67H74DCK-DId-jB3J.js} +1 -1
- package/dist/assets/{chunk-AACKK3MU-Df8we83t.js → chunk-AACKK3MU-B7tcgr1S.js} +1 -1
- package/dist/assets/{chunk-BFAMUDN2-7LjBVMDK.js → chunk-BFAMUDN2-CrmQgCE5.js} +1 -1
- package/dist/assets/{chunk-E2GYISFI-DAMw4fkJ.js → chunk-E2GYISFI-D-n8jgjd.js} +1 -1
- package/dist/assets/{chunk-OW32GOEJ-yUjobw9c.js → chunk-OW32GOEJ--iH27nu8.js} +1 -1
- package/dist/assets/{chunk-SKB7J2MH-DK2UL7Fg.js → chunk-SKB7J2MH-C7yzcJxW.js} +1 -1
- package/dist/assets/{chunk-SZ463SBG-BNW3pcWd.js → chunk-SZ463SBG-DSJVBGN2.js} +1 -1
- package/dist/assets/{circle-play-tWbKtgpW.js → circle-play-B-V3vZS2.js} +1 -1
- package/dist/assets/classDiagram-M3E45YP4-BmSrAbkk.js +1 -0
- package/dist/assets/classDiagram-v2-YAWTLIQI-BmSrAbkk.js +1 -0
- package/dist/assets/clone-FuXkkpUl.js +1 -0
- package/dist/assets/{compile-BV7bapig.js → compile-DV9yNheH.js} +1 -1
- package/dist/assets/{dagre-JOIXM2OF-ARMAsFTx.js → dagre-JOIXM2OF-BIttwNhp.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-RUGaEiu-.js → data-grid-overlay-editor-B5ydeAdd.js} +1 -1
- package/dist/assets/{diagram-5UYTHUR4-NsNPiVIn.js → diagram-5UYTHUR4-Uzf5awZi.js} +1 -1
- package/dist/assets/{diagram-VMROVX33-aeTRfhee.js → diagram-VMROVX33-CPx9s-dp.js} +1 -1
- package/dist/assets/{diagram-ZTM2IBQH-DPQOODta.js → diagram-ZTM2IBQH-qg72lh6h.js} +1 -1
- package/dist/assets/edit-page-CZppQMLn.js +148 -0
- package/dist/assets/{erDiagram-3M52JZNH-DCGqsHyv.js → erDiagram-3M52JZNH-HlKE0PkA.js} +1 -1
- package/dist/assets/{flowDiagram-KYDEHFYC-Bf2U4twQ.js → flowDiagram-KYDEHFYC-DIntU9jv.js} +1 -1
- package/dist/assets/{ganttDiagram-EK5VF46D-DNtsobIr.js → ganttDiagram-EK5VF46D-DTGE8Pce.js} +1 -1
- package/dist/assets/{gitGraphDiagram-GW3U2K7C-DzlCpyCT.js → gitGraphDiagram-GW3U2K7C-B44VVXmf.js} +1 -1
- package/dist/assets/glide-data-editor-CDLfxhSG.js +132 -0
- package/dist/assets/{graph-BSQF8u6w.js → graph-BLXwoRq0.js} +1 -1
- package/dist/assets/{home-page-DQX4-Ba6.js → home-page-DwS5o2fd.js} +1 -1
- package/dist/assets/{index-Bcef--wg.js → index-B-EVAHVl.js} +132 -132
- package/dist/assets/{index-afXa6DYI.js → index-BA_Au2d-.js} +1 -1
- package/dist/assets/{index-oBkfwVO1.js → index-BNknS44e.js} +1 -1
- package/dist/assets/{index-CmmsL5ND.js → index-BQJDn5Ho.js} +1 -1
- package/dist/assets/{index-CLhQR2MO.js → index-BVsmWScB.js} +1 -1
- package/dist/assets/{index-DcdypXBi.js → index-BcXfW2eP.js} +1 -1
- package/dist/assets/{index-D19r2KMk.js → index-CPnTHduj.js} +1 -1
- package/dist/assets/{index-B28vw_CO.js → index-Cak3dDDM.js} +1 -1
- package/dist/assets/{index-fzD4sVgi.js → index-Clol_M_k.js} +1 -1
- package/dist/assets/{index-BtlPDH1w.js → index-CqCgwPyu.js} +1 -1
- package/dist/assets/{index-DwB16Qx9.js → index-D-n8rXry.js} +1 -1
- package/dist/assets/{index-7QGHW6iO.js → index-DdK5QQrQ.js} +1 -1
- package/dist/assets/{index-C89KR2Pg.js → index-DxYHuwZv.js} +1 -1
- package/dist/assets/{index-D_d-ErDS.js → index-KiLjLzhB.js} +1 -1
- package/dist/assets/{index-zTWfqPgP.js → index-OB0xw62_.js} +1 -1
- package/dist/assets/{index-CNxVUYLC.js → index-VkO2i9w3.js} +1 -1
- package/dist/assets/{index-DlrGPnOz.js → index-XYR0C2gk.js} +1 -1
- package/dist/assets/{index-CwYSVQhR.js → index-bMi5RsNW.js} +1 -1
- package/dist/assets/{index-BZbfU8sl.js → index-oATEU95P.js} +1 -1
- package/dist/assets/infoDiagram-LHK5PUON-WKRp7XzS.js +2 -0
- package/dist/assets/{journeyDiagram-EWQZEKCU-BMzxCYXt.js → journeyDiagram-EWQZEKCU-2iPlsw5B.js} +1 -1
- package/dist/assets/{kanban-definition-ZSS6B67P-D1TzeA1D.js → kanban-definition-ZSS6B67P-C5brIhmj.js} +1 -1
- package/dist/assets/{layout-DKXwJxqQ.js → layout-CJLxx5k2.js} +1 -1
- package/dist/assets/{linear-BqvUFknI.js → linear-BDUJpoxU.js} +1 -1
- package/dist/assets/{links-DjQSL_d4.js → links-BIFj97mm.js} +2 -2
- package/dist/assets/{mermaid-DtZe25vs.js → mermaid-CR-9hv2N.js} +4 -4
- package/dist/assets/{min-T_V1UNpm.js → min-DcOd6fso.js} +1 -1
- package/dist/assets/{mindmap-definition-6CBA2TL7-GbGAzB4w.js → mindmap-definition-6CBA2TL7-Z2b8kyAo.js} +1 -1
- package/dist/assets/{number-overlay-editor-CT3Bbwhy.js → number-overlay-editor-CxsfxLoW.js} +1 -1
- package/dist/assets/{pieDiagram-NIOCPIFQ-BePPH_yI.js → pieDiagram-NIOCPIFQ-Dfjv-pgA.js} +1 -1
- package/dist/assets/{quadrantDiagram-2OG54O6I-Bp5iEbsv.js → quadrantDiagram-2OG54O6I-L1qsq_Hj.js} +1 -1
- package/dist/assets/{react-plotly-Bf7XLEkq.js → react-plotly-NtQjYffK.js} +1 -1
- package/dist/assets/{requirementDiagram-QOLK2EJ7-D7h-YWPj.js → requirementDiagram-QOLK2EJ7-DpTDRdp7.js} +1 -1
- package/dist/assets/{run-page-D0-MLs--.js → run-page-CzFKj33Z.js} +1 -1
- package/dist/assets/{sankeyDiagram-4UZDY2LN-CTTAu-FR.js → sankeyDiagram-4UZDY2LN-B3UtweMD.js} +1 -1
- package/dist/assets/{sequenceDiagram-SKLFT4DO-Dkt7Gsr9.js → sequenceDiagram-SKLFT4DO-CqzRfpAM.js} +1 -1
- package/dist/assets/{slides-component-xWZ54aTo.js → slides-component-ChUzspNa.js} +1 -1
- package/dist/assets/{sortBy-DyX67t2U.js → sortBy-CnX6hsm8.js} +1 -1
- package/dist/assets/{stateDiagram-MI5ZYTHO-PqEnKY2K.js → stateDiagram-MI5ZYTHO-CgmP86Xh.js} +1 -1
- package/dist/assets/stateDiagram-v2-5AN5P6BG-CjhDB2Py.js +1 -0
- package/dist/assets/{storage-DYZfd7WX.js → storage-BLci8KSF.js} +3 -3
- package/dist/assets/{terminal-CW9Gz5fJ.js → terminal-DGfvmYHB.js} +1 -1
- package/dist/assets/{time-CGVH8-aM.js → time-CEyhHOn8.js} +1 -1
- package/dist/assets/{timeline-definition-MYPXXCX6-gcbyIilR.js → timeline-definition-MYPXXCX6-hXvpmUJD.js} +1 -1
- package/dist/assets/{tracing-DOI7eeYB.js → tracing-BUfPnWEM.js} +2 -2
- package/dist/assets/{trash-X_flm9rm.js → trash-p7vgY4vi.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-K8LGav4g.js → treemap-75Q7IDZK-7yfO5QYy.js} +1 -1
- package/dist/assets/{vega-component-DwbDQFNM.js → vega-component-YqIhXiLv.js} +1 -1
- package/dist/assets/{xychartDiagram-H2YORKM3-Z4KkyQAu.js → xychartDiagram-H2YORKM3-BW4mOCN4.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/_baseMap-BynvX5nz.js +0 -1
- package/dist/assets/channel-CquRobwU.js +0 -1
- package/dist/assets/classDiagram-M3E45YP4-K4hY8E2v.js +0 -1
- package/dist/assets/classDiagram-v2-YAWTLIQI-K4hY8E2v.js +0 -1
- package/dist/assets/clone-BTOAhq7k.js +0 -1
- package/dist/assets/edit-page-EYCHSVV0.js +0 -148
- package/dist/assets/glide-data-editor-DIHcugIW.js +0 -132
- package/dist/assets/infoDiagram-LHK5PUON-CKK3kFzR.js +0 -2
- package/dist/assets/stateDiagram-v2-5AN5P6BG-B-Dq9VrR.js +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import{ci as as,aO as ls,c as te,T as S,b as Ue,j as s,fA as cs,fB as us,a as K,cF as ds,ar as Nt,fC as hs,fD as In,ff as fs,fE as Sn,fF as D,fG as On,fH as T,fI as C,fJ as E,fK as he,fL as _,bs as ue,fM as kn,fN as F,fO as Y,ac as Ae,fP as le,bt as $,fQ as rt,fR as gs,e7 as Cn,fS as Nn,fT as ps,fU as ms,dU as it,al as qe,fV as vs,fW as Dn,b5 as ys,fX as xs,L as B,fY as bs,fZ as js,f_ as ws,f$ as Me,g0 as Is,g1 as Ss,cq as Os,bg as Be,bu as st,ey as ot,a6 as pe,ev as ks,dQ as Tn,ad as Cs,ab as Ns,g2 as Ds,g3 as Ts,g4 as we,g5 as En,g6 as Es,g7 as _n,g8 as at,g9 as Pn,ga as _s,gb as lt,gc as Z,gd as Ps,ge as As,dx as Dt,fq as Ms,gf as Tt,gg as Rs,gh as Ls,gi as An,gj as Mn,gk as Fs,eV as Rn,U as ct,gl as Hs,gm as zs,gn as Ln,go as Fn,gp as Hn,gq as Us,gr as zn,a4 as Et,gs as qs,gt as Bs,a7 as Un,a8 as Vs,a9 as Ws,cl as qn,gu as Gs,gv as Bn,at as Ve,aJ as Ks,gw as Vn,gx as _t,aw as Ys,gy as $s,ag as We,_ as Wn,gz as Xs,E as Qs,gA as Zs,gB as ut,gC as Js,gD as eo,ao as Pt,fo as to,gE as no,gF as ro,gG as io,gH as so,gI as oo,gJ as ao,et as Ge,dH as dt,bq as At,gK as lo,gL as co,gM as uo,gN as Gn,a5 as ho,gO as fo,gP as go,gQ as po,bd as mo,bl as vo,gR as yo,bb as xo}from"./index-
|
1
|
+
import{ci as as,aO as ls,c as te,T as S,b as Ue,j as s,fA as cs,fB as us,a as K,cF as ds,ar as Nt,fC as hs,fD as In,ff as fs,fE as Sn,fF as D,fG as On,fH as T,fI as C,fJ as E,fK as he,fL as _,bs as ue,fM as kn,fN as F,fO as Y,ac as Ae,fP as le,bt as $,fQ as rt,fR as gs,e7 as Cn,fS as Nn,fT as ps,fU as ms,dU as it,al as qe,fV as vs,fW as Dn,b5 as ys,fX as xs,L as B,fY as bs,fZ as js,f_ as ws,f$ as Me,g0 as Is,g1 as Ss,cq as Os,bg as Be,bu as st,ey as ot,a6 as pe,ev as ks,dQ as Tn,ad as Cs,ab as Ns,g2 as Ds,g3 as Ts,g4 as we,g5 as En,g6 as Es,g7 as _n,g8 as at,g9 as Pn,ga as _s,gb as lt,gc as Z,gd as Ps,ge as As,dx as Dt,fq as Ms,gf as Tt,gg as Rs,gh as Ls,gi as An,gj as Mn,gk as Fs,eV as Rn,U as ct,gl as Hs,gm as zs,gn as Ln,go as Fn,gp as Hn,gq as Us,gr as zn,a4 as Et,gs as qs,gt as Bs,a7 as Un,a8 as Vs,a9 as Ws,cl as qn,gu as Gs,gv as Bn,at as Ve,aJ as Ks,gw as Vn,gx as _t,aw as Ys,gy as $s,ag as We,_ as Wn,gz as Xs,E as Qs,gA as Zs,gB as ut,gC as Js,gD as eo,ao as Pt,fo as to,gE as no,gF as ro,gG as io,gH as so,gI as oo,gJ as ao,et as Ge,dH as dt,bq as At,gK as lo,gL as co,gM as uo,gN as Gn,a5 as ho,gO as fo,gP as go,gQ as po,bd as mo,bl as vo,gR as yo,bb as xo}from"./index-B-EVAHVl.js";import{e as bo}from"./index-BNknS44e.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 gi(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 pi(t){var e=null;return function(){return e==null&&(e=t()),e}}function vl(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 mi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var yl=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),mi(this,"entered",[]),mi(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return vl(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}(),xl=pi(function(){return/firefox/i.test(navigator.userAgent)}),vi=pi(function(){return!!window.safari});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 Qe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var yi=function(){function t(e,n){(function(H,z){if(!(H instanceof z))throw new TypeError("Cannot call a class as a function")})(this,t),Qe(this,"xs",void 0),Qe(this,"ys",void 0),Qe(this,"c1s",void 0),Qe(this,"c2s",void 0),Qe(this,"c3s",void 0);for(var r=e.length,i=[],o=0;o<r;o++)i.push(o);i.sort(function(H,z){return e[H]<e[z]?-1:1});for(var a,l,c=[],u=[],h=0;h<r-1;h++)a=e[h+1]-e[h],l=n[h+1]-n[h],c.push(a),u.push(l/a);for(var d=[u[0]],y=0;y<c.length-1;y++){var m=u[y],g=u[y+1];if(m*g<=0)d.push(0);else{a=c[y];var f=c[y+1],v=a+f;d.push(3*v/((v+f)/m+(v+a)/g))}}d.push(u[u.length-1]);for(var x,I=[],w=[],O=0;O<d.length-1;O++){x=u[O];var k=d[O],N=1/c[O],A=k+d[O+1]-x-x;I.push((x-k-A)*N),w.push(A*N*N)}this.xs=e,this.ys=n,this.c1s=d,this.c2s=I,this.c3s=w}return bl(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,h=a.length-1;u<=h;){var d=n[c=Math.floor(.5*(u+h))];if(d<e)u=c+1;else{if(!(d>e))return r[c];h=c-1}}var y=e-n[l=Math.max(0,h)],m=y*y;return r[l]+i[l]*y+o[l]*m+a[l]*y*m}}]),t}();function xi(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 yt(t){return{x:t.clientX,y:t.clientY}}function jl(t,e,n,r,i){var o,a,l,c=(o=e).nodeName==="IMG"&&(xl()||!((a=document.documentElement)!==null&&a!==void 0&&a.contains(o))),u=xi(c?t:e),h={x:n.x-u.x,y:n.y-u.y},d=t.offsetWidth,y=t.offsetHeight,m=r.anchorX,g=r.anchorY,f=function(k,N,A,H){var z=k?N.width:A,U=k?N.height:H;return vi()&&k&&(U/=window.devicePixelRatio,z/=window.devicePixelRatio),{dragPreviewWidth:z,dragPreviewHeight:U}}(c,e,d,y),v=f.dragPreviewWidth,x=f.dragPreviewHeight,I=i.offsetX,w=i.offsetY,O=w===0||w;return{x:I===0||I?I:new yi([0,.5,1],[h.x,h.x/d*v,h.x+v-d]).interpolate(m),y:O?w:(l=new yi([0,.5,1],[h.y,h.y/y*x,h.y+x-y]).interpolate(g),vi()&&c&&(l+=(window.devicePixelRatio-1)*x),l)}}var bi="__NATIVE_FILE__",ji="__NATIVE_URL__",wi="__NATIVE_TEXT__",Ii="__NATIVE_HTML__";const Si=Object.freeze(Object.defineProperty({__proto__:null,FILE:bi,HTML:Ii,TEXT:wi,URL:ji},Symbol.toStringTag,{value:"Module"}));function un(t,e,n){var r=e.reduce(function(i,o){return i||t.getData(o)},"");return r??n}var Ze;function xt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var dn=(xt(Ze={},bi,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),xt(Ze,Ii,{exposeProperties:{html:function(t,e){return un(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),xt(Ze,ji,{exposeProperties:{urls:function(t,e){return un(t,e,"").split(`
|
15
15
|
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),xt(Ze,wi,{exposeProperties:{text:function(t,e){return un(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Ze);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 Oi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Il=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Oi(this,"item",void 0),Oi(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return wl(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 hn(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys(dn).filter(function(n){return dn[n].matchesTypes.some(function(r){return e.indexOf(r)>-1})})[0]||null}function Sl(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 fn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ol=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),fn(this,"ownerDocument",null),fn(this,"globalContext",void 0),fn(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=n}return Sl(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 ki(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 Ci(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ki(Object(n),!0).forEach(function(r){L(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ki(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kl(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 L(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var gn,Cl=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),L(this,"options",void 0),L(this,"actions",void 0),L(this,"monitor",void 0),L(this,"registry",void 0),L(this,"enterLeaveCounter",void 0),L(this,"sourcePreviewNodes",new Map),L(this,"sourcePreviewNodeOptions",new Map),L(this,"sourceNodes",new Map),L(this,"sourceNodeOptions",new Map),L(this,"dragStartSourceIds",null),L(this,"dropTargetIds",[]),L(this,"dragEnterTargetIds",[]),L(this,"currentNativeSource",null),L(this,"currentNativeHandle",null),L(this,"currentDragSourceNode",null),L(this,"altKeyPressed",!1),L(this,"mouseMoveTimeoutTimer",null),L(this,"asyncEndDragFrameId",null),L(this,"dragOverTargetIds",null),L(this,"lastClientOffset",null),L(this,"hoverRafId",null),L(this,"getSourceClientOffset",function(o){var a=i.sourceNodes.get(o);return a&&xi(a)||null}),L(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),L(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),L(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),L(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),L(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var a=i.dragStartSourceIds;i.dragStartSourceIds=null;var l=yt(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:l});var c=o.dataTransfer,u=hn(c);if(i.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var h=i.monitor.getSourceId(),d=i.sourceNodes.get(h),y=i.sourcePreviewNodes.get(h)||d;if(y){var m=i.getCurrentSourcePreviewNodeOptions(),g=jl(d,y,l,{anchorX:m.anchorX,anchorY:m.anchorY},{offsetX:m.offsetX,offsetY:m.offsetY});c.setDragImage(y,g.x,g.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()}}}),L(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),L(this,"handleTopDragEnterCapture",function(o){if(i.dragEnterTargetIds=[],i.enterLeaveCounter.enter(o.target)&&!i.monitor.isDragging()){var a=o.dataTransfer,l=hn(a);l&&i.beginDragNativeItem(l,a)}}),L(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:yt(o)}),a.some(function(l){return i.monitor.canDropOnTarget(l)})&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),L(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),L(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=yt(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"))}),L(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault(),i.enterLeaveCounter.leave(o.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),L(this,"handleTopDropCapture",function(o){var a;i.dropTargetIds=[],i.isDraggingNativeItem()?(o.preventDefault(),(a=i.currentNativeSource)===null||a===void 0||a.loadDataTransfer(o.dataTransfer)):hn(o.dataTransfer)&&o.preventDefault(),i.enterLeaveCounter.reset()}),L(this,"handleTopDrop",function(o){var a=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(a,{clientOffset:yt(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),L(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 Ol(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new yl(this.isNodeInDocument)}return kl(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 Ci({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 Ci({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(Si).some(function(n){return Si[n]===e})}},{key:"beginDragNativeItem",value:function(e,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(r,i){var o=new Il(dn[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}(),Nl=function(t,e,n){return new Cl(t,e,n)};function Dl(t){const e=fe(),n=e.selectedIds,[r,i,o]=ul(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const a=e.isSelected(t.id)?Array.from(n):[t.id];return e.dispatch(Fe.dragStart(t.id,a)),{id:t.id,dragIds:a}},end:()=>{e.hideCursor(),e.dispatch(Fe.dragEnd())}}),[n,t]);return S.useEffect(()=>{o((gn||((gn=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),gn))},[o]),i}function bt(t,e){return{parentId:t||null,index:e}}function ze(t,e){return{type:"line",index:t,level:e}}function pn(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:ar(r)+1}}function Ni(t){var e;const n=function(d,y){const m=d.getBoundingClientRect(),g=y.x-Math.round(m.x),f=y.y-Math.round(m.y),v=m.height,x=f<v/2,I=!x,w=v/4,O=f>w&&f<v-w;return{x:g,inTopHalf:x,inBottomHalf:I,inMiddle:O,atTop:!O&&x,atBottom:!O&&I}}(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(d,y,m,g){return d?d.isInternal?g.atTop?[y,d]:g.inMiddle?[d,d]:[d,m]:g.inTopHalf?[y,d]:[d,m]:[y,null]}(o,l,a,n);if(o&&o.isInternal&&n.inMiddle)return{drop:bt(o.id,null),cursor:(h=o.id,{type:"highlight",id:h})};var h;if(!c)return{drop:bt((e=u==null?void 0:u.parent)===null||e===void 0?void 0:e.id,0),cursor:ze(0,0)};if(rr(c)){const d=ht(i,(u==null?void 0:u.level)||0,c.level);return{drop:pn(c,d),cursor:ze(c.rowIndex+1,d)}}if(ir(c)){const d=ht(i,(u==null?void 0:u.level)||0,c.level);return{drop:pn(c,d),cursor:ze(c.rowIndex+1,d)}}if(sr(c)){const d=ht(i,0,c.level+1);return d>c.level?{drop:bt(c.id,0),cursor:ze(c.rowIndex+1,d)}:{drop:pn(c,d),cursor:ze(c.rowIndex+1,d)}}return{drop:bt(c==null?void 0:c.id,0),cursor:ze(c.rowIndex+1,c.level+1)}}const Tl=Ue.memo(function({index:t,style:e}){nr(),function(){if(S.useContext(Jn)===null)throw new Error("Provide a NodesContext")}();const n=fe(),r=function(g){const f=fe(),v=f.at(g);if(!v)throw new Error(`Could not find node for index: ${g}`);return S.useMemo(()=>{const x=v.clone();return f.visibleNodes[g]=x,x},[...Object.values(v.state),v])}(t),i=S.useRef(null),o=Dl(r),a=function(g,f){const v=fe(),[x,I]=fi(()=>({accept:"NODE",canDrop:()=>v.canDrop(),hover:(w,O)=>{const k=O.getClientOffset();if(!g.current||!k)return;const{cursor:N,drop:A}=Ni({element:g.current,offset:k,indent:v.indent,node:f,prevNode:f.prev,nextNode:f.next});A&&v.dispatch(Fe.hovering(A.parentId,A.index)),O.canDrop()?N&&v.showCursor(N):v.hideCursor()},drop:(w,O)=>{if(!O.canDrop())return null;let{parentId:k,index:N,dragIds:A}=v.state.dnd;hr(v.props.onMove,{dragIds:A,parentId:k===Ye?null:k,index:N===null?0:N,dragNodes:v.dragNodes,parentNode:v.get(k)}),v.open(k)}}),[f,g.current,v.props]);return I}(i,r),l=S.useCallback(g=>{i.current=g,a(g)},[a]),c=n.indent*r.level,u=S.useMemo(()=>({paddingLeft:c}),[c]),h=S.useMemo(()=>{var g,f;return Object.assign(Object.assign({},e),{top:parseFloat(e.top)+((f=(g=n.props.padding)!==null&&g!==void 0?g:n.props.paddingTop)!==null&&f!==void 0?f:0)})},[e,n.props.padding,n.props.paddingTop]),d={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:h,tabIndex:-1,className:n.props.rowClassName};S.useEffect(()=>{var g;!r.isEditing&&r.isFocused&&((g=i.current)===null||g===void 0||g.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);const y=n.renderNode,m=n.renderRow;return s.jsx(m,{node:r,innerRef:l,attrs:d,children:s.jsx(y,{node:r,tree:n,style:u,dragHandle:o})})});let mn="",Di=null;function Ti(){nr();const t=fe();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 lr(e.currentTarget);if(e.key==="Tab"&&e.shiftKey)return e.preventDefault(),void cr(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(Di),mn+=e.key,Di=setTimeout(()=>{mn=""},600);const r=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"&&o.toLowerCase().startsWith(mn)});r&&t.focus(r.id)},children:s.jsx(ia,{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:aa,innerElementType:ua,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:Tl})})}function Ei(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(_i),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(_i),n}(t.root)}function _i(t,e){t.rowIndex=e}const Pi=t=>t.reduce((e,n,r)=>(e[n.id]=r,e),{});var vn=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){var h;u.done?i(u.value):(h=u.value,h instanceof n?h:new n(function(d){d(h)})).then(a,l)}c((r=r.apply(t,e||[])).next())})};const{safeRun:X,identify:Oe,identifyNull:je}=Mo;class et{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=mr(this),this.visibleNodes=Ei(this),this.idToIndex=Pi(this.visibleNodes)}update(e){this.props=e,this.root=mr(this),this.visibleNodes=Ei(this),this.idToIndex=Pi(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=Ke(e,this.props.childrenAccessor||"children"))!==null&&n!==void 0?n:null}accessId(e){const n=Ke(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=dr(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 vn(this,arguments,void 0,function*(e={}){var n,r;const i=e.parentId===void 0?pr(this):e.parentId,o=(n=e.index)!==null&&n!==void 0?n:gr(this),a=(r=e.type)!==null&&r!==void 0?r:"leaf",l=yield X(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 vn(this,void 0,void 0,function*(){if(!e)return;const n=(Array.isArray(e)?e:[e]).map(Oe),r=n.map(i=>this.get(i)).filter(i=>!!i);yield X(this.props.onDelete,{nodes:r,ids:n})})}edit(e){const n=Oe(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(Lt(n)),new Promise(r=>{et.editPromise=r})}submit(e,n){return vn(this,void 0,void 0,function*(){if(!e)return;const r=Oe(e);yield X(this.props.onRename,{id:r,name:n,node:this.get(r)}),this.dispatch(Lt(null)),this.resolveEdit({cancelled:!1,value:n}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Lt(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const n=this.get(je(e));n&&X(this.props.onActivate,n)}resolveEdit(e){const n=et.editPromise;n&&n(e),et.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(Re(Oe(e))),n.scroll!==!1&&this.scrollTo(e),this.focusedNode&&X(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=Oe(e);r&&this.dispatch(Re(i)),this.dispatch(Vo(i)),this.dispatch(br(i)),this.dispatch(Ht(i)),this.scrollTo(i,n.align),this.focusedNode&&r&&X(this.props.onFocus,this.focusedNode),X(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const n=Oe(e);this.dispatch(xr(n)),X(this.props.onSelect,this.selectedNodes)}selectMulti(e){const n=this.get(je(e));n&&(this.dispatch(Re(n.id)),this.dispatch(yr(n.id)),this.dispatch(br(n.id)),this.dispatch(Ht(n.id)),this.scrollTo(n),this.focusedNode&&X(this.props.onFocus,this.focusedNode),X(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const n=Oe(e),{anchor:r,mostRecent:i}=this.state.nodes.selection;this.dispatch(Re(n)),this.dispatch(xr(this.nodesBetween(r,i))),this.dispatch(yr(this.nodesBetween(r,je(n)))),this.dispatch(Ht(n)),this.scrollTo(n),this.focusedNode&&X(this.props.onFocus,this.focusedNode),X(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),X(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Re((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&X(this.props.onFocus,this.focusedNode),X(this.props.onSelect,this.selectedNodes)}setSelection(e){var n;const r=new Set((n=e.ids)===null||n===void 0?void 0:n.map(Oe)),i=je(e.anchor),o=je(e.mostRecent);this.dispatch(Wo({ids:r,anchor:i,mostRecent:o})),X(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&&or(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(Fe.cursor({type:"none"}))}showCursor(e){this.dispatch(Fe.cursor(e))}open(e){const n=je(e);n&&(this.isOpen(n)||(this.dispatch(Ft.open(n,this.isFiltered)),X(this.props.onToggle,n)))}close(e){const n=je(e);n&&this.isOpen(n)&&(this.dispatch(Ft.close(n,this.isFiltered)),X(this.props.onToggle,n))}toggle(e){const n=je(e);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(e){const n=je(e);if(!n)return;const r=Rt(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(){ft(this.root,e=>{e.isInternal&&e.open()})}closeAll(){ft(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,n="smart"){if(!e)return;const r=Oe(e);return this.openParents(r),fr(()=>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===Ye)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!Ke(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!Ke(e,this.props.disableDrag||(()=>!1))}isDragging(e){const n=je(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=je(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(Re(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Ti}get renderRow(){return this.props.renderRow||zo}get renderNode(){return this.props.children||Uo}get renderDragPreview(){return this.props.renderDragPreview||jr}get renderCursor(){return this.props.renderCursor||Ho}}function re(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 Ai=typeof Symbol=="function"&&Symbol.observable||"@@observable",yn=()=>Math.random().toString(36).substring(7).split("").join("."),jt={INIT:`@@redux/INIT${yn()}`,REPLACE:`@@redux/REPLACE${yn()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yn()}`};function Mi(t,e,n){if(typeof t!="function")throw new Error(re(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(re(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(re(1));return n(Mi)(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((m,g)=>{a.set(g,m)}))}function h(){if(c)throw new Error(re(3));return i}function d(m){if(typeof m!="function")throw new Error(re(4));if(c)throw new Error(re(5));let g=!0;u();const f=l++;return a.set(f,m),function(){if(g){if(c)throw new Error(re(6));g=!1,u(),a.delete(f),o=null}}}function y(m){if(!function(g){if(typeof g!="object"||g===null)return!1;let f=g;for(;Object.getPrototypeOf(f)!==null;)f=Object.getPrototypeOf(f);return Object.getPrototypeOf(g)===f||Object.getPrototypeOf(g)===null}(m))throw new Error(re(7));if(m.type===void 0)throw new Error(re(8));if(typeof m.type!="string")throw new Error(re(17));if(c)throw new Error(re(9));try{c=!0,i=r(i,m)}finally{c=!1}return(o=a).forEach(g=>{g()}),m}return y({type:jt.INIT}),{dispatch:y,subscribe:d,getState:h,replaceReducer:function(m){if(typeof m!="function")throw new Error(re(10));r=m,y({type:jt.REPLACE})},[Ai]:function(){const m=d;return{subscribe(g){if(typeof g!="object"||g===null)throw new Error(re(11));function f(){const v=g;v.next&&v.next(h())}return f(),{unsubscribe:m(f)}},[Ai](){return this}}}}}function Ri(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:jt.INIT})===void 0)throw new Error(re(12));if(l(void 0,{type:jt.PROBE_UNKNOWN_ACTION()})===void 0)throw new Error(re(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 h=r[u],d=n[h],y=o[h],m=d(y,a);if(m===void 0)throw a&&a.type,new Error(re(14));c[h]=m,l=l||m!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}const El=Ri({nodes:Ri({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:vr(t.filtered,e)}):Object.assign(Object.assign({},t),{unfiltered:vr(t.unfiltered,e)}):t},selection:function(t=Le().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=Le().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=Le().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 Le().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},t),{parentId:e.parentId,index:e.index});default:return t}}}),_l=Le();function Pl({treeProps:t,imperativeHandle:e,children:n}){const r=S.useRef(null),i=S.useRef(null),o=S.useRef(Mi(El,Le(t))),a=us.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>_l),l=S.useMemo(()=>new et(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(Ft.clear(!0))},[l.props.searchTerm]),s.jsx(Zn.Provider,{value:l,children:s.jsx(tr.Provider,{value:c.current,children:s.jsx(Jn.Provider,{value:a.nodes,children:s.jsx(er.Provider,{value:a.dnd,children:s.jsx(Wa,Object.assign({backend:Nl,options:{rootElement:l.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:n}))})})})})}function Al(t){return function(){const e=fe(),[,n]=fi(()=>({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}=Ni({element:e.listEl.current,offset:o,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});l&&e.dispatch(Fe.hovering(l.parentId,l.index)),i.canDrop()?a&&e.showCursor(a):e.hideCursor()}}),[e]);n(e.listEl)}(),t.children}function Ml(){const t=fe().props.renderContainer||Ti;return s.jsx(s.Fragment,{children:s.jsx(t,{})})}function Rl(){const t=fe(),{offset:e,mouse:n,item:r,isDragging:i}=(o=d=>({offset:d.getSourceClientOffset(),mouse:d.getClientOffset(),item:d.getItem(),isDragging:d.isDragging()}),a=Te().getMonitor(),l=ml(li(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 h=t.props.renderDragPreview||jr;return s.jsx(h,{offset:e,mouse:n,id:(r==null?void 0:r.id)||null,dragIds:(r==null?void 0:r.dragIds)||[],isDragging:i})}class Li{constructor(e){this.root=function(n){const r=new Fi({id:"ROOT"},null);return r.children=n.map(i=>xn(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 xn(t,e){const n=new Fi(t,e);return t.children&&(n.children=t.children.map(r=>xn(r,n))),n}class Fi{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=xn(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 Ll=0;function Fl(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 Li(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:h})=>{const d={id:"simple-tree-id-"+Ll++,name:""};return h==="internal"&&(d.children=[]),a.create({parentId:c,index:u,data:d}),o(a.data),d},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 Hl=S.forwardRef(function(t,e){const n=Fl(t);return s.jsxs(Pl,{treeProps:n,imperativeHandle:e,children:[s.jsx(Al,{children:s.jsx(Ml,{})}),s.jsx(Rl,{})]})});function zl(t,e){const n=K.c(11),{delayMs:r,whenVisible:i,disabled:o}=e,a=o!==void 0&&o,l=S.useRef(void 0);let c,u,h,d,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?(h=()=>{if(r===null||a)return;const m=setInterval(()=>{var g;i&&document.visibilityState!=="visible"||((g=l.current)==null||g.call(l))},r);return()=>clearInterval(m)},d=[r,i,a],n[3]=r,n[4]=a,n[5]=i,n[6]=h,n[7]=d):(h=n[6],d=n[7]),S.useEffect(h,d),n[8]!==a||n[9]!==i?(y=()=>{var m;document.visibilityState==="visible"&&i&&!a&&((m=l.current)==null||m.call(l))},n[8]=a,n[9]=i,n[10]=y):y=n[10],ds(document,"visibilitychange",y),null}function Ul(){return["compact","medium","full","columns"]}const ql=t=>{const e=K.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},Hi=t=>{const e=K.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=Nt("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},Bl=t=>{const e=K.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},zi=[{label:"Auto (Default)",value:"auto"},{label:"Native",value:"native"},{label:"Polars",value:"polars"},{label:"Lazy Polars",value:"lazy-polars"},{label:"Pandas",value:"pandas"}],Vl=()=>{const t=K.c(30),[e,n]=hs();let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=In(fs),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=Sn(i);let a;t[3]!==n?(a=async I=>{await gs({config:I}).then(()=>{n(I)}).catch(()=>{n(I)})},t[3]=n,t[4]=a):a=t[4];const l=a;let c,u,h,d,y,m,g,f,v,x;return t[5]!==e.width?(c=[e.width],t[5]=e.width,t[6]=c):c=t[6],S.useEffect(Wl,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")?(h=s.jsxs("div",{children:[s.jsx(ql,{children:"Notebook Settings"}),s.jsx(Bl,{children:"Configure how your notebook or application looks and behaves."})]}),t[10]=h):h=t[10],t[11]!==o.control?(d=s.jsxs(wt,{title:"Display",children:[s.jsx(D,{control:o.control,name:"width",render:Kl}),s.jsx(D,{control:o.control,name:"app_title",render:Yl})]}),t[11]=o.control,t[12]=d):d=t[12],t[13]!==o.control?(y=s.jsxs(wt,{title:"Custom Files",children:[s.jsx(D,{control:o.control,name:"css_file",render:$l}),s.jsx(D,{control:o.control,name:"html_head_file",render:Xl})]}),t[13]=o.control,t[14]=y):y=t[14],t[15]!==o.control?(m=s.jsx(wt,{title:"Data",children:s.jsx(D,{control:o.control,name:"sql_output",render:Zl})}),t[15]=o.control,t[16]=m):m=t[16],t[17]!==o.control?(g=s.jsx(wt,{title:"Exporting outputs",children:s.jsx(D,{control:o.control,name:"auto_download",render:Jl})}),t[17]=o.control,t[18]=g):g=t[18],t[19]!==d||t[20]!==y||t[21]!==m||t[22]!==g?(f=s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[d,y,m,g]}),t[19]=d,t[20]=y,t[21]=m,t[22]=g,t[23]=f):f=t[23],t[24]!==f||t[25]!==u?(v=s.jsxs("form",{onChange:u,className:"flex flex-col gap-6",children:[h,f]}),t[24]=f,t[25]=u,t[26]=v):v=t[26],t[27]!==o||t[28]!==v?(x=s.jsx(On,{...o,children:v}),t[27]=o,t[28]=v,t[29]=x):x=t[29],x},wt=t=>{const e=K.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 Wl(){window.dispatchEvent(new Event("resize"))}function Gl(t){return s.jsx("option",{value:t,children:t},t)}function Kl(t){const{field:e}=t;return s.jsxs(T,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(C,{children:"Width"}),s.jsx(E,{children:s.jsx(he,{"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(Gl)})}),s.jsx(_,{})]})}function Yl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(C,{children:"App title"}),s.jsx(E,{children:s.jsx(ue,{...e,value:e.value??"",onChange:n=>{e.onChange(n.target.value),kn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(_,{})]}),s.jsx(F,{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 $l(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(C,{className:"flex-shrink-0",children:"Custom CSS"}),s.jsx(E,{children:s.jsx(ue,{...e,value:e.value??"",placeholder:"custom.css",onChange:n=>{e.onChange(n.target.value),kn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(_,{})]}),s.jsx(F,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function Xl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(C,{className:"flex-shrink-0",children:"HTML Head"}),s.jsx(E,{children:s.jsx(ue,{...e,value:e.value??"",placeholder:"head.html",onChange:n=>{e.onChange(n.target.value)}})}),s.jsx(_,{})]}),s.jsxs(F,{children:["A filepath to an HTML file to be injected into the"," ",s.jsx(Y,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function Ql(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function Zl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(C,{children:"SQL Output Type"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"sql-output-select",onChange:n=>{e.onChange(n.target.value),Ae({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:zi.map(Ql)})}),s.jsx(_,{})]}),s.jsxs(F,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",s.jsx(Y,{className:"inline",children:"native"}),". See the"," ",s.jsx(le,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}function Jl(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:"flex flex-col gap-2",children:[s.jsx(E,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($,{id:"html-checkbox",checked:e.value.includes("html"),onCheckedChange:()=>{e.onChange(rt(e.value,"html"))}}),s.jsx(C,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($,{id:"ipynb-checkbox",checked:e.value.includes("ipynb"),onCheckedChange:()=>{e.onChange(rt(e.value,"ipynb"))}}),s.jsx(C,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(_,{})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(Y,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}const ec=Cn("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"}}),tc=Cn("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"),It=Ue.forwardRef((t,e)=>{const n=K.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=Nn(ec({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});It.displayName="Button",Ue.forwardRef((t,e)=>{const n=K.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=Nn(tc(),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 nc=ps();const Ui="marimo:copilot:signedIn",qi=ys(Ui,null,void 0,{getOnInit:!0}),Bi=qe(null),St=qe(null);function Vi(){const t=localStorage.getItem(Ui)==="true",e=ms();return t&&e.completion.copilot==="github"}const xe=B.get("@github/copilot-language-server");class rc extends xs{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 as(i)&&(o="leading"in i?!!i.leading:o,a="trailing"in i?!!i.trailing:a),ls(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 xe.error("#request: Error",r),r}}async notify(e,n){return xe.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!Vi()}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&&xe.warn("#textDocumentDidChange: Multiple changes detected. This is not supported.",n);const r=n[0];"range"in r&&xe.warn("#textDocumentDidChange: Copilot doesn't support range changes.",r);const i=bs(r.text);return super.textDocumentDidChange({...e,contentChanges:[{text:i}],textDocument:js.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return Promise.resolve({contents:[]})}signOut(){return this._request("signOut",{})}async signInInitiate(){xe.log("#signInInitiate: Starting sign-in flow");try{const e=await this._request("signIn",{});return xe.log("#signInInitiate: Sign-in flow started successfully"),e}catch(e){throw xe.warn("#signInInitiate: Failed to start sign-in flow",e),e}}async signInConfirm(e){xe.log("#signInConfirm: Confirming sign-in");try{const n=await this._request("signInConfirm",e);return xe.log("#signInConfirm: Sign-in confirmed successfully"),n}catch(n){throw xe.warn("#signInConfirm: Failed to confirm sign-in",n),n}}async signedIn(){try{const{status:e}=await this._request("checkStatus",{});return xe.log("#checkStatus: Status check completed",{status:e}),e==="SignedIn"||e==="AlreadySignedIn"||e==="OK"}catch(e){throw xe.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,it.set(St,r);const i=await this.throttledGetCompletionInternal(e,n);var o;return o=n,it.get(St)===o&&it.set(St,null),n!==this.documentVersion?null:i??null}}const Wi="/__marimo_copilot__.py",Gi=`file://${Wi}`,ic=Me(()=>new sc);class sc extends nc.Transport{constructor(){super(),this.delegate=void 0,this.delegate=void 0}getWsUrl(){return Is().getLSPURL("copilot").toString()}async tryConnect(e=3,n=1e3){for(let r=1;r<=e;r++)try{return this.delegate||(this.delegate=new Ss.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,Ae({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 vs(Dn,e=>e.completion.copilot==="github"),await Os(),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 Je=Me(()=>new rc({rootUri:Gi,workspaceFolders:null,transport:ic()}));function oc(){return ws({documentUri:Gi,client:Je(),languageId:"copilot",hoverEnabled:!1,completionEnabled:!1,definitionEnabled:!1,renameEnabled:!1,codeActionsEnabled:!1,signatureHelpEnabled:!1,diagnosticsEnabled:!1,sendIncrementalChanges:!1})}const Ki=S.memo(()=>{const[t,e]=Be(qi),[n,r]=Be(Bi),[i,o]=S.useState(),[a,l]=S.useState(!1),c=async d=>{d.preventDefault(),l(!0);try{const{verificationUri:y,status:m,userCode:g}=await async function(){return await Je().signInInitiate()}();Xi(m)?e(!0):(r("signingIn"),o({url:y,code:g}))}finally{l(!1)}},u=async d=>{if(d.preventDefault(),i){l(!0);try{const y=await async function(m){const g=Je();try{B.log("Copilot#tryFinishSignIn: Attempting to confirm sign-in");const{status:f}=await g.signInConfirm({userCode:m});return Xi(f)?(B.log("Copilot#tryFinishSignIn: Sign-in confirmed successfully"),{success:!0}):(B.warn("Copilot#tryFinishSignIn: Sign-in confirmation returned unexpected status",{status:f}),{success:!1})}catch(f){return $i(f)?(B.error("Copilot#tryFinishSignIn: Connection error during sign-in",f),{success:!1,error:"connection"}):await async function(v){for(let x=0;x<Yi;x++)try{if(await new Promise(I=>setTimeout(I,ac)),await v.signedIn())return B.log("Copilot#tryFinishSignIn: Successfully signed in after retry"),{success:!0}}catch(I){if(B.warn("Copilot#tryFinishSignIn: Retry attempt failed",{attempt:x+1,maxRetries:Yi}),$i(I))return{success:!1,error:"connection"}}return B.error("Copilot#tryFinishSignIn: All sign-in attempts failed"),{success:!1}}(g)}}(i.code);y.success?(e(!0),r("signedIn")):y.error==="connection"?(r("connectionError"),Ae({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)}}},h=async d=>{d.preventDefault(),await async function(){await Je().signOut()}(),e(!1),r("signedOut")};return(()=>{switch(n??(t?"signedIn":"connecting")){case"connecting":return s.jsx(st,{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(Cs,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{i&&(await Ns(i.code),Ae({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:Ds({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(Tn,{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(Tn,{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(st,{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(ks,{className:"h-3 w-3 text-white"})}),"Connected"]}),s.jsx(pe,{onClick:h,size:"xs",variant:"text",children:"Disconnect"})]});case"connectionError":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(st,{className:"font-normal flex",children:[s.jsx(ot,{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(st,{className:"font-normal flex",children:[s.jsx(ot,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),s.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",s.jsx(le,{href:"https://docs.marimo.io/getting_started/index.html#github-copilot",children:"docs"}),"."]})]})}})()});Ki.displayName="CopilotConfig";const Yi=5,ac=3e3;function $i(t){return t instanceof Error&&(t.message.includes("ECONNREFUSED")||t.message.includes("WebSocket")||t.message.includes("network"))}function Xi(t){return t==="SignedIn"||t==="AlreadySignedIn"||t==="OK"}let Ot=null;class lc{constructor(e){this.view=void 0,this.abortController=new AbortController,this.view=e.view,this.view.dom.addEventListener("focus",()=>{Ot=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)if(Ts())e.style.display="none";else{const n=(Ot==null?void 0:Ot.deref())===this.view;e.style.display=n?"":"none"}}destroy(){this.abortController.abort()}}const Qi={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 cc(t,e){const n=t.split(/\s+/),r=n[0];let i=0;if(r in Qi){const o=Qi[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 Zi;const uc=Me(()=>{Z.defineAction("goToDefinition",t=>{const e=t.cm6;return Ps(e)}),Z.mapCommand("gd","action","goToDefinition",{},{context:"normal"}),Z.defineEx("write","w",t=>{const e=t.cm6;e&&e.state.facet(at).saveNotebook()})}),dc=Me(async()=>{var n;const t=it.get(Dn),e=(n=t.keymap)==null?void 0:n.vimrc;if(e)try{B.log(`Loading vimrc from ${e}`);const r=(await As({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=cc(c,a);u&&l.push(u)}return l}(r,B.warn);(function(o){function a(h){h.args&&h.args.lhs&&h.args.rhs?h.mode?Z.map(h.args.lhs,h.args.rhs,h.mode):Z.map(h.args.lhs,h.args.rhs):B.warn(`Could not execute vimrc command "${h.name}: expected arguments"`)}function l(h){h.args&&h.args.lhs&&h.args.rhs?h.mode?Z.noremap(h.args.lhs,h.args.rhs,h.mode):Z.noremap(h.args.lhs,h.args.rhs):B.warn(`Could not execute vimrc command "${h.name}: expected arguments"`)}function c(h){h.args&&h.args.lhs?h.mode?Z.unmap(h.args.lhs,h.mode):Z.unmap(h.args.lhs):B.warn(`Could not execute vimrc command "${h.name}: expected arguments"`)}function u(h){h.mode?Z.mapclear(h.mode):Z.mapclear()}for(const h of o)"map|nmap|vmap|imap".split("|").includes(h.name)?a(h):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(h.name)?l(h):"unmap|nunmap|vunmap|iunmap".split("|").includes(h.name)?c(h):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(h.name)?u(h):B.warn(`Could not execute vimrc command "${h.name}: unknown command"`)})(i)}catch(r){B.error("Failed to load vimrc:",r)}});class kt{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=lt(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(Dt("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){Dt("exitInsertMode"in Z,"Vim does not have an exitInsertMode method"),Dt("exitVisualMode"in Z,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=lt(i);if(!o){B.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const a=o.setSelections.bind(o);if(o.setSelections=()=>[],!Ji(o)){B.warn("Expected CodeMirror instance to have Vim state");continue}const l=o.state.vim;switch(n){case"normal":l.insertMode&&Z.exitInsertMode(o,!0),l.visualMode&&Z.exitVisualMode(o,!0);break;case"insert":l.insertMode||Z.handleKey(o,"i","")}o.setSelections=a}}}function Ji(t){return t.state.vim!==void 0}Zi=kt,kt.INSTANCES=new Zi;const hc=["default","vim"];function fc(t,e){switch(t.preset){case"default":return[we.of(es()),we.of(ts(e)),Tt.low(we.of([{key:"Escape",preventDefault:!0,run:n=>(n.contentDOM.blur(),!0)}]))];case"vim":return[we.of(pc()),we.of(ts(e)),we.of([{key:"Enter",run:n=>{var i;const r=lt(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&Ls(n)}}]),Tt.high(mc("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(at).deleteCell(),!0):!1)),Rs({status:!1}),Tt.high((uc(),dc(),[we.of([{key:"j",run:n=>{if(Es(n,!0)&&_n(n)){const r=n.state.facet(at),i=n.state.facet(Pn);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),we.of([{key:"k",run:n=>{if(_s(n)&&_n(n)){const r=n.state.facet(at),i=n.state.facet(Pn);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),we.of([{linux:"Ctrl-[",run:n=>{const r=lt(n);return r?Ji(r)?!!r.state.vim.insertMode&&(Z.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)}}]),En.define(n=>(requestAnimationFrame(()=>{kt.INSTANCES.addInstance(n)}),{destroy(){kt.INSTANCES.removeInstance(n)}})),En.define(n=>new lc({view:n}))]))];default:return Ms(t.preset),[]}}const gc=new Set([An,Mn]),es=Me(()=>Fs.filter(t=>!gc.has(t.run))),ts=t=>[{key:t.getHotkey("cell.toggleComment").key,run:An},{key:t.getHotkey("cell.toggleBlockComment").key,run:Mn}],pc=Me(()=>{const t=new Set(["Enter","Ctrl-v"]);return es().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function mc(t,e,n){let r="",i=0;return we.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 bn=qe(!1),vc=()=>{const t=K.c(81),[e,n]=Be(bn),[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]=Rn(),h=ct(Hs);let d,y;t[1]!==n?(d=()=>n(yc),t[1]=n,t[2]=d):d=t[2],zs("global.showHelp",d),t[3]!==c||t[4]!==u?(y=async ke=>{const ee={...c};u(ke),await Hn({config:ke}).catch(G=>{throw u(ee),G})},t[3]=c,t[4]=u,t[5]=y):y=t[5];const m=y;let g;t[6]!==c||t[7]!==r||t[8]!==m?(g=async ke=>{if(!r)return;const ee=ke.join("-"),G={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides,[r]:ee}}};i(null),l([]),await m(G)},t[6]=c,t[7]=r,t[8]=m,t[9]=g):g=t[9];const f=g;let v,x,I;if(t[10]!==c||t[11]!==r||t[12]!==f||t[13]!==h||t[14]!==e||t[15]!==a||t[16]!==m){I=Symbol.for("react.early_return_sentinel");{const ke=async()=>{if(!r)return;const G={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides}}};delete G.keymap.overrides[r],i(null),l([]),await m(G)};let ee;t[20]!==c||t[21]!==m?(ee=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const G={...c,keymap:{...c.keymap,overrides:{}}};i(null),l([]),await m(G)},t[20]=c,t[21]=m,t[22]=ee):ee=t[22],v=ee,e?x=G=>{const be=h.getHotkey(G);if(r===G){const nt=Us(G);return s.jsxs("div",{children:[s.jsx(ue,{defaultValue:a.join("+"),placeholder:be.name,onKeyDown:ae=>{ae.preventDefault();const Ce=[];if(ae.key==="Meta"||ae.key==="Control"||ae.key==="Alt"||ae.key==="Shift"||(ae.metaKey&&Ce.push(Fn()?"Cmd":"Meta"),ae.ctrlKey&&Ce.push("Ctrl"),ae.altKey&&Ce.push("Alt"),ae.shiftKey&&Ce.push("Shift"),ae.key==="-"))return;if(ae.key==="Escape"&&Ce.length===0)return i(null),void l([]);let wn=ae.key.toLowerCase();ae.key===" "&&(wn="Space"),Ce.push(wn),f(Ce)},autoFocus:!0,endAdornment:s.jsx(pe,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),l([])},children:s.jsx(ot,{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"}),nt.key!==be.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:ke,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:nt.key})]})]})]},G)}return s.jsxs("div",{className:"grid grid-cols-[auto,2fr,3fr] gap-2 items-center",children:[h.isEditable(G)?s.jsx(zn,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),i(G)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx(Ln,{className:"justify-end",shortcut:be.key}),s.jsx("span",{children:be.name.toLowerCase()})]},G)}:I=null}t[10]=c,t[11]=r,t[12]=f,t[13]=h,t[14]=e,t[15]=a,t[16]=m,t[17]=v,t[18]=x,t[19]=I}else v=t[17],x=t[18],I=t[19];if(I!==Symbol.for("react.early_return_sentinel"))return I;const w=x;let O,k,N,A,H,z,U,q,de,ie,se,Q,J,W,oe,ce,b,p,j,V,Se,Ee,_e,Pe,tt;if(t[23]!==c.keymap.preset||t[24]!==h||t[25]!==e||t[26]!==w||t[27]!==n){const ke=h.getHotkeyGroups(),ee=(be,nt)=>{const ae=ke[be];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:be}),nt]}),ae.map(w)]})},G=be=>ee(be,s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["Press"," ",c.keymap.preset==="vim"?s.jsxs(s.Fragment,{children:[s.jsx(Ln,{shortcut:Fn()?"Cmd":"Ctrl"}),s.jsx(Y,{children:"Esc"})]}):s.jsx(Y,{children:"Esc"})," ","in a cell to enter command mode"]}));N=Et,J=e,t[46]!==n?(W=be=>n(be),t[46]=n,t[47]=W):W=t[47],k=qs,se="sm:items-center sm:top-0",t[48]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Bs,{}),t[48]=Q):Q=t[48],O=Un,q=!1,de="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[49]===Symbol.for("react.memo_cache_sentinel")?(ie=s.jsx(Vs,{children:s.jsx(Ws,{children:"Shortcuts"})}),t[49]=ie):ie=t[49],z="flex flex-row gap-3",U=s.jsxs("div",{className:"w-1/2",children:[ee("Editing"),ee("Markdown")]}),oe="w-1/2",ce=ee("Navigation"),b=ee("Running Cells"),p=ee("Creation and Ordering"),A=G("Command"),H=ee("Other"),t[23]=c.keymap.preset,t[24]=h,t[25]=e,t[26]=w,t[27]=n,t[28]=O,t[29]=k,t[30]=N,t[31]=A,t[32]=H,t[33]=z,t[34]=U,t[35]=q,t[36]=de,t[37]=ie,t[38]=se,t[39]=Q,t[40]=J,t[41]=W,t[42]=oe,t[43]=ce,t[44]=b,t[45]=p}else O=t[28],k=t[29],N=t[30],A=t[31],H=t[32],z=t[33],U=t[34],q=t[35],de=t[36],ie=t[37],se=t[38],Q=t[39],J=t[40],W=t[41],oe=t[42],ce=t[43],b=t[44],p=t[45];return t[50]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[50]=j):j=t[50],t[51]!==v?(V=s.jsx(pe,{className:"mt-4 hover:bg-destructive/10 border-destructive hover:border-destructive",variant:"outline",size:"xs",onClick:v,tabIndex:-1,children:j}),t[51]=v,t[52]=V):V=t[52],t[53]!==A||t[54]!==H||t[55]!==V||t[56]!==oe||t[57]!==ce||t[58]!==b||t[59]!==p?(Se=s.jsxs("div",{className:oe,children:[ce,b,p,A,H,V]}),t[53]=A,t[54]=H,t[55]=V,t[56]=oe,t[57]=ce,t[58]=b,t[59]=p,t[60]=Se):Se=t[60],t[61]!==z||t[62]!==U||t[63]!==Se?(Ee=s.jsxs("div",{className:z,children:[U,Se]}),t[61]=z,t[62]=U,t[63]=Se,t[64]=Ee):Ee=t[64],t[65]!==O||t[66]!==q||t[67]!==de||t[68]!==ie||t[69]!==Ee?(_e=s.jsxs(O,{usePortal:q,className:de,children:[ie,Ee]}),t[65]=O,t[66]=q,t[67]=de,t[68]=ie,t[69]=Ee,t[70]=_e):_e=t[70],t[71]!==k||t[72]!==se||t[73]!==Q||t[74]!==_e?(Pe=s.jsxs(k,{className:se,children:[Q,_e]}),t[71]=k,t[72]=se,t[73]=Q,t[74]=_e,t[75]=Pe):Pe=t[75],t[76]!==N||t[77]!==J||t[78]!==W||t[79]!==Pe?(tt=s.jsx(N,{open:J,onOpenChange:W,children:Pe}),t[76]=N,t[77]=J,t[78]=W,t[79]=Pe,t[80]=tt):tt=t[80],tt};function yc(t){return!t}const ns=["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"],xc=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"];function rs(t,e){const n=K.c(10);let r;n[0]!==e||n[1]!==t?(r=qn(t,e),n[0]=e,n[1]=t,n[2]=r):r=n[2];const i=r,o=ct(Gs);let a;n[3]!==e||n[4]!==o?(a=qn(o,e),n[3]=e,n[4]=o,n[5]=a):a=n[5];const l=a,c=l!=null&&i!==l;let u;return n[6]!==i||n[7]!==c||n[8]!==l?(u={isOverridden:c,currentValue:i,overriddenValue:l},n[6]=i,n[7]=c,n[8]=l,n[9]=u):u=n[9],u}const bc=t=>{const e=K.c(3),{name:n,children:r}=t,[i]=Bn(),{isOverridden:o}=rs(i,n);let a;return e[0]!==r||e[1]!==o?(a=o?s.jsx(Ve,{delayDuration:200,content:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{children:["This setting is overridden by the"," ",s.jsx(Y,{className:"inline mx-[1px]",children:"pyproject.toml"})," config."]}),s.jsxs("p",{children:["To change it, edit the project config"," ",s.jsx(Y,{className:"inline mx-[1px]",children:"pyproject.toml"}),"directly."]})]}),children:s.jsx("div",{className:"text-muted-foreground opacity-80 cursor-not-allowed *:pointer-events-none",children:r})}):r,e[0]=r,e[1]=o,e[2]=a):a=e[2],a},is=[{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:[We()?{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"}];We()||is.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const jc=()=>{const t=K.c(21),[e]=Rn(),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}=Ks(Ic,r);if(l){let w;return t[2]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Wn,{size:"medium",centered:!0}),t[2]=w):w=t[2],w}if(o){let w;return t[3]!==o?(w=s.jsx(Qs,{error:o}),t[3]=o,t[4]=w):w=t[4],w}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 h;t[7]!==u?(h=new Set(u.map(Sc)),t[7]=u,t[8]=h):h=t[8];const d=h;let y,m,g,f,v,x,I;return t[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Hi,{children:"Optional Features"}),t[9]=y):y=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Zs,{children:s.jsxs(Vn,{children:[s.jsx(ut,{children:"Dependency"}),s.jsx(ut,{children:"Feature"}),s.jsx(ut,{children:"Status"}),s.jsx(ut,{})]})}),t[11]=g):g=t[11],t[12]!==d||t[13]!==n||t[14]!==a?(f=is.map(w=>{const O=w.packagesRequired.every(N=>d.has(N.name.split("[")[0])),k=w.packagesRequired.map(Oc).join(", ");return s.jsxs(Vn,{className:"text-sm",children:[s.jsx(_t,{children:w.description}),s.jsx(_t,{className:"font-mono text-xs",children:k}),s.jsx(_t,{children:O?s.jsxs("div",{className:"flex items-center",children:[s.jsx(Yn,{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(Ys,{className:"h-4 w-4 text-[var(--red-10)] mr-2"}),s.jsx(wc,{packageSpecs:[...w.packagesRequired,...w.additionalPackageInstalls],packageManager:n,onSuccess:a})]})})]},w.id)}),t[12]=d,t[13]=n,t[14]=a,t[15]=f):f=t[15],t[16]!==f?(v=s.jsxs(Js,{children:[g,s.jsx(eo,{children:f})]}),t[16]=f,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?(I=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[y,m,v,x]}),t[19]=v,t[20]=I):I=t[20],I},wc=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=Ue.useState(!1);return s.jsxs(pe,{size:"xs",variant:"outline",className:Nt("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 Xs({package:o});a.success?(n(),Ae({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(Y,{className:"inline",children:t.map(l=>l.name).join(", ")})," ","have been added to your environment."]})})):Ae({title:"Failed to install package",description:a.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(Wn,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(Kn,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function Ic(){return $s()}function Sc(t){return t.name}function Oc(t){return t.name}const M="flex flex-row items-center space-x-1 space-y-0",ss=[{id:"editor",label:"Editor",Icon:zn,className:"bg-[var(--blue-4)]"},{id:"display",label:"Display",Icon:Do,className:"bg-[var(--grass-4)]"},{id:"packageManagement",label:"Package Management",Icon:To,className:"bg-[var(--red-4)]"},{id:"runtime",label:"Runtime",Icon:$n,className:"bg-[var(--amber-4)]"},{id:"ai",label:"AI",Icon:Io,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:Xn,className:"bg-[var(--orange-4)]"},{id:"labs",label:"Labs",Icon:So,className:"bg-[var(--slate-4)]"}],os=qe(ss[0].id),kc=()=>{const t=K.c(48),[e,n]=Bn(),r=S.useRef(null),i=Pt(bn),[o,a]=Be(os),l=ct(to),c=ct(no);let u,h;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=In(ro),t[0]=u):u=t[0],t[1]!==e?(h={resolver:u,defaultValues:e},t[1]=e,t[2]=h):h=t[2];const d=Sn(h);let y;t[3]!==n?(y=async b=>{await Hn({config:b}).then(()=>{n(b)})},t[3]=n,t[4]=y):y=t[4];const m=y;let g;t[5]===Symbol.for("react.memo_cache_sentinel")?(g=We(),t[5]=g):g=t[5];const f=g;let v;t[6]!==e||t[7]!==d?(v=()=>{const b=d.getValues("completion.copilot");return b===!1?null:b==="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(le,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),s.jsx(D,{control:d.control,name:"completion.codeium_api_key",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"codeium-api-key-input",className:"m-0 inline-flex",placeholder:"key",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.codeium_api_key"})]})}})]}):b==="github"?s.jsx(Ki,{}):b==="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(D,{control:d.control,name:"completion.model",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Model"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"custom-model-input",className:"m-0 inline-flex",placeholder:"Qwen2.5-Coder-7B",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.model"})]})}}),s.jsx(D,{control:d.control,name:"completion.base_url",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Base URL"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"custom-base-url-input",className:"m-0 inline-flex",placeholder:"http://localhost:11434/v1",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.base_url"})]})}}),s.jsx(D,{control:d.control,name:"completion.api_key",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"custom-api-key-input",className:"m-0 inline-flex",placeholder:"key",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.api_key"})]})}})]}):void 0},t[6]=e,t[7]=d,t[8]=v):v=t[8];const x=v;let I;t[9]!==o||t[10]!==l||t[11]!==e||t[12]!==d||t[13]!==m||t[14]!==x||t[15]!==a||t[16]!==i?(I=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(ge,{title:"Autosave",children:[s.jsx(D,{control:d.control,name:"save.autosave",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autosave enabled"}),s.jsx(E,{children:s.jsx($,{"data-testid":"autosave-checkbox",checked:p.value==="after_delay",disabled:p.disabled,onCheckedChange:j=>{p.onChange(j?"after_delay":"off")}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(D,{control:d.control,name:"save.autosave_delay",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Autosave delay (seconds)"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:d.getValues("save.autosave")!=="after_delay",...p,value:p.value/1e3,minValue:1,onChange:j=>{p.onChange(1e3*j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"save.autosave_delay"})]})}})]}),s.jsxs(ge,{title:"Formatting",children:[s.jsx(D,{control:d.control,name:"save.format_on_save",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Format on save"}),s.jsx(E,{children:s.jsx($,{"data-testid":"format-on-save-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(D,{control:d.control,name:"formatting.line_length",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Line length"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"line-length-input",className:"m-0 w-24",...p,value:p.value,minValue:1,maxValue:1e3,onChange:j=>{p.onChange(j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(F,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(ge,{title:"Autocomplete",children:s.jsx(D,{control:d.control,name:"completion.activate_on_typing",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autocomplete"}),s.jsx(E,{children:s.jsx($,{"data-testid":"autocomplete-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(F,{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:j=>{j.preventDefault(),j.stopPropagation(),a("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(ge,{title:"Language Servers",children:[s.jsxs(F,{children:["See the"," ",s.jsx(le,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsxs(F,{children:[s.jsx("strong",{children:"Note:"})," When using multiple language servers, different features may conflict."]}),s.jsx(D,{control:d.control,name:"language_servers.pylsp.enabled",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(le,{href:"https://github.com/python-lsp/python-lsp-server",children:"docs"}),")"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"pylsp-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),p.value&&!l.pylsp&&s.jsxs(At,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(Y,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsx(D,{control:d.control,name:"language_servers.basedpyright.enabled",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"basedpyright (",s.jsx(le,{href:"https://github.com/DetachHead/basedpyright",children:"docs"}),")"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"basedpyright-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"language_servers.basedpyright.enabled"})]}),p.value&&!l.basedpyright&&s.jsxs(At,{kind:"danger",children:["basedpyright is not available in your current environment. Please install"," ",s.jsx(Y,{className:"inline",children:"basedpyright"})," in your environment."]})]})}}),s.jsx(D,{control:d.control,name:"language_servers.ty.enabled",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"ty (",s.jsx(le,{href:"https://github.com/astral-sh/ty",children:"docs"}),")"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"ty-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"language_servers.ty.enabled"})]}),p.value&&!l.ty&&s.jsxs(At,{kind:"danger",children:["ty is not available in your current environment. Please install ",s.jsx(Y,{className:"inline",children:"ty"})," in your environment."]})]})}}),s.jsx(D,{control:d.control,name:"diagnostics.enabled",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"diagnostics-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsxs(ge,{title:"Keymap",children:[s.jsx(D,{control:d.control,name:"keymap.preset",render:b=>{const{field:p}=b;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Keymap"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"keymap-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:hc.map(Cc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"keymap.preset"})]})})}}),s.jsx(D,{control:d.control,name:"keymap.destructive_delete",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Destructive delete"}),s.jsx(E,{children:s.jsx($,{"data-testid":"destructive-delete-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"keymap.destructive_delete"})]}),s.jsxs(F,{className:"flex items-center gap-1",children:["Allow deleting non-empty cells",s.jsx(Ve,{content:s.jsxs("div",{className:"max-w-xs",children:[s.jsx("strong",{children:"Use with caution:"})," Deleting cells with code can lose work and computed results since variables are removed from memory."]}),children:s.jsx(lo,{className:"w-3 h-3 text-[var(--amber-11)]"})})]}),s.jsx("div",{children:s.jsx(pe,{variant:"link",className:"mb-0 px-0",type:"button",onClick:j=>{j.preventDefault(),j.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})]})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(ge,{title:"Display",children:[s.jsx(D,{control:d.control,name:"display.default_width",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default width"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"user-config-width-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Nc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.default_width"})]}),s.jsx(F,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(D,{control:d.control,name:"display.theme",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Theme"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"theme-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:ao.map(Dc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.theme"})]}),s.jsx(F,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(D,{control:d.control,name:"display.code_editor_font_size",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Code editor font size (px)"}),s.jsx(E,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(Ge,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...p,value:p.value,minValue:8,maxValue:32,onChange:j=>{p.onChange(j),m(d.getValues())}})})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(D,{control:d.control,name:"display.reference_highlighting",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Reference highlighting"}),s.jsx(E,{children:s.jsx($,{"data-testid":"reference-highlighting-checkbox",checked:p.value,onCheckedChange:p.onChange})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(F,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(ge,{title:"Outputs",children:[s.jsx(D,{control:d.control,name:"display.cell_output",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Cell output area"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"cell-output-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["above","below"].map(Tc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.cell_output"})]}),s.jsx(F,{children:"Where to display cell's output."})]})}}),s.jsx(D,{control:d.control,name:"display.dataframes",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Dataframe viewer"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"display-dataframes-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(Ec)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.dataframes"})]}),s.jsx(F,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(D,{control:d.control,name:"display.default_table_page_size",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default table page size"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"default-table-page-size-input",className:"m-0 w-24",...p,value:p.value,minValue:1,step:1,onChange:j=>{p.onChange(j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(F,{children:"The default number of rows displayed in dataframes and SQL results."})]})}}),s.jsx(D,{control:d.control,name:"display.default_table_max_columns",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default table max columns"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"default-table-max-columns-input",className:"m-0 w-24",...p,value:p.value,minValue:1,step:1,onChange:j=>{p.onChange(j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.default_table_max_columns"})]}),s.jsx(F,{children:"The default maximum number of columns displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(ge,{title:"Package Management",children:s.jsx(D,{control:d.control,disabled:f,name:"package_management.manager",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Manager"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"package-manager-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:oo.map(_c)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(F,{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(le,{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(le,{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(Y,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(ge,{title:"Runtime configuration",children:[s.jsx(D,{control:d.control,name:"runtime.default_sql_output",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default SQL output"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"user-config-sql-output-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:zi.map(Pc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(F,{children:'The default SQL output format for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(D,{control:d.control,name:"runtime.default_auto_download",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Auto output formats"}),s.jsx(E,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($,{id:"html-checkbox",checked:Array.isArray(p.value)&&p.value.includes("html"),onCheckedChange:()=>{const j=Array.isArray(p.value)?p.value:[];p.onChange(rt(j,"html"))}}),s.jsx(C,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($,{id:"ipynb-checkbox",checked:Array.isArray(p.value)&&p.value.includes("ipynb"),onCheckedChange:()=>{const j=Array.isArray(p.value)?p.value:[];p.onChange(rt(j,"ipynb"))}}),s.jsx(C,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.default_auto_download"})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save notebooks in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(Y,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}}),s.jsx(D,{control:d.control,name:"runtime.auto_instantiate",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autorun on startup"}),s.jsx(E,{children:s.jsx($,{"data-testid":"auto-instantiate-checkbox",disabled:p.disabled,checked:p.value,onCheckedChange:p.onChange})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(F,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(D,{control:d.control,name:"runtime.on_cell_change",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"On cell change"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"on-cell-change-select",onChange:j=>p.onChange(j.target.value),value:p.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(Ac)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(F,{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(D,{control:d.control,name:"runtime.auto_reload",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"On module change"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"auto-reload-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:f,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(Mc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(F,{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(D,{control:d.control,name:"runtime.reactive_tests",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(E,{children:s.jsx($,{"data-testid":"reactive-test-checkbox",checked:p.value,onCheckedChange:p.onChange})})]}),s.jsx(R,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(_,{}),s.jsx(F,{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(F,{children:["Learn more in the"," ",s.jsx(le,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsxs(s.Fragment,{children:[s.jsxs(ge,{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(D,{control:d.control,name:"completion.copilot",render:b=>{const{field:p}=b;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Provider"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"copilot-select",onChange:j=>{j.target.value==="none"?p.onChange(!1):p.onChange(j.target.value)},value:p.value===!0?"github":p.value===!1?"none":p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["none","github","codeium","custom"].map(Rc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.copilot"})]})})}}),x()]}),s.jsxs(ge,{title:"AI Keys",children:[s.jsx(D,{control:d.control,name:"ai.open_ai.api_key",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"OpenAI API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-openai-api-key-input",className:"m-0 inline-flex",placeholder:"sk-proj...",...p,onChange:j=>{const V=j.target.value;V.includes("*")||p.onChange(V)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.open_ai.api_key"})]}),s.jsxs(F,{children:["Your OpenAI API key from"," ",s.jsx(le,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]})]})}}),s.jsx(D,{control:d.control,name:"ai.anthropic.api_key",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Anthropic API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-anthropic-api-key-input",className:"m-0 inline-flex",placeholder:"sk-ant...",...p,onChange:j=>{const V=j.target.value;V.includes("*")||p.onChange(V)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.anthropic.api_key"})]}),s.jsxs(F,{children:["Your Anthropic API key from"," ",s.jsx(le,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]})]})}}),s.jsx(D,{control:d.control,name:"ai.google.api_key",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Google AI API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-google-api-key-input",className:"m-0 inline-flex",placeholder:"AI...",...p,onChange:j=>{const V=j.target.value;V.includes("*")||p.onChange(V)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.google.api_key"})]}),s.jsxs(F,{children:["Your Google AI API key from"," ",s.jsx(le,{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(le,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),s.jsx(D,{control:d.control,disabled:f,name:"ai.bedrock.region_name",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"AWS Region"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"bedrock-region-select",onChange:j=>p.onChange(j.target.value),value:typeof p.value=="string"?p.value:"us-east-1",disabled:p.disabled,className:"inline-flex mr-2",children:xc.map(Lc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.bedrock.region_name"})]}),s.jsx(F,{children:"The AWS region where Bedrock service is available."})]})}}),s.jsx(D,{control:d.control,disabled:f,name:"ai.bedrock.profile_name",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"AWS Profile Name (Optional)"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"bedrock-profile-input",className:"m-0 inline-flex",placeholder:"default",...p,value:p.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.bedrock.profile_name"})]}),s.jsx(F,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})}})]}),s.jsxs(ge,{title:"AI Assist",children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add an API key to ",s.jsx(Y,{className:"inline",children:"marimo.toml"})," to activate marimo's AI assistant; see"," ",s.jsx(le,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html",children:"docs"})," ","for more info."]}),s.jsx(D,{control:d.control,disabled:f,name:"ai.open_ai.base_url",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Base URL"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-base-url-input",className:"m-0 inline-flex",placeholder:"https://api.openai.com/v1",...p})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.open_ai.base_url"})]}),s.jsx(F,{children:"This URL can be any OpenAI-compatible API endpoint."})]})}}),s.jsx(D,{control:d.control,disabled:f,name:"ai.open_ai.model",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Model"}),s.jsx(E,{children:s.jsx(ue,{list:"ai-model-datalist","data-testid":"ai-model-input",className:"m-0 inline-flex",placeholder:"gpt-4-turbo",...p})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.open_ai.model"})]}),s.jsx("datalist",{id:"ai-model-datalist",children:ns.map(Fc)}),s.jsx(F,{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(D,{control:d.control,name:"ai.rules",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(T,{children:[s.jsx(C,{children:"Custom Rules"}),s.jsx(E,{children:s.jsx(so,{"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",...p,value:p.value})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.rules"})]}),s.jsx(F,{children:"Custom rules to include in all AI completion prompts."})]})}})]})]});case"optionalDeps":return s.jsx(jc,{});case"labs":return s.jsxs(ge,{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(D,{control:d.control,name:"experimental.inline_ai_tooltip",render:Hc}),s.jsx(D,{control:d.control,name:"experimental.rtc_v2",render:zc}),s.jsx(D,{control:d.control,name:"experimental.performant_table_charts",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Performant Table Charts"}),s.jsx(E,{children:s.jsx($,{"data-testid":"performant-table-charts-checkbox",checked:p.value===!0,onCheckedChange:p.onChange})})]}),s.jsx(R,{userConfig:e,name:"experimental.performant_table_charts"}),s.jsx(F,{children:"Enable experimental table charts which are computed on the backend."})]})}})]})}},t[9]=o,t[10]=l,t[11]=e,t[12]=d,t[13]=m,t[14]=x,t[15]=a,t[16]=i,t[17]=I):I=t[17];const w=I;let O,k,N;t[18]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Y,{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")?(N=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",O,k,"Run ",s.jsx(Y,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[20]=N):N=t[20];const A=N;let H,z,U,q,de,ie,se,Q,J,W,oe,ce;return t[21]!==d||t[22]!==m?(H=d.handleSubmit(m),t[21]=d,t[22]=m,t[23]=H):H=t[23],t[24]!==a?(z=b=>a(b),t[24]=a,t[25]=z):z=t[25],t[26]===Symbol.for("react.memo_cache_sentinel")?(U=ss.map(Uc),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")?(de=s.jsx("div",{className:"flex-1"}),ie=!We()&&A,t[29]=de,t[30]=ie):(de=t[29],ie=t[30]),t[31]!==q?(se=s.jsxs(co,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[U,q,de,ie]}),t[31]=q,t[32]=se):se=t[32],t[33]!==o||t[34]!==z||t[35]!==se?(Q=s.jsx(uo,{value:o,onValueChange:z,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:se}),t[33]=o,t[34]=z,t[35]=se,t[36]=Q):Q=t[36],t[37]!==w?(J=w(),t[37]=w,t[38]=J):J=t[38],t[39]!==J?(W=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:J}),t[39]=J,t[40]=W):W=t[40],t[41]!==Q||t[42]!==W||t[43]!==H?(oe=s.jsxs("form",{ref:r,onChange:H,className:"flex text-pretty overflow-hidden",children:[Q,W]}),t[41]=Q,t[42]=W,t[43]=H,t[44]=oe):oe=t[44],t[45]!==d||t[46]!==oe?(ce=s.jsx(On,{...d,children:oe}),t[45]=d,t[46]=oe,t[47]=ce):ce=t[47],ce},ge=t=>{const e=K.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Hi,{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},R=t=>{const e=K.c(18),{userConfig:n,name:r}=t,{isOverridden:i,currentValue:o,overriddenValue:a}=rs(n,r);if(!i)return null;let l,c,u,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(Y,{className:"inline",children:"pyproject.toml"}),"."]}),c=s.jsx("br",{}),e[0]=l,e[1]=c):(l=e[0],c=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("span",{children:["Edit the ",s.jsx(Y,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),h=s.jsx("br",{}),e[2]=u,e[3]=h):(u=e[2],h=e[3]);const d=String(o);let y,m;e[4]!==d?(y=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:d})]}),e[4]=d,e[5]=y):y=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("br",{}),e[6]=m):m=e[6];const g=String(a);let f,v,x;e[7]!==g?(f=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:g})]}),e[7]=g,e[8]=f):f=e[8],e[9]!==y||e[10]!==f?(v=s.jsxs(s.Fragment,{children:[l,c,u,h,y,m,f]}),e[9]=y,e[10]=f,e[11]=v):v=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Xn,{className:"w-3 h-3"}),e[12]=x):x=e[12];const I=String(a);let w,O;return e[13]!==I?(w=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:[x,"Overridden by pyproject.toml [",I,"]"]}),e[13]=I,e[14]=w):w=e[14],e[15]!==v||e[16]!==w?(O=s.jsx(Ve,{content:v,children:w}),e[15]=v,e[16]=w,e[17]=O):O=e[17],O};function Cc(t){return s.jsx("option",{value:t,children:t},t)}function Nc(t){return s.jsx("option",{value:t,children:t},t)}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.value,children:t.label},t.value)}function Ac(t){return s.jsx("option",{value:t,children:t},t)}function Mc(t){return s.jsx("option",{value:t,children:t},t)}function Rc(t){return s.jsx("option",{value:t,children:t},t)}function Lc(t){return s.jsx("option",{value:t,children:t},t)}function Fc(t){return s.jsx("option",{value:t,children:t},t)}function Hc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(E,{children:s.jsx($,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function zc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(E,{children:s.jsx($,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function Uc(t){return s.jsx(io,{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:Nt(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 jn=qe(!1);function qc(){const t=K.c(5),e=Pt(os),n=Pt(jn);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 Bc=t=>{const e=K.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]=Be(jn),h=a?"disabled":"hint-green";let d,y,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Gn,{strokeWidth:1.8}),e[0]=d):d=e[0],e[1]!==l?(y=s.jsx(Ve,{content:l,children:d}),e[1]=l,e[2]=y):y=e[2],e[3]!==a||e[4]!==h||e[5]!==y?(m=s.jsx(It,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:a,color:h,children:y}),e[3]=a,e[4]=h,e[5]=y,e[6]=m):m=e[6];const g=m;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Un,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:s.jsx(kc,{})}),e[7]=f):f=e[7];const v=f;if(!o){let U,q;return e[8]!==g?(U=s.jsx(ho,{children:g}),e[8]=g,e[9]=U):U=e[9],e[10]!==u||e[11]!==c||e[12]!==U?(q=s.jsxs(Et,{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,I,w,O,k,N,A,H,z;return e[14]!==g?(x=s.jsx(fo,{asChild:!0,children:g}),e[14]=g,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(Vl,{}),w=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=I,e[17]=w):(I=e[16],w=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(Gn,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=k):k=e[20],e[21]!==O?(N=s.jsxs(go,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Vc,children:[I,w,s.jsxs(pe,{onClick:O,variant:"link",className:"px-0",children:[k,"User settings"]})]}),e[21]=O,e[22]=N):N=e[22],e[23]!==N||e[24]!==x?(A=s.jsxs(po,{children:[x,N]}),e[23]=N,e[24]=x,e[25]=A):A=e[25],e[26]!==u||e[27]!==c?(H=s.jsx(Et,{open:c,onOpenChange:u,children:v}),e[26]=u,e[27]=c,e[28]=H):H=e[28],e[29]!==A||e[30]!==H?(z=s.jsxs(s.Fragment,{children:[A,H]}),e[29]=A,e[30]=H,e[31]=z):z=e[31],z};function Vc(t){return t.preventDefault()}const Wc=t=>{const e=K.c(12),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,a=i===void 0?"Shutdown":i,{openConfirm:l,closeModal:c}=mo(),u=Kc;if(We())return null;const h=o?"disabled":"red";let d,y,m,g;return e[0]!==c||e[1]!==n||e[2]!==l?(d=f=>{f.stopPropagation(),l({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(vo,{onClick:v=>{u(),c()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=c,e[1]=n,e[2]=l,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ot,{strokeWidth:1}),e[4]=y):y=e[4],e[5]!==o||e[6]!==h||e[7]!==d?(m=s.jsx(It,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:h,className:"h-[27px] w-[27px]",disabled:o,onClick:d,children:y}),e[5]=o,e[6]=h,e[7]=d,e[8]=m):m=e[8],e[9]!==m||e[10]!==a?(g=s.jsx(Ve,{content:a,children:m}),e[9]=m,e[10]=a,e[11]=g):g=e[11],g};function Gc(){window.close()}function Kc(){yo(),setTimeout(Gc,200)}function Yc(t){window.open(xo(`?file=${t}`).toString(),"_blank")}export{jo as A,wo as B,Bc as C,bc as D,ko as G,vc as K,Co as L,No as M,Eo as P,Wc as S,Hl as T,_o as Y,Oo as a,Kn as b,It as c,oc as d,Je as e,Wi as f,Ul as g,fc as h,Vi as i,qc as j,bn as k,qi as l,St as m,Bi as n,Yc as o,$n as p,Yn as q,ns as r,jn as s,Li as t,zl as u};
|
17
|
+
`)){if(c.startsWith('"')||c.trim()==="")continue;const u=cc(c,a);u&&l.push(u)}return l}(r,B.warn);(function(o){function a(h){h.args&&h.args.lhs&&h.args.rhs?h.mode?Z.map(h.args.lhs,h.args.rhs,h.mode):Z.map(h.args.lhs,h.args.rhs):B.warn(`Could not execute vimrc command "${h.name}: expected arguments"`)}function l(h){h.args&&h.args.lhs&&h.args.rhs?h.mode?Z.noremap(h.args.lhs,h.args.rhs,h.mode):Z.noremap(h.args.lhs,h.args.rhs):B.warn(`Could not execute vimrc command "${h.name}: expected arguments"`)}function c(h){h.args&&h.args.lhs?h.mode?Z.unmap(h.args.lhs,h.mode):Z.unmap(h.args.lhs):B.warn(`Could not execute vimrc command "${h.name}: expected arguments"`)}function u(h){h.mode?Z.mapclear(h.mode):Z.mapclear()}for(const h of o)"map|nmap|vmap|imap".split("|").includes(h.name)?a(h):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(h.name)?l(h):"unmap|nunmap|vunmap|iunmap".split("|").includes(h.name)?c(h):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(h.name)?u(h):B.warn(`Could not execute vimrc command "${h.name}: unknown command"`)})(i)}catch(r){B.error("Failed to load vimrc:",r)}});class kt{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=lt(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(Dt("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){Dt("exitInsertMode"in Z,"Vim does not have an exitInsertMode method"),Dt("exitVisualMode"in Z,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=lt(i);if(!o){B.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const a=o.setSelections.bind(o);if(o.setSelections=()=>[],!Ji(o)){B.warn("Expected CodeMirror instance to have Vim state");continue}const l=o.state.vim;switch(n){case"normal":l.insertMode&&Z.exitInsertMode(o,!0),l.visualMode&&Z.exitVisualMode(o,!0);break;case"insert":l.insertMode||Z.handleKey(o,"i","")}o.setSelections=a}}}function Ji(t){return t.state.vim!==void 0}Zi=kt,kt.INSTANCES=new Zi;const hc=["default","vim"];function fc(t,e){switch(t.preset){case"default":return[we.of(es()),we.of(ts(e)),Tt.low(we.of([{key:"Escape",preventDefault:!0,run:n=>(n.contentDOM.blur(),!0)}]))];case"vim":return[we.of(pc()),we.of(ts(e)),we.of([{key:"Enter",run:n=>{var i;const r=lt(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&Ls(n)}}]),Tt.high(mc("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(at).deleteCell(),!0):!1)),Rs({status:!1}),Tt.high((uc(),dc(),[we.of([{key:"j",run:n=>{if(Es(n,!0)&&_n(n)){const r=n.state.facet(at),i=n.state.facet(Pn);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),we.of([{key:"k",run:n=>{if(_s(n)&&_n(n)){const r=n.state.facet(at),i=n.state.facet(Pn);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),we.of([{linux:"Ctrl-[",win:"Ctrl-[",run:n=>{const r=lt(n);return r?Ji(r)?!!r.state.vim.insertMode&&(Z.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)}}]),En.define(n=>(requestAnimationFrame(()=>{kt.INSTANCES.addInstance(n)}),{destroy(){kt.INSTANCES.removeInstance(n)}})),En.define(n=>new lc({view:n}))]))];default:return Ms(t.preset),[]}}const gc=new Set([An,Mn]),es=Me(()=>Fs.filter(t=>!gc.has(t.run))),ts=t=>[{key:t.getHotkey("cell.toggleComment").key,run:An},{key:t.getHotkey("cell.toggleBlockComment").key,run:Mn}],pc=Me(()=>{const t=new Set(["Enter","Ctrl-v"]);return es().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function mc(t,e,n){let r="",i=0;return we.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 bn=qe(!1),vc=()=>{const t=K.c(81),[e,n]=Be(bn),[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]=Rn(),h=ct(Hs);let d,y;t[1]!==n?(d=()=>n(yc),t[1]=n,t[2]=d):d=t[2],zs("global.showHelp",d),t[3]!==c||t[4]!==u?(y=async ke=>{const ee={...c};u(ke),await Hn({config:ke}).catch(G=>{throw u(ee),G})},t[3]=c,t[4]=u,t[5]=y):y=t[5];const m=y;let g;t[6]!==c||t[7]!==r||t[8]!==m?(g=async ke=>{if(!r)return;const ee=ke.join("-"),G={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides,[r]:ee}}};i(null),l([]),await m(G)},t[6]=c,t[7]=r,t[8]=m,t[9]=g):g=t[9];const f=g;let v,x,I;if(t[10]!==c||t[11]!==r||t[12]!==f||t[13]!==h||t[14]!==e||t[15]!==a||t[16]!==m){I=Symbol.for("react.early_return_sentinel");{const ke=async()=>{if(!r)return;const G={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides}}};delete G.keymap.overrides[r],i(null),l([]),await m(G)};let ee;t[20]!==c||t[21]!==m?(ee=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const G={...c,keymap:{...c.keymap,overrides:{}}};i(null),l([]),await m(G)},t[20]=c,t[21]=m,t[22]=ee):ee=t[22],v=ee,e?x=G=>{const be=h.getHotkey(G);if(r===G){const nt=Us(G);return s.jsxs("div",{children:[s.jsx(ue,{defaultValue:a.join("+"),placeholder:be.name,onKeyDown:ae=>{ae.preventDefault();const Ce=[];if(ae.key==="Meta"||ae.key==="Control"||ae.key==="Alt"||ae.key==="Shift"||(ae.metaKey&&Ce.push(Fn()?"Cmd":"Meta"),ae.ctrlKey&&Ce.push("Ctrl"),ae.altKey&&Ce.push("Alt"),ae.shiftKey&&Ce.push("Shift"),ae.key==="-"))return;if(ae.key==="Escape"&&Ce.length===0)return i(null),void l([]);let wn=ae.key.toLowerCase();ae.key===" "&&(wn="Space"),Ce.push(wn),f(Ce)},autoFocus:!0,endAdornment:s.jsx(pe,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),l([])},children:s.jsx(ot,{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"}),nt.key!==be.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:ke,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:nt.key})]})]})]},G)}return s.jsxs("div",{className:"grid grid-cols-[auto,2fr,3fr] gap-2 items-center",children:[h.isEditable(G)?s.jsx(zn,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),i(G)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx(Ln,{className:"justify-end",shortcut:be.key}),s.jsx("span",{children:be.name.toLowerCase()})]},G)}:I=null}t[10]=c,t[11]=r,t[12]=f,t[13]=h,t[14]=e,t[15]=a,t[16]=m,t[17]=v,t[18]=x,t[19]=I}else v=t[17],x=t[18],I=t[19];if(I!==Symbol.for("react.early_return_sentinel"))return I;const w=x;let O,k,N,A,H,z,U,q,de,ie,se,Q,J,W,oe,ce,b,p,j,V,Se,Ee,_e,Pe,tt;if(t[23]!==c.keymap.preset||t[24]!==h||t[25]!==e||t[26]!==w||t[27]!==n){const ke=h.getHotkeyGroups(),ee=(be,nt)=>{const ae=ke[be];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:be}),nt]}),ae.map(w)]})},G=be=>ee(be,s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["Press"," ",c.keymap.preset==="vim"?s.jsxs(s.Fragment,{children:[s.jsx(Ln,{shortcut:Fn()?"Cmd":"Ctrl"}),s.jsx(Y,{children:"Esc"})]}):s.jsx(Y,{children:"Esc"})," ","in a cell to enter command mode"]}));N=Et,J=e,t[46]!==n?(W=be=>n(be),t[46]=n,t[47]=W):W=t[47],k=qs,se="sm:items-center sm:top-0",t[48]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Bs,{}),t[48]=Q):Q=t[48],O=Un,q=!1,de="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[49]===Symbol.for("react.memo_cache_sentinel")?(ie=s.jsx(Vs,{children:s.jsx(Ws,{children:"Shortcuts"})}),t[49]=ie):ie=t[49],z="flex flex-row gap-3",U=s.jsxs("div",{className:"w-1/2",children:[ee("Editing"),ee("Markdown")]}),oe="w-1/2",ce=ee("Navigation"),b=ee("Running Cells"),p=ee("Creation and Ordering"),A=G("Command"),H=ee("Other"),t[23]=c.keymap.preset,t[24]=h,t[25]=e,t[26]=w,t[27]=n,t[28]=O,t[29]=k,t[30]=N,t[31]=A,t[32]=H,t[33]=z,t[34]=U,t[35]=q,t[36]=de,t[37]=ie,t[38]=se,t[39]=Q,t[40]=J,t[41]=W,t[42]=oe,t[43]=ce,t[44]=b,t[45]=p}else O=t[28],k=t[29],N=t[30],A=t[31],H=t[32],z=t[33],U=t[34],q=t[35],de=t[36],ie=t[37],se=t[38],Q=t[39],J=t[40],W=t[41],oe=t[42],ce=t[43],b=t[44],p=t[45];return t[50]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[50]=j):j=t[50],t[51]!==v?(V=s.jsx(pe,{className:"mt-4 hover:bg-destructive/10 border-destructive hover:border-destructive",variant:"outline",size:"xs",onClick:v,tabIndex:-1,children:j}),t[51]=v,t[52]=V):V=t[52],t[53]!==A||t[54]!==H||t[55]!==V||t[56]!==oe||t[57]!==ce||t[58]!==b||t[59]!==p?(Se=s.jsxs("div",{className:oe,children:[ce,b,p,A,H,V]}),t[53]=A,t[54]=H,t[55]=V,t[56]=oe,t[57]=ce,t[58]=b,t[59]=p,t[60]=Se):Se=t[60],t[61]!==z||t[62]!==U||t[63]!==Se?(Ee=s.jsxs("div",{className:z,children:[U,Se]}),t[61]=z,t[62]=U,t[63]=Se,t[64]=Ee):Ee=t[64],t[65]!==O||t[66]!==q||t[67]!==de||t[68]!==ie||t[69]!==Ee?(_e=s.jsxs(O,{usePortal:q,className:de,children:[ie,Ee]}),t[65]=O,t[66]=q,t[67]=de,t[68]=ie,t[69]=Ee,t[70]=_e):_e=t[70],t[71]!==k||t[72]!==se||t[73]!==Q||t[74]!==_e?(Pe=s.jsxs(k,{className:se,children:[Q,_e]}),t[71]=k,t[72]=se,t[73]=Q,t[74]=_e,t[75]=Pe):Pe=t[75],t[76]!==N||t[77]!==J||t[78]!==W||t[79]!==Pe?(tt=s.jsx(N,{open:J,onOpenChange:W,children:Pe}),t[76]=N,t[77]=J,t[78]=W,t[79]=Pe,t[80]=tt):tt=t[80],tt};function yc(t){return!t}const ns=["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"],xc=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"];function rs(t,e){const n=K.c(10);let r;n[0]!==e||n[1]!==t?(r=qn(t,e),n[0]=e,n[1]=t,n[2]=r):r=n[2];const i=r,o=ct(Gs);let a;n[3]!==e||n[4]!==o?(a=qn(o,e),n[3]=e,n[4]=o,n[5]=a):a=n[5];const l=a,c=l!=null&&i!==l;let u;return n[6]!==i||n[7]!==c||n[8]!==l?(u={isOverridden:c,currentValue:i,overriddenValue:l},n[6]=i,n[7]=c,n[8]=l,n[9]=u):u=n[9],u}const bc=t=>{const e=K.c(3),{name:n,children:r}=t,[i]=Bn(),{isOverridden:o}=rs(i,n);let a;return e[0]!==r||e[1]!==o?(a=o?s.jsx(Ve,{delayDuration:200,content:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{children:["This setting is overridden by the"," ",s.jsx(Y,{className:"inline mx-[1px]",children:"pyproject.toml"})," config."]}),s.jsxs("p",{children:["To change it, edit the project config"," ",s.jsx(Y,{className:"inline mx-[1px]",children:"pyproject.toml"}),"directly."]})]}),children:s.jsx("div",{className:"text-muted-foreground opacity-80 cursor-not-allowed *:pointer-events-none",children:r})}):r,e[0]=r,e[1]=o,e[2]=a):a=e[2],a},is=[{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:[We()?{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"}];We()||is.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const jc=()=>{const t=K.c(21),[e]=Rn(),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}=Ks(Ic,r);if(l){let w;return t[2]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Wn,{size:"medium",centered:!0}),t[2]=w):w=t[2],w}if(o){let w;return t[3]!==o?(w=s.jsx(Qs,{error:o}),t[3]=o,t[4]=w):w=t[4],w}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 h;t[7]!==u?(h=new Set(u.map(Sc)),t[7]=u,t[8]=h):h=t[8];const d=h;let y,m,g,f,v,x,I;return t[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Hi,{children:"Optional Features"}),t[9]=y):y=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Zs,{children:s.jsxs(Vn,{children:[s.jsx(ut,{children:"Dependency"}),s.jsx(ut,{children:"Feature"}),s.jsx(ut,{children:"Status"}),s.jsx(ut,{})]})}),t[11]=g):g=t[11],t[12]!==d||t[13]!==n||t[14]!==a?(f=is.map(w=>{const O=w.packagesRequired.every(N=>d.has(N.name.split("[")[0])),k=w.packagesRequired.map(Oc).join(", ");return s.jsxs(Vn,{className:"text-sm",children:[s.jsx(_t,{children:w.description}),s.jsx(_t,{className:"font-mono text-xs",children:k}),s.jsx(_t,{children:O?s.jsxs("div",{className:"flex items-center",children:[s.jsx(Yn,{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(Ys,{className:"h-4 w-4 text-[var(--red-10)] mr-2"}),s.jsx(wc,{packageSpecs:[...w.packagesRequired,...w.additionalPackageInstalls],packageManager:n,onSuccess:a})]})})]},w.id)}),t[12]=d,t[13]=n,t[14]=a,t[15]=f):f=t[15],t[16]!==f?(v=s.jsxs(Js,{children:[g,s.jsx(eo,{children:f})]}),t[16]=f,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?(I=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[y,m,v,x]}),t[19]=v,t[20]=I):I=t[20],I},wc=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=Ue.useState(!1);return s.jsxs(pe,{size:"xs",variant:"outline",className:Nt("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 Xs({package:o});a.success?(n(),Ae({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(Y,{className:"inline",children:t.map(l=>l.name).join(", ")})," ","have been added to your environment."]})})):Ae({title:"Failed to install package",description:a.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(Wn,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(Kn,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function Ic(){return $s()}function Sc(t){return t.name}function Oc(t){return t.name}const M="flex flex-row items-center space-x-1 space-y-0",ss=[{id:"editor",label:"Editor",Icon:zn,className:"bg-[var(--blue-4)]"},{id:"display",label:"Display",Icon:Do,className:"bg-[var(--grass-4)]"},{id:"packageManagement",label:"Package Management",Icon:To,className:"bg-[var(--red-4)]"},{id:"runtime",label:"Runtime",Icon:$n,className:"bg-[var(--amber-4)]"},{id:"ai",label:"AI",Icon:Io,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:Xn,className:"bg-[var(--orange-4)]"},{id:"labs",label:"Labs",Icon:So,className:"bg-[var(--slate-4)]"}],os=qe(ss[0].id),kc=()=>{const t=K.c(48),[e,n]=Bn(),r=S.useRef(null),i=Pt(bn),[o,a]=Be(os),l=ct(to),c=ct(no);let u,h;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=In(ro),t[0]=u):u=t[0],t[1]!==e?(h={resolver:u,defaultValues:e},t[1]=e,t[2]=h):h=t[2];const d=Sn(h);let y;t[3]!==n?(y=async b=>{await Hn({config:b}).then(()=>{n(b)})},t[3]=n,t[4]=y):y=t[4];const m=y;let g;t[5]===Symbol.for("react.memo_cache_sentinel")?(g=We(),t[5]=g):g=t[5];const f=g;let v;t[6]!==e||t[7]!==d?(v=()=>{const b=d.getValues("completion.copilot");return b===!1?null:b==="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(le,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),s.jsx(D,{control:d.control,name:"completion.codeium_api_key",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"codeium-api-key-input",className:"m-0 inline-flex",placeholder:"key",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.codeium_api_key"})]})}})]}):b==="github"?s.jsx(Ki,{}):b==="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(D,{control:d.control,name:"completion.model",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Model"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"custom-model-input",className:"m-0 inline-flex",placeholder:"Qwen2.5-Coder-7B",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.model"})]})}}),s.jsx(D,{control:d.control,name:"completion.base_url",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Base URL"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"custom-base-url-input",className:"m-0 inline-flex",placeholder:"http://localhost:11434/v1",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.base_url"})]})}}),s.jsx(D,{control:d.control,name:"completion.api_key",render:p=>{const{field:j}=p;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"custom-api-key-input",className:"m-0 inline-flex",placeholder:"key",...j,value:j.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.api_key"})]})}})]}):void 0},t[6]=e,t[7]=d,t[8]=v):v=t[8];const x=v;let I;t[9]!==o||t[10]!==l||t[11]!==e||t[12]!==d||t[13]!==m||t[14]!==x||t[15]!==a||t[16]!==i?(I=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(ge,{title:"Autosave",children:[s.jsx(D,{control:d.control,name:"save.autosave",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autosave enabled"}),s.jsx(E,{children:s.jsx($,{"data-testid":"autosave-checkbox",checked:p.value==="after_delay",disabled:p.disabled,onCheckedChange:j=>{p.onChange(j?"after_delay":"off")}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(D,{control:d.control,name:"save.autosave_delay",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Autosave delay (seconds)"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:d.getValues("save.autosave")!=="after_delay",...p,value:p.value/1e3,minValue:1,onChange:j=>{p.onChange(1e3*j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"save.autosave_delay"})]})}}),s.jsx(D,{control:d.control,name:"runtime.default_auto_download",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Save cell outputs as"}),s.jsx(E,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($,{id:"html-checkbox",checked:Array.isArray(p.value)&&p.value.includes("html"),onCheckedChange:()=>{const j=Array.isArray(p.value)?p.value:[];p.onChange(rt(j,"html"))}}),s.jsx(C,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($,{id:"ipynb-checkbox",checked:Array.isArray(p.value)&&p.value.includes("ipynb"),onCheckedChange:()=>{const j=Array.isArray(p.value)?p.value:[];p.onChange(rt(j,"ipynb"))}}),s.jsx(C,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.default_auto_download"})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save notebooks in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(Y,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}})]}),s.jsxs(ge,{title:"Formatting",children:[s.jsx(D,{control:d.control,name:"save.format_on_save",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Format on save"}),s.jsx(E,{children:s.jsx($,{"data-testid":"format-on-save-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(D,{control:d.control,name:"formatting.line_length",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Line length"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"line-length-input",className:"m-0 w-24",...p,value:p.value,minValue:1,maxValue:1e3,onChange:j=>{p.onChange(j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(F,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(ge,{title:"Autocomplete",children:s.jsx(D,{control:d.control,name:"completion.activate_on_typing",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autocomplete"}),s.jsx(E,{children:s.jsx($,{"data-testid":"autocomplete-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(F,{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:j=>{j.preventDefault(),j.stopPropagation(),a("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(ge,{title:"Language Servers",children:[s.jsxs(F,{children:["See the"," ",s.jsx(le,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsxs(F,{children:[s.jsx("strong",{children:"Note:"})," When using multiple language servers, different features may conflict."]}),s.jsx(D,{control:d.control,name:"language_servers.pylsp.enabled",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(le,{href:"https://github.com/python-lsp/python-lsp-server",children:"docs"}),")"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"pylsp-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),p.value&&!l.pylsp&&s.jsxs(At,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(Y,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsx(D,{control:d.control,name:"language_servers.basedpyright.enabled",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"basedpyright (",s.jsx(le,{href:"https://github.com/DetachHead/basedpyright",children:"docs"}),")"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"basedpyright-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"language_servers.basedpyright.enabled"})]}),p.value&&!l.basedpyright&&s.jsxs(At,{kind:"danger",children:["basedpyright is not available in your current environment. Please install"," ",s.jsx(Y,{className:"inline",children:"basedpyright"})," in your environment."]})]})}}),s.jsx(D,{control:d.control,name:"language_servers.ty.enabled",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"ty (",s.jsx(le,{href:"https://github.com/astral-sh/ty",children:"docs"}),")"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"ty-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"language_servers.ty.enabled"})]}),p.value&&!l.ty&&s.jsxs(At,{kind:"danger",children:["ty is not available in your current environment. Please install ",s.jsx(Y,{className:"inline",children:"ty"})," in your environment."]})]})}}),s.jsx(D,{control:d.control,name:"diagnostics.enabled",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsxs(C,{children:[s.jsx(dt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(E,{children:s.jsx($,{"data-testid":"diagnostics-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsxs(ge,{title:"Keymap",children:[s.jsx(D,{control:d.control,name:"keymap.preset",render:b=>{const{field:p}=b;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Keymap"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"keymap-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:hc.map(Cc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"keymap.preset"})]})})}}),s.jsx(D,{control:d.control,name:"keymap.destructive_delete",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Destructive delete"}),s.jsx(E,{children:s.jsx($,{"data-testid":"destructive-delete-checkbox",checked:p.value,disabled:p.disabled,onCheckedChange:j=>{p.onChange(!!j)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"keymap.destructive_delete"})]}),s.jsxs(F,{className:"flex items-center gap-1",children:["Allow deleting non-empty cells",s.jsx(Ve,{content:s.jsxs("div",{className:"max-w-xs",children:[s.jsx("strong",{children:"Use with caution:"})," Deleting cells with code can lose work and computed results since variables are removed from memory."]}),children:s.jsx(lo,{className:"w-3 h-3 text-[var(--amber-11)]"})})]}),s.jsx("div",{children:s.jsx(pe,{variant:"link",className:"mb-0 px-0",type:"button",onClick:j=>{j.preventDefault(),j.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})]})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(ge,{title:"Display",children:[s.jsx(D,{control:d.control,name:"display.default_width",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default width"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"user-config-width-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Nc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.default_width"})]}),s.jsx(F,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(D,{control:d.control,name:"display.theme",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Theme"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"theme-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:ao.map(Dc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.theme"})]}),s.jsx(F,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(D,{control:d.control,name:"display.code_editor_font_size",render:b=>{const{field:p}=b;return s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Code editor font size (px)"}),s.jsx(E,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(Ge,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...p,value:p.value,minValue:8,maxValue:32,onChange:j=>{p.onChange(j),m(d.getValues())}})})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(D,{control:d.control,name:"display.reference_highlighting",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Reference highlighting"}),s.jsx(E,{children:s.jsx($,{"data-testid":"reference-highlighting-checkbox",checked:p.value,onCheckedChange:p.onChange})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(F,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(ge,{title:"Outputs",children:[s.jsx(D,{control:d.control,name:"display.cell_output",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Cell output area"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"cell-output-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["above","below"].map(Tc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.cell_output"})]}),s.jsx(F,{children:"Where to display cell's output."})]})}}),s.jsx(D,{control:d.control,name:"display.dataframes",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Dataframe viewer"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"display-dataframes-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(Ec)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.dataframes"})]}),s.jsx(F,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(D,{control:d.control,name:"display.default_table_page_size",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default table page size"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"default-table-page-size-input",className:"m-0 w-24",...p,value:p.value,minValue:1,step:1,onChange:j=>{p.onChange(j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(F,{children:"The default number of rows displayed in dataframes and SQL results."})]})}}),s.jsx(D,{control:d.control,name:"display.default_table_max_columns",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default table max columns"}),s.jsx(E,{children:s.jsx(Ge,{"data-testid":"default-table-max-columns-input",className:"m-0 w-24",...p,value:p.value,minValue:1,step:1,onChange:j=>{p.onChange(j),Number.isNaN(j)||m(d.getValues())}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"display.default_table_max_columns"})]}),s.jsx(F,{children:"The default maximum number of columns displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(ge,{title:"Package Management",children:s.jsx(D,{control:d.control,disabled:f,name:"package_management.manager",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Manager"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"package-manager-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:oo.map(_c)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(F,{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(le,{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(le,{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(Y,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(ge,{title:"Runtime configuration",children:[s.jsx(D,{control:d.control,name:"runtime.auto_instantiate",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autorun on startup"}),s.jsx(E,{children:s.jsx($,{"data-testid":"auto-instantiate-checkbox",disabled:p.disabled,checked:p.value,onCheckedChange:p.onChange})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(F,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(D,{control:d.control,name:"runtime.on_cell_change",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"On cell change"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"on-cell-change-select",onChange:j=>p.onChange(j.target.value),value:p.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(Pc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(F,{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(D,{control:d.control,name:"runtime.auto_reload",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"On module change"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"auto-reload-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:f,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(Ac)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(F,{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(D,{control:d.control,name:"runtime.default_sql_output",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Default SQL output"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"user-config-sql-output-select",onChange:j=>p.onChange(j.target.value),value:p.value,disabled:p.disabled,className:"inline-flex mr-2",children:zi.map(Mc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(F,{children:'The default SQL output type for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(D,{control:d.control,name:"runtime.reactive_tests",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(E,{children:s.jsx($,{"data-testid":"reactive-test-checkbox",checked:p.value,onCheckedChange:p.onChange})})]}),s.jsx(R,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(_,{}),s.jsx(F,{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(F,{children:["Learn more in the"," ",s.jsx(le,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsxs(s.Fragment,{children:[s.jsxs(ge,{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(D,{control:d.control,name:"completion.copilot",render:b=>{const{field:p}=b;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Provider"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"copilot-select",onChange:j=>{j.target.value==="none"?p.onChange(!1):p.onChange(j.target.value)},value:p.value===!0?"github":p.value===!1?"none":p.value,disabled:p.disabled,className:"inline-flex mr-2",children:["none","github","codeium","custom"].map(Rc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"completion.copilot"})]})})}}),x()]}),s.jsxs(ge,{title:"AI Keys",children:[s.jsx(D,{control:d.control,name:"ai.open_ai.api_key",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"OpenAI API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-openai-api-key-input",className:"m-0 inline-flex",placeholder:"sk-proj...",...p,onChange:j=>{const V=j.target.value;V.includes("*")||p.onChange(V)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.open_ai.api_key"})]}),s.jsxs(F,{children:["Your OpenAI API key from"," ",s.jsx(le,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]})]})}}),s.jsx(D,{control:d.control,name:"ai.anthropic.api_key",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Anthropic API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-anthropic-api-key-input",className:"m-0 inline-flex",placeholder:"sk-ant...",...p,onChange:j=>{const V=j.target.value;V.includes("*")||p.onChange(V)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.anthropic.api_key"})]}),s.jsxs(F,{children:["Your Anthropic API key from"," ",s.jsx(le,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]})]})}}),s.jsx(D,{control:d.control,name:"ai.google.api_key",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Google AI API Key"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-google-api-key-input",className:"m-0 inline-flex",placeholder:"AI...",...p,onChange:j=>{const V=j.target.value;V.includes("*")||p.onChange(V)}})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.google.api_key"})]}),s.jsxs(F,{children:["Your Google AI API key from"," ",s.jsx(le,{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(le,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),s.jsx(D,{control:d.control,disabled:f,name:"ai.bedrock.region_name",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"AWS Region"}),s.jsx(E,{children:s.jsx(he,{"data-testid":"bedrock-region-select",onChange:j=>p.onChange(j.target.value),value:typeof p.value=="string"?p.value:"us-east-1",disabled:p.disabled,className:"inline-flex mr-2",children:xc.map(Lc)})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.bedrock.region_name"})]}),s.jsx(F,{children:"The AWS region where Bedrock service is available."})]})}}),s.jsx(D,{control:d.control,disabled:f,name:"ai.bedrock.profile_name",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"AWS Profile Name (Optional)"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"bedrock-profile-input",className:"m-0 inline-flex",placeholder:"default",...p,value:p.value||""})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.bedrock.profile_name"})]}),s.jsx(F,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})}})]}),s.jsxs(ge,{title:"AI Assist",children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add an API key to ",s.jsx(Y,{className:"inline",children:"marimo.toml"})," to activate marimo's AI assistant; see"," ",s.jsx(le,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html",children:"docs"})," ","for more info."]}),s.jsx(D,{control:d.control,disabled:f,name:"ai.open_ai.base_url",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Base URL"}),s.jsx(E,{children:s.jsx(ue,{"data-testid":"ai-base-url-input",className:"m-0 inline-flex",placeholder:"https://api.openai.com/v1",...p})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.open_ai.base_url"})]}),s.jsx(F,{children:"This URL can be any OpenAI-compatible API endpoint."})]})}}),s.jsx(D,{control:d.control,disabled:f,name:"ai.open_ai.model",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{children:"Model"}),s.jsx(E,{children:s.jsx(ue,{list:"ai-model-datalist","data-testid":"ai-model-input",className:"m-0 inline-flex",placeholder:"gpt-4-turbo",...p})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.open_ai.model"})]}),s.jsx("datalist",{id:"ai-model-datalist",children:ns.map(Fc)}),s.jsx(F,{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(D,{control:d.control,name:"ai.rules",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(T,{children:[s.jsx(C,{children:"Custom Rules"}),s.jsx(E,{children:s.jsx(so,{"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",...p,value:p.value})}),s.jsx(_,{}),s.jsx(R,{userConfig:e,name:"ai.rules"})]}),s.jsx(F,{children:"Custom rules to include in all AI completion prompts."})]})}})]})]});case"optionalDeps":return s.jsx(jc,{});case"labs":return s.jsxs(ge,{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(D,{control:d.control,name:"experimental.inline_ai_tooltip",render:Hc}),s.jsx(D,{control:d.control,name:"experimental.rtc_v2",render:zc}),s.jsx(D,{control:d.control,name:"experimental.performant_table_charts",render:b=>{const{field:p}=b;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Performant Table Charts"}),s.jsx(E,{children:s.jsx($,{"data-testid":"performant-table-charts-checkbox",checked:p.value===!0,onCheckedChange:p.onChange})})]}),s.jsx(R,{userConfig:e,name:"experimental.performant_table_charts"}),s.jsx(F,{children:"Enable experimental table charts which are computed on the backend."})]})}})]})}},t[9]=o,t[10]=l,t[11]=e,t[12]=d,t[13]=m,t[14]=x,t[15]=a,t[16]=i,t[17]=I):I=t[17];const w=I;let O,k,N;t[18]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Y,{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")?(N=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",O,k,"Run ",s.jsx(Y,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[20]=N):N=t[20];const A=N;let H,z,U,q,de,ie,se,Q,J,W,oe,ce;return t[21]!==d||t[22]!==m?(H=d.handleSubmit(m),t[21]=d,t[22]=m,t[23]=H):H=t[23],t[24]!==a?(z=b=>a(b),t[24]=a,t[25]=z):z=t[25],t[26]===Symbol.for("react.memo_cache_sentinel")?(U=ss.map(Uc),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")?(de=s.jsx("div",{className:"flex-1"}),ie=!We()&&A,t[29]=de,t[30]=ie):(de=t[29],ie=t[30]),t[31]!==q?(se=s.jsxs(co,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[U,q,de,ie]}),t[31]=q,t[32]=se):se=t[32],t[33]!==o||t[34]!==z||t[35]!==se?(Q=s.jsx(uo,{value:o,onValueChange:z,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:se}),t[33]=o,t[34]=z,t[35]=se,t[36]=Q):Q=t[36],t[37]!==w?(J=w(),t[37]=w,t[38]=J):J=t[38],t[39]!==J?(W=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:J}),t[39]=J,t[40]=W):W=t[40],t[41]!==Q||t[42]!==W||t[43]!==H?(oe=s.jsxs("form",{ref:r,onChange:H,className:"flex text-pretty overflow-hidden",children:[Q,W]}),t[41]=Q,t[42]=W,t[43]=H,t[44]=oe):oe=t[44],t[45]!==d||t[46]!==oe?(ce=s.jsx(On,{...d,children:oe}),t[45]=d,t[46]=oe,t[47]=ce):ce=t[47],ce},ge=t=>{const e=K.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Hi,{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},R=t=>{const e=K.c(18),{userConfig:n,name:r}=t,{isOverridden:i,currentValue:o,overriddenValue:a}=rs(n,r);if(!i)return null;let l,c,u,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(Y,{className:"inline",children:"pyproject.toml"}),"."]}),c=s.jsx("br",{}),e[0]=l,e[1]=c):(l=e[0],c=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("span",{children:["Edit the ",s.jsx(Y,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),h=s.jsx("br",{}),e[2]=u,e[3]=h):(u=e[2],h=e[3]);const d=String(o);let y,m;e[4]!==d?(y=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:d})]}),e[4]=d,e[5]=y):y=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("br",{}),e[6]=m):m=e[6];const g=String(a);let f,v,x;e[7]!==g?(f=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:g})]}),e[7]=g,e[8]=f):f=e[8],e[9]!==y||e[10]!==f?(v=s.jsxs(s.Fragment,{children:[l,c,u,h,y,m,f]}),e[9]=y,e[10]=f,e[11]=v):v=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Xn,{className:"w-3 h-3"}),e[12]=x):x=e[12];const I=String(a);let w,O;return e[13]!==I?(w=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:[x,"Overridden by pyproject.toml [",I,"]"]}),e[13]=I,e[14]=w):w=e[14],e[15]!==v||e[16]!==w?(O=s.jsx(Ve,{content:v,children:w}),e[15]=v,e[16]=w,e[17]=O):O=e[17],O};function Cc(t){return s.jsx("option",{value:t,children:t},t)}function Nc(t){return s.jsx("option",{value:t,children:t},t)}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){return s.jsx("option",{value:t,children:t},t)}function Mc(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function Rc(t){return s.jsx("option",{value:t,children:t},t)}function Lc(t){return s.jsx("option",{value:t,children:t},t)}function Fc(t){return s.jsx("option",{value:t,children:t},t)}function Hc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(E,{children:s.jsx($,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function zc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(T,{className:M,children:[s.jsx(C,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(E,{children:s.jsx($,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function Uc(t){return s.jsx(io,{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:Nt(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 jn=qe(!1);function qc(){const t=K.c(5),e=Pt(os),n=Pt(jn);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 Bc=t=>{const e=K.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]=Be(jn),h=a?"disabled":"hint-green";let d,y,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Gn,{strokeWidth:1.8}),e[0]=d):d=e[0],e[1]!==l?(y=s.jsx(Ve,{content:l,children:d}),e[1]=l,e[2]=y):y=e[2],e[3]!==a||e[4]!==h||e[5]!==y?(m=s.jsx(It,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:a,color:h,children:y}),e[3]=a,e[4]=h,e[5]=y,e[6]=m):m=e[6];const g=m;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Un,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:s.jsx(kc,{})}),e[7]=f):f=e[7];const v=f;if(!o){let U,q;return e[8]!==g?(U=s.jsx(ho,{children:g}),e[8]=g,e[9]=U):U=e[9],e[10]!==u||e[11]!==c||e[12]!==U?(q=s.jsxs(Et,{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,I,w,O,k,N,A,H,z;return e[14]!==g?(x=s.jsx(fo,{asChild:!0,children:g}),e[14]=g,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(Vl,{}),w=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=I,e[17]=w):(I=e[16],w=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(Gn,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=k):k=e[20],e[21]!==O?(N=s.jsxs(go,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Vc,children:[I,w,s.jsxs(pe,{onClick:O,variant:"link",className:"px-0",children:[k,"User settings"]})]}),e[21]=O,e[22]=N):N=e[22],e[23]!==N||e[24]!==x?(A=s.jsxs(po,{children:[x,N]}),e[23]=N,e[24]=x,e[25]=A):A=e[25],e[26]!==u||e[27]!==c?(H=s.jsx(Et,{open:c,onOpenChange:u,children:v}),e[26]=u,e[27]=c,e[28]=H):H=e[28],e[29]!==A||e[30]!==H?(z=s.jsxs(s.Fragment,{children:[A,H]}),e[29]=A,e[30]=H,e[31]=z):z=e[31],z};function Vc(t){return t.preventDefault()}const Wc=t=>{const e=K.c(12),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,a=i===void 0?"Shutdown":i,{openConfirm:l,closeModal:c}=mo(),u=Kc;if(We())return null;const h=o?"disabled":"red";let d,y,m,g;return e[0]!==c||e[1]!==n||e[2]!==l?(d=f=>{f.stopPropagation(),l({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(vo,{onClick:v=>{u(),c()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=c,e[1]=n,e[2]=l,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ot,{strokeWidth:1}),e[4]=y):y=e[4],e[5]!==o||e[6]!==h||e[7]!==d?(m=s.jsx(It,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:h,className:"h-[27px] w-[27px]",disabled:o,onClick:d,children:y}),e[5]=o,e[6]=h,e[7]=d,e[8]=m):m=e[8],e[9]!==m||e[10]!==a?(g=s.jsx(Ve,{content:a,children:m}),e[9]=m,e[10]=a,e[11]=g):g=e[11],g};function Gc(){window.close()}function Kc(){yo(),setTimeout(Gc,200)}function Yc(t){window.open(xo(`?file=${t}`).toString(),"_blank")}export{jo as A,wo as B,Bc as C,bc as D,ko as G,vc as K,Co as L,No as M,Eo as P,Wc as S,Hl as T,_o as Y,Oo as a,Kn as b,It as c,oc as d,Je as e,Wi as f,Ul as g,fc as h,Vi as i,qc as j,bn as k,qi as l,St as m,Bi as n,Yc as o,$n as p,Yn as q,ns as r,jn as s,Li as t,zl as u};
|