@marimo-team/frontend 0.19.7-dev37 → 0.19.7-dev39

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 (23) hide show
  1. package/dist/assets/{add-cell-with-ai-DT1ae2MK.js → add-cell-with-ai-noZuPKY2.js} +2 -2
  2. package/dist/assets/{agent-panel-oLGqa4bG.js → agent-panel-Bv7IrTwR.js} +1 -1
  3. package/dist/assets/ai-model-dropdown-CJGHNqP_.js +5 -0
  4. package/dist/assets/{app-config-button-BiwYEPE8.js → app-config-button-DDLHriXt.js} +1 -1
  5. package/dist/assets/{cell-editor-B3U1SnYJ.js → cell-editor-BWyQ1DZv.js} +2 -2
  6. package/dist/assets/{chat-display-B34MaCGM.js → chat-display-CO27_lED.js} +1 -1
  7. package/dist/assets/{chat-panel-fuQFRvFm.js → chat-panel-DLqZeRMe.js} +2 -2
  8. package/dist/assets/{command-palette-KuNgJNix.js → command-palette-H-B8cBaS.js} +1 -1
  9. package/dist/assets/{edit-page-DBFIML4p.js → edit-page-BeRvoZb5.js} +7 -7
  10. package/dist/assets/{home-page--XVUAUCM.js → home-page-MttpX4Nz.js} +1 -1
  11. package/dist/assets/{index-Bj5F80Z9.css → index-CikhHYAB.css} +1 -1
  12. package/dist/assets/{index-DTpRqi46.js → index-DUcuXkRU.js} +3 -3
  13. package/dist/assets/{packages-panel-CBc59eNR.js → packages-panel-BkOmsLKm.js} +1 -1
  14. package/dist/assets/{scratchpad-panel-SMFZ5eRQ.js → scratchpad-panel-CAYDDJR8.js} +1 -1
  15. package/dist/assets/{useNotebookActions-DhF-uJ0P.js → useNotebookActions-CCKN64zx.js} +1 -1
  16. package/dist/index.html +5 -5
  17. package/package.json +2 -2
  18. package/src/components/app-config/ai-config.tsx +28 -0
  19. package/src/components/chat/chat-panel.tsx +1 -1
  20. package/src/components/editor/ai/add-cell-with-ai.tsx +1 -0
  21. package/src/components/editor/ai/ai-completion-editor.tsx +1 -0
  22. package/src/components/editor/renderers/cell-array.tsx +11 -3
  23. package/dist/assets/ai-model-dropdown-BL-PaF8o.js +0 -5
