@marimo-team/frontend 0.20.5-dev8 → 0.20.5-dev9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{add-cell-with-ai--4VOMvH8.js → add-cell-with-ai-BUGemtjx.js} +1 -1
- package/dist/assets/{agent-panel-Dcuv6ZGc.js → agent-panel-BsLlz7EK.js} +1 -1
- package/dist/assets/{ai-model-dropdown-C3Y44M85.js → ai-model-dropdown-CB5pPJ9U.js} +4 -4
- package/dist/assets/{app-config-button-bnipxY5L.js → app-config-button-CTufn6Cn.js} +1 -1
- package/dist/assets/{cell-editor-BYvliobE.js → cell-editor-DxuD0g8M.js} +1 -1
- package/dist/assets/{chat-display-Co6iGNSx.js → chat-display-Bwj4Pf6B.js} +1 -1
- package/dist/assets/{chat-panel-70sjqZuy.js → chat-panel-B9GyIE5v.js} +1 -1
- package/dist/assets/{command-palette-CSEjt4e_.js → command-palette-Dx0LcVhf.js} +1 -1
- package/dist/assets/{edit-page-goj7Ea_b.js → edit-page-CMo5s4xu.js} +3 -3
- package/dist/assets/{home-page-BXQp6S6h.js → home-page-BSTRjXoo.js} +1 -1
- package/dist/assets/{index-Dt_vPSmJ.js → index-DHreJ2o9.js} +3 -3
- package/dist/assets/{packages-panel-D8d46YWc.js → packages-panel-DiNDt_4S.js} +1 -1
- package/dist/assets/{scratchpad-panel-B3K7MZ0B.js → scratchpad-panel-DOwj7z6O.js} +1 -1
- package/dist/assets/{useNotebookActions-uvZlYyaW.js → useNotebookActions-CH_6dTI-.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/src/components/app-config/ai-config.tsx +10 -0
- package/src/components/ui/links.tsx +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-WUlsM6MC.js";import{t as le}from"./react-Bj1aDYRI.js";import{dr as V}from"./cells-CCtxWKxf.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-C3Y44M85.js";import{y as de}from"./utils-CORJ8yYa.js";import{S as me}from"./config-D9X9QKiL.js";import{t as pe}from"./jsx-runtime-CP2fAiZX.js";import{r as xe}from"./button-BmOH9agK.js";import{t as K}from"./cn-d_A4rA-x.js";import"./dist-DUY6xZX8.js";import"./cjs-CVt8hZ5L.js";import"./main-Cmx6WhDY.js";import"./useNonce-BY4jV7Yb.js";import{r as W}from"./requests-DZy_SQ_v.js";import{r as ue}from"./x-yqLqiq5Q.js";import{t as fe}from"./chevron-right-_z3dkNFy.js";import{u as ge}from"./toDate-DDAiY7kz.js";import{t as R}from"./spinner-DCSoZZhh.js";import{a as he}from"./input-BPldEXfy.js";import"./dist-DfBASypd.js";import"./dist-Dq_iQ08e.js";import"./dist-BjtLy-VA.js";import"./dist-odxAaH5Z.js";import"./dist-51xFOPFs.js";import{t as ve}from"./use-toast-BhMe50aT.js";import"./session-DnMOyddG.js";import"./Combination-tjZP3FH6.js";import{t as J}from"./tooltip-DOQlecCr.js";import"./purify.es-CPplrWRQ.js";import"./popover-Cvl9xY6R.js";import{t as je}from"./copy-DMCkK2TI.js";import{i as be,n as F,r as Q,s as X,t as ke}from"./useInstallPackage-jGxNsOWc.js";import{n as Y}from"./error-banner-R2OkQKR0.js";import{n as ye}from"./useAsyncData-DVm0BCFt.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-FXVKPW36.js";import{t as ee}from"./empty-state-DFr2pZOz.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let s of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(s.toLowerCase()))return e.slice(s.length).trim();return e}var r=H(pe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:i,className:p}=t;if(n){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=l):l=e[0],l}let c;e[1]===p?c=e[2]:(c=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",p),e[1]=p,e[2]=c);let a;e[3]===s?a=e[4]:(a=xe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==i||e[6]!==c||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:c,onClick:a,children:i}),e[5]=i,e[6]=c,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),s=e.package_management.manager,{getDependencyTree:n,getPackageList:i}=W(),[p,c]=I.useState(null),a;t[0]!==n||t[1]!==i?(a=async()=>{let[u,C]=await Promise.all([i(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:l,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,r.jsx)(Y,{error:m}),t[6]=m,t[7]=u),u}let h=l.tree!=null,d;t[8]!==h||t[9]!==p?(d=De(p,h),t[8]=h,t[9]=p,t[10]=d):d=t[10];let f=d,x=(w=l.tree)==null?void 0:w.name,P=(S=l==null?void 0:l.tree)==null?void 0:S.version,y=x==="<root>",k;t[11]!==s||t[12]!==j?(k=(0,r.jsx)(Pe,{packageManager:s,onSuccess:j}),t[11]=s,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==x||t[17]!==P||t[18]!==f?(b=h&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("list"),children:"List"}),(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("tree"),children:"Tree"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),x&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[x,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=x,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==l.list||t[21]!==l.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:l.list,onSuccess:j}):(0,r.jsx)($e,{tree:l.tree,error:m,onSuccess:j}),t[20]=l.list,t[21]=l.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:s,packageManager:n}=t,[i,p]=I.useState(""),{handleClick:c}=ce(),a=oe(X),o=ae(X),l,m;e[0]!==a||e[1]!==o?(l=()=>{a&&(p(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=l,e[3]=m):(l=e[2],m=e[3]),I.useEffect(l,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),p("")},e[4]=s,e[5]=h);let d=h,f;e[6]!==g||e[7]!==i||e[8]!==d?(f=()=>{g([_e(i)],d)},e[6]=g,e[7]=i,e[8]=d,e[9]=f):f=e[9];let x=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==c?(y=j?(0,r.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,r.jsx)(J,{content:"Change package manager",children:(0,r.jsx)(V,{onClick:()=>c("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=c,e[12]=y):y=e[12];let k;e[13]===x?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),x())},e[13]=x,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>p(U.target.value),e[15]=b):b=e[15];let v;e[16]!==i||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,r.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:i,onKeyDown:k,onChange:b}),e[16]=i,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsxs)("div",{children:[C," A Git repository",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,r.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,r.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,r.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=i&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!i,M;e[33]!==x||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:x,disabled:z,children:"Add"}),e[33]=x,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,r.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:s,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,r.jsx)(V,{})}),e[0]=a):a=e[0],a}let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(Ne,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(q,{children:"Name"}),(0,r.jsx)(q,{children:"Version"}),(0,r.jsx)(q,{})]})}),e[1]=i):i=e[1];let p;if(e[2]!==s||e[3]!==n){let a;e[5]===s?a=e[6]:(a=o=>(0,r.jsxs)(Z,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,r.jsx)(B,{children:o.name}),(0,r.jsx)(B,{children:o.version}),(0,r.jsxs)(B,{className:"flex justify-end",children:[(0,r.jsx)(re,{packageName:o.name,onSuccess:s}),(0,r.jsx)(se,{packageName:o.name,onSuccess:s})]})]},o.name),e[5]=s,e[6]=a),p=n.map(a),e[2]=s,e[3]=n,e[4]=p}else p=e[4];let c;return e[7]===p?c=e[8]:(c=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[i,(0,r.jsx)(we,{children:p})]}),e[7]=p,e[8]=c),c},re=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{addPackage:p}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,upgrade:!0,group:a});o.success?(s(),Q(t)):Q(t,o.error)}finally{i(!1)}},loading:n,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{removePackage:p}=W();return(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,group:a});o.success?(s(),F(t)):F(t,o.error)}finally{i(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:i}=t,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];let[c,a]=I.useState(p),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let l;if(e[2]===s?l=e[3]:(l=[s],e[2]=s,e[3]=l),I.useEffect(o,l),n){let d;return e[4]===n?d=e[5]:(d=(0,r.jsx)(Y,{error:n}),e[4]=n,e[5]=d),d}if(!s){let d;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=d):d=e[6],d}if(s.dependencies.length===0){let d;return e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=d):d=e[7],d}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{a(f=>{let x=new Set(f);return x.has(d)?x.delete(d):x.add(d),x})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==c||e[10]!==i||e[11]!==s.dependencies){let d;e[13]!==c||e[14]!==i?(d=(f,x)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${x}`,node:f,level:0,isTopLevel:!0,expandedNodes:c,onToggle:j,onSuccess:i})},`${f.name}-${x}`),e[13]=c,e[14]=i,e[15]=d):d=e[15],g=s.dependencies.map(d),e[9]=c,e[10]=i,e[11]=s.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:s,node:n,level:i,isTopLevel:p,expandedNodes:c,onToggle:a,onSuccess:o}=t,l=p===void 0?!1:p,m=n.dependencies.length>0,j;e[0]!==c||e[1]!==s?(j=c.has(s),e[0]=c,e[1]=s,e[2]=j):j=e[2];let g=j,h=l?0:16+i*16,d;e[3]!==m||e[4]!==s||e[5]!==a?(d=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=d):d=e[6];let f=d,x;e[7]!==m||e[8]!==s||e[9]!==a?(x=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=x):x=e[10];let P=x,y=m&&"select-none",k=l?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==l?(v=l?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=l,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,r.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,r.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,r.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,r.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==l||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=l&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=l,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,r.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==c||e[47]!==m||e[48]!==g||e[49]!==i||e[50]!==n.dependencies||e[51]!==s||e[52]!==o||e[53]!==a?(A=m&&g&&(0,r.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,r.jsx)(ne,{nodeId:`${s}-${z}`,node:N,level:i+1,isTopLevel:!1,expandedNodes:c,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=c,e[47]=m,e[48]=g,e[49]=i,e[50]=n.dependencies,e[51]=s,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,r.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
|
|
1
|
+
import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-WUlsM6MC.js";import{t as le}from"./react-Bj1aDYRI.js";import{dr as V}from"./cells-CCtxWKxf.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-CB5pPJ9U.js";import{y as de}from"./utils-CORJ8yYa.js";import{S as me}from"./config-D9X9QKiL.js";import{t as pe}from"./jsx-runtime-CP2fAiZX.js";import{r as xe}from"./button-BmOH9agK.js";import{t as K}from"./cn-d_A4rA-x.js";import"./dist-DUY6xZX8.js";import"./cjs-CVt8hZ5L.js";import"./main-Cmx6WhDY.js";import"./useNonce-BY4jV7Yb.js";import{r as W}from"./requests-DZy_SQ_v.js";import{r as ue}from"./x-yqLqiq5Q.js";import{t as fe}from"./chevron-right-_z3dkNFy.js";import{u as ge}from"./toDate-DDAiY7kz.js";import{t as R}from"./spinner-DCSoZZhh.js";import{a as he}from"./input-BPldEXfy.js";import"./dist-DfBASypd.js";import"./dist-Dq_iQ08e.js";import"./dist-BjtLy-VA.js";import"./dist-odxAaH5Z.js";import"./dist-51xFOPFs.js";import{t as ve}from"./use-toast-BhMe50aT.js";import"./session-DnMOyddG.js";import"./Combination-tjZP3FH6.js";import{t as J}from"./tooltip-DOQlecCr.js";import"./purify.es-CPplrWRQ.js";import"./popover-Cvl9xY6R.js";import{t as je}from"./copy-DMCkK2TI.js";import{i as be,n as F,r as Q,s as X,t as ke}from"./useInstallPackage-jGxNsOWc.js";import{n as Y}from"./error-banner-R2OkQKR0.js";import{n as ye}from"./useAsyncData-DVm0BCFt.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-FXVKPW36.js";import{t as ee}from"./empty-state-DFr2pZOz.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let s of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(s.toLowerCase()))return e.slice(s.length).trim();return e}var r=H(pe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:i,className:p}=t;if(n){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=l):l=e[0],l}let c;e[1]===p?c=e[2]:(c=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",p),e[1]=p,e[2]=c);let a;e[3]===s?a=e[4]:(a=xe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==i||e[6]!==c||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:c,onClick:a,children:i}),e[5]=i,e[6]=c,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),s=e.package_management.manager,{getDependencyTree:n,getPackageList:i}=W(),[p,c]=I.useState(null),a;t[0]!==n||t[1]!==i?(a=async()=>{let[u,C]=await Promise.all([i(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:l,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,r.jsx)(Y,{error:m}),t[6]=m,t[7]=u),u}let h=l.tree!=null,d;t[8]!==h||t[9]!==p?(d=De(p,h),t[8]=h,t[9]=p,t[10]=d):d=t[10];let f=d,x=(w=l.tree)==null?void 0:w.name,P=(S=l==null?void 0:l.tree)==null?void 0:S.version,y=x==="<root>",k;t[11]!==s||t[12]!==j?(k=(0,r.jsx)(Pe,{packageManager:s,onSuccess:j}),t[11]=s,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==x||t[17]!==P||t[18]!==f?(b=h&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("list"),children:"List"}),(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>c("tree"),children:"Tree"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),x&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[x,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=x,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==l.list||t[21]!==l.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:l.list,onSuccess:j}):(0,r.jsx)($e,{tree:l.tree,error:m,onSuccess:j}),t[20]=l.list,t[21]=l.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:s,packageManager:n}=t,[i,p]=I.useState(""),{handleClick:c}=ce(),a=oe(X),o=ae(X),l,m;e[0]!==a||e[1]!==o?(l=()=>{a&&(p(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=l,e[3]=m):(l=e[2],m=e[3]),I.useEffect(l,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),p("")},e[4]=s,e[5]=h);let d=h,f;e[6]!==g||e[7]!==i||e[8]!==d?(f=()=>{g([_e(i)],d)},e[6]=g,e[7]=i,e[8]=d,e[9]=f):f=e[9];let x=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==c?(y=j?(0,r.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,r.jsx)(J,{content:"Change package manager",children:(0,r.jsx)(V,{onClick:()=>c("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=c,e[12]=y):y=e[12];let k;e[13]===x?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),x())},e[13]=x,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>p(U.target.value),e[15]=b):b=e[15];let v;e[16]!==i||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,r.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:i,onKeyDown:k,onChange:b}),e[16]=i,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsxs)("div",{children:[C," A Git repository",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,r.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,r.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,r.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=i&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!i,M;e[33]!==x||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:x,disabled:z,children:"Add"}),e[33]=x,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,r.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:s,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,r.jsx)(V,{})}),e[0]=a):a=e[0],a}let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(Ne,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(q,{children:"Name"}),(0,r.jsx)(q,{children:"Version"}),(0,r.jsx)(q,{})]})}),e[1]=i):i=e[1];let p;if(e[2]!==s||e[3]!==n){let a;e[5]===s?a=e[6]:(a=o=>(0,r.jsxs)(Z,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,r.jsx)(B,{children:o.name}),(0,r.jsx)(B,{children:o.version}),(0,r.jsxs)(B,{className:"flex justify-end",children:[(0,r.jsx)(re,{packageName:o.name,onSuccess:s}),(0,r.jsx)(se,{packageName:o.name,onSuccess:s})]})]},o.name),e[5]=s,e[6]=a),p=n.map(a),e[2]=s,e[3]=n,e[4]=p}else p=e[4];let c;return e[7]===p?c=e[8]:(c=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[i,(0,r.jsx)(we,{children:p})]}),e[7]=p,e[8]=c),c},re=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{addPackage:p}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,upgrade:!0,group:a});o.success?(s(),Q(t)):Q(t,o.error)}finally{i(!1)}},loading:n,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{removePackage:p}=W();return(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,group:a});o.success?(s(),F(t)):F(t,o.error)}finally{i(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:i}=t,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];let[c,a]=I.useState(p),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let l;if(e[2]===s?l=e[3]:(l=[s],e[2]=s,e[3]=l),I.useEffect(o,l),n){let d;return e[4]===n?d=e[5]:(d=(0,r.jsx)(Y,{error:n}),e[4]=n,e[5]=d),d}if(!s){let d;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=d):d=e[6],d}if(s.dependencies.length===0){let d;return e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=d):d=e[7],d}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{a(f=>{let x=new Set(f);return x.has(d)?x.delete(d):x.add(d),x})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==c||e[10]!==i||e[11]!==s.dependencies){let d;e[13]!==c||e[14]!==i?(d=(f,x)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${x}`,node:f,level:0,isTopLevel:!0,expandedNodes:c,onToggle:j,onSuccess:i})},`${f.name}-${x}`),e[13]=c,e[14]=i,e[15]=d):d=e[15],g=s.dependencies.map(d),e[9]=c,e[10]=i,e[11]=s.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:s,node:n,level:i,isTopLevel:p,expandedNodes:c,onToggle:a,onSuccess:o}=t,l=p===void 0?!1:p,m=n.dependencies.length>0,j;e[0]!==c||e[1]!==s?(j=c.has(s),e[0]=c,e[1]=s,e[2]=j):j=e[2];let g=j,h=l?0:16+i*16,d;e[3]!==m||e[4]!==s||e[5]!==a?(d=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=d):d=e[6];let f=d,x;e[7]!==m||e[8]!==s||e[9]!==a?(x=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=x):x=e[10];let P=x,y=m&&"select-none",k=l?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==l?(v=l?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=l,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,r.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,r.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,r.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,r.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==l||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=l&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=l,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,r.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==c||e[47]!==m||e[48]!==g||e[49]!==i||e[50]!==n.dependencies||e[51]!==s||e[52]!==o||e[53]!==a?(A=m&&g&&(0,r.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,r.jsx)(ne,{nodeId:`${s}-${z}`,node:N,level:i+1,isTopLevel:!1,expandedNodes:c,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=c,e[47]=m,e[48]=g,e[49]=i,e[50]=n.dependencies,e[51]=s,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,r.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as ye,l as be,n as T,p as ae,u as we}from"./useEvent-WUlsM6MC.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{P as ke,T as ze,kn as Ce,ui as Se,vi as Ae,yi as n,__tla as Oe}from"./cells-CCtxWKxf.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import"./tooltip-D_HRHf_c.js";import{h as ie}from"./useEventListener-CjXriKgk.js";import{y as Ie}from"./utils-CORJ8yYa.js";import{t as Pe}from"./constants-CdR60lKM.js";import{t as Le}from"./jsx-runtime-CP2fAiZX.js";import{t as z}from"./button-BmOH9agK.js";import{t as le}from"./cn-d_A4rA-x.js";import"./dist-DUY6xZX8.js";import{n as Me,__tla as Ee}from"./JsonOutput-BW2KjuuO.js";import"./cjs-CVt8hZ5L.js";import"./main-Cmx6WhDY.js";import"./useNonce-BY4jV7Yb.js";import{r as Re}from"./requests-DZy_SQ_v.js";import{t as me}from"./createLucideIcon-BvP5LBIs.js";import{d as De,__tla as He}from"./layout-DcfIrJXW.js";import{n as Te,t as Ve,__tla as qe}from"./LazyAnyLanguageCodeMirror-BdX_Y5NA.js";import"./download-BTm4CTKr.js";import"./markdown-renderer-B6a5ZAwT.js";import{u as Ge}from"./toDate-DDAiY7kz.js";import{t as Ue,__tla as Be}from"./cell-editor-
|
|
1
|
+
import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as ye,l as be,n as T,p as ae,u as we}from"./useEvent-WUlsM6MC.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{P as ke,T as ze,kn as Ce,ui as Se,vi as Ae,yi as n,__tla as Oe}from"./cells-CCtxWKxf.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import"./tooltip-D_HRHf_c.js";import{h as ie}from"./useEventListener-CjXriKgk.js";import{y as Ie}from"./utils-CORJ8yYa.js";import{t as Pe}from"./constants-CdR60lKM.js";import{t as Le}from"./jsx-runtime-CP2fAiZX.js";import{t as z}from"./button-BmOH9agK.js";import{t as le}from"./cn-d_A4rA-x.js";import"./dist-DUY6xZX8.js";import{n as Me,__tla as Ee}from"./JsonOutput-BW2KjuuO.js";import"./cjs-CVt8hZ5L.js";import"./main-Cmx6WhDY.js";import"./useNonce-BY4jV7Yb.js";import{r as Re}from"./requests-DZy_SQ_v.js";import{t as me}from"./createLucideIcon-BvP5LBIs.js";import{d as De,__tla as He}from"./layout-DcfIrJXW.js";import{n as Te,t as Ve,__tla as qe}from"./LazyAnyLanguageCodeMirror-BdX_Y5NA.js";import"./download-BTm4CTKr.js";import"./markdown-renderer-B6a5ZAwT.js";import{u as Ge}from"./toDate-DDAiY7kz.js";import{t as Ue,__tla as Be}from"./cell-editor-DxuD0g8M.js";import"./html-to-image-b9BimK8l.js";import{t as Fe}from"./spinner-DCSoZZhh.js";import{t as Je}from"./play-D4Tdvkms.js";import"./dist-DfBASypd.js";import"./dist-Dq_iQ08e.js";import"./dist-BjtLy-VA.js";import"./dist-odxAaH5Z.js";import"./dist-51xFOPFs.js";import"./session-DnMOyddG.js";import{r as Ke}from"./useTheme-CwdqVOYu.js";import"./Combination-tjZP3FH6.js";import{t as C}from"./tooltip-DOQlecCr.js";import"./purify.es-CPplrWRQ.js";import"./dates-CzBDvj6R.js";import"./popover-Cvl9xY6R.js";import"./vega-loader.browser-CZV6_g2i.js";import"./defaultLocale-OkOxlkkM.js";import"./defaultLocale-DK1MWd7f.js";import{__tla as Qe}from"./chunk-5FQGJX7Z-BJDu6jwt.js";import"./katex-rvFxOCU-.js";import{o as We}from"./focus-ShrwcKIv.js";import{a as Xe}from"./renderShortcut-BJEd-iA7.js";import"./esm-BQUzYly2.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-RgA6v8U3.js";import"./name-cell-input-BRHlWy2Y.js";import{n as $e,r as et}from"./panel-context-ICWm_stq.js";import{__tla as tt}from"./loro_wasm_bg-Bj93RhA2.js";import"./ws-D2eS61zr.js";import"./Inputs-DWdIc0Ie.js";import"./dist-Bq1BhBMA.js";import"./dist-Bbmd3uCi.js";import"./dist-y6DTGoUH.js";import"./dist-C-_581uo.js";import"./dist-DVh79TGS.js";import"./dist-DFv45CtW.js";import"./dist-i0ilBbwP.js";import"./dist-6QbI72oM.js";import"./dist-C30-xTdI.js";import"./esm-BTyesPLl.js";import{t as rt}from"./kiosk-mode-BBqwMND1.js";let ce,ot=Promise.all([(()=>{try{return Oe}catch{}})(),(()=>{try{return Ee}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return qe}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return Qe}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(),V=oe(Ne(),1),ue=15;const q=Se("marimo:scratchpadHistory:v1",[],Ce),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(q);s(q,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Le(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ke(),[i]=Ie(),{theme:m}=Ke(),c=(0,V.useRef)(null),G=We(),{createNewCell:U,updateCellCode:d}=ze(),{sendRunScratchpad:p}=Re(),S=$e(),B=et(),l=s.cellRuntime[n],F=l==null?void 0:l.output,A=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=ye(xe),[a,h]=be(fe),u=we(q),O;e[0]!==K||e[1]!==r||e[2]!==p?(O=()=>{p({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=p,e[3]=O):O=e[3];let f=T(O),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 Q=T(I),P;e[8]!==p||e[9]!==d?(P=()=>{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]=P):P=e[10];let W=T(P),L;e[11]!==h||e[12]!==d?(L=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]=L):L=e[13];let X=T(L),[Y,ge]=(0,V.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==a||e[17]!==m?(M=()=>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:()=>X(o),children:(0,t.jsx)(V.Suspense,{children:(0,t.jsx)(Ve,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=a,e[17]=m,e[18]=M):M=e[18];let Z=M,E;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==A?(E=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:Xe("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Je,{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:W,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:Q,children:(0,t.jsx)(Te,{size:16})})})}),(A==="running"||A==="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]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=A,e[26]=E):E=e[26];let $=E,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Ae.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]!==Y||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let y;e[45]===j?y=e[46]:(y=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=y);let b;e[47]===F?b=e[48]:(b=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:F,className:Pe.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=F,e[48]=b);let w;e[49]===J?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:J,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=J,e[50]=w);let N;e[51]!==b||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[b,w]})}),e[51]=b,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==B||e[56]!==g||e[57]!==y||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,y,N]},B)}),e[54]=S,e[55]=B,e[56]=g,e[57]=y,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as fe}from"./chunk-LvLJmgfZ.js";import{d as E,l as Ge,p as Ye,u as ie}from"./useEvent-WUlsM6MC.js";import{t as $e}from"./react-Bj1aDYRI.js";import{Cn as Ke,En as Je,Gt as Xe,Nr as Ze,Sn as Qe,T as ye,_ as et,ar as tt,cr as at,dt as ke,h as be,lt as ot,pr as nt,pt as it,rr as st,t as lt,ut as rt,vi as se,xn as dt}from"./cells-CCtxWKxf.js";import{t as S}from"./compiler-runtime-B3qBwwSJ.js";import{n as ct}from"./assertNever-Dw9aFN4h.js";import{s as xe}from"./useLifecycle-BDXC6oVR.js";import{a as ht,n as we}from"./add-connection-dialog-9CzjZlY9.js";import{n as pt,x as mt}from"./ai-model-dropdown-C3Y44M85.js";import{c as ge,m as I}from"./useEventListener-CjXriKgk.js";import{y as ut}from"./utils-CORJ8yYa.js";import{n as _,t as je}from"./constants-CdR60lKM.js";import{S as le,h as ft,x as yt}from"./config-D9X9QKiL.js";import{t as kt}from"./jsx-runtime-CP2fAiZX.js";import{r as bt,t as re}from"./button-BmOH9agK.js";import{r as L}from"./requests-DZy_SQ_v.js";import{t as h}from"./createLucideIcon-BvP5LBIs.js";import{a as ve,f as xt,i as Ce,m as wt,p as ze,u as We}from"./layout-DcfIrJXW.js";import{t as Me}from"./check-BnZGcuDh.js";import{c as gt,d as Se,n as jt,o as vt,r as _e,t as Ct}from"./download-BTm4CTKr.js";import{f as zt}from"./maps-8VTEe-0T.js";import{r as Wt}from"./useCellActionButton-DFgACqVf.js";import{t as Mt}from"./copy-CAR4dOiD.js";import{t as St}from"./download-BG-iMGgV.js";import{t as _t}from"./eye-off-DgTL09j7.js";import{t as Dt}from"./file-plus-corner-BRwJx0yp.js";import{t as Y}from"./file-DVwc11C3.js";import{t as At}from"./github-BrsjF9dp.js";import{m as Nt}from"./form-B7_NRa34.js";import{n as Pt,r as Et,t as It}from"./youtube-fKFch587.js";import{n as Lt,t as Tt}from"./square-oV8Csj8Y.js";import{i as Ht}from"./html-to-image-b9BimK8l.js";import{t as qt}from"./link-Cpo6yhBB.js";import{r as Rt}from"./input-BPldEXfy.js";import{t as Vt}from"./settings-DD8FJvQ_.js";import{x as Ft}from"./azure-Ddr1pZpW.js";import{t as C}from"./use-toast-BhMe50aT.js";import{n as De,t as Ot}from"./paths-bMgYkaP2.js";import{o as Ut}from"./session-DnMOyddG.js";import{a as Bt,c as Gt,i as Yt,n as $t,r as Kt,s as Jt,t as Xt}from"./select-DygbgNTD.js";import{t as Zt}from"./tooltip-DOQlecCr.js";import{o as Qt}from"./alert-dialog-DsNfSYaw.js";import{a as ea,c as ta,i as aa,n as oa,r as na}from"./dialog-BXzvlof-.js";import{n as de}from"./ImperativeModal-CRNJOvqT.js";import{r as ia,t as sa}from"./share-sD4fbzpH.js";import{t as $}from"./copy-DMCkK2TI.js";import{a as la}from"./cell-link-B59Kn5nL.js";import{a as ra}from"./renderShortcut-BJEd-iA7.js";import{t as da}from"./icons-B9sHgc9n.js";import{t as ca}from"./links-syPBpTLO.js";import{r as ha,t as pa}from"./hooks-BllYlfDO.js";import{t as Ae}from"./types-Myu7G9iV.js";var ma=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ua=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ne=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"}]]),Pe=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"}]]),Ee=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"}]]),fa=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"}]]),ya=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"}]]),ka=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"}]]),Ie=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"}]]),ba=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"}]]),xa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Le=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"}]]),wa=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"}]]),ga=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"}]]),Te=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"}]]),He=S(),ce=fe($e(),1),a=fe(kt(),1),K="https://static.marimo.app";const ja=e=>{let t=(0,He.c)(25),{onClose:n}=e,[o,s]=(0,ce.useState)(""),{exportAsHTML:r}=L(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${K}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let A=await r({download:!1,includeCode:!0,files:xt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${K}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:l})}).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]=l,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(ta,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(ea,{children:[p,(0,a.jsxs)(na,{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:K,target:"_blank",children:K}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Rt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(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)(va,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(re,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(re,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await $(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(aa,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(oa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var va=e=>{let t=(0,He.c)(8),[n,o]=ce.useState(!1),s;t[0]===e.text?s=t[1]:(s=bt.stopPropagation(async p=>{p.preventDefault(),await $(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(re,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Zt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Ca=S();function za(){let e=document.getElementsByClassName(je.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=se.findElement(t);if(!o){I.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:se.parse(o.id)}}}return I.warn("No visible output area found for scroll anchor"),null}function Wa(e){if(!e){I.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(se.create(e.cellId));if(!t){I.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${je.outputArea}`)){I.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function qe(){let e=(0,Ca.c)(2),t=E(ke),n;return e[0]===t?n=e[1]:(n=()=>{let o=za();t(s=>({mode:rt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Wa(o)})})},e[0]=t,e[1]=n),n}const Re=Ye(!1);var Ma=S();const Sa=()=>{let e=(0,Ma.c)(7),{selectedLayout:t}=ve(),{setLayoutView:n}=Ce();if(le()&&!Je("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Jt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Gt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)($t,{children:(0,a.jsxs)(Kt,{children:[(0,a.jsx)(Bt,{children:"View as"}),Ae.map(Da)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Xt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function _a(e){return(0,a.jsx)(Ve(e),{className:"h-4 w-4"})}function Ve(e){switch(e){case"vertical":return ba;case"grid":return Et;case"slides":return Le;default:return ct(e),Tt}}function Fe(e){return xe(e)}function Da(e){return(0,a.jsx)(Yt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[_a(e),(0,a.jsx)("span",{children:Fe(e)})]})},e)}async function Aa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Na=S();function Pa(e){let t=(0,Na.c)(5),{openPrompt:n,closeModal:o}=de(),{sendCopy:s}=L(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${De.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(De.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ca(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const Ea=()=>{let{updateCellConfig:e}=ye(),{saveCellConfig:t}=L();return(0,ce.useCallback)(async()=>{let n=new Xe,o=be(),s=o.cellIds.inOrderIds,r={};for(let i of s){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 l=ge.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ia=S();function Oe(){let e=(0,Ia.c)(4),{openConfirm:t}=de(),n=E(ft),{sendRestart:o}=L(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{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)(Qt,{onClick:async()=>{n({state:yt.CLOSING}),await o(),ia()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var La=S(),D=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Ta(){var me,ue;let e=(0,La.c)(45),t=la(),{openModal:n,closeModal:o}=de(),{toggleApplication:s}=dt(),{selectedPanel:r}=Qe(),[l]=Ge(ke),i=ie(ot),d=Ea(),[p]=ut(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ye(),b=Oe(),x=it(),j=Pa(t),v=E(Re),A=E(pt),z=E(mt),{exportAsMarkdown:J,readCode:N,saveCellConfig:X,updateCellOutputs:Z}=L(),Q=ha(),ee=ie(et),te=ie(lt),{selectedLayout:T}=ve(),{setLayoutView:ae}=Ce(),H=qe(),q=((me=p.sharing)==null?void 0:me.html)??!0,R=((ue=p.sharing)==null?void 0:ue.wasm)??!0,pe=!le(),oe=T==="slides",Ue=to,Be=eo,V;e[0]!==t||e[1]!==Q||e[2]!==Z?(V=async c=>{let{preset:m,title:P}=c;if(!t){he();return}await gt(P,async ne=>{await pa({takeScreenshots:()=>Q({progress:ne}),updateCellOutputs:Z}),await Aa({filename:t,preset:m,downloadPDF:jt})})},e[0]=t,e[1]=Q,e[2]=Z,e[3]=V):V=e[3];let W=V,F;e[4]===W?F=e[5]:(F=async()=>{if(pe){await W({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),m=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(Qa,0),setTimeout(()=>window.dispatchEvent(m),0)},e[4]=W,e[5]=F);let O=F,U;e[6]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(St,{size:14,strokeWidth:1.5}),e[6]=U):U=e[6];let B;e[7]===Symbol.for("react.memo_cache_sentinel")?(B=(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),e[7]=B):B=e[7];let M;e[8]===t?M=e[9]:(M=async()=>{if(!t){he();return}await We({filename:t,includeCode:!0})},e[8]=t,e[9]=M);let G;return e[10]!==f||e[11]!==te||e[12]!==u||e[13]!==o||e[14]!==y||e[15]!==j||e[16]!==W||e[17]!==k||e[18]!==J||e[19]!==t||e[20]!==O||e[21]!==ee||e[22]!==d||e[23]!==oe||e[24]!==i||e[25]!==n||e[26]!==N||e[27]!==b||e[28]!==x||e[29]!==X||e[30]!==T||e[31]!==r||e[32]!==v||e[33]!==z||e[34]!==ae||e[35]!==A||e[36]!==q||e[37]!==R||e[38]!==M||e[39]!==s||e[40]!==H||e[41]!==g||e[42]!==w||e[43]!==l.mode?(G=[{icon:U,label:"Download",handle:D,dropdown:[{icon:B,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){he();return}await We({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(da,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await J({download:!1});_e(new Blob([c],{type:"text/plain"}),Se.toMarkdown(document.title))}},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await N();_e(new Blob([c.contents],{type:"text/plain"}),Se.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ra("global.hideCode",!1)]}),handle:Za},oe?{divider:!0,icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:D,dropdown:[{icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:O},{icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Be(!0),hidden:!pe,handle:async()=>{await W({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:O}]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Share",handle:D,hidden:!q&&!R,dropdown:[{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!q,handle:async()=>{n((0,a.jsx)(ja,{onClose:o}))}},{icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!R,handle:async()=>{await $(sa({code:(await N()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:D,dropdown:Ke.flatMap(c=>{let{type:m,Icon:P,hidden:ne}=c;return ne?[]:{label:xe(m),rightElement:Ue(r===m),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),handle:()=>s(m)}})},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Present as",handle:D,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{H()}},...Ae.map((c,m)=>{let P=Ve(c);return{divider:m===0,label:Fe(c),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:T===c&&(0,a.jsx)(Me,{size:14})}),handle:()=>{ae(c),l.mode==="edit"&&H()}}})]},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||le(),handle:j},{icon:(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await $((await N()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!ee||i,handle:async()=>{let c=Ze(be());await X({configs:ge.fromEntries(c.map(Xa))});for(let m of c)w({cellId:m,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(we,{onClose:o}))}},{icon:(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(we,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!te||i,handle:()=>{g()}},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ja)},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ka)},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A($a),redundant:!0},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Resources",handle:D,dropdown:[{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Ya},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ga},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ba},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ua},{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Oa}]},{divider:!0,icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Fa},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Va}].filter(Ra).map(Ha),e[10]=f,e[11]=te,e[12]=u,e[13]=o,e[14]=y,e[15]=j,e[16]=W,e[17]=k,e[18]=J,e[19]=t,e[20]=O,e[21]=ee,e[22]=d,e[23]=oe,e[24]=i,e[25]=n,e[26]=N,e[27]=b,e[28]=x,e[29]=X,e[30]=T,e[31]=r,e[32]=v,e[33]=z,e[34]=ae,e[35]=A,e[36]=q,e[37]=R,e[38]=M,e[39]=s,e[40]=H,e[41]=g,e[42]=w,e[43]=l.mode,e[44]=G):G=e[44],G}function Ha(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(qa)}:e}function qa(e){return!e.hidden}function Ra(e){return!e.hidden}function Va(){let e=Ut();window.open(e,"_blank")}function Fa(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Oa(){window.open(_.releasesPage,"_blank")}function Ua(){window.open(_.youtube,"_blank")}function Ba(){window.open(_.discordLink,"_blank")}function Ga(){window.open(_.githubPage,"_blank")}function Ya(){window.open(_.docsPage,"_blank")}function $a(e){return!e}function Ka(e){return!e}function Ja(e){return!e}function Xa(e){return[e,{disabled:!1}]}async function Za(){let e=document.getElementById("App");e&&await vt({element:e,filename:document.title,prepare:Ct})}function Qa(){return window.print()}function eo(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function to(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Me,{size:14})})}function he(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{qe as a,Ee as c,Re as i,Pe as l,Oe as n,Te as o,Sa as r,Ie as s,Ta as t,Ne as u};
|
|
1
|
+
import{s as fe}from"./chunk-LvLJmgfZ.js";import{d as E,l as Ge,p as Ye,u as ie}from"./useEvent-WUlsM6MC.js";import{t as $e}from"./react-Bj1aDYRI.js";import{Cn as Ke,En as Je,Gt as Xe,Nr as Ze,Sn as Qe,T as ye,_ as et,ar as tt,cr as at,dt as ke,h as be,lt as ot,pr as nt,pt as it,rr as st,t as lt,ut as rt,vi as se,xn as dt}from"./cells-CCtxWKxf.js";import{t as S}from"./compiler-runtime-B3qBwwSJ.js";import{n as ct}from"./assertNever-Dw9aFN4h.js";import{s as xe}from"./useLifecycle-BDXC6oVR.js";import{a as ht,n as we}from"./add-connection-dialog-9CzjZlY9.js";import{n as pt,x as mt}from"./ai-model-dropdown-CB5pPJ9U.js";import{c as ge,m as I}from"./useEventListener-CjXriKgk.js";import{y as ut}from"./utils-CORJ8yYa.js";import{n as _,t as je}from"./constants-CdR60lKM.js";import{S as le,h as ft,x as yt}from"./config-D9X9QKiL.js";import{t as kt}from"./jsx-runtime-CP2fAiZX.js";import{r as bt,t as re}from"./button-BmOH9agK.js";import{r as L}from"./requests-DZy_SQ_v.js";import{t as h}from"./createLucideIcon-BvP5LBIs.js";import{a as ve,f as xt,i as Ce,m as wt,p as ze,u as We}from"./layout-DcfIrJXW.js";import{t as Me}from"./check-BnZGcuDh.js";import{c as gt,d as Se,n as jt,o as vt,r as _e,t as Ct}from"./download-BTm4CTKr.js";import{f as zt}from"./maps-8VTEe-0T.js";import{r as Wt}from"./useCellActionButton-DFgACqVf.js";import{t as Mt}from"./copy-CAR4dOiD.js";import{t as St}from"./download-BG-iMGgV.js";import{t as _t}from"./eye-off-DgTL09j7.js";import{t as Dt}from"./file-plus-corner-BRwJx0yp.js";import{t as Y}from"./file-DVwc11C3.js";import{t as At}from"./github-BrsjF9dp.js";import{m as Nt}from"./form-B7_NRa34.js";import{n as Pt,r as Et,t as It}from"./youtube-fKFch587.js";import{n as Lt,t as Tt}from"./square-oV8Csj8Y.js";import{i as Ht}from"./html-to-image-b9BimK8l.js";import{t as qt}from"./link-Cpo6yhBB.js";import{r as Rt}from"./input-BPldEXfy.js";import{t as Vt}from"./settings-DD8FJvQ_.js";import{x as Ft}from"./azure-Ddr1pZpW.js";import{t as C}from"./use-toast-BhMe50aT.js";import{n as De,t as Ot}from"./paths-bMgYkaP2.js";import{o as Ut}from"./session-DnMOyddG.js";import{a as Bt,c as Gt,i as Yt,n as $t,r as Kt,s as Jt,t as Xt}from"./select-DygbgNTD.js";import{t as Zt}from"./tooltip-DOQlecCr.js";import{o as Qt}from"./alert-dialog-DsNfSYaw.js";import{a as ea,c as ta,i as aa,n as oa,r as na}from"./dialog-BXzvlof-.js";import{n as de}from"./ImperativeModal-CRNJOvqT.js";import{r as ia,t as sa}from"./share-sD4fbzpH.js";import{t as $}from"./copy-DMCkK2TI.js";import{a as la}from"./cell-link-B59Kn5nL.js";import{a as ra}from"./renderShortcut-BJEd-iA7.js";import{t as da}from"./icons-B9sHgc9n.js";import{t as ca}from"./links-syPBpTLO.js";import{r as ha,t as pa}from"./hooks-BllYlfDO.js";import{t as Ae}from"./types-Myu7G9iV.js";var ma=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ua=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ne=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"}]]),Pe=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"}]]),Ee=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"}]]),fa=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"}]]),ya=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"}]]),ka=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"}]]),Ie=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"}]]),ba=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"}]]),xa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Le=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"}]]),wa=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"}]]),ga=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"}]]),Te=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"}]]),He=S(),ce=fe($e(),1),a=fe(kt(),1),K="https://static.marimo.app";const ja=e=>{let t=(0,He.c)(25),{onClose:n}=e,[o,s]=(0,ce.useState)(""),{exportAsHTML:r}=L(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${K}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let A=await r({download:!1,includeCode:!0,files:xt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${K}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:l})}).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]=l,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(ta,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(ea,{children:[p,(0,a.jsxs)(na,{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:K,target:"_blank",children:K}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Rt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(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)(va,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(re,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(re,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await $(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(aa,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(oa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var va=e=>{let t=(0,He.c)(8),[n,o]=ce.useState(!1),s;t[0]===e.text?s=t[1]:(s=bt.stopPropagation(async p=>{p.preventDefault(),await $(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(re,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Zt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Ca=S();function za(){let e=document.getElementsByClassName(je.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=se.findElement(t);if(!o){I.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:se.parse(o.id)}}}return I.warn("No visible output area found for scroll anchor"),null}function Wa(e){if(!e){I.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(se.create(e.cellId));if(!t){I.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${je.outputArea}`)){I.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function qe(){let e=(0,Ca.c)(2),t=E(ke),n;return e[0]===t?n=e[1]:(n=()=>{let o=za();t(s=>({mode:rt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Wa(o)})})},e[0]=t,e[1]=n),n}const Re=Ye(!1);var Ma=S();const Sa=()=>{let e=(0,Ma.c)(7),{selectedLayout:t}=ve(),{setLayoutView:n}=Ce();if(le()&&!Je("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Jt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Gt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)($t,{children:(0,a.jsxs)(Kt,{children:[(0,a.jsx)(Bt,{children:"View as"}),Ae.map(Da)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Xt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function _a(e){return(0,a.jsx)(Ve(e),{className:"h-4 w-4"})}function Ve(e){switch(e){case"vertical":return ba;case"grid":return Et;case"slides":return Le;default:return ct(e),Tt}}function Fe(e){return xe(e)}function Da(e){return(0,a.jsx)(Yt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[_a(e),(0,a.jsx)("span",{children:Fe(e)})]})},e)}async function Aa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Na=S();function Pa(e){let t=(0,Na.c)(5),{openPrompt:n,closeModal:o}=de(),{sendCopy:s}=L(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${De.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(De.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ca(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const Ea=()=>{let{updateCellConfig:e}=ye(),{saveCellConfig:t}=L();return(0,ce.useCallback)(async()=>{let n=new Xe,o=be(),s=o.cellIds.inOrderIds,r={};for(let i of s){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 l=ge.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ia=S();function Oe(){let e=(0,Ia.c)(4),{openConfirm:t}=de(),n=E(ft),{sendRestart:o}=L(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{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)(Qt,{onClick:async()=>{n({state:yt.CLOSING}),await o(),ia()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var La=S(),D=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Ta(){var me,ue;let e=(0,La.c)(45),t=la(),{openModal:n,closeModal:o}=de(),{toggleApplication:s}=dt(),{selectedPanel:r}=Qe(),[l]=Ge(ke),i=ie(ot),d=Ea(),[p]=ut(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ye(),b=Oe(),x=it(),j=Pa(t),v=E(Re),A=E(pt),z=E(mt),{exportAsMarkdown:J,readCode:N,saveCellConfig:X,updateCellOutputs:Z}=L(),Q=ha(),ee=ie(et),te=ie(lt),{selectedLayout:T}=ve(),{setLayoutView:ae}=Ce(),H=qe(),q=((me=p.sharing)==null?void 0:me.html)??!0,R=((ue=p.sharing)==null?void 0:ue.wasm)??!0,pe=!le(),oe=T==="slides",Ue=to,Be=eo,V;e[0]!==t||e[1]!==Q||e[2]!==Z?(V=async c=>{let{preset:m,title:P}=c;if(!t){he();return}await gt(P,async ne=>{await pa({takeScreenshots:()=>Q({progress:ne}),updateCellOutputs:Z}),await Aa({filename:t,preset:m,downloadPDF:jt})})},e[0]=t,e[1]=Q,e[2]=Z,e[3]=V):V=e[3];let W=V,F;e[4]===W?F=e[5]:(F=async()=>{if(pe){await W({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),m=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(Qa,0),setTimeout(()=>window.dispatchEvent(m),0)},e[4]=W,e[5]=F);let O=F,U;e[6]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(St,{size:14,strokeWidth:1.5}),e[6]=U):U=e[6];let B;e[7]===Symbol.for("react.memo_cache_sentinel")?(B=(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),e[7]=B):B=e[7];let M;e[8]===t?M=e[9]:(M=async()=>{if(!t){he();return}await We({filename:t,includeCode:!0})},e[8]=t,e[9]=M);let G;return e[10]!==f||e[11]!==te||e[12]!==u||e[13]!==o||e[14]!==y||e[15]!==j||e[16]!==W||e[17]!==k||e[18]!==J||e[19]!==t||e[20]!==O||e[21]!==ee||e[22]!==d||e[23]!==oe||e[24]!==i||e[25]!==n||e[26]!==N||e[27]!==b||e[28]!==x||e[29]!==X||e[30]!==T||e[31]!==r||e[32]!==v||e[33]!==z||e[34]!==ae||e[35]!==A||e[36]!==q||e[37]!==R||e[38]!==M||e[39]!==s||e[40]!==H||e[41]!==g||e[42]!==w||e[43]!==l.mode?(G=[{icon:U,label:"Download",handle:D,dropdown:[{icon:B,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){he();return}await We({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(da,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await J({download:!1});_e(new Blob([c],{type:"text/plain"}),Se.toMarkdown(document.title))}},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await N();_e(new Blob([c.contents],{type:"text/plain"}),Se.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ra("global.hideCode",!1)]}),handle:Za},oe?{divider:!0,icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:D,dropdown:[{icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:O},{icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Be(!0),hidden:!pe,handle:async()=>{await W({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(Y,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:O}]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Share",handle:D,hidden:!q&&!R,dropdown:[{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!q,handle:async()=>{n((0,a.jsx)(ja,{onClose:o}))}},{icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!R,handle:async()=>{await $(sa({code:(await N()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:D,dropdown:Ke.flatMap(c=>{let{type:m,Icon:P,hidden:ne}=c;return ne?[]:{label:xe(m),rightElement:Ue(r===m),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),handle:()=>s(m)}})},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Present as",handle:D,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{H()}},...Ae.map((c,m)=>{let P=Ve(c);return{divider:m===0,label:Fe(c),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:T===c&&(0,a.jsx)(Me,{size:14})}),handle:()=>{ae(c),l.mode==="edit"&&H()}}})]},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||le(),handle:j},{icon:(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await $((await N()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!ee||i,handle:async()=>{let c=Ze(be());await X({configs:ge.fromEntries(c.map(Xa))});for(let m of c)w({cellId:m,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(we,{onClose:o}))}},{icon:(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(we,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!te||i,handle:()=>{g()}},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ja)},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ka)},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A($a),redundant:!0},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Resources",handle:D,dropdown:[{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Ya},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ga},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ba},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ua},{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Oa}]},{divider:!0,icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Fa},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Va}].filter(Ra).map(Ha),e[10]=f,e[11]=te,e[12]=u,e[13]=o,e[14]=y,e[15]=j,e[16]=W,e[17]=k,e[18]=J,e[19]=t,e[20]=O,e[21]=ee,e[22]=d,e[23]=oe,e[24]=i,e[25]=n,e[26]=N,e[27]=b,e[28]=x,e[29]=X,e[30]=T,e[31]=r,e[32]=v,e[33]=z,e[34]=ae,e[35]=A,e[36]=q,e[37]=R,e[38]=M,e[39]=s,e[40]=H,e[41]=g,e[42]=w,e[43]=l.mode,e[44]=G):G=e[44],G}function Ha(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(qa)}:e}function qa(e){return!e.hidden}function Ra(e){return!e.hidden}function Va(){let e=Ut();window.open(e,"_blank")}function Fa(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Oa(){window.open(_.releasesPage,"_blank")}function Ua(){window.open(_.youtube,"_blank")}function Ba(){window.open(_.discordLink,"_blank")}function Ga(){window.open(_.githubPage,"_blank")}function Ya(){window.open(_.docsPage,"_blank")}function $a(e){return!e}function Ka(e){return!e}function Ja(e){return!e}function Xa(e){return[e,{disabled:!1}]}async function Za(){let e=document.getElementById("App");e&&await vt({element:e,filename:document.title,prepare:Ct})}function Qa(){return window.print()}function eo(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function to(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Me,{size:14})})}function he(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{qe as a,Ee as c,Re as i,Pe as l,Oe as n,Te as o,Sa as r,Ie as s,Ta as t,Ne 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-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-DHreJ2o9.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-TXkS1QI3.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/clsx-A78R3nYl.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/cn-d_A4rA-x.js">
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-DeCFDX1B.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-DtQaB9NM.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-n1-FF7zs.js">
|
|
175
|
-
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-
|
|
175
|
+
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-CB5pPJ9U.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-OkOxlkkM.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/precisionRound-BOmLQIKI.js">
|
|
178
178
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-DK1MWd7f.js">
|
|
@@ -215,10 +215,10 @@
|
|
|
215
215
|
<link rel="modulepreload" crossorigin href="./assets/esm-BQUzYly2.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/file-DVwc11C3.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/play-D4Tdvkms.js">
|
|
218
|
-
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai
|
|
218
|
+
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-BUGemtjx.js">
|
|
219
219
|
<link rel="modulepreload" crossorigin href="./assets/isEmpty-9KlyX4nB.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/bot-message-square-BzawfL5p.js">
|
|
221
|
-
<link rel="modulepreload" crossorigin href="./assets/chat-display-
|
|
221
|
+
<link rel="modulepreload" crossorigin href="./assets/chat-display-Bwj4Pf6B.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-F2DZENgf.js">
|
|
223
223
|
<link rel="modulepreload" crossorigin href="./assets/square-function-4zY5Dv0P.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/spec-Be-iRLAY.js">
|
package/package.json
CHANGED
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
AccordionItem,
|
|
61
61
|
AccordionTrigger,
|
|
62
62
|
} from "../ui/accordion";
|
|
63
|
+
import { Alert, AlertDescription } from "../ui/alert";
|
|
63
64
|
import { Button } from "../ui/button";
|
|
64
65
|
import { Checkbox } from "../ui/checkbox";
|
|
65
66
|
import { DropdownMenuSeparator } from "../ui/dropdown-menu";
|
|
@@ -966,6 +967,15 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({
|
|
|
966
967
|
provider="github"
|
|
967
968
|
isConfigured={hasValue("ai.github.api_key")}
|
|
968
969
|
>
|
|
970
|
+
<Alert variant="warning" className="py-1.5 px-3 text-xs">
|
|
971
|
+
<AlertDescription>
|
|
972
|
+
Free tier models have low token limits which can cause errors with
|
|
973
|
+
larger prompts.{" "}
|
|
974
|
+
<ExternalLink href="https://docs.github.com/en/github-models/prototyping-with-ai-models#rate-limits">
|
|
975
|
+
Learn more
|
|
976
|
+
</ExternalLink>
|
|
977
|
+
</AlertDescription>
|
|
978
|
+
</Alert>
|
|
969
979
|
<ApiKey
|
|
970
980
|
form={form}
|
|
971
981
|
config={config}
|
|
@@ -8,6 +8,7 @@ export const ExternalLink = ({
|
|
|
8
8
|
| `https://console.anthropic.com/${string}`
|
|
9
9
|
| `https://aistudio.google.com/${string}`
|
|
10
10
|
| `https://github.com/${string}`
|
|
11
|
+
| `https://docs.github.com/${string}`
|
|
11
12
|
| `https://openrouter.ai/${string}`
|
|
12
13
|
| `https://docs.marimo.io/${string}`
|
|
13
14
|
| `https://docs.python.org/${string}`
|