@marimo-team/frontend 0.22.6-dev8 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/assets/{add-cell-with-ai-DGlOf8Z8.js → add-cell-with-ai-3_AIzd22.js} +2 -2
  2. package/dist/assets/{agent-panel-DTnTi0AC.js → agent-panel-CdOqi3vb.js} +1 -1
  3. package/dist/assets/{ai-model-dropdown-CRtaHcCu.js → ai-model-dropdown-DWOGmhDj.js} +4 -4
  4. package/dist/assets/{app-config-button-CnX21edo.js → app-config-button-BxCSZCVS.js} +1 -1
  5. package/dist/assets/cell-editor-CuHdpTsy.js +22 -0
  6. package/dist/assets/{chat-display-DL75zaqJ.js → chat-display-DFUo2Riv.js} +1 -1
  7. package/dist/assets/{chat-panel-Dhp31YSq.js → chat-panel-Dl4jq1Dp.js} +2 -2
  8. package/dist/assets/{chat-ui-mZR0uCpP.js → chat-ui-CysJeVE6.js} +1 -1
  9. package/dist/assets/{command-palette-DX6TSAQd.js → command-palette-DaEVrXkC.js} +1 -1
  10. package/dist/assets/{edit-page-CoQU9h7s.js → edit-page-DOK2VJe6.js} +6 -6
  11. package/dist/assets/{home-page-BntiR5eS.js → home-page-CruHjoHv.js} +1 -1
  12. package/dist/assets/{index-BlbvNWcW.js → index-DW6VcSzY.js} +11 -11
  13. package/dist/assets/{packages-panel-5axf3DuF.js → packages-panel-DxS7zji3.js} +1 -1
  14. package/dist/assets/{scratchpad-panel-DX5u2q0x.js → scratchpad-panel-C8dGg-F9.js} +1 -1
  15. package/dist/assets/{useNotebookActions-bWbtL8Qj.js → useNotebookActions-aodoqUGd.js} +1 -1
  16. package/dist/index.html +1 -1
  17. package/package.json +1 -1
  18. package/src/components/app-config/user-config-form.tsx +25 -0
  19. package/src/components/editor/cell/code/cell-editor.tsx +4 -0
  20. package/src/core/codemirror/cm.ts +3 -1
  21. package/src/core/codemirror/completion/__tests__/keymap.test.ts +40 -1
  22. package/src/core/codemirror/completion/accept-on-enter-atom.ts +10 -0
  23. package/src/core/codemirror/completion/keymap.ts +16 -9
  24. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +4 -2
  25. package/src/plugins/impl/plotly/__tests__/PlotlyPlugin.test.tsx +50 -0
  26. package/src/plugins/impl/plotly/__tests__/selection.test.ts +73 -0
  27. package/src/plugins/impl/plotly/selection.ts +35 -3
  28. package/dist/assets/cell-editor-b5nzU-br.js +0 -22
