Spaces:
Running
Running
import{G as e,H as a,J as s,M as t,O as o,P as r,Q as n,T as i,U as l,V as c,W as m,X as d,Y as h,Z as b,_ as x,$ as f,a0 as y,a1 as p,a2 as u,a3 as g,a4 as _,a5 as j,a6 as k,a7 as v,a8 as w,a9 as N}from"./index-BiV-b1K2.js";import{u as S,A as C,R as I,a as P,C as T}from"./useMarimoWebSocket-BLMCu7Fz.js";import"./createWsUrl-Bazdvp-G.js";const A=n=>{const l=e.c(14),{appConfig:c}=n,{setCells:m}=a();let d,h,b;l[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],l[0]=d):d=l[0],s.useEffect(E,d),l[1]===Symbol.for("react.memo_cache_sentinel")?(h=i(),l[1]=h):h=l[1],l[2]!==m?(b={autoInstantiate:!0,setCells:m,sessionId:h},l[2]=m,l[3]=b):b=l[3];const{connection:x}=S(b),f=t(o);let y,p,u;return l[4]!==x?(y=r.jsx(P,{connection:x,className:"sm:pt-8"}),l[4]=x,l[5]=y):y=l[5],l[6]!==c?(p=r.jsx(T,{appConfig:c,mode:"read"}),l[6]=c,l[7]=p):p=l[7],l[8]!==c.width||l[9]!==x||l[10]!==f||l[11]!==y||l[12]!==p?(u=r.jsxs(C,{connection:x,isRunning:f,width:c.width,children:[y,p]}),l[8]=c.width,l[9]=x,l[10]=f,l[11]=y,l[12]=p,l[13]=u):u=l[13],u};function W(){I.INSTANCE.stop()}function E(){return I.INSTANCE.start(n),W}const R=()=>{const a=e.c(4);if(!l())return null;let s;a[0]===Symbol.for("react.memo_cache_sentinel")?(s=c(),a[0]=s):s=a[0];const t=s;if(!t)return null;let o,n,i;return a[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("a",{href:m.githubPage,target:"_blank",className:"underline",rel:"noreferrer",children:"marimo"}),a[1]=o):o=a[1],a[2]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsxs("span",{children:["This is a static Python notebook built using"," ",o,".",r.jsx("br",{}),"Some interactive features may not work, see ways to run or edit this."]}),a[2]=n):n=a[2],a[3]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsxs("div",{className:"px-4 py-2 bg-[var(--sky-2)] border-b border-[var(--sky-7)] text-md text-[var(--sky-11)] font-semibold flex justify-between items-center gap-4 no-print",children:[n,r.jsx("span",{className:"flex-shrink-0",children:r.jsx(D,{code:t})})]}),a[3]=i):i=a[3],i},D=a=>{const s=e.c(81),{code:t}=a;let o;if(s[0]===Symbol.for("react.memo_cache_sentinel")){o=d()||"notebook.py";const e=o.lastIndexOf("/");-1!==e&&(o=o.slice(e+1)),s[0]=o}else o=s[0];const n=window.location.href;let i,l,c,N,S,C,I,P,T,A,W,E,R,D,F,M,O,U,Y,z,B,G,H,J,Q,V,X,Z,$,q,K,L,ee,ae,se,te,oe;if(s[1]!==t){const e=h({code:t});let a;N=b,s[25]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsx(x,{asChild:!0,children:r.jsx(f,{"data-testid":"static-notebook-dialog-trigger",variant:"secondary",children:"Run or edit this notebook"})}),s[25]=F):F=s[25],c=y,l=p,s[26]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(u,{children:o}),s[26]=D):D=s[26],i=g,z="pt-4 text-md text-left",B="This is a static notebook built using",G=" ",s[27]===Symbol.for("react.memo_cache_sentinel")?(H=r.jsx("a",{href:m.githubPage,target:"_blank",className:"text-link hover:underline",rel:"noreferrer",children:"marimo"}),s[27]=H):H=s[27],C=". marimo is an open-source next-generation Python notebook.",s[28]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx("hr",{className:"my-3"}),s[28]=I):I=s[28],P="In order to edit this notebook, you will need to download the code locally, install marimo, and run the following in your terminal:",s[29]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("br",{}),s[29]=a):a=s[29],s[30]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsxs("div",{className:"font-mono text-sm bg-[var(--sky-2)] rounded-md my-3 p-2 border border-[var(--sky-7)]",children:["pip install marimo",a,"marimo edit ",o]}),A=!n.endsWith(".html")&&r.jsxs(r.Fragment,{children:["or",r.jsxs("div",{className:"font-mono text-sm bg-[var(--sky-2)] rounded-md my-3 p-2 border border-[var(--sky-7)] break-all",children:["marimo edit ",window.location.href]})]}),W=r.jsx("hr",{className:"my-3"}),s[30]=T,s[31]=A,s[32]=W):(T=s[30],A=s[31],W=s[32]),E="You may also be able to run this notebook entirely in the browser via WebAssembly at:",R=" ",S=e,M="_blank",O="text-link hover:underline",U="noreferrer",Y=e.slice(0,40),s[1]=t,s[2]=i,s[3]=l,s[4]=c,s[5]=N,s[6]=S,s[7]=C,s[8]=I,s[9]=P,s[10]=T,s[11]=A,s[12]=W,s[13]=E,s[14]=R,s[15]=D,s[16]=F,s[17]=M,s[18]=O,s[19]=U,s[20]=Y,s[21]=z,s[22]=B,s[23]=G,s[24]=H}else i=s[2],l=s[3],c=s[4],N=s[5],S=s[6],C=s[7],I=s[8],P=s[9],T=s[10],A=s[11],W=s[12],E=s[13],R=s[14],D=s[15],F=s[16],M=s[17],O=s[18],U=s[19],Y=s[20],z=s[21],B=s[22],G=s[23],H=s[24];return s[33]!==S||s[34]!==M||s[35]!==O||s[36]!==U||s[37]!==Y?(J=r.jsxs("a",{href:S,target:M,className:O,rel:U,children:[Y,"..."]}),s[33]=S,s[34]=M,s[35]=O,s[36]=U,s[37]=Y,s[38]=J):J=s[38],s[39]===Symbol.for("react.memo_cache_sentinel")?(Q=r.jsx("br",{}),s[39]=Q):Q=s[39],s[40]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsxs("div",{className:"text-sm text-muted-foreground pt-2",children:[r.jsx("strong",{children:"Note:"})," This feature is experimental and may not work for all notebooks. Additionally, some dependencies may not be available in the browser."]}),s[40]=V):V=s[40],s[41]!==i||s[42]!==C||s[43]!==I||s[44]!==P||s[45]!==T||s[46]!==A||s[47]!==W||s[48]!==E||s[49]!==R||s[50]!==J||s[51]!==z||s[52]!==B||s[53]!==G||s[54]!==H?(X=r.jsxs(i,{className:z,children:[B,G,H,C,I,P,T,A,W,E,R,J,Q,V]}),s[41]=i,s[42]=C,s[43]=I,s[44]=P,s[45]=T,s[46]=A,s[47]=W,s[48]=E,s[49]=R,s[50]=J,s[51]=z,s[52]=B,s[53]=G,s[54]=H,s[55]=X):X=s[55],s[56]!==l||s[57]!==D||s[58]!==X?(Z=r.jsxs(l,{children:[D,X]}),s[56]=l,s[57]=D,s[58]=X,s[59]=Z):Z=s[59],s[60]!==t?($=async()=>{await _(t),j({title:"Copied to clipboard"})},s[60]=t,s[61]=$):$=s[61],s[62]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx(k,{className:"w-4 h-4 mr-1"}),s[62]=q):q=s[62],s[63]!==$?(K=r.jsxs(f,{"data-testid":"copy-static-notebook-dialog-button",variant:"secondary",onClick:$,children:[q,"Copy code"]}),s[63]=$,s[64]=K):K=s[64],s[65]!==t?(L=()=>{v(new Blob([t],{type:"text/plain"}),o)},s[65]=t,s[66]=L):L=s[66],s[67]===Symbol.for("react.memo_cache_sentinel")?(ee=r.jsx(w,{className:"w-4 h-4 mr-1"}),s[67]=ee):ee=s[67],s[68]!==L?(ae=r.jsxs(f,{"data-testid":"download-static-notebook-dialog-button",variant:"secondary",onClick:L,children:[ee,"Download code"]}),s[68]=L,s[69]=ae):ae=s[69],s[70]!==K||s[71]!==ae?(se=r.jsxs("div",{className:"flex gap-4 flex-wrap",children:[K,ae]}),s[70]=K,s[71]=ae,s[72]=se):se=s[72],s[73]!==c||s[74]!==Z||s[75]!==se?(te=r.jsxs(c,{children:[Z,se]}),s[73]=c,s[74]=Z,s[75]=se,s[76]=te):te=s[76],s[77]!==N||s[78]!==F||s[79]!==te?(oe=r.jsxs(N,{children:[F,te]}),s[77]=N,s[78]=F,s[79]=te,s[80]=oe):oe=s[80],oe},F=N()||l(),M=a=>{const s=e.c(6);let t,o,n,i;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=r.jsx(R,{}),s[0]=t):t=s[0],s[1]!==a.appConfig?(o=r.jsx(A,{appConfig:a.appConfig}),s[1]=a.appConfig,s[2]=o):o=s[2],s[3]===Symbol.for("react.memo_cache_sentinel")?(n=F&&r.jsx(O,{}),s[3]=n):n=s[3],s[4]!==o?(i=r.jsxs(r.Fragment,{children:[t,o,n]}),s[4]=o,s[5]=i):i=s[5],i},O=()=>{const a=e.c(1);let s;return a[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"fixed bottom-0 right-0 z-50",children:r.jsxs("a",{href:m.githubPage,target:"_blank",className:"text-sm text-[var(--grass-11)] font-bold tracking-wide transition-colors bg-[var(--grass-4)] hover:bg-[var(--grass-5)] border-t border-l border-[var(--grass-8)] px-3 py-1 rounded-tl-md flex items-center gap-2",rel:"noreferrer",children:[r.jsx("span",{className:"pb-[2px]",children:"made with marimo"}),r.jsx("img",{src:"./favicon.ico",alt:"marimo",className:"h-4 w-auto"})]})}),a[0]=s):s=a[0],s};export{M as default}; | |