@marimo-team/frontend 0.18.5-dev186 → 0.18.5-dev189

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 (77) hide show
  1. package/dist/assets/{CellStatus-DqLx71xI.js → CellStatus-Bo1x1B6n.js} +1 -1
  2. package/dist/assets/{JsonOutput-3u2O9mUd.js → JsonOutput-BCHaEg3R.js} +1 -1
  3. package/dist/assets/MarimoErrorOutput-BIIhR96K.js +7 -0
  4. package/dist/assets/{RenderHTML-Dp8s4Bzr.js → RenderHTML-BUhX0rkG.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-DTIq0l6h.js → add-cell-with-ai-CLrEdPGH.js} +1 -1
  6. package/dist/assets/{add-database-form-C20ZnUUx.js → add-database-form-DkSxzOXk.js} +1 -1
  7. package/dist/assets/{agent-panel-D08HI0-X.js → agent-panel-Bz7HLWO3.js} +2 -2
  8. package/dist/assets/{ai-model-dropdown-CK5sei5N.js → ai-model-dropdown-ea-cOLAL.js} +1 -1
  9. package/dist/assets/{app-config-button-Ce5Tkr5O.js → app-config-button-BFjdAlTt.js} +1 -1
  10. package/dist/assets/{cell-link-B7EjqLUL.js → cell-link-DNVmmRzI.js} +1 -1
  11. package/dist/assets/{cells-BLhvmrVl.js → cells-Dk_j8HX9.js} +50 -50
  12. package/dist/assets/{chat-components-DHkUyXWV.js → chat-components-BMWBGknq.js} +1 -1
  13. package/dist/assets/{chat-display-DZMIiHZy.js → chat-display-CEYX5MXY.js} +1 -1
  14. package/dist/assets/{chat-panel-Bm-_lPiR.js → chat-panel-DmUjYxAt.js} +1 -1
  15. package/dist/assets/{client-hHcgVFo7.js → client-D08Rbi3p.js} +1 -1
  16. package/dist/assets/{column-preview-B1AyyIgE.js → column-preview-Cqovvoyb.js} +1 -1
  17. package/dist/assets/{command-CDWT71Ts.js → command-gUA-HncX.js} +1 -1
  18. package/dist/assets/{command-palette-BcPZK2Wg.js → command-palette-Dt43cGFk.js} +1 -1
  19. package/dist/assets/{common-4ZdFNk6L.js → common-BWR26KIv.js} +1 -1
  20. package/dist/assets/{datasource-DNy_uzDr.js → datasource-i415crE1.js} +1 -1
  21. package/dist/assets/{dependency-graph-panel-B6oPfRTp.js → dependency-graph-panel-BwaKuCE7.js} +1 -1
  22. package/dist/assets/{documentation-panel-BRHbbFlV.js → documentation-panel-C4aTmugE.js} +1 -1
  23. package/dist/assets/{download-DPiYP-j0.js → download-Dsuja3On.js} +1 -1
  24. package/dist/assets/edit-page-sCQCmucY.js +12 -0
  25. package/dist/assets/{error-panel-qGIXpWqc.js → error-panel-DCozbyWc.js} +1 -1
  26. package/dist/assets/{es-CR1H2K7u.js → es-DjCjT1hB.js} +1 -1
  27. package/dist/assets/{file-explorer-panel-DdOLBo1H.js → file-explorer-panel-BvRpCXWv.js} +1 -1
  28. package/dist/assets/{floating-outline-foC3RCPc.js → floating-outline-DYdnwTX9.js} +1 -1
  29. package/dist/assets/{focus-CgHW_IRL.js → focus-U1ePwk4d.js} +1 -1
  30. package/dist/assets/{form-NWifpNWT.js → form-D8BW7hlS.js} +1 -1
  31. package/dist/assets/{glide-data-editor-Brckuic5.js → glide-data-editor-DqvrqciP.js} +1 -1
  32. package/dist/assets/{globals-CiRTn5Vt.js → globals-BBskDqJi.js} +1 -1
  33. package/dist/assets/{home-page-WElJkZm5.js → home-page-c43aYnLs.js} +1 -1
  34. package/dist/assets/{index-CBtg35hI.js → index-BG4TYPt5.js} +4 -4
  35. package/dist/assets/{kiosk-mode-vS4t3di8.js → kiosk-mode-C23fjW_G.js} +1 -1
  36. package/dist/assets/{layout-D1qNIXxE.js → layout-DenYhPfS.js} +1 -1
  37. package/dist/assets/{logs-panel-BUqhCH8r.js → logs-panel-CmImbuAp.js} +1 -1
  38. package/dist/assets/{markdown-renderer-DgV_KnEf.js → markdown-renderer-COkLQ1b5.js} +1 -1
  39. package/dist/assets/{mode-BeOhz3YE.js → mode-BOijHAOc.js} +1 -1
  40. package/dist/assets/{name-cell-input-lVGcUDBb.js → name-cell-input-Cf2CUXDm.js} +1 -1
  41. package/dist/assets/{outline-panel-DHLUaY4X.js → outline-panel-CdaUT0TE.js} +1 -1
  42. package/dist/assets/{packages-panel-DhVyvWkj.js → packages-panel-CghFsvM0.js} +1 -1
  43. package/dist/assets/{panel-context-B3nGD1_W.js → panel-context-DUUPei-R.js} +1 -1
  44. package/dist/assets/{panels-BMfGXS7h.js → panels-CymS0QU-.js} +1 -1
  45. package/dist/assets/{process-output-C2mignv4.js → process-output-BAfpcew-.js} +1 -1
  46. package/dist/assets/{readonly-python-code-C3URGhHv.js → readonly-python-code-B8gfuyX1.js} +1 -1
  47. package/dist/assets/{run-page-BqTaOWHL.js → run-page-rr9Ilre7.js} +1 -1
  48. package/dist/assets/{scratchpad-panel-5FCgSkW8.js → scratchpad-panel-fzQUjA3o.js} +1 -1
  49. package/dist/assets/{session-panel-6od-_OeM.js → session-panel-BsMBi24k.js} +1 -1
  50. package/dist/assets/{snippets-panel-CAAC62vz.js → snippets-panel-DW6lWuPh.js} +1 -1
  51. package/dist/assets/{state-CGIjjAWG.js → state-DWEWL_KV.js} +1 -1
  52. package/dist/assets/{state-CoslvOiH.js → state-HUtu_wpA.js} +1 -1
  53. package/dist/assets/{switch-BLEwkiUl.js → switch-Cd5iA-KH.js} +1 -1
  54. package/dist/assets/{textarea-S24k5l8r.js → textarea-jTWtOsHe.js} +1 -1
  55. package/dist/assets/{tracing-Cl31yJ-W.js → tracing-CDJRdFd4.js} +1 -1
  56. package/dist/assets/{tracing-panel-Cw103_Tm.js → tracing-panel-BrBmQCJr.js} +2 -2
  57. package/dist/assets/{types-DiksLxkJ.js → types-CiMSegk1.js} +1 -1
  58. package/dist/assets/{useAddCell-DGhb_PpU.js → useAddCell-FisWjOQO.js} +1 -1
  59. package/dist/assets/{useCellActionButton-COxDEyF8.js → useCellActionButton-DLwn_yx9.js} +1 -1
  60. package/dist/assets/{useDeleteCell-BVWdwuvc.js → useDeleteCell-CFtiNna2.js} +1 -1
  61. package/dist/assets/{useDependencyPanelTab-DgtlzfpF.js → useDependencyPanelTab-DWfKzMhf.js} +1 -1
  62. package/dist/assets/{useNotebookActions-BeEH92nn.js → useNotebookActions-B4HR9n-p.js} +1 -1
  63. package/dist/assets/{useRunCells-Buew9vMX.js → useRunCells-DLQFWY1L.js} +1 -1
  64. package/dist/assets/{useSplitCell-LsoCeBEb.js → useSplitCell-DDFoE9WM.js} +1 -1
  65. package/dist/assets/{utilities.esm-BAGxBLhu.js → utilities.esm-DlnAwGsz.js} +1 -1
  66. package/dist/index.html +31 -31
  67. package/package.json +1 -1
  68. package/src/components/editor/chrome/state.ts +62 -24
  69. package/src/components/editor/chrome/wrapper/app-chrome.tsx +4 -8
  70. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
  71. package/src/components/editor/chrome/wrapper/footer.tsx +5 -13
  72. package/src/components/editor/chrome/wrapper/sidebar.tsx +2 -3
  73. package/src/components/editor/output/MarimoErrorOutput.tsx +2 -2
  74. package/src/components/terminal/hooks.ts +2 -2
  75. package/src/plugins/impl/data-editor/glide-data-editor.tsx +0 -1
  76. package/dist/assets/MarimoErrorOutput-HLzwepOd.js +0 -7
  77. package/dist/assets/edit-page-BNwlX8qM.js +0 -12
