@marimo-team/frontend 0.23.7-dev26 → 0.23.7-dev29
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/{JsonOutput-DPTx4W3_.js → JsonOutput-CGRqyV9u.js} +1 -1
- package/dist/assets/{add-cell-with-ai-Brv9Nib_.js → add-cell-with-ai-BY6XaAZ3.js} +14 -14
- package/dist/assets/{add-connection-dialog-CDimGa9X.js → add-connection-dialog-C2N_XkPg.js} +1 -1
- package/dist/assets/{agent-panel-GKPzGkcA.js → agent-panel-DFm4e-B6.js} +1 -1
- package/dist/assets/{cell-editor-Bsykn4S-.js → cell-editor-CcriAGOG.js} +1 -1
- package/dist/assets/{chat-display-D2yhLWNi.js → chat-display-BHIBT3NZ.js} +1 -1
- package/dist/assets/{chat-panel-B5MUxP69.js → chat-panel-BW7I3hUn.js} +1 -1
- package/dist/assets/{chat-ui-D4WaB_kd.js → chat-ui-CeMFucvK.js} +1 -1
- package/dist/assets/{column-preview-D_mFRbEq.js → column-preview-BjPmiDfN.js} +1 -1
- package/dist/assets/{command-palette-Bwq10yhf.js → command-palette-BVA3apz9.js} +1 -1
- package/dist/assets/{edit-page-ms9zMhPH.js → edit-page-C8x2MxAf.js} +5 -5
- package/dist/assets/{file-explorer-panel-CwTZ0CcT.js → file-explorer-panel-CcZAXOfR.js} +1 -1
- package/dist/assets/{form-CvdGBYia.js → form-Erlg5epl.js} +1 -1
- package/dist/assets/{hooks-cC9mPQOU.js → hooks-DN50smd9.js} +1 -1
- package/dist/assets/{index-5DPWreKX.js → index-DJPWW9kq.js} +4 -4
- package/dist/assets/{layout-Cb_Fr_ha.js → layout-Blt3H1HN.js} +3 -3
- package/dist/assets/{panels-Btt-Kg9z.js → panels-elqsvkIN.js} +1 -1
- package/dist/assets/{reveal-component-Dop5VNNi.js → reveal-component-7bvFNhiJ.js} +1 -1
- package/dist/assets/{run-page-CclsHuGK.js → run-page-BlxgdRHc.js} +1 -1
- package/dist/assets/{scratchpad-panel-0WSd_KKK.js → scratchpad-panel-CCEUdBnE.js} +1 -1
- package/dist/assets/{session-panel-DKVn-WKZ.js → session-panel-BEPImgnp.js} +1 -1
- package/dist/assets/{useNotebookActions-C2hJSWHR.js → useNotebookActions-LT2x1bBk.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +3 -3
- package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +10 -2
- package/src/components/editor/chrome/wrapper/app-chrome.tsx +1 -0
- package/src/components/editor/chrome/wrapper/footer.tsx +4 -1
- package/src/components/editor/chrome/wrapper/panels.tsx +4 -1
- package/src/components/editor/chrome/wrapper/sidebar.tsx +4 -1
- package/src/components/editor/controls/Controls.tsx +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as ie}from"./chunk-LvLJmgfZ.js";import{d as de,l as Be,p as he,u as K}from"./useEvent-D91BmmQi.js";import{t as De}from"./react-Bj1aDYRI.js";import{Ar as Ve,At as Me,Br as ue,D as Pe,Fn as Ee,Fr as xe,Gt as Oe,In as Ue,Ir as Re,Kt as Ae,Lr as We,M as Ge,Nr as se,Oi as ze,P as He,Pr as pe,Rn as Ke,Rt as Je,Ur as Xe,Vr as fe,Wr as be,Wt as Qe,_n as Ye,a as Ze,ar as ea,cr as aa,f as ta,hr as sa,or as la,vr as na,yr as le}from"./cells-DFP-V6he.js";import"./react-dom-CSu739Rf.js";import{t as ge}from"./compiler-runtime-B3qBwwSJ.js";import{o as ra}from"./utils-Wvjk_Y4h.js";import{t as oa}from"./ErrorBoundary-DyYDV0HI.js";import{t as O}from"./cn-DCUzRj2J.js";import{t as ma}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{n as ca}from"./multi-map-CUuNtzHt.js";import"./popover-Bz_0Vkyf.js";import{B as je,H as ia,U as da,V as ha,W as ua,z as ne}from"./JsonOutput-DPTx4W3_.js";import"./download-PdY73eIa.js";import{r as Ne}from"./radio-group-B-1HJbUZ.js";import{t as re}from"./tooltip-DTV9tlSr.js";import{r as xa,t as ee}from"./button-BbCh-29a.js";import"./dist-BrR4M-k3.js";import{u as J}from"./arrays-DYDL-3-i.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{i as pa}from"./strings-wdPMRf6Z.js";import{r as fa}from"./requests-DIwGYs0l.js";import{t as ba}from"./createLucideIcon-D5guW7EU.js";import{t as ga}from"./x-C-6liIBr.js";import"./markdown-renderer-DyxPYsSd.js";import{t as ye}from"./add-connection-dialog-CDimGa9X.js";import{t as ve}from"./plus-CxkHs8QM.js";import{a as ja}from"./input-DkSJHlVD.js";import{n as Na,o as ya}from"./column-preview-D_mFRbEq.js";import{t as va}from"./workflow-Bm8qF7yj.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-Cc5BIu1h.js";import{t as wa}from"./copy-icon-OjtDb4gO.js";import{t as Sa}from"./context-QkTujrKn.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{t as we}from"./cell-link-CKjfkiFA.js";import{n as oe}from"./useAsyncData-Bczwgx1s.js";import{a as Ca,o as ae,t as _a,u as ka}from"./command-FM3TtrvZ.js";import"./chunk-5FQGJX7Z-DzaUzyuM.js";import{r as $a}from"./html-to-image-DkwHQ_Qj.js";import{o as Fa}from"./focus-DIIsMOUb.js";import{a as Ia,i as La,n as Ta,o as Se,r as qa,t as Ba}from"./table-Bgc-inJs.js";import"./react-resizable-panels.browser.esm-BdtIs0E-.js";import{n as Da}from"./icons-D7rawFWk.js";import{r as Va}from"./tree-actions-OR_cmYSp.js";import{a as me,i as te,o as ce,r as Ce,s as _e,t as Ma}from"./components-DtZWQLFy.js";import{t as Pa}from"./empty-state-Cjt8SfMh.js";import{n as Ea,t as Oa}from"./common-W-U2rLKH.js";import{a as Ua,i as Ra,n as ke,r as $e,t as Fe}from"./components-BtpZRoDo.js";var Aa=ba("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),A=ge(),C=ie(De(),1),t=ie(ma(),1),S={engineEmpty:"pl-3",engine:"pl-3 pr-2",database:"pl-4",schemaEmpty:"pl-8",schema:"pl-7",schemaLoading:"pl-8",tableLoading:"pl-11",tableSchemaless:"pl-8",tableWithSchema:"pl-12",columnLocal:"pl-5",columnSql:"pl-13",columnPreview:"pl-10"},Wa=he(a=>{let e=a(xe),s=a(Ke),l=a(Ze);return J(e,r=>{if(!r.variable_name)return-1;let o=Object.values(s).find(j=>j.name===r.variable_name);if(!o)return 0;let n=l.inOrderIds.indexOf(o.declaredBy[0]);return n===-1?0:n})});const Ie=he(a=>{let e=new Map(a(Ve));for(let s of be){let l=e.get(s);l&&(l.databases.length===0&&e.delete(s),l.databases.length===1&&l.databases[0].name==="memory"&&l.databases[0].schemas.length===0&&e.delete(s))}return J([...e.values()],s=>be.has(s.name)?1:0)}),Ga=()=>{let a=(0,A.c)(32),[e,s]=C.useState(""),l=de(pe),r=K(Wa),o=K(Ie);if(r.length===0&&o.length===0){let u;return a[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(Pa,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,t.jsx)(ye,{children:(0,t.jsxs)(ee,{variant:"outline",size:"sm",children:["Add database or catalog",(0,t.jsx)(ve,{className:"h-4 w-4 ml-2"})]})}),icon:(0,t.jsx)(le,{})}),a[0]=u):u=a[0],u}let n=!!e.trim(),j;a[1]===l?j=a[2]:(j=u=>{l(u.length>0),s(u)},a[1]=l,a[2]=j);let g;a[3]!==e||a[4]!==j?(g=(0,t.jsx)(Ca,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:j,rootClassName:"flex-1 border-r border-b-0"}),a[3]=e,a[4]=j,a[5]=g):g=a[5];let N;a[6]===n?N=a[7]:(N=n&&(0,t.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>s(""),children:(0,t.jsx)(ga,{className:"h-4 w-4"})}),a[6]=n,a[7]=N);let f;a[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(ye,{children:(0,t.jsx)(ee,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,t.jsx)(ve,{className:"h-4 w-4"})})}),a[8]=f):f=a[8];let c;a[9]!==g||a[10]!==N?(c=(0,t.jsxs)("div",{className:"flex items-center w-full border-b",children:[g,N,f]}),a[9]=g,a[10]=N,a[11]=c):c=a[11];let i;if(a[12]!==o||a[13]!==n||a[14]!==e){let u;a[16]!==n||a[17]!==e?(u=x=>(0,t.jsx)(za,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(b=>(0,t.jsx)(Ha,{engineName:x.name,database:b,hasSearch:n,children:(0,t.jsx)(Ka,{schemas:b.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:b.name,hasSearch:n,searchValue:e,dialect:x.dialect})},b.name))},x.name),a[16]=n,a[17]=e,a[18]=u):u=a[18],i=o.map(u),a[12]=o,a[13]=n,a[14]=e,a[15]=i}else i=a[15];let h;a[19]!==o.length||a[20]!==r.length?(h=o.length>0&&r.length>0&&(0,t.jsxs)(Ce,{className:S.engine,children:[(0,t.jsx)(Da,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-xs",children:"Python"})]}),a[19]=o.length,a[20]=r.length,a[21]=h):h=a[21];let p;a[22]!==e||a[23]!==r?(p=r.length>0&&(0,t.jsx)(Le,{tables:r,searchValue:e}),a[22]=e,a[23]=r,a[24]=p):p=a[24];let d;a[25]!==i||a[26]!==h||a[27]!==p?(d=(0,t.jsxs)(ka,{className:"flex flex-col",children:[i,h,p]}),a[25]=i,a[26]=h,a[27]=p,a[28]=d):d=a[28];let m;return a[29]!==c||a[30]!==d?(m=(0,t.jsxs)(_a,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[c,d]}),a[29]=c,a[30]=d,a[31]=m):m=a[31],m};var za=a=>{let e=(0,A.c)(25),{connection:s,children:l,hasChildren:r}=a,o=s.name===Xe,n=o?"In-Memory":s.name,{previewDataSourceConnection:j}=fa(),g;e[0]!==s.name||e[1]!==j?(g=async()=>{await j({engine:s.name})},e[0]=s.name,e[1]=j,e[2]=g):g=e[2];let N=g,f;e[3]===s.dialect?f=e[4]:(f=(0,t.jsx)(Me,{className:"h-4 w-4 text-muted-foreground",name:s.dialect}),e[3]=s.dialect,e[4]=f);let c;e[5]===s.dialect?c=e[6]:(c=ea(s.dialect),e[5]=s.dialect,e[6]=c);let i;e[7]===c?i=e[8]:(i=(0,t.jsx)("span",{className:"text-xs",children:c}),e[7]=c,e[8]=i);let h=n,p;e[9]===h?p=e[10]:(p=(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,t.jsx)(Ua,{variableName:h}),")"]}),e[9]=h,e[10]=p);let d;e[11]!==N||e[12]!==o?(d=!o&&(0,t.jsx)(Va,{onClick:N,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[11]=N,e[12]=o,e[13]=d):d=e[13];let m;e[14]!==f||e[15]!==i||e[16]!==p||e[17]!==d?(m=(0,t.jsxs)(Ce,{className:S.engine,children:[f,i,p,d]}),e[14]=f,e[15]=i,e[16]=p,e[17]=d,e[18]=m):m=e[18];let u;e[19]!==l||e[20]!==r?(u=r?l:(0,t.jsx)(te,{content:"No databases available",className:S.engineEmpty}),e[19]=l,e[20]=r,e[21]=u):u=e[21];let x;return e[22]!==m||e[23]!==u?(x=(0,t.jsxs)(t.Fragment,{children:[m,u]}),e[22]=m,e[23]=u,e[24]=x):x=e[24],x},Ha=a=>{let e=(0,A.c)(26),{hasSearch:s,engineName:l,database:r,children:o}=a,[n,j]=C.useState(!1),[g,N]=C.useState(!1),[f,c]=C.useState(s);f!==s&&(c(s),j(s));let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",S.database),e[0]=i):i=e[0];let h;e[1]!==n||e[2]!==g?(h=()=>{j(!n),N(!g)},e[1]=n,e[2]=g,e[3]=h):h=e[3];let p=`${l}:${r.name}`,d;e[4]===n?d=e[5]:(d=(0,t.jsx)(_e,{isExpanded:n}),e[4]=n,e[5]=d);let m=g&&n?"text-foreground":"text-muted-foreground",u;e[6]===m?u=e[7]:(u=O("h-4 w-4",m),e[6]=m,e[7]=u);let x;e[8]===u?x=e[9]:(x=(0,t.jsx)(le,{className:u}),e[8]=u,e[9]=x);let b=g&&n&&"font-semibold",y;e[10]===b?y=e[11]:(y=O(b),e[10]=b,e[11]=y);let v;e[12]===r.name?v=e[13]:(v=r.name===""?(0,t.jsx)("i",{children:"Not connected"}):r.name,e[12]=r.name,e[13]=v);let w;e[14]!==v||e[15]!==y?(w=(0,t.jsx)("span",{className:y,children:v}),e[14]=v,e[15]=y,e[16]=w):w=e[16];let _;e[17]!==w||e[18]!==h||e[19]!==p||e[20]!==d||e[21]!==x?(_=(0,t.jsxs)(ae,{className:i,onSelect:h,value:p,children:[d,x,w]}),e[17]=w,e[18]=h,e[19]=p,e[20]=d,e[21]=x,e[22]=_):_=e[22];let T=n&&o,k;return e[23]!==_||e[24]!==T?(k=(0,t.jsxs)(t.Fragment,{children:[_,T]}),e[23]=_,e[24]=T,e[25]=k):k=e[25],k},Ka=({schemas:a,defaultSchema:e,defaultDatabase:s,dialect:l,engineName:r,databaseName:o,hasSearch:n,searchValue:j})=>{let{addSchemaList:g}=se(),[N,f]=C.useState(!1),[c,i]=C.useState(!1),{isPending:h,error:p}=oe(async()=>{if(a.length===0&&r&&!N){f(!0),i(!0);try{g({schemas:(await Qe.request({engine:r,database:o})).schemas??[],sqlSchemaContext:{engine:r,database:o}})}finally{i(!1)}}},[a.length,r,o,N]);return h||c?(0,t.jsx)(ce,{message:"Loading schemas...",className:S.schemaLoading}):p?(0,t.jsx)(me,{error:p,className:S.schemaLoading}):a.length===0?(0,t.jsx)(te,{content:"No schemas available",className:S.schemaEmpty}):(0,t.jsx)(t.Fragment,{children:a.filter(d=>j?d.tables.some(m=>m.name.toLowerCase().includes(j.toLowerCase())):!0).map(d=>(0,t.jsx)(Ja,{databaseName:o,schema:d,hasSearch:n,children:(0,t.jsx)(Le,{tables:d.tables,searchValue:j,sqlTableContext:{engine:r,database:o,schema:d.name,defaultSchema:e,defaultDatabase:s,dialect:l}})},d.name))})},Ja=a=>{let e=(0,A.c)(24),{databaseName:s,schema:l,children:r,hasSearch:o}=a,[n,j]=C.useState(o),[g,N]=C.useState(!1),f=`${s}:${l.name}`;if(ue(l.name))return r;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",S.schema),e[0]=c):c=e[0];let i;e[1]!==n||e[2]!==g?(i=()=>{j(!n),N(!g)},e[1]=n,e[2]=g,e[3]=i):i=e[3];let h;e[4]===n?h=e[5]:(h=(0,t.jsx)(_e,{isExpanded:n}),e[4]=n,e[5]=h);let p=g&&n&&"text-foreground",d;e[6]===p?d=e[7]:(d=O("h-4 w-4 text-muted-foreground",p),e[6]=p,e[7]=d);let m;e[8]===d?m=e[9]:(m=(0,t.jsx)(sa,{className:d}),e[8]=d,e[9]=m);let u=g&&n&&"font-semibold",x;e[10]===u?x=e[11]:(x=O(u),e[10]=u,e[11]=x);let b;e[12]!==l.name||e[13]!==x?(b=(0,t.jsx)("span",{className:x,children:l.name}),e[12]=l.name,e[13]=x,e[14]=b):b=e[14];let y;e[15]!==i||e[16]!==h||e[17]!==m||e[18]!==b||e[19]!==f?(y=(0,t.jsxs)(ae,{className:c,onSelect:i,value:f,children:[h,m,b]}),e[15]=i,e[16]=h,e[17]=m,e[18]=b,e[19]=f,e[20]=y):y=e[20];let v=n&&r,w;return e[21]!==y||e[22]!==v?(w=(0,t.jsxs)(t.Fragment,{children:[y,v]}),e[21]=y,e[22]=v,e[23]=w):w=e[23],w},Le=a=>{let e=(0,A.c)(24),{tables:s,sqlTableContext:l,searchValue:r}=a,{addTableList:o}=se(),[n,j]=C.useState(!1),[g,N]=C.useState(!1),f;e[0]!==o||e[1]!==l||e[2]!==s.length||e[3]!==n?(f=async()=>{if(s.length===0&&l&&!n){j(!0),N(!0);let{engine:m,database:u,schema:x}=l,b=await Ae.request({engine:m,database:u,schema:x});if(!(b!=null&&b.tables))throw N(!1),Error("No tables available");o({tables:b.tables,sqlTableContext:l}),N(!1)}},e[0]=o,e[1]=l,e[2]=s.length,e[3]=n,e[4]=f):f=e[4];let c;e[5]!==l||e[6]!==s.length||e[7]!==n?(c=[s.length,l,n],e[5]=l,e[6]=s.length,e[7]=n,e[8]=c):c=e[8];let{isPending:i,error:h}=oe(f,c);if(i||g){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(ce,{message:"Loading tables...",className:S.tableLoading}),e[9]=m):m=e[9],m}if(h){let m;return e[10]===h?m=e[11]:(m=(0,t.jsx)(me,{error:h,className:S.tableLoading}),e[10]=h,e[11]=m),m}if(s.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(te,{content:"No tables found",className:S.tableLoading}),e[12]=m):m=e[12],m}let p;if(e[13]!==r||e[14]!==l||e[15]!==s){let m;e[17]===r?m=e[18]:(m=b=>r?b.name.toLowerCase().includes(r.toLowerCase()):!0,e[17]=r,e[18]=m);let u=s.filter(m),x;e[19]!==r||e[20]!==l?(x=b=>(0,t.jsx)(Xa,{table:b,sqlTableContext:l,isSearching:!!r},b.name),e[19]=r,e[20]=l,e[21]=x):x=e[21],p=u.map(x),e[13]=r,e[14]=l,e[15]=s,e[16]=p}else p=e[16];let d;return e[22]===p?d=e[23]:(d=(0,t.jsx)(t.Fragment,{children:p}),e[22]=p,e[23]=d),d},Xa=a=>{let e=(0,A.c)(64),{table:s,sqlTableContext:l,isSearching:r}=a,{addTable:o}=se(),[n,j]=C.useState(!1),[g,N]=C.useState(!1),f=s.columns.length>0,c;e[0]!==o||e[1]!==n||e[2]!==l||e[3]!==s.name||e[4]!==f||e[5]!==g?(c=async()=>{if(n&&!f&&l&&!g){N(!0);let{engine:D,database:Y,schema:qe}=l,Z=await Oe.request({engine:D,database:Y,schema:qe,tableName:s.name});if(!(Z!=null&&Z.table))throw Error("No table details available");o({table:Z.table,sqlTableContext:l})}},e[0]=o,e[1]=n,e[2]=l,e[3]=s.name,e[4]=f,e[5]=g,e[6]=c):c=e[6];let i;e[7]!==n||e[8]!==f?(i=[n,f],e[7]=n,e[8]=f,e[9]=i):i=e[9];let{isFetching:h,isPending:p,error:d}=oe(c,i),m=K(ra),u=Fa(),{createNewCell:x}=Pe(),b=Ne(),y;e[10]!==b||e[11]!==m||e[12]!==x||e[13]!==u||e[14]!==l||e[15]!==s?(y=()=>{$a({autoInstantiate:m,createNewCell:x,fromCellId:u}),b((()=>{if(s.source_type==="catalog"){let D=l!=null&&l.database?`${l.database}.${s.name}`:s.name;return`${s.engine}.load_table("${D}")`}if(l)return fe({table:s,columnName:"*",sqlTableContext:l});switch(s.source_type){case"local":return`mo.ui.table(${s.name})`;case"duckdb":case"connection":return fe({table:s,columnName:"*",sqlTableContext:l});default:return pa(s.source_type),""}})())},e[10]=b,e[11]=m,e[12]=x,e[13]=u,e[14]=l,e[15]=s,e[16]=y):y=e[16];let v=y,w;e[17]!==s.num_columns||e[18]!==s.num_rows?(w=()=>{let D=[];return s.num_rows!=null&&D.push(`${s.num_rows} rows`),s.num_columns!=null&&D.push(`${s.num_columns} columns`),D.length===0?null:(0,t.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:D.join(", ")})})},e[17]=s.num_columns,e[18]=s.num_rows,e[19]=w):w=e[19];let _=w,T;e[20]!==d||e[21]!==h||e[22]!==p||e[23]!==l||e[24]!==s?(T=()=>{if(p||h)return(0,t.jsx)(ce,{message:"Loading columns...",className:S.tableLoading});if(d)return(0,t.jsx)(me,{error:d,className:S.tableLoading});let D=s.columns;return D.length===0?(0,t.jsx)(te,{content:"No columns found",className:S.tableLoading}):D.map(Y=>(0,t.jsx)(Qa,{table:s,column:Y,sqlTableContext:l},Y.name))},e[20]=d,e[21]=h,e[22]=p,e[23]=l,e[24]=s,e[25]=T):T=e[25];let k=T,q;e[26]!==n||e[27]!==r||e[28]!==s.source_type||e[29]!==s.type?(q=()=>{if(s.source_type!=="local")return(0,t.jsx)(s.type==="table"?aa:na,{className:"h-3 w-3",strokeWidth:n||r?2.5:void 0})},e[26]=n,e[27]=r,e[28]=s.source_type,e[29]=s.type,e[30]=q):q=e[30];let V=q,M=l?`${l.database}.${l.schema}.${s.name}`:s.name,P=l&&(ue(l.schema)?S.tableSchemaless:S.tableWithSchema),E=(n||r)&&"font-semibold",$;e[31]!==P||e[32]!==E?($=O("rounded-none group h-8 cursor-pointer",P,E),e[31]=P,e[32]=E,e[33]=$):$=e[33];let F;e[34]===n?F=e[35]:(F=()=>j(!n),e[34]=n,e[35]=F);let I;e[36]===V?I=e[37]:(I=V(),e[36]=V,e[37]=I);let B;e[38]===s.name?B=e[39]:(B=(0,t.jsx)("span",{className:"text-sm",children:s.name}),e[38]=s.name,e[39]=B);let U;e[40]!==I||e[41]!==B?(U=(0,t.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[I,B]}),e[40]=I,e[41]=B,e[42]=U):U=e[42];let R;e[43]===_?R=e[44]:(R=_(),e[43]=_,e[44]=R);let L;e[45]===v?L=e[46]:(L=xa.stopPropagation(()=>v()),e[45]=v,e[46]=L);let X;e[47]===Symbol.for("react.memo_cache_sentinel")?(X=(0,t.jsx)(ya,{className:"h-3 w-3"}),e[47]=X):X=e[47];let G;e[48]===L?G=e[49]:(G=(0,t.jsx)(re,{content:"Add table to notebook",delayDuration:400,children:(0,t.jsx)(ee,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:L,children:X})}),e[48]=L,e[49]=G);let z;e[50]!==n||e[51]!==F||e[52]!==U||e[53]!==R||e[54]!==G||e[55]!==$||e[56]!==M?(z=(0,t.jsxs)(ae,{className:$,value:M,"aria-selected":n,forceMount:!0,onSelect:F,children:[U,R,G]}),e[50]=n,e[51]=F,e[52]=U,e[53]=R,e[54]=G,e[55]=$,e[56]=M,e[57]=z):z=e[57];let H;e[58]!==n||e[59]!==k?(H=n&&k(),e[58]=n,e[59]=k,e[60]=H):H=e[60];let Q;return e[61]!==z||e[62]!==H?(Q=(0,t.jsxs)(t.Fragment,{children:[z,H]}),e[61]=z,e[62]=H,e[63]=Q):Q=e[63],Q},Qa=a=>{var U,R;let e=(0,A.c)(48),{table:s,column:l,sqlTableContext:r}=a,[o,n]=C.useState(!1),j=K(pe),g=de(Re);j&&o&&n(!1),g(o?L=>new Set([...L,`${s.name}:${l.name}`]):L=>(L.delete(`${s.name}:${l.name}`),new Set(L)));let N=Ne(),{columnsPreviews:f}=We(),c;e[0]!==l.name||e[1]!==s.primary_keys?(c=((U=s.primary_keys)==null?void 0:U.includes(l.name))||!1,e[0]=l.name,e[1]=s.primary_keys,e[2]=c):c=e[2];let i=c,h;e[3]!==l.name||e[4]!==s.indexes?(h=((R=s.indexes)==null?void 0:R.includes(l.name))||!1,e[3]=l.name,e[4]=s.indexes,e[5]=h):h=e[5];let p=h,d;e[6]===N?d=e[7]:(d=L=>{N(L)},e[6]=N,e[7]=d);let m=d,u=Ya,x=o?"font-semibold":"",b;e[8]!==l.name||e[9]!==x?(b=(0,t.jsx)("span",{className:x,children:l.name}),e[8]=l.name,e[9]=x,e[10]=b):b=e[10];let y=b,v=`${s.name}.${l.name}`,w=`${s.name}.${l.name}`,_;e[11]===o?_=e[12]:(_=()=>n(!o),e[11]=o,e[12]=_);let T=r?S.columnSql:S.columnLocal,k;e[13]===T?k=e[14]:(k=O("flex flex-row gap-2 items-center flex-1",T),e[13]=T,e[14]=k);let q;e[15]!==l.type||e[16]!==y?(q=(0,t.jsx)(Ma,{columnName:y,dataType:l.type}),e[15]=l.type,e[16]=y,e[17]=q):q=e[17];let V;e[18]===i?V=e[19]:(V=i&&u({tooltipContent:"Primary key",content:"PK"}),e[18]=i,e[19]=V);let M;e[20]===p?M=e[21]:(M=p&&u({tooltipContent:"Indexed",content:"IDX"}),e[20]=p,e[21]=M);let P;e[22]!==k||e[23]!==q||e[24]!==V||e[25]!==M?(P=(0,t.jsxs)("div",{className:k,children:[q,V,M]}),e[22]=k,e[23]=q,e[24]=V,e[25]=M,e[26]=P):P=e[26];let E;e[27]===l.name?E=e[28]:(E=(0,t.jsx)(re,{content:"Copy column name",delayDuration:400,children:(0,t.jsx)(ee,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,t.jsx)(wa,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[27]=l.name,e[28]=E);let $;e[29]===l.external_type?$=e[30]:($=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[29]=l.external_type,e[30]=$);let F;e[31]!==P||e[32]!==E||e[33]!==$||e[34]!==v||e[35]!==w||e[36]!==_?(F=(0,t.jsxs)(ae,{className:"rounded-none py-1 group cursor-pointer",value:w,onSelect:_,children:[P,E,$]},v),e[31]=P,e[32]=E,e[33]=$,e[34]=v,e[35]=w,e[36]=_,e[37]=F):F=e[37];let I;e[38]!==l||e[39]!==f||e[40]!==m||e[41]!==o||e[42]!==r||e[43]!==s?(I=o&&(0,t.jsx)("div",{className:O(S.columnPreview,"pr-2 py-2 bg-(--slate-1) shadow-inner border-b"),children:(0,t.jsx)(oa,{children:(0,t.jsx)(Na,{table:s,column:l,onAddColumnChart:m,preview:f.get(r?`${r.database}.${r.schema}.${s.name}:${l.name}`:`${s.name}:${l.name}`),sqlTableContext:r})})}),e[38]=l,e[39]=f,e[40]=m,e[41]=o,e[42]=r,e[43]=s,e[44]=I):I=e[44];let B;return e[45]!==F||e[46]!==I?(B=(0,t.jsxs)(t.Fragment,{children:[F,I]}),e[45]=F,e[46]=I,e[47]=B):B=e[47],B};function Ya(a){let{tooltipContent:e,content:s}=a;return(0,t.jsx)(re,{content:e,delayDuration:100,children:(0,t.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:s})})}function hs(a){return a}var W={name:"name",type:"type-value",defs:"defs-refs"},Za=[{id:W.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsx)(Oa,{name:e,declaredBy:s})}},{id:W.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Type"}),(0,t.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsxs)("div",{className:"max-w-[150px]",children:[(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:s??"",children:s})]})}},{id:W.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Declared By"}),(0,t.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,s,l]=a(),r=o=>{let n=ta(o);n&&Ye(n,l)};return(0,t.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,t.jsx)("span",{title:"Declared by",children:(0,t.jsx)(Aa,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,t.jsx)(we,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):(0,t.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((o,n)=>(0,t.jsxs)("span",{className:"flex",children:[(0,t.jsx)(we,{variant:"focus",cellId:o,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(o)},o),n<e.length-1&&", "]},o))})]}),(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,t.jsx)("span",{title:"Used by",children:(0,t.jsx)(va,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,t.jsx)(Ea,{maxCount:3,cellIds:s,skipScroll:!0,onClick:r})]})]})}}];function et({variables:a,sort:e,cellIdToIndex:s}){e||(e={id:W.defs,desc:!1});let l=[];switch(e.id){case W.name:l=J(a,r=>r.name);break;case W.type:l=J(a,r=>r.dataType);break;case W.defs:l=J(a,r=>s.get(r.declaredBy[0]));break}return e.desc?l.toReversed():l}const Te=(0,C.memo)(({className:a,cellIds:e,variables:s})=>{let[l,r]=C.useState([]),[o,n]=C.useState(""),j=He(),{locale:g}=Sa(),N=(0,C.useMemo)(()=>{let c=i=>{let h=j[i];return Je(h)?`cell-${e.indexOf(i)}`:h??`cell-${e.indexOf(i)}`};return Object.values(s).map(i=>({...i,declaredByNames:i.declaredBy.map(c),usedByNames:i.usedBy.map(c)}))},[s,j,e]),f=ha({data:(0,C.useMemo)(()=>{let c=new Map;return e.forEach((i,h)=>c.set(i,h)),et({variables:N,sort:l[0],cellIdToIndex:c})},[N,l,e]),columns:Za,getCoreRowModel:ia(),onGlobalFilterChange:n,getFilteredRowModel:da(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(c){return c.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:g,onSortingChange:r,getSortedRowModel:ua(),state:{sorting:l,globalFilter:o}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ja,{className:"w-full",placeholder:"Search",value:o,onChange:c=>n(c.target.value)}),(0,t.jsxs)(Ba,{className:O("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,t.jsx)(Ia,{children:(0,t.jsx)(Se,{className:"whitespace-nowrap text-xs",children:f.getFlatHeaders().map(c=>(0,t.jsx)(La,{className:"sticky top-0 bg-background border-b",children:je(c.column.columnDef.header,c.getContext())},c.id))})}),(0,t.jsx)(Ta,{children:f.getRowModel().rows.map(c=>(0,t.jsx)(Se,{className:"hover:bg-accent",children:c.getVisibleCells().map(i=>(0,t.jsx)(qa,{className:"border-b",children:je(i.column.columnDef.cell,i.getContext())},i.id))},c.id))})]})]})});Te.displayName="VariableTable";var at=ge(),tt=ze("marimo:session-panel:state",{openSections:["variables"],hasUserInteracted:!1},Ee),st=()=>{let a=(0,at.c)(24),e=Ue(),s=Ge(),l=K(xe),r=K(Ie),[o,n]=Be(tt),j=l.length+r.length,g;a[0]!==j||a[1]!==o.hasUserInteracted||a[2]!==o.openSections?(g=!o.hasUserInteracted&&j>0?[...new Set([...o.openSections,"datasources"])]:o.openSections,a[0]=j,a[1]=o.hasUserInteracted,a[2]=o.openSections,a[3]=g):g=a[3];let N=g,f;a[4]===n?f=a[5]:(f=v=>{n({openSections:v,hasUserInteracted:!0})},a[4]=n,a[5]=f);let c=f,i=!N.includes("datasources")&&j>0,h;a[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)(le,{className:"w-4 h-4"}),a[6]=h):h=a[6];let p;a[7]!==j||a[8]!==i?(p=i&&(0,t.jsx)(Ra,{children:j}),a[7]=j,a[8]=i,a[9]=p):p=a[9];let d;a[10]===p?d=a[11]:(d=(0,t.jsxs)($e,{children:[h,"Data sources",p]}),a[10]=p,a[11]=d);let m;a[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(Fe,{children:(0,t.jsx)(Ga,{})}),a[12]=m):m=a[12];let u;a[13]===d?u=a[14]:(u=(0,t.jsxs)(ke,{value:"datasources",children:[d,m]}),a[13]=d,a[14]=u);let x;a[15]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsxs)($e,{children:[(0,t.jsx)(la,{className:"w-4 h-4"}),"Variables"]}),a[15]=x):x=a[15];let b;a[16]!==s||a[17]!==e?(b=(0,t.jsxs)(ke,{value:"variables",lastItem:!0,children:[x,(0,t.jsx)(Fe,{children:Object.keys(e).length===0?(0,t.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,t.jsx)(Te,{cellIds:s.inOrderIds,variables:e})})]}),a[16]=s,a[17]=e,a[18]=b):b=a[18];let y;return a[19]!==c||a[20]!==N||a[21]!==u||a[22]!==b?(y=(0,t.jsxs)(ca,{type:"multiple",value:N,onValueChange:c,className:"flex flex-col h-full overflow-auto",children:[u,b]}),a[19]=c,a[20]=N,a[21]=u,a[22]=b,a[23]=y):y=a[23],y};export{st as default};
|
|
1
|
+
import{s as ie}from"./chunk-LvLJmgfZ.js";import{d as de,l as Be,p as he,u as K}from"./useEvent-D91BmmQi.js";import{t as De}from"./react-Bj1aDYRI.js";import{Ar as Ve,At as Me,Br as ue,D as Pe,Fn as Ee,Fr as xe,Gt as Oe,In as Ue,Ir as Re,Kt as Ae,Lr as We,M as Ge,Nr as se,Oi as ze,P as He,Pr as pe,Rn as Ke,Rt as Je,Ur as Xe,Vr as fe,Wr as be,Wt as Qe,_n as Ye,a as Ze,ar as ea,cr as aa,f as ta,hr as sa,or as la,vr as na,yr as le}from"./cells-DFP-V6he.js";import"./react-dom-CSu739Rf.js";import{t as ge}from"./compiler-runtime-B3qBwwSJ.js";import{o as ra}from"./utils-Wvjk_Y4h.js";import{t as oa}from"./ErrorBoundary-DyYDV0HI.js";import{t as O}from"./cn-DCUzRj2J.js";import{t as ma}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{n as ca}from"./multi-map-CUuNtzHt.js";import"./popover-Bz_0Vkyf.js";import{B as je,H as ia,U as da,V as ha,W as ua,z as ne}from"./JsonOutput-CGRqyV9u.js";import"./download-PdY73eIa.js";import{r as Ne}from"./radio-group-B-1HJbUZ.js";import{t as re}from"./tooltip-DTV9tlSr.js";import{r as xa,t as ee}from"./button-BbCh-29a.js";import"./dist-BrR4M-k3.js";import{u as J}from"./arrays-DYDL-3-i.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{i as pa}from"./strings-wdPMRf6Z.js";import{r as fa}from"./requests-DIwGYs0l.js";import{t as ba}from"./createLucideIcon-D5guW7EU.js";import{t as ga}from"./x-C-6liIBr.js";import"./markdown-renderer-DyxPYsSd.js";import{t as ye}from"./add-connection-dialog-C2N_XkPg.js";import{t as ve}from"./plus-CxkHs8QM.js";import{a as ja}from"./input-DkSJHlVD.js";import{n as Na,o as ya}from"./column-preview-BjPmiDfN.js";import{t as va}from"./workflow-Bm8qF7yj.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-Cc5BIu1h.js";import{t as wa}from"./copy-icon-OjtDb4gO.js";import{t as Sa}from"./context-QkTujrKn.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{t as we}from"./cell-link-CKjfkiFA.js";import{n as oe}from"./useAsyncData-Bczwgx1s.js";import{a as Ca,o as ae,t as _a,u as ka}from"./command-FM3TtrvZ.js";import"./chunk-5FQGJX7Z-DzaUzyuM.js";import{r as $a}from"./html-to-image-DkwHQ_Qj.js";import{o as Fa}from"./focus-DIIsMOUb.js";import{a as Ia,i as La,n as Ta,o as Se,r as qa,t as Ba}from"./table-Bgc-inJs.js";import"./react-resizable-panels.browser.esm-BdtIs0E-.js";import{n as Da}from"./icons-D7rawFWk.js";import{r as Va}from"./tree-actions-OR_cmYSp.js";import{a as me,i as te,o as ce,r as Ce,s as _e,t as Ma}from"./components-DtZWQLFy.js";import{t as Pa}from"./empty-state-Cjt8SfMh.js";import{n as Ea,t as Oa}from"./common-W-U2rLKH.js";import{a as Ua,i as Ra,n as ke,r as $e,t as Fe}from"./components-BtpZRoDo.js";var Aa=ba("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),A=ge(),C=ie(De(),1),t=ie(ma(),1),S={engineEmpty:"pl-3",engine:"pl-3 pr-2",database:"pl-4",schemaEmpty:"pl-8",schema:"pl-7",schemaLoading:"pl-8",tableLoading:"pl-11",tableSchemaless:"pl-8",tableWithSchema:"pl-12",columnLocal:"pl-5",columnSql:"pl-13",columnPreview:"pl-10"},Wa=he(a=>{let e=a(xe),s=a(Ke),l=a(Ze);return J(e,r=>{if(!r.variable_name)return-1;let o=Object.values(s).find(j=>j.name===r.variable_name);if(!o)return 0;let n=l.inOrderIds.indexOf(o.declaredBy[0]);return n===-1?0:n})});const Ie=he(a=>{let e=new Map(a(Ve));for(let s of be){let l=e.get(s);l&&(l.databases.length===0&&e.delete(s),l.databases.length===1&&l.databases[0].name==="memory"&&l.databases[0].schemas.length===0&&e.delete(s))}return J([...e.values()],s=>be.has(s.name)?1:0)}),Ga=()=>{let a=(0,A.c)(32),[e,s]=C.useState(""),l=de(pe),r=K(Wa),o=K(Ie);if(r.length===0&&o.length===0){let u;return a[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(Pa,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,t.jsx)(ye,{children:(0,t.jsxs)(ee,{variant:"outline",size:"sm",children:["Add database or catalog",(0,t.jsx)(ve,{className:"h-4 w-4 ml-2"})]})}),icon:(0,t.jsx)(le,{})}),a[0]=u):u=a[0],u}let n=!!e.trim(),j;a[1]===l?j=a[2]:(j=u=>{l(u.length>0),s(u)},a[1]=l,a[2]=j);let g;a[3]!==e||a[4]!==j?(g=(0,t.jsx)(Ca,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:j,rootClassName:"flex-1 border-r border-b-0"}),a[3]=e,a[4]=j,a[5]=g):g=a[5];let N;a[6]===n?N=a[7]:(N=n&&(0,t.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>s(""),children:(0,t.jsx)(ga,{className:"h-4 w-4"})}),a[6]=n,a[7]=N);let f;a[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(ye,{children:(0,t.jsx)(ee,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,t.jsx)(ve,{className:"h-4 w-4"})})}),a[8]=f):f=a[8];let c;a[9]!==g||a[10]!==N?(c=(0,t.jsxs)("div",{className:"flex items-center w-full border-b",children:[g,N,f]}),a[9]=g,a[10]=N,a[11]=c):c=a[11];let i;if(a[12]!==o||a[13]!==n||a[14]!==e){let u;a[16]!==n||a[17]!==e?(u=x=>(0,t.jsx)(za,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(b=>(0,t.jsx)(Ha,{engineName:x.name,database:b,hasSearch:n,children:(0,t.jsx)(Ka,{schemas:b.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:b.name,hasSearch:n,searchValue:e,dialect:x.dialect})},b.name))},x.name),a[16]=n,a[17]=e,a[18]=u):u=a[18],i=o.map(u),a[12]=o,a[13]=n,a[14]=e,a[15]=i}else i=a[15];let h;a[19]!==o.length||a[20]!==r.length?(h=o.length>0&&r.length>0&&(0,t.jsxs)(Ce,{className:S.engine,children:[(0,t.jsx)(Da,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-xs",children:"Python"})]}),a[19]=o.length,a[20]=r.length,a[21]=h):h=a[21];let p;a[22]!==e||a[23]!==r?(p=r.length>0&&(0,t.jsx)(Le,{tables:r,searchValue:e}),a[22]=e,a[23]=r,a[24]=p):p=a[24];let d;a[25]!==i||a[26]!==h||a[27]!==p?(d=(0,t.jsxs)(ka,{className:"flex flex-col",children:[i,h,p]}),a[25]=i,a[26]=h,a[27]=p,a[28]=d):d=a[28];let m;return a[29]!==c||a[30]!==d?(m=(0,t.jsxs)(_a,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[c,d]}),a[29]=c,a[30]=d,a[31]=m):m=a[31],m};var za=a=>{let e=(0,A.c)(25),{connection:s,children:l,hasChildren:r}=a,o=s.name===Xe,n=o?"In-Memory":s.name,{previewDataSourceConnection:j}=fa(),g;e[0]!==s.name||e[1]!==j?(g=async()=>{await j({engine:s.name})},e[0]=s.name,e[1]=j,e[2]=g):g=e[2];let N=g,f;e[3]===s.dialect?f=e[4]:(f=(0,t.jsx)(Me,{className:"h-4 w-4 text-muted-foreground",name:s.dialect}),e[3]=s.dialect,e[4]=f);let c;e[5]===s.dialect?c=e[6]:(c=ea(s.dialect),e[5]=s.dialect,e[6]=c);let i;e[7]===c?i=e[8]:(i=(0,t.jsx)("span",{className:"text-xs",children:c}),e[7]=c,e[8]=i);let h=n,p;e[9]===h?p=e[10]:(p=(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,t.jsx)(Ua,{variableName:h}),")"]}),e[9]=h,e[10]=p);let d;e[11]!==N||e[12]!==o?(d=!o&&(0,t.jsx)(Va,{onClick:N,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[11]=N,e[12]=o,e[13]=d):d=e[13];let m;e[14]!==f||e[15]!==i||e[16]!==p||e[17]!==d?(m=(0,t.jsxs)(Ce,{className:S.engine,children:[f,i,p,d]}),e[14]=f,e[15]=i,e[16]=p,e[17]=d,e[18]=m):m=e[18];let u;e[19]!==l||e[20]!==r?(u=r?l:(0,t.jsx)(te,{content:"No databases available",className:S.engineEmpty}),e[19]=l,e[20]=r,e[21]=u):u=e[21];let x;return e[22]!==m||e[23]!==u?(x=(0,t.jsxs)(t.Fragment,{children:[m,u]}),e[22]=m,e[23]=u,e[24]=x):x=e[24],x},Ha=a=>{let e=(0,A.c)(26),{hasSearch:s,engineName:l,database:r,children:o}=a,[n,j]=C.useState(!1),[g,N]=C.useState(!1),[f,c]=C.useState(s);f!==s&&(c(s),j(s));let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",S.database),e[0]=i):i=e[0];let h;e[1]!==n||e[2]!==g?(h=()=>{j(!n),N(!g)},e[1]=n,e[2]=g,e[3]=h):h=e[3];let p=`${l}:${r.name}`,d;e[4]===n?d=e[5]:(d=(0,t.jsx)(_e,{isExpanded:n}),e[4]=n,e[5]=d);let m=g&&n?"text-foreground":"text-muted-foreground",u;e[6]===m?u=e[7]:(u=O("h-4 w-4",m),e[6]=m,e[7]=u);let x;e[8]===u?x=e[9]:(x=(0,t.jsx)(le,{className:u}),e[8]=u,e[9]=x);let b=g&&n&&"font-semibold",y;e[10]===b?y=e[11]:(y=O(b),e[10]=b,e[11]=y);let v;e[12]===r.name?v=e[13]:(v=r.name===""?(0,t.jsx)("i",{children:"Not connected"}):r.name,e[12]=r.name,e[13]=v);let w;e[14]!==v||e[15]!==y?(w=(0,t.jsx)("span",{className:y,children:v}),e[14]=v,e[15]=y,e[16]=w):w=e[16];let _;e[17]!==w||e[18]!==h||e[19]!==p||e[20]!==d||e[21]!==x?(_=(0,t.jsxs)(ae,{className:i,onSelect:h,value:p,children:[d,x,w]}),e[17]=w,e[18]=h,e[19]=p,e[20]=d,e[21]=x,e[22]=_):_=e[22];let T=n&&o,k;return e[23]!==_||e[24]!==T?(k=(0,t.jsxs)(t.Fragment,{children:[_,T]}),e[23]=_,e[24]=T,e[25]=k):k=e[25],k},Ka=({schemas:a,defaultSchema:e,defaultDatabase:s,dialect:l,engineName:r,databaseName:o,hasSearch:n,searchValue:j})=>{let{addSchemaList:g}=se(),[N,f]=C.useState(!1),[c,i]=C.useState(!1),{isPending:h,error:p}=oe(async()=>{if(a.length===0&&r&&!N){f(!0),i(!0);try{g({schemas:(await Qe.request({engine:r,database:o})).schemas??[],sqlSchemaContext:{engine:r,database:o}})}finally{i(!1)}}},[a.length,r,o,N]);return h||c?(0,t.jsx)(ce,{message:"Loading schemas...",className:S.schemaLoading}):p?(0,t.jsx)(me,{error:p,className:S.schemaLoading}):a.length===0?(0,t.jsx)(te,{content:"No schemas available",className:S.schemaEmpty}):(0,t.jsx)(t.Fragment,{children:a.filter(d=>j?d.tables.some(m=>m.name.toLowerCase().includes(j.toLowerCase())):!0).map(d=>(0,t.jsx)(Ja,{databaseName:o,schema:d,hasSearch:n,children:(0,t.jsx)(Le,{tables:d.tables,searchValue:j,sqlTableContext:{engine:r,database:o,schema:d.name,defaultSchema:e,defaultDatabase:s,dialect:l}})},d.name))})},Ja=a=>{let e=(0,A.c)(24),{databaseName:s,schema:l,children:r,hasSearch:o}=a,[n,j]=C.useState(o),[g,N]=C.useState(!1),f=`${s}:${l.name}`;if(ue(l.name))return r;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",S.schema),e[0]=c):c=e[0];let i;e[1]!==n||e[2]!==g?(i=()=>{j(!n),N(!g)},e[1]=n,e[2]=g,e[3]=i):i=e[3];let h;e[4]===n?h=e[5]:(h=(0,t.jsx)(_e,{isExpanded:n}),e[4]=n,e[5]=h);let p=g&&n&&"text-foreground",d;e[6]===p?d=e[7]:(d=O("h-4 w-4 text-muted-foreground",p),e[6]=p,e[7]=d);let m;e[8]===d?m=e[9]:(m=(0,t.jsx)(sa,{className:d}),e[8]=d,e[9]=m);let u=g&&n&&"font-semibold",x;e[10]===u?x=e[11]:(x=O(u),e[10]=u,e[11]=x);let b;e[12]!==l.name||e[13]!==x?(b=(0,t.jsx)("span",{className:x,children:l.name}),e[12]=l.name,e[13]=x,e[14]=b):b=e[14];let y;e[15]!==i||e[16]!==h||e[17]!==m||e[18]!==b||e[19]!==f?(y=(0,t.jsxs)(ae,{className:c,onSelect:i,value:f,children:[h,m,b]}),e[15]=i,e[16]=h,e[17]=m,e[18]=b,e[19]=f,e[20]=y):y=e[20];let v=n&&r,w;return e[21]!==y||e[22]!==v?(w=(0,t.jsxs)(t.Fragment,{children:[y,v]}),e[21]=y,e[22]=v,e[23]=w):w=e[23],w},Le=a=>{let e=(0,A.c)(24),{tables:s,sqlTableContext:l,searchValue:r}=a,{addTableList:o}=se(),[n,j]=C.useState(!1),[g,N]=C.useState(!1),f;e[0]!==o||e[1]!==l||e[2]!==s.length||e[3]!==n?(f=async()=>{if(s.length===0&&l&&!n){j(!0),N(!0);let{engine:m,database:u,schema:x}=l,b=await Ae.request({engine:m,database:u,schema:x});if(!(b!=null&&b.tables))throw N(!1),Error("No tables available");o({tables:b.tables,sqlTableContext:l}),N(!1)}},e[0]=o,e[1]=l,e[2]=s.length,e[3]=n,e[4]=f):f=e[4];let c;e[5]!==l||e[6]!==s.length||e[7]!==n?(c=[s.length,l,n],e[5]=l,e[6]=s.length,e[7]=n,e[8]=c):c=e[8];let{isPending:i,error:h}=oe(f,c);if(i||g){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(ce,{message:"Loading tables...",className:S.tableLoading}),e[9]=m):m=e[9],m}if(h){let m;return e[10]===h?m=e[11]:(m=(0,t.jsx)(me,{error:h,className:S.tableLoading}),e[10]=h,e[11]=m),m}if(s.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(te,{content:"No tables found",className:S.tableLoading}),e[12]=m):m=e[12],m}let p;if(e[13]!==r||e[14]!==l||e[15]!==s){let m;e[17]===r?m=e[18]:(m=b=>r?b.name.toLowerCase().includes(r.toLowerCase()):!0,e[17]=r,e[18]=m);let u=s.filter(m),x;e[19]!==r||e[20]!==l?(x=b=>(0,t.jsx)(Xa,{table:b,sqlTableContext:l,isSearching:!!r},b.name),e[19]=r,e[20]=l,e[21]=x):x=e[21],p=u.map(x),e[13]=r,e[14]=l,e[15]=s,e[16]=p}else p=e[16];let d;return e[22]===p?d=e[23]:(d=(0,t.jsx)(t.Fragment,{children:p}),e[22]=p,e[23]=d),d},Xa=a=>{let e=(0,A.c)(64),{table:s,sqlTableContext:l,isSearching:r}=a,{addTable:o}=se(),[n,j]=C.useState(!1),[g,N]=C.useState(!1),f=s.columns.length>0,c;e[0]!==o||e[1]!==n||e[2]!==l||e[3]!==s.name||e[4]!==f||e[5]!==g?(c=async()=>{if(n&&!f&&l&&!g){N(!0);let{engine:D,database:Y,schema:qe}=l,Z=await Oe.request({engine:D,database:Y,schema:qe,tableName:s.name});if(!(Z!=null&&Z.table))throw Error("No table details available");o({table:Z.table,sqlTableContext:l})}},e[0]=o,e[1]=n,e[2]=l,e[3]=s.name,e[4]=f,e[5]=g,e[6]=c):c=e[6];let i;e[7]!==n||e[8]!==f?(i=[n,f],e[7]=n,e[8]=f,e[9]=i):i=e[9];let{isFetching:h,isPending:p,error:d}=oe(c,i),m=K(ra),u=Fa(),{createNewCell:x}=Pe(),b=Ne(),y;e[10]!==b||e[11]!==m||e[12]!==x||e[13]!==u||e[14]!==l||e[15]!==s?(y=()=>{$a({autoInstantiate:m,createNewCell:x,fromCellId:u}),b((()=>{if(s.source_type==="catalog"){let D=l!=null&&l.database?`${l.database}.${s.name}`:s.name;return`${s.engine}.load_table("${D}")`}if(l)return fe({table:s,columnName:"*",sqlTableContext:l});switch(s.source_type){case"local":return`mo.ui.table(${s.name})`;case"duckdb":case"connection":return fe({table:s,columnName:"*",sqlTableContext:l});default:return pa(s.source_type),""}})())},e[10]=b,e[11]=m,e[12]=x,e[13]=u,e[14]=l,e[15]=s,e[16]=y):y=e[16];let v=y,w;e[17]!==s.num_columns||e[18]!==s.num_rows?(w=()=>{let D=[];return s.num_rows!=null&&D.push(`${s.num_rows} rows`),s.num_columns!=null&&D.push(`${s.num_columns} columns`),D.length===0?null:(0,t.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:D.join(", ")})})},e[17]=s.num_columns,e[18]=s.num_rows,e[19]=w):w=e[19];let _=w,T;e[20]!==d||e[21]!==h||e[22]!==p||e[23]!==l||e[24]!==s?(T=()=>{if(p||h)return(0,t.jsx)(ce,{message:"Loading columns...",className:S.tableLoading});if(d)return(0,t.jsx)(me,{error:d,className:S.tableLoading});let D=s.columns;return D.length===0?(0,t.jsx)(te,{content:"No columns found",className:S.tableLoading}):D.map(Y=>(0,t.jsx)(Qa,{table:s,column:Y,sqlTableContext:l},Y.name))},e[20]=d,e[21]=h,e[22]=p,e[23]=l,e[24]=s,e[25]=T):T=e[25];let k=T,q;e[26]!==n||e[27]!==r||e[28]!==s.source_type||e[29]!==s.type?(q=()=>{if(s.source_type!=="local")return(0,t.jsx)(s.type==="table"?aa:na,{className:"h-3 w-3",strokeWidth:n||r?2.5:void 0})},e[26]=n,e[27]=r,e[28]=s.source_type,e[29]=s.type,e[30]=q):q=e[30];let V=q,M=l?`${l.database}.${l.schema}.${s.name}`:s.name,P=l&&(ue(l.schema)?S.tableSchemaless:S.tableWithSchema),E=(n||r)&&"font-semibold",$;e[31]!==P||e[32]!==E?($=O("rounded-none group h-8 cursor-pointer",P,E),e[31]=P,e[32]=E,e[33]=$):$=e[33];let F;e[34]===n?F=e[35]:(F=()=>j(!n),e[34]=n,e[35]=F);let I;e[36]===V?I=e[37]:(I=V(),e[36]=V,e[37]=I);let B;e[38]===s.name?B=e[39]:(B=(0,t.jsx)("span",{className:"text-sm",children:s.name}),e[38]=s.name,e[39]=B);let U;e[40]!==I||e[41]!==B?(U=(0,t.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[I,B]}),e[40]=I,e[41]=B,e[42]=U):U=e[42];let R;e[43]===_?R=e[44]:(R=_(),e[43]=_,e[44]=R);let L;e[45]===v?L=e[46]:(L=xa.stopPropagation(()=>v()),e[45]=v,e[46]=L);let X;e[47]===Symbol.for("react.memo_cache_sentinel")?(X=(0,t.jsx)(ya,{className:"h-3 w-3"}),e[47]=X):X=e[47];let G;e[48]===L?G=e[49]:(G=(0,t.jsx)(re,{content:"Add table to notebook",delayDuration:400,children:(0,t.jsx)(ee,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:L,children:X})}),e[48]=L,e[49]=G);let z;e[50]!==n||e[51]!==F||e[52]!==U||e[53]!==R||e[54]!==G||e[55]!==$||e[56]!==M?(z=(0,t.jsxs)(ae,{className:$,value:M,"aria-selected":n,forceMount:!0,onSelect:F,children:[U,R,G]}),e[50]=n,e[51]=F,e[52]=U,e[53]=R,e[54]=G,e[55]=$,e[56]=M,e[57]=z):z=e[57];let H;e[58]!==n||e[59]!==k?(H=n&&k(),e[58]=n,e[59]=k,e[60]=H):H=e[60];let Q;return e[61]!==z||e[62]!==H?(Q=(0,t.jsxs)(t.Fragment,{children:[z,H]}),e[61]=z,e[62]=H,e[63]=Q):Q=e[63],Q},Qa=a=>{var U,R;let e=(0,A.c)(48),{table:s,column:l,sqlTableContext:r}=a,[o,n]=C.useState(!1),j=K(pe),g=de(Re);j&&o&&n(!1),g(o?L=>new Set([...L,`${s.name}:${l.name}`]):L=>(L.delete(`${s.name}:${l.name}`),new Set(L)));let N=Ne(),{columnsPreviews:f}=We(),c;e[0]!==l.name||e[1]!==s.primary_keys?(c=((U=s.primary_keys)==null?void 0:U.includes(l.name))||!1,e[0]=l.name,e[1]=s.primary_keys,e[2]=c):c=e[2];let i=c,h;e[3]!==l.name||e[4]!==s.indexes?(h=((R=s.indexes)==null?void 0:R.includes(l.name))||!1,e[3]=l.name,e[4]=s.indexes,e[5]=h):h=e[5];let p=h,d;e[6]===N?d=e[7]:(d=L=>{N(L)},e[6]=N,e[7]=d);let m=d,u=Ya,x=o?"font-semibold":"",b;e[8]!==l.name||e[9]!==x?(b=(0,t.jsx)("span",{className:x,children:l.name}),e[8]=l.name,e[9]=x,e[10]=b):b=e[10];let y=b,v=`${s.name}.${l.name}`,w=`${s.name}.${l.name}`,_;e[11]===o?_=e[12]:(_=()=>n(!o),e[11]=o,e[12]=_);let T=r?S.columnSql:S.columnLocal,k;e[13]===T?k=e[14]:(k=O("flex flex-row gap-2 items-center flex-1",T),e[13]=T,e[14]=k);let q;e[15]!==l.type||e[16]!==y?(q=(0,t.jsx)(Ma,{columnName:y,dataType:l.type}),e[15]=l.type,e[16]=y,e[17]=q):q=e[17];let V;e[18]===i?V=e[19]:(V=i&&u({tooltipContent:"Primary key",content:"PK"}),e[18]=i,e[19]=V);let M;e[20]===p?M=e[21]:(M=p&&u({tooltipContent:"Indexed",content:"IDX"}),e[20]=p,e[21]=M);let P;e[22]!==k||e[23]!==q||e[24]!==V||e[25]!==M?(P=(0,t.jsxs)("div",{className:k,children:[q,V,M]}),e[22]=k,e[23]=q,e[24]=V,e[25]=M,e[26]=P):P=e[26];let E;e[27]===l.name?E=e[28]:(E=(0,t.jsx)(re,{content:"Copy column name",delayDuration:400,children:(0,t.jsx)(ee,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,t.jsx)(wa,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[27]=l.name,e[28]=E);let $;e[29]===l.external_type?$=e[30]:($=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[29]=l.external_type,e[30]=$);let F;e[31]!==P||e[32]!==E||e[33]!==$||e[34]!==v||e[35]!==w||e[36]!==_?(F=(0,t.jsxs)(ae,{className:"rounded-none py-1 group cursor-pointer",value:w,onSelect:_,children:[P,E,$]},v),e[31]=P,e[32]=E,e[33]=$,e[34]=v,e[35]=w,e[36]=_,e[37]=F):F=e[37];let I;e[38]!==l||e[39]!==f||e[40]!==m||e[41]!==o||e[42]!==r||e[43]!==s?(I=o&&(0,t.jsx)("div",{className:O(S.columnPreview,"pr-2 py-2 bg-(--slate-1) shadow-inner border-b"),children:(0,t.jsx)(oa,{children:(0,t.jsx)(Na,{table:s,column:l,onAddColumnChart:m,preview:f.get(r?`${r.database}.${r.schema}.${s.name}:${l.name}`:`${s.name}:${l.name}`),sqlTableContext:r})})}),e[38]=l,e[39]=f,e[40]=m,e[41]=o,e[42]=r,e[43]=s,e[44]=I):I=e[44];let B;return e[45]!==F||e[46]!==I?(B=(0,t.jsxs)(t.Fragment,{children:[F,I]}),e[45]=F,e[46]=I,e[47]=B):B=e[47],B};function Ya(a){let{tooltipContent:e,content:s}=a;return(0,t.jsx)(re,{content:e,delayDuration:100,children:(0,t.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:s})})}function hs(a){return a}var W={name:"name",type:"type-value",defs:"defs-refs"},Za=[{id:W.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsx)(Oa,{name:e,declaredBy:s})}},{id:W.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Type"}),(0,t.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsxs)("div",{className:"max-w-[150px]",children:[(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:s??"",children:s})]})}},{id:W.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Declared By"}),(0,t.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,s,l]=a(),r=o=>{let n=ta(o);n&&Ye(n,l)};return(0,t.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,t.jsx)("span",{title:"Declared by",children:(0,t.jsx)(Aa,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,t.jsx)(we,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):(0,t.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((o,n)=>(0,t.jsxs)("span",{className:"flex",children:[(0,t.jsx)(we,{variant:"focus",cellId:o,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(o)},o),n<e.length-1&&", "]},o))})]}),(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,t.jsx)("span",{title:"Used by",children:(0,t.jsx)(va,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,t.jsx)(Ea,{maxCount:3,cellIds:s,skipScroll:!0,onClick:r})]})]})}}];function et({variables:a,sort:e,cellIdToIndex:s}){e||(e={id:W.defs,desc:!1});let l=[];switch(e.id){case W.name:l=J(a,r=>r.name);break;case W.type:l=J(a,r=>r.dataType);break;case W.defs:l=J(a,r=>s.get(r.declaredBy[0]));break}return e.desc?l.toReversed():l}const Te=(0,C.memo)(({className:a,cellIds:e,variables:s})=>{let[l,r]=C.useState([]),[o,n]=C.useState(""),j=He(),{locale:g}=Sa(),N=(0,C.useMemo)(()=>{let c=i=>{let h=j[i];return Je(h)?`cell-${e.indexOf(i)}`:h??`cell-${e.indexOf(i)}`};return Object.values(s).map(i=>({...i,declaredByNames:i.declaredBy.map(c),usedByNames:i.usedBy.map(c)}))},[s,j,e]),f=ha({data:(0,C.useMemo)(()=>{let c=new Map;return e.forEach((i,h)=>c.set(i,h)),et({variables:N,sort:l[0],cellIdToIndex:c})},[N,l,e]),columns:Za,getCoreRowModel:ia(),onGlobalFilterChange:n,getFilteredRowModel:da(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(c){return c.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:g,onSortingChange:r,getSortedRowModel:ua(),state:{sorting:l,globalFilter:o}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ja,{className:"w-full",placeholder:"Search",value:o,onChange:c=>n(c.target.value)}),(0,t.jsxs)(Ba,{className:O("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,t.jsx)(Ia,{children:(0,t.jsx)(Se,{className:"whitespace-nowrap text-xs",children:f.getFlatHeaders().map(c=>(0,t.jsx)(La,{className:"sticky top-0 bg-background border-b",children:je(c.column.columnDef.header,c.getContext())},c.id))})}),(0,t.jsx)(Ta,{children:f.getRowModel().rows.map(c=>(0,t.jsx)(Se,{className:"hover:bg-accent",children:c.getVisibleCells().map(i=>(0,t.jsx)(qa,{className:"border-b",children:je(i.column.columnDef.cell,i.getContext())},i.id))},c.id))})]})]})});Te.displayName="VariableTable";var at=ge(),tt=ze("marimo:session-panel:state",{openSections:["variables"],hasUserInteracted:!1},Ee),st=()=>{let a=(0,at.c)(24),e=Ue(),s=Ge(),l=K(xe),r=K(Ie),[o,n]=Be(tt),j=l.length+r.length,g;a[0]!==j||a[1]!==o.hasUserInteracted||a[2]!==o.openSections?(g=!o.hasUserInteracted&&j>0?[...new Set([...o.openSections,"datasources"])]:o.openSections,a[0]=j,a[1]=o.hasUserInteracted,a[2]=o.openSections,a[3]=g):g=a[3];let N=g,f;a[4]===n?f=a[5]:(f=v=>{n({openSections:v,hasUserInteracted:!0})},a[4]=n,a[5]=f);let c=f,i=!N.includes("datasources")&&j>0,h;a[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)(le,{className:"w-4 h-4"}),a[6]=h):h=a[6];let p;a[7]!==j||a[8]!==i?(p=i&&(0,t.jsx)(Ra,{children:j}),a[7]=j,a[8]=i,a[9]=p):p=a[9];let d;a[10]===p?d=a[11]:(d=(0,t.jsxs)($e,{children:[h,"Data sources",p]}),a[10]=p,a[11]=d);let m;a[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(Fe,{children:(0,t.jsx)(Ga,{})}),a[12]=m):m=a[12];let u;a[13]===d?u=a[14]:(u=(0,t.jsxs)(ke,{value:"datasources",children:[d,m]}),a[13]=d,a[14]=u);let x;a[15]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsxs)($e,{children:[(0,t.jsx)(la,{className:"w-4 h-4"}),"Variables"]}),a[15]=x):x=a[15];let b;a[16]!==s||a[17]!==e?(b=(0,t.jsxs)(ke,{value:"variables",lastItem:!0,children:[x,(0,t.jsx)(Fe,{children:Object.keys(e).length===0?(0,t.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,t.jsx)(Te,{cellIds:s.inOrderIds,variables:e})})]}),a[16]=s,a[17]=e,a[18]=b):b=a[18];let y;return a[19]!==c||a[20]!==N||a[21]!==u||a[22]!==b?(y=(0,t.jsxs)(ca,{type:"multiple",value:N,onValueChange:c,className:"flex flex-col h-full overflow-auto",children:[u,b]}),a[19]=c,a[20]=N,a[21]=u,a[22]=b,a[23]=y):y=a[23],y};export{st as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as We}from"./chunk-LvLJmgfZ.js";import{d as $,l as mt,p as pt,u as ae}from"./useEvent-D91BmmQi.js";import{t as ut}from"./react-Bj1aDYRI.js";import{D as _e,Dn as ft,Dr as xt,E as yt,Ii as fe,Mn as bt,On as kt,Sr as wt,Yr as jt,Zt as gt,_ as vt,_r as Ct,ct as zt,h as Me,kn as Wt,st as _t,t as Mt,ut as Ne,yr as Nt}from"./cells-DFP-V6he.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as St,x as Dt}from"./ai-model-dropdown-BNBl1Zqz.js";import{_ as H,d as Se}from"./useEventListener-DvoEXWke.js";import{y as Pt}from"./utils-Wvjk_Y4h.js";import{n as S,t as De}from"./constants-DMpttj8Q.js";import{T as oe,n as At,o as It,v as Lt,w as Et}from"./config-DzkFE_hx.js";import{n as Tt}from"./switch-C4flmwHC.js";import{t as Rt}from"./jsx-runtime-BqBOg78p.js";import{o as $t}from"./alert-dialog-BqFLkbUc.js";import{a as Ht,c as xe,o as ye,s as qt}from"./popover-Bz_0Vkyf.js";import{a as Ot,c as Bt,i as Ft,n as Ut,r as Yt,s as Vt,t as Kt}from"./select-DZcFyKFQ.js";import{_t as Gt}from"./JsonOutput-DPTx4W3_.js";import{c as Pe,d as be,n as Jt,o as Zt,r as ke,t as Qt}from"./download-PdY73eIa.js";import{t as Ae}from"./tooltip-DTV9tlSr.js";import{r as Ie,t as q}from"./button-BbCh-29a.js";import{i as Xt,r as ea,t as Le}from"./strings-wdPMRf6Z.js";import{r as O}from"./requests-DIwGYs0l.js";import{t as g}from"./createLucideIcon-D5guW7EU.js";import{F as ta,I as aa,L as Ee,P as oa,R as na,a as Te,i as Re,u as $e}from"./layout-Cb_Fr_ha.js";import{t as we}from"./check-BH35Ndha.js";import{r as sa}from"./useCellActionButton-DB5AiJOa.js";import{t as He}from"./copy-BwrPA9zQ.js";import{t as la}from"./external-link-BTNxSavU.js";import{t as ia}from"./eye-off-BT-KOYV5.js";import{t as ne}from"./file-HTLbeC2b.js";import{t as ra}from"./github-raQvpeuZ.js";import{u as da}from"./form-CvdGBYia.js";import{n as ca,r as ha,t as ma}from"./youtube-3lRHw8NU.js";import{i as pa,n as qe}from"./add-connection-dialog-CDimGa9X.js";import{t as ua}from"./house-D2ldnAB9.js";import{t as fa}from"./image-BIibSXT6.js";import{t as xa}from"./link-CoJxTwWE.js";import{r as ya}from"./input-DkSJHlVD.js";import{t as ba}from"./settings-SnYErNWQ.js";import{t as ka}from"./sparkles-CC9Bko6a.js";import{y as wa}from"./textarea-DQ04jSpC.js";import{t as ja}from"./square-B5xWCt0a.js";import{t as D}from"./use-toast-IPAtJGea.js";import{n as Oe,t as ga}from"./paths-D5zczhUD.js";import{o as va}from"./session-0B5NBztP.js";import{n as B}from"./copy-LK56fFow.js";import{r as Ca}from"./useRunCells-YtfQa1U2.js";import{a as Be,c as Fe,i as Ue,n as Ye,r as Ve}from"./dialog-DzC_QCtT.js";import{n as je}from"./ImperativeModal-DMLPabMc.js";import{r as za,t as Ke}from"./share-DMwTZOTH.js";import{a as Wa}from"./cell-link-CKjfkiFA.js";import{a as _a}from"./renderShortcut-DpuO8OzB.js";import{t as Ma}from"./icons-D7rawFWk.js";import{n as Ge}from"./marimo-icons-CcDNGIRM.js";import{t as Na}from"./links-DguLoFik.js";import{r as Sa,t as Je}from"./hooks-cC9mPQOU.js";import{t as Ze}from"./types-iYXk7c05.js";var Da=g("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Pa=g("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Qe=g("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"}]]),Xe=g("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"}]]),et=g("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"}]]),Aa=g("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"}]]),Ia=g("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"}]]),La=g("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"}]]),Ea=g("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ta=g("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),tt=g("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"}]]),Ra=g("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"}]]),$a=g("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"}]]),at=g("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"}]]),ge=N(),P=We(ut(),1),a=We(Rt(),1);function Ha(){return"uvx marimo@latest"}function qa(t,e,n){let o=n?" --with-token":"",s=`${Ha()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode --prompt "$(${s} --opencode)"`;default:ea(t)}}function Oa(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var Ba="npx skills add marimo-team/marimo-pair";function Fa(){let t=(0,ge.c)(2),[e,n]=(0,P.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(At("/auth/token").href,{headers:Tt.headers()}).then(Ua).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,P.useEffect)(o,s),e}function Ua(t){return t.ok?t.json():null}const Ya=t=>{let e=(0,ge.c)(32),{onClose:n}=t,[o,s]=(0,P.useState)("claude"),r=It(),i=Fa(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=qa(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Fe,{children:"Pair with an agent"}),e[4]=p):p=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(Be,{children:[p,(0,a.jsxs)(Ve,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=u):u=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(F,{command:Ba})]}),e[6]=h):h=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=f):f=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=M=>s(M),e[8]=x):x=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsxs)(qt,{className:"w-full",children:[(0,a.jsx)(xe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(xe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(xe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=k):k=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(ye,{value:"claude",className:"mt-3",children:(0,a.jsx)(F,{command:c})}),e[10]=c,e[11]=y);let b;e[12]===c?b=e[13]:(b=(0,a.jsx)(ye,{value:"codex",className:"mt-3",children:(0,a.jsx)(F,{command:c})}),e[12]=c,e[13]=b);let w;e[14]===c?w=e[15]:(w=(0,a.jsx)(ye,{value:"opencode",className:"mt-3",children:(0,a.jsx)(F,{command:c})}),e[14]=c,e[15]=w);let j;e[16]!==o||e[17]!==w||e[18]!==y||e[19]!==b?(j=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[f,(0,a.jsxs)(Ht,{value:o,onValueChange:x,children:[k,y,b,w]})]}),e[16]=o,e[17]=w,e[18]=y,e[19]=b,e[20]=j):j=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(F,{command:i,display:Oa(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==j||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,j,z]}),e[24]=j,e[25]=z,e[26]=v):v=e[26];let W;e[27]===n?W=e[28]:(W=(0,a.jsx)(Ue,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=W);let _;return e[29]!==v||e[30]!==W?(_=(0,a.jsxs)(Ye,{className:"sm:max-w-lg",children:[u,v,W]}),e[29]=v,e[30]=W,e[31]=_):_=e[31],_};var F=t=>{let e=(0,ge.c)(15),{command:n,display:o}=t,[s,r]=(0,P.useState)(!1),i;e[0]===n?i=e[1]:(i=Ie.stopPropagation(async x=>{x.preventDefault(),await B(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let p;e[4]===s?p=e[5]:(p=s?(0,a.jsx)(we,{size:14,strokeWidth:1.5}):(0,a.jsx)(He,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=p);let u;e[6]!==l||e[7]!==p?(u=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:p}),e[6]=l,e[7]=p,e[8]=u):u=e[8];let h;e[9]!==s||e[10]!==u?(h=(0,a.jsx)(Ae,{content:"Copied!",open:s,children:u}),e[9]=s,e[10]=u,e[11]=h):h=e[11];let f;return e[12]!==c||e[13]!==h?(f=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=f):f=e[14],f},ot=N(),se="https://static.marimo.app";const Va=t=>{let e=(0,ot.c)(25),{onClose:n}=t,[o,s]=(0,P.useState)(""),{exportAsHTML:r}=O(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${se}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async j=>{j.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:oa.INSTANCE.filenames()}),v=D({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${se}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),D({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:S.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),D({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Fe,{children:"Share static notebook"}),e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Ve,{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:se,target:"_blank",children:se}),"."]})]}),e[5]=p):p=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=j=>{s(j.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=u):u=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(ya,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let f;e[9]===l?f=e[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)(Ka,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=f);let x;e[11]!==h||e[12]!==f?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,f]}),e[11]=h,e[12]=f,e[13]=x):x=e[13];let k;e[14]===n?k=e[15]:(k=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=k);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await B(l)},children:"Create"}),e[16]=l,e[17]=y);let b;e[18]!==k||e[19]!==y?(b=(0,a.jsxs)(Ue,{children:[k,y]}),e[18]=k,e[19]=y,e[20]=b):b=e[20];let w;return e[21]!==d||e[22]!==b||e[23]!==x?(w=(0,a.jsx)(Ye,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[p,x,b]})}),e[21]=d,e[22]=b,e[23]=x,e[24]=w):w=e[24],w};var Ka=t=>{let e=(0,ot.c)(8),[n,o]=P.useState(!1),s;e[0]===t.text?s=e[1]:(s=Ie.stopPropagation(async c=>{c.preventDefault(),await B(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(He,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Ae,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Ga=N();function Ja(){let t=document.getElementsByClassName(De.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=fe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:fe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Za(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(fe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${De.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function nt(){let t=(0,Ga.c)(2),e=$(Ne),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ja();e(s=>({mode:zt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Za(o)})})},t[0]=e,t[1]=n),n}const st=pt(!1);var Qa=N();const Xa=()=>{let t=(0,Qa.c)(7),{selectedLayout:e}=Te(),{setLayoutView:n}=Re();if(oe()&&!bt("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Vt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Bt,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Ut,{children:(0,a.jsxs)(Yt,{children:[(0,a.jsx)(Ot,{children:"View as"}),Ze.map(to)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Kt,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function eo(t){return(0,a.jsx)(lt(t),{className:"h-4 w-4"})}function lt(t){switch(t){case"vertical":return La;case"grid":return ha;case"slides":return tt;default:return Xt(t),ja}}function it(t){return Le.startCase(t)}function to(t){return(0,a.jsx)(Ft,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[eo(t),(0,a.jsx)("span",{children:it(t)})]})},t)}async function ao(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var oo=N();function no(t){let e=(0,oo.c)(5),{openPrompt:n,closeModal:o}=je(),{sendCopy:s}=O(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ga.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Oe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(Oe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),D({title:"Notebook copied",description:"A copy of the notebook has been created."}),Na(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const so=()=>{let{updateCellConfig:t}=_e(),{saveCellConfig:e}=O();return(0,P.useCallback)(async()=>{let n=new gt,o=Me(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Se.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var lo=N();function rt(){let t=(0,lo.c)(4),{openConfirm:e}=je(),n=$(Lt),{sendRestart:o}=O(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)($t,{onClick:async()=>{n({state:Et.CLOSING}),await o(),za()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var io=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function ro(){var Ce,ze;let t=(0,io.c)(52),e=Wa(),{openModal:n,closeModal:o}=je(),{toggleApplication:s}=ft(),{selectedPanel:r}=kt(),[i]=mt(Ne),l=ae(_t),d=so(),[c]=Pt(),{updateCellConfig:p,undoDeleteCell:u,clearAllCellOutputs:h,addSetupCellIfDoesntExist:f,collapseAllCells:x,expandAllCells:k}=_e(),y=rt(),b=Ca(),w=no(e),j=$(st),z=$(St),v=$(Dt),{exportAsIPYNB:W,exportAsMarkdown:_,readCode:M,saveCellConfig:ie,updateCellOutputs:A}=O(),I=Sa(),re=ae(vt),de=ae(Mt),ce=ae(yt),{selectedLayout:U}=Te(),{setLayoutView:he}=Re(),Y=nt(),V=((Ce=c.sharing)==null?void 0:Ce.html)??!0,K=((ze=c.sharing)==null?void 0:ze.wasm)??!0,ve=!oe(),me=U==="slides",dt=_o,ct=Wo,G;t[0]!==e||t[1]!==I||t[2]!==A?(G=async m=>{let{preset:C,title:R}=m;if(!e){le();return}await Pe(R,async ue=>{await Je({takeScreenshots:()=>I({progress:ue}),updateCellOutputs:A}),await ao({filename:e,preset:C,downloadPDF:Jt})})},t[0]=e,t[1]=I,t[2]=A,t[3]=G):G=t[3];let L=G,J;t[4]===L?J=t[5]:(J=async()=>{if(ve){await L({preset:"document",title:"Downloading Document PDF..."});return}let m=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(m),setTimeout(zo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=L,t[5]=J);let Z=J,Q;t[6]!==W||t[7]!==e||t[8]!==I||t[9]!==A?(Q=async()=>{if(!e){le();return}await Pe("Downloading IPYNB...",async m=>{await Je({takeScreenshots:()=>I({progress:m}),updateCellOutputs:A});let C=await W({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),be.toIPYNB(document.title))})},t[6]=W,t[7]=e,t[8]=I,t[9]=A,t[10]=Q):Q=t[10];let pe=Q,X;t[11]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),t[11]=X):X=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let E;t[13]===e?E=t[14]:(E=async()=>{if(!e){le();return}await $e({filename:e,includeCode:!0})},t[13]=e,t[14]=E);let te;return t[15]!==f||t[16]!==de||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==w||t[21]!==L||t[22]!==k||t[23]!==_||t[24]!==e||t[25]!==Z||t[26]!==pe||t[27]!==re||t[28]!==d||t[29]!==me||t[30]!==l||t[31]!==n||t[32]!==M||t[33]!==y||t[34]!==b||t[35]!==ie||t[36]!==U||t[37]!==r||t[38]!==j||t[39]!==v||t[40]!==he||t[41]!==z||t[42]!==V||t[43]!==K||t[44]!==E||t[45]!==s||t[46]!==Y||t[47]!==u||t[48]!==ce||t[49]!==p||t[50]!==i.mode?(te=[{icon:X,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){le();return}await $e({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Ma,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let m=await _({download:!1});ke(new Blob([m],{type:"text/plain"}),be.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:pe},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let m=await M();ke(new Blob([m.contents],{type:"text/plain"}),be.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",_a("global.hideCode",!1)]}),handle:Co},me?{divider:!0,icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Z},{icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:ct(!0),hidden:!ve,handle:async()=>{await L({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Z}]},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:oe(),handle:async()=>{n((0,a.jsx)(Ya,{onClose:o}))}},{icon:(0,a.jsx)(Ra,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!V&&!K,dropdown:[{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!V,handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await B(Ke({code:(await M()).contents})),D({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Create molab notebook",handle:async()=>{let m=Ke({code:(await M()).contents,baseUrl:`${S.molab}/new`});window.open(m,"_blank")}}]},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:Wt.flatMap(m=>{let{type:C,Icon:R,hidden:ue,additionalKeywords:ht}=m;return ue?[]:{label:Le.startCase(C),rightElement:dt(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:ht}})},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(wa,{size:14,strokeWidth:1.5}):(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{Y()}},...Ze.map((m,C)=>{let R=lt(m);return{divider:C===0,label:it(m),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:U===m&&(0,a.jsx)(we,{size:14})}),handle:()=>{he(m),i.mode==="edit"&&Y()}}})]},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||oe(),handle:w},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await B((await M()).contents),D({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!re||l,handle:async()=>{let m=jt(Me());await ie({configs:Se.fromEntries(m.map(vo))});for(let C of m)p({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(qe,{onClose:o}))}},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(qe,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:ce,hidden:!de||l,handle:()=>{u()}},{icon:(0,a.jsx)($a,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{b()}},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>j(go)},{icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(jo)},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(wo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:ko},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"GitHub",handle:bo},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:yo},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"YouTube",handle:xo},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Changelog",handle:fo}]},{divider:!0,icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:uo},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:po}].filter(mo).map(co),t[15]=f,t[16]=de,t[17]=h,t[18]=o,t[19]=x,t[20]=w,t[21]=L,t[22]=k,t[23]=_,t[24]=e,t[25]=Z,t[26]=pe,t[27]=re,t[28]=d,t[29]=me,t[30]=l,t[31]=n,t[32]=M,t[33]=y,t[34]=b,t[35]=ie,t[36]=U,t[37]=r,t[38]=j,t[39]=v,t[40]=he,t[41]=z,t[42]=V,t[43]=K,t[44]=E,t[45]=s,t[46]=Y,t[47]=u,t[48]=ce,t[49]=p,t[50]=i.mode,t[51]=te):te=t[51],te}function co(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ho)}:t}function ho(t){return!t.hidden}function mo(t){return!t.hidden}function po(){let t=va();window.open(t,"_blank")}function uo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function fo(){window.open(S.releasesPage,"_blank")}function xo(){window.open(S.youtube,"_blank")}function yo(){window.open(S.discordLink,"_blank")}function bo(){window.open(S.githubPage,"_blank")}function ko(){window.open(S.docsPage,"_blank")}function wo(t){return!t}function jo(t){return!t}function go(t){return!t}function vo(t){return[t,{disabled:!1}]}async function Co(){let t=document.getElementById("App");t&&await Zt({element:t,filename:document.title,prepare:Qt})}function zo(){return window.print()}function Wo(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function _o(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(we,{size:14})})}function le(){D({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{nt as a,Xe as c,st as i,Qe as l,rt as n,at as o,Xa as r,et as s,ro as t};
|
|
1
|
+
import{s as We}from"./chunk-LvLJmgfZ.js";import{d as $,l as mt,p as pt,u as ae}from"./useEvent-D91BmmQi.js";import{t as ut}from"./react-Bj1aDYRI.js";import{D as _e,Dn as ft,Dr as xt,E as yt,Ii as fe,Mn as bt,On as kt,Sr as wt,Yr as jt,Zt as gt,_ as vt,_r as Ct,ct as zt,h as Me,kn as Wt,st as _t,t as Mt,ut as Ne,yr as Nt}from"./cells-DFP-V6he.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as St,x as Dt}from"./ai-model-dropdown-BNBl1Zqz.js";import{_ as H,d as Se}from"./useEventListener-DvoEXWke.js";import{y as Pt}from"./utils-Wvjk_Y4h.js";import{n as S,t as De}from"./constants-DMpttj8Q.js";import{T as oe,n as At,o as It,v as Lt,w as Et}from"./config-DzkFE_hx.js";import{n as Tt}from"./switch-C4flmwHC.js";import{t as Rt}from"./jsx-runtime-BqBOg78p.js";import{o as $t}from"./alert-dialog-BqFLkbUc.js";import{a as Ht,c as xe,o as ye,s as qt}from"./popover-Bz_0Vkyf.js";import{a as Ot,c as Bt,i as Ft,n as Ut,r as Yt,s as Vt,t as Kt}from"./select-DZcFyKFQ.js";import{_t as Gt}from"./JsonOutput-CGRqyV9u.js";import{c as Pe,d as be,n as Jt,o as Zt,r as ke,t as Qt}from"./download-PdY73eIa.js";import{t as Ae}from"./tooltip-DTV9tlSr.js";import{r as Ie,t as q}from"./button-BbCh-29a.js";import{i as Xt,r as ea,t as Le}from"./strings-wdPMRf6Z.js";import{r as O}from"./requests-DIwGYs0l.js";import{t as g}from"./createLucideIcon-D5guW7EU.js";import{F as ta,I as aa,L as Ee,P as oa,R as na,a as Te,i as Re,u as $e}from"./layout-Blt3H1HN.js";import{t as we}from"./check-BH35Ndha.js";import{r as sa}from"./useCellActionButton-DB5AiJOa.js";import{t as He}from"./copy-BwrPA9zQ.js";import{t as la}from"./external-link-BTNxSavU.js";import{t as ia}from"./eye-off-BT-KOYV5.js";import{t as ne}from"./file-HTLbeC2b.js";import{t as ra}from"./github-raQvpeuZ.js";import{u as da}from"./form-Erlg5epl.js";import{n as ca,r as ha,t as ma}from"./youtube-3lRHw8NU.js";import{i as pa,n as qe}from"./add-connection-dialog-C2N_XkPg.js";import{t as ua}from"./house-D2ldnAB9.js";import{t as fa}from"./image-BIibSXT6.js";import{t as xa}from"./link-CoJxTwWE.js";import{r as ya}from"./input-DkSJHlVD.js";import{t as ba}from"./settings-SnYErNWQ.js";import{t as ka}from"./sparkles-CC9Bko6a.js";import{y as wa}from"./textarea-DQ04jSpC.js";import{t as ja}from"./square-B5xWCt0a.js";import{t as D}from"./use-toast-IPAtJGea.js";import{n as Oe,t as ga}from"./paths-D5zczhUD.js";import{o as va}from"./session-0B5NBztP.js";import{n as B}from"./copy-LK56fFow.js";import{r as Ca}from"./useRunCells-YtfQa1U2.js";import{a as Be,c as Fe,i as Ue,n as Ye,r as Ve}from"./dialog-DzC_QCtT.js";import{n as je}from"./ImperativeModal-DMLPabMc.js";import{r as za,t as Ke}from"./share-DMwTZOTH.js";import{a as Wa}from"./cell-link-CKjfkiFA.js";import{a as _a}from"./renderShortcut-DpuO8OzB.js";import{t as Ma}from"./icons-D7rawFWk.js";import{n as Ge}from"./marimo-icons-CcDNGIRM.js";import{t as Na}from"./links-DguLoFik.js";import{r as Sa,t as Je}from"./hooks-DN50smd9.js";import{t as Ze}from"./types-iYXk7c05.js";var Da=g("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Pa=g("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Qe=g("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"}]]),Xe=g("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"}]]),et=g("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"}]]),Aa=g("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"}]]),Ia=g("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"}]]),La=g("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"}]]),Ea=g("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ta=g("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),tt=g("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"}]]),Ra=g("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"}]]),$a=g("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"}]]),at=g("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"}]]),ge=N(),P=We(ut(),1),a=We(Rt(),1);function Ha(){return"uvx marimo@latest"}function qa(t,e,n){let o=n?" --with-token":"",s=`${Ha()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode --prompt "$(${s} --opencode)"`;default:ea(t)}}function Oa(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var Ba="npx skills add marimo-team/marimo-pair";function Fa(){let t=(0,ge.c)(2),[e,n]=(0,P.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(At("/auth/token").href,{headers:Tt.headers()}).then(Ua).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,P.useEffect)(o,s),e}function Ua(t){return t.ok?t.json():null}const Ya=t=>{let e=(0,ge.c)(32),{onClose:n}=t,[o,s]=(0,P.useState)("claude"),r=It(),i=Fa(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=qa(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Fe,{children:"Pair with an agent"}),e[4]=p):p=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(Be,{children:[p,(0,a.jsxs)(Ve,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=u):u=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(F,{command:Ba})]}),e[6]=h):h=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=f):f=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=M=>s(M),e[8]=x):x=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsxs)(qt,{className:"w-full",children:[(0,a.jsx)(xe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(xe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(xe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=k):k=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(ye,{value:"claude",className:"mt-3",children:(0,a.jsx)(F,{command:c})}),e[10]=c,e[11]=y);let b;e[12]===c?b=e[13]:(b=(0,a.jsx)(ye,{value:"codex",className:"mt-3",children:(0,a.jsx)(F,{command:c})}),e[12]=c,e[13]=b);let w;e[14]===c?w=e[15]:(w=(0,a.jsx)(ye,{value:"opencode",className:"mt-3",children:(0,a.jsx)(F,{command:c})}),e[14]=c,e[15]=w);let j;e[16]!==o||e[17]!==w||e[18]!==y||e[19]!==b?(j=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[f,(0,a.jsxs)(Ht,{value:o,onValueChange:x,children:[k,y,b,w]})]}),e[16]=o,e[17]=w,e[18]=y,e[19]=b,e[20]=j):j=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(F,{command:i,display:Oa(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==j||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,j,z]}),e[24]=j,e[25]=z,e[26]=v):v=e[26];let W;e[27]===n?W=e[28]:(W=(0,a.jsx)(Ue,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=W);let _;return e[29]!==v||e[30]!==W?(_=(0,a.jsxs)(Ye,{className:"sm:max-w-lg",children:[u,v,W]}),e[29]=v,e[30]=W,e[31]=_):_=e[31],_};var F=t=>{let e=(0,ge.c)(15),{command:n,display:o}=t,[s,r]=(0,P.useState)(!1),i;e[0]===n?i=e[1]:(i=Ie.stopPropagation(async x=>{x.preventDefault(),await B(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let p;e[4]===s?p=e[5]:(p=s?(0,a.jsx)(we,{size:14,strokeWidth:1.5}):(0,a.jsx)(He,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=p);let u;e[6]!==l||e[7]!==p?(u=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:p}),e[6]=l,e[7]=p,e[8]=u):u=e[8];let h;e[9]!==s||e[10]!==u?(h=(0,a.jsx)(Ae,{content:"Copied!",open:s,children:u}),e[9]=s,e[10]=u,e[11]=h):h=e[11];let f;return e[12]!==c||e[13]!==h?(f=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=f):f=e[14],f},ot=N(),se="https://static.marimo.app";const Va=t=>{let e=(0,ot.c)(25),{onClose:n}=t,[o,s]=(0,P.useState)(""),{exportAsHTML:r}=O(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${se}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async j=>{j.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:oa.INSTANCE.filenames()}),v=D({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${se}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),D({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:S.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),D({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Fe,{children:"Share static notebook"}),e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Ve,{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:se,target:"_blank",children:se}),"."]})]}),e[5]=p):p=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=j=>{s(j.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=u):u=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(ya,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let f;e[9]===l?f=e[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)(Ka,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=f);let x;e[11]!==h||e[12]!==f?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,f]}),e[11]=h,e[12]=f,e[13]=x):x=e[13];let k;e[14]===n?k=e[15]:(k=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=k);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await B(l)},children:"Create"}),e[16]=l,e[17]=y);let b;e[18]!==k||e[19]!==y?(b=(0,a.jsxs)(Ue,{children:[k,y]}),e[18]=k,e[19]=y,e[20]=b):b=e[20];let w;return e[21]!==d||e[22]!==b||e[23]!==x?(w=(0,a.jsx)(Ye,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[p,x,b]})}),e[21]=d,e[22]=b,e[23]=x,e[24]=w):w=e[24],w};var Ka=t=>{let e=(0,ot.c)(8),[n,o]=P.useState(!1),s;e[0]===t.text?s=e[1]:(s=Ie.stopPropagation(async c=>{c.preventDefault(),await B(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(He,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Ae,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Ga=N();function Ja(){let t=document.getElementsByClassName(De.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=fe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:fe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Za(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(fe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${De.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function nt(){let t=(0,Ga.c)(2),e=$(Ne),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ja();e(s=>({mode:zt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Za(o)})})},t[0]=e,t[1]=n),n}const st=pt(!1);var Qa=N();const Xa=()=>{let t=(0,Qa.c)(7),{selectedLayout:e}=Te(),{setLayoutView:n}=Re();if(oe()&&!bt("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Vt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Bt,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Ut,{children:(0,a.jsxs)(Yt,{children:[(0,a.jsx)(Ot,{children:"View as"}),Ze.map(to)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Kt,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function eo(t){return(0,a.jsx)(lt(t),{className:"h-4 w-4"})}function lt(t){switch(t){case"vertical":return La;case"grid":return ha;case"slides":return tt;default:return Xt(t),ja}}function it(t){return Le.startCase(t)}function to(t){return(0,a.jsx)(Ft,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[eo(t),(0,a.jsx)("span",{children:it(t)})]})},t)}async function ao(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var oo=N();function no(t){let e=(0,oo.c)(5),{openPrompt:n,closeModal:o}=je(),{sendCopy:s}=O(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ga.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Oe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(Oe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),D({title:"Notebook copied",description:"A copy of the notebook has been created."}),Na(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const so=()=>{let{updateCellConfig:t}=_e(),{saveCellConfig:e}=O();return(0,P.useCallback)(async()=>{let n=new gt,o=Me(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Se.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var lo=N();function rt(){let t=(0,lo.c)(4),{openConfirm:e}=je(),n=$(Lt),{sendRestart:o}=O(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)($t,{onClick:async()=>{n({state:Et.CLOSING}),await o(),za()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var io=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function ro(){var Ce,ze;let t=(0,io.c)(52),e=Wa(),{openModal:n,closeModal:o}=je(),{toggleApplication:s}=ft(),{selectedPanel:r}=kt(),[i]=mt(Ne),l=ae(_t),d=so(),[c]=Pt(),{updateCellConfig:p,undoDeleteCell:u,clearAllCellOutputs:h,addSetupCellIfDoesntExist:f,collapseAllCells:x,expandAllCells:k}=_e(),y=rt(),b=Ca(),w=no(e),j=$(st),z=$(St),v=$(Dt),{exportAsIPYNB:W,exportAsMarkdown:_,readCode:M,saveCellConfig:ie,updateCellOutputs:A}=O(),I=Sa(),re=ae(vt),de=ae(Mt),ce=ae(yt),{selectedLayout:U}=Te(),{setLayoutView:he}=Re(),Y=nt(),V=((Ce=c.sharing)==null?void 0:Ce.html)??!0,K=((ze=c.sharing)==null?void 0:ze.wasm)??!0,ve=!oe(),me=U==="slides",dt=_o,ct=Wo,G;t[0]!==e||t[1]!==I||t[2]!==A?(G=async m=>{let{preset:C,title:R}=m;if(!e){le();return}await Pe(R,async ue=>{await Je({takeScreenshots:()=>I({progress:ue}),updateCellOutputs:A}),await ao({filename:e,preset:C,downloadPDF:Jt})})},t[0]=e,t[1]=I,t[2]=A,t[3]=G):G=t[3];let L=G,J;t[4]===L?J=t[5]:(J=async()=>{if(ve){await L({preset:"document",title:"Downloading Document PDF..."});return}let m=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(m),setTimeout(zo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=L,t[5]=J);let Z=J,Q;t[6]!==W||t[7]!==e||t[8]!==I||t[9]!==A?(Q=async()=>{if(!e){le();return}await Pe("Downloading IPYNB...",async m=>{await Je({takeScreenshots:()=>I({progress:m}),updateCellOutputs:A});let C=await W({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),be.toIPYNB(document.title))})},t[6]=W,t[7]=e,t[8]=I,t[9]=A,t[10]=Q):Q=t[10];let pe=Q,X;t[11]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),t[11]=X):X=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let E;t[13]===e?E=t[14]:(E=async()=>{if(!e){le();return}await $e({filename:e,includeCode:!0})},t[13]=e,t[14]=E);let te;return t[15]!==f||t[16]!==de||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==w||t[21]!==L||t[22]!==k||t[23]!==_||t[24]!==e||t[25]!==Z||t[26]!==pe||t[27]!==re||t[28]!==d||t[29]!==me||t[30]!==l||t[31]!==n||t[32]!==M||t[33]!==y||t[34]!==b||t[35]!==ie||t[36]!==U||t[37]!==r||t[38]!==j||t[39]!==v||t[40]!==he||t[41]!==z||t[42]!==V||t[43]!==K||t[44]!==E||t[45]!==s||t[46]!==Y||t[47]!==u||t[48]!==ce||t[49]!==p||t[50]!==i.mode?(te=[{icon:X,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){le();return}await $e({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Ma,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let m=await _({download:!1});ke(new Blob([m],{type:"text/plain"}),be.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:pe},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let m=await M();ke(new Blob([m.contents],{type:"text/plain"}),be.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",_a("global.hideCode",!1)]}),handle:Co},me?{divider:!0,icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Z},{icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:ct(!0),hidden:!ve,handle:async()=>{await L({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ne,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Z}]},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:oe(),handle:async()=>{n((0,a.jsx)(Ya,{onClose:o}))}},{icon:(0,a.jsx)(Ra,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!V&&!K,dropdown:[{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!V,handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await B(Ke({code:(await M()).contents})),D({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Create molab notebook",handle:async()=>{let m=Ke({code:(await M()).contents,baseUrl:`${S.molab}/new`});window.open(m,"_blank")}}]},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:Wt.flatMap(m=>{let{type:C,Icon:R,hidden:ue,additionalKeywords:ht}=m;return ue?[]:{label:Le.startCase(C),rightElement:dt(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:ht}})},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(wa,{size:14,strokeWidth:1.5}):(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{Y()}},...Ze.map((m,C)=>{let R=lt(m);return{divider:C===0,label:it(m),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:U===m&&(0,a.jsx)(we,{size:14})}),handle:()=>{he(m),i.mode==="edit"&&Y()}}})]},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||oe(),handle:w},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await B((await M()).contents),D({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!re||l,handle:async()=>{let m=jt(Me());await ie({configs:Se.fromEntries(m.map(vo))});for(let C of m)p({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(qe,{onClose:o}))}},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(qe,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:ce,hidden:!de||l,handle:()=>{u()}},{icon:(0,a.jsx)($a,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{b()}},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>j(go)},{icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(jo)},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(wo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:ko},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"GitHub",handle:bo},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:yo},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"YouTube",handle:xo},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Changelog",handle:fo}]},{divider:!0,icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:uo},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:po}].filter(mo).map(co),t[15]=f,t[16]=de,t[17]=h,t[18]=o,t[19]=x,t[20]=w,t[21]=L,t[22]=k,t[23]=_,t[24]=e,t[25]=Z,t[26]=pe,t[27]=re,t[28]=d,t[29]=me,t[30]=l,t[31]=n,t[32]=M,t[33]=y,t[34]=b,t[35]=ie,t[36]=U,t[37]=r,t[38]=j,t[39]=v,t[40]=he,t[41]=z,t[42]=V,t[43]=K,t[44]=E,t[45]=s,t[46]=Y,t[47]=u,t[48]=ce,t[49]=p,t[50]=i.mode,t[51]=te):te=t[51],te}function co(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ho)}:t}function ho(t){return!t.hidden}function mo(t){return!t.hidden}function po(){let t=va();window.open(t,"_blank")}function uo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function fo(){window.open(S.releasesPage,"_blank")}function xo(){window.open(S.youtube,"_blank")}function yo(){window.open(S.discordLink,"_blank")}function bo(){window.open(S.githubPage,"_blank")}function ko(){window.open(S.docsPage,"_blank")}function wo(t){return!t}function jo(t){return!t}function go(t){return!t}function vo(t){return[t,{disabled:!1}]}async function Co(){let t=document.getElementById("App");t&&await Zt({element:t,filename:document.title,prepare:Qt})}function zo(){return window.print()}function Wo(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function _o(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(we,{size:14})})}function le(){D({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{nt as a,Xe as c,st as i,Qe as l,rt as n,at as o,Xa as r,et as s,ro as t};
|
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-DJPWW9kq.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BPPi7vOr.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-1YLdnr8A.js">
|
|
193
193
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-rVklqqFF.js">
|
|
194
194
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-BdtIs0E-.js">
|
|
195
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
195
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-CGRqyV9u.js">
|
|
196
196
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-nqk474t8.js">
|
|
197
197
|
<link rel="modulepreload" crossorigin href="./assets/square-function-uY_yJr5g.js">
|
|
198
198
|
<link rel="modulepreload" crossorigin href="./assets/spec-CPQR_o92.js">
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-a_9k9BK7.js">
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/tree-actions-OR_cmYSp.js">
|
|
202
202
|
<link rel="modulepreload" crossorigin href="./assets/components-DtZWQLFy.js">
|
|
203
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
203
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-BjPmiDfN.js">
|
|
204
204
|
<link rel="modulepreload" crossorigin href="./assets/icons-D7rawFWk.js">
|
|
205
205
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-B-1HJbUZ.js">
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/floating-outline-D8dOyOI7.js">
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/label-xHqFtfdz.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/textarea-DQ04jSpC.js">
|
|
227
227
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DLc784Sj.js">
|
|
228
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
228
|
+
<link rel="modulepreload" crossorigin href="./assets/form-Erlg5epl.js">
|
|
229
229
|
<link rel="modulepreload" crossorigin href="./assets/renderShortcut-DpuO8OzB.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/field-BqBRuxbN.js">
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/RSPContexts-D6ufu5K9.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/frontend",
|
|
3
|
-
"version": "0.23.7-
|
|
3
|
+
"version": "0.23.7-dev29",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"./unstable_internal/*": "./src/*"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ai-sdk/react": "^3.0.
|
|
24
|
+
"@ai-sdk/react": "^3.0.134",
|
|
25
25
|
"@anywidget/types": "^0.2.0",
|
|
26
26
|
"@codemirror/autocomplete": "^6.20.1",
|
|
27
27
|
"@codemirror/commands": "^6.10.2",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@xterm/addon-web-links": "^0.12.0",
|
|
94
94
|
"@xterm/xterm": "^5.5.0",
|
|
95
95
|
"@zed-industries/agent-client-protocol": "^0.4.5",
|
|
96
|
-
"ai": "^6.0.
|
|
96
|
+
"ai": "^6.0.129",
|
|
97
97
|
"ansi_up": "^6.0.6",
|
|
98
98
|
"class-variance-authority": "^0.7.1",
|
|
99
99
|
"clsx": "^2.1.1",
|
|
@@ -133,7 +133,12 @@ export const ContextAwarePanel: React.FC = () => {
|
|
|
133
133
|
onDragging={handleDragging}
|
|
134
134
|
className="resize-handle border-border z-20 print:hidden border-l"
|
|
135
135
|
/>
|
|
136
|
-
<Panel
|
|
136
|
+
<Panel
|
|
137
|
+
data-testid="chrome-context-aware-panel"
|
|
138
|
+
defaultSize={25}
|
|
139
|
+
minSize={25}
|
|
140
|
+
maxSize={80}
|
|
141
|
+
>
|
|
137
142
|
{renderBody()}
|
|
138
143
|
</Panel>
|
|
139
144
|
</>
|
|
@@ -167,7 +172,10 @@ const ResizableComponent = ({ children }: ResizableComponentProps) => {
|
|
|
167
172
|
});
|
|
168
173
|
|
|
169
174
|
return (
|
|
170
|
-
<div
|
|
175
|
+
<div
|
|
176
|
+
data-testid="chrome-context-aware-panel"
|
|
177
|
+
className="absolute z-40 right-0 h-full bg-background flex flex-row"
|
|
178
|
+
>
|
|
171
179
|
<div
|
|
172
180
|
ref={handleRefs.left}
|
|
173
181
|
className="w-1 h-full cursor-col-resize border-l"
|
|
@@ -537,6 +537,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
|
|
|
537
537
|
{helperPanel}
|
|
538
538
|
<Panel
|
|
539
539
|
id="app-chrome-body"
|
|
540
|
+
data-testid="chrome-body"
|
|
540
541
|
className={cn(isDeveloperPanelOpen && !isSidebarOpen && "border-l")}
|
|
541
542
|
>
|
|
542
543
|
<PanelGroup autoSaveId="marimo:chrome:v1:l1" direction="vertical">
|
|
@@ -58,7 +58,10 @@ export const Footer: React.FC = () => {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
|
-
<footer
|
|
61
|
+
<footer
|
|
62
|
+
data-testid="chrome-footer"
|
|
63
|
+
className="h-10 py-1 gap-1 bg-background flex items-center text-muted-foreground text-md pl-2 pr-1 border-t border-border select-none print:hidden text-sm z-50 hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin"
|
|
64
|
+
>
|
|
62
65
|
<FooterItem
|
|
63
66
|
className="h-full"
|
|
64
67
|
tooltip={
|
|
@@ -3,7 +3,10 @@ import type { PropsWithChildren } from "react";
|
|
|
3
3
|
|
|
4
4
|
export const PanelsWrapper: React.FC<PropsWithChildren> = ({ children }) => {
|
|
5
5
|
return (
|
|
6
|
-
<div
|
|
6
|
+
<div
|
|
7
|
+
data-testid="chrome-wrapper"
|
|
8
|
+
className="flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative"
|
|
9
|
+
>
|
|
7
10
|
{children}
|
|
8
11
|
</div>
|
|
9
12
|
);
|
|
@@ -115,7 +115,10 @@ export const Sidebar: React.FC = () => {
|
|
|
115
115
|
]);
|
|
116
116
|
|
|
117
117
|
return (
|
|
118
|
-
<div
|
|
118
|
+
<div
|
|
119
|
+
data-testid="chrome-sidebar"
|
|
120
|
+
className="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen"
|
|
121
|
+
>
|
|
119
122
|
<ReorderableList<PanelDescriptor>
|
|
120
123
|
value={sidebarItems}
|
|
121
124
|
setValue={handleSetSidebarItems}
|
|
@@ -88,7 +88,10 @@ export const Controls = ({
|
|
|
88
88
|
{!presenting && <FindReplace />}
|
|
89
89
|
|
|
90
90
|
{!closed && (
|
|
91
|
-
<div
|
|
91
|
+
<div
|
|
92
|
+
data-testid="chrome-controls-top-right"
|
|
93
|
+
className={topRightControls}
|
|
94
|
+
>
|
|
92
95
|
{presenting && <LayoutSelect />}
|
|
93
96
|
<NotebookMenuDropdown
|
|
94
97
|
disabled={disabled}
|
|
@@ -103,7 +106,10 @@ export const Controls = ({
|
|
|
103
106
|
</div>
|
|
104
107
|
)}
|
|
105
108
|
|
|
106
|
-
<div
|
|
109
|
+
<div
|
|
110
|
+
data-testid="chrome-controls-bottom-right"
|
|
111
|
+
className={cn(bottomRightControls)}
|
|
112
|
+
>
|
|
107
113
|
<HideInKioskMode>
|
|
108
114
|
<SaveComponent kioskMode={false} />
|
|
109
115
|
</HideInKioskMode>
|