@@ -1 +1 @@
1
- import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-D91BmmQi.js";import{t as le}from"./react-Bj1aDYRI.js";import{gr as V}from"./cells-EJo3u4za.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-CRtaHcCu.js";import{y as de}from"./utils-8btzWeZg.js";import{S as me}from"./config-DoZCLcOb.js";import{t as K}from"./cn-DYvqRARy.js";import{t as pe}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-k58KVlT-.js";import"./popover-AtoFZ7i4.js";import{t as J}from"./tooltip-DmqhBBs6.js";import{r as xe}from"./button-BKVLeSTX.js";import"./dist-VwkX7yeV.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{r as W}from"./requests-9-v2bhoi.js";import{r as ue}from"./x-Bv2rCglF.js";import{t as fe}from"./chevron-right-CgvDWFE3.js";import{u as ge}from"./toDate-BGIVWsZ9.js";import{t as R}from"./spinner-C5wIpWgQ.js";import{a as he}from"./input-Bg12i6qY.js";import"./dist-BvlMLwcr.js";import"./dist-4lB-oR9j.js";import"./dist-CxquLoAZ.js";import"./dist-Dnlw22ji.js";import"./dist-CgYlATe-.js";import{t as ve}from"./use-toast-BDYuj3zG.js";import"./session-DdnWW30b.js";import"./purify.es-BFDc-_i_.js";import{n as je}from"./copy-Bizk-4hH.js";import{i as be,n as F,r as Q,s as X,t as ke}from"./useInstallPackage-CeM6oPsT.js";import{n as Y}from"./error-banner-bXc_9BBZ.js";import{n as ye}from"./useAsyncData-aCoWDe-l.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-B03CpBmt.js";import{t as ee}from"./empty-state-BbLVXQU7.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let s of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(s.toLowerCase()))return e.slice(s.length).trim();return e}var r=H(pe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:i,className:p}=t;if(n){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=l):l=e[0],l}let c;e[1]===p?c=e[2]:(c=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",p),e[1]=p,e[2]=c);let a;e[3]===s?a=e[4]:(a=xe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==i||e[6]!==c||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:c,onClick:a,children:i}),e[5]=i,e[6]=c,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),s=e.package_management.manager,{getDependencyTree:n,getPackageList:i}=W(),[p,c]=I.useState(null),a;t[0]!==n||t[1]!==i?(a=async()=>{let[u,C]=await Promise.all([i(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:l,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,r.jsx)(Y,{error:m}),t[6]=m,t[7]=u),u}let h=l.tree!=null,d;t[8]!==h||t[9]!==p?(d=De(p,h),t[8]=h,t[9]=p,t[10]=d):d=t[10];let f=d,x=(w=l.tree)==null?void 0:w.name,P=(S=l==null?void 0:l.tree)==null?void 0:S.version,y=x==="<root>",k;t[11]!==s||t[12]!==j?(k=(0,r.jsx)(Pe,{packageManager:s,onSuccess:j}),t[11]=s,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==x||t[17]!==P||t[18]!==f?(b=h&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("list"),children:"List"}),(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("tree"),children:"Tree"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),x&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[x,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=x,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==l.list||t[21]!==l.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:l.list,onSuccess:j}):(0,r.jsx)($e,{tree:l.tree,error:m,onSuccess:j}),t[20]=l.list,t[21]=l.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:s,packageManager:n}=t,[i,p]=I.useState(""),{handleClick:c}=ce(),a=oe(X),o=ae(X),l,m;e[0]!==a||e[1]!==o?(l=()=>{a&&(p(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=l,e[3]=m):(l=e[2],m=e[3]),I.useEffect(l,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),p("")},e[4]=s,e[5]=h);let d=h,f;e[6]!==g||e[7]!==i||e[8]!==d?(f=()=>{g([_e(i)],d)},e[6]=g,e[7]=i,e[8]=d,e[9]=f):f=e[9];let x=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==c?(y=j?(0,r.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,r.jsx)(J,{content:"Change package manager",children:(0,r.jsx)(V,{onClick:()=>c("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=c,e[12]=y):y=e[12];let k;e[13]===x?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),x())},e[13]=x,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>p(U.target.value),e[15]=b):b=e[15];let v;e[16]!==i||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,r.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:i,onKeyDown:k,onChange:b}),e[16]=i,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsxs)("div",{children:[C," A Git repository",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,r.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,r.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,r.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=i&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!i,M;e[33]!==x||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:x,disabled:z,children:"Add"}),e[33]=x,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,r.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:s,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,r.jsx)(V,{})}),e[0]=a):a=e[0],a}let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(Ne,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(q,{children:"Name"}),(0,r.jsx)(q,{children:"Version"}),(0,r.jsx)(q,{})]})}),e[1]=i):i=e[1];let p;if(e[2]!==s||e[3]!==n){let a;e[5]===s?a=e[6]:(a=o=>(0,r.jsxs)(Z,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,r.jsx)(B,{children:o.name}),(0,r.jsx)(B,{children:o.version}),(0,r.jsxs)(B,{className:"flex justify-end",children:[(0,r.jsx)(re,{packageName:o.name,onSuccess:s}),(0,r.jsx)(se,{packageName:o.name,onSuccess:s})]})]},o.name),e[5]=s,e[6]=a),p=n.map(a),e[2]=s,e[3]=n,e[4]=p}else p=e[4];let c;return e[7]===p?c=e[8]:(c=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[i,(0,r.jsx)(we,{children:p})]}),e[7]=p,e[8]=c),c},re=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{addPackage:p}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,upgrade:!0,group:a});o.success?(s(),Q(t)):Q(t,o.error)}finally{i(!1)}},loading:n,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{removePackage:p}=W();return(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,group:a});o.success?(s(),F(t)):F(t,o.error)}finally{i(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:i}=t,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];let[c,a]=I.useState(p),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let l;if(e[2]===s?l=e[3]:(l=[s],e[2]=s,e[3]=l),I.useEffect(o,l),n){let d;return e[4]===n?d=e[5]:(d=(0,r.jsx)(Y,{error:n}),e[4]=n,e[5]=d),d}if(!s){let d;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=d):d=e[6],d}if(s.dependencies.length===0){let d;return e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=d):d=e[7],d}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{a(f=>{let x=new Set(f);return x.has(d)?x.delete(d):x.add(d),x})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==c||e[10]!==i||e[11]!==s.dependencies){let d;e[13]!==c||e[14]!==i?(d=(f,x)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${x}`,node:f,level:0,isTopLevel:!0,expandedNodes:c,onToggle:j,onSuccess:i})},`${f.name}-${x}`),e[13]=c,e[14]=i,e[15]=d):d=e[15],g=s.dependencies.map(d),e[9]=c,e[10]=i,e[11]=s.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:s,node:n,level:i,isTopLevel:p,expandedNodes:c,onToggle:a,onSuccess:o}=t,l=p===void 0?!1:p,m=n.dependencies.length>0,j;e[0]!==c||e[1]!==s?(j=c.has(s),e[0]=c,e[1]=s,e[2]=j):j=e[2];let g=j,h=l?0:16+i*16,d;e[3]!==m||e[4]!==s||e[5]!==a?(d=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=d):d=e[6];let f=d,x;e[7]!==m||e[8]!==s||e[9]!==a?(x=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=x):x=e[10];let P=x,y=m&&"select-none",k=l?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==l?(v=l?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=l,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,r.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,r.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,r.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,r.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==l||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=l&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=l,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,r.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==c||e[47]!==m||e[48]!==g||e[49]!==i||e[50]!==n.dependencies||e[51]!==s||e[52]!==o||e[53]!==a?(A=m&&g&&(0,r.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,r.jsx)(ne,{nodeId:`${s}-${z}`,node:N,level:i+1,isTopLevel:!1,expandedNodes:c,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=c,e[47]=m,e[48]=g,e[49]=i,e[50]=n.dependencies,e[51]=s,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,r.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
1
+ import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-D91BmmQi.js";import{t as le}from"./react-Bj1aDYRI.js";import{gr as V}from"./cells-EJo3u4za.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-DWOGmhDj.js";import{y as de}from"./utils-8btzWeZg.js";import{S as me}from"./config-DoZCLcOb.js";import{t as K}from"./cn-DYvqRARy.js";import{t as pe}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-k58KVlT-.js";import"./popover-AtoFZ7i4.js";import{t as J}from"./tooltip-DmqhBBs6.js";import{r as xe}from"./button-BKVLeSTX.js";import"./dist-VwkX7yeV.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{r as W}from"./requests-9-v2bhoi.js";import{r as ue}from"./x-Bv2rCglF.js";import{t as fe}from"./chevron-right-CgvDWFE3.js";import{u as ge}from"./toDate-BGIVWsZ9.js";import{t as R}from"./spinner-C5wIpWgQ.js";import{a as he}from"./input-Bg12i6qY.js";import"./dist-BvlMLwcr.js";import"./dist-4lB-oR9j.js";import"./dist-CxquLoAZ.js";import"./dist-Dnlw22ji.js";import"./dist-CgYlATe-.js";import{t as ve}from"./use-toast-BDYuj3zG.js";import"./session-DdnWW30b.js";import"./purify.es-BFDc-_i_.js";import{n as je}from"./copy-Bizk-4hH.js";import{i as be,n as F,r as Q,s as X,t as ke}from"./useInstallPackage-CeM6oPsT.js";import{n as Y}from"./error-banner-bXc_9BBZ.js";import{n as ye}from"./useAsyncData-aCoWDe-l.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-B03CpBmt.js";import{t as ee}from"./empty-state-BbLVXQU7.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let s of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(s.toLowerCase()))return e.slice(s.length).trim();return e}var r=H(pe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:i,className:p}=t;if(n){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=l):l=e[0],l}let c;e[1]===p?c=e[2]:(c=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",p),e[1]=p,e[2]=c);let a;e[3]===s?a=e[4]:(a=xe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==i||e[6]!==c||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:c,onClick:a,children:i}),e[5]=i,e[6]=c,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),s=e.package_management.manager,{getDependencyTree:n,getPackageList:i}=W(),[p,c]=I.useState(null),a;t[0]!==n||t[1]!==i?(a=async()=>{let[u,C]=await Promise.all([i(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:l,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,r.jsx)(Y,{error:m}),t[6]=m,t[7]=u),u}let h=l.tree!=null,d;t[8]!==h||t[9]!==p?(d=De(p,h),t[8]=h,t[9]=p,t[10]=d):d=t[10];let f=d,x=(w=l.tree)==null?void 0:w.name,P=(S=l==null?void 0:l.tree)==null?void 0:S.version,y=x==="<root>",k;t[11]!==s||t[12]!==j?(k=(0,r.jsx)(Pe,{packageManager:s,onSuccess:j}),t[11]=s,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==x||t[17]!==P||t[18]!==f?(b=h&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("list"),children:"List"}),(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("tree"),children:"Tree"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),x&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[x,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=x,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==l.list||t[21]!==l.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:l.list,onSuccess:j}):(0,r.jsx)($e,{tree:l.tree,error:m,onSuccess:j}),t[20]=l.list,t[21]=l.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:s,packageManager:n}=t,[i,p]=I.useState(""),{handleClick:c}=ce(),a=oe(X),o=ae(X),l,m;e[0]!==a||e[1]!==o?(l=()=>{a&&(p(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=l,e[3]=m):(l=e[2],m=e[3]),I.useEffect(l,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),p("")},e[4]=s,e[5]=h);let d=h,f;e[6]!==g||e[7]!==i||e[8]!==d?(f=()=>{g([_e(i)],d)},e[6]=g,e[7]=i,e[8]=d,e[9]=f):f=e[9];let x=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==c?(y=j?(0,r.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,r.jsx)(J,{content:"Change package manager",children:(0,r.jsx)(V,{onClick:()=>c("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=c,e[12]=y):y=e[12];let k;e[13]===x?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),x())},e[13]=x,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>p(U.target.value),e[15]=b):b=e[15];let v;e[16]!==i||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,r.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:i,onKeyDown:k,onChange:b}),e[16]=i,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsxs)("div",{children:[C," A Git repository",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,r.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,r.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,r.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=i&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!i,M;e[33]!==x||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:x,disabled:z,children:"Add"}),e[33]=x,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,r.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:s,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,r.jsx)(V,{})}),e[0]=a):a=e[0],a}let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(Ne,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(q,{children:"Name"}),(0,r.jsx)(q,{children:"Version"}),(0,r.jsx)(q,{})]})}),e[1]=i):i=e[1];let p;if(e[2]!==s||e[3]!==n){let a;e[5]===s?a=e[6]:(a=o=>(0,r.jsxs)(Z,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,r.jsx)(B,{children:o.name}),(0,r.jsx)(B,{children:o.version}),(0,r.jsxs)(B,{className:"flex justify-end",children:[(0,r.jsx)(re,{packageName:o.name,onSuccess:s}),(0,r.jsx)(se,{packageName:o.name,onSuccess:s})]})]},o.name),e[5]=s,e[6]=a),p=n.map(a),e[2]=s,e[3]=n,e[4]=p}else p=e[4];let c;return e[7]===p?c=e[8]:(c=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[i,(0,r.jsx)(we,{children:p})]}),e[7]=p,e[8]=c),c},re=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{addPackage:p}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,upgrade:!0,group:a});o.success?(s(),Q(t)):Q(t,o.error)}finally{i(!1)}},loading:n,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{removePackage:p}=W();return(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,group:a});o.success?(s(),F(t)):F(t,o.error)}finally{i(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:i}=t,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];let[c,a]=I.useState(p),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let l;if(e[2]===s?l=e[3]:(l=[s],e[2]=s,e[3]=l),I.useEffect(o,l),n){let d;return e[4]===n?d=e[5]:(d=(0,r.jsx)(Y,{error:n}),e[4]=n,e[5]=d),d}if(!s){let d;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=d):d=e[6],d}if(s.dependencies.length===0){let d;return e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=d):d=e[7],d}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{a(f=>{let x=new Set(f);return x.has(d)?x.delete(d):x.add(d),x})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==c||e[10]!==i||e[11]!==s.dependencies){let d;e[13]!==c||e[14]!==i?(d=(f,x)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${x}`,node:f,level:0,isTopLevel:!0,expandedNodes:c,onToggle:j,onSuccess:i})},`${f.name}-${x}`),e[13]=c,e[14]=i,e[15]=d):d=e[15],g=s.dependencies.map(d),e[9]=c,e[10]=i,e[11]=s.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:s,node:n,level:i,isTopLevel:p,expandedNodes:c,onToggle:a,onSuccess:o}=t,l=p===void 0?!1:p,m=n.dependencies.length>0,j;e[0]!==c||e[1]!==s?(j=c.has(s),e[0]=c,e[1]=s,e[2]=j):j=e[2];let g=j,h=l?0:16+i*16,d;e[3]!==m||e[4]!==s||e[5]!==a?(d=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=d):d=e[6];let f=d,x;e[7]!==m||e[8]!==s||e[9]!==a?(x=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=x):x=e[10];let P=x,y=m&&"select-none",k=l?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==l?(v=l?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=l,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,r.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,r.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,r.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,r.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==l||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=l&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=l,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,r.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==c||e[47]!==m||e[48]!==g||e[49]!==i||e[50]!==n.dependencies||e[51]!==s||e[52]!==o||e[53]!==a?(A=m&&g&&(0,r.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,r.jsx)(ne,{nodeId:`${s}-${z}`,node:N,level:i+1,isTopLevel:!1,expandedNodes:c,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=c,e[47]=m,e[48]=g,e[49]=i,e[50]=n.dependencies,e[51]=s,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,r.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
@@ -1 +1 @@
1
- import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ye,l as be,n as T,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{E as ke,Ei as n,F as ze,Mn as Ce,Ti as Se,_i as Oe,__tla as Ae}from"./cells-EJo3u4za.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-DGjKht0c.js";import{y as Me}from"./utils-8btzWeZg.js";import{t as Ee}from"./constants-tOPFFcLZ.js";import{t as le}from"./cn-DYvqRARy.js";import{t as Ie}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-k58KVlT-.js";import"./popover-AtoFZ7i4.js";import{n as Le,__tla as Pe}from"./JsonOutput-9XtRRx5l.js";import"./download-TSo32ofd.js";import{t as z}from"./tooltip-DmqhBBs6.js";import{t as C}from"./button-BKVLeSTX.js";import"./dist-VwkX7yeV.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{r as Re}from"./requests-9-v2bhoi.js";import{t as me}from"./createLucideIcon-w-Qo9n0R.js";import{d as De,__tla as He}from"./layout-CF-7BNtf.js";import{n as Te,t as Ve,__tla as qe}from"./LazyAnyLanguageCodeMirror-CoYqQxHb.js";import{__tla as Fe}from"./markdown-renderer-B9RsGqHb.js";import{u as Ge}from"./toDate-BGIVWsZ9.js";import{t as Ue,__tla as Be}from"./cell-editor-b5nzU-br.js";import{t as Je}from"./spinner-C5wIpWgQ.js";import{t as Ke}from"./play-BdC4C3dp.js";import"./dist-BvlMLwcr.js";import"./dist-4lB-oR9j.js";import"./dist-CxquLoAZ.js";import"./dist-Dnlw22ji.js";import"./dist-CgYlATe-.js";import"./session-DdnWW30b.js";import{r as Qe}from"./useTheme-DCDmxPD0.js";import"./purify.es-BFDc-_i_.js";import"./dates-stqTIkXD.js";import"./utils-BZwMGX81.js";import"./vega-loader.browser-DXARUlxo.js";import"./defaultLocale-JieDVWC_.js";import"./defaultLocale-BLne0bXb.js";import{__tla as We}from"./chunk-5FQGJX7Z-Cyc7d5AB.js";import"./html-to-image-BJiJlwQY.js";import{o as Xe}from"./focus-DXeddo75.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-BUNcfKXO.js";import{a as $e}from"./renderShortcut-DrDh2657.js";import"./esm-BqofWdD5.js";import"./name-cell-input-CYsY4A1G.js";import{n as et,r as tt}from"./panel-context-aIZ10ULn.js";import{__tla as rt}from"./loro_wasm_bg-B_AVgvOe.js";import"./ws-BApgRfsy.js";import"./Inputs-6ni2iCdV.js";import"./dist-DDiNOVwA.js";import"./dist-ByWFdhfz.js";import"./dist-CHgkfE72.js";import"./dist-BYHplnRv.js";import"./dist-04hxiWlB.js";import"./dist-B1XdVflW.js";import"./dist-Gx6Yy96j.js";import"./dist-Yk16cgLk.js";import"./dist-umvL589W.js";import"./esm-D1fwWXHg.js";import{t as at}from"./kiosk-mode-JCcLyeoQ.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return qe}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=me("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),he=me("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),pe=se(),V=ae(Ne(),1),ue=15;const q=Oe("marimo:scratchpadHistory:v1",[],Ce),fe=oe(!1),xe=oe(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(q);s(q,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=ae(Ie(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),s=ze(),[i]=Me(),{theme:m}=Qe(),c=(0,V.useRef)(null),F=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:h}=Re(),S=et(),U=tt(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=ye(xe),[o,p]=be(fe),u=we(q),A;e[0]!==K||e[1]!==r||e[2]!==h?(A=()=>{h({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=h,e[3]=A):A=e[3];let f=T(A),M;e[4]!==r||e[5]!==G||e[6]!==F?(M=()=>{r.trim()&&G({code:r,before:!1,cellId:F??"__end__"})},e[4]=r,e[5]=G,e[6]=F,e[7]=M):M=e[7];let Q=T(M),E;e[8]!==h||e[9]!==d?(E=()=>{d({cellId:n,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=E):E=e[10];let W=T(E),I;e[11]!==p||e[12]!==d?(I=a=>{p(!1),d({cellId:n,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=I):I=e[13];let X=T(I),[Y,ge]=(0,V.useState)(),L;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==m?(L=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(V.Suspense,{children:(0,t.jsx)(Ve,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=m,e[18]=L):L=e[18];let Z=L,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Ke,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Te,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Je,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Se.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=a=>{c.current=a},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let y;e[45]===j?y=e[46]:(y=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=y);let b;e[47]===B?b=e[48]:(b=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Le,{allowExpand:!1,output:B,className:Ee.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=b);let w;e[49]===J?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:J,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=J,e[50]=w);let N;e[51]!==b||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[b,w]})}),e[51]=b,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==y||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,y,N]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=y,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ye,l as be,n as T,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{E as ke,Ei as n,F as ze,Mn as Ce,Ti as Se,_i as Oe,__tla as Ae}from"./cells-EJo3u4za.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-DGjKht0c.js";import{y as Me}from"./utils-8btzWeZg.js";import{t as Ee}from"./constants-tOPFFcLZ.js";import{t as le}from"./cn-DYvqRARy.js";import{t as Ie}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-k58KVlT-.js";import"./popover-AtoFZ7i4.js";import{n as Le,__tla as Pe}from"./JsonOutput-9XtRRx5l.js";import"./download-TSo32ofd.js";import{t as z}from"./tooltip-DmqhBBs6.js";import{t as C}from"./button-BKVLeSTX.js";import"./dist-VwkX7yeV.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{r as Re}from"./requests-9-v2bhoi.js";import{t as me}from"./createLucideIcon-w-Qo9n0R.js";import{d as De,__tla as He}from"./layout-CF-7BNtf.js";import{n as Te,t as Ve,__tla as qe}from"./LazyAnyLanguageCodeMirror-CoYqQxHb.js";import{__tla as Fe}from"./markdown-renderer-B9RsGqHb.js";import{u as Ge}from"./toDate-BGIVWsZ9.js";import{t as Ue,__tla as Be}from"./cell-editor-CuHdpTsy.js";import{t as Je}from"./spinner-C5wIpWgQ.js";import{t as Ke}from"./play-BdC4C3dp.js";import"./dist-BvlMLwcr.js";import"./dist-4lB-oR9j.js";import"./dist-CxquLoAZ.js";import"./dist-Dnlw22ji.js";import"./dist-CgYlATe-.js";import"./session-DdnWW30b.js";import{r as Qe}from"./useTheme-DCDmxPD0.js";import"./purify.es-BFDc-_i_.js";import"./dates-stqTIkXD.js";import"./utils-BZwMGX81.js";import"./vega-loader.browser-DXARUlxo.js";import"./defaultLocale-JieDVWC_.js";import"./defaultLocale-BLne0bXb.js";import{__tla as We}from"./chunk-5FQGJX7Z-Cyc7d5AB.js";import"./html-to-image-BJiJlwQY.js";import{o as Xe}from"./focus-DXeddo75.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-BUNcfKXO.js";import{a as $e}from"./renderShortcut-DrDh2657.js";import"./esm-BqofWdD5.js";import"./name-cell-input-CYsY4A1G.js";import{n as et,r as tt}from"./panel-context-aIZ10ULn.js";import{__tla as rt}from"./loro_wasm_bg-B_AVgvOe.js";import"./ws-BApgRfsy.js";import"./Inputs-6ni2iCdV.js";import"./dist-DDiNOVwA.js";import"./dist-ByWFdhfz.js";import"./dist-CHgkfE72.js";import"./dist-BYHplnRv.js";import"./dist-04hxiWlB.js";import"./dist-B1XdVflW.js";import"./dist-Gx6Yy96j.js";import"./dist-Yk16cgLk.js";import"./dist-umvL589W.js";import"./esm-D1fwWXHg.js";import{t as at}from"./kiosk-mode-JCcLyeoQ.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return qe}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=me("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),he=me("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),pe=se(),V=ae(Ne(),1),ue=15;const q=Oe("marimo:scratchpadHistory:v1",[],Ce),fe=oe(!1),xe=oe(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(q);s(q,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=ae(Ie(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),s=ze(),[i]=Me(),{theme:m}=Qe(),c=(0,V.useRef)(null),F=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:h}=Re(),S=et(),U=tt(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=ye(xe),[o,p]=be(fe),u=we(q),A;e[0]!==K||e[1]!==r||e[2]!==h?(A=()=>{h({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=h,e[3]=A):A=e[3];let f=T(A),M;e[4]!==r||e[5]!==G||e[6]!==F?(M=()=>{r.trim()&&G({code:r,before:!1,cellId:F??"__end__"})},e[4]=r,e[5]=G,e[6]=F,e[7]=M):M=e[7];let Q=T(M),E;e[8]!==h||e[9]!==d?(E=()=>{d({cellId:n,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=E):E=e[10];let W=T(E),I;e[11]!==p||e[12]!==d?(I=a=>{p(!1),d({cellId:n,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=I):I=e[13];let X=T(I),[Y,ge]=(0,V.useState)(),L;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==m?(L=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(V.Suspense,{children:(0,t.jsx)(Ve,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=m,e[18]=L):L=e[18];let Z=L,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Ke,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Te,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Je,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Se.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=a=>{c.current=a},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let y;e[45]===j?y=e[46]:(y=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=y);let b;e[47]===B?b=e[48]:(b=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Le,{allowExpand:!1,output:B,className:Ee.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=b);let w;e[49]===J?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:J,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=J,e[50]=w);let N;e[51]!==b||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[b,w]})}),e[51]=b,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==y||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,y,N]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=y,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
@@ -1 +1 @@
1
- import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as $,l as ct,p as ht,u as me}from"./useEvent-D91BmmQi.js";import{t as mt}from"./react-Bj1aDYRI.js";import{E as Me,En as pt,Jt as ut,Rr as ft,Ti as pe,Tn as xt,_ as yt,cr as kt,ct as We,h as _e,kn as bt,ot as wt,pr as jt,st as gt,t as vt,ur as Ct,vr as zt,wn as Mt}from"./cells-EJo3u4za.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Wt,x as _t}from"./ai-model-dropdown-CRtaHcCu.js";import{_ as H,d as Ne}from"./useEventListener-DGjKht0c.js";import{y as Nt}from"./utils-8btzWeZg.js";import{n as L,t as Se}from"./constants-tOPFFcLZ.js";import{S as ue,h as St,n as Dt,o as Pt,x as At}from"./config-DoZCLcOb.js";import{n as It}from"./switch-C6xjg01T.js";import{t as Et}from"./jsx-runtime-Blw4afVn.js";import{o as Lt}from"./alert-dialog-CXspBRlP.js";import{a as Tt,c as fe,o as xe,s as Rt}from"./popover-AtoFZ7i4.js";import{a as $t,c as Ht,i as qt,n as Bt,r as Ot,s as Ut,t as Vt}from"./select--zcABebs.js";import{gt as Ft}from"./JsonOutput-9XtRRx5l.js";import{c as De,d as ye,n as Yt,o as Kt,r as ke,t as Gt}from"./download-TSo32ofd.js";import{m as Jt}from"./form-BiDLPu7R.js";import{t as Pe}from"./tooltip-DmqhBBs6.js";import{r as Ae,t as q}from"./button-BKVLeSTX.js";import{i as Zt,r as Qt,t as Ie}from"./strings-pfr2N700.js";import{r as B}from"./requests-9-v2bhoi.js";import{t as b}from"./createLucideIcon-w-Qo9n0R.js";import{a as Ee,f as Xt,i as Le,m as ea,p as Te,u as Re}from"./layout-CF-7BNtf.js";import{t as be}from"./check-B-sKate2.js";import{n as ta}from"./maps-B4xARV9R.js";import{r as aa}from"./useCellActionButton-DftkIqUl.js";import{t as $e}from"./copy-DFMsQ6MJ.js";import{t as oa}from"./eye-off-DgRJ-xBZ.js";import{t as ae}from"./file-l37OnSN4.js";import{t as na}from"./github-C3N4cuN4.js";import{n as sa,r as la,t as ia}from"./youtube-D6LtMx2w.js";import{i as ra,n as He}from"./add-connection-dialog-ux7eCDRM.js";import{n as da,t as ca}from"./square-COtNnHUC.js";import{t as ha}from"./image-BgkzrnsX.js";import{t as ma}from"./link-dU_vDDSR.js";import{r as pa}from"./input-Bg12i6qY.js";import{t as ua}from"./settings-C1bg8A2T.js";import{t as fa}from"./sparkles-B79Qf6ma.js";import{y as xa}from"./textarea-Cfp3upzK.js";import{t as S}from"./use-toast-BDYuj3zG.js";import{n as qe,t as ya}from"./paths-BzSgteR-.js";import{o as ka}from"./session-DdnWW30b.js";import{n as O}from"./copy-Bizk-4hH.js";import{r as ba}from"./useRunCells-d2edY6Tu.js";import{a as Be,c as Oe,i as Ue,n as Ve,r as Fe}from"./dialog-BYjetQgE.js";import{n as we}from"./ImperativeModal-DoGv2BXV.js";import{r as wa,t as ja}from"./share-0LPgOyiW.js";import{a as ga}from"./cell-link-CcAqXeeg.js";import{a as va}from"./renderShortcut-DrDh2657.js";import{t as Ca}from"./icons-DlzgV4KY.js";import{n as za}from"./marimo-icons-Dp8wmdDL.js";import{t as Ma}from"./links-C19POYUQ.js";import{r as Wa,t as Ye}from"./hooks-BgwM3Mb2.js";import{t as Ke}from"./types-DOdUT9LT.js";var _a=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Na=b("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ge=b("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Je=b("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ze=b("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Sa=b("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Da=b("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Pa=b("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Qe=b("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Aa=b("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Ia=b("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ea=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Xe=b("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),La=b("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ta=b("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),et=b("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),je=N(),D=ze(mt(),1),a=ze(Et(),1);function Ra(){return"uvx marimo@latest"}function $a(t,e,n){let o=n?" --with-token":"",s=`${Ra()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode "$(${s} --opencode)"`;default:Qt(t)}}function Ha(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var qa="npx skills add marimo-team/marimo-pair";function Ba(){let t=(0,je.c)(2),[e,n]=(0,D.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(Dt("/auth/token").href,{headers:It.headers()}).then(Oa).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,D.useEffect)(o,s),e}function Oa(t){return t.ok?t.json():null}const Ua=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,D.useState)("claude"),r=Pt(),i=Ba(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=$a(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Oe,{children:"Pair with an agent"}),e[4]=m):m=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Be,{children:[m,(0,a.jsxs)(Fe,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=p):p=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(U,{command:qa})]}),e[6]=h):h=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=u):u=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=_=>s(_),e[8]=x):x=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Rt,{className:"w-full",children:[(0,a.jsx)(fe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(fe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(fe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=w):w=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(xe,{value:"claude",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[10]=c,e[11]=y);let k;e[12]===c?k=e[13]:(k=(0,a.jsx)(xe,{value:"codex",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[12]=c,e[13]=k);let j;e[14]===c?j=e[15]:(j=(0,a.jsx)(xe,{value:"opencode",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[14]=c,e[15]=j);let g;e[16]!==o||e[17]!==j||e[18]!==y||e[19]!==k?(g=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[u,(0,a.jsxs)(Tt,{value:o,onValueChange:x,children:[w,y,k,j]})]}),e[16]=o,e[17]=j,e[18]=y,e[19]=k,e[20]=g):g=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(U,{command:i,display:Ha(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==g||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,g,z]}),e[24]=g,e[25]=z,e[26]=v):v=e[26];let M;e[27]===n?M=e[28]:(M=(0,a.jsx)(Ue,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=M);let W;return e[29]!==v||e[30]!==M?(W=(0,a.jsxs)(Ve,{className:"sm:max-w-lg",children:[p,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var U=t=>{let e=(0,je.c)(15),{command:n,display:o}=t,[s,r]=(0,D.useState)(!1),i;e[0]===n?i=e[1]:(i=Ae.stopPropagation(async x=>{x.preventDefault(),await O(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let m;e[4]===s?m=e[5]:(m=s?(0,a.jsx)(be,{size:14,strokeWidth:1.5}):(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=m);let p;e[6]!==l||e[7]!==m?(p=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:m}),e[6]=l,e[7]=m,e[8]=p):p=e[8];let h;e[9]!==s||e[10]!==p?(h=(0,a.jsx)(Pe,{content:"Copied!",open:s,children:p}),e[9]=s,e[10]=p,e[11]=h):h=e[11];let u;return e[12]!==c||e[13]!==h?(u=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=u):u=e[14],u},tt=N(),oe="https://static.marimo.app";const Va=t=>{let e=(0,tt.c)(25),{onClose:n}=t,[o,s]=(0,D.useState)(""),{exportAsHTML:r}=B(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${oe}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async g=>{g.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:Xt.INSTANCE.filenames()}),v=S({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${oe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),S({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:L.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),S({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Oe,{children:"Share static notebook"}),e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Fe,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:oe,target:"_blank",children:oe}),"."]})]}),e[5]=m):m=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=g=>{s(g.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=p):p=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:p,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let u;e[9]===l?u=e[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Fa,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=u);let x;e[11]!==h||e[12]!==u?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,u]}),e[11]=h,e[12]=u,e[13]=x):x=e[13];let w;e[14]===n?w=e[15]:(w=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=w);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await O(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Ue,{children:[w,y]}),e[18]=w,e[19]=y,e[20]=k):k=e[20];let j;return e[21]!==d||e[22]!==k||e[23]!==x?(j=(0,a.jsx)(Ve,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[m,x,k]})}),e[21]=d,e[22]=k,e[23]=x,e[24]=j):j=e[24],j};var Fa=t=>{let e=(0,tt.c)(8),[n,o]=D.useState(!1),s;e[0]===t.text?s=e[1]:(s=Ae.stopPropagation(async c=>{c.preventDefault(),await O(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Pe,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Ya=N();function Ka(){let t=document.getElementsByClassName(Se.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=pe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:pe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Ga(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(pe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Se.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function at(){let t=(0,Ya.c)(2),e=$(We),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ka();e(s=>({mode:gt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ga(o)})})},t[0]=e,t[1]=n),n}const ot=ht(!1);var Ja=N();const Za=()=>{let t=(0,Ja.c)(7),{selectedLayout:e}=Ee(),{setLayoutView:n}=Le();if(ue()&&!bt("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Ut,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Bt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)($t,{children:"View as"}),Ke.map(Xa)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Vt,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function Qa(t){return(0,a.jsx)(nt(t),{className:"h-4 w-4"})}function nt(t){switch(t){case"vertical":return Aa;case"grid":return la;case"slides":return Xe;default:return Zt(t),ca}}function st(t){return Ie.startCase(t)}function Xa(t){return(0,a.jsx)(qt,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Qa(t),(0,a.jsx)("span",{children:st(t)})]})},t)}async function eo(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var to=N();function ao(t){let e=(0,to.c)(5),{openPrompt:n,closeModal:o}=we(),{sendCopy:s}=B(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ya.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(qe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),S({title:"Notebook copied",description:"A copy of the notebook has been created."}),Ma(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const oo=()=>{let{updateCellConfig:t}=Me(),{saveCellConfig:e}=B();return(0,D.useCallback)(async()=>{let n=new ut,o=_e(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Ne.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var no=N();function lt(){let t=(0,no.c)(4),{openConfirm:e}=we(),n=$(St),{sendRestart:o}=B(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Lt,{onClick:async()=>{n({state:At.CLOSING}),await o(),wa()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var so=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function lo(){var ve,Ce;let t=(0,so.c)(51),e=ga(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=Mt(),{selectedPanel:r}=xt(),[i]=ct(We),l=me(wt),d=oo(),[c]=Nt(),{updateCellConfig:m,undoDeleteCell:p,clearAllCellOutputs:h,addSetupCellIfDoesntExist:u,collapseAllCells:x,expandAllCells:w}=Me(),y=lt(),k=ba(),j=ao(e),g=$(ot),z=$(Wt),v=$(_t),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:P}=B(),A=Wa(),le=me(yt),ie=me(vt),{selectedLayout:V}=Ee(),{setLayoutView:re}=Le(),F=at(),Y=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=V==="slides",it=zo,rt=Co,G;t[0]!==e||t[1]!==A||t[2]!==P?(G=async f=>{let{preset:C,title:R}=f;if(!e){ne();return}await De(R,async he=>{await Ye({takeScreenshots:()=>A({progress:he}),updateCellOutputs:P}),await eo({filename:e,preset:C,downloadPDF:Yt})})},t[0]=e,t[1]=A,t[2]=P,t[3]=G):G=t[3];let I=G,J;t[4]===I?J=t[5]:(J=async()=>{if(ge){await I({preset:"document",title:"Downloading Document PDF..."});return}let f=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(f),setTimeout(vo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Z=J,Q;t[6]!==M||t[7]!==e||t[8]!==A||t[9]!==P?(Q=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async f=>{await Ye({takeScreenshots:()=>A({progress:f}),updateCellOutputs:P});let C=await M({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},t[6]=M,t[7]=e,t[8]=A,t[9]=P,t[10]=Q):Q=t[10];let ce=Q,X;t[11]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),t[11]=X):X=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let E;t[13]===e?E=t[14]:(E=async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!0})},t[13]=e,t[14]=E);let te;return t[15]!==u||t[16]!==ie||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==j||t[21]!==I||t[22]!==w||t[23]!==W||t[24]!==e||t[25]!==Z||t[26]!==ce||t[27]!==le||t[28]!==d||t[29]!==de||t[30]!==l||t[31]!==n||t[32]!==_||t[33]!==y||t[34]!==k||t[35]!==se||t[36]!==V||t[37]!==r||t[38]!==g||t[39]!==v||t[40]!==re||t[41]!==z||t[42]!==Y||t[43]!==K||t[44]!==E||t[45]!==s||t[46]!==F||t[47]!==p||t[48]!==m||t[49]!==i.mode?(te=[{icon:X,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Ca,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let f=await W({download:!1});ke(new Blob([f],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let f=await _();ke(new Blob([f.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",va("global.hideCode",!1)]}),handle:go},de?{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Z},{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:rt(!0),hidden:!ge,handle:async()=>{await I({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Z}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Ua,{onClose:o}))}},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!Y&&!K,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!Y,handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await O(ja({code:(await _()).contents})),S({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:pt.flatMap(f=>{let{type:C,Icon:R,hidden:he,additionalKeywords:dt}=f;return he?[]:{label:Ie.startCase(C),rightElement:it(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:dt}})},{icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(xa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{F()}},...Ke.map((f,C)=>{let R=nt(f);return{divider:C===0,label:st(f),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:V===f&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(f),i.mode==="edit"&&F()}}})]},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||ue(),handle:j},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await O((await _()).contents),S({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!le||l,handle:async()=>{let f=ft(_e());await se({configs:Ne.fromEntries(f.map(jo))});for(let C of f)m({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(He,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(He,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ie||l,handle:()=>{p()}},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>g(wo)},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(bo)},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(ko),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:yo},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"GitHub",handle:xo},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"YouTube",handle:uo},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ho}].filter(co).map(io),t[15]=u,t[16]=ie,t[17]=h,t[18]=o,t[19]=x,t[20]=j,t[21]=I,t[22]=w,t[23]=W,t[24]=e,t[25]=Z,t[26]=ce,t[27]=le,t[28]=d,t[29]=de,t[30]=l,t[31]=n,t[32]=_,t[33]=y,t[34]=k,t[35]=se,t[36]=V,t[37]=r,t[38]=g,t[39]=v,t[40]=re,t[41]=z,t[42]=Y,t[43]=K,t[44]=E,t[45]=s,t[46]=F,t[47]=p,t[48]=m,t[49]=i.mode,t[50]=te):te=t[50],te}function io(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ro)}:t}function ro(t){return!t.hidden}function co(t){return!t.hidden}function ho(){let t=ka();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function po(){window.open(L.releasesPage,"_blank")}function uo(){window.open(L.youtube,"_blank")}function fo(){window.open(L.discordLink,"_blank")}function xo(){window.open(L.githubPage,"_blank")}function yo(){window.open(L.docsPage,"_blank")}function ko(t){return!t}function bo(t){return!t}function wo(t){return!t}function jo(t){return[t,{disabled:!1}]}async function go(){let t=document.getElementById("App");t&&await Kt({element:t,filename:document.title,prepare:Gt})}function vo(){return window.print()}function Co(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(be,{size:14})})}function ne(){S({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{at as a,Ze as c,ot as i,Je as l,lt as n,et as o,Za as r,Qe as s,lo as t,Ge as u};
1
+ import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as $,l as ct,p as ht,u as me}from"./useEvent-D91BmmQi.js";import{t as mt}from"./react-Bj1aDYRI.js";import{E as Me,En as pt,Jt as ut,Rr as ft,Ti as pe,Tn as xt,_ as yt,cr as kt,ct as We,h as _e,kn as bt,ot as wt,pr as jt,st as gt,t as vt,ur as Ct,vr as zt,wn as Mt}from"./cells-EJo3u4za.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Wt,x as _t}from"./ai-model-dropdown-DWOGmhDj.js";import{_ as H,d as Ne}from"./useEventListener-DGjKht0c.js";import{y as Nt}from"./utils-8btzWeZg.js";import{n as L,t as Se}from"./constants-tOPFFcLZ.js";import{S as ue,h as St,n as Dt,o as Pt,x as At}from"./config-DoZCLcOb.js";import{n as It}from"./switch-C6xjg01T.js";import{t as Et}from"./jsx-runtime-Blw4afVn.js";import{o as Lt}from"./alert-dialog-CXspBRlP.js";import{a as Tt,c as fe,o as xe,s as Rt}from"./popover-AtoFZ7i4.js";import{a as $t,c as Ht,i as qt,n as Bt,r as Ot,s as Ut,t as Vt}from"./select--zcABebs.js";import{gt as Ft}from"./JsonOutput-9XtRRx5l.js";import{c as De,d as ye,n as Yt,o as Kt,r as ke,t as Gt}from"./download-TSo32ofd.js";import{m as Jt}from"./form-BiDLPu7R.js";import{t as Pe}from"./tooltip-DmqhBBs6.js";import{r as Ae,t as q}from"./button-BKVLeSTX.js";import{i as Zt,r as Qt,t as Ie}from"./strings-pfr2N700.js";import{r as B}from"./requests-9-v2bhoi.js";import{t as b}from"./createLucideIcon-w-Qo9n0R.js";import{a as Ee,f as Xt,i as Le,m as ea,p as Te,u as Re}from"./layout-CF-7BNtf.js";import{t as be}from"./check-B-sKate2.js";import{n as ta}from"./maps-B4xARV9R.js";import{r as aa}from"./useCellActionButton-DftkIqUl.js";import{t as $e}from"./copy-DFMsQ6MJ.js";import{t as oa}from"./eye-off-DgRJ-xBZ.js";import{t as ae}from"./file-l37OnSN4.js";import{t as na}from"./github-C3N4cuN4.js";import{n as sa,r as la,t as ia}from"./youtube-D6LtMx2w.js";import{i as ra,n as He}from"./add-connection-dialog-ux7eCDRM.js";import{n as da,t as ca}from"./square-COtNnHUC.js";import{t as ha}from"./image-BgkzrnsX.js";import{t as ma}from"./link-dU_vDDSR.js";import{r as pa}from"./input-Bg12i6qY.js";import{t as ua}from"./settings-C1bg8A2T.js";import{t as fa}from"./sparkles-B79Qf6ma.js";import{y as xa}from"./textarea-Cfp3upzK.js";import{t as S}from"./use-toast-BDYuj3zG.js";import{n as qe,t as ya}from"./paths-BzSgteR-.js";import{o as ka}from"./session-DdnWW30b.js";import{n as O}from"./copy-Bizk-4hH.js";import{r as ba}from"./useRunCells-d2edY6Tu.js";import{a as Be,c as Oe,i as Ue,n as Ve,r as Fe}from"./dialog-BYjetQgE.js";import{n as we}from"./ImperativeModal-DoGv2BXV.js";import{r as wa,t as ja}from"./share-0LPgOyiW.js";import{a as ga}from"./cell-link-CcAqXeeg.js";import{a as va}from"./renderShortcut-DrDh2657.js";import{t as Ca}from"./icons-DlzgV4KY.js";import{n as za}from"./marimo-icons-Dp8wmdDL.js";import{t as Ma}from"./links-C19POYUQ.js";import{r as Wa,t as Ye}from"./hooks-BgwM3Mb2.js";import{t as Ke}from"./types-DOdUT9LT.js";var _a=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Na=b("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ge=b("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Je=b("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ze=b("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Sa=b("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Da=b("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Pa=b("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Qe=b("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Aa=b("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Ia=b("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ea=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Xe=b("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),La=b("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ta=b("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),et=b("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),je=N(),D=ze(mt(),1),a=ze(Et(),1);function Ra(){return"uvx marimo@latest"}function $a(t,e,n){let o=n?" --with-token":"",s=`${Ra()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode "$(${s} --opencode)"`;default:Qt(t)}}function Ha(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var qa="npx skills add marimo-team/marimo-pair";function Ba(){let t=(0,je.c)(2),[e,n]=(0,D.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(Dt("/auth/token").href,{headers:It.headers()}).then(Oa).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,D.useEffect)(o,s),e}function Oa(t){return t.ok?t.json():null}const Ua=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,D.useState)("claude"),r=Pt(),i=Ba(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=$a(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Oe,{children:"Pair with an agent"}),e[4]=m):m=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Be,{children:[m,(0,a.jsxs)(Fe,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=p):p=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(U,{command:qa})]}),e[6]=h):h=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=u):u=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=_=>s(_),e[8]=x):x=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Rt,{className:"w-full",children:[(0,a.jsx)(fe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(fe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(fe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=w):w=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(xe,{value:"claude",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[10]=c,e[11]=y);let k;e[12]===c?k=e[13]:(k=(0,a.jsx)(xe,{value:"codex",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[12]=c,e[13]=k);let j;e[14]===c?j=e[15]:(j=(0,a.jsx)(xe,{value:"opencode",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[14]=c,e[15]=j);let g;e[16]!==o||e[17]!==j||e[18]!==y||e[19]!==k?(g=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[u,(0,a.jsxs)(Tt,{value:o,onValueChange:x,children:[w,y,k,j]})]}),e[16]=o,e[17]=j,e[18]=y,e[19]=k,e[20]=g):g=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(U,{command:i,display:Ha(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==g||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,g,z]}),e[24]=g,e[25]=z,e[26]=v):v=e[26];let M;e[27]===n?M=e[28]:(M=(0,a.jsx)(Ue,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=M);let W;return e[29]!==v||e[30]!==M?(W=(0,a.jsxs)(Ve,{className:"sm:max-w-lg",children:[p,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var U=t=>{let e=(0,je.c)(15),{command:n,display:o}=t,[s,r]=(0,D.useState)(!1),i;e[0]===n?i=e[1]:(i=Ae.stopPropagation(async x=>{x.preventDefault(),await O(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let m;e[4]===s?m=e[5]:(m=s?(0,a.jsx)(be,{size:14,strokeWidth:1.5}):(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=m);let p;e[6]!==l||e[7]!==m?(p=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:m}),e[6]=l,e[7]=m,e[8]=p):p=e[8];let h;e[9]!==s||e[10]!==p?(h=(0,a.jsx)(Pe,{content:"Copied!",open:s,children:p}),e[9]=s,e[10]=p,e[11]=h):h=e[11];let u;return e[12]!==c||e[13]!==h?(u=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=u):u=e[14],u},tt=N(),oe="https://static.marimo.app";const Va=t=>{let e=(0,tt.c)(25),{onClose:n}=t,[o,s]=(0,D.useState)(""),{exportAsHTML:r}=B(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${oe}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async g=>{g.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:Xt.INSTANCE.filenames()}),v=S({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${oe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),S({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:L.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),S({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Oe,{children:"Share static notebook"}),e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Fe,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:oe,target:"_blank",children:oe}),"."]})]}),e[5]=m):m=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=g=>{s(g.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=p):p=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:p,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let u;e[9]===l?u=e[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Fa,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=u);let x;e[11]!==h||e[12]!==u?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,u]}),e[11]=h,e[12]=u,e[13]=x):x=e[13];let w;e[14]===n?w=e[15]:(w=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=w);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await O(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Ue,{children:[w,y]}),e[18]=w,e[19]=y,e[20]=k):k=e[20];let j;return e[21]!==d||e[22]!==k||e[23]!==x?(j=(0,a.jsx)(Ve,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[m,x,k]})}),e[21]=d,e[22]=k,e[23]=x,e[24]=j):j=e[24],j};var Fa=t=>{let e=(0,tt.c)(8),[n,o]=D.useState(!1),s;e[0]===t.text?s=e[1]:(s=Ae.stopPropagation(async c=>{c.preventDefault(),await O(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Pe,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Ya=N();function Ka(){let t=document.getElementsByClassName(Se.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=pe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:pe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Ga(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(pe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Se.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function at(){let t=(0,Ya.c)(2),e=$(We),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ka();e(s=>({mode:gt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ga(o)})})},t[0]=e,t[1]=n),n}const ot=ht(!1);var Ja=N();const Za=()=>{let t=(0,Ja.c)(7),{selectedLayout:e}=Ee(),{setLayoutView:n}=Le();if(ue()&&!bt("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Ut,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Bt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)($t,{children:"View as"}),Ke.map(Xa)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Vt,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function Qa(t){return(0,a.jsx)(nt(t),{className:"h-4 w-4"})}function nt(t){switch(t){case"vertical":return Aa;case"grid":return la;case"slides":return Xe;default:return Zt(t),ca}}function st(t){return Ie.startCase(t)}function Xa(t){return(0,a.jsx)(qt,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Qa(t),(0,a.jsx)("span",{children:st(t)})]})},t)}async function eo(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var to=N();function ao(t){let e=(0,to.c)(5),{openPrompt:n,closeModal:o}=we(),{sendCopy:s}=B(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ya.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(qe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),S({title:"Notebook copied",description:"A copy of the notebook has been created."}),Ma(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const oo=()=>{let{updateCellConfig:t}=Me(),{saveCellConfig:e}=B();return(0,D.useCallback)(async()=>{let n=new ut,o=_e(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Ne.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var no=N();function lt(){let t=(0,no.c)(4),{openConfirm:e}=we(),n=$(St),{sendRestart:o}=B(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Lt,{onClick:async()=>{n({state:At.CLOSING}),await o(),wa()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var so=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function lo(){var ve,Ce;let t=(0,so.c)(51),e=ga(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=Mt(),{selectedPanel:r}=xt(),[i]=ct(We),l=me(wt),d=oo(),[c]=Nt(),{updateCellConfig:m,undoDeleteCell:p,clearAllCellOutputs:h,addSetupCellIfDoesntExist:u,collapseAllCells:x,expandAllCells:w}=Me(),y=lt(),k=ba(),j=ao(e),g=$(ot),z=$(Wt),v=$(_t),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:P}=B(),A=Wa(),le=me(yt),ie=me(vt),{selectedLayout:V}=Ee(),{setLayoutView:re}=Le(),F=at(),Y=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=V==="slides",it=zo,rt=Co,G;t[0]!==e||t[1]!==A||t[2]!==P?(G=async f=>{let{preset:C,title:R}=f;if(!e){ne();return}await De(R,async he=>{await Ye({takeScreenshots:()=>A({progress:he}),updateCellOutputs:P}),await eo({filename:e,preset:C,downloadPDF:Yt})})},t[0]=e,t[1]=A,t[2]=P,t[3]=G):G=t[3];let I=G,J;t[4]===I?J=t[5]:(J=async()=>{if(ge){await I({preset:"document",title:"Downloading Document PDF..."});return}let f=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(f),setTimeout(vo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Z=J,Q;t[6]!==M||t[7]!==e||t[8]!==A||t[9]!==P?(Q=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async f=>{await Ye({takeScreenshots:()=>A({progress:f}),updateCellOutputs:P});let C=await M({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},t[6]=M,t[7]=e,t[8]=A,t[9]=P,t[10]=Q):Q=t[10];let ce=Q,X;t[11]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),t[11]=X):X=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let E;t[13]===e?E=t[14]:(E=async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!0})},t[13]=e,t[14]=E);let te;return t[15]!==u||t[16]!==ie||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==j||t[21]!==I||t[22]!==w||t[23]!==W||t[24]!==e||t[25]!==Z||t[26]!==ce||t[27]!==le||t[28]!==d||t[29]!==de||t[30]!==l||t[31]!==n||t[32]!==_||t[33]!==y||t[34]!==k||t[35]!==se||t[36]!==V||t[37]!==r||t[38]!==g||t[39]!==v||t[40]!==re||t[41]!==z||t[42]!==Y||t[43]!==K||t[44]!==E||t[45]!==s||t[46]!==F||t[47]!==p||t[48]!==m||t[49]!==i.mode?(te=[{icon:X,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Ca,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let f=await W({download:!1});ke(new Blob([f],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let f=await _();ke(new Blob([f.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",va("global.hideCode",!1)]}),handle:go},de?{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Z},{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:rt(!0),hidden:!ge,handle:async()=>{await I({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Z}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Ua,{onClose:o}))}},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!Y&&!K,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!Y,handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await O(ja({code:(await _()).contents})),S({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:pt.flatMap(f=>{let{type:C,Icon:R,hidden:he,additionalKeywords:dt}=f;return he?[]:{label:Ie.startCase(C),rightElement:it(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:dt}})},{icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(xa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{F()}},...Ke.map((f,C)=>{let R=nt(f);return{divider:C===0,label:st(f),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:V===f&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(f),i.mode==="edit"&&F()}}})]},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||ue(),handle:j},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await O((await _()).contents),S({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!le||l,handle:async()=>{let f=ft(_e());await se({configs:Ne.fromEntries(f.map(jo))});for(let C of f)m({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(He,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(He,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ie||l,handle:()=>{p()}},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>g(wo)},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(bo)},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(ko),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:yo},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"GitHub",handle:xo},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"YouTube",handle:uo},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ho}].filter(co).map(io),t[15]=u,t[16]=ie,t[17]=h,t[18]=o,t[19]=x,t[20]=j,t[21]=I,t[22]=w,t[23]=W,t[24]=e,t[25]=Z,t[26]=ce,t[27]=le,t[28]=d,t[29]=de,t[30]=l,t[31]=n,t[32]=_,t[33]=y,t[34]=k,t[35]=se,t[36]=V,t[37]=r,t[38]=g,t[39]=v,t[40]=re,t[41]=z,t[42]=Y,t[43]=K,t[44]=E,t[45]=s,t[46]=F,t[47]=p,t[48]=m,t[49]=i.mode,t[50]=te):te=t[50],te}function io(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ro)}:t}function ro(t){return!t.hidden}function co(t){return!t.hidden}function ho(){let t=ka();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function po(){window.open(L.releasesPage,"_blank")}function uo(){window.open(L.youtube,"_blank")}function fo(){window.open(L.discordLink,"_blank")}function xo(){window.open(L.githubPage,"_blank")}function yo(){window.open(L.docsPage,"_blank")}function ko(t){return!t}function bo(t){return!t}function wo(t){return!t}function jo(t){return[t,{disabled:!1}]}async function go(){let t=document.getElementById("App");t&&await Kt({element:t,filename:document.title,prepare:Gt})}function vo(){return window.print()}function Co(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(be,{size:14})})}function ne(){S({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{at as a,Ze as c,ot as i,Je as l,lt as n,et as o,Za as r,Qe as s,lo as t,Ge as u};
package/dist/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-BlbvNWcW.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-DW6VcSzY.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-D2MJg03u.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.22.6-dev8",
3
+ "version": "0.23.0",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -19,6 +19,7 @@ import { useForm } from "react-hook-form";
19
19
  import type z from "zod";
20
20
  import { Button } from "@/components/ui/button";
21
21
  import { Checkbox } from "@/components/ui/checkbox";
22
+ import { acceptCompletionOnEnterAtom } from "@/core/codemirror/completion/accept-on-enter-atom";
22
23
  import {
23
24
  Form,
24
25
  FormControl,
@@ -118,6 +119,9 @@ const LOCALE_SYSTEM_VALUE = "__system__";
118
119
 
119
120
  export const UserConfigForm: React.FC = () => {
120
121
  const [config, setConfig] = useUserConfig();
122
+ const [acceptOnEnter, setAcceptOnEnter] = useAtom(
123
+ acceptCompletionOnEnterAtom,
124
+ );
121
125
  const formElement = useRef<HTMLFormElement>(null);
122
126
  const setKeyboardShortcutsOpen = useSetAtom(keyboardShortcutsAtom);
123
127
  const [activeCategory, setActiveCategory] = useAtom(
@@ -446,6 +450,27 @@ export const UserConfigForm: React.FC = () => {
446
450
  </div>
447
451
  )}
448
452
  />
453
+ <div className="flex flex-col space-y-1">
454
+ <FormItem className={formItemClasses}>
455
+ <FormLabel className="font-normal">
456
+ Accept suggestion on Enter
457
+ </FormLabel>
458
+ <FormControl>
459
+ <Checkbox
460
+ data-testid="accept-completion-on-enter-checkbox"
461
+ checked={acceptOnEnter}
462
+ onCheckedChange={(checked) =>
463
+ setAcceptOnEnter(Boolean(checked))
464
+ }
465
+ />
466
+ </FormControl>
467
+ </FormItem>
468
+ <FormDescription>
469
+ When unchecked, pressing Enter inserts a new line instead of
470
+ accepting an autocomplete suggestion. Use Tab to accept
471
+ suggestions.
472
+ </FormDescription>
473
+ </div>
449
474
  <FormField
450
475
  control={form.control}
451
476
  name="completion.signature_hint_on_typing"
@@ -13,6 +13,7 @@ import { useCellActions } from "@/core/cells/cells";
13
13
  import { usePendingDeleteService } from "@/core/cells/pending-delete-service";
14
14
  import type { CellData, CellRuntimeState } from "@/core/cells/types";
15
15
  import { setupCodeMirror } from "@/core/codemirror/cm";
16
+ import { acceptCompletionOnEnterAtom } from "@/core/codemirror/completion/accept-on-enter-atom";
16
17
  import {
17
18
  getInitialLanguageAdapter,
18
19
  languageAdapterState,
@@ -146,6 +147,7 @@ const CellEditorInternal = ({
146
147
  });
147
148
 
148
149
  const autoInstantiate = useAtomValue(autoInstantiateAtom);
150
+ const acceptCompletionOnEnter = useAtomValue(acceptCompletionOnEnterAtom);
149
151
  const afterToggleMarkdown = useEvent(() => {
150
152
  maybeAddMarimoImport({
151
153
  autoInstantiate,
@@ -212,6 +214,7 @@ const CellEditorInternal = ({
212
214
  },
213
215
  },
214
216
  completionConfig: userConfig.completion,
217
+ acceptCompletionOnEnter,
215
218
  keymapConfig: userConfig.keymap,
216
219
  lspConfig: userConfig.language_servers,
217
220
  theme,
@@ -261,6 +264,7 @@ const CellEditorInternal = ({
261
264
  return extensions;
262
265
  }, [
263
266
  cellId,
267
+ acceptCompletionOnEnter,
264
268
  userConfig.keymap,
265
269
  userConfig.completion,
266
270
  userConfig.language_servers,
@@ -73,6 +73,7 @@ export interface CodeMirrorSetupOpts {
73
73
  cellId: CellId;
74
74
  showPlaceholder: boolean;
75
75
  enableAI: boolean;
76
+ acceptCompletionOnEnter?: boolean;
76
77
  cellActions: CodemirrorCellActions;
77
78
  completionConfig: CompletionConfig;
78
79
  keymapConfig: KeymapConfig;
@@ -175,6 +176,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
175
176
  theme,
176
177
  hotkeys,
177
178
  completionConfig,
179
+ acceptCompletionOnEnter,
178
180
  cellId,
179
181
  lspConfig,
180
182
  diagnosticsConfig,
@@ -207,7 +209,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
207
209
  foldGutter(),
208
210
  stringsAutoCloseBraces(),
209
211
  closeBrackets(),
210
- completionKeymap(),
212
+ completionKeymap(acceptCompletionOnEnter),
211
213
  // to avoid clash with charDeleteBackward keymap
212
214
  Prec.high(keymap.of(closeBracketsKeymap)),
213
215
  bracketMatching(),
@@ -1,8 +1,21 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import { completionKeymap as defaultCompletionKeymap } from "@codemirror/autocomplete";
4
+ import { EditorState } from "@codemirror/state";
5
+ import { keymap } from "@codemirror/view";
4
6
  import { describe, expect, it } from "vitest";
5
- import { filterCompletionBindings } from "../keymap";
7
+ import { completionKeymap, filterCompletionBindings } from "../keymap";
8
+
9
+ function hasEnterBinding(acceptOnEnter: boolean): boolean {
10
+ const state = EditorState.create({
11
+ extensions: [completionKeymap(acceptOnEnter)],
12
+ });
13
+
14
+ return state
15
+ .facet(keymap)
16
+ .flat()
17
+ .some((binding) => binding.key === "Enter");
18
+ }
6
19
 
7
20
  describe("completionKeymap", () => {
8
21
  it("upstream includes the macOS-only completion bindings we care about", () => {
@@ -21,4 +34,30 @@ describe("completionKeymap", () => {
21
34
  expect(filtered.some((binding) => binding.key === "Escape")).toBe(false);
22
35
  expect(filtered.some((binding) => binding.mac === "Alt-i")).toBe(true);
23
36
  });
37
+
38
+ it("includes Enter by default", () => {
39
+ const filtered = filterCompletionBindings(defaultCompletionKeymap);
40
+ expect(filtered.some((binding) => binding.key === "Enter")).toBe(true);
41
+ });
42
+
43
+ it("removes Enter when passed a keysToRemove set containing Enter", () => {
44
+ const keysToRemove = new Set<string | undefined>([
45
+ "Escape",
46
+ "Alt-`",
47
+ "Enter",
48
+ ]);
49
+ const filtered = filterCompletionBindings(
50
+ defaultCompletionKeymap,
51
+ keysToRemove,
52
+ );
53
+ expect(filtered.some((binding) => binding.key === "Enter")).toBe(false);
54
+ });
55
+
56
+ it("completionKeymap includes Enter when acceptOnEnter is true", () => {
57
+ expect(hasEnterBinding(true)).toBe(true);
58
+ });
59
+
60
+ it("completionKeymap removes Enter when acceptOnEnter is false", () => {
61
+ expect(hasEnterBinding(false)).toBe(false);
62
+ });
24
63
  });
@@ -0,0 +1,10 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ import { atomWithStorage } from "jotai/utils";
3
+ import { jotaiJsonStorage } from "@/utils/storage/jotai";
4
+ // Default: true (Enter accepts suggestion, matching VS Code default)
5
+ export const acceptCompletionOnEnterAtom = atomWithStorage<boolean>(
6
+ "marimo:accept-completion-on-enter",
7
+ true,
8
+ jotaiJsonStorage,
9
+ { getOnInit: true },
10
+ );
@@ -22,20 +22,27 @@ const KEYS_TO_REMOVE = new Set<string | undefined>([
22
22
  "Alt-`",
23
23
  ]);
24
24
 
25
- function hasRemovedKeybinding(binding: KeyBinding): boolean {
26
- return [binding.key, binding.mac, binding.linux, binding.win].some((key) =>
27
- KEYS_TO_REMOVE.has(key),
28
- );
29
- }
30
-
31
25
  export function filterCompletionBindings(
32
26
  bindings: readonly KeyBinding[],
27
+ keysToRemove: Set<string | undefined> = KEYS_TO_REMOVE,
33
28
  ): readonly KeyBinding[] {
34
- return bindings.filter((binding) => !hasRemovedKeybinding(binding));
29
+ return bindings.filter(
30
+ (binding) =>
31
+ ![binding.key, binding.mac, binding.linux, binding.win].some((key) =>
32
+ keysToRemove.has(key),
33
+ ),
34
+ );
35
35
  }
36
36
 
37
- export function completionKeymap(): Extension {
38
- const withoutKeysToRemove = filterCompletionBindings(defaultCompletionKeymap);
37
+ export function completionKeymap(acceptOnEnter = true): Extension {
38
+ const keysToRemove = new Set(KEYS_TO_REMOVE);
39
+ if (!acceptOnEnter) {
40
+ keysToRemove.add("Enter");
41
+ }
42
+ const withoutKeysToRemove = filterCompletionBindings(
43
+ defaultCompletionKeymap,
44
+ keysToRemove,
45
+ );
39
46
 
40
47
  return Prec.highest(
41
48
  keymap.of([
@@ -19,6 +19,7 @@ import {
19
19
  extractPoints,
20
20
  extractSunburstPoints,
21
21
  extractTreemapPoints,
22
+ hasAreaTrace,
22
23
  hasPureLineTrace,
23
24
  lineSelectionButtons,
24
25
  type ModeBarButton,
@@ -113,7 +114,8 @@ export const PlotlyComponent = memo(
113
114
 
114
115
  const configMemo = useDeepCompareMemoize(config);
115
116
  const plotlyConfig = useMemo((): Partial<Plotly.Config> => {
116
- const hasPureLine = hasPureLineTrace(figure.data);
117
+ const hasLineOrAreaTrace =
118
+ hasPureLineTrace(figure.data) || hasAreaTrace(figure.data);
117
119
  const defaultButtons: ModeBarButton[] = [
118
120
  // Custom button to reset the state
119
121
  {
@@ -130,7 +132,7 @@ export const PlotlyComponent = memo(
130
132
  click: handleResetWithClear,
131
133
  },
132
134
  ];
133
- if (hasPureLine) {
135
+ if (hasLineOrAreaTrace) {
134
136
  defaultButtons.push(...lineSelectionButtons(handleSetDragmode));
135
137
  }
136
138
 
@@ -111,4 +111,54 @@ describe("PlotlyPlugin", () => {
111
111
  range: undefined,
112
112
  });
113
113
  });
114
+
115
+ it("clicking a violin element triggers onClick", async () => {
116
+ const setValue = vi.fn<Setter<unknown>>();
117
+
118
+ render(
119
+ <Suspense fallback={null}>
120
+ <PlotlyComponent
121
+ figure={{
122
+ data: [{ type: "violin" }],
123
+ layout: {},
124
+ frames: null,
125
+ }}
126
+ value={undefined}
127
+ setValue={setValue}
128
+ host={document.createElement("div")}
129
+ config={{}}
130
+ />
131
+ </Suspense>,
132
+ );
133
+
134
+ await waitFor(() => {
135
+ expect(capturedPlotProps).not.toBeNull();
136
+ });
137
+
138
+ act(() => {
139
+ capturedPlotProps?.onClick?.({
140
+ points: [
141
+ {
142
+ data: { type: "violin" },
143
+ x: "Group A",
144
+ y: 3,
145
+ pointIndex: 0,
146
+ pointNumber: 0,
147
+ curveNumber: 0,
148
+ },
149
+ ],
150
+ });
151
+ });
152
+
153
+ expect(setValue).toHaveBeenCalledTimes(1);
154
+ const updater = setValue.mock.calls[0][0] as (value: unknown) => unknown;
155
+ expect(updater({})).toEqual({
156
+ selections: [],
157
+ points: [
158
+ { x: "Group A", y: 3, curveNumber: 0, pointNumber: 0, pointIndex: 0 },
159
+ ],
160
+ indices: [0],
161
+ range: undefined,
162
+ });
163
+ });
114
164
  });