@@ -1 +1 @@
1
- import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-DO6uJBas.js";import{t as le}from"./react-BGmjiNul.js";import{Zn as V}from"./cells-BW_4R0Qw.js";import"./react-dom-C9fstfnp.js";import{t as ie}from"./compiler-runtime-DeeZ7FnK.js";import{r as ce}from"./ai-model-dropdown-BL-PaF8o.js";import{y as de}from"./utils-DXvhzCGS.js";import{j as me}from"./config-CIrPQIbt.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as pe}from"./button-YC1gW_kJ.js";import{t as K}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as W}from"./requests-BsVD4CdD.js";import{_ as ue}from"./select-V5IdpNiR.js";import{t as fe}from"./chevron-right-DwagBitu.js";import{u as ge}from"./toDate-CgbKQM5E.js";import{t as R}from"./spinner-DaIKav-i.js";import{a as he}from"./input-pAun1m1X.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ve}from"./use-toast-rmUWldD_.js";import"./Combination-CMPwuAmi.js";import{t as J}from"./tooltip-CEc2ajau.js";import"./popover-Gz-GJzym.js";import{t as je}from"./copy-Bv2DBpIS.js";import{i as be,n as Z,r as F,s as Q,t as ke}from"./useInstallPackage-Bdnnp5fe.js";import{n as X}from"./error-banner-DUzsIXtq.js";import{n as ye}from"./useAsyncData-C4XRy1BE.js";import{a as Ne,i as q,n as we,o as Y,r as B,t as Se}from"./table-C8uQmBAN.js";import{t as ee}from"./empty-state-h8C2C6hZ.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let r of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(r.toLowerCase()))return e.slice(r.length).trim();return e}var s=H(xe(),1),te=t=>{let e=(0,G.c)(9),{onClick:r,loading:n,children:l,className:x}=t;if(n){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let d;e[1]===x?d=e[2]:(d=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",x),e[1]=x,e[2]=d);let a;e[3]===r?a=e[4]:(a=pe.stopPropagation(r),e[3]=r,e[4]=a);let o;return e[5]!==l||e[6]!==d||e[7]!==a?(o=(0,s.jsx)("button",{type:"button",className:d,onClick:a,children:l}),e[5]=l,e[6]=d,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),r=e.package_management.manager,{getDependencyTree:n,getPackageList:l}=W(),[x,d]=I.useState(null),a;t[0]!==n||t[1]!==l?(a=async()=>{let[u,C]=await Promise.all([l(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=l,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=[r],t[3]=r,t[4]=o);let{data:c,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.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,s.jsx)(X,{error:m}),t[6]=m,t[7]=u),u}let h=c.tree!=null,i;t[8]!==h||t[9]!==x?(i=De(x,h),t[8]=h,t[9]=x,t[10]=i):i=t[10];let f=i,p=(w=c.tree)==null?void 0:w.name,P=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>",k;t[11]!==r||t[12]!==j?(k=(0,s.jsx)(Pe,{packageManager:r,onSuccess:j}),t[11]=r,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==p||t[17]!==P||t[18]!==f?(b=h&&(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.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:()=>d("list"),children:"List"}),(0,s.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:()=>d("tree"),children:"Tree"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.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"}),p&&!y&&(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=p,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==c.list||t[21]!==c.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,s.jsx)(Ee,{packages:c.list,onSuccess:j}):(0,s.jsx)($e,{tree:c.tree,error:m,onSuccess:j}),t[20]=c.list,t[21]=c.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,s.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:r,packageManager:n}=t,[l,x]=I.useState(""),{handleClick:d}=ce(),a=oe(Q),o=ae(Q),c,m;e[0]!==a||e[1]!==o?(c=()=>{a&&(x(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=c,e[3]=m):(c=e[2],m=e[3]),I.useEffect(c,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===r?h=e[5]:(h=()=>{r(),x("")},e[4]=r,e[5]=h);let i=h,f;e[6]!==g||e[7]!==l||e[8]!==i?(f=()=>{g([_e(l)],i)},e[6]=g,e[7]=l,e[8]=i,e[9]=f):f=e[9];let p=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==d?(y=j?(0,s.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,s.jsx)(J,{content:"Change package manager",children:(0,s.jsx)(V,{onClick:()=>d("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=d,e[12]=y):y=e[12];let k;e[13]===p?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),p())},e[13]=p,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>x(U.target.value),e[15]=b):b=e[15];let v;e[16]!==l||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,s.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:l,onKeyDown:k,onChange:b}),e[16]=l,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,s.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,s.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,s.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,s.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,s.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,s.jsxs)("div",{children:[C," A Git repository",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,s.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,s.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,s.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,s.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,s.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,s.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,s.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,s.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=l&&"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=!l,M;e[33]!==p||e[34]!==N||e[35]!==z?(M=(0,s.jsx)("button",{type:"button",className:N,onClick:p,disabled:z,children:"Add"}),e[33]=p,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,s.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:r,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,s.jsx)(V,{})}),e[0]=a):a=e[0],a}let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,s.jsx)(Ne,{children:(0,s.jsxs)(Y,{children:[(0,s.jsx)(q,{children:"Name"}),(0,s.jsx)(q,{children:"Version"}),(0,s.jsx)(q,{})]})}),e[1]=l):l=e[1];let x;if(e[2]!==r||e[3]!==n){let a;e[5]===r?a=e[6]:(a=o=>(0,s.jsxs)(Y,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,s.jsx)(B,{children:o.name}),(0,s.jsx)(B,{children:o.version}),(0,s.jsxs)(B,{className:"flex justify-end",children:[(0,s.jsx)(se,{packageName:o.name,onSuccess:r}),(0,s.jsx)(re,{packageName:o.name,onSuccess:r})]})]},o.name),e[5]=r,e[6]=a),x=n.map(a),e[2]=r,e[3]=n,e[4]=x}else x=e[4];let d;return e[7]===x?d=e[8]:(d=(0,s.jsxs)(Se,{className:"overflow-auto flex-1",children:[l,(0,s.jsx)(we,{children:x})]}),e[7]=x,e[8]=d),d},se=({packageName:t,onSuccess:e})=>{let[r,n]=I.useState(!1),{addPackage:l}=W();return me()?null:(0,s.jsx)(te,{onClick:async()=>{try{n(!0);let x=await l({package:t,upgrade:!0});x.success?(e(),F(t)):F(t,x.error)}finally{n(!1)}},loading:r,children:"Upgrade"})},re=({packageName:t,tags:e,onSuccess:r})=>{let[n,l]=I.useState(!1),{removePackage:x}=W();return(0,s.jsx)(te,{onClick:async()=>{try{l(!0);let d=e==null?void 0:e.some(o=>o.kind==="group"&&o.value==="dev"),a=await x({package:t,dev:d});a.success?(r(),Z(t)):Z(t,a.error)}finally{l(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:r,error:n,onSuccess:l}=t,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[0]=x):x=e[0];let[d,a]=I.useState(x),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let c;if(e[2]===r?c=e[3]:(c=[r],e[2]=r,e[3]=c),I.useEffect(o,c),n){let i;return e[4]===n?i=e[5]:(i=(0,s.jsx)(X,{error:n}),e[4]=n,e[5]=i),i}if(!r){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(R,{size:"medium",centered:!0}),e[6]=i):i=e[6],i}if(r.dependencies.length===0){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,s.jsx)(V,{})}),e[7]=i):i=e[7],i}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=i=>{a(f=>{let p=new Set(f);return p.has(i)?p.delete(i):p.add(i),p})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==d||e[10]!==l||e[11]!==r.dependencies){let i;e[13]!==d||e[14]!==l?(i=(f,p)=>(0,s.jsx)("div",{className:"border-b",children:(0,s.jsx)(ne,{nodeId:`root-${p}`,node:f,level:0,isTopLevel:!0,expandedNodes:d,onToggle:j,onSuccess:l})},`${f.name}-${p}`),e[13]=d,e[14]=l,e[15]=i):i=e[15],g=r.dependencies.map(i),e[9]=d,e[10]=l,e[11]=r.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:r,node:n,level:l,isTopLevel:x,expandedNodes:d,onToggle:a,onSuccess:o}=t,c=x===void 0?!1:x,m=n.dependencies.length>0,j;e[0]!==d||e[1]!==r?(j=d.has(r),e[0]=d,e[1]=r,e[2]=j):j=e[2];let g=j,h=c?0:16+l*16,i;e[3]!==m||e[4]!==r||e[5]!==a?(i=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(r))},e[3]=m,e[4]=r,e[5]=a,e[6]=i):i=e[6];let f=i,p;e[7]!==m||e[8]!==r||e[9]!==a?(p=N=>{N.stopPropagation(),m&&a(r)},e[7]=m,e[8]=r,e[9]=a,e[10]=p):p=e[10];let P=p,y=m&&"select-none",k=c?"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]!==c?(v=c?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=c,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,s.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.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,s.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,s.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,s.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,s.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==c||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=c&&(0,s.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,s.jsx)(se,{packageName:n.name,onSuccess:o}),(0,s.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=c,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,s.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]!==d||e[47]!==m||e[48]!==g||e[49]!==l||e[50]!==n.dependencies||e[51]!==r||e[52]!==o||e[53]!==a?(A=m&&g&&(0,s.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,s.jsx)(ne,{nodeId:`${r}-${z}`,node:N,level:l+1,isTopLevel:!1,expandedNodes:d,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=d,e[47]=m,e[48]=g,e[49]=l,e[50]=n.dependencies,e[51]=r,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,s.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,s.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,s.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,s.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-DO6uJBas.js";import{t as le}from"./react-BGmjiNul.js";import{Zn as V}from"./cells-BW_4R0Qw.js";import"./react-dom-C9fstfnp.js";import{t as ie}from"./compiler-runtime-DeeZ7FnK.js";import{r as ce}from"./ai-model-dropdown-CJGHNqP_.js";import{y as de}from"./utils-DXvhzCGS.js";import{j as me}from"./config-CIrPQIbt.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as pe}from"./button-YC1gW_kJ.js";import{t as K}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as W}from"./requests-BsVD4CdD.js";import{_ as ue}from"./select-V5IdpNiR.js";import{t as fe}from"./chevron-right-DwagBitu.js";import{u as ge}from"./toDate-CgbKQM5E.js";import{t as R}from"./spinner-DaIKav-i.js";import{a as he}from"./input-pAun1m1X.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ve}from"./use-toast-rmUWldD_.js";import"./Combination-CMPwuAmi.js";import{t as J}from"./tooltip-CEc2ajau.js";import"./popover-Gz-GJzym.js";import{t as je}from"./copy-Bv2DBpIS.js";import{i as be,n as Z,r as F,s as Q,t as ke}from"./useInstallPackage-Bdnnp5fe.js";import{n as X}from"./error-banner-DUzsIXtq.js";import{n as ye}from"./useAsyncData-C4XRy1BE.js";import{a as Ne,i as q,n as we,o as Y,r as B,t as Se}from"./table-C8uQmBAN.js";import{t as ee}from"./empty-state-h8C2C6hZ.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let r of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(r.toLowerCase()))return e.slice(r.length).trim();return e}var s=H(xe(),1),te=t=>{let e=(0,G.c)(9),{onClick:r,loading:n,children:l,className:x}=t;if(n){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let d;e[1]===x?d=e[2]:(d=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",x),e[1]=x,e[2]=d);let a;e[3]===r?a=e[4]:(a=pe.stopPropagation(r),e[3]=r,e[4]=a);let o;return e[5]!==l||e[6]!==d||e[7]!==a?(o=(0,s.jsx)("button",{type:"button",className:d,onClick:a,children:l}),e[5]=l,e[6]=d,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),r=e.package_management.manager,{getDependencyTree:n,getPackageList:l}=W(),[x,d]=I.useState(null),a;t[0]!==n||t[1]!==l?(a=async()=>{let[u,C]=await Promise.all([l(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=l,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=[r],t[3]=r,t[4]=o);let{data:c,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.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,s.jsx)(X,{error:m}),t[6]=m,t[7]=u),u}let h=c.tree!=null,i;t[8]!==h||t[9]!==x?(i=De(x,h),t[8]=h,t[9]=x,t[10]=i):i=t[10];let f=i,p=(w=c.tree)==null?void 0:w.name,P=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>",k;t[11]!==r||t[12]!==j?(k=(0,s.jsx)(Pe,{packageManager:r,onSuccess:j}),t[11]=r,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==p||t[17]!==P||t[18]!==f?(b=h&&(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.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:()=>d("list"),children:"List"}),(0,s.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:()=>d("tree"),children:"Tree"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.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"}),p&&!y&&(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=p,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==c.list||t[21]!==c.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,s.jsx)(Ee,{packages:c.list,onSuccess:j}):(0,s.jsx)($e,{tree:c.tree,error:m,onSuccess:j}),t[20]=c.list,t[21]=c.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,s.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:r,packageManager:n}=t,[l,x]=I.useState(""),{handleClick:d}=ce(),a=oe(Q),o=ae(Q),c,m;e[0]!==a||e[1]!==o?(c=()=>{a&&(x(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=c,e[3]=m):(c=e[2],m=e[3]),I.useEffect(c,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===r?h=e[5]:(h=()=>{r(),x("")},e[4]=r,e[5]=h);let i=h,f;e[6]!==g||e[7]!==l||e[8]!==i?(f=()=>{g([_e(l)],i)},e[6]=g,e[7]=l,e[8]=i,e[9]=f):f=e[9];let p=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==d?(y=j?(0,s.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,s.jsx)(J,{content:"Change package manager",children:(0,s.jsx)(V,{onClick:()=>d("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=d,e[12]=y):y=e[12];let k;e[13]===p?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),p())},e[13]=p,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>x(U.target.value),e[15]=b):b=e[15];let v;e[16]!==l||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,s.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:l,onKeyDown:k,onChange:b}),e[16]=l,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,s.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,s.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,s.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,s.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,s.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,s.jsxs)("div",{children:[C," A Git repository",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,s.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,s.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,s.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,s.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,s.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,s.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,s.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,s.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=l&&"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=!l,M;e[33]!==p||e[34]!==N||e[35]!==z?(M=(0,s.jsx)("button",{type:"button",className:N,onClick:p,disabled:z,children:"Add"}),e[33]=p,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,s.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:r,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,s.jsx)(V,{})}),e[0]=a):a=e[0],a}let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,s.jsx)(Ne,{children:(0,s.jsxs)(Y,{children:[(0,s.jsx)(q,{children:"Name"}),(0,s.jsx)(q,{children:"Version"}),(0,s.jsx)(q,{})]})}),e[1]=l):l=e[1];let x;if(e[2]!==r||e[3]!==n){let a;e[5]===r?a=e[6]:(a=o=>(0,s.jsxs)(Y,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,s.jsx)(B,{children:o.name}),(0,s.jsx)(B,{children:o.version}),(0,s.jsxs)(B,{className:"flex justify-end",children:[(0,s.jsx)(se,{packageName:o.name,onSuccess:r}),(0,s.jsx)(re,{packageName:o.name,onSuccess:r})]})]},o.name),e[5]=r,e[6]=a),x=n.map(a),e[2]=r,e[3]=n,e[4]=x}else x=e[4];let d;return e[7]===x?d=e[8]:(d=(0,s.jsxs)(Se,{className:"overflow-auto flex-1",children:[l,(0,s.jsx)(we,{children:x})]}),e[7]=x,e[8]=d),d},se=({packageName:t,onSuccess:e})=>{let[r,n]=I.useState(!1),{addPackage:l}=W();return me()?null:(0,s.jsx)(te,{onClick:async()=>{try{n(!0);let x=await l({package:t,upgrade:!0});x.success?(e(),F(t)):F(t,x.error)}finally{n(!1)}},loading:r,children:"Upgrade"})},re=({packageName:t,tags:e,onSuccess:r})=>{let[n,l]=I.useState(!1),{removePackage:x}=W();return(0,s.jsx)(te,{onClick:async()=>{try{l(!0);let d=e==null?void 0:e.some(o=>o.kind==="group"&&o.value==="dev"),a=await x({package:t,dev:d});a.success?(r(),Z(t)):Z(t,a.error)}finally{l(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:r,error:n,onSuccess:l}=t,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[0]=x):x=e[0];let[d,a]=I.useState(x),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let c;if(e[2]===r?c=e[3]:(c=[r],e[2]=r,e[3]=c),I.useEffect(o,c),n){let i;return e[4]===n?i=e[5]:(i=(0,s.jsx)(X,{error:n}),e[4]=n,e[5]=i),i}if(!r){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(R,{size:"medium",centered:!0}),e[6]=i):i=e[6],i}if(r.dependencies.length===0){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,s.jsx)(V,{})}),e[7]=i):i=e[7],i}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=i=>{a(f=>{let p=new Set(f);return p.has(i)?p.delete(i):p.add(i),p})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==d||e[10]!==l||e[11]!==r.dependencies){let i;e[13]!==d||e[14]!==l?(i=(f,p)=>(0,s.jsx)("div",{className:"border-b",children:(0,s.jsx)(ne,{nodeId:`root-${p}`,node:f,level:0,isTopLevel:!0,expandedNodes:d,onToggle:j,onSuccess:l})},`${f.name}-${p}`),e[13]=d,e[14]=l,e[15]=i):i=e[15],g=r.dependencies.map(i),e[9]=d,e[10]=l,e[11]=r.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:r,node:n,level:l,isTopLevel:x,expandedNodes:d,onToggle:a,onSuccess:o}=t,c=x===void 0?!1:x,m=n.dependencies.length>0,j;e[0]!==d||e[1]!==r?(j=d.has(r),e[0]=d,e[1]=r,e[2]=j):j=e[2];let g=j,h=c?0:16+l*16,i;e[3]!==m||e[4]!==r||e[5]!==a?(i=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(r))},e[3]=m,e[4]=r,e[5]=a,e[6]=i):i=e[6];let f=i,p;e[7]!==m||e[8]!==r||e[9]!==a?(p=N=>{N.stopPropagation(),m&&a(r)},e[7]=m,e[8]=r,e[9]=a,e[10]=p):p=e[10];let P=p,y=m&&"select-none",k=c?"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]!==c?(v=c?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=c,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,s.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.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,s.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,s.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,s.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,s.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==c||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=c&&(0,s.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,s.jsx)(se,{packageName:n.name,onSuccess:o}),(0,s.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=c,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,s.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]!==d||e[47]!==m||e[48]!==g||e[49]!==l||e[50]!==n.dependencies||e[51]!==r||e[52]!==o||e[53]!==a?(A=m&&g&&(0,s.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,s.jsx)(ne,{nodeId:`${r}-${z}`,node:N,level:l+1,isTopLevel:!1,expandedNodes:d,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=d,e[47]=m,e[48]=g,e[49]=l,e[50]=n.dependencies,e[51]=r,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,s.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,s.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,s.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,s.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 oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-DO6uJBas.js";import{t as Ne}from"./react-BGmjiNul.js";import{N as ke,Zr as ze,_n as Ce,ai as Se,oi as n,w as Oe,__tla as Ae}from"./cells-BW_4R0Qw.js";import"./react-dom-C9fstfnp.js";import{t as se}from"./compiler-runtime-DeeZ7FnK.js";import"./tooltip-BGrCWNss.js";import{f as ie}from"./hotkeys-BHHWjLlp.js";import{y as Ie}from"./utils-DXvhzCGS.js";import{t as Le}from"./constants-B6Cb__3x.js";import"./config-CIrPQIbt.js";import{t as Me}from"./jsx-runtime-ZmTK25f3.js";import{t as z}from"./button-YC1gW_kJ.js";import{t as le}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import{n as Pe,__tla as Ee}from"./JsonOutput-DtidtKaJ.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as Re}from"./requests-BsVD4CdD.js";import{t as me}from"./createLucideIcon-CnW3RofX.js";import{d as De,__tla as He}from"./layout-KY92f2Sm.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import"./download-Bwa9P-Pz.js";import"./markdown-renderer-Dpn5NCvn.js";import{u as Ge}from"./toDate-CgbKQM5E.js";import{t as Ue,__tla as Ze}from"./cell-editor-B3U1SnYJ.js";import{t as Be}from"./play-BPIh-ZEU.js";import{t as Fe}from"./spinner-DaIKav-i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{r as Je}from"./useTheme-DUdVAZI8.js";import"./Combination-CMPwuAmi.js";import{t as C}from"./tooltip-CEc2ajau.js";import"./dates-Dhn1r-h6.js";import"./popover-Gz-GJzym.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import"./purify.es-DNVQZNFu.js";import{__tla as Ke}from"./chunk-5FQGJX7Z-CVUXBqX6.js";import"./katex-Dc8yG8NU.js";import"./html-to-image-Cu1p0tCK.js";import{o as Qe}from"./focus-CsiV5LZR.js";import{a as We}from"./renderShortcut-DEwfrKeS.js";import"./esm-DpMp6qko.js";import{n as Xe,r as Ye,t as ne}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import"./name-cell-input-D6uaGwg7.js";import{n as $e,r as et}from"./panel-context-B7WTvLhE.js";import"./Inputs-D2Xn4HON.js";import{__tla as tt}from"./loro_wasm_bg-CDxXoyfI.js";import"./ws-BApgRfsy.js";import"./dist-C9XNJlLJ.js";import"./dist-fsvXrTzp.js";import"./dist-6cIjG-FS.js";import"./dist-CldbmzwA.js";import"./dist-OM63llNV.js";import"./dist-BmvOPdv_.js";import"./dist-DDGPBuw4.js";import"./dist-C4h-1T2Q.js";import"./dist-D_XLVesh.js";import"./esm-l4kcybiY.js";import{t as rt}from"./kiosk-mode-vMIC4Cbh.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Ee}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ze}catch{}})(),(()=>{try{return Ke}catch{}})(),(()=>{try{return tt}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"}]]),pe=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"}]]),he=se(),q=oe(Ne(),1),ue=15;const T=ze("marimo:scratchpadHistory:v1",[],Ce),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ke(),[i]=Ie(),{theme:m}=Je(),c=(0,q.useRef)(null),G=Qe(),{createNewCell:U,updateCellCode:d}=Oe(),{sendRunScratchpad:p}=Re(),S=$e(),Z=et(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,F=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[a,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==U||e[6]!==G?(I=()=>{r.trim()&&U({code:r,before:!1,cellId:G??"__end__"})},e[4]=r,e[5]=U,e[6]=G,e[7]=I):I=e[7];let K=V(I),L;e[8]!==p||e[9]!==d?(L=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let o=c.current;o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=L):L=e[10];let Q=V(L),M;e[11]!==h||e[12]!==d?(M=o=>{h(!1),d({cellId:n,code:o,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:o}})},e[11]=h,e[12]=d,e[13]=M):M=e[13];let W=V(M),[X,ge]=(0,q.useState)(),P;e[14]!==W||e[15]!==u||e[16]!==a||e[17]!==m?(P=()=>a?(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((o,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>W(o),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=W,e[15]=u,e[16]=a,e[17]=m,e[18]=P):P=e[18];let Y=P,E;e[19]!==Q||e[20]!==K||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==O?(E=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:We("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Be,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(C,{content:"Clear code and outputs",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(rt,{children:(0,t.jsx)(C,{content:"Insert code",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:K,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Fe,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(C,{content:"Toggle history",children:(0,t.jsx)(z,{size:"xs",variant:"text",className:le(a&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!a),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(C,{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)(z,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=Q,e[20]=K,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=O,e[26]=E):E=e[26];let $=E,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=o=>{c.current=o},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==X||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:X,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=X,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Y?v=e[38]:(v=Y(),e[37]=Y,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 b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ye,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===F?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:F,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=F,e[50]=w);let N;e[51]!==y||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:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==Z||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Xe,{direction:S,className:"h-full",children:[g,b,N]},Z)}),e[54]=S,e[55]=Z,e[56]=g,e[57]=b,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 oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-DO6uJBas.js";import{t as Ne}from"./react-BGmjiNul.js";import{N as ke,Zr as ze,_n as Ce,ai as Se,oi as n,w as Oe,__tla as Ae}from"./cells-BW_4R0Qw.js";import"./react-dom-C9fstfnp.js";import{t as se}from"./compiler-runtime-DeeZ7FnK.js";import"./tooltip-BGrCWNss.js";import{f as ie}from"./hotkeys-BHHWjLlp.js";import{y as Ie}from"./utils-DXvhzCGS.js";import{t as Le}from"./constants-B6Cb__3x.js";import"./config-CIrPQIbt.js";import{t as Me}from"./jsx-runtime-ZmTK25f3.js";import{t as z}from"./button-YC1gW_kJ.js";import{t as le}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import{n as Pe,__tla as Ee}from"./JsonOutput-DtidtKaJ.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as Re}from"./requests-BsVD4CdD.js";import{t as me}from"./createLucideIcon-CnW3RofX.js";import{d as De,__tla as He}from"./layout-KY92f2Sm.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import"./download-Bwa9P-Pz.js";import"./markdown-renderer-Dpn5NCvn.js";import{u as Ge}from"./toDate-CgbKQM5E.js";import{t as Ue,__tla as Ze}from"./cell-editor-BWyQ1DZv.js";import{t as Be}from"./play-BPIh-ZEU.js";import{t as Fe}from"./spinner-DaIKav-i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{r as Je}from"./useTheme-DUdVAZI8.js";import"./Combination-CMPwuAmi.js";import{t as C}from"./tooltip-CEc2ajau.js";import"./dates-Dhn1r-h6.js";import"./popover-Gz-GJzym.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import"./purify.es-DNVQZNFu.js";import{__tla as Ke}from"./chunk-5FQGJX7Z-CVUXBqX6.js";import"./katex-Dc8yG8NU.js";import"./html-to-image-Cu1p0tCK.js";import{o as Qe}from"./focus-CsiV5LZR.js";import{a as We}from"./renderShortcut-DEwfrKeS.js";import"./esm-DpMp6qko.js";import{n as Xe,r as Ye,t as ne}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import"./name-cell-input-D6uaGwg7.js";import{n as $e,r as et}from"./panel-context-B7WTvLhE.js";import"./Inputs-D2Xn4HON.js";import{__tla as tt}from"./loro_wasm_bg-CDxXoyfI.js";import"./ws-BApgRfsy.js";import"./dist-C9XNJlLJ.js";import"./dist-fsvXrTzp.js";import"./dist-6cIjG-FS.js";import"./dist-CldbmzwA.js";import"./dist-OM63llNV.js";import"./dist-BmvOPdv_.js";import"./dist-DDGPBuw4.js";import"./dist-C4h-1T2Q.js";import"./dist-D_XLVesh.js";import"./esm-l4kcybiY.js";import{t as rt}from"./kiosk-mode-vMIC4Cbh.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Ee}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ze}catch{}})(),(()=>{try{return Ke}catch{}})(),(()=>{try{return tt}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"}]]),pe=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"}]]),he=se(),q=oe(Ne(),1),ue=15;const T=ze("marimo:scratchpadHistory:v1",[],Ce),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ke(),[i]=Ie(),{theme:m}=Je(),c=(0,q.useRef)(null),G=Qe(),{createNewCell:U,updateCellCode:d}=Oe(),{sendRunScratchpad:p}=Re(),S=$e(),Z=et(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,F=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[a,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==U||e[6]!==G?(I=()=>{r.trim()&&U({code:r,before:!1,cellId:G??"__end__"})},e[4]=r,e[5]=U,e[6]=G,e[7]=I):I=e[7];let K=V(I),L;e[8]!==p||e[9]!==d?(L=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let o=c.current;o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=L):L=e[10];let Q=V(L),M;e[11]!==h||e[12]!==d?(M=o=>{h(!1),d({cellId:n,code:o,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:o}})},e[11]=h,e[12]=d,e[13]=M):M=e[13];let W=V(M),[X,ge]=(0,q.useState)(),P;e[14]!==W||e[15]!==u||e[16]!==a||e[17]!==m?(P=()=>a?(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((o,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>W(o),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=W,e[15]=u,e[16]=a,e[17]=m,e[18]=P):P=e[18];let Y=P,E;e[19]!==Q||e[20]!==K||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==O?(E=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:We("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Be,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(C,{content:"Clear code and outputs",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(rt,{children:(0,t.jsx)(C,{content:"Insert code",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:K,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Fe,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(C,{content:"Toggle history",children:(0,t.jsx)(z,{size:"xs",variant:"text",className:le(a&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!a),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(C,{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)(z,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=Q,e[20]=K,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=O,e[26]=E):E=e[26];let $=E,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=o=>{c.current=o},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==X||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:X,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=X,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Y?v=e[38]:(v=Y(),e[37]=Y,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 b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ye,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===F?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:F,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=F,e[50]=w);let N;e[51]!==y||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:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==Z||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Xe,{direction:S,className:"h-full",children:[g,b,N]},Z)}),e[54]=S,e[55]=Z,e[56]=g,e[57]=b,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 de}from"./chunk-LvLJmgfZ.js";import{d as D,l as Oe,p as Be,u as ee}from"./useEvent-DO6uJBas.js";import{t as Ue}from"./react-BGmjiNul.js";import{$n as $e,Gn as Ye,Jn as Fe,Rt as Ge,Un as Je,ai as te,dn as Ke,g as Xe,hn as ce,jt as Ze,ln as Qe,m as he,t as et,un as tt,w as pe,yr as at,zt as me}from"./cells-BW_4R0Qw.js";import{t as W}from"./compiler-runtime-DeeZ7FnK.js";import{n as ot}from"./assertNever-CBU83Y6o.js";import{s as ue}from"./useLifecycle-D35CBukS.js";import{n as nt}from"./add-database-form-_pTLtiHN.js";import{n as it,x as lt}from"./ai-model-dropdown-BL-PaF8o.js";import{a as fe,d as P}from"./hotkeys-BHHWjLlp.js";import{y as st}from"./utils-DXvhzCGS.js";import{n as _,t as ye}from"./constants-B6Cb__3x.js";import{A as rt,f as dt,j as ke,w as ct}from"./config-CIrPQIbt.js";import{t as ht}from"./jsx-runtime-ZmTK25f3.js";import{r as pt,t as ae}from"./button-YC1gW_kJ.js";import{r as I}from"./requests-BsVD4CdD.js";import{t as h}from"./createLucideIcon-CnW3RofX.js";import{a as be,f as mt,i as xe,m as ut,p as we,u as ge}from"./layout-KY92f2Sm.js";import{t as je}from"./check-DdfN0k2d.js";import{a as ft,c as yt,i as kt,n as bt,r as xt,s as wt,t as gt}from"./select-V5IdpNiR.js";import{c as jt,d as ve,n as vt,o as Ct,r as Ce,t as zt}from"./download-Bwa9P-Pz.js";import{f as Mt}from"./maps-t9yNKYA8.js";import{r as Wt}from"./useCellActionButton-DwRoApVS.js";import{t as _t}from"./copy-CQ15EONK.js";import{t as At}from"./download-B9SUL40m.js";import{t as St}from"./eye-off-BhExYOph.js";import{t as Nt}from"./file-plus-corner-Da9I6dgU.js";import{t as Dt}from"./file-Cs1JbsV6.js";import{i as Pt,n as It,r as Et,t as Tt}from"./youtube-8p26v8EM.js";import{n as Ht,t as Lt}from"./house-DhFkiXz7.js";import{n as qt}from"./play-BPIh-ZEU.js";import{t as Rt}from"./link-BsTPF7B0.js";import{r as Vt}from"./input-pAun1m1X.js";import{t as Ot}from"./settings-DOXWMfVd.js";import{y as Bt}from"./textarea-DSR2T2ft.js";import{t as Ut}from"./square-C8Tw_XXG.js";import{t as C}from"./use-toast-rmUWldD_.js";import{t as $t}from"./tooltip-CEc2ajau.js";import{a as ze,i as Yt,r as Ft}from"./mode-BCr7l3Th.js";import{o as Gt}from"./alert-dialog-DwQffb13.js";import{a as Jt,c as Kt,i as Xt,n as Zt,r as Qt}from"./dialog-CxGKN4C_.js";import{n as oe}from"./ImperativeModal-CUbWEBci.js";import{r as ea,t as ta}from"./share-CbPtIlnM.js";import{t as U}from"./copy-Bv2DBpIS.js";import{r as aa}from"./useRunCells-C50mliNM.js";import{a as oa}from"./cell-link-_-mIiddP.js";import{a as Me}from"./renderShortcut-DEwfrKeS.js";import{t as na}from"./icons-BhEXrzsb.js";import{t as ia}from"./links-C-GGaW8R.js";import{r as la,t as sa}from"./hooks-B1nUQK2T.js";import{t as We}from"./types-z6Sk3JCV.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),_e=h("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"}]]),Ae=h("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"}]]),Se=h("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"}]]),ca=h("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"}]]),ha=h("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=h("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"}]]),Ne=h("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"}]]),ma=h("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"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),De=h("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"}]]),fa=h("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"}]]),ya=h("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"}]]),Pe=h("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"}]]),Ie=W(),ne=de(Ue(),1),a=de(ht(),1),$="https://static.marimo.app";const ka=e=>{let t=(0,Ie.c)(25),{onClose:n}=e,[o,l]=(0,ne.useState)(""),{exportAsHTML:r}=I(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${$}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let A=await r({download:!1,includeCode:!0,files:mt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${$}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:s})}).catch(()=>{z.dismiss(),C({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:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({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."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Kt,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Jt,{children:[p,(0,a.jsxs)(Qt,{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:$,target:"_blank",children:$}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Vt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===i?u=t[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)(ba,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=u);let f;t[11]!==m||t[12]!==u?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,u]}),t[11]=m,t[12]=u,t[13]=f):f=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(ae,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let k;t[16]===i?k=t[17]:(k=(0,a.jsx)(ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await U(i)},children:"Create"}),t[16]=i,t[17]=k);let b;t[18]!==y||t[19]!==k?(b=(0,a.jsxs)(Xt,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=b):b=t[20];let j;return t[21]!==d||t[22]!==b||t[23]!==f?(j=(0,a.jsx)(Zt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,f,b]})}),t[21]=d,t[22]=b,t[23]=f,t[24]=j):j=t[24],j};var ba=e=>{let t=(0,Ie.c)(8),[n,o]=ne.useState(!1),l;t[0]===e.text?l=t[1]:(l=pt.stopPropagation(async p=>{p.preventDefault(),await U(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ae,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)($t,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},xa=W();function wa(){let e=document.getElementsByClassName(ye.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=te.findElement(t);if(!o){P.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:te.parse(o.id)}}}return P.warn("No visible output area found for scroll anchor"),null}function ga(e){if(!e){P.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(te.create(e.cellId));if(!t){P.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${ye.outputArea}`)){P.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ee(){let e=(0,xa.c)(2),t=D(ze),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:Yt(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const Te=Be(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=be(),{setLayoutView:n}=xe();if(ke()&&!ce("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(wt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(yt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(bt,{children:(0,a.jsxs)(xt,{children:[(0,a.jsx)(ft,{children:"View as"}),We.map(za)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(gt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function Ca(e){return(0,a.jsx)(He(e),{className:"h-4 w-4"})}function He(e){switch(e){case"vertical":return ma;case"grid":return Et;case"slides":return De;default:return ot(e),Ut}}function Le(e){return ue(e)}function za(e){return(0,a.jsx)(kt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Le(e)})]})},e)}var Ma=W();function Wa(e){let t=(0,Ma.c)(5),{openPrompt:n,closeModal:o}=oe(),{sendCopy:l}=I(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Ge.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${me.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(me.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ia(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const _a=()=>{let{updateCellConfig:e}=pe(),{saveCellConfig:t}=I();return(0,ne.useCallback)(async()=>{let n=new Ze,o=he(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=fe.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Aa=W();function qe(){let e=(0,Aa.c)(4),{openConfirm:t}=oe(),n=D(ct),{sendRestart:o}=I(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({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)(Gt,{onClick:async()=>{n({state:rt.CLOSING}),await o(),ea()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Sa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var se,re;let e=(0,Sa.c)(40),t=oa(),{openModal:n,closeModal:o}=oe(),{toggleApplication:l}=Qe(),{selectedPanel:r}=tt(),[s]=Oe(ze),i=ee(Ft),d=_a(),[p]=st(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=pe(),k=qe(),b=aa(),j=Wa(t),v=D(Te),A=D(it),z=D(lt),{exportAsMarkdown:Y,readCode:S,saveCellConfig:F,updateCellOutputs:G}=I(),J=ee(Xe),K=ee(et),{selectedLayout:X}=be(),{setLayoutView:Z}=xe(),T=Ee(),Q=la(),H=((se=p.sharing)==null?void 0:se.html)??!0,L=((re=p.sharing)==null?void 0:re.wasm)??!0,q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q=ce("server_side_pdf_export"),e[0]=q):q=e[0];let le=q,R=le||s.mode==="present",Re=Ga,V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=(0,a.jsx)(At,{size:14,strokeWidth:1.5}),e[1]=V):V=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(we,{size:14,strokeWidth:1.5}),e[2]=O):O=e[2];let M;e[3]===t?M=e[4]:(M=async()=>{if(!t){ie();return}await ge({filename:t,includeCode:!0})},e[3]=t,e[4]=M);let B;return e[5]!==u||e[6]!==K||e[7]!==m||e[8]!==o||e[9]!==f||e[10]!==j||e[11]!==y||e[12]!==Y||e[13]!==t||e[14]!==J||e[15]!==d||e[16]!==i||e[17]!==n||e[18]!==R||e[19]!==S||e[20]!==k||e[21]!==b||e[22]!==F||e[23]!==X||e[24]!==r||e[25]!==v||e[26]!==z||e[27]!==Z||e[28]!==A||e[29]!==H||e[30]!==L||e[31]!==M||e[32]!==Q||e[33]!==l||e[34]!==T||e[35]!==g||e[36]!==w||e[37]!==G||e[38]!==s.mode?(B=[{icon:V,label:"Download",handle:E,dropdown:[{icon:O,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(we,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ie();return}await ge({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(na,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await Y({download:!1});Ce(new Blob([c],{type:"text/plain"}),ve.toMarkdown(document.title))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await S();Ce(new Blob([c.contents],{type:"text/plain"}),ve.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:Fa},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:!R,tooltip:R?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:async()=>{if(le){if(!t){ie();return}await jt("Downloading PDF...",async N=>{await sa({takeScreenshots:()=>Q({progress:N}),updateCellOutputs:G}),await vt({filename:t,webpdf:!1})});return}let c=new Event("export-beforeprint"),x=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout(Ya,0),setTimeout(()=>window.dispatchEvent(x),0)})()}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!H&&!L,dropdown:[{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!H,handle:async()=>{n((0,a.jsx)(ka,{onClose:o}))}},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!L,handle:async()=>{await U(ta({code:(await S()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:Ke.flatMap(c=>{let{type:x,Icon:N,hidden:Ve}=c;return Ve?[]:{label:ue(x),rightElement:Re(r===x),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),handle:()=>l(x)}})},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{T()}},...We.map((c,x)=>{let N=He(c);return{divider:x===0,label:Le(c),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:X===c&&(0,a.jsx)(je,{size:14})}),handle:()=>{Z(c),s.mode==="edit"&&T()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ke(),handle:j},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await U((await S()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!J||i,handle:async()=>{let c=at(he());await F({configs:fe.fromEntries(c.map($a))});for(let x of c)w({cellId:x,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Se,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(nt,{onClose:o}))}},{icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!K||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{b()}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ba)},{icon:(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A(Oa),redundant:!0},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ra},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:qa},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:La},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ta},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ea}].filter(Ia).map(Da),e[5]=u,e[6]=K,e[7]=m,e[8]=o,e[9]=f,e[10]=j,e[11]=y,e[12]=Y,e[13]=t,e[14]=J,e[15]=d,e[16]=i,e[17]=n,e[18]=R,e[19]=S,e[20]=k,e[21]=b,e[22]=F,e[23]=X,e[24]=r,e[25]=v,e[26]=z,e[27]=Z,e[28]=A,e[29]=H,e[30]=L,e[31]=M,e[32]=Q,e[33]=l,e[34]=T,e[35]=g,e[36]=w,e[37]=G,e[38]=s.mode,e[39]=B):B=e[39],B}function Da(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Pa)}:e}function Pa(e){return!e.hidden}function Ia(e){return!e.hidden}function Ea(){let e=dt();window.open(e,"_blank")}function Ta(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function La(){window.open(_.youtube,"_blank")}function qa(){window.open(_.discordLink,"_blank")}function Ra(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Oa(e){return!e}function Ba(e){return!e}function Ua(e){return!e}function $a(e){return[e,{disabled:!1}]}function Ya(){return window.print()}async function Fa(){let e=document.getElementById("App");e&&await Ct({element:e,filename:document.title,prepare:zt})}function Ga(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(je,{size:14})})}function ie(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ee as a,Se as c,Te as i,Ae as l,qe as n,Pe as o,va as r,Ne as s,Na as t,_e as u};
1
+ import{s as de}from"./chunk-LvLJmgfZ.js";import{d as D,l as Oe,p as Be,u as ee}from"./useEvent-DO6uJBas.js";import{t as Ue}from"./react-BGmjiNul.js";import{$n as $e,Gn as Ye,Jn as Fe,Rt as Ge,Un as Je,ai as te,dn as Ke,g as Xe,hn as ce,jt as Ze,ln as Qe,m as he,t as et,un as tt,w as pe,yr as at,zt as me}from"./cells-BW_4R0Qw.js";import{t as W}from"./compiler-runtime-DeeZ7FnK.js";import{n as ot}from"./assertNever-CBU83Y6o.js";import{s as ue}from"./useLifecycle-D35CBukS.js";import{n as nt}from"./add-database-form-_pTLtiHN.js";import{n as it,x as lt}from"./ai-model-dropdown-CJGHNqP_.js";import{a as fe,d as P}from"./hotkeys-BHHWjLlp.js";import{y as st}from"./utils-DXvhzCGS.js";import{n as _,t as ye}from"./constants-B6Cb__3x.js";import{A as rt,f as dt,j as ke,w as ct}from"./config-CIrPQIbt.js";import{t as ht}from"./jsx-runtime-ZmTK25f3.js";import{r as pt,t as ae}from"./button-YC1gW_kJ.js";import{r as I}from"./requests-BsVD4CdD.js";import{t as h}from"./createLucideIcon-CnW3RofX.js";import{a as be,f as mt,i as xe,m as ut,p as we,u as ge}from"./layout-KY92f2Sm.js";import{t as je}from"./check-DdfN0k2d.js";import{a as ft,c as yt,i as kt,n as bt,r as xt,s as wt,t as gt}from"./select-V5IdpNiR.js";import{c as jt,d as ve,n as vt,o as Ct,r as Ce,t as zt}from"./download-Bwa9P-Pz.js";import{f as Mt}from"./maps-t9yNKYA8.js";import{r as Wt}from"./useCellActionButton-DwRoApVS.js";import{t as _t}from"./copy-CQ15EONK.js";import{t as At}from"./download-B9SUL40m.js";import{t as St}from"./eye-off-BhExYOph.js";import{t as Nt}from"./file-plus-corner-Da9I6dgU.js";import{t as Dt}from"./file-Cs1JbsV6.js";import{i as Pt,n as It,r as Et,t as Tt}from"./youtube-8p26v8EM.js";import{n as Ht,t as Lt}from"./house-DhFkiXz7.js";import{n as qt}from"./play-BPIh-ZEU.js";import{t as Rt}from"./link-BsTPF7B0.js";import{r as Vt}from"./input-pAun1m1X.js";import{t as Ot}from"./settings-DOXWMfVd.js";import{y as Bt}from"./textarea-DSR2T2ft.js";import{t as Ut}from"./square-C8Tw_XXG.js";import{t as C}from"./use-toast-rmUWldD_.js";import{t as $t}from"./tooltip-CEc2ajau.js";import{a as ze,i as Yt,r as Ft}from"./mode-BCr7l3Th.js";import{o as Gt}from"./alert-dialog-DwQffb13.js";import{a as Jt,c as Kt,i as Xt,n as Zt,r as Qt}from"./dialog-CxGKN4C_.js";import{n as oe}from"./ImperativeModal-CUbWEBci.js";import{r as ea,t as ta}from"./share-CbPtIlnM.js";import{t as U}from"./copy-Bv2DBpIS.js";import{r as aa}from"./useRunCells-C50mliNM.js";import{a as oa}from"./cell-link-_-mIiddP.js";import{a as Me}from"./renderShortcut-DEwfrKeS.js";import{t as na}from"./icons-BhEXrzsb.js";import{t as ia}from"./links-C-GGaW8R.js";import{r as la,t as sa}from"./hooks-B1nUQK2T.js";import{t as We}from"./types-z6Sk3JCV.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),_e=h("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"}]]),Ae=h("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"}]]),Se=h("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"}]]),ca=h("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"}]]),ha=h("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=h("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"}]]),Ne=h("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"}]]),ma=h("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"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),De=h("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"}]]),fa=h("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"}]]),ya=h("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"}]]),Pe=h("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"}]]),Ie=W(),ne=de(Ue(),1),a=de(ht(),1),$="https://static.marimo.app";const ka=e=>{let t=(0,Ie.c)(25),{onClose:n}=e,[o,l]=(0,ne.useState)(""),{exportAsHTML:r}=I(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${$}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let A=await r({download:!1,includeCode:!0,files:mt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${$}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:s})}).catch(()=>{z.dismiss(),C({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:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({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."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Kt,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Jt,{children:[p,(0,a.jsxs)(Qt,{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:$,target:"_blank",children:$}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Vt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===i?u=t[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)(ba,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=u);let f;t[11]!==m||t[12]!==u?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,u]}),t[11]=m,t[12]=u,t[13]=f):f=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(ae,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let k;t[16]===i?k=t[17]:(k=(0,a.jsx)(ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await U(i)},children:"Create"}),t[16]=i,t[17]=k);let b;t[18]!==y||t[19]!==k?(b=(0,a.jsxs)(Xt,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=b):b=t[20];let j;return t[21]!==d||t[22]!==b||t[23]!==f?(j=(0,a.jsx)(Zt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,f,b]})}),t[21]=d,t[22]=b,t[23]=f,t[24]=j):j=t[24],j};var ba=e=>{let t=(0,Ie.c)(8),[n,o]=ne.useState(!1),l;t[0]===e.text?l=t[1]:(l=pt.stopPropagation(async p=>{p.preventDefault(),await U(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ae,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)($t,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},xa=W();function wa(){let e=document.getElementsByClassName(ye.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=te.findElement(t);if(!o){P.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:te.parse(o.id)}}}return P.warn("No visible output area found for scroll anchor"),null}function ga(e){if(!e){P.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(te.create(e.cellId));if(!t){P.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${ye.outputArea}`)){P.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ee(){let e=(0,xa.c)(2),t=D(ze),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:Yt(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const Te=Be(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=be(),{setLayoutView:n}=xe();if(ke()&&!ce("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(wt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(yt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(bt,{children:(0,a.jsxs)(xt,{children:[(0,a.jsx)(ft,{children:"View as"}),We.map(za)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(gt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function Ca(e){return(0,a.jsx)(He(e),{className:"h-4 w-4"})}function He(e){switch(e){case"vertical":return ma;case"grid":return Et;case"slides":return De;default:return ot(e),Ut}}function Le(e){return ue(e)}function za(e){return(0,a.jsx)(kt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Le(e)})]})},e)}var Ma=W();function Wa(e){let t=(0,Ma.c)(5),{openPrompt:n,closeModal:o}=oe(),{sendCopy:l}=I(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Ge.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${me.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(me.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ia(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const _a=()=>{let{updateCellConfig:e}=pe(),{saveCellConfig:t}=I();return(0,ne.useCallback)(async()=>{let n=new Ze,o=he(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=fe.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Aa=W();function qe(){let e=(0,Aa.c)(4),{openConfirm:t}=oe(),n=D(ct),{sendRestart:o}=I(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({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)(Gt,{onClick:async()=>{n({state:rt.CLOSING}),await o(),ea()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Sa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var se,re;let e=(0,Sa.c)(40),t=oa(),{openModal:n,closeModal:o}=oe(),{toggleApplication:l}=Qe(),{selectedPanel:r}=tt(),[s]=Oe(ze),i=ee(Ft),d=_a(),[p]=st(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=pe(),k=qe(),b=aa(),j=Wa(t),v=D(Te),A=D(it),z=D(lt),{exportAsMarkdown:Y,readCode:S,saveCellConfig:F,updateCellOutputs:G}=I(),J=ee(Xe),K=ee(et),{selectedLayout:X}=be(),{setLayoutView:Z}=xe(),T=Ee(),Q=la(),H=((se=p.sharing)==null?void 0:se.html)??!0,L=((re=p.sharing)==null?void 0:re.wasm)??!0,q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q=ce("server_side_pdf_export"),e[0]=q):q=e[0];let le=q,R=le||s.mode==="present",Re=Ga,V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=(0,a.jsx)(At,{size:14,strokeWidth:1.5}),e[1]=V):V=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(we,{size:14,strokeWidth:1.5}),e[2]=O):O=e[2];let M;e[3]===t?M=e[4]:(M=async()=>{if(!t){ie();return}await ge({filename:t,includeCode:!0})},e[3]=t,e[4]=M);let B;return e[5]!==u||e[6]!==K||e[7]!==m||e[8]!==o||e[9]!==f||e[10]!==j||e[11]!==y||e[12]!==Y||e[13]!==t||e[14]!==J||e[15]!==d||e[16]!==i||e[17]!==n||e[18]!==R||e[19]!==S||e[20]!==k||e[21]!==b||e[22]!==F||e[23]!==X||e[24]!==r||e[25]!==v||e[26]!==z||e[27]!==Z||e[28]!==A||e[29]!==H||e[30]!==L||e[31]!==M||e[32]!==Q||e[33]!==l||e[34]!==T||e[35]!==g||e[36]!==w||e[37]!==G||e[38]!==s.mode?(B=[{icon:V,label:"Download",handle:E,dropdown:[{icon:O,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(we,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ie();return}await ge({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(na,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await Y({download:!1});Ce(new Blob([c],{type:"text/plain"}),ve.toMarkdown(document.title))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await S();Ce(new Blob([c.contents],{type:"text/plain"}),ve.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:Fa},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:!R,tooltip:R?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:async()=>{if(le){if(!t){ie();return}await jt("Downloading PDF...",async N=>{await sa({takeScreenshots:()=>Q({progress:N}),updateCellOutputs:G}),await vt({filename:t,webpdf:!1})});return}let c=new Event("export-beforeprint"),x=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout(Ya,0),setTimeout(()=>window.dispatchEvent(x),0)})()}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!H&&!L,dropdown:[{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!H,handle:async()=>{n((0,a.jsx)(ka,{onClose:o}))}},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!L,handle:async()=>{await U(ta({code:(await S()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:Ke.flatMap(c=>{let{type:x,Icon:N,hidden:Ve}=c;return Ve?[]:{label:ue(x),rightElement:Re(r===x),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),handle:()=>l(x)}})},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{T()}},...We.map((c,x)=>{let N=He(c);return{divider:x===0,label:Le(c),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:X===c&&(0,a.jsx)(je,{size:14})}),handle:()=>{Z(c),s.mode==="edit"&&T()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ke(),handle:j},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await U((await S()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!J||i,handle:async()=>{let c=at(he());await F({configs:fe.fromEntries(c.map($a))});for(let x of c)w({cellId:x,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Se,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(nt,{onClose:o}))}},{icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!K||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{b()}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ba)},{icon:(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A(Oa),redundant:!0},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ra},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:qa},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:La},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ta},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ea}].filter(Ia).map(Da),e[5]=u,e[6]=K,e[7]=m,e[8]=o,e[9]=f,e[10]=j,e[11]=y,e[12]=Y,e[13]=t,e[14]=J,e[15]=d,e[16]=i,e[17]=n,e[18]=R,e[19]=S,e[20]=k,e[21]=b,e[22]=F,e[23]=X,e[24]=r,e[25]=v,e[26]=z,e[27]=Z,e[28]=A,e[29]=H,e[30]=L,e[31]=M,e[32]=Q,e[33]=l,e[34]=T,e[35]=g,e[36]=w,e[37]=G,e[38]=s.mode,e[39]=B):B=e[39],B}function Da(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Pa)}:e}function Pa(e){return!e.hidden}function Ia(e){return!e.hidden}function Ea(){let e=dt();window.open(e,"_blank")}function Ta(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function La(){window.open(_.youtube,"_blank")}function qa(){window.open(_.discordLink,"_blank")}function Ra(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Oa(e){return!e}function Ba(e){return!e}function Ua(e){return!e}function $a(e){return[e,{disabled:!1}]}function Ya(){return window.print()}async function Fa(){let e=document.getElementById("App");e&&await Ct({element:e,filename:document.title,prepare:zt})}function Ga(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(je,{size:14})})}function ie(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ee as a,Se as c,Te as i,Ae as l,qe as n,Pe as o,va as r,Ne as s,Na as t,_e 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-DTpRqi46.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-DUcuXkRU.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-DItdS47A.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/clsx-D8GwTfvk.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/cn-BKtXLv3a.js">
@@ -167,7 +167,7 @@
167
167
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-CQd-1kjx.js">
168
168
  <link rel="modulepreload" crossorigin href="./assets/trash-2-CyqGun26.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-B65rDESJ.js">
170
- <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-BL-PaF8o.js">
170
+ <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-CJGHNqP_.js">
171
171
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-D_rSvXvJ.js">
172
172
  <link rel="modulepreload" crossorigin href="./assets/precisionRound-BMPhtTJQ.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-C92Rrpmf.js">
@@ -208,14 +208,14 @@
208
208
  <link rel="modulepreload" crossorigin href="./assets/play-BPIh-ZEU.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/chat-components-ZGfi_TyH.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/isEmpty-CgX_-6Mt.js">
211
- <link rel="modulepreload" crossorigin href="./assets/chat-display-B34MaCGM.js">
211
+ <link rel="modulepreload" crossorigin href="./assets/chat-display-CO27_lED.js">
212
212
  <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-CR3IczUk.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/icons-BhEXrzsb.js">
214
214
  <link rel="modulepreload" crossorigin href="./assets/process-output-TMO5uCHT.js">
215
215
  <link rel="modulepreload" crossorigin href="./assets/blob-CuXvdYPX.js">
216
216
  <link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-DaPAPabU.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/esm-DpMp6qko.js">
218
- <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-DT1ae2MK.js">
218
+ <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-noZuPKY2.js">
219
219
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-W42b2ZIs.js">
220
220
  <link rel="modulepreload" crossorigin href="./assets/square-function-CqXXKtIq.js">
221
221
  <link rel="modulepreload" crossorigin href="./assets/spec-D1kBp3jX.js">
@@ -253,7 +253,7 @@
253
253
  <link rel="stylesheet" crossorigin href="./assets/cells-jmgGt1lS.css">
254
254
  <link rel="stylesheet" crossorigin href="./assets/markdown-renderer-DdDKmWlR.css">
255
255
  <link rel="stylesheet" crossorigin href="./assets/JsonOutput-B7vuddcd.css">
256
- <link rel="stylesheet" crossorigin href="./assets/index-Bj5F80Z9.css">
256
+ <link rel="stylesheet" crossorigin href="./assets/index-CikhHYAB.css">
257
257
  </head>
258
258
  <body>
259
259
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.19.7-dev37",
3
+ "version": "0.19.7-dev39",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -213,7 +213,7 @@
213
213
  "devDependencies": {
214
214
  "@babel/plugin-proposal-decorators": "^7.28.0",
215
215
  "@babel/preset-typescript": "^7.25.9",
216
- "@biomejs/biome": "2.3.10",
216
+ "@biomejs/biome": "2.3.12",
217
217
  "@codecov/vite-plugin": "^1.9.1",
218
218
  "@csstools/postcss-light-dark-function": "^2.0.11",
219
219
  "@playwright/test": "^1.57.0",
@@ -5,6 +5,7 @@ import {
5
5
  BotIcon,
6
6
  BrainIcon,
7
7
  ChevronRightIcon,
8
+ InfoIcon,
8
9
  PlusIcon,
9
10
  Trash2Icon,
10
11
  } from "lucide-react";
@@ -61,6 +62,7 @@ import {
61
62
  } from "../ui/accordion";
62
63
  import { Button } from "../ui/button";
63
64
  import { Checkbox } from "../ui/checkbox";
65
+ import { DropdownMenuSeparator } from "../ui/dropdown-menu";
64
66
  import { Label } from "../ui/label";
65
67
  import { ExternalLink } from "../ui/links";
66
68
  import {
@@ -272,6 +274,32 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
272
274
  placeholder={placeholder}
273
275
  onSelect={selectModel}
274
276
  triggerClassName="text-sm"
277
+ customDropdownContent={
278
+ <>
279
+ <DropdownMenuSeparator />
280
+ <p className="px-2 py-1.5 text-sm text-muted-secondary flex items-center gap-1">
281
+ Enter a custom model
282
+ <Tooltip content="Models should include the provider prefix, e.g. 'openai/gpt-4o'">
283
+ <InfoIcon className="h-3 w-3" />
284
+ </Tooltip>
285
+ </p>
286
+ <div className="px-2 py-1">
287
+ <Input
288
+ className="w-full border-border shadow-none focus-visible:shadow-xs"
289
+ placeholder={placeholder}
290
+ {...field}
291
+ value={asStringOrEmpty(field.value)}
292
+ onKeyDown={Events.stopPropagation()}
293
+ />
294
+ {value && (
295
+ <IncorrectModelId
296
+ value={value}
297
+ includeSuggestion={false}
298
+ />
299
+ )}
300
+ </div>
301
+ </>
302
+ }
275
303
  forRole={forRole}
276
304
  />
277
305
  </FormControl>
@@ -433,7 +433,7 @@ const ChatPanel = () => {
433
433
  return (
434
434
  <PanelEmptyState
435
435
  title="Chat with AI"
436
- description="No AI provider configured or model selected"
436
+ description="No AI provider configured or Chat model not selected"
437
437
  action={
438
438
  <Button
439
439
  variant="outline"
@@ -272,6 +272,7 @@ export const AddCellWithAI: React.FC<{
272
272
  triggerClassName="h-7 text-xs max-w-64"
273
273
  iconSize="small"
274
274
  forRole="edit"
275
+ showAddCustomModelDocs={true}
275
276
  />
276
277
  </div>
277
278
  </div>
@@ -363,6 +363,7 @@ export const AiCompletionEditor: React.FC<Props> = ({
363
363
  iconSize="small"
364
364
  forRole="edit"
365
365
  displayIconOnly={true}
366
+ placeholder="Edit model"
366
367
  />
367
368
  </div>
368
369
  {completion && (
@@ -13,6 +13,7 @@ import {
13
13
  SquareMIcon,
14
14
  } from "lucide-react";
15
15
  import { useEffect } from "react";
16
+ import { useOpenSettingsToTab } from "@/components/app-config/state";
16
17
  import { StartupLogsAlert } from "@/components/editor/alerts/startup-logs-alert";
17
18
  import { Cell } from "@/components/editor/notebook-cell";
18
19
  import { PackageAlert } from "@/components/editor/package-alert";
@@ -253,6 +254,7 @@ const AddCellButtons: React.FC<{
253
254
  const [isAiButtonOpen, isAiButtonOpenActions] = useBoolean(false);
254
255
  const aiEnabled = useAtomValue(aiEnabledAtom);
255
256
  const canInteractWithApp = useAtomValue(canInteractWithAppAtom);
257
+ const { handleClick } = useOpenSettingsToTab();
256
258
 
257
259
  const buttonClass = cn(
258
260
  "mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap",
@@ -320,7 +322,9 @@ const AddCellButtons: React.FC<{
320
322
  </Button>
321
323
  <Tooltip
322
324
  content={
323
- aiEnabled ? null : <span>Enable via settings under AI Assist</span>
325
+ aiEnabled ? null : (
326
+ <span>AI provider not found or Edit model not selected</span>
327
+ )
324
328
  }
325
329
  delayDuration={100}
326
330
  asChild={false}
@@ -329,8 +333,12 @@ const AddCellButtons: React.FC<{
329
333
  className={buttonClass}
330
334
  variant="text"
331
335
  size="sm"
332
- disabled={!aiEnabled || !canInteractWithApp}
333
- onClick={isAiButtonOpenActions.toggle}
336
+ disabled={!canInteractWithApp}
337
+ onClick={
338
+ aiEnabled
339
+ ? isAiButtonOpenActions.toggle
340
+ : () => handleClick("ai", "ai-providers")
341
+ }
334
342
  >
335
343
  <SparklesIcon className="mr-2 size-4 shrink-0" />
336
344
  Generate with AI