@@ -23,10 +23,8 @@ import { RuntimeSettings } from "./footer-items/runtime-settings";
23
23
  import { useSetDependencyPanelTab } from "./useDependencyPanelTab";
24
24
 
25
25
  export const Footer: React.FC = () => {
26
- const { isDeveloperPanelOpen, isSidebarOpen, selectedPanel } =
27
- useChromeState();
28
- const { toggleDeveloperPanel, openApplication, setIsSidebarOpen } =
29
- useChromeActions();
26
+ const { isDeveloperPanelOpen } = useChromeState();
27
+ const { toggleDeveloperPanel, toggleApplication } = useChromeActions();
30
28
  const setDependencyPanelTab = useSetDependencyPanelTab();
31
29
 
32
30
  const errorCount = useAtomValue(cellErrorCount);
@@ -42,7 +40,7 @@ export const Footer: React.FC = () => {
42
40
  const warningCount = 0;
43
41
 
44
42
  useHotkey("global.toggleTerminal", () => {
45
- toggleDeveloperPanel();
43
+ toggleApplication("terminal");
46
44
  });
47
45
 
48
46
  useHotkey("global.togglePanel", () => {
@@ -50,14 +48,8 @@ export const Footer: React.FC = () => {
50
48
  });
51
49
 
52
50
  useHotkey("global.toggleMinimap", () => {
53
- // If already on dependencies panel with minimap tab, close the sidebar
54
- if (isSidebarOpen && selectedPanel === "dependencies") {
55
- setIsSidebarOpen(false);
56
- } else {
57
- // Open sidebar with dependencies panel and switch to minimap tab
58
- openApplication("dependencies");
59
- setDependencyPanelTab("minimap");
60
- }
51
+ toggleApplication("dependencies");
52
+ setDependencyPanelTab("minimap");
61
53
  });
62
54
 
63
55
  return (
@@ -20,8 +20,7 @@ import {
20
20
 
21
21
  export const Sidebar: React.FC = () => {
22
22
  const { selectedPanel, selectedDeveloperPanelTab } = useChromeState();
23
- const { toggleApplication, setSelectedDeveloperPanelTab } =
24
- useChromeActions();
23
+ const { toggleApplication, openApplication } = useChromeActions();
25
24
  const [panelLayout, setPanelLayout] = useAtom(panelLayoutAtom);
26
25
 
27
26
  const renderIcon = ({ Icon }: PanelDescriptor, className?: string) => {
@@ -73,7 +72,7 @@ export const Sidebar: React.FC = () => {
73
72
  (id) => id !== item.type,
74
73
  );
75
74
  if (remainingDevPanels.length > 0) {
76
- setSelectedDeveloperPanelTab(remainingDevPanels[0]);
75
+ openApplication(remainingDevPanels[0]);
77
76
  }
78
77
  }
79
78
  }
@@ -142,7 +142,7 @@ export const MarimoErrorOutput = ({
142
142
  );
143
143
 
144
144
  const openScratchpad = () => {
145
- chromeActions.openDeveloperPanelTab("scratchpad");
145
+ chromeActions.openApplication("scratchpad");
146
146
  };
147
147
 
148
148
  const renderMessages = () => {
@@ -186,7 +186,7 @@ export const MarimoErrorOutput = ({
186
186
  size="xs"
187
187
  variant="outline"
188
188
  className="mt-2 font-normal"
189
- onClick={() => chromeActions.openDeveloperPanelTab("terminal")}
189
+ onClick={() => chromeActions.openApplication("terminal")}
190
190
  >
191
191
  <TerminalIcon className="h-3.5 w-3.5 mr-1.5" />
192
192
  <span>Open terminal</span>
@@ -25,11 +25,11 @@ import { useTerminalActions } from "./state";
25
25
  */
26
26
  export function useTerminalCommands() {
27
27
  const { addCommand } = useTerminalActions();
28
- const { openDeveloperPanelTab } = useChromeActions();
28
+ const { openApplication } = useChromeActions();
29
29
 
30
30
  const sendCommand = (text: string) => {
31
31
  // First, ensure the terminal is open
32
- openDeveloperPanelTab("terminal");
32
+ openApplication("terminal");
33
33
 
34
34
  // Add the command to the queue
35
35
  addCommand(text);
@@ -616,7 +616,6 @@ export const GlideDataEditor = <T,>({
616
616
  allowedFillDirections="vertical" // We can support all directions, but we need to handle datatype logic
617
617
  onKeyDown={onKeyDown}
618
618
  height={data.length > 10 ? 450 : undefined}
619
- width={"100%"}
620
619
  rowMarkers={{
621
620
  kind: "both",
622
621
  }}
@@ -1,7 +0,0 @@
1
- import{s as G}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-DlWF5OMa.js";import{t as we}from"./react-BGmjiNul.js";import{C as ke,Fr as J,Kr as Ie,Pn as $e,Pr as _e,fn as Fe,q as Te,rn as Ae,v as Ce}from"./cells-BLhvmrVl.js";import{t as z}from"./compiler-runtime-DeeZ7FnK.js";import{t as Se}from"./invariant-C6yE60hi.js";import{r as Me}from"./utils-CJJIceVn.js";import{t as Pe}from"./jsx-runtime-DN_bIXfG.js";import{r as X,t as $}from"./button-DuYGqRtX.js";import{t as Y}from"./cn-C1rgT0yh.js";import{t as H}from"./createLucideIcon-CW2xpJ57.js";import{_ as qe}from"./select-D0g5GnIs.js";import{a as ze,p as Ee,r as Le,t as We}from"./dropdown-menu-BP4_BZLr.js";import{a as De,n as Ve}from"./state-CoslvOiH.js";import{c as Z,n as Be}from"./datasource-DNy_uzDr.js";import{a as Qe}from"./dist-RKnr9SNh.js";import{t as ee}from"./tooltip-CvjcEpZC.js";import{a as Oe,i as He,n as Ue,r as Ke}from"./multi-map-fjX9ImVF.js";import{t as te}from"./kbd-Czc5z_04.js";import{t as T}from"./links-DNmjkr65.js";import{r as Re,t as Ge}from"./alert-BEdExd6A.js";import{o as Je,t as Xe}from"./useInstallPackage-RldLPyJs.js";import{n as b}from"./cell-link-B7EjqLUL.js";var Ye=H("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),A=H("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),re=H("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function Ze(r){let e=null,s=r.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function et(r){let e=r.split(`
2
- `),s=" ",n=Ze(Qe.parse(r));if(!n)return["def _():",...U(e,s),`${s}return`,"","","_()"].join(`
3
- `);let i=r.slice(0,n.from).trim(),l=r.slice(n.from).trim(),a=i.split(`
4
- `),c=l.split(`
5
- `);return["def _():",...U(a,s),`${s}return ${c[0]}`,...U(c.slice(1),s),"","","_()"].join(`
6
- `)}function U(r,e){if(r.length===1&&r[0]==="")return[];let s=[];for(let n of r)n===""?s.push(""):s.push(e+n);return s}function tt(r,e){var s;if(r.type==="multiple-defs")return[{title:"Fix: Wrap in a function",description:"Make this cell's variables local by wrapping the cell in a function.",fixType:"manual",onFix:async n=>{Se(n.editor,"Editor is null");let i=et(n.editor.state.doc.toString());n.editor.dispatch({changes:{from:0,to:n.editor.state.doc.length,insert:i}})}}];if(r.type==="exception"&&r.exception_type==="NameError"){let n=(s=r.msg.match(/name '(.+)' is not defined/))==null?void 0:s[1];if(!n||!(n in se))return[];let i=rt(n);return[{title:`Fix: Add '${i}'`,description:"Add a new cell for the missing import",fixType:"manual",onFix:async l=>{l.addCodeBelow(i)}}]}return r.type==="sql-error"&&e.aiEnabled?[{title:"Fix with AI",description:"Fix the SQL statement",fixType:"ai",onFix:async n=>{var a;let i=Be(n.cellId),l=`Fix the SQL statement: ${r.msg}.`;i&&(l+=`
7
- Database schema: ${i}`),(a=n.aiFix)==null||a.setAiCompletionCell({cellId:n.cellId,initialPrompt:l,triggerImmediately:n.aiFix.triggerFix})}}]:[]}function rt(r){let e=se[r];return e===r?`import ${e}`:`import ${e} as ${r}`}var se={mo:"marimo",alt:"altair",bokeh:"bokeh",dask:"dask",np:"numpy",pd:"pandas",pl:"polars",plotly:"plotly",plt:"matplotlib.pyplot",px:"plotly.express",scipy:"scipy",sk:"sklearn",sns:"seaborn",stats:"scipy.stats",tf:"tensorflow",torch:"torch",xr:"xarray",dt:"datetime",json:"json",math:"math",os:"os",re:"re",sys:"sys"},st=z(),nt=Ie("marimo:ai-autofix-mode","autofix",Fe);function lt(){let r=(0,st.c)(3),[e,s]=Ne(nt),n;return r[0]!==e||r[1]!==s?(n={fixMode:e,setFixMode:s},r[0]=e,r[1]=s,r[2]=n):n=r[2],n}var K=z(),t=G(Pe(),1);const N=r=>{let e=(0,K.c)(21),{errors:s,cellId:n,className:i}=r,l=ve(),{createNewCell:a}=ke(),c=be(Me),o;if(e[0]!==c||e[1]!==s){let x;e[3]===c?x=e[4]:(x=y=>tt(y,{aiEnabled:c}),e[3]=c,e[4]=x),o=s.flatMap(x),e[0]=c,e[1]=s,e[2]=o}else o=e[2];let m=o,p=ye(Ve);if(m.length===0)return null;let d=m[0],f;e[5]!==n||e[6]!==a||e[7]!==d||e[8]!==p||e[9]!==l?(f=x=>{var w;let y=(w=l.get(Ce).cellHandles[n].current)==null?void 0:w.editorView;d.onFix({addCodeBelow:_=>{a({cellId:n,autoFocus:!1,before:!1,code:_})},editor:y,cellId:n,aiFix:{setAiCompletionCell:p,triggerFix:x}}),y==null||y.focus()},e[5]=n,e[6]=a,e[7]=d,e[8]=p,e[9]=l,e[10]=f):f=e[10];let u=f,j;e[11]===i?j=e[12]:(j=Y("my-2",i),e[11]=i,e[12]=j);let h;e[13]!==d.description||e[14]!==d.fixType||e[15]!==d.title||e[16]!==u?(h=d.fixType==="ai"?(0,t.jsx)(oe,{tooltip:d.description,openPrompt:()=>u(!1),applyAutofix:()=>u(!0)}):(0,t.jsx)(ee,{content:d.description,align:"start",children:(0,t.jsxs)($,{size:"xs",variant:"outline",className:"font-normal",onClick:()=>u(!1),children:[(0,t.jsx)(Z,{className:"h-3 w-3 mr-2"}),d.title]})}),e[13]=d.description,e[14]=d.fixType,e[15]=d.title,e[16]=u,e[17]=h):h=e[17];let g;return e[18]!==j||e[19]!==h?(g=(0,t.jsx)("div",{className:j,children:h}),e[18]=j,e[19]=h,e[20]=g):g=e[20],g};var ne=De,le=Z,ie="Suggest a prompt",ae="Fix with AI";const oe=r=>{let e=(0,K.c)(21),{tooltip:s,openPrompt:n,applyAutofix:i}=r,{fixMode:l,setFixMode:a}=lt(),c=l==="prompt"?n:i,o;e[0]===l?o=e[1]:(o=l==="prompt"?(0,t.jsx)(ne,{className:"h-3 w-3 mr-2 mb-0.5"}):(0,t.jsx)(le,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=l,e[1]=o);let m=l==="prompt"?ie:ae,p;e[2]!==c||e[3]!==o||e[4]!==m?(p=(0,t.jsxs)($,{size:"xs",variant:"outline",className:"font-normal rounded-r-none border-r-0",onClick:c,children:[o,m]}),e[2]=c,e[3]=o,e[4]=m,e[5]=p):p=e[5];let d;e[6]!==p||e[7]!==s?(d=(0,t.jsx)(ee,{content:s,align:"start",children:p}),e[6]=p,e[7]=s,e[8]=d):d=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(Ee,{asChild:!0,children:(0,t.jsx)($,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,t.jsx)(qe,{className:"h-3 w-3"})})}),e[9]=f):f=e[9];let u;e[10]!==l||e[11]!==a?(u=()=>{a(l==="prompt"?"autofix":"prompt")},e[10]=l,e[11]=a,e[12]=u):u=e[12];let j=l==="prompt"?"autofix":"prompt",h;e[13]===j?h=e[14]:(h=(0,t.jsx)(it,{mode:j}),e[13]=j,e[14]=h);let g;e[15]!==u||e[16]!==h?(g=(0,t.jsxs)(We,{children:[f,(0,t.jsx)(Le,{align:"end",className:"w-56",children:(0,t.jsx)(ze,{className:"flex items-center gap-2",onClick:u,children:h})})]}),e[15]=u,e[16]=h,e[17]=g):g=e[17];let x;return e[18]!==g||e[19]!==d?(x=(0,t.jsxs)("div",{className:"flex",children:[d,g]}),e[18]=g,e[19]=d,e[20]=x):x=e[20],x};var it=r=>{let e=(0,K.c)(12),{mode:s}=r,n;e[0]===s?n=e[1]:(n=s==="prompt"?(0,t.jsx)(ne,{className:"h-4 w-4"}):(0,t.jsx)(le,{className:"h-4 w-4"}),e[0]=s,e[1]=n);let i=n,l=s==="prompt"?ie:ae,a=s==="prompt"?"Edit the prompt before applying":"Apply AI fixes automatically",c;e[2]===l?c=e[3]:(c=(0,t.jsx)("span",{className:"font-medium",children:l}),e[2]=l,e[3]=c);let o;e[4]===a?o=e[5]:(o=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),e[4]=a,e[5]=o);let m;e[6]!==c||e[7]!==o?(m=(0,t.jsxs)("div",{className:"flex flex-col",children:[c,o]}),e[6]=c,e[7]=o,e[8]=m):m=e[8];let p;return e[9]!==i||e[10]!==m?(p=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i,m]}),e[9]=i,e[10]=m,e[11]=p):p=e[11],p},ce=/(https?:\/\/\S+)/,at=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,de=/^data:image\//i,ot=["avatars.githubusercontent.com"];function me(r){return de.test(r)?[{type:"image",url:r}]:r.split(ce).filter(e=>e.trim()!=="").map(e=>ce.test(e)?at.test(e)||de.test(e)||ot.some(s=>e.includes(s))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var pe=z(),E=G(we(),1),ct=new Te;const R=r=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return r.replaceAll(e,"")};var ue=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function dt(r){ue.lastIndex=0;let e=ue.exec(r);if(!e)return null;let s=e.index+e[0].length,n=r.slice(s).split(/\s+/),i="",l=0;for(let c of n){let o=c.trim();if(!o)continue;if(o.startsWith("-")){l+=o.length+1;continue}let m=o.match(/^[\w,.[\]-]+/);if(m){i=m[0];break}break}if(!i)return null;let a=s+l+i.length;return{package:i,endIndex:a}}function k(r,e=""){if(!r)return null;if(!/https?:\/\//.test(r))return r;let s=me(r);return s.length===1&&s[0].type==="text"?r:(0,t.jsx)(t.Fragment,{children:s.map((n,i)=>{let l=e?`${e}-${i}`:i;if(n.type==="url"){let a=R(n.url);return(0,t.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:X.stopPropagation(),className:"text-link hover:underline",children:a},l)}if(n.type==="image"){let a=R(n.url);return(0,t.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:X.stopPropagation(),className:"text-link hover:underline",children:a},l)}return(0,t.jsx)(E.Fragment,{children:n.value},l)})})}var mt=r=>{let e=(0,pe.c)(6),{packages:s,children:n}=r,{handleInstallPackages:i}=Xe(),l;e[0]!==i||e[1]!==s?(l=c=>{i(s),c.preventDefault()},e[0]=i,e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==n||e[4]!==l?(a=(0,t.jsx)("button",{onClick:l,className:"text-link hover:underline",type:"button",children:n}),e[3]=n,e[4]=l,e[5]=a):a=e[5],a};const pt=r=>{if(!(r instanceof J.Text))return;let e=R(r.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(e))return;let s=[],n=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=n.exec(e))!==null;){let c=i.index,o=dt(e.slice(c));o&&s.push({match:i,result:o})}if(s.length===0)return;let l=[],a=0;if(s.forEach((c,o)=>{let{match:m,result:p}=c,d=m.index,f=d+p.endIndex;if(a<d){let j=e.slice(a,d);l.push((0,t.jsx)(E.Fragment,{children:k(j,`before-${o}`)},`before-${o}`))}let u=e.slice(d,f);l.push((0,t.jsx)(mt,{packages:[p.package],children:u},`install-${o}`)),a=f}),a<e.length){let c=e.slice(a);l.push((0,t.jsx)(E.Fragment,{children:k(c,"after")},"after"))}return(0,t.jsx)(t.Fragment,{children:l})},ut=r=>{if(!(r instanceof J.Text))return;let e=r.data;if(!/https?:\/\//.test(e))return;let s=k(e);if(typeof s!="string")return(0,t.jsx)(t.Fragment,{children:s})},ht=(...r)=>e=>{for(let s of r){let n=s(e);if(n!==void 0)return n}},xt=(r,e)=>(0,t.jsx)("span",{children:_e(ct.ansi_to_html(r),{replace:s=>e(s)})}),ft=r=>{let e=(0,pe.c)(4),{text:s}=r,n;e[0]===s?n=e[1]:(n=xt(s,ht(pt,ut)),e[0]=s,e[1]=n);let i=n,l;return e[2]===i?l=e[3]:(l=(0,t.jsx)(t.Fragment,{children:i}),e[2]=i,e[3]=l),l};var he=z(),I=r=>{let e=(0,he.c)(10),s=r.title??"Tip",n;e[0]===s?n=e[1]:(n=(0,t.jsx)(Oe,{className:"pt-2 pb-2 font-normal",children:s}),e[0]=s,e[1]=n);let i;e[2]===r.children?i=e[3]:(i=(0,t.jsx)(Ke,{className:"mr-24 text-[0.84375rem]",children:r.children}),e[2]=r.children,e[3]=i);let l;e[4]!==n||e[5]!==i?(l=(0,t.jsxs)(He,{value:"item-1",className:"text-muted-foreground",children:[n,i]}),e[4]=n,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==r.className||e[8]!==l?(a=(0,t.jsx)(Ue,{type:"single",collapsible:!0,className:r.className,children:l}),e[7]=r.className,e[8]=l,e[9]=a):a=e[9],a};const jt=r=>{let e=(0,he.c)(31),{errors:s,cellId:n,className:i}=r,l=Ae(),a="This cell wasn't run because it has errors",c="destructive",o="text-error";if(s.some(gt))a="Interrupted";else if(s.some(yt))a="An internal error occurred";else if(s.some(vt))a="Ancestor prevented from running",c="default",o="text-secondary-foreground";else if(s.some(Nt))a="Ancestor stopped",c="default",o="text-secondary-foreground";else if(s.some(bt))a="SQL error";else{let x;e[0]===s?x=e[1]:(x=s.find(wt),e[0]=s,e[1]=x);let y=x;y&&"exception_type"in y&&(a=y.exception_type)}let m,p,d,f,u,j;if(e[2]!==c||e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==s||e[7]!==o||e[8]!==a){let x=s.filter(kt),y=s.filter(It),w=s.filter($t),_=s.filter(_t),L=s.filter(Ft),C=s.filter(Tt),S=s.filter(At),W=s.filter(Ct),D=s.filter(St),V=s.filter(Mt),F=s.filter(Pt),B=s.filter(qt),Q=s.filter(zt),M;e[15]===l?M=e[16]:(M=()=>{l.openDeveloperPanelTab("scratchpad")},e[15]=l,e[16]=M);let xe=M,fe=()=>{let v=[];if(F.length>0||B.length>0){let q=F.some(Et),ge=!q&&F.some(Lt);v.push((0,t.jsxs)("div",{children:[F.map(Wt),B.map(Dt),q&&(0,t.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Je(l),children:[(0,t.jsx)(Ye,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,t.jsx)("span",{children:"Open package manager"})]}),ge&&(0,t.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openDeveloperPanelTab("terminal"),children:[(0,t.jsx)(re,{className:"h-3.5 w-3.5 mr-1.5"}),(0,t.jsx)("span",{children:"Open terminal"})]}),n&&(0,t.jsx)(N,{errors:[...F,...B],cellId:n})]},"syntax-unknown"))}if(x.length>0&&v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"The setup cell cannot be run because it has references."}),(0,t.jsx)("ul",{className:"list-disc",children:x.flatMap(Vt)}),n&&(0,t.jsx)(N,{errors:x,cellId:n}),(0,t.jsxs)(I,{title:"Why can't the setup cell have references?",className:"mb-2",children:[(0,t.jsx)("p",{className:"pb-2",children:"The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables."}),(0,t.jsx)("p",{className:"py-2",children:"Try simplifying the setup cell to only contain only necessary variables."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(T,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,t.jsx)(A,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"setup-refs")),y.length>0&&v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell is in a cycle."}),(0,t.jsx)("ul",{className:"list-disc",children:y.flatMap(Bt)}),n&&(0,t.jsx)(N,{errors:y,cellId:n}),(0,t.jsxs)(I,{title:"What are cycles and how do I resolve them?",className:"mb-2",children:[(0,t.jsx)("p",{className:"pb-2",children:"An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug."}),(0,t.jsx)("p",{className:"py-2",children:"Try merging these cells into a single cell to eliminate the cycle."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(T,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,t.jsx)(A,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"cycle")),w.length>0){let q=w[0].name;v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell redefines variables from other cells."}),w.map(Ot),n&&(0,t.jsx)(N,{errors:w,cellId:n}),(0,t.jsxs)(I,{title:"Why can't I redefine variables?",children:[(0,t.jsx)("p",{className:"pb-2",children:"marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more."}),(0,t.jsxs)("p",{className:"py-2",children:["Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., ",(0,t.jsxs)(te,{className:"inline",children:["_",q]}),"). to make them private to this cell."]}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(T,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,t.jsx)(A,{size:"0.75rem",className:"inline"})]}),"."]})]}),(0,t.jsx)(I,{title:"Need a scratchpad?",children:(0,t.jsxs)("div",{className:"flex flex-row gap-2 items-center",children:[(0,t.jsxs)($,{size:"xs",variant:"link",className:"my-2 font-normal mx-0 px-0",onClick:xe,children:[(0,t.jsx)($e,{className:"h-3"}),(0,t.jsx)("span",{children:"Try the scratchpad"})]}),(0,t.jsx)("span",{children:"to experiment without restrictions on variable names."})]})})]},"multiple-defs"))}return _.length>0&&v.push((0,t.jsxs)("div",{children:[_.map(Ht),n&&(0,t.jsx)(N,{errors:_,cellId:n}),(0,t.jsxs)(I,{title:"Why can't I use `import *`?",children:[(0,t.jsx)("p",{className:"pb-2",children:"Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution."}),(0,t.jsx)("p",{className:"py-2",children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,t.jsx)("p",{className:"py-2",children:"Star imports would also silently add names to globals, which would be incompatible with reactive execution."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(T,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,t.jsx)(A,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),L.length>0&&v.push((0,t.jsxs)("div",{children:[L.map(Ut),n&&(0,t.jsx)(N,{errors:L,cellId:n})]},"interruption")),C.length>0&&v.push((0,t.jsxs)("ul",{children:[C.map(Kt),C.some(Rt)&&(0,t.jsx)(I,{children:"Fix the error in the mentioned cells, or handle the exceptions with try/except blocks."}),n&&(0,t.jsx)(N,{errors:C,cellId:n})]},"exception")),S.length>0&&v.push((0,t.jsxs)("ul",{children:[S.map(Gt),n&&(0,t.jsx)(N,{errors:S,cellId:n}),(0,t.jsx)(I,{children:S.some(Jt)?"Ensure that the referenced cells define the required variables, or turn off strict execution.":"Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution."})]},"strict-exception")),W.length>0&&v.push((0,t.jsxs)("div",{children:[W.map(Xt),n&&(0,t.jsx)(N,{errors:W,cellId:n})]},"internal")),D.length>0&&v.push((0,t.jsxs)("div",{children:[D.map(Yt),n&&(0,t.jsx)(N,{errors:D,cellId:n})]},"ancestor-prevented")),V.length>0&&v.push((0,t.jsxs)("div",{children:[V.map(Zt),n&&(0,t.jsx)(N,{errors:V,cellId:n})]},"ancestor-stopped")),Q.length>0&&v.push((0,t.jsxs)("div",{children:[Q.map(er),n&&(0,t.jsx)(N,{errors:Q,cellId:n,className:"mt-2.5"})]},"sql-errors")),v},O=`font-code font-medium tracking-wide ${o}`,P;e[17]!==O||e[18]!==a?(P=(0,t.jsx)(Re,{className:O,children:a}),e[17]=O,e[18]=a,e[19]=P):P=e[19];let je=P;m=Ge,f=c,e[20]===i?u=e[21]:(u=Y("border-none font-code text-sm text-[0.84375rem] px-0 text-muted-foreground normal [&:has(svg)]:pl-0 space-y-4",i),e[20]=i,e[21]=u),j=je,p="flex flex-col gap-8",d=fe(),e[2]=c,e[3]=n,e[4]=l,e[5]=i,e[6]=s,e[7]=o,e[8]=a,e[9]=m,e[10]=p,e[11]=d,e[12]=f,e[13]=u,e[14]=j}else m=e[9],p=e[10],d=e[11],f=e[12],u=e[13],j=e[14];let h;e[22]!==p||e[23]!==d?(h=(0,t.jsx)("div",{children:(0,t.jsx)("div",{className:p,children:d})}),e[22]=p,e[23]=d,e[24]=h):h=e[24];let g;return e[25]!==m||e[26]!==f||e[27]!==u||e[28]!==j||e[29]!==h?(g=(0,t.jsxs)(m,{variant:f,className:u,children:[j,h]}),e[25]=m,e[26]=f,e[27]=u,e[28]=j,e[29]=h,e[30]=g):g=e[30],g};function gt(r){return r.type==="interruption"}function yt(r){return r.type==="internal"}function vt(r){return r.type==="ancestor-prevented"}function Nt(r){return r.type==="ancestor-stopped"}function bt(r){return r.type==="sql-error"}function wt(r){return r.type==="exception"}function kt(r){return r.type==="setup-refs"}function It(r){return r.type==="cycle"}function $t(r){return r.type==="multiple-defs"}function _t(r){return r.type==="import-star"}function Ft(r){return r.type==="interruption"}function Tt(r){return r.type==="exception"}function At(r){return r.type==="strict-exception"}function Ct(r){return r.type==="internal"}function St(r){return r.type==="ancestor-prevented"}function Mt(r){return r.type==="ancestor-stopped"}function Pt(r){return r.type==="syntax"}function qt(r){return r.type==="unknown"}function zt(r){return r.type==="sql-error"}function Et(r){return r.msg.includes("!pip")}function Lt(r){return r.msg.includes("use os.subprocess")}function Wt(r,e){return(0,t.jsx)("pre",{children:k(r.msg,`syntax-${e}`)},`syntax-${e}`)}function Dt(r,e){return(0,t.jsx)("pre",{children:k(r.msg,`unknown-${e}`)},`unknown-${e}`)}function Vt(r,e){return r.edges_with_vars.map((s,n)=>(0,t.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,t.jsx)(b,{cellId:s[0]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[": "," ",s[1].length===1?s[1][0]:s[1].join(", ")]})]},`setup-refs-${e}-${n}`))}function Bt(r,e){return r.edges_with_vars.map((s,n)=>(0,t.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,t.jsx)(b,{cellId:s[0]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[" -> ",s[1].length===1?s[1][0]:s[1].join(", ")," -> "]}),(0,t.jsx)(b,{cellId:s[2]})]},`cycle-${e}-${n}`))}function Qt(r,e){return(0,t.jsx)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:(0,t.jsx)(b,{cellId:r})},`cell-${e}`)}function Ot(r,e){return(0,t.jsxs)(E.Fragment,{children:[(0,t.jsx)("p",{className:"text-muted-foreground mt-2",children:`'${r.name}' was also defined by:`}),(0,t.jsx)("ul",{className:"list-disc",children:r.cells.map(Qt)})]},`multiple-defs-${e}`)}function Ht(r,e){return(0,t.jsx)("p",{className:"text-muted-foreground",children:r.msg},`import-star-${e}`)}function Ut(r,e){return(0,t.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Kt(r,e){return r.exception_type==="NameError"&&r.msg.startsWith("name 'mo'")?(0,t.jsx)("li",{className:"my-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:"name 'mo' is not defined."}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-2",children:["The marimo module (imported as"," ",(0,t.jsx)(te,{className:"inline",children:"mo"}),") is required for Markdown, SQL, and UI elements."]})]})},`exception-${e}`):r.exception_type==="NameError"&&r.msg.startsWith("name '_")?(0,t.jsx)("li",{className:"my-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:r.msg}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-2",children:["Variables prefixed with an underscore are local to a cell"," ","(",(0,t.jsxs)(T,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,t.jsx)(A,{size:"0.75rem",className:"inline"})]}),")."]}),(0,t.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]})},`exception-${e}`):(0,t.jsx)("li",{className:"my-2",children:r.raising_cell==null?(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:k(r.msg,`exception-${e}`)}),(0,t.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]}):(0,t.jsxs)("div",{children:[k(r.msg,`exception-${e}`),(0,t.jsx)(b,{cellId:r.raising_cell})]})},`exception-${e}`)}function Rt(r){return r.raising_cell!=null}function Gt(r,e){return(0,t.jsx)("li",{className:"my-2",children:r.blamed_cell==null?(0,t.jsx)("p",{children:r.msg}):(0,t.jsxs)("div",{children:[r.msg,(0,t.jsx)(b,{cellId:r.blamed_cell})]})},`strict-exception-${e}`)}function Jt(r){return r.blamed_cell!=null}function Xt(r,e){return(0,t.jsx)("p",{children:r.msg},`internal-${e}`)}function Yt(r,e){return(0,t.jsxs)("div",{children:[r.msg,r.blamed_cell==null?(0,t.jsxs)("span",{children:["(",(0,t.jsx)(b,{cellId:r.raising_cell}),")"]}):(0,t.jsxs)("span",{children:["(",(0,t.jsx)(b,{cellId:r.raising_cell}),"\xA0blames\xA0",(0,t.jsx)(b,{cellId:r.blamed_cell}),")"]})]},`ancestor-prevented-${e}`)}function Zt(r,e){return(0,t.jsxs)("div",{children:[r.msg,(0,t.jsx)(b,{cellId:r.raising_cell})]},`ancestor-stopped-${e}`)}function er(r,e){return(0,t.jsx)("div",{className:"space-y-2 mt-2",children:(0,t.jsx)("p",{className:"text-muted-foreground whitespace-pre-wrap",children:r.msg})},`sql-error-${e}`)}export{re as a,oe as i,ft as n,me as r,jt as t};