@marimo-team/frontend 0.23.7-dev76 → 0.23.7-dev78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/assets/{JsonOutput-BEbyS3oG.js → JsonOutput-05-R3eil.js} +1 -1
  2. package/dist/assets/{add-connection-dialog-Cw6_iYno.js → add-connection-dialog-CzxRpS5F.js} +1 -1
  3. package/dist/assets/{agent-panel-StLA6gDR.js → agent-panel-zPhlhkYL.js} +1 -1
  4. package/dist/assets/{cell-editor-2QxjK8Iy.js → cell-editor-ODyJXDT8.js} +1 -1
  5. package/dist/assets/{column-preview-DA6nf5_Q.js → column-preview-BLIWbdOX.js} +1 -1
  6. package/dist/assets/{command-palette-xwQgzDjB.js → command-palette-CeDe63_W.js} +1 -1
  7. package/dist/assets/{dependency-graph-panel-69vKwEHr.js → dependency-graph-panel-D-QLNUZN.js} +1 -1
  8. package/dist/assets/{download-BO6T2USS.js → download-B1QFVDP-.js} +1 -1
  9. package/dist/assets/{edit-page-CDRIYjrs.js → edit-page-D_MrFGP2.js} +3 -3
  10. package/dist/assets/{file-explorer-panel-_77UepGi.js → file-explorer-panel-BVBKF1SH.js} +1 -1
  11. package/dist/assets/{form-CM8vYbSt.js → form-BjUJP6PJ.js} +1 -1
  12. package/dist/assets/{hooks-CizEp07l.js → hooks-jWLD3t7P.js} +1 -1
  13. package/dist/assets/{index-Cu94n5mj.js → index-CA2sQKnW.js} +14 -14
  14. package/dist/assets/{layout-BX294DMP.js → layout-DEU6lX-9.js} +3 -3
  15. package/dist/assets/{panels-DM5HG3Hc.js → panels-DWhhEgv4.js} +1 -1
  16. package/dist/assets/{reveal-component-DOOziYlB.js → reveal-component-DNpBzX6F.js} +1 -1
  17. package/dist/assets/{run-page-62ydR-HX.js → run-page-CO2X6wso.js} +1 -1
  18. package/dist/assets/{scratchpad-panel-BcG61-7O.js → scratchpad-panel-CWfddArs.js} +1 -1
  19. package/dist/assets/{session-panel-jVcSUURP.js → session-panel-BP0QxaoM.js} +1 -1
  20. package/dist/assets/{useCellActionButton-CpNJthj4.js → useCellActionButton-QaDO24oW.js} +1 -1
  21. package/dist/assets/{useDependencyPanelTab-BNbEyT1o.js → useDependencyPanelTab-BB_XeSAg.js} +1 -1
  22. package/dist/assets/{useNotebookActions-DiN6ywFP.js → useNotebookActions-CJEicFed.js} +1 -1
  23. package/dist/index.html +5 -5
  24. package/package.json +1 -1
  25. package/src/plugins/layout/DownloadPlugin.tsx +9 -7
  26. package/src/utils/download.ts +4 -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-Dnu4nDoy.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-BEbyS3oG.js";import"./download-BO6T2USS.js";import{r as Ne}from"./radio-group-rsi1ibXY.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-BQ-BQLiJ.js";import{t as ye}from"./add-connection-dialog-Cw6_iYno.js";import{t as ve}from"./plus-CxkHs8QM.js";import{a as ja}from"./input-CVE-gIjt.js";import{n as Na,o as ya}from"./column-preview-DA6nf5_Q.js";import{t as va}from"./workflow-CgnDnnoN.js";import"./dist-DCqxOggh.js";import"./dist-BZr6MMV-.js";import"./dist-BU26XwgJ.js";import"./dist-COs9gIu5.js";import"./dist-DkA__6UI.js";import"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import"./dates-DI1TvEEK.js";import{t as wa}from"./copy-icon-BdZPgXgo.js";import{t as Sa}from"./context-C1Tm_47t.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{t as we}from"./cell-link-PQYiMZw1.js";import{n as oe}from"./useAsyncData-C5i0IRVM.js";import{a as Ca,o as ae,t as _a,u as ka}from"./command-2NPJCYDa.js";import"./chunk-5FQGJX7Z-BSzccEgu.js";import{r as $a}from"./html-to-image-D6SgvARi.js";import{o as Fa}from"./focus-BaOnnMs-.js";import{a as Ia,i as La,n as Ta,o as Se,r as qa,t as Ba}from"./table-DQE9hQzM.js";import"./react-resizable-panels.browser.esm-Ce2ksurd.js";import{n as Da}from"./icons-8tfAri2V.js";import{r as Va}from"./tree-actions-DY8FUp3V.js";import{a as me,i as te,o as ce,r as Ce,s as _e,t as Ma}from"./components-zB5yT_R8.js";import{t as Pa}from"./empty-state-CcobJSnG.js";import{n as Ea,t as Oa}from"./common-BaBE_ygg.js";import{a as Ua,i as Ra,n as ke,r as $e,t as Fe}from"./components-CvGaLA5d.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-Dnu4nDoy.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-05-R3eil.js";import"./download-B1QFVDP-.js";import{r as Ne}from"./radio-group-rsi1ibXY.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-BQ-BQLiJ.js";import{t as ye}from"./add-connection-dialog-CzxRpS5F.js";import{t as ve}from"./plus-CxkHs8QM.js";import{a as ja}from"./input-CVE-gIjt.js";import{n as Na,o as ya}from"./column-preview-BLIWbdOX.js";import{t as va}from"./workflow-CgnDnnoN.js";import"./dist-DCqxOggh.js";import"./dist-BZr6MMV-.js";import"./dist-BU26XwgJ.js";import"./dist-COs9gIu5.js";import"./dist-DkA__6UI.js";import"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import"./dates-DI1TvEEK.js";import{t as wa}from"./copy-icon-BdZPgXgo.js";import{t as Sa}from"./context-C1Tm_47t.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{t as we}from"./cell-link-PQYiMZw1.js";import{n as oe}from"./useAsyncData-C5i0IRVM.js";import{a as Ca,o as ae,t as _a,u as ka}from"./command-2NPJCYDa.js";import"./chunk-5FQGJX7Z-BSzccEgu.js";import{r as $a}from"./html-to-image-D6SgvARi.js";import{o as Fa}from"./focus-BaOnnMs-.js";import{a as Ia,i as La,n as Ta,o as Se,r as qa,t as Ba}from"./table-DQE9hQzM.js";import"./react-resizable-panels.browser.esm-Ce2ksurd.js";import{n as Da}from"./icons-8tfAri2V.js";import{r as Va}from"./tree-actions-DY8FUp3V.js";import{a as me,i as te,o as ce,r as Ce,s as _e,t as Ma}from"./components-zB5yT_R8.js";import{t as Pa}from"./empty-state-CcobJSnG.js";import{n as Ea,t as Oa}from"./common-BaBE_ygg.js";import{a as Ua,i as Ra,n as ke,r as $e,t as Fe}from"./components-CvGaLA5d.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 ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-D91BmmQi.js";import{$n as de,Bn as ne,D as se,Ri as re,Sr as ce,Vn as he,br as me,kt as F,st as pe,v as ke,vr as fe,yr as ue}from"./cells-Dnu4nDoy.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{a as be,o as xe,r as je}from"./utils-Wvjk_Y4h.js";import{t as ve}from"./jsx-runtime-BqBOg78p.js";import{t as Ce}from"./label-xHqFtfdz.js";import{a as we,h as ge}from"./download-BO6T2USS.js";import{r as Ie}from"./requests-DIwGYs0l.js";import{t as f}from"./createLucideIcon-D5guW7EU.js";import{n as V,r as Q}from"./x-C-6liIBr.js";import{t as ze}from"./chevron-right-CG5QYXYk.js";import{t as G}from"./circle-plus-BdiiIXu5.js";import{t as We}from"./code-xml-CZN6vNxu.js";import{t as Me}from"./eye-off-BT-KOYV5.js";import{t as _e}from"./image-BIibSXT6.js";import{t as Se}from"./link-CoJxTwWE.js";import{t as Ae}from"./play-5vQl-hy9.js";import{t as De}from"./sparkles-CC9Bko6a.js";import{t as Re}from"./trash-2-BJLYnZpG.js";import{t as Te}from"./use-toast-ERM44-k9.js";import{n as Be}from"./copy-Ch48HVPK.js";import{i as Ne}from"./useRunCells-C0BPo9m1.js";import{a as Ee,c as He,n as Le}from"./dialog-DqOQT_n4.js";import{n as qe}from"./ImperativeModal-DEC1mXgV.js";import{n as Oe}from"./state-D9EoHCkz.js";import{r as K}from"./html-to-image-D6SgvARi.js";import{n as Pe,t as Ue}from"./icons-8tfAri2V.js";import{t as Fe}from"./useDeleteCell-DFahVcdW.js";import{n as $}from"./name-cell-input-bwfAyC0i.js";import{t as X}from"./multi-icon-NVkxesVZ.js";import{t as Ve}from"./useSplitCell-BN53wD86.js";var J=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Qe=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ge(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ke(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var $e=ye(),l=ae(ve(),1);function Xe(a){let e=(0,$e.c)(47),{cell:c,closePopover:u}=a,{createNewCell:m,updateCellConfig:s,updateCellName:x,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:S,markUntouched:A}=se(),D=Ve(),R=Ne(c==null?void 0:c.cellId),T=!b(ke),B=Fe(),{openModal:j}=qe(),N=ie(Oe),E=b(je),v=b(xe),oe=b(pe),y=b(be),{saveCellConfig:r}=Ie();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:i,getEditorView:n,name:h,hasOutput:C,hasConsoleOutput:H,status:L}=c,w;e[1]!==o||e[2]!==i.disabled||e[3]!==r||e[4]!==s?(w=async()=>{let t={disabled:!i.disabled};await r({configs:{[o]:t}}),s({cellId:o,config:t})},e[1]=o,e[2]=i.disabled,e[3]=r,e[4]=s,e[5]=w):w=e[5];let q=w,g;e[6]!==o||e[7]!==i.hide_code||e[8]!==n||e[9]!==r||e[10]!==s?(g=async()=>{let t={hide_code:!i.hide_code};await r({configs:{[o]:t}}),s({cellId:o,config:t});let U=n();U&&(t.hide_code?U.contentDOM.blur():U.focus())},e[6]=o,e[7]=i.hide_code,e[8]=n,e[9]=r,e[10]=s,e[11]=g):g=e[11];let O=g,d=o===re,I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),e[12]=I):I=e[12];let P=L==="running"||L==="queued"||L==="disabled-transitively"||i.disabled,k;e[13]===R?k=e[14]:(k=()=>R(),e[13]=R,e[14]=k);let z;return e[15]!==_||e[16]!==E||e[17]!==y||e[18]!==v||e[19]!==T||e[20]!==o||e[21]!==S||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==m||e[26]!==B||e[27]!==n||e[28]!==H||e[29]!==C||e[30]!==d||e[31]!==A||e[32]!==p||e[33]!==h||e[34]!==j||e[35]!==r||e[36]!==M||e[37]!==W||e[38]!==N||e[39]!==D||e[40]!==P||e[41]!==k||e[42]!==q||e[43]!==O||e[44]!==s||e[45]!==x?(z=[[{icon:I,label:"Run cell",hotkey:"cell.run",hidden:P,redundant:!0,handle:k},{icon:(0,l.jsx)(De,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!E,handle:()=>{N(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>D({cellId:o})},{icon:(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=n();t&&de({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(fe,{size:13,strokeWidth:1.5}):(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:O,hotkey:"cell.hideCode"},{icon:i.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:i.disabled?"Enable execution":"Disable execution",handle:q,hidden:d}],[{icon:(0,l.jsx)(Ue,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),F(t,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await r({configs:{[o]:{hide_code:!0}}}),s({cellId:o,config:{hide_code:!0}}),A({cellId:o})))},hidden:d},ne(n())==="sql"?{icon:(0,l.jsx)(Pe,{}),label:"View as Python",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&he(t,"python",{force:!0})},hidden:d}:{icon:(0,l.jsx)(ue,{size:13,strokeWidth:1.5}),label:"Convert to SQL",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),F(t,{language:"sql",keepCodeAsIs:!1}))},hidden:d}],[{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>m({cellId:o,before:!0}),hidden:d,redundant:!0},{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(Q,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>m({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:d},{icon:(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:d},{icon:(0,l.jsx)(ge,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(J,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(me,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:y!=="columns"||d}],[{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>we(o,"result")},{icon:(0,l.jsx)(ce,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||H),handle:()=>{S({cellId:o})}}],[{icon:(0,l.jsx)(Qe,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:el,handleHeadless:()=>{j((0,l.jsxs)(Le,{children:[(0,l.jsx)(Ee,{children:(0,l.jsx)(He,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Ce,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)($,{placeholder:"cell name",value:h,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),j(null))},onChange:t=>x({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)($,{placeholder:"cell name",value:h,onChange:t=>x({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:d},{icon:(0,l.jsx)(Se,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(h),tooltip:te(h)?void 0:"Only named cells can be linked to",handle:async()=>{await Be(Ge(h)),Te({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!T,variant:"danger",icon:(0,l.jsx)(Re,{size:13,strokeWidth:1.5}),handle:()=>{B({cellId:o})}}]].map(Ye).filter(Je),e[15]=_,e[16]=E,e[17]=y,e[18]=v,e[19]=T,e[20]=o,e[21]=S,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=m,e[26]=B,e[27]=n,e[28]=H,e[29]=C,e[30]=d,e[31]=A,e[32]=p,e[33]=h,e[34]=j,e[35]=r,e[36]=M,e[37]=W,e[38]=N,e[39]=D,e[40]=P,e[41]=k,e[42]=q,e[43]=O,e[44]=s,e[45]=x,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Ye(a){return a.filter(Ze)}function Ze(a){return!a.hidden}function el(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ke as n,Y as o,le as r,J as s,Xe as t};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-D91BmmQi.js";import{$n as de,Bn as ne,D as se,Ri as re,Sr as ce,Vn as he,br as me,kt as F,st as pe,v as ke,vr as fe,yr as ue}from"./cells-Dnu4nDoy.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{a as be,o as xe,r as je}from"./utils-Wvjk_Y4h.js";import{t as ve}from"./jsx-runtime-BqBOg78p.js";import{t as Ce}from"./label-xHqFtfdz.js";import{a as we,h as ge}from"./download-B1QFVDP-.js";import{r as Ie}from"./requests-DIwGYs0l.js";import{t as f}from"./createLucideIcon-D5guW7EU.js";import{n as V,r as Q}from"./x-C-6liIBr.js";import{t as ze}from"./chevron-right-CG5QYXYk.js";import{t as G}from"./circle-plus-BdiiIXu5.js";import{t as We}from"./code-xml-CZN6vNxu.js";import{t as Me}from"./eye-off-BT-KOYV5.js";import{t as _e}from"./image-BIibSXT6.js";import{t as Se}from"./link-CoJxTwWE.js";import{t as Ae}from"./play-5vQl-hy9.js";import{t as De}from"./sparkles-CC9Bko6a.js";import{t as Re}from"./trash-2-BJLYnZpG.js";import{t as Te}from"./use-toast-ERM44-k9.js";import{n as Be}from"./copy-Ch48HVPK.js";import{i as Ne}from"./useRunCells-C0BPo9m1.js";import{a as Ee,c as He,n as Le}from"./dialog-DqOQT_n4.js";import{n as qe}from"./ImperativeModal-DEC1mXgV.js";import{n as Oe}from"./state-D9EoHCkz.js";import{r as K}from"./html-to-image-D6SgvARi.js";import{n as Pe,t as Ue}from"./icons-8tfAri2V.js";import{t as Fe}from"./useDeleteCell-DFahVcdW.js";import{n as $}from"./name-cell-input-bwfAyC0i.js";import{t as X}from"./multi-icon-NVkxesVZ.js";import{t as Ve}from"./useSplitCell-BN53wD86.js";var J=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Qe=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ge(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ke(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var $e=ye(),l=ae(ve(),1);function Xe(a){let e=(0,$e.c)(47),{cell:c,closePopover:u}=a,{createNewCell:m,updateCellConfig:s,updateCellName:x,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:S,markUntouched:A}=se(),D=Ve(),R=Ne(c==null?void 0:c.cellId),T=!b(ke),B=Fe(),{openModal:j}=qe(),N=ie(Oe),E=b(je),v=b(xe),oe=b(pe),y=b(be),{saveCellConfig:r}=Ie();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:i,getEditorView:n,name:h,hasOutput:C,hasConsoleOutput:H,status:L}=c,w;e[1]!==o||e[2]!==i.disabled||e[3]!==r||e[4]!==s?(w=async()=>{let t={disabled:!i.disabled};await r({configs:{[o]:t}}),s({cellId:o,config:t})},e[1]=o,e[2]=i.disabled,e[3]=r,e[4]=s,e[5]=w):w=e[5];let q=w,g;e[6]!==o||e[7]!==i.hide_code||e[8]!==n||e[9]!==r||e[10]!==s?(g=async()=>{let t={hide_code:!i.hide_code};await r({configs:{[o]:t}}),s({cellId:o,config:t});let U=n();U&&(t.hide_code?U.contentDOM.blur():U.focus())},e[6]=o,e[7]=i.hide_code,e[8]=n,e[9]=r,e[10]=s,e[11]=g):g=e[11];let O=g,d=o===re,I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),e[12]=I):I=e[12];let P=L==="running"||L==="queued"||L==="disabled-transitively"||i.disabled,k;e[13]===R?k=e[14]:(k=()=>R(),e[13]=R,e[14]=k);let z;return e[15]!==_||e[16]!==E||e[17]!==y||e[18]!==v||e[19]!==T||e[20]!==o||e[21]!==S||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==m||e[26]!==B||e[27]!==n||e[28]!==H||e[29]!==C||e[30]!==d||e[31]!==A||e[32]!==p||e[33]!==h||e[34]!==j||e[35]!==r||e[36]!==M||e[37]!==W||e[38]!==N||e[39]!==D||e[40]!==P||e[41]!==k||e[42]!==q||e[43]!==O||e[44]!==s||e[45]!==x?(z=[[{icon:I,label:"Run cell",hotkey:"cell.run",hidden:P,redundant:!0,handle:k},{icon:(0,l.jsx)(De,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!E,handle:()=>{N(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>D({cellId:o})},{icon:(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=n();t&&de({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(fe,{size:13,strokeWidth:1.5}):(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:O,hotkey:"cell.hideCode"},{icon:i.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:i.disabled?"Enable execution":"Disable execution",handle:q,hidden:d}],[{icon:(0,l.jsx)(Ue,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),F(t,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await r({configs:{[o]:{hide_code:!0}}}),s({cellId:o,config:{hide_code:!0}}),A({cellId:o})))},hidden:d},ne(n())==="sql"?{icon:(0,l.jsx)(Pe,{}),label:"View as Python",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&he(t,"python",{force:!0})},hidden:d}:{icon:(0,l.jsx)(ue,{size:13,strokeWidth:1.5}),label:"Convert to SQL",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),F(t,{language:"sql",keepCodeAsIs:!1}))},hidden:d}],[{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>m({cellId:o,before:!0}),hidden:d,redundant:!0},{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(Q,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>m({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:d},{icon:(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:d},{icon:(0,l.jsx)(ge,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(J,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(me,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:y!=="columns"||d}],[{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>we(o,"result")},{icon:(0,l.jsx)(ce,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||H),handle:()=>{S({cellId:o})}}],[{icon:(0,l.jsx)(Qe,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:el,handleHeadless:()=>{j((0,l.jsxs)(Le,{children:[(0,l.jsx)(Ee,{children:(0,l.jsx)(He,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Ce,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)($,{placeholder:"cell name",value:h,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),j(null))},onChange:t=>x({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)($,{placeholder:"cell name",value:h,onChange:t=>x({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:d},{icon:(0,l.jsx)(Se,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(h),tooltip:te(h)?void 0:"Only named cells can be linked to",handle:async()=>{await Be(Ge(h)),Te({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!T,variant:"danger",icon:(0,l.jsx)(Re,{size:13,strokeWidth:1.5}),handle:()=>{B({cellId:o})}}]].map(Ye).filter(Je),e[15]=_,e[16]=E,e[17]=y,e[18]=v,e[19]=T,e[20]=o,e[21]=S,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=m,e[26]=B,e[27]=n,e[28]=H,e[29]=C,e[30]=d,e[31]=A,e[32]=p,e[33]=h,e[34]=j,e[35]=r,e[36]=M,e[37]=W,e[38]=N,e[39]=D,e[40]=P,e[41]=k,e[42]=q,e[43]=O,e[44]=s,e[45]=x,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Ye(a){return a.filter(Ze)}function Ze(a){return!a.hidden}function el(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ke as n,Y as o,le as r,J as s,Xe as t};
@@ -1 +1 @@
1
- import{s as K}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as M,p as Z,u as $}from"./useEvent-D91BmmQi.js";import{t as ee}from"./react-Bj1aDYRI.js";import{K as te,Pt as re}from"./cells-Dnu4nDoy.js";import{t as V}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as ae}from"./jsx-runtime-BqBOg78p.js";import{d as ne}from"./alert-dialog-BqFLkbUc.js";import{i as B,r as se,t as G}from"./popover-Bz_0Vkyf.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-DTV9tlSr.js";import{t as de}from"./createLucideIcon-D5guW7EU.js";import{t as he}from"./useCellActionButton-CpNJthj4.js";import{a as pe,c as fe,i as ue,o as xe,r as je,t as be,u as ye}from"./command-2NPJCYDa.js";import{n as ve}from"./focus-BaOnnMs-.js";import{a as Ne,i as ge}from"./renderShortcut-DK-VjfaX.js";var we=de("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),J=V(),h=K(ee(),1),t=K(ae(),1);const L=h.memo(h.forwardRef((r,a)=>{let e=(0,J.c)(39),{children:n,showTooltip:c,...m}=r,p=c===void 0?!0:c,[d,I]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>I(!1),e[0]=N):N=e[0];let W=N,D=(0,h.useRef)(null),E=he({cell:m,closePopover:W}).map(Ce).filter(_e),P=ne(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{te(()=>{D.current&&D.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let T=M(g),w;e[2]===T?w=e[3]:(w=s=>{I(o=>{let l=typeof s=="function"?s(o):s;return l&&T(),l})},e[2]=T,e[3]=w);let i=M(w),k;e[4]===i?k=e[5]:(k=()=>({toggle:()=>i(Se)}),e[4]=i,e[5]=k),(0,h.useImperativeHandle)(a,k);let O=se,A=be,F=re(m.cellId),f;e[6]===F?f=e[7]:(f=(0,t.jsx)(pe,{placeholder:"Search actions...",className:"h-6 m-1",...F}),e[6]=F,e[7]=f);let H=ye,u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(je,{children:"No results"}),e[8]=u):u=e[8];let R=E.map((s,o)=>(0,t.jsxs)(h.Fragment,{children:[(0,t.jsx)(ue,{children:s.map(l=>{let z=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[l.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:l.icon}),(0,t.jsx)("div",{className:"flex-1",children:l.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[l.hotkey&&ge(l.hotkey),l.rightElement]})]});return l.tooltip&&(z=(0,t.jsx)(me,{content:l.tooltip,delayDuration:100,children:z})),(0,t.jsx)(xe,{className:le(l.disabled&&"opacity-50!"),onSelect:()=>{l.disableClick||l.disabled||(l.handle(),I(!1))},variant:l.variant,children:z},l.label)})},o),o<E.length-1&&(0,t.jsx)(fe,{})]},o)),x;e[9]!==H||e[10]!==u||e[11]!==R?(x=(0,t.jsxs)(H,{children:[u,R]}),e[9]=H,e[10]=u,e[11]=R,e[12]=x):x=e[12];let j;e[13]!==A||e[14]!==x||e[15]!==f?(j=(0,t.jsxs)(A,{children:[f,x]}),e[13]=A,e[14]=x,e[15]=f,e[16]=j):j=e[16];let C;e[17]!==O||e[18]!==P||e[19]!==j?(C=(0,t.jsx)(O,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...P,children:j}),e[17]=O,e[18]=P,e[19]=j,e[20]=C):C=e[20];let b=C;if(!p){let s;e[21]===n?s=e[22]:(s=(0,t.jsx)(B,{asChild:!0,children:n}),e[21]=n,e[22]=s);let o;return e[23]!==b||e[24]!==i||e[25]!==d||e[26]!==s?(o=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[s,b]}),e[23]=b,e[24]=i,e[25]=d,e[26]=s,e[27]=o):o=e[27],o}let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(ie,{tabIndex:-1,children:Ne("cell.cellActions")}),e[28]=_):_=e[28];let q=!d&&_,y;e[29]===n?y=e[30]:(y=(0,t.jsx)(ce,{ref:D,children:(0,t.jsx)(B,{className:"flex",children:n})}),e[29]=n,e[30]=y);let v;e[31]!==q||e[32]!==y?(v=(0,t.jsxs)(oe,{delayDuration:200,disableHoverableContent:!0,children:[q,y]}),e[31]=q,e[32]=y,e[33]=v):v=e[33];let S;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==v?(S=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[v,b]}),e[34]=b,e[35]=i,e[36]=d,e[37]=v,e[38]=S):S=e[38],S})),Q=h.memo(r=>{let a=(0,J.c)(5),{children:e,cellId:n}=r,c;a[0]===n?c=a[1]:(c=ve(n),a[0]=n,a[1]=c);let m=$(c);if(!m)return null;let p;return a[2]!==e||a[3]!==m?(p=(0,t.jsx)(L,{showTooltip:!1,...m,children:e}),a[2]=e,a[3]=m,a[4]=p):p=a[4],p});Q.displayName="ConnectionCellActionsDropdown";function ke(r){return!r.redundant}function Ce(r){return r.filter(ke)}function _e(r){return r.length>0}function Se(r){return!r}var Ie=V();const U=Z("minimap");function De(){let r=(0,Ie.c)(3),[a,e]=Y(U),n;return r[0]!==a||r[1]!==e?(n={dependencyPanelTab:a,setDependencyPanelTab:e},r[0]=a,r[1]=e,r[2]=n):n=r[2],n}function Pe(){return X(U)}export{we as a,Q as i,Pe as n,L as r,De as t};
1
+ import{s as K}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as M,p as Z,u as $}from"./useEvent-D91BmmQi.js";import{t as ee}from"./react-Bj1aDYRI.js";import{K as te,Pt as re}from"./cells-Dnu4nDoy.js";import{t as V}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as ae}from"./jsx-runtime-BqBOg78p.js";import{d as ne}from"./alert-dialog-BqFLkbUc.js";import{i as B,r as se,t as G}from"./popover-Bz_0Vkyf.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-DTV9tlSr.js";import{t as de}from"./createLucideIcon-D5guW7EU.js";import{t as he}from"./useCellActionButton-QaDO24oW.js";import{a as pe,c as fe,i as ue,o as xe,r as je,t as be,u as ye}from"./command-2NPJCYDa.js";import{n as ve}from"./focus-BaOnnMs-.js";import{a as Ne,i as ge}from"./renderShortcut-DK-VjfaX.js";var we=de("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),J=V(),h=K(ee(),1),t=K(ae(),1);const L=h.memo(h.forwardRef((r,a)=>{let e=(0,J.c)(39),{children:n,showTooltip:c,...m}=r,p=c===void 0?!0:c,[d,I]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>I(!1),e[0]=N):N=e[0];let W=N,D=(0,h.useRef)(null),E=he({cell:m,closePopover:W}).map(Ce).filter(_e),P=ne(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{te(()=>{D.current&&D.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let T=M(g),w;e[2]===T?w=e[3]:(w=s=>{I(o=>{let l=typeof s=="function"?s(o):s;return l&&T(),l})},e[2]=T,e[3]=w);let i=M(w),k;e[4]===i?k=e[5]:(k=()=>({toggle:()=>i(Se)}),e[4]=i,e[5]=k),(0,h.useImperativeHandle)(a,k);let O=se,A=be,F=re(m.cellId),f;e[6]===F?f=e[7]:(f=(0,t.jsx)(pe,{placeholder:"Search actions...",className:"h-6 m-1",...F}),e[6]=F,e[7]=f);let H=ye,u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(je,{children:"No results"}),e[8]=u):u=e[8];let R=E.map((s,o)=>(0,t.jsxs)(h.Fragment,{children:[(0,t.jsx)(ue,{children:s.map(l=>{let z=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[l.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:l.icon}),(0,t.jsx)("div",{className:"flex-1",children:l.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[l.hotkey&&ge(l.hotkey),l.rightElement]})]});return l.tooltip&&(z=(0,t.jsx)(me,{content:l.tooltip,delayDuration:100,children:z})),(0,t.jsx)(xe,{className:le(l.disabled&&"opacity-50!"),onSelect:()=>{l.disableClick||l.disabled||(l.handle(),I(!1))},variant:l.variant,children:z},l.label)})},o),o<E.length-1&&(0,t.jsx)(fe,{})]},o)),x;e[9]!==H||e[10]!==u||e[11]!==R?(x=(0,t.jsxs)(H,{children:[u,R]}),e[9]=H,e[10]=u,e[11]=R,e[12]=x):x=e[12];let j;e[13]!==A||e[14]!==x||e[15]!==f?(j=(0,t.jsxs)(A,{children:[f,x]}),e[13]=A,e[14]=x,e[15]=f,e[16]=j):j=e[16];let C;e[17]!==O||e[18]!==P||e[19]!==j?(C=(0,t.jsx)(O,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...P,children:j}),e[17]=O,e[18]=P,e[19]=j,e[20]=C):C=e[20];let b=C;if(!p){let s;e[21]===n?s=e[22]:(s=(0,t.jsx)(B,{asChild:!0,children:n}),e[21]=n,e[22]=s);let o;return e[23]!==b||e[24]!==i||e[25]!==d||e[26]!==s?(o=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[s,b]}),e[23]=b,e[24]=i,e[25]=d,e[26]=s,e[27]=o):o=e[27],o}let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(ie,{tabIndex:-1,children:Ne("cell.cellActions")}),e[28]=_):_=e[28];let q=!d&&_,y;e[29]===n?y=e[30]:(y=(0,t.jsx)(ce,{ref:D,children:(0,t.jsx)(B,{className:"flex",children:n})}),e[29]=n,e[30]=y);let v;e[31]!==q||e[32]!==y?(v=(0,t.jsxs)(oe,{delayDuration:200,disableHoverableContent:!0,children:[q,y]}),e[31]=q,e[32]=y,e[33]=v):v=e[33];let S;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==v?(S=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[v,b]}),e[34]=b,e[35]=i,e[36]=d,e[37]=v,e[38]=S):S=e[38],S})),Q=h.memo(r=>{let a=(0,J.c)(5),{children:e,cellId:n}=r,c;a[0]===n?c=a[1]:(c=ve(n),a[0]=n,a[1]=c);let m=$(c);if(!m)return null;let p;return a[2]!==e||a[3]!==m?(p=(0,t.jsx)(L,{showTooltip:!1,...m,children:e}),a[2]=e,a[3]=m,a[4]=p):p=a[4],p});Q.displayName="ConnectionCellActionsDropdown";function ke(r){return!r.redundant}function Ce(r){return r.filter(ke)}function _e(r){return r.length>0}function Se(r){return!r}var Ie=V();const U=Z("minimap");function De(){let r=(0,Ie.c)(3),[a,e]=Y(U),n;return r[0]!==a||r[1]!==e?(n={dependencyPanelTab:a,setDependencyPanelTab:e},r[0]=a,r[1]=e,r[2]=n):n=r[2],n}function Pe(){return X(U)}export{we as a,Q as i,Pe as n,L as r,De as t};
@@ -1,4 +1,4 @@
1
- import{s as Me}from"./chunk-LvLJmgfZ.js";import{d as Q,l as ft,p as xt,u as he}from"./useEvent-D91BmmQi.js";import{t as yt}from"./react-Bj1aDYRI.js";import{D as Se,Dn as kt,Dr as bt,E as wt,Ii as we,Mn as jt,On as gt,Sr as vt,Yr as Ct,Zt as zt,_ as Wt,_r as _t,ct as Mt,h as Ne,kn as St,st as Nt,t as Dt,ut as De,yr as Pt}from"./cells-Dnu4nDoy.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,x as It}from"./ai-model-dropdown-CjhUqXgj.js";import{_ as X,d as Pe}from"./useEventListener-DvoEXWke.js";import{y as $t}from"./utils-Wvjk_Y4h.js";import{n as B,t as Ae}from"./constants-DMpttj8Q.js";import{T as me,n as Lt,o as Et,v as Tt,w as Rt}from"./config-C2lTvbuU.js";import{n as Ht}from"./switch-BtkQp293.js";import{t as Ot}from"./jsx-runtime-BqBOg78p.js";import{o as Ut}from"./alert-dialog-BqFLkbUc.js";import{a as qt,c as Bt,o as Ie,s as Ft}from"./popover-Bz_0Vkyf.js";import{a as Vt,c as Yt,i as Kt,n as Gt,r as Jt,s as Zt,t as Qt}from"./select-DZcFyKFQ.js";import{St as Xt}from"./JsonOutput-BEbyS3oG.js";import{c as $e,d as je,n as ea,o as ta,r as ge,t as aa}from"./download-BO6T2USS.js";import{t as ve}from"./tooltip-DTV9tlSr.js";import{r as Le,t as G}from"./button-BbCh-29a.js";import{i as oa,r as na,t as Ee}from"./strings-wdPMRf6Z.js";import{r as ee}from"./requests-DIwGYs0l.js";import{t as z}from"./createLucideIcon-D5guW7EU.js";import{F as sa,I as la,L as Te,P as ia,R as ra,a as Re,i as He,u as Oe}from"./layout-BX294DMP.js";import{t as pe}from"./check-BH35Ndha.js";import{r as da}from"./useCellActionButton-CpNJthj4.js";import{t as Ce}from"./copy-BwrPA9zQ.js";import{t as ca}from"./external-link-BTNxSavU.js";import{t as ha}from"./eye-off-BT-KOYV5.js";import{t as ue}from"./file-HTLbeC2b.js";import{t as ma}from"./github-raQvpeuZ.js";import{u as pa}from"./form-CM8vYbSt.js";import{n as ua,r as fa,t as xa}from"./youtube-3lRHw8NU.js";import{i as ya,n as Ue}from"./add-connection-dialog-Cw6_iYno.js";import{t as ka}from"./house-D2ldnAB9.js";import{t as ba}from"./image-BIibSXT6.js";import{t as wa}from"./link-CoJxTwWE.js";import{r as ja}from"./input-CVE-gIjt.js";import{t as ga}from"./settings-SnYErNWQ.js";import{t as va}from"./sparkles-CC9Bko6a.js";import{y as Ca}from"./textarea-BBTcSr-i.js";import{t as za}from"./square-rACnnz-q.js";import{t as F}from"./use-toast-ERM44-k9.js";import{n as qe,t as Wa}from"./paths-SFhaqGlE.js";import{o as _a}from"./session-DGdfs0bJ.js";import{n as te}from"./copy-Ch48HVPK.js";import{r as Ma}from"./useRunCells-C0BPo9m1.js";import{a as Be,c as Fe,i as Ve,n as Ye,r as Ke}from"./dialog-DqOQT_n4.js";import{n as ze}from"./ImperativeModal-DEC1mXgV.js";import{r as Sa,t as Ge}from"./share-oorMPghT.js";import{a as Na}from"./cell-link-PQYiMZw1.js";import{a as Da}from"./renderShortcut-DK-VjfaX.js";import{t as Pa}from"./icons-8tfAri2V.js";import{n as Je}from"./marimo-icons-CUuBQ0ae.js";import{t as Aa}from"./links-Av1BIe0O.js";import{r as Ia,t as Ze}from"./hooks-CizEp07l.js";import{t as Qe}from"./types-DZmRsGZN.js";var $a=z("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),La=z("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Xe=z("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"}]]),et=z("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"}]]),tt=z("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"}]]),Ea=z("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"}]]),Ta=z("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"}]]),Ra=z("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"}]]),Ha=z("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"}]]),Oa=z("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),at=z("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"}]]),Ua=z("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"}]]),qa=z("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"}]]),ot=z("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"}]]),fe=q(),V=Me(yt(),1),a=Me(Ot(),1),Ba=["claude","codex","opencode"];function Fa(){return"uvx marimo@latest"}function Va(t,e,o){let n=o?" --with-token":"",l=`${Fa()} pair prompt --url '${e}'${n}`;switch(t){case"claude":return`claude "$(${l} --claude)"`;case"codex":return`codex "$(${l} --codex)"`;case"opencode":return`opencode --prompt "$(${l} --opencode)"`;default:na(t)}}function nt(t,e){let o=e?`
1
+ import{s as Me}from"./chunk-LvLJmgfZ.js";import{d as Q,l as ft,p as xt,u as he}from"./useEvent-D91BmmQi.js";import{t as yt}from"./react-Bj1aDYRI.js";import{D as Se,Dn as kt,Dr as bt,E as wt,Ii as we,Mn as jt,On as gt,Sr as vt,Yr as Ct,Zt as zt,_ as Wt,_r as _t,ct as Mt,h as Ne,kn as St,st as Nt,t as Dt,ut as De,yr as Pt}from"./cells-Dnu4nDoy.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,x as It}from"./ai-model-dropdown-CjhUqXgj.js";import{_ as X,d as Pe}from"./useEventListener-DvoEXWke.js";import{y as $t}from"./utils-Wvjk_Y4h.js";import{n as B,t as Ae}from"./constants-DMpttj8Q.js";import{T as me,n as Lt,o as Et,v as Tt,w as Rt}from"./config-C2lTvbuU.js";import{n as Ht}from"./switch-BtkQp293.js";import{t as Ot}from"./jsx-runtime-BqBOg78p.js";import{o as Ut}from"./alert-dialog-BqFLkbUc.js";import{a as qt,c as Bt,o as Ie,s as Ft}from"./popover-Bz_0Vkyf.js";import{a as Vt,c as Yt,i as Kt,n as Gt,r as Jt,s as Zt,t as Qt}from"./select-DZcFyKFQ.js";import{St as Xt}from"./JsonOutput-05-R3eil.js";import{c as $e,d as je,n as ea,o as ta,r as ge,t as aa}from"./download-B1QFVDP-.js";import{t as ve}from"./tooltip-DTV9tlSr.js";import{r as Le,t as G}from"./button-BbCh-29a.js";import{i as oa,r as na,t as Ee}from"./strings-wdPMRf6Z.js";import{r as ee}from"./requests-DIwGYs0l.js";import{t as z}from"./createLucideIcon-D5guW7EU.js";import{F as sa,I as la,L as Te,P as ia,R as ra,a as Re,i as He,u as Oe}from"./layout-DEU6lX-9.js";import{t as pe}from"./check-BH35Ndha.js";import{r as da}from"./useCellActionButton-QaDO24oW.js";import{t as Ce}from"./copy-BwrPA9zQ.js";import{t as ca}from"./external-link-BTNxSavU.js";import{t as ha}from"./eye-off-BT-KOYV5.js";import{t as ue}from"./file-HTLbeC2b.js";import{t as ma}from"./github-raQvpeuZ.js";import{u as pa}from"./form-BjUJP6PJ.js";import{n as ua,r as fa,t as xa}from"./youtube-3lRHw8NU.js";import{i as ya,n as Ue}from"./add-connection-dialog-CzxRpS5F.js";import{t as ka}from"./house-D2ldnAB9.js";import{t as ba}from"./image-BIibSXT6.js";import{t as wa}from"./link-CoJxTwWE.js";import{r as ja}from"./input-CVE-gIjt.js";import{t as ga}from"./settings-SnYErNWQ.js";import{t as va}from"./sparkles-CC9Bko6a.js";import{y as Ca}from"./textarea-BBTcSr-i.js";import{t as za}from"./square-rACnnz-q.js";import{t as F}from"./use-toast-ERM44-k9.js";import{n as qe,t as Wa}from"./paths-SFhaqGlE.js";import{o as _a}from"./session-DGdfs0bJ.js";import{n as te}from"./copy-Ch48HVPK.js";import{r as Ma}from"./useRunCells-C0BPo9m1.js";import{a as Be,c as Fe,i as Ve,n as Ye,r as Ke}from"./dialog-DqOQT_n4.js";import{n as ze}from"./ImperativeModal-DEC1mXgV.js";import{r as Sa,t as Ge}from"./share-oorMPghT.js";import{a as Na}from"./cell-link-PQYiMZw1.js";import{a as Da}from"./renderShortcut-DK-VjfaX.js";import{t as Pa}from"./icons-8tfAri2V.js";import{n as Je}from"./marimo-icons-CUuBQ0ae.js";import{t as Aa}from"./links-Av1BIe0O.js";import{r as Ia,t as Ze}from"./hooks-jWLD3t7P.js";import{t as Qe}from"./types-DZmRsGZN.js";var $a=z("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),La=z("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Xe=z("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"}]]),et=z("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"}]]),tt=z("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"}]]),Ea=z("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"}]]),Ta=z("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"}]]),Ra=z("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"}]]),Ha=z("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"}]]),Oa=z("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),at=z("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"}]]),Ua=z("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"}]]),qa=z("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"}]]),ot=z("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"}]]),fe=q(),V=Me(yt(),1),a=Me(Ot(),1),Ba=["claude","codex","opencode"];function Fa(){return"uvx marimo@latest"}function Va(t,e,o){let n=o?" --with-token":"",l=`${Fa()} pair prompt --url '${e}'${n}`;switch(t){case"claude":return`claude "$(${l} --claude)"`;case"codex":return`codex "$(${l} --codex)"`;case"opencode":return`opencode --prompt "$(${l} --opencode)"`;default:na(t)}}function nt(t,e){let o=e?`
2
2
 
3
3
  Use this auth token when calling \`execute-code.sh\`: \`execute-code.sh --url '${t}' --token '${e}'\`.`:"";return["Use the /marimo-pair skill to pair-program on a running marimo notebook.","",`Connect to the notebook at: ${t}`,"",`Use \`execute-code.sh --url ${t}\` from the marimo-pair skill to execute code in the notebook.${o}`,"","Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."].join(`
4
4
  `)}function st(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var lt="npx skills add marimo-team/marimo-pair",Ya={claude:"Claude",codex:"Codex",opencode:"OpenCode",prompt:"Prompt"};function Ka(){let t=(0,fe.c)(2),[e,o]=(0,V.useState)(null),n,l;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{fetch(Lt("/auth/token").href,{headers:Ht.headers()}).then(Ga).then(d=>o((d==null?void 0:d.token)??null)).catch(()=>o(null))},l=[],t[0]=n,t[1]=l):(n=t[0],l=t[1]),(0,V.useEffect)(n,l),e}function Ga(t){return t.ok?t.json():null}const Ja=t=>{let e=(0,fe.c)(64),{onClose:o}=t,[n,l]=(0,V.useState)("claude"),d=Et(),s=Ka(),i=!!s,r,c,j,k,m,p,h,u,x,f,b,y,g,v,D,P,W,A,C,_;if(e[0]!==n||e[1]!==s||e[2]!==i||e[3]!==d.httpURL){let R=d.httpURL.toString();m=Ye,b="sm:max-w-2xl";let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(Fe,{children:"Pair with an agent"}),e[24]=O):O=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsxs)(Be,{children:[O,(0,a.jsxs)(Ke,{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[25]=y):y=e[25],f="flex flex-col gap-4 py-2",k=qt,_=n,e[26]===Symbol.for("react.memo_cache_sentinel")?(h=U=>l(U),e[26]=h):h=e[26];let H;e[27]===Symbol.for("react.memo_cache_sentinel")?(H=["claude","codex","opencode","prompt"],e[27]=H):H=e[27],e[28]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(Ft,{className:"w-full",children:H.map(Za)}),e[28]=u):u=e[28],x=Ba.map(U=>(0,a.jsxs)(Ie,{value:U,className:"mt-4 flex flex-col gap-4",children:[(0,a.jsx)(ae,{index:1,title:"Install the skill",hint:"Run once per machine.",children:(0,a.jsx)(oe,{command:lt})}),(0,a.jsx)(ae,{index:2,title:"Run in your terminal",children:(0,a.jsx)(oe,{command:Va(U,R,i)})}),i&&s&&(0,a.jsx)(ae,{index:3,title:"Paste when prompted for a token",children:(0,a.jsx)(oe,{command:s,display:st(s)})})]},U)),j=Ie,W="prompt",A="mt-4 flex flex-col gap-4",e[29]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsx)(ae,{index:1,title:"Make sure the marimo-pair skill is available to your agent",hint:"Skip if your agent already has it.",children:(0,a.jsx)(oe,{command:lt})}),e[29]=C):C=e[29],c=ae,v=2,D="Copy this prompt into your agent",P=i?"Includes your auth token \u2014 keep it private.":void 0,r=oe,p=nt(R,s),g=nt(R,s?st(s):null),e[0]=n,e[1]=s,e[2]=i,e[3]=d.httpURL,e[4]=r,e[5]=c,e[6]=j,e[7]=k,e[8]=m,e[9]=p,e[10]=h,e[11]=u,e[12]=x,e[13]=f,e[14]=b,e[15]=y,e[16]=g,e[17]=v,e[18]=D,e[19]=P,e[20]=W,e[21]=A,e[22]=C,e[23]=_}else r=e[4],c=e[5],j=e[6],k=e[7],m=e[8],p=e[9],h=e[10],u=e[11],x=e[12],f=e[13],b=e[14],y=e[15],g=e[16],v=e[17],D=e[18],P=e[19],W=e[20],A=e[21],C=e[22],_=e[23];let I;e[30]!==r||e[31]!==p||e[32]!==g?(I=(0,a.jsx)(r,{command:p,display:g,multiline:!0}),e[30]=r,e[31]=p,e[32]=g,e[33]=I):I=e[33];let $;e[34]!==c||e[35]!==I||e[36]!==v||e[37]!==D||e[38]!==P?($=(0,a.jsx)(c,{index:v,title:D,hint:P,children:I}),e[34]=c,e[35]=I,e[36]=v,e[37]=D,e[38]=P,e[39]=$):$=e[39];let L;e[40]!==j||e[41]!==$||e[42]!==W||e[43]!==A||e[44]!==C?(L=(0,a.jsxs)(j,{value:W,className:A,children:[C,$]}),e[40]=j,e[41]=$,e[42]=W,e[43]=A,e[44]=C,e[45]=L):L=e[45];let S;e[46]!==k||e[47]!==h||e[48]!==u||e[49]!==x||e[50]!==L||e[51]!==_?(S=(0,a.jsxs)(k,{value:_,onValueChange:h,children:[u,x,L]}),e[46]=k,e[47]=h,e[48]=u,e[49]=x,e[50]=L,e[51]=_,e[52]=S):S=e[52];let E;e[53]!==f||e[54]!==S?(E=(0,a.jsx)("div",{className:f,children:S}),e[53]=f,e[54]=S,e[55]=E):E=e[55];let N;e[56]===o?N=e[57]:(N=(0,a.jsx)(Ve,{children:(0,a.jsx)(G,{variant:"secondary",onClick:o,children:"Close"})}),e[56]=o,e[57]=N);let T;return e[58]!==m||e[59]!==b||e[60]!==y||e[61]!==E||e[62]!==N?(T=(0,a.jsxs)(m,{className:b,children:[y,E,N]}),e[58]=m,e[59]=b,e[60]=y,e[61]=E,e[62]=N,e[63]=T):T=e[63],T};var ae=t=>{let e=(0,fe.c)(11),{index:o,title:n,hint:l,children:d}=t,s;e[0]!==o||e[1]!==n?(s=(0,a.jsxs)("span",{className:"text-sm font-medium",children:[o,". ",n]}),e[0]=o,e[1]=n,e[2]=s):s=e[2];let i;e[3]===l?i=e[4]:(i=l&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=i);let r;e[5]!==s||e[6]!==i?(r=(0,a.jsxs)("div",{className:"flex items-baseline gap-2",children:[s,i]}),e[5]=s,e[6]=i,e[7]=r):r=e[7];let c;return e[8]!==d||e[9]!==r?(c=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[r,d]}),e[8]=d,e[9]=r,e[10]=c):c=e[10],c},oe=t=>{let e=(0,fe.c)(28),{command:o,display:n,multiline:l}=t,d=l===void 0?!1:l,[s,i]=(0,V.useState)(!1),r;e[0]===o?r=e[1]:(r=Le.stopPropagation(async x=>{x.preventDefault(),await te(o),i(!0),setTimeout(()=>i(!1),2e3)}),e[0]=o,e[1]=r);let c=r;if(d){let x=n??o,f;e[2]===x?f=e[3]:(f=(0,a.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words px-3 py-2 pr-10 font-mono text-xs select-all",children:x}),e[2]=x,e[3]=f);let b;e[4]===s?b=e[5]:(b=s?(0,a.jsx)(pe,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=b);let y;e[6]!==c||e[7]!==b?(y=(0,a.jsx)(G,{onClick:c,size:"xs",variant:"ghost",className:"absolute right-1 top-1",children:b}),e[6]=c,e[7]=b,e[8]=y):y=e[8];let g;e[9]!==s||e[10]!==y?(g=(0,a.jsx)(ve,{content:"Copied!",open:s,children:y}),e[9]=s,e[10]=y,e[11]=g):g=e[11];let v;return e[12]!==f||e[13]!==g?(v=(0,a.jsxs)("div",{className:"relative rounded-md bg-muted",children:[f,g]}),e[12]=f,e[13]=g,e[14]=v):v=e[14],v}let j=n??o,k;e[15]===j?k=e[16]:(k=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:j}),e[15]=j,e[16]=k);let m;e[17]===s?m=e[18]:(m=s?(0,a.jsx)(pe,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[17]=s,e[18]=m);let p;e[19]!==c||e[20]!==m?(p=(0,a.jsx)(G,{onClick:c,size:"xs",variant:"ghost",children:m}),e[19]=c,e[20]=m,e[21]=p):p=e[21];let h;e[22]!==s||e[23]!==p?(h=(0,a.jsx)(ve,{content:"Copied!",open:s,children:p}),e[22]=s,e[23]=p,e[24]=h):h=e[24];let u;return e[25]!==k||e[26]!==h?(u=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[k,h]}),e[25]=k,e[26]=h,e[27]=u):u=e[27],u};function Za(t){return(0,a.jsx)(Bt,{value:t,className:"flex-1",children:Ya[t]},t)}var it=q(),xe="https://static.marimo.app";const Qa=t=>{let e=(0,it.c)(25),{onClose:o}=t,[n,l]=(0,V.useState)(""),{exportAsHTML:d}=ee(),s=`${n}-${Math.random().toString(36).slice(2,6)}`,i=`${xe}/static/${s}`,r;e[0]!==d||e[1]!==o||e[2]!==s?(r=async y=>{y.preventDefault(),o();let g=await d({download:!1,includeCode:!0,files:ia.INSTANCE.filenames()}),v=F({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${xe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:g,path:s})}).catch(()=>{v.dismiss(),F({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:B.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),F({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]=d,e[1]=o,e[2]=s,e[3]=r):r=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 j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Ke,{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:xe,target:"_blank",children:xe}),"."]})]}),e[5]=j):j=e[5];let k;e[6]===Symbol.for("react.memo_cache_sentinel")?(k=y=>{l(y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=k):k=e[6];let m;e[7]===n?m=e[8]:(m=(0,a.jsx)(ja,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:n,placeholder:"Notebook slug",onChange:k,required:!0,autoComplete:"off"}),e[7]=n,e[8]=m);let p;e[9]===i?p=e[10]:(p=(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)(Xa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),e[9]=i,e[10]=p);let h;e[11]!==m||e[12]!==p?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,p]}),e[11]=m,e[12]=p,e[13]=h):h=e[13];let u;e[14]===o?u=e[15]:(u=(0,a.jsx)(G,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:o,children:"Cancel"}),e[14]=o,e[15]=u);let x;e[16]===i?x=e[17]:(x=(0,a.jsx)(G,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await te(i)},children:"Create"}),e[16]=i,e[17]=x);let f;e[18]!==u||e[19]!==x?(f=(0,a.jsxs)(Ve,{children:[u,x]}),e[18]=u,e[19]=x,e[20]=f):f=e[20];let b;return e[21]!==r||e[22]!==f||e[23]!==h?(b=(0,a.jsx)(Ye,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:r,children:[j,h,f]})}),e[21]=r,e[22]=f,e[23]=h,e[24]=b):b=e[24],b};var Xa=t=>{let e=(0,it.c)(8),[o,n]=V.useState(!1),l;e[0]===t.text?l=e[1]:(l=Le.stopPropagation(async c=>{c.preventDefault(),await te(t.text),n(!0),setTimeout(()=>n(!1),2e3)}),e[0]=t.text,e[1]=l);let d=l,s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[2]=s):s=e[2];let i;e[3]===d?i=e[4]:(i=(0,a.jsx)(G,{"data-testid":"copy-static-notebook-url-button",onClick:d,size:"xs",variant:"secondary",children:s}),e[3]=d,e[4]=i);let r;return e[5]!==o||e[6]!==i?(r=(0,a.jsx)(ve,{content:"Copied!",open:o,children:i}),e[5]=o,e[6]=i,e[7]=r):r=e[7],r},eo=q();function to(){let t=document.getElementsByClassName(Ae.outputArea);for(let e of t){let o=e.getBoundingClientRect();if(o.bottom>0&&o.top<window.innerHeight){let n=we.findElement(e);if(!n){X.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:we.parse(n.id)}}}return X.warn("No visible output area found for scroll anchor"),null}function ao(t){if(!t){X.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(we.create(t.cellId));if(!e){X.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Ae.outputArea}`)){X.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function rt(){let t=(0,eo.c)(2),e=Q(De),o;return t[0]===e?o=t[1]:(o=()=>{let n=to();e(l=>({mode:Mt(l.mode),cellAnchor:(n==null?void 0:n.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ao(n)})})},t[0]=e,t[1]=o),o}const dt=xt(!1);var oo=q();const no=()=>{let t=(0,oo.c)(7),{selectedLayout:e}=Re(),{setLayoutView:o}=He();if(me()&&!jt("wasm_layouts"))return null;let n;t[0]===o?n=t[1]:(n=i=>o(i),t[0]=o,t[1]=n);let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Zt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Yt,{placeholder:"Select a view"})}),t[2]=l):l=t[2];let d;t[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(Gt,{children:(0,a.jsxs)(Jt,{children:[(0,a.jsx)(Vt,{children:"View as"}),Qe.map(lo)]})}),t[3]=d):d=t[3];let s;return t[4]!==e||t[5]!==n?(s=(0,a.jsxs)(Qt,{"data-testid":"layout-select",value:e,onValueChange:n,children:[l,d]}),t[4]=e,t[5]=n,t[6]=s):s=t[6],s};function so(t){return(0,a.jsx)(ct(t),{className:"h-4 w-4"})}function ct(t){switch(t){case"vertical":return Ra;case"grid":return fa;case"slides":return at;default:return oa(t),za}}function ht(t){return Ee.startCase(t)}function lo(t){return(0,a.jsx)(Kt,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[so(t),(0,a.jsx)("span",{children:ht(t)})]})},t)}async function io(t){let{filename:e,preset:o,downloadPDF:n}=t;await n({filename:e,webpdf:!1,preset:o,includeInputs:!0,rasterServer:"static"})}var ro=q();function co(t){let e=(0,ro.c)(5),{openPrompt:o,closeModal:n}=ze(),{sendCopy:l}=ee(),d;return e[0]!==n||e[1]!==o||e[2]!==l||e[3]!==t?(d=()=>{if(!t)return null;let s=Wa.guessDeliminator(t);o({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let r=s.join(qe.dirname(t),i);l({source:t,destination:r}).then(()=>{n(),F({title:"Notebook copied",description:"A copy of the notebook has been created."}),Aa(r)})}})},e[0]=n,e[1]=o,e[2]=l,e[3]=t,e[4]=d):d=e[4],d}const ho=()=>{let{updateCellConfig:t}=Se(),{saveCellConfig:e}=ee();return(0,V.useCallback)(async()=>{let o=new zt,n=Ne(),l=n.cellIds.inOrderIds,d={};for(let i of l){if(n.cellData[i]===void 0)continue;let{code:r,config:c}=n.cellData[i];c.hide_code||o.isSupported(r)&&(d[i]={hide_code:!0})}let s=Pe.entries(d);if(s.length!==0){await e({configs:d});for(let[i,r]of s)t({cellId:i,config:r})}},[t])};var mo=q();function mt(){let t=(0,mo.c)(4),{openConfirm:e}=ze(),o=Q(Tt),{sendRestart:n}=ee(),l;return t[0]!==e||t[1]!==n||t[2]!==o?(l=()=>{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)(Ut,{onClick:async()=>{o({state:Rt.CLOSING}),await n(),Sa()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o,t[3]=l):l=t[3],l}var po=q(),J=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function uo(){var We,_e;let t=(0,po.c)(52),e=Na(),{openModal:o,closeModal:n}=ze(),{toggleApplication:l}=kt(),{selectedPanel:d}=gt(),[s]=ft(De),i=he(Nt),r=ho(),[c]=$t(),{updateCellConfig:j,undoDeleteCell:k,clearAllCellOutputs:m,addSetupCellIfDoesntExist:p,collapseAllCells:h,expandAllCells:u}=Se(),x=mt(),f=Ma(),b=co(e),y=Q(dt),g=Q(At),v=Q(It),{exportAsIPYNB:D,exportAsMarkdown:P,readCode:W,saveCellConfig:A,updateCellOutputs:C}=ee(),_=Ia(),I=he(Wt),$=he(Dt),L=he(wt),{selectedLayout:S}=Re(),{setLayoutView:E}=He(),N=rt(),T=((We=c.sharing)==null?void 0:We.html)??!0,R=((_e=c.sharing)==null?void 0:_e.wasm)??!0,O=!me(),H=S==="slides",U=Po,pt=Do,ne;t[0]!==e||t[1]!==_||t[2]!==C?(ne=async w=>{let{preset:M,title:Z}=w;if(!e){ye();return}await $e(Z,async be=>{await Ze({takeScreenshots:()=>_({progress:be}),updateCellOutputs:C}),await io({filename:e,preset:M,downloadPDF:ea})})},t[0]=e,t[1]=_,t[2]=C,t[3]=ne):ne=t[3];let Y=ne,se;t[4]===Y?se=t[5]:(se=async()=>{if(O){await Y({preset:"document",title:"Downloading Document PDF..."});return}let w=new Event("export-beforeprint"),M=new Event("export-afterprint");window.dispatchEvent(w),setTimeout(No,0),setTimeout(()=>window.dispatchEvent(M),0)},t[4]=Y,t[5]=se);let le=se,ie;t[6]!==D||t[7]!==e||t[8]!==_||t[9]!==C?(ie=async()=>{if(!e){ye();return}await $e("Downloading IPYNB...",async w=>{await Ze({takeScreenshots:()=>_({progress:w}),updateCellOutputs:C});let M=await D({download:!1});ge(new Blob([M],{type:"application/x-ipynb+json"}),je.toIPYNB(document.title))})},t[6]=D,t[7]=e,t[8]=_,t[9]=C,t[10]=ie):ie=t[10];let ke=ie,re;t[11]===Symbol.for("react.memo_cache_sentinel")?(re=(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),t[11]=re):re=t[11];let de;t[12]===Symbol.for("react.memo_cache_sentinel")?(de=(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),t[12]=de):de=t[12];let K;t[13]===e?K=t[14]:(K=async()=>{if(!e){ye();return}await Oe({filename:e,includeCode:!0})},t[13]=e,t[14]=K);let ce;return t[15]!==p||t[16]!==$||t[17]!==m||t[18]!==n||t[19]!==h||t[20]!==b||t[21]!==Y||t[22]!==u||t[23]!==P||t[24]!==e||t[25]!==le||t[26]!==ke||t[27]!==I||t[28]!==r||t[29]!==H||t[30]!==i||t[31]!==o||t[32]!==W||t[33]!==x||t[34]!==f||t[35]!==A||t[36]!==S||t[37]!==d||t[38]!==y||t[39]!==v||t[40]!==E||t[41]!==g||t[42]!==T||t[43]!==R||t[44]!==K||t[45]!==l||t[46]!==N||t[47]!==k||t[48]!==L||t[49]!==j||t[50]!==s.mode?(ce=[{icon:re,label:"Download",handle:J,dropdown:[{icon:de,label:"Download as HTML",handle:K},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ye();return}await Oe({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Pa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let w=await P({download:!1});ge(new Blob([w],{type:"text/plain"}),je.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ha,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ke},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let w=await W();ge(new Blob([w.contents],{type:"text/plain"}),je.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Da("global.hideCode",!1)]}),handle:So},H?{divider:!0,icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:J,dropdown:[{icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:le},{icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:pt(!0),hidden:!O,handle:async()=>{await Y({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ue,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:le}]},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:me(),handle:async()=>{o((0,a.jsx)(Ja,{onClose:n}))}},{icon:(0,a.jsx)(Ua,{size:14,strokeWidth:1.5}),label:"Share",handle:J,hidden:!T&&!R,dropdown:[{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!T,handle:async()=>{o((0,a.jsx)(Qa,{onClose:n}))}},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!R,handle:async()=>{await te(Ge({code:(await W()).contents})),F({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Create molab notebook",handle:async()=>{let w=Ge({code:(await W()).contents,baseUrl:`${B.molab}/new`});window.open(w,"_blank")}}]},{icon:(0,a.jsx)(Oa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:J,dropdown:St.flatMap(w=>{let{type:M,Icon:Z,hidden:be,additionalKeywords:ut}=w;return be?[]:{label:Ee.startCase(M),rightElement:U(d===M),icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),handle:()=>l(M),additionalKeywords:ut}})},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Present as",handle:J,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}):(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{N()}},...Qe.map((w,M)=>{let Z=ct(w);return{divider:M===0,label:ht(w),icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:S===w&&(0,a.jsx)(pe,{size:14})}),handle:()=>{E(w),s.mode==="edit"&&N()}}})]},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||me(),handle:b},{icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await te((await W()).contents),F({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!I||i,handle:async()=>{let w=Ct(Ne());await A({configs:Pe.fromEntries(w.map(Mo))});for(let M of w)j({cellId:M,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{p({})}},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{o((0,a.jsx)(Ue,{onClose:n}))}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{o((0,a.jsx)(Ue,{defaultTab:"storage",onClose:n}))}},{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:L,hidden:!$||i,handle:()=>{k()}},{icon:(0,a.jsx)(qa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:x,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{f()}},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:r,redundant:!0},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:h,redundant:!0},{icon:(0,a.jsx)($a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:u,redundant:!0},{divider:!0,icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>y(_o)},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(Wo)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>g(zo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Resources",handle:J,dropdown:[{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Co},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"GitHub",handle:vo},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:go},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"YouTube",handle:jo},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Changelog",handle:wo}]},{divider:!0,icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:bo},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ko}].filter(yo).map(fo),t[15]=p,t[16]=$,t[17]=m,t[18]=n,t[19]=h,t[20]=b,t[21]=Y,t[22]=u,t[23]=P,t[24]=e,t[25]=le,t[26]=ke,t[27]=I,t[28]=r,t[29]=H,t[30]=i,t[31]=o,t[32]=W,t[33]=x,t[34]=f,t[35]=A,t[36]=S,t[37]=d,t[38]=y,t[39]=v,t[40]=E,t[41]=g,t[42]=T,t[43]=R,t[44]=K,t[45]=l,t[46]=N,t[47]=k,t[48]=L,t[49]=j,t[50]=s.mode,t[51]=ce):ce=t[51],ce}function fo(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(xo)}:t}function xo(t){return!t.hidden}function yo(t){return!t.hidden}function ko(){let t=_a();window.open(t,"_blank")}function bo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function wo(){window.open(B.releasesPage,"_blank")}function jo(){window.open(B.youtube,"_blank")}function go(){window.open(B.discordLink,"_blank")}function vo(){window.open(B.githubPage,"_blank")}function Co(){window.open(B.docsPage,"_blank")}function zo(t){return!t}function Wo(t){return!t}function _o(t){return!t}function Mo(t){return[t,{disabled:!1}]}async function So(){let t=document.getElementById("App");t&&await ta({element:t,filename:document.title,prepare:aa})}function No(){return window.print()}function Do(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 Po(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(pe,{size:14})})}function ye(){F({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{rt as a,et as c,dt as i,Xe as l,mt as n,ot as o,no as r,tt as s,uo 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-Cu94n5mj.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-CA2sQKnW.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-DdZsAcJe.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
@@ -175,7 +175,7 @@
175
175
  <link rel="modulepreload" crossorigin href="./assets/field-DNlzfMKW.js">
176
176
  <link rel="modulepreload" crossorigin href="./assets/popover-Bz_0Vkyf.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/errors-iwK4b4VF.js">
178
- <link rel="modulepreload" crossorigin href="./assets/download-BO6T2USS.js">
178
+ <link rel="modulepreload" crossorigin href="./assets/download-B1QFVDP-.js">
179
179
  <link rel="modulepreload" crossorigin href="./assets/table-DQE9hQzM.js">
180
180
  <link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-DPVTppnD.js">
181
181
  <link rel="modulepreload" crossorigin href="./assets/error-banner-CLO6LFll.js">
@@ -195,7 +195,7 @@
195
195
  <link rel="modulepreload" crossorigin href="./assets/message-circle-1YLdnr8A.js">
196
196
  <link rel="modulepreload" crossorigin href="./assets/trash-2-BJLYnZpG.js">
197
197
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-Ce2ksurd.js">
198
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BEbyS3oG.js">
198
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-05-R3eil.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-nqk474t8.js">
200
200
  <link rel="modulepreload" crossorigin href="./assets/square-function-blYaQso8.js">
201
201
  <link rel="modulepreload" crossorigin href="./assets/spec-D1ptWKg6.js">
@@ -203,7 +203,7 @@
203
203
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-a_9k9BK7.js">
204
204
  <link rel="modulepreload" crossorigin href="./assets/tree-actions-DY8FUp3V.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/components-zB5yT_R8.js">
206
- <link rel="modulepreload" crossorigin href="./assets/column-preview-DA6nf5_Q.js">
206
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-BLIWbdOX.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/icons-8tfAri2V.js">
208
208
  <link rel="modulepreload" crossorigin href="./assets/radio-group-rsi1ibXY.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/floating-outline-DbOtUfo-.js">
@@ -228,7 +228,7 @@
228
228
  <link rel="modulepreload" crossorigin href="./assets/label-xHqFtfdz.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/textarea-BBTcSr-i.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DLc784Sj.js">
231
- <link rel="modulepreload" crossorigin href="./assets/form-CM8vYbSt.js">
231
+ <link rel="modulepreload" crossorigin href="./assets/form-BjUJP6PJ.js">
232
232
  <link rel="modulepreload" crossorigin href="./assets/renderShortcut-DK-VjfaX.js">
233
233
  <link rel="modulepreload" crossorigin href="./assets/useBoolean-B8LMGUHl.js">
234
234
  <link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-CWcgQCbT.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.23.7-dev76",
3
+ "version": "0.23.7-dev78",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -80,22 +80,26 @@ const DownloadButton = ({
80
80
  const [isLoading, setIsLoading] = useState(false);
81
81
 
82
82
  const handleClick = async (e: React.MouseEvent) => {
83
- if (!data.lazy) {
83
+ if (data.disabled) {
84
+ e.preventDefault();
85
+ e.stopPropagation();
84
86
  return;
85
87
  }
86
88
 
87
- if (data.disabled) {
89
+ e.preventDefault();
90
+
91
+ if (!data.lazy) {
92
+ downloadByURL(data.data, data.filename ?? undefined);
88
93
  return;
89
94
  }
90
95
 
91
- e.preventDefault();
92
96
  setIsLoading(true);
93
97
 
94
98
  try {
95
99
  const loadedData = await load({});
96
100
  downloadByURL(
97
101
  loadedData.data,
98
- loadedData.filename || data.filename || "download",
102
+ loadedData.filename ?? data.filename ?? undefined,
99
103
  );
100
104
  } catch (error) {
101
105
  toast({
@@ -114,9 +118,7 @@ const DownloadButton = ({
114
118
  return (
115
119
  <a
116
120
  href={data.data}
117
- download={data.filename || true}
118
- target="_blank"
119
- rel="noopener noreferrer"
121
+ download={data.filename ?? ""}
120
122
  onClick={handleClick}
121
123
  className={buttonVariants({
122
124
  variant: "secondary",
@@ -175,10 +175,12 @@ export async function downloadHTMLAsImage(opts: {
175
175
  }
176
176
  }
177
177
 
178
- export function downloadByURL(url: string, filename: string) {
178
+ export function downloadByURL(url: string, filename?: string) {
179
179
  const a = document.createElement("a");
180
180
  a.href = url;
181
- a.download = filename;
181
+ if (filename) {
182
+ a.download = filename;
183
+ }
182
184
  a.click();
183
185
  a.remove();
184
186
  }