@marimo-team/islands 0.25.3-dev388 → 0.25.3-dev391

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 (101) hide show
  1. package/dist/{ErrorBoundary-_mFP3LkM.js → ErrorBoundary-DNRG0xHi.js} +1 -1
  2. package/dist/{chat-ui-BKSYhGMh.js → chat-ui-CWVNPm2l.js} +769 -769
  3. package/dist/{code-visibility-DkMNjdNe.js → code-visibility-Ca8sDptK.js} +10 -10
  4. package/dist/{common-Ces9ooG_.js → common-B3NYpak4.js} +4910 -4902
  5. package/dist/{data-grid-overlay-editor-uNMslVKY.js → data-grid-overlay-editor-Cz7uMmtm.js} +1 -1
  6. package/dist/{error-entries-rtPWQkJk.js → error-entries-CnXf4kpP.js} +821 -686
  7. package/dist/{feedback-button-i960qUnq.js → feedback-button-BQbnZsf5.js} +7 -7
  8. package/dist/{glide-data-editor-_EEhlGzS.js → glide-data-editor-Bxc30klU.js} +3 -3
  9. package/dist/{globals-DKkjIolp.js → globals-CDatnx0Y.js} +1 -1
  10. package/dist/{html-to-image-B5nTOeMI.js → html-to-image-Bu_-vH_Y.js} +4782 -4765
  11. package/dist/main.js +6233 -6172
  12. package/dist/{number-overlay-editor-D5U7jbrh.js → number-overlay-editor-ChGu5C-s.js} +1 -1
  13. package/dist/{process-output-DNxpsd4n.js → process-output-Rbqr1aYD.js} +2 -2
  14. package/dist/{reveal-component-BM9TozVQ.js → reveal-component-CSxWJFAP.js} +32 -32
  15. package/dist/style.css +1 -1
  16. package/package.json +1 -1
  17. package/src/__mocks__/executions.ts +48 -8
  18. package/src/__mocks__/notebook.ts +20 -42
  19. package/src/components/app-config/__tests__/add-model-discovery.test.tsx +255 -0
  20. package/src/components/app-config/__tests__/model-discovery.test.tsx +183 -0
  21. package/src/components/app-config/ai-config.tsx +20 -24
  22. package/src/components/app-config/model-discovery.tsx +118 -184
  23. package/src/components/app-config/model-provider-config.ts +25 -0
  24. package/src/components/editor/Output.tsx +5 -4
  25. package/src/components/editor/__tests__/data-attributes.test.tsx +1 -6
  26. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +11 -16
  27. package/src/components/editor/__tests__/output-persistence.test.tsx +6 -24
  28. package/src/components/editor/actions/__tests__/useSetOutputsExpanded.test.ts +6 -8
  29. package/src/components/editor/actions/useSetOutputsExpanded.ts +12 -4
  30. package/src/components/editor/cell/cell-context-menu.tsx +3 -2
  31. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +89 -72
  32. package/src/components/editor/notebook-cell.tsx +15 -10
  33. package/src/components/editor/output/console/process-output.ts +4 -2
  34. package/src/components/editor/renderers/cells-renderer.tsx +3 -1
  35. package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +5 -11
  36. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +9 -8
  37. package/src/components/editor/renderers/types.ts +2 -2
  38. package/src/components/editor/renderers/vertical-layout/utils.ts +4 -4
  39. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +5 -8
  40. package/src/components/scratchpad/scratchpad.tsx +6 -2
  41. package/src/components/slides/__tests__/cell-output-block.test.tsx +7 -8
  42. package/src/components/slides/__tests__/minimap-actions.test.tsx +3 -3
  43. package/src/components/slides/__tests__/slide-cell-view.test.tsx +1 -0
  44. package/src/components/slides/slide-cell-view.tsx +1 -3
  45. package/src/components/slides/slide.tsx +3 -3
  46. package/src/core/ai/context/__tests__/registry.test.ts +7 -11
  47. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +113 -35
  48. package/src/core/ai/context/providers/__tests__/error.test.ts +74 -191
  49. package/src/core/ai/context/providers/cell-output.ts +11 -6
  50. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +8 -103
  51. package/src/core/cells/__tests__/cells.test.ts +40 -292
  52. package/src/core/cells/__tests__/clear-outputs.test.ts +151 -0
  53. package/src/core/cells/__tests__/harness.ts +14 -12
  54. package/src/core/cells/__tests__/layout.test.ts +20 -26
  55. package/src/core/cells/__tests__/notebook-outline.test.ts +49 -43
  56. package/src/core/cells/__tests__/session.test.ts +26 -146
  57. package/src/core/cells/actions.ts +49 -9
  58. package/src/core/cells/cell.ts +0 -13
  59. package/src/core/cells/cells.ts +53 -62
  60. package/src/core/cells/focus.ts +6 -1
  61. package/src/core/cells/layout.ts +2 -3
  62. package/src/core/cells/outputs.ts +2 -2
  63. package/src/core/cells/session.ts +3 -38
  64. package/src/core/cells/types.ts +6 -8
  65. package/src/core/cells/utils.ts +4 -3
  66. package/src/core/codemirror/ai/__tests__/resources.test.ts +7 -11
  67. package/src/core/errors/__tests__/error-entries.test.ts +52 -18
  68. package/src/core/errors/error-entries.ts +21 -11
  69. package/src/core/executions/__tests__/freshness.test.ts +7 -4
  70. package/src/core/executions/__tests__/hooks.test.tsx +5 -1
  71. package/src/core/executions/__tests__/interrupt.test.ts +2 -0
  72. package/src/core/executions/__tests__/output-lifecycle.test.ts +201 -0
  73. package/src/core/executions/__tests__/output.test.ts +87 -3
  74. package/src/core/executions/__tests__/select.test.ts +17 -10
  75. package/src/core/executions/atoms.ts +73 -15
  76. package/src/core/executions/freshness.ts +1 -1
  77. package/src/core/executions/hooks.ts +18 -8
  78. package/src/core/executions/index.ts +6 -0
  79. package/src/core/executions/output.ts +122 -38
  80. package/src/core/executions/select.ts +2 -2
  81. package/src/core/export/__tests__/hooks.test.ts +20 -29
  82. package/src/core/export/hooks.ts +7 -9
  83. package/src/core/islands/__tests__/iframe-resizer.test.ts +91 -0
  84. package/src/core/islands/__tests__/main.test.ts +17 -0
  85. package/src/core/islands/components/__tests__/web-components.test.tsx +13 -15
  86. package/src/core/islands/components/output-wrapper.tsx +15 -20
  87. package/src/core/islands/iframe-resizer.ts +38 -0
  88. package/src/core/islands/main.ts +3 -0
  89. package/src/core/lifecycle/render-policy.ts +7 -4
  90. package/src/core/network/__tests__/ai.test.ts +41 -0
  91. package/src/core/network/ai.ts +12 -0
  92. package/src/core/notebook/document/__tests__/codemirror.test.ts +2 -0
  93. package/src/core/notebook/replica/__tests__/replica.test.ts +19 -0
  94. package/src/core/notebook/replica/__tests__/results.test.ts +45 -16
  95. package/src/core/notebook/replica/index.ts +1 -1
  96. package/src/core/notebook/replica/replica.ts +19 -4
  97. package/src/core/notebook/replica/resources/executions.ts +100 -9
  98. package/src/core/notebook/replica/resources/results.ts +46 -31
  99. package/src/core/transports/__tests__/static.test.ts +5 -3
  100. package/src/stories/cell.stories.tsx +40 -30
  101. package/src/stories/layout/vertical/one-column.stories.tsx +15 -7
@@ -7,16 +7,16 @@ import { f as s, h as c } from "./tooltip-BwlFTaNy.js";
7
7
  import { t as l } from "./check-BbhVyViy.js";
8
8
  import { n as u, r as d } from "./assertNever-5uYEbJc8.js";
9
9
  import { t as f } from "./jsx-runtime-D8btoEHk.js";
10
- import { At as p, Et as m, Lt as h, Pt as g, St as _, Tt as v, _t as y, bt as b, cn as x, f as S, fn as ee, jt as te, kt as ne, ln as re, pn as ie, un as C, vt as w, xt as ae } from "./use-restore-focus-fKgXR0nb.js";
11
- import { n as oe } from "./toast-0xspcdmv.js";
12
- import { t as se } from "./objects-DCmMvZtn.js";
13
- import { t as T } from "./invariant-DLmrl-hA.js";
14
- import { t as ce } from "./purify.es-DmnrIjg4.js";
15
- import { t as le } from "./createReducer-fp0gX_9U.js";
16
- import { M as ue, N as de, V as fe, g as pe } from "./dist-B_xgcU0N.js";
17
- import { _ as me, a as he, i as ge, l as _e, p as ve } from "./static-state-Cqzv5X7B.js";
18
- import { t as ye } from "./capabilities-DKqMqBzm.js";
19
- var be = c("external-link", [
10
+ import { At as p, Et as m, Lt as h, Pt as g, St as _, Tt as v, _t as y, bt as b, cn as x, f as S, fn as ee, jt as te, kt as ne, ln as re, pn as ie, un as ae, vt as C, xt as oe } from "./use-restore-focus-fKgXR0nb.js";
11
+ import { n as se } from "./toast-0xspcdmv.js";
12
+ import { t as ce } from "./objects-DCmMvZtn.js";
13
+ import { t as w } from "./invariant-DLmrl-hA.js";
14
+ import { t as le } from "./purify.es-DmnrIjg4.js";
15
+ import { t as ue } from "./createReducer-fp0gX_9U.js";
16
+ import { M as de, N as fe, V as pe, g as me } from "./dist-B_xgcU0N.js";
17
+ import { _ as he, a as ge, i as _e, l as ve, p as ye } from "./static-state-Cqzv5X7B.js";
18
+ import { t as be } from "./capabilities-DKqMqBzm.js";
19
+ var xe = c("external-link", [
20
20
  ["path", {
21
21
  d: "M15 3h6v6",
22
22
  key: "1q9fwt"
@@ -29,20 +29,20 @@ var be = c("external-link", [
29
29
  d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
30
30
  key: "a6xqqp"
31
31
  }]
32
- ]), xe = c("minus", [["path", {
32
+ ]), Se = c("minus", [["path", {
33
33
  d: "M5 12h14",
34
34
  key: "1ays0h"
35
- }]]), E = /* @__PURE__ */ e(i(), 1), D = f(), Se = Object.defineProperty, O = (e, t) => Se(e, "name", {
35
+ }]]), T = /* @__PURE__ */ e(i(), 1), E = f(), Ce = Object.defineProperty, D = (e, t) => Ce(e, "name", {
36
36
  value: t,
37
37
  configurable: !0
38
- }), Ce = "Checkbox", [we, Te] = ee(Ce), [Ee, De] = we(Ce);
39
- function Oe(e) {
38
+ }), we = "Checkbox", [Te, Ee] = ee(we), [De, Oe] = Te(we);
39
+ function ke(e) {
40
40
  let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] = re({
41
41
  prop: n,
42
42
  defaultProp: i ?? !1,
43
43
  onChange: c,
44
- caller: Ce
45
- }), [m, h] = E.useState(null), [g, _] = E.useState(null), [v, y] = E.useState(null), b = !m || !!o || !!m.closest("form"), x = {
44
+ caller: we
45
+ }), [m, h] = T.useState(null), [g, _] = T.useState(null), [v, y] = T.useState(null), b = !m || !!o || !!m.closest("form"), x = {
46
46
  checked: f,
47
47
  disabled: a,
48
48
  setChecked: p,
@@ -54,51 +54,51 @@ function Oe(e) {
54
54
  userClick: v,
55
55
  onUserClick: y,
56
56
  required: l,
57
- defaultChecked: !k(i) && i,
57
+ defaultChecked: !O(i) && i,
58
58
  isFormControl: b,
59
59
  bubbleInput: g,
60
60
  setBubbleInput: _
61
61
  };
62
- return /* @__PURE__ */ (0, D.jsx)(Ee, {
62
+ return /* @__PURE__ */ (0, E.jsx)(De, {
63
63
  scope: t,
64
64
  ...x,
65
- children: Ie(d) ? d(x) : r
65
+ children: Le(d) ? d(x) : r
66
66
  });
67
67
  }
68
- O(Oe, "CheckboxProvider");
69
- var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
70
- let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = De(ke, e), g = r(a, d), _ = E.useRef(l);
71
- return E.useEffect(() => {
68
+ D(ke, "CheckboxProvider");
69
+ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
70
+ let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = Oe(Ae, e), g = r(a, d), _ = T.useRef(l);
71
+ return T.useEffect(() => {
72
72
  let e = o?.form;
73
73
  if (e) {
74
- let t = /* @__PURE__ */ O(() => f(_.current), "reset");
74
+ let t = /* @__PURE__ */ D(() => f(_.current), "reset");
75
75
  return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
76
76
  }
77
- }, [o, f]), /* @__PURE__ */ (0, D.jsx)(ie.button, {
77
+ }, [o, f]), /* @__PURE__ */ (0, E.jsx)(ie.button, {
78
78
  type: "button",
79
79
  role: "checkbox",
80
- "aria-checked": k(l) ? "mixed" : l,
80
+ "aria-checked": O(l) ? "mixed" : l,
81
81
  "aria-required": u,
82
- "data-state": Le(l),
82
+ "data-state": Re(l),
83
83
  "data-disabled": c ? "" : void 0,
84
84
  disabled: c,
85
85
  value: s,
86
86
  ...i,
87
87
  ref: g,
88
- onKeyDown: C(t, (e) => {
88
+ onKeyDown: ae(t, (e) => {
89
89
  e.key === "Enter" && e.preventDefault();
90
90
  }),
91
- onClick: C(n, (e) => {
91
+ onClick: ae(n, (e) => {
92
92
  let t = e.isPropagationStopped();
93
93
  p({
94
- requestedChecked: k(l) ? !0 : !l,
94
+ requestedChecked: O(l) ? !0 : !l,
95
95
  hasConsumerStoppedPropagation: t
96
- }), f((e) => k(e) ? !0 : !e), h && m && (t || e.stopPropagation());
96
+ }), f((e) => O(e) ? !0 : !e), h && m && (t || e.stopPropagation());
97
97
  })
98
98
  });
99
- }, "CheckboxTrigger")), je = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
99
+ }, "CheckboxTrigger")), Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
100
100
  let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
101
- return /* @__PURE__ */ (0, D.jsx)(Oe, {
101
+ return /* @__PURE__ */ (0, E.jsx)(ke, {
102
102
  __scopeCheckbox: n,
103
103
  checked: i,
104
104
  defaultChecked: a,
@@ -108,18 +108,18 @@ var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
108
108
  name: r,
109
109
  form: u,
110
110
  value: c,
111
- internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(Ae, {
111
+ internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, E.jsxs)(E.Fragment, { children: [/* @__PURE__ */ (0, E.jsx)(je, {
112
112
  ...d,
113
113
  ref: t,
114
114
  __scopeCheckbox: n
115
- }), e && /* @__PURE__ */ (0, D.jsx)(Fe, { __scopeCheckbox: n })] })
115
+ }), e && /* @__PURE__ */ (0, E.jsx)(Ie, { __scopeCheckbox: n })] })
116
116
  });
117
- }, "Checkbox")), Me = "CheckboxIndicator", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
118
- let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = De(Me, n);
119
- return /* @__PURE__ */ (0, D.jsx)(x, {
120
- present: r || k(a.checked) || a.checked === !0,
121
- children: /* @__PURE__ */ (0, D.jsx)(ie.span, {
122
- "data-state": Le(a.checked),
117
+ }, "Checkbox")), Ne = "CheckboxIndicator", Pe = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
118
+ let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = Oe(Ne, n);
119
+ return /* @__PURE__ */ (0, E.jsx)(x, {
120
+ present: r || O(a.checked) || a.checked === !0,
121
+ children: /* @__PURE__ */ (0, E.jsx)(ie.span, {
122
+ "data-state": Re(a.checked),
123
123
  "data-disabled": a.disabled ? "" : void 0,
124
124
  ...i,
125
125
  ref: t,
@@ -129,9 +129,9 @@ var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
129
129
  }
130
130
  })
131
131
  });
132
- }, "CheckboxIndicator")), Pe = "CheckboxBubbleInput", Fe = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
133
- let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = De(Pe, e), _ = r(i, g), v = s(a), y = E.useRef(!1), b = E.useRef(c), x = E.useRef(o), S = E.useRef(null);
134
- E.useEffect(() => {
132
+ }, "CheckboxIndicator")), Fe = "CheckboxBubbleInput", Ie = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
133
+ let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = Oe(Fe, e), _ = r(i, g), v = s(a), y = T.useRef(!1), b = T.useRef(c), x = T.useRef(o), S = T.useRef(null);
134
+ T.useEffect(() => {
135
135
  let e = h;
136
136
  if (!e) return;
137
137
  let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
@@ -139,20 +139,20 @@ var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
139
139
  let r = b.current !== c;
140
140
  b.current = c;
141
141
  let i = o !== null && o !== x.current;
142
- if (x.current = o, i) S.current = r ? null : o, r && (e.indeterminate = k(c), n.call(e, !k(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
142
+ if (x.current = o, i) S.current = r ? null : o, r && (e.indeterminate = O(c), n.call(e, !O(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
143
143
  else if (r) {
144
144
  let t = S.current;
145
145
  S.current = null;
146
146
  let r = t?.requestedChecked === c;
147
- y.current = !0, e.indeterminate = k(c), n.call(e, !k(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
147
+ y.current = !0, e.indeterminate = O(c), n.call(e, !O(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
148
148
  }
149
149
  }, [
150
150
  h,
151
151
  c,
152
152
  o
153
153
  ]);
154
- let ee = E.useRef(!k(c) && c);
155
- return /* @__PURE__ */ (0, D.jsx)(ie.input, {
154
+ let ee = T.useRef(!O(c) && c);
155
+ return /* @__PURE__ */ (0, E.jsx)(ie.input, {
156
156
  type: "checkbox",
157
157
  "aria-hidden": !0,
158
158
  defaultChecked: l ?? ee.current,
@@ -164,7 +164,7 @@ var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
164
164
  ...n,
165
165
  tabIndex: -1,
166
166
  ref: _,
167
- onClick: C(t, (e) => {
167
+ onClick: ae(t, (e) => {
168
168
  y.current && e.stopPropagation();
169
169
  }),
170
170
  style: {
@@ -178,33 +178,124 @@ var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
178
178
  }
179
179
  });
180
180
  }, "CheckboxBubbleInput"));
181
- function Ie(e) {
181
+ function Le(e) {
182
182
  return typeof e == "function";
183
183
  }
184
- O(Ie, "isFunction");
185
- function k(e) {
184
+ D(Le, "isFunction");
185
+ function O(e) {
186
186
  return e === "indeterminate";
187
187
  }
188
- O(k, "isIndeterminate");
189
- function Le(e) {
190
- return k(e) ? "indeterminate" : e ? "checked" : "unchecked";
188
+ D(O, "isIndeterminate");
189
+ function Re(e) {
190
+ return O(e) ? "indeterminate" : e ? "checked" : "unchecked";
191
+ }
192
+ D(Re, "getState");
193
+ //#endregion
194
+ //#region src/plugins/core/sanitize-html.ts
195
+ var ze = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
196
+ if (typeof document < "u") {
197
+ let e = "data-temp-href-target";
198
+ le.addHook("beforeSanitizeAttributes", (t) => {
199
+ t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
200
+ }), le.addHook("afterSanitizeAttributes", (t) => {
201
+ t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
202
+ });
203
+ }
204
+ function Be(e) {
205
+ let t = {
206
+ USE_PROFILES: {
207
+ html: !0,
208
+ svg: !0,
209
+ mathMl: !0
210
+ },
211
+ ADD_TAGS: ["use"],
212
+ ADD_ATTR: ["href", "xlink:href"],
213
+ ALLOWED_URI_REGEXP: ze,
214
+ FORCE_BODY: !0,
215
+ CUSTOM_ELEMENT_HANDLING: {
216
+ tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
217
+ attributeNameCheck: /^[A-Za-z][\w-]*$/
218
+ },
219
+ SAFE_FOR_XML: !e.includes("marimo-mermaid")
220
+ };
221
+ return le.sanitize(e, t);
222
+ }
223
+ //#endregion
224
+ //#region src/core/dom/outline.ts
225
+ var Ve = [
226
+ "marimo-carousel",
227
+ "marimo-tabs",
228
+ "marimo-accordion",
229
+ "marimo-sidebar"
230
+ ], He = "h1, h2, h3, h4, h5, h6";
231
+ function Ue(e) {
232
+ if (typeof DOMParser > "u") return null;
233
+ let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(He);
234
+ for (let e of Array.from(n)) {
235
+ let n = e.textContent;
236
+ if (Ve.some((t) => e.closest(t)) || !n) continue;
237
+ let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
238
+ name: n,
239
+ level: r,
240
+ by: Ge(e)
241
+ };
242
+ i !== n && (a.html = Be(i)), t.push(a);
243
+ }
244
+ return { items: t };
245
+ }
246
+ function We(e) {
247
+ if (!e.includes("\"")) return `"${e}"`;
248
+ if (!e.includes("'")) return `'${e}'`;
249
+ let t = e.split("\""), n = [];
250
+ for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
251
+ return `concat(${n.join(", ")})`;
252
+ }
253
+ function Ge(e) {
254
+ let t = e.id;
255
+ if (t) return { id: t };
256
+ let n = e.textContent ?? "";
257
+ return { path: `//${e.tagName}[contains(., ${We(n)})]` };
258
+ }
259
+ function Ke(e) {
260
+ return { items: e.filter(Boolean).flatMap((e) => e.items) };
261
+ }
262
+ function qe(e) {
263
+ if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
264
+ try {
265
+ return w(typeof e.data == "string", "expected string"), Ue(e.data);
266
+ } catch {
267
+ return t.error("Failed to parse outline"), null;
268
+ }
269
+ }
270
+ function Je(e) {
271
+ return e != null && e.items.some((e) => e.level <= 3);
272
+ }
273
+ function Ye(e, n) {
274
+ let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
275
+ if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
276
+ let a = r(i), o = e + 1;
277
+ for (; o < n.length;) {
278
+ let t = n[o];
279
+ if (t && r(t) <= a) return [e, o - 1];
280
+ o++;
281
+ }
282
+ return [e, n.length - 1];
191
283
  }
192
- O(Le, "getState");
193
284
  //#endregion
194
285
  //#region src/core/notebook/replica/connection.ts
195
- var A = {
286
+ var k = {
196
287
  NOT_STARTED: "NOT_STARTED",
197
288
  CONNECTING: "CONNECTING",
198
289
  OPEN: "OPEN",
199
290
  CLOSED: "CLOSED"
200
- }, Re = {
291
+ }, Xe = {
201
292
  KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
202
293
  KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
203
- }, ze = {
294
+ }, Ze = {
204
295
  sourceChanged: !1,
205
296
  inputsChanged: !1
206
297
  };
207
- function Be(e) {
298
+ function Qe(e) {
208
299
  let t = /* @__PURE__ */ new Map();
209
300
  for (let n of e.executions.values()) for (let e of n.variables.values()) {
210
301
  let n = t.get(e.name);
@@ -212,8 +303,8 @@ function Be(e) {
212
303
  }
213
304
  return t;
214
305
  }
215
- function Ve(e) {
216
- let t = Be(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
306
+ function $e(e) {
307
+ let t = Qe(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
217
308
  function i(e, n) {
218
309
  let i = new Set(n).add(e.id);
219
310
  for (let [n, a] of Object.entries(e.depends_on)) {
@@ -249,13 +340,144 @@ function Ve(e) {
249
340
  return n.set(t.id, c), c;
250
341
  }
251
342
  return (t) => {
252
- let n = e.results.get(t);
253
- return n == null ? ze : o(n, /* @__PURE__ */ new Set());
343
+ let n = e.results.get(t)?.record;
344
+ return n == null ? Ze : o(n, /* @__PURE__ */ new Set());
345
+ };
346
+ }
347
+ //#endregion
348
+ //#region src/core/executions/output.ts
349
+ var et = /* @__PURE__ */ new Map(), tt = "application/vnd.marimo+error";
350
+ function A(e) {
351
+ return e;
352
+ }
353
+ function nt(e) {
354
+ return e.map(({ cell_id: e, message: t }) => ({
355
+ cell_id: A(e),
356
+ message: t
357
+ }));
358
+ }
359
+ function rt(e) {
360
+ return e === null ? 0 : Date.parse(e) / 1e3;
361
+ }
362
+ function it(e) {
363
+ return rt(e.completed_at ?? e.started_at);
364
+ }
365
+ function at(e, t) {
366
+ return {
367
+ channel: "output",
368
+ mimetype: t.mimetype,
369
+ data: t.data,
370
+ timestamp: it(e)
371
+ };
372
+ }
373
+ function j(e, t) {
374
+ return {
375
+ channel: "marimo-error",
376
+ mimetype: tt,
377
+ data: t,
378
+ timestamp: it(e)
379
+ };
380
+ }
381
+ function ot(e) {
382
+ let t = e.related.at(0);
383
+ return t === void 0 ? null : A(t.cell_id);
384
+ }
385
+ function st(e) {
386
+ switch (e.kind) {
387
+ case "exception": return {
388
+ type: "exception",
389
+ exception_type: e.name ?? "Exception",
390
+ msg: e.message,
391
+ raising_cell: ot(e),
392
+ traceback: e.traceback?.data ?? null
393
+ };
394
+ case "invalid-syntax": return {
395
+ type: "syntax",
396
+ msg: e.message,
397
+ lineno: e.range === null ? null : e.range.start.line + 1
398
+ };
399
+ case "internal": return {
400
+ type: "unknown",
401
+ msg: e.message,
402
+ error_type: e.name
403
+ };
404
+ case "interrupted": return { type: "interruption" };
405
+ default: return {
406
+ type: "diagnostic",
407
+ kind: e.kind,
408
+ msg: e.message,
409
+ related: nt(e.related)
410
+ };
411
+ }
412
+ }
413
+ function ct(e, t) {
414
+ let n = t.related[0];
415
+ if (n !== void 0 && t.reason === "upstream-stopped") return j(e, [{
416
+ type: "ancestor-stopped",
417
+ msg: t.message,
418
+ raising_cell: A(n.cell_id)
419
+ }]);
420
+ if (n !== void 0 && t.reason === "upstream-failed") {
421
+ let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
422
+ return j(e, [{
423
+ type: "ancestor-prevented",
424
+ msg: t.message,
425
+ raising_cell: A(n.cell_id),
426
+ blamed_cell: r === void 0 ? null : A(r.cell_id)
427
+ }]);
428
+ }
429
+ return j(e, [{
430
+ type: "diagnostic",
431
+ kind: t.reason,
432
+ msg: t.message,
433
+ related: nt(t.related)
434
+ }]);
435
+ }
436
+ function lt(e, t) {
437
+ let n = e.cell_id === null ? void 0 : t.get(e.cell_id);
438
+ return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
439
+ }
440
+ function ut(e, t = et) {
441
+ let n = dt(e), r = lt(e, t);
442
+ return n === null || r === void 0 ? n : {
443
+ ...n,
444
+ code: r
254
445
  };
255
446
  }
447
+ function dt(e) {
448
+ let t = e.outcome;
449
+ if (t === null) return null;
450
+ switch (t.kind) {
451
+ case "value": return t.display === null ? null : at(e, t.display);
452
+ case "error": return j(e, [st(t.error)]);
453
+ case "interrupted": return j(e, [{ type: "interruption" }]);
454
+ case "skipped": return ct(e, t);
455
+ }
456
+ }
457
+ function ft(e, t) {
458
+ let n = e.executions.latest.get(t), r = n === void 0 ? void 0 : e.executions.executions.get(n);
459
+ if (r !== void 0 && r.record.outcome !== null && r.record.status !== "completed") return r;
460
+ let i = e.results.get(t) ?? null;
461
+ return r?.record.status === "running" && i?.record.outcome?.kind === "skipped" ? null : i;
462
+ }
463
+ function pt(e, t) {
464
+ return e?.execution === t.record.id && e.version === t.outputVersion;
465
+ }
466
+ function mt(e, t) {
467
+ let n = ft(e, t);
468
+ return n === null || pt(e.cleared.get(t), n) ? null : ut(n.record, e.cells);
469
+ }
470
+ function ht(e) {
471
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
472
+ for (let r of n) {
473
+ let n = mt(e, r);
474
+ n !== null && t.set(A(r), n);
475
+ }
476
+ return t;
477
+ }
256
478
  //#endregion
257
479
  //#region src/utils/time.ts
258
- var He = class e {
480
+ var gt = class e {
259
481
  ms;
260
482
  static fromMilliseconds(t) {
261
483
  return t == null ? null : new e(t);
@@ -284,125 +506,151 @@ var He = class e {
284
506
  };
285
507
  //#endregion
286
508
  //#region src/core/executions/select.ts
287
- function Ue(e) {
509
+ function _t(e) {
288
510
  let t = e.outcome;
289
511
  return t === null ? null : t.kind;
290
512
  }
291
- function We(e) {
292
- return e === null ? null : He.parse(e).toMilliseconds();
513
+ function vt(e) {
514
+ return e === null ? null : gt.parse(e).toMilliseconds();
293
515
  }
294
- function Ge(e, t) {
516
+ function yt(e, t) {
295
517
  let n = e.latest.get(t);
296
518
  return n === void 0 ? null : e.executions.get(n) ?? null;
297
519
  }
298
- function Ke(e, t) {
520
+ function bt(e, t) {
299
521
  let n = e.cells.get(t);
300
522
  return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
301
523
  }
302
- function qe(e, t) {
303
- if (!Ke(e, t)) return !1;
524
+ function xt(e, t) {
525
+ if (!bt(e, t)) return !1;
304
526
  if (e.requested.has(t)) return !0;
305
- let n = Ge(e.executions, t)?.record.run_id ?? e.results.get(t)?.run_id;
527
+ let n = yt(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id;
306
528
  for (let r of e.executions.runs.values()) if (r.status !== "completed" && r.id !== n && r.cells.includes(t)) return !0;
307
529
  return !1;
308
530
  }
309
- function Je(e, t) {
310
- let n = Ge(e.executions, t), r = e.results.get(t) ?? null, i = "idle", a = r === null ? null : We(r.started_at), o = !1;
311
- n !== null && n.record.status !== "completed" ? (i = n.record.status, a = We(n.record.started_at) ?? a, o = n.record.outcome !== null) : qe(e, t) && (i = "queued");
312
- let s = i === "idle", c = s && r !== null && r.started_at !== null && r.completed_at !== null ? He.parse(r.completed_at).since(He.parse(r.started_at)) : null;
531
+ function St(e, t) {
532
+ let n = yt(e.executions, t), r = e.results.get(t)?.record ?? null, i = "idle", a = r === null ? null : vt(r.started_at), o = !1;
533
+ n !== null && n.record.status !== "completed" ? (i = n.record.status, a = vt(n.record.started_at) ?? a, o = n.record.outcome !== null) : xt(e, t) && (i = "queued");
534
+ let s = i === "idle", c = s && r !== null && r.started_at !== null && r.completed_at !== null ? gt.parse(r.completed_at).since(gt.parse(r.started_at)) : null;
313
535
  return {
314
536
  status: i,
315
537
  blocked: e.blocked.has(t),
316
- outcome: s && r !== null ? Ue(r) : null,
538
+ outcome: s && r !== null ? _t(r) : null,
317
539
  startedAt: a,
318
540
  duration: c,
319
541
  rendered: o
320
542
  };
321
543
  }
322
- function Ye(e) {
544
+ function Ct(e) {
323
545
  return [...e.executions.values()].filter((e) => e.record.status !== "completed");
324
546
  }
325
- function Xe(e) {
326
- return Ye(e).some((e) => e.record.status === "running");
547
+ function wt(e) {
548
+ return Ct(e).some((e) => e.record.status === "running");
327
549
  }
328
- function Ze(e) {
329
- let t = Ye(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
550
+ function Tt(e) {
551
+ let t = Ct(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
330
552
  for (let t of e.executions.runs.values()) if (t.status !== "completed") for (let e of t.cells) r.add(e);
331
553
  let i = 0;
332
- for (let t of r) !n.has(t) && qe(e, t) && (i += 1);
554
+ for (let t of r) !n.has(t) && xt(e, t) && (i += 1);
333
555
  return t.length + i;
334
556
  }
335
557
  //#endregion
336
558
  //#region src/core/executions/atoms.ts
337
- var Qe = {
559
+ var M = {
338
560
  runs: /* @__PURE__ */ new Map(),
339
561
  executions: /* @__PURE__ */ new Map(),
340
- latest: /* @__PURE__ */ new Map()
341
- }, $e = /* @__PURE__ */ new Map(), et = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Set(), nt = /* @__PURE__ */ new Set(), rt = /* @__PURE__ */ new Set(), it = /* @__PURE__ */ new Map(), j = h(null), at = h(null);
342
- function ot(e, t, n, r) {
562
+ latest: /* @__PURE__ */ new Map(),
563
+ results: /* @__PURE__ */ new Map(),
564
+ scratch: null
565
+ }, Et = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), Dt = /* @__PURE__ */ new Set(), Ot = /* @__PURE__ */ new Set(), kt = /* @__PURE__ */ new Set(), At = /* @__PURE__ */ new Map(), P = h(null), jt = h(null);
566
+ function Mt(e, t, n, r) {
343
567
  return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
344
568
  }
345
- function st(e) {
569
+ function Nt(e) {
346
570
  let t = e.get(_), n = t === null ? null : e.get(t.notebookAtom);
347
571
  return t === null || n === null ? null : {
348
572
  replica: t,
349
573
  id: n.id
350
574
  };
351
575
  }
352
- function ct(e, t) {
353
- let n = st(e);
576
+ function Pt(e, t) {
577
+ let n = Nt(e);
354
578
  return n === null ? null : {
355
579
  notebook: n,
356
580
  value: t
357
581
  };
358
582
  }
359
- function lt(e, t) {
583
+ function Ft(e, t) {
360
584
  let n = e.get(_);
361
585
  if (n !== t.notebook.replica) return !1;
362
586
  let r = e.get(n.notebookAtom);
363
587
  return r === null || r.id === t.notebook.id;
364
588
  }
365
- var ut = h((e) => {
366
- let t = e(_), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = ot(e(j), t, n, tt);
367
- return r.size === 0 ? nt : new Set([...r].flatMap((e) => e.cells));
368
- }), M = h((e) => {
589
+ var It = h((e) => {
590
+ let t = e(_), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = Mt(e(P), t, n, Dt);
591
+ return r.size === 0 ? Ot : new Set([...r].flatMap((e) => e.cells));
592
+ }), F = h((e) => {
369
593
  let t = e(_), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = t === null ? null : e(t.shownDocumentAtom);
370
594
  return {
371
- executions: t === null ? Qe : e(t.executionsAtom),
372
- results: t === null ? $e : e(t.resultsAtom),
373
- cells: r?.cells ?? et,
374
- requested: e(ut),
375
- blocked: ot(e(at), t, n, rt)
595
+ executions: t === null ? M : e(t.executionsAtom),
596
+ results: t === null ? Et : e(t.resultsAtom),
597
+ cells: r?.cells ?? N,
598
+ requested: e(It),
599
+ blocked: Mt(e(jt), t, n, kt)
376
600
  };
377
- }), dt = h((e) => {
601
+ }), Lt = h((e) => {
378
602
  let t = e(_), n = t === null ? null : e(t.shownDocumentAtom);
379
603
  return t === null || n === null ? {
380
- cells: et,
381
- executions: Qe,
382
- results: $e
604
+ cells: N,
605
+ executions: M,
606
+ results: Et
383
607
  } : {
384
608
  cells: n.cells,
385
609
  executions: e(t.executionsAtom),
386
610
  results: e(t.resultsAtom)
387
611
  };
388
- }), ft = h((e) => Ve(e(dt))), pt = h(null);
389
- h((e) => {
390
- let t = e(_), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
612
+ }), Rt = h((e) => $e(e(Lt))), zt = h(null), Bt = h((e) => {
613
+ let t = e(_), n = t === null ? null : e(t.shownDocumentAtom);
614
+ return t === null || n === null ? null : {
615
+ replica: t,
616
+ id: n.revision.notebook_id
617
+ };
618
+ }), Vt = h((e) => {
619
+ let t = e(_), n = e(Bt)?.id ?? null;
391
620
  return {
392
- executions: t === null ? Qe : e(t.executionsAtom),
393
- results: t === null ? $e : e(t.resultsAtom),
394
- cleared: ot(e(pt), t, n, it)
621
+ executions: t === null ? M : e(t.executionsAtom),
622
+ results: t === null ? Et : e(t.resultsAtom),
623
+ cleared: Mt(e(zt), t, n, At),
624
+ cells: t === null ? N : e(t.documentAtom)?.cells ?? N
395
625
  };
396
- });
397
- var mt = h((e) => {
626
+ }), Ht = h((e) => ht(e(Vt))), I = v((e) => ne(Ht, (t) => t.get(e) ?? null, te)), L = v((e) => h((t) => qe(t(I(e)))));
627
+ function Ut(e) {
628
+ I.remove(e), L.remove(e);
629
+ }
630
+ function Wt(e, t) {
631
+ let n = e.get(Vt), r = new Map(n.cleared);
632
+ for (let e of t) {
633
+ let t = ft(n, e);
634
+ t?.record.outcome != null && r.set(e, {
635
+ execution: t.record.id,
636
+ version: t.outputVersion
637
+ });
638
+ }
639
+ let i = e.get(Bt);
640
+ e.set(zt, i === null ? null : {
641
+ notebook: i,
642
+ value: r
643
+ });
644
+ }
645
+ var Gt = h((e) => {
398
646
  let t = e(_);
399
647
  return t === null ? null : e(t.runtimeAtom)?.status ?? null;
400
648
  });
401
- h((e) => Xe(e(M).executions)), h((e) => Ze(e(M)));
402
- var ht = h((e) => {
649
+ h((e) => wt(e(F).executions)), h((e) => Tt(e(F)));
650
+ var Kt = h((e) => {
403
651
  let t = e(_);
404
652
  if (t === null) return { refused: "No notebook is connected" };
405
- if (e(t.connectionAtom).state === A.CLOSED) return { refused: "The notebook is disconnected" };
653
+ if (e(t.connectionAtom).state === k.CLOSED) return { refused: "The notebook is disconnected" };
406
654
  if (e(t.notebookAtom) === null) return "waiting";
407
655
  let n = e(t.runtimeAtom);
408
656
  if (n === null) return { refused: "The notebook has no runtime" };
@@ -412,157 +660,67 @@ var ht = h((e) => {
412
660
  default: return "waiting";
413
661
  }
414
662
  });
415
- function gt(e) {
663
+ function qt(e) {
416
664
  return new Promise((t, n) => {
417
- let r = e.sub(ht, i);
665
+ let r = e.sub(Kt, i);
418
666
  function i() {
419
- let i = e.get(ht);
667
+ let i = e.get(Kt);
420
668
  i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
421
669
  }
422
670
  i();
423
671
  });
424
672
  }
425
- function _t(e, t) {
426
- let n = st(e);
673
+ function Jt(e, t) {
674
+ let n = Nt(e);
427
675
  if (n === null) return null;
428
676
  let r = {
429
677
  notebook: n,
430
678
  cells: [...t]
431
- }, i = e.get(j), a = i !== null && i.notebook.replica === n.replica && i.notebook.id === n.id ? i.value : tt;
432
- return e.set(j, {
679
+ }, i = e.get(P), a = i !== null && i.notebook.replica === n.replica && i.notebook.id === n.id ? i.value : Dt;
680
+ return e.set(P, {
433
681
  notebook: n,
434
682
  value: new Set(a).add(r)
435
683
  }), r;
436
684
  }
437
- function vt(e, t) {
438
- let n = e.get(j);
685
+ function Yt(e, t) {
686
+ let n = e.get(P);
439
687
  if (n === null || !n.value.has(t)) return;
440
688
  let r = new Set(n.value);
441
- r.delete(t), e.set(j, {
689
+ r.delete(t), e.set(P, {
442
690
  notebook: n.notebook,
443
691
  value: r
444
692
  });
445
693
  }
446
- function yt(e, t, n) {
694
+ function Xt(e, t, n) {
447
695
  let { replica: r } = t.notebook, i = e.sub(r.executionsAtom, a);
448
696
  function a() {
449
- (!lt(e, t) || e.get(r.executionsAtom).runs.has(n.id)) && (i(), vt(e, t));
697
+ (!Ft(e, t) || e.get(r.executionsAtom).runs.has(n.id)) && (i(), Yt(e, t));
450
698
  }
451
699
  a();
452
700
  }
453
- function bt(e, t, n) {
454
- let r = e.get(M).blocked;
701
+ function Zt(e, t, n) {
702
+ let r = e.get(F).blocked;
455
703
  if (r.has(t) === n) return;
456
704
  let i = new Set(r);
457
- n ? i.add(t) : i.delete(t), e.set(at, ct(e, i));
458
- }
459
- function xt(e, t) {
460
- t.status != null && bt(e, t.cell_id, t.status === "disabled-transitively");
705
+ n ? i.add(t) : i.delete(t), e.set(jt, Pt(e, i));
461
706
  }
462
- //#endregion
463
- //#region src/plugins/core/sanitize-html.ts
464
- var St = a(), Ct = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
465
- if (typeof document < "u") {
466
- let e = "data-temp-href-target";
467
- ce.addHook("beforeSanitizeAttributes", (t) => {
468
- t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
469
- }), ce.addHook("afterSanitizeAttributes", (t) => {
470
- t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
471
- });
472
- }
473
- function wt(e) {
474
- let t = {
475
- USE_PROFILES: {
476
- html: !0,
477
- svg: !0,
478
- mathMl: !0
479
- },
480
- ADD_TAGS: ["use"],
481
- ADD_ATTR: ["href", "xlink:href"],
482
- ALLOWED_URI_REGEXP: Ct,
483
- FORCE_BODY: !0,
484
- CUSTOM_ELEMENT_HANDLING: {
485
- tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
486
- attributeNameCheck: /^[A-Za-z][\w-]*$/
487
- },
488
- SAFE_FOR_XML: !e.includes("marimo-mermaid")
489
- };
490
- return ce.sanitize(e, t);
491
- }
492
- //#endregion
493
- //#region src/core/dom/outline.ts
494
- var Tt = [
495
- "marimo-carousel",
496
- "marimo-tabs",
497
- "marimo-accordion",
498
- "marimo-sidebar"
499
- ], Et = "h1, h2, h3, h4, h5, h6";
500
- function Dt(e) {
501
- if (typeof DOMParser > "u") return null;
502
- let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Et);
503
- for (let e of Array.from(n)) {
504
- let n = e.textContent;
505
- if (Tt.some((t) => e.closest(t)) || !n) continue;
506
- let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
507
- name: n,
508
- level: r,
509
- by: kt(e)
510
- };
511
- i !== n && (a.html = wt(i)), t.push(a);
512
- }
513
- return { items: t };
514
- }
515
- function Ot(e) {
516
- if (!e.includes("\"")) return `"${e}"`;
517
- if (!e.includes("'")) return `'${e}'`;
518
- let t = e.split("\""), n = [];
519
- for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
520
- return `concat(${n.join(", ")})`;
521
- }
522
- function kt(e) {
523
- let t = e.id;
524
- if (t) return { id: t };
525
- let n = e.textContent ?? "";
526
- return { path: `//${e.tagName}[contains(., ${Ot(n)})]` };
527
- }
528
- function At(e) {
529
- return { items: e.filter(Boolean).flatMap((e) => e.items) };
530
- }
531
- function jt(e) {
532
- if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
533
- try {
534
- return T(typeof e.data == "string", "expected string"), Dt(e.data);
535
- } catch {
536
- return t.error("Failed to parse outline"), null;
537
- }
538
- }
539
- function Mt(e) {
540
- return e != null && e.items.some((e) => e.level <= 3);
541
- }
542
- function Nt(e, n) {
543
- let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
544
- if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
545
- let a = r(i), o = e + 1;
546
- for (; o < n.length;) {
547
- let t = n[o];
548
- if (t && r(t) <= a) return [e, o - 1];
549
- o++;
550
- }
551
- return [e, n.length - 1];
707
+ function Qt(e, t) {
708
+ t.status != null && Zt(e, t.cell_id, t.status === "disabled-transitively");
552
709
  }
553
710
  //#endregion
554
711
  //#region src/core/codemirror/editing/commands.ts
555
- function Pt(e) {
712
+ var $t = a();
713
+ function en(e) {
556
714
  return (t) => {
557
715
  let n = !1;
558
716
  for (let r of t) r && (n = e(r) || n);
559
717
  return n;
560
718
  };
561
719
  }
562
- var Ft = Pt(pe), It = Pt(de);
720
+ var tn = en(me), nn = en(fe);
563
721
  //#endregion
564
722
  //#region src/utils/schedule-task.ts
565
- function Lt() {
723
+ function rn() {
566
724
  let e = globalThis.scheduler;
567
725
  if (typeof e?.postTask == "function") return (t) => {
568
726
  e.postTask(t, { priority: "user-visible" }).catch((e) => {
@@ -583,10 +741,10 @@ function Lt() {
583
741
  setTimeout(e, 0);
584
742
  };
585
743
  }
586
- var Rt = Lt();
744
+ var an = rn();
587
745
  //#endregion
588
746
  //#region src/core/codemirror/editor-mount-scheduler.ts
589
- function zt(e = Rt) {
747
+ function on(e = an) {
590
748
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
591
749
  function i() {
592
750
  r || t.size === 0 || (r = !0, e(o));
@@ -629,21 +787,21 @@ function zt(e = Rt) {
629
787
  }
630
788
  };
631
789
  }
632
- var Bt = zt();
790
+ var sn = on();
633
791
  //#endregion
634
792
  //#region src/core/mime.ts
635
- function Vt(e) {
793
+ function cn(e) {
636
794
  return e === "application/vnd.marimo+error";
637
795
  }
638
- function N(e) {
796
+ function ln(e) {
639
797
  return e === "application/vnd.marimo+traceback";
640
798
  }
641
- function P(e) {
642
- return Vt(e) || N(e);
799
+ function R(e) {
800
+ return cn(e) || ln(e);
643
801
  }
644
802
  //#endregion
645
803
  //#region src/components/editor/output/ansi-reduce.ts
646
- var Ht = class e {
804
+ var un = class e {
647
805
  lines = [""];
648
806
  cursor = {
649
807
  row: 0,
@@ -732,7 +890,7 @@ var Ht = class e {
732
890
  render() {
733
891
  return this.lines.join("\n");
734
892
  }
735
- }, Ut = class {
893
+ }, dn = class {
736
894
  ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
737
895
  parse(e) {
738
896
  let t = [], n = 0;
@@ -751,9 +909,9 @@ var Ht = class e {
751
909
  value: e.slice(n)
752
910
  }), t;
753
911
  }
754
- }, Wt = class {
755
- parser = new Ut();
756
- buffer = new Ht();
912
+ }, fn = class {
913
+ parser = new dn();
914
+ buffer = new un();
757
915
  reduce(e) {
758
916
  return this.reset(), this.append(e), this.render();
759
917
  }
@@ -769,7 +927,7 @@ var Ht = class e {
769
927
  for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
770
928
  }
771
929
  reset() {
772
- this.buffer = new Ht();
930
+ this.buffer = new un();
773
931
  }
774
932
  render() {
775
933
  return this.buffer.render();
@@ -812,20 +970,20 @@ var Ht = class e {
812
970
  for (let t of e) t >= " " && (n += t);
813
971
  return n;
814
972
  }
815
- }, F = class e {
973
+ }, z = class e {
816
974
  mimetype;
817
975
  channel;
818
976
  timestamp;
819
977
  code;
820
978
  id;
821
979
  input_id;
822
- ansiReducer = new Wt();
980
+ ansiReducer = new fn();
823
981
  _data;
824
982
  get data() {
825
983
  return this._data;
826
984
  }
827
985
  static create(t) {
828
- let n = new Wt();
986
+ let n = new fn();
829
987
  return n.append(t.data), new e({
830
988
  mimetype: t.mimetype,
831
989
  channel: t.channel,
@@ -862,32 +1020,32 @@ var Ht = class e {
862
1020
  };
863
1021
  //#endregion
864
1022
  //#region src/core/cells/collapseConsoleOutputs.tsx
865
- function Gt(e, t = 5e3) {
1023
+ function pn(e, t = 5e3) {
866
1024
  let n = [...e];
867
- if (n.length < 2) return Xt(n.map(qt), t);
1025
+ if (n.length < 2) return vn(n.map(hn), t);
868
1026
  let r = n[n.length - 1], i = n[n.length - 2];
869
- return Kt(r, i) && (Yt(r), Yt(i), n[n.length - 2] = Jt(i, r), n.pop()), Xt(n, t);
1027
+ return mn(r, i) && (_n(r), _n(i), n[n.length - 2] = gn(i, r), n.pop()), vn(n, t);
870
1028
  }
871
- function Kt(e, t) {
1029
+ function mn(e, t) {
872
1030
  let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
873
1031
  if (!n) return !1;
874
1032
  let r = e.channel === t.channel, i = e.channel !== "stdin";
875
1033
  return n && r && i;
876
1034
  }
877
- function qt(e) {
878
- return e instanceof F ? e : typeof e.data == "string" ? F.create(e) : e;
1035
+ function hn(e) {
1036
+ return e instanceof z ? e : typeof e.data == "string" ? z.create(e) : e;
879
1037
  }
880
- function Jt(e, t) {
881
- return e instanceof F ? e.appendData(t.data) : F.create(e).appendData(t.data);
1038
+ function gn(e, t) {
1039
+ return e instanceof z ? e.appendData(t.data) : z.create(e).appendData(t.data);
882
1040
  }
883
- function Yt(e) {
884
- T(typeof e.data == "string", "expected string output");
1041
+ function _n(e) {
1042
+ w(typeof e.data == "string", "expected string output");
885
1043
  }
886
- function Xt(e, t) {
1044
+ function vn(e, t) {
887
1045
  let n = 0, r;
888
1046
  for (r = e.length - 1; r >= 0 && n < t; r--) {
889
1047
  let t = e[r];
890
- t.mimetype === "text/plain" ? (T(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
1048
+ t.mimetype === "text/plain" ? (w(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
891
1049
  }
892
1050
  if (n < t) return e;
893
1051
  let i = r + 1, a = {
@@ -898,7 +1056,7 @@ function Xt(e, t) {
898
1056
  }, o = e[i];
899
1057
  if (o == null) return [a, ...e.slice(i + 1)];
900
1058
  if (o.mimetype === "text/plain") {
901
- T(typeof o.data == "string", "expected string");
1059
+ w(typeof o.data == "string", "expected string");
902
1060
  let r = o.data.split("\n"), s = t - (n - r.length);
903
1061
  return [
904
1062
  a,
@@ -913,16 +1071,16 @@ function Xt(e, t) {
913
1071
  }
914
1072
  //#endregion
915
1073
  //#region src/core/cells/cell.ts
916
- function Zt(e) {
1074
+ function yn(e) {
917
1075
  return (e.at(-1)?.id ?? 0) + 1;
918
1076
  }
919
- function Qt(e) {
1077
+ function bn(e) {
920
1078
  return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
921
1079
  }
922
- function $t(e, t) {
1080
+ function xn(e, t) {
923
1081
  let n = { ...e };
924
- t.status === "queued" && (n.debuggerActive = !1), t.status === "running" && Qt(e.output).some((e) => e.includes("ancestor")) && (n.output = null), n.output = t.output ?? n.output, t.serialization !== void 0 && (n.serialization = t.serialization);
925
- let r = Qt(t.output).includes("interruption"), i = e.consoleOutputs;
1082
+ t.status === "queued" && (n.debuggerActive = !1), t.serialization !== void 0 && (n.serialization = t.serialization);
1083
+ let r = bn(t.output).includes("interruption"), i = e.consoleOutputs;
926
1084
  (r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
927
1085
  channel: e.channel,
928
1086
  mimetype: e.mimetype,
@@ -933,26 +1091,26 @@ function $t(e, t) {
933
1091
  response: e.response ?? ""
934
1092
  } : e));
935
1093
  let a = t.console;
936
- a != null && (i = Gt(Array.isArray(a) ? a.map((e, t) => ({
1094
+ a != null && (i = pn(Array.isArray(a) ? a.map((e, t) => ({
937
1095
  ...e,
938
1096
  id: t + 1
939
1097
  })) : [...i, {
940
1098
  ...a,
941
- id: Zt(i)
942
- }])), n.consoleOutputs = i, n.outline = jt(n.output);
1099
+ id: yn(i)
1100
+ }])), n.consoleOutputs = i;
943
1101
  let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
944
1102
  return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
945
1103
  }
946
- function en(e) {
1104
+ function Sn(e) {
947
1105
  return e === "running" || e === "queued";
948
1106
  }
949
- function tn(e, t, n) {
1107
+ function Cn(e, t, n) {
950
1108
  let { status: r, outcome: i, rendered: a } = e;
951
- return en(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
1109
+ return Sn(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
952
1110
  }
953
1111
  //#endregion
954
1112
  //#region src/core/cells/columns.ts
955
- function nn(e) {
1113
+ function wn(e) {
956
1114
  let t = /* @__PURE__ */ new Map(), n = 0;
957
1115
  for (let r of e.order) {
958
1116
  let i = e.cells.get(r)?.config.column;
@@ -960,9 +1118,9 @@ function nn(e) {
960
1118
  }
961
1119
  return t;
962
1120
  }
963
- function rn(e) {
1121
+ function Tn(e) {
964
1122
  let t = [[]];
965
- for (let [n, r] of nn(e)) {
1123
+ for (let [n, r] of wn(e)) {
966
1124
  for (; t.length <= r;) t.push([]);
967
1125
  t[r].push(n);
968
1126
  }
@@ -970,18 +1128,18 @@ function rn(e) {
970
1128
  }
971
1129
  //#endregion
972
1130
  //#region src/core/dom/ui-element-constants.ts
973
- var an = "object-id", on = "random-id", sn = "abcdefghijklmnopqrstuvwxyz", cn = sn + sn.toUpperCase(), ln = /* @__PURE__ */ new Set(), I = "__scratch__", un = "setup", dn = { create() {
1131
+ var En = "object-id", Dn = "random-id", On = "abcdefghijklmnopqrstuvwxyz", kn = On + On.toUpperCase(), An = /* @__PURE__ */ new Set(), B = "__scratch__", jn = "setup", Mn = { create() {
974
1132
  let e = 0, t;
975
1133
  do {
976
1134
  let n = "";
977
- for (let e = 0; e < 4; e++) n += cn[Math.floor(Math.random() * 52)];
1135
+ for (let e = 0; e < 4; e++) n += kn[Math.floor(Math.random() * 52)];
978
1136
  t = n, e++;
979
- } while (ln.has(t) && e < 100);
1137
+ } while (An.has(t) && e < 100);
980
1138
  if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
981
- return ln.add(t), t;
982
- } }, L = {
1139
+ return An.add(t), t;
1140
+ } }, V = {
983
1141
  create(e) {
984
- return T(e != null, "cellId is required"), `cell-${e}`;
1142
+ return w(e != null, "cellId is required"), `cell-${e}`;
985
1143
  },
986
1144
  parse(e) {
987
1145
  return e.slice(5);
@@ -992,7 +1150,7 @@ var an = "object-id", on = "random-id", sn = "abcdefghijklmnopqrstuvwxyz", cn =
992
1150
  findElementThroughShadowDOMs(e) {
993
1151
  let t = e;
994
1152
  for (; t;) {
995
- let e = L.findElement(t);
1153
+ let e = V.findElement(t);
996
1154
  if (e) return e;
997
1155
  let n = t.getRootNode();
998
1156
  if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
@@ -1000,33 +1158,33 @@ var an = "object-id", on = "random-id", sn = "abcdefghijklmnopqrstuvwxyz", cn =
1000
1158
  return null;
1001
1159
  }
1002
1160
  };
1003
- function fn(e) {
1004
- let t = null, n = L.findElementThroughShadowDOMs(e);
1005
- return n && (t = L.parse(n.id)), t;
1161
+ function Nn(e) {
1162
+ let t = null, n = V.findElementThroughShadowDOMs(e);
1163
+ return n && (t = V.parse(n.id)), t;
1006
1164
  }
1007
- var pn = {
1165
+ var Pn = {
1008
1166
  parse(e) {
1009
- return e.getAttribute(an);
1167
+ return e.getAttribute(En);
1010
1168
  },
1011
1169
  parseOrThrow(e) {
1012
- let t = pn.parse(e);
1013
- return T(t, "<marimo-ui-element/> missing object-id attribute"), t;
1170
+ let t = Pn.parse(e);
1171
+ return w(t, "<marimo-ui-element/> missing object-id attribute"), t;
1014
1172
  }
1015
- }, mn = { create(e) {
1173
+ }, Fn = { create(e) {
1016
1174
  return `output-${e}`;
1017
- } }, hn = h(/* @__PURE__ */ new Set()), R = h([]), z = h([]);
1018
- function gn() {
1019
- return `column-${dn.create()}`;
1175
+ } }, In = h(/* @__PURE__ */ new Set()), H = h([]), U = h([]);
1176
+ function Ln() {
1177
+ return `column-${Mn.create()}`;
1020
1178
  }
1021
- var _n = h(null, (e, t, n) => {
1022
- let r = rn(n).length, i = e(R);
1179
+ var Rn = h(null, (e, t, n) => {
1180
+ let r = Tn(n).length, i = e(H);
1023
1181
  if (i.length === r) return;
1024
- let a = e(z), o = [...i, ...a].slice(0, r);
1025
- for (; o.length < r;) o.push(gn());
1026
- t(R, o), t(z, a.slice(Math.max(0, r - i.length)));
1182
+ let a = e(U), o = [...i, ...a].slice(0, r);
1183
+ for (; o.length < r;) o.push(Ln());
1184
+ t(H, o), t(U, a.slice(Math.max(0, r - i.length)));
1027
1185
  });
1028
- function vn(e, t, n) {
1029
- return [...(e === null ? [[]] : rn(e)).map((e, n) => ({
1186
+ function zn(e, t, n) {
1187
+ return [...(e === null ? [[]] : Tn(e)).map((e, n) => ({
1030
1188
  id: t[n] ?? `column-${n}`,
1031
1189
  ids: e
1032
1190
  })), ...n.map((e) => ({
@@ -1034,18 +1192,18 @@ function vn(e, t, n) {
1034
1192
  ids: []
1035
1193
  }))];
1036
1194
  }
1037
- function yn(e, t, n) {
1195
+ function Bn(e, t, n) {
1038
1196
  let r = /* @__PURE__ */ new Map();
1039
1197
  return e.forEach((i, a) => {
1040
1198
  let o = t[a];
1041
1199
  if (!n.has(i) || !o || o.items.length === 0) return;
1042
- let s = Nt(a, t);
1200
+ let s = Ye(a, t);
1043
1201
  s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
1044
1202
  }), r;
1045
1203
  }
1046
- function bn(e, t, n) {
1204
+ function Vn(e, t, n) {
1047
1205
  return { columns: e.map(({ id: e, ids: r }) => {
1048
- let i = yn(r, r.map(t), n), a = new Set([...i.values()].flat());
1206
+ let i = Bn(r, r.map(t), n), a = new Set([...i.values()].flat());
1049
1207
  return {
1050
1208
  id: e,
1051
1209
  ids: r,
@@ -1054,52 +1212,52 @@ function bn(e, t, n) {
1054
1212
  };
1055
1213
  }) };
1056
1214
  }
1057
- var B = h((e) => {
1058
- let t = e(ae), n = t === null ? null : e(t.documentAtom), r = e(yi);
1059
- return bn(vn(n, e(R), e(z)), (e) => r[e] ?? null, e(hn));
1060
- }), xn = () => g(B), Sn = h((e) => e(B).columns.length);
1061
- function Cn(e, t) {
1215
+ var Hn = h((e) => {
1216
+ let t = e(oe), n = t === null ? null : e(t.documentAtom), r = e(Gi);
1217
+ return Vn(zn(n, e(H), e(U)), (e) => r[e] ?? null, e(In));
1218
+ }), Un = () => g(Hn), Wn = h((e) => e(Hn).columns.length);
1219
+ function Gn(e, t) {
1062
1220
  return e.columns.find((e) => e.id === t);
1063
1221
  }
1064
- function wn(e, t) {
1222
+ function Kn(e, t) {
1065
1223
  let n = e.columns.find((e) => e.ids.includes(t));
1066
1224
  if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
1067
1225
  return n;
1068
1226
  }
1069
- function Tn(e, t) {
1227
+ function qn(e, t) {
1070
1228
  for (let n of e.columns) {
1071
1229
  let e = n.folds.get(t);
1072
1230
  if (e !== void 0) return e;
1073
1231
  }
1074
1232
  }
1075
- function En(e, t) {
1233
+ function Jn(e, t) {
1076
1234
  let n = e.columns.find((e) => e.ids.includes(t));
1077
1235
  return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
1078
1236
  }
1079
- function Dn(e, t) {
1080
- let n = En(e, t);
1081
- return Tn(e, t) === void 0 ? n : [...n, t];
1237
+ function Yn(e, t) {
1238
+ let n = Jn(e, t);
1239
+ return qn(e, t) === void 0 ? n : [...n, t];
1082
1240
  }
1083
- var On = /* @__PURE__ */ new Set(/* @__PURE__ */ "__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup".split("."));
1084
- function kn(e, t = !0) {
1241
+ var Xn = /* @__PURE__ */ new Set(/* @__PURE__ */ "__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup".split("."));
1242
+ function Zn(e, t = !0) {
1085
1243
  return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
1086
1244
  }
1087
- function An(e, t) {
1088
- let n = new Set(t), r = e, i = (e) => !n.has(e) && !On.has(e);
1245
+ function Qn(e, t) {
1246
+ let n = new Set(t), r = e, i = (e) => !n.has(e) && !Xn.has(e);
1089
1247
  if (i(e)) return e;
1090
1248
  let a = 1;
1091
1249
  for (; !i(r);) r = `${e}_${a}`, a++;
1092
1250
  return r;
1093
1251
  }
1094
- function jn(e, t) {
1095
- return Mn(e) ? `cell-${t}` : e;
1252
+ function $n(e, t) {
1253
+ return er(e) ? `cell-${t}` : e;
1096
1254
  }
1097
- function Mn(e) {
1255
+ function er(e) {
1098
1256
  return !e || e === "_" || e === "__";
1099
1257
  }
1100
1258
  //#endregion
1101
1259
  //#region src/core/cells/types.ts
1102
- function Nn({ id: e, name: t = "_", code: n = "", config: r }) {
1260
+ function tr({ id: e, name: t = "_", code: n = "", config: r }) {
1103
1261
  return {
1104
1262
  id: e,
1105
1263
  config: r || {
@@ -1112,7 +1270,7 @@ function Nn({ id: e, name: t = "_", code: n = "", config: r }) {
1112
1270
  code: n
1113
1271
  };
1114
1272
  }
1115
- function Pn(e) {
1273
+ function nr(e) {
1116
1274
  return {
1117
1275
  hide_code: !1,
1118
1276
  disabled: !1,
@@ -1121,10 +1279,8 @@ function Pn(e) {
1121
1279
  ...e
1122
1280
  };
1123
1281
  }
1124
- function V(e) {
1282
+ function rr(e) {
1125
1283
  return {
1126
- outline: null,
1127
- output: null,
1128
1284
  consoleOutputs: [],
1129
1285
  debuggerActive: !1,
1130
1286
  ...e
@@ -1132,8 +1288,8 @@ function V(e) {
1132
1288
  }
1133
1289
  //#endregion
1134
1290
  //#region src/core/cells/document.ts
1135
- function Fn(e, t) {
1136
- let n = t.code ?? e.code, r = te(e.config, t.config) ? e.config : Pn(t.config);
1291
+ function ir(e, t) {
1292
+ let n = t.code ?? e.code, r = te(e.config, t.config) ? e.config : nr(t.config);
1137
1293
  return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
1138
1294
  ...e,
1139
1295
  name: t.name,
@@ -1145,7 +1301,7 @@ function Fn(e, t) {
1145
1301
  config: r
1146
1302
  };
1147
1303
  }
1148
- function In(e, t) {
1304
+ function ar(e, t) {
1149
1305
  let n = te(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
1150
1306
  for (let o of n) {
1151
1307
  let n = t.cells.get(o), s = e.cellData[o];
@@ -1153,22 +1309,22 @@ function In(e, t) {
1153
1309
  if (s === void 0) {
1154
1310
  r = {
1155
1311
  ...r,
1156
- [o]: Nn({
1312
+ [o]: tr({
1157
1313
  id: o,
1158
1314
  code: n.code ?? "",
1159
1315
  name: n.name,
1160
- config: Pn(n.config)
1316
+ config: nr(n.config)
1161
1317
  })
1162
1318
  }, i = {
1163
1319
  ...i,
1164
- [o]: i[o] ?? V()
1320
+ [o]: i[o] ?? rr()
1165
1321
  }, a = {
1166
1322
  ...a,
1167
- [o]: (0, E.createRef)()
1323
+ [o]: (0, T.createRef)()
1168
1324
  };
1169
1325
  continue;
1170
1326
  }
1171
- let c = Fn(s, n);
1327
+ let c = ir(s, n);
1172
1328
  c !== s && (r = {
1173
1329
  ...r,
1174
1330
  [o]: c
@@ -1187,50 +1343,50 @@ function In(e, t) {
1187
1343
  cellHandles: a
1188
1344
  };
1189
1345
  }
1190
- function Ln({ store: e, model: t, reconcile: n, signal: r }) {
1346
+ function or({ store: e, model: t, reconcile: n, signal: r }) {
1191
1347
  let i = () => {
1192
1348
  let r = e.get(t.documentAtom);
1193
- r !== null && (n(r), e.set(_n, r));
1349
+ r !== null && (n(r), e.set(Rn, r));
1194
1350
  }, a = e.sub(t.documentAtom, i);
1195
1351
  r.addEventListener("abort", a, { once: !0 }), i();
1196
1352
  }
1197
- async function Rn() {
1198
- let e = w.get(ae);
1199
- e !== null && w.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
1353
+ async function sr() {
1354
+ let e = C.get(oe);
1355
+ e !== null && C.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
1200
1356
  }
1201
1357
  //#endregion
1202
1358
  //#region src/core/cells/editor.ts
1203
- var H = h(/* @__PURE__ */ new Set());
1204
- function zn(e, t, n) {
1359
+ var W = h(/* @__PURE__ */ new Set());
1360
+ function cr(e, t, n) {
1205
1361
  return !!e && !t.has(n);
1206
1362
  }
1207
1363
  h(null, (e, t, { cellId: n }) => {
1208
- t(H, (e) => /* @__PURE__ */ new Set([...e, n]));
1209
- }), h(null, (e, t, { cellId: n }) => e(H).has(n) ? (t(H, (e) => {
1364
+ t(W, (e) => /* @__PURE__ */ new Set([...e, n]));
1365
+ }), h(null, (e, t, { cellId: n }) => e(W).has(n) ? (t(W, (e) => {
1210
1366
  let t = new Set(e);
1211
1367
  return t.delete(n), t;
1212
1368
  }), !0) : !1);
1213
- var Bn = h(/* @__PURE__ */ new Map());
1369
+ var lr = h(/* @__PURE__ */ new Map());
1214
1370
  h(null, (e, t, { cellId: n }) => {
1215
- t(Bn, (e) => {
1371
+ t(lr, (e) => {
1216
1372
  let t = new Map(e);
1217
1373
  return t.delete(n), t;
1218
1374
  });
1219
1375
  });
1220
1376
  //#endregion
1221
1377
  //#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
1222
- function Vn(e, t) {
1223
- return ve(e * 1e3, t?.in);
1378
+ function ur(e, t) {
1379
+ return ye(e * 1e3, t?.in);
1224
1380
  }
1225
1381
  //#endregion
1226
1382
  //#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
1227
- var U = function(e, t) {
1383
+ var dr = function(e, t) {
1228
1384
  return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
1229
- }, W;
1385
+ }, G;
1230
1386
  (function(e) {
1231
1387
  e[e.EOS = 0] = "EOS", e[e.Text = 1] = "Text", e[e.Incomplete = 2] = "Incomplete", e[e.ESC = 3] = "ESC", e[e.Unknown = 4] = "Unknown", e[e.SGR = 5] = "SGR", e[e.OSCURL = 6] = "OSCURL";
1232
- })(W ||= {});
1233
- var Hn = class {
1388
+ })(G ||= {});
1389
+ var fr = class {
1234
1390
  constructor() {
1235
1391
  this.VERSION = "6.0.6", this.setup_palettes(), this._use_classes = !1, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1, this.fg = this.bg = null, this._buffer = "", this._url_allowlist = {
1236
1392
  http: 1,
@@ -1462,57 +1618,57 @@ var Hn = class {
1462
1618
  }
1463
1619
  get_next_packet() {
1464
1620
  var e = {
1465
- kind: W.EOS,
1621
+ kind: G.EOS,
1466
1622
  text: "",
1467
1623
  url: ""
1468
1624
  }, t = this._buffer.length;
1469
1625
  if (t == 0) return e;
1470
1626
  var n = this._buffer.indexOf("\x1B");
1471
- if (n == -1) return e.kind = W.Text, e.text = this._buffer, this._buffer = "", e;
1472
- if (n > 0) return e.kind = W.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
1627
+ if (n == -1) return e.kind = G.Text, e.text = this._buffer, this._buffer = "", e;
1628
+ if (n > 0) return e.kind = G.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
1473
1629
  if (n == 0) {
1474
- if (t < 3) return e.kind = W.Incomplete, e;
1630
+ if (t < 3) return e.kind = G.Incomplete, e;
1475
1631
  var r = this._buffer.charAt(1);
1476
- if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1632
+ if (r != "[" && r != "]" && r != "(") return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1477
1633
  if (r == "[") {
1478
- this._csi_regex ||= Un(Gn ||= U(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \x1B[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \x1B[ # CSI\n [ -~]* # anything legal\n ([\0-:]) # anything illegal\n )\n "], ["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]));
1634
+ this._csi_regex ||= pr(hr ||= dr(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \x1B[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \x1B[ # CSI\n [ -~]* # anything legal\n ([\0-:]) # anything illegal\n )\n "], ["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]));
1479
1635
  let t = this._buffer.match(this._csi_regex);
1480
- if (t === null) return e.kind = W.Incomplete, e;
1481
- if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1482
- e.kind = t[1] != "" || t[3] != "m" ? W.Unknown : W.SGR, e.text = t[2];
1636
+ if (t === null) return e.kind = G.Incomplete, e;
1637
+ if (t[4]) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1638
+ e.kind = t[1] != "" || t[3] != "m" ? G.Unknown : G.SGR, e.text = t[2];
1483
1639
  var i = t[0].length;
1484
1640
  return this._buffer = this._buffer.slice(i), e;
1485
1641
  }
1486
1642
  if (r == "]") {
1487
- if (t < 4) return e.kind = W.Incomplete, e;
1488
- if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1489
- this._osc_st ||= Wn(Kn ||= U(["\n (?: # legal sequence\n (\x1B\\) # ESC | # alternate\n (\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-] # anything illegal\n | # alternate\n [\b-] # anything illegal\n | # alternate\n [-] # anything illegal\n )\n "], ["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "])), this._osc_st.lastIndex = 0;
1643
+ if (t < 4) return e.kind = G.Incomplete, e;
1644
+ if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1645
+ this._osc_st ||= mr(gr ||= dr(["\n (?: # legal sequence\n (\x1B\\) # ESC | # alternate\n (\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-] # anything illegal\n | # alternate\n [\b-] # anything illegal\n | # alternate\n [-] # anything illegal\n )\n "], ["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "])), this._osc_st.lastIndex = 0;
1490
1646
  {
1491
1647
  let t = this._osc_st.exec(this._buffer);
1492
- if (t === null) return e.kind = W.Incomplete, e;
1493
- if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1648
+ if (t === null) return e.kind = G.Incomplete, e;
1649
+ if (t[3]) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1494
1650
  }
1495
1651
  {
1496
1652
  let t = this._osc_st.exec(this._buffer);
1497
- if (t === null) return e.kind = W.Incomplete, e;
1498
- if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1653
+ if (t === null) return e.kind = G.Incomplete, e;
1654
+ if (t[3]) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1499
1655
  }
1500
- this._osc_regex ||= Un(qn ||= U(["\n ^ # beginning of line\n #\n \x1B]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n \x1B]8;; # OSC Hyperlink End\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n "], ["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]));
1656
+ this._osc_regex ||= pr(_r ||= dr(["\n ^ # beginning of line\n #\n \x1B]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n \x1B]8;; # OSC Hyperlink End\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n "], ["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]));
1501
1657
  let n = this._buffer.match(this._osc_regex);
1502
- if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1503
- e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
1658
+ if (n === null) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1659
+ e.kind = G.OSCURL, e.url = n[1], e.text = n[2];
1504
1660
  var i = n[0].length;
1505
1661
  return this._buffer = this._buffer.slice(i), e;
1506
1662
  }
1507
- if (r == "(") return e.kind = W.Unknown, this._buffer = this._buffer.slice(3), e;
1663
+ if (r == "(") return e.kind = G.Unknown, this._buffer = this._buffer.slice(3), e;
1508
1664
  }
1509
1665
  }
1510
1666
  ansi_to_html(e) {
1511
1667
  this.append_buffer(e);
1512
1668
  for (var t = [];;) {
1513
1669
  var n = this.get_next_packet();
1514
- if (n.kind == W.EOS || n.kind == W.Incomplete) break;
1515
- n.kind != W.ESC && n.kind != W.Unknown && (n.kind == W.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == W.SGR ? this.process_ansi(n) : n.kind == W.OSCURL && t.push(this.process_hyperlink(n)));
1670
+ if (n.kind == G.EOS || n.kind == G.Incomplete) break;
1671
+ n.kind != G.ESC && n.kind != G.Unknown && (n.kind == G.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == G.SGR ? this.process_ansi(n) : n.kind == G.OSCURL && t.push(this.process_hyperlink(n)));
1516
1672
  }
1517
1673
  return t.join("");
1518
1674
  }
@@ -1582,16 +1738,16 @@ var Hn = class {
1582
1738
  return t.length < 1 || !this._url_allowlist[t[0]] ? "" : `<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`;
1583
1739
  }
1584
1740
  };
1585
- function Un(e, ...t) {
1741
+ function pr(e, ...t) {
1586
1742
  let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
1587
1743
  return new RegExp(n);
1588
1744
  }
1589
- function Wn(e, ...t) {
1745
+ function mr(e, ...t) {
1590
1746
  let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
1591
1747
  return new RegExp(n, "g");
1592
1748
  }
1593
- var Gn, Kn, qn, Jn = new Hn();
1594
- function G(e) {
1749
+ var hr, gr, _r, vr = new fr();
1750
+ function K(e) {
1595
1751
  try {
1596
1752
  let t = document.createElement("div");
1597
1753
  return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
@@ -1599,24 +1755,24 @@ function G(e) {
1599
1755
  return t.error("Error parsing HTML content:", n), e;
1600
1756
  }
1601
1757
  }
1602
- function Yn(e) {
1758
+ function yr(e) {
1603
1759
  if (!e) return "";
1604
1760
  try {
1605
- return G(Jn.ansi_to_html(e));
1761
+ return K(vr.ansi_to_html(e));
1606
1762
  } catch (n) {
1607
1763
  return t.error("Error converting ANSI to plain text:", n), e;
1608
1764
  }
1609
1765
  }
1610
1766
  //#endregion
1611
1767
  //#region src/core/errors/traceback-atom.ts
1612
- var Xn = h(null);
1768
+ var br = h(null);
1613
1769
  //#endregion
1614
1770
  //#region src/core/cells/logs.ts
1615
- function Zn(e) {
1771
+ function xr(e) {
1616
1772
  return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
1617
1773
  }
1618
- var Qn = !1;
1619
- function $n(e) {
1774
+ var Sr = !1;
1775
+ function Cr(e) {
1620
1776
  let t = [], n = [e.console].filter(Boolean).flat();
1621
1777
  for (let r of n) {
1622
1778
  let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
@@ -1626,7 +1782,7 @@ function $n(e) {
1626
1782
  case "stdout":
1627
1783
  case "stderr":
1628
1784
  case "marimo-error": {
1629
- let a = d.asString(r.data), o = i ? G(a) : a;
1785
+ let a = d.asString(r.data), o = i ? K(a) : a;
1630
1786
  t.push({
1631
1787
  timestamp: r.timestamp || Date.now(),
1632
1788
  level: n ? "stderr" : "stdout",
@@ -1641,9 +1797,9 @@ function $n(e) {
1641
1797
  }
1642
1798
  }
1643
1799
  }
1644
- if (t.forEach(er.log), n.length === 0 && P(e.output?.mimetype) && Array.isArray(e.output.data)) {
1800
+ if (t.forEach(wr.log), n.length === 0 && R(e.output?.mimetype) && Array.isArray(e.output.data)) {
1645
1801
  e.output.data.forEach((t) => {
1646
- er.log({
1802
+ wr.log({
1647
1803
  level: "stderr",
1648
1804
  source: {
1649
1805
  type: "cell",
@@ -1653,18 +1809,18 @@ function $n(e) {
1653
1809
  message: JSON.stringify(t)
1654
1810
  });
1655
1811
  });
1656
- let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = w.get(ge) === "read";
1657
- if (t.length > 0 && !Qn && n) {
1658
- Qn = !0;
1812
+ let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(_e) === "read";
1813
+ if (t.length > 0 && !Sr && n) {
1814
+ Sr = !0;
1659
1815
  let e = t.find((e) => e.traceback);
1660
1816
  o(e ? {
1661
1817
  title: "An internal error occurred",
1662
1818
  description: e.msg || "Click 'View' to see traceback",
1663
1819
  variant: "danger",
1664
- action: E.createElement(oe, {
1820
+ action: T.createElement(se, {
1665
1821
  altText: "View traceback",
1666
1822
  onClick: () => {
1667
- w.set(Xn, {
1823
+ C.set(br, {
1668
1824
  traceback: e.traceback,
1669
1825
  errorMessage: e.msg || "An internal error occurred"
1670
1826
  });
@@ -1679,13 +1835,13 @@ function $n(e) {
1679
1835
  }
1680
1836
  return t;
1681
1837
  }
1682
- var er = { log: (e) => {
1838
+ var wr = { log: (e) => {
1683
1839
  let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
1684
- console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${tr(e.timestamp)}]`, `(${Zn(e.source)}) ${e.message}`);
1840
+ console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Tr(e.timestamp)}]`, `(${xr(e.source)}) ${e.message}`);
1685
1841
  } };
1686
- function tr(e) {
1842
+ function Tr(e) {
1687
1843
  try {
1688
- return Vn(e).toLocaleTimeString(void 0, {
1844
+ return ur(e).toLocaleTimeString(void 0, {
1689
1845
  hour12: !0,
1690
1846
  hour: "numeric",
1691
1847
  minute: "numeric",
@@ -1697,14 +1853,14 @@ function tr(e) {
1697
1853
  }
1698
1854
  //#endregion
1699
1855
  //#region src/components/editor/navigation/focus-utils.ts
1700
- function nr(e, n) {
1701
- let r = document.getElementById(L.create(e));
1702
- r ? ir(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
1856
+ function Er(e, n) {
1857
+ let r = document.getElementById(V.create(e));
1858
+ r ? Or(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
1703
1859
  }
1704
- function rr() {
1860
+ function Dr() {
1705
1861
  return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
1706
1862
  }
1707
- function ir(e, n) {
1863
+ function Or(e, n) {
1708
1864
  try {
1709
1865
  e.focus(n);
1710
1866
  } catch {
@@ -1713,7 +1869,7 @@ function ir(e, n) {
1713
1869
  }
1714
1870
  //#endregion
1715
1871
  //#region src/utils/timeout.ts
1716
- function ar(e, n) {
1872
+ function kr(e, n) {
1717
1873
  let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
1718
1874
  if (o < r) {
1719
1875
  try {
@@ -1728,76 +1884,76 @@ function ar(e, n) {
1728
1884
  }
1729
1885
  //#endregion
1730
1886
  //#region src/core/cells/utils.ts
1731
- function or(e, t, n) {
1732
- return fr(e, t, n).length > 0;
1887
+ function Ar(e, t, n) {
1888
+ return Ir(e, t, n).length > 0;
1733
1889
  }
1734
- function sr(e) {
1890
+ function jr(e) {
1735
1891
  return e.cellIds.map((t) => e.cellData[t]);
1736
1892
  }
1737
- function cr(e) {
1893
+ function Mr(e) {
1738
1894
  let { cellIds: t, cellData: n } = e, r = [];
1739
1895
  for (let e of t) n[e].config.disabled && r.push(e);
1740
1896
  return r;
1741
1897
  }
1742
- function lr(e) {
1898
+ function Nr(e) {
1743
1899
  let { cellIds: t, cellData: n } = e, r = [];
1744
1900
  for (let e of t) n[e].config.disabled || r.push(e);
1745
1901
  return r;
1746
1902
  }
1747
- function ur(e) {
1903
+ function Pr(e) {
1748
1904
  return e.history.length > 0;
1749
1905
  }
1750
- function dr(e) {
1906
+ function Fr(e) {
1751
1907
  let t = e.history[e.history.length - 1];
1752
1908
  return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
1753
1909
  }
1754
- function fr(e, t, n) {
1910
+ function Ir(e, t, n) {
1755
1911
  let { cellIds: r, cellData: i } = e;
1756
1912
  return r.filter((e) => {
1757
- let r = Je(t, e);
1758
- return r.status === "idle" ? mr(r) || hr({
1913
+ let r = St(t, e);
1914
+ return r.status === "idle" ? Rr(r) || zr({
1759
1915
  freshness: n(e),
1760
1916
  interrupted: r.outcome === "interrupted",
1761
1917
  disabled: i[e].config.disabled,
1762
1918
  blocked: r.blocked
1763
- }) : pr(t.executions, e) && n(e).sourceChanged;
1919
+ }) : Lr(t.executions, e) && n(e).sourceChanged;
1764
1920
  });
1765
1921
  }
1766
- function pr(e, t) {
1922
+ function Lr(e, t) {
1767
1923
  let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
1768
1924
  return r !== void 0 && r.status !== "completed";
1769
1925
  }
1770
- function mr({ status: e, outcome: t }) {
1926
+ function Rr({ status: e, outcome: t }) {
1771
1927
  return t === null && e !== "queued" && e !== "running";
1772
1928
  }
1773
- function hr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
1929
+ function zr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
1774
1930
  return e.sourceChanged || t || e.inputsChanged && !(n || r);
1775
1931
  }
1776
- function gr({ errored: e, stopped: t }) {
1932
+ function Br({ errored: e, stopped: t }) {
1777
1933
  return {
1778
1934
  published: !0,
1779
1935
  "has-error": e,
1780
1936
  stopped: t
1781
1937
  };
1782
1938
  }
1783
- function _r({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
1784
- let a = P(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
1939
+ function Vr({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
1940
+ let a = R(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
1785
1941
  return (e || t || n || a) && !o;
1786
1942
  }
1787
1943
  //#endregion
1788
1944
  //#region src/core/network/requests.ts
1789
- var vr = h(null);
1790
- function yr() {
1791
- let e = g(vr);
1792
- return T(e, "useRequestClient() requires setting requestClientAtom."), e;
1945
+ var Hr = h(null);
1946
+ function Ur() {
1947
+ let e = g(Hr);
1948
+ return w(e, "useRequestClient() requires setting requestClientAtom."), e;
1793
1949
  }
1794
- function br() {
1795
- let e = w.get(vr);
1796
- return T(e, "getRequestClient() requires requestClientAtom to be set."), e;
1950
+ function Wr() {
1951
+ let e = C.get(Hr);
1952
+ return w(e, "getRequestClient() requires requestClientAtom to be set."), e;
1797
1953
  }
1798
1954
  //#endregion
1799
1955
  //#region src/utils/storage/storage.ts
1800
- var xr = class {
1956
+ var Gr = class {
1801
1957
  store = /* @__PURE__ */ new Map();
1802
1958
  get length() {
1803
1959
  return this.store.size;
@@ -1818,16 +1974,16 @@ var xr = class {
1818
1974
  this.store.set(e, t);
1819
1975
  }
1820
1976
  };
1821
- function Sr() {
1822
- let { hasLocalStorage: e, hasSessionStorage: t } = ye();
1823
- return e ? window.localStorage : t ? window.sessionStorage : new xr();
1977
+ function Kr() {
1978
+ let { hasLocalStorage: e, hasSessionStorage: t } = be();
1979
+ return e ? window.localStorage : t ? window.sessionStorage : new Gr();
1824
1980
  }
1825
- var Cr = Sr(), wr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Tr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Er = /^data:image\//i, Dr = ["avatars.githubusercontent.com"];
1826
- function Or(e) {
1827
- return Er.test(e) ? [{
1981
+ var qr = Kr(), Jr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Yr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Xr = /^data:image\//i, Zr = ["avatars.githubusercontent.com"];
1982
+ function Qr(e) {
1983
+ return Xr.test(e) ? [{
1828
1984
  type: "image",
1829
1985
  url: e
1830
- }] : e.split(wr).filter((e) => e !== "").map((e) => wr.test(e) ? Tr.test(e) || Er.test(e) || Dr.some((t) => e.includes(t)) ? {
1986
+ }] : e.split(Jr).filter((e) => e !== "").map((e) => Jr.test(e) ? Yr.test(e) || Xr.test(e) || Zr.some((t) => e.includes(t)) ? {
1831
1987
  type: "image",
1832
1988
  url: e
1833
1989
  } : {
@@ -1840,48 +1996,48 @@ function Or(e) {
1840
1996
  }
1841
1997
  //#endregion
1842
1998
  //#region src/utils/json/json-parser.ts
1843
- var kr = new RegExp(wr.source, "g");
1999
+ var $r = new RegExp(Jr.source, "g");
1844
2000
  BigInt.prototype.toJSON = function() {
1845
2001
  return JSON.rawJSON(this.toString());
1846
2002
  };
1847
- function Ar(e) {
2003
+ function ei(e) {
1848
2004
  try {
1849
- return JSON.parse(e, (e, t) => Pr(t));
2005
+ return JSON.parse(e, (e, t) => ii(t));
1850
2006
  } catch {}
1851
2007
  if (e == null || e === "") return {};
1852
2008
  try {
1853
- return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : Pr(t) : Pr(t));
2009
+ return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : ii(t) : ii(t));
1854
2010
  } catch {
1855
2011
  return {};
1856
2012
  }
1857
2013
  }
1858
- function jr(e) {
2014
+ function ti(e) {
1859
2015
  if (e.length === 0) return "";
1860
2016
  let t = Object.keys(e[0]);
1861
2017
  return [
1862
2018
  `| ${t.join(" | ")} |`,
1863
2019
  `|${t.map(() => "---").join("|")}|`,
1864
- ...e.map((e) => `| ${t.map((t) => Mr(e[t])).join(" | ")} |`)
2020
+ ...e.map((e) => `| ${t.map((t) => ni(e[t])).join(" | ")} |`)
1865
2021
  ].join("\n");
1866
2022
  }
1867
- function Mr(e) {
2023
+ function ni(e) {
1868
2024
  if (e == null) return "";
1869
- if (Array.isArray(e) || typeof e == "object") return Nr(JSON.stringify(e));
2025
+ if (Array.isArray(e) || typeof e == "object") return ri(JSON.stringify(e));
1870
2026
  let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
1871
2027
  t = t.replaceAll(n, (e) => {
1872
2028
  let t = `__MDLINK_${i++}__`;
1873
2029
  return r.set(t, e), t;
1874
- }), t = t.replaceAll(kr, "[$1]($1)");
2030
+ }), t = t.replaceAll($r, "[$1]($1)");
1875
2031
  for (let [e, n] of r) t = t.replace(e, n);
1876
- return Nr(t);
2032
+ return ri(t);
1877
2033
  }
1878
- function Nr(e) {
2034
+ function ri(e) {
1879
2035
  return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
1880
2036
  }
1881
- function Pr(e) {
2037
+ function ii(e) {
1882
2038
  return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
1883
2039
  }
1884
- var Fr = new class {
2040
+ var ai = new class {
1885
2041
  getFilename() {
1886
2042
  return this.getSearchParam("filename");
1887
2043
  }
@@ -1908,39 +2064,39 @@ var Fr = new class {
1908
2064
  }();
1909
2065
  //#endregion
1910
2066
  //#region src/core/dom/htmlUtils.ts
1911
- function Ir(e) {
1912
- return Ar(e ?? "");
2067
+ function oi(e) {
2068
+ return ei(e ?? "");
1913
2069
  }
1914
- function Lr(e) {
1915
- return se.mapValues(e.dataset, (e) => typeof e == "string" ? Ir(e) : e);
2070
+ function si(e) {
2071
+ return ce.mapValues(e.dataset, (e) => typeof e == "string" ? oi(e) : e);
1916
2072
  }
1917
- function Rr(e, t) {
1918
- let n = e.parentElement ? pn.parse(e.parentElement) : void 0;
1919
- return n && t.has(n) ? t.lookupValue(n) : Ir(e.dataset.initialValue);
2073
+ function ci(e, t) {
2074
+ let n = e.parentElement ? Pn.parse(e.parentElement) : void 0;
2075
+ return n && t.has(n) ? t.lookupValue(n) : oi(e.dataset.initialValue);
1920
2076
  }
1921
- function zr() {
2077
+ function li() {
1922
2078
  if (S()) return document.title || null;
1923
- if (me()) {
1924
- let e = Fr.getFilename();
2079
+ if (he()) {
2080
+ let e = ai.getFilename();
1925
2081
  if (e) return e;
1926
2082
  }
1927
2083
  let e = document.querySelector("marimo-filename");
1928
- _e(e, "marimo-filename tag not found");
2084
+ ve(e, "marimo-filename tag not found");
1929
2085
  let t = e.innerHTML;
1930
2086
  return t.length === 0 ? null : t;
1931
2087
  }
1932
2088
  //#endregion
1933
2089
  //#region src/core/saving/file-state.ts
1934
- var K = h(zr());
2090
+ var q = h(li());
1935
2091
  h(null);
1936
- var Br = h(null);
2092
+ var ui = h(null);
1937
2093
  h(void 0);
1938
2094
  //#endregion
1939
2095
  //#region src/utils/storage/typed.ts
1940
- var Vr = class {
2096
+ var di = class {
1941
2097
  defaultValue;
1942
2098
  storage;
1943
- constructor(e, t = Cr) {
2099
+ constructor(e, t = qr) {
1944
2100
  this.defaultValue = e, this.storage = t;
1945
2101
  }
1946
2102
  get(e) {
@@ -1957,11 +2113,11 @@ var Vr = class {
1957
2113
  remove(e) {
1958
2114
  this.storage.removeItem(e);
1959
2115
  }
1960
- }, Hr = class {
2116
+ }, fi = class {
1961
2117
  schema;
1962
2118
  getDefaultValue;
1963
2119
  storage;
1964
- constructor(e, t, n = Cr) {
2120
+ constructor(e, t, n = qr) {
1965
2121
  this.schema = e, this.getDefaultValue = t, this.storage = n;
1966
2122
  }
1967
2123
  get(e) {
@@ -1980,15 +2136,15 @@ var Vr = class {
1980
2136
  remove(e) {
1981
2137
  this.storage.removeItem(e);
1982
2138
  }
1983
- }, Ur = class extends Hr {
2139
+ }, pi = class extends fi {
1984
2140
  filename;
1985
2141
  unsubscribeFromFilename;
1986
2142
  constructor(e, t, n) {
1987
- let r = w.get(K);
2143
+ let r = C.get(q);
1988
2144
  super(t, n), this.filename = r;
1989
2145
  try {
1990
- this.unsubscribeFromFilename = w.sub(K, () => {
1991
- let t = w.get(K);
2146
+ this.unsubscribeFromFilename = C.sub(q, () => {
2147
+ let t = C.get(q);
1992
2148
  this.handleFilenameChange(e, t);
1993
2149
  });
1994
2150
  } catch {
@@ -2016,7 +2172,7 @@ var Vr = class {
2016
2172
  dispose() {
2017
2173
  this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
2018
2174
  }
2019
- }, q = {
2175
+ }, J = {
2020
2176
  VariableName: "VariableName",
2021
2177
  FunctionDefinition: "FunctionDefinition",
2022
2178
  ClassDefinition: "ClassDefinition",
@@ -2041,30 +2197,30 @@ var Vr = class {
2041
2197
  Comment: "Comment",
2042
2198
  String: "String",
2043
2199
  FormatString: "FormatString"
2044
- }, J = {
2200
+ }, Y = {
2045
2201
  For: "for",
2046
2202
  In: "in",
2047
2203
  As: "as",
2048
2204
  Import: "import"
2049
- }, Wr = /* @__PURE__ */ new Set([
2050
- q.FunctionDefinition,
2051
- q.LambdaExpression,
2052
- q.ArrayComprehensionExpression,
2053
- q.SetComprehensionExpression,
2054
- q.DictionaryComprehensionExpression,
2055
- q.ComprehensionExpression,
2056
- q.ClassDefinition
2205
+ }, mi = /* @__PURE__ */ new Set([
2206
+ J.FunctionDefinition,
2207
+ J.LambdaExpression,
2208
+ J.ArrayComprehensionExpression,
2209
+ J.SetComprehensionExpression,
2210
+ J.DictionaryComprehensionExpression,
2211
+ J.ComprehensionExpression,
2212
+ J.ClassDefinition
2057
2213
  ]);
2058
- q.Comment, q.String, q.FormatString;
2214
+ J.Comment, J.String, J.FormatString;
2059
2215
  //#endregion
2060
2216
  //#region src/core/codemirror/utils.ts
2061
- function Gr(e) {
2217
+ function hi(e) {
2062
2218
  e && e.dispatch({ selection: {
2063
2219
  anchor: e.state.doc.length,
2064
2220
  head: e.state.doc.length
2065
2221
  } });
2066
2222
  }
2067
- function Kr(e) {
2223
+ function gi(e) {
2068
2224
  let t = e.dom.closest(".marimo-cell");
2069
2225
  t && requestAnimationFrame(() => {
2070
2226
  t.scrollIntoView({
@@ -2076,29 +2232,29 @@ function Kr(e) {
2076
2232
  }
2077
2233
  //#endregion
2078
2234
  //#region src/core/codemirror/go-to-definition/commands.ts
2079
- var qr = /* @__PURE__ */ new Set([q.ClassDefinition]);
2080
- function Jr(e, t) {
2235
+ var _i = /* @__PURE__ */ new Set([J.ClassDefinition]);
2236
+ function vi(e, t) {
2081
2237
  requestAnimationFrame(() => {
2082
2238
  e.focus(), e.dispatch({
2083
2239
  selection: {
2084
2240
  anchor: t,
2085
2241
  head: t
2086
2242
  },
2087
- effects: fe.scrollIntoView(t, { y: "center" })
2243
+ effects: pe.scrollIntoView(t, { y: "center" })
2088
2244
  });
2089
- }), Kr(e);
2245
+ }), gi(e);
2090
2246
  }
2091
- function Yr(e, t) {
2092
- let n = ue(e), r = null;
2247
+ function yi(e, t) {
2248
+ let n = de(e), r = null;
2093
2249
  return n.iterate({ enter: (n) => {
2094
2250
  if (r !== null) return !1;
2095
- if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
2096
- if (n.name === q.Comment || n.name === q.String) return !1;
2251
+ if (n.name === J.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
2252
+ if (n.name === J.Comment || n.name === J.String) return !1;
2097
2253
  } }), r;
2098
2254
  }
2099
- function Xr(e, t) {
2255
+ function bi(e, t) {
2100
2256
  let n = [], r = e.resolveInner(t, 0);
2101
- for (; r;) Wr.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
2257
+ for (; r;) mi.has(r.name) && (n.some((e) => e.type === J.FunctionDefinition || e.type === J.LambdaExpression) && r.name === J.ClassDefinition || n.push({
2102
2258
  id: r.from,
2103
2259
  type: r.name
2104
2260
  })), r = r.parent;
@@ -2107,70 +2263,70 @@ function Xr(e, t) {
2107
2263
  type: "global"
2108
2264
  }), n;
2109
2265
  }
2110
- function Y(e, t, n) {
2266
+ function X(e, t, n) {
2111
2267
  e.push({
2112
2268
  scopeId: t,
2113
2269
  from: n
2114
2270
  });
2115
2271
  }
2116
- function Zr(e, t) {
2272
+ function xi(e, t) {
2117
2273
  if (e.firstChild()) do
2118
2274
  t(e.node);
2119
2275
  while (e.nextSibling());
2120
2276
  }
2121
- function Qr(e, t) {
2277
+ function Si(e, t) {
2122
2278
  let { state: n, variableName: r, scopeId: i, declarations: a } = t;
2123
2279
  switch (e.name) {
2124
- case q.VariableName:
2125
- n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
2280
+ case J.VariableName:
2281
+ n.doc.sliceString(e.from, e.to) === r && X(a, i, e.from);
2126
2282
  break;
2127
- case q.TupleExpression:
2128
- case q.ArrayExpression: {
2283
+ case J.TupleExpression:
2284
+ case J.ArrayExpression: {
2129
2285
  let n = e.node.cursor();
2130
2286
  n.firstChild();
2131
2287
  do
2132
- Qr(n, t);
2288
+ Si(n, t);
2133
2289
  while (n.nextSibling());
2134
2290
  break;
2135
2291
  }
2136
2292
  }
2137
2293
  }
2138
- function $r(e, t) {
2294
+ function Ci(e, t) {
2139
2295
  let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
2140
2296
  o.firstChild();
2141
2297
  do {
2142
- if (o.name !== q.ParamList) continue;
2298
+ if (o.name !== J.ParamList) continue;
2143
2299
  let e = o.node.cursor();
2144
2300
  e.firstChild();
2145
2301
  do
2146
- e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
2302
+ e.name === J.VariableName && n.doc.sliceString(e.from, e.to) === r && X(a, i, e.from);
2147
2303
  while (e.nextSibling());
2148
2304
  } while (o.nextSibling());
2149
2305
  }
2150
- function ei(e, t) {
2306
+ function wi(e, t) {
2151
2307
  let n = e.cursor();
2152
2308
  n.firstChild();
2153
2309
  let r = !1;
2154
2310
  do
2155
- if (n.name === J.For) r = !0;
2156
- else if (r && n.name === J.In) break;
2157
- else r && Qr(n, t);
2311
+ if (n.name === Y.For) r = !0;
2312
+ else if (r && n.name === Y.In) break;
2313
+ else r && Si(n, t);
2158
2314
  while (n.nextSibling());
2159
2315
  }
2160
- function ti(e, t) {
2161
- let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Wr.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
2316
+ function Ti(e, t) {
2317
+ let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = mi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
2162
2318
  switch (s) {
2163
- case q.FunctionDefinition:
2164
- case q.ClassDefinition: {
2319
+ case J.FunctionDefinition:
2320
+ case J.ClassDefinition: {
2165
2321
  let t = e.cursor();
2166
2322
  t.firstChild();
2167
2323
  do
2168
- if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
2169
- Y(a, i[i.length - 1] ?? -1, t.from);
2324
+ if (t.name === J.VariableName && n.doc.sliceString(t.from, t.to) === r) {
2325
+ X(a, i[i.length - 1] ?? -1, t.from);
2170
2326
  break;
2171
2327
  }
2172
2328
  while (t.nextSibling());
2173
- s === q.FunctionDefinition && $r(e, {
2329
+ s === J.FunctionDefinition && Ci(e, {
2174
2330
  state: n,
2175
2331
  variableName: r,
2176
2332
  scopeId: c,
@@ -2178,38 +2334,38 @@ function ti(e, t) {
2178
2334
  });
2179
2335
  break;
2180
2336
  }
2181
- case q.LambdaExpression:
2182
- $r(e, {
2337
+ case J.LambdaExpression:
2338
+ Ci(e, {
2183
2339
  state: n,
2184
2340
  variableName: r,
2185
2341
  scopeId: c,
2186
2342
  declarations: a
2187
2343
  });
2188
2344
  break;
2189
- case q.ArrayComprehensionExpression:
2190
- case q.DictionaryComprehensionExpression:
2191
- case q.SetComprehensionExpression:
2192
- case q.ComprehensionExpression:
2193
- case q.ForStatement:
2194
- ei(e, {
2345
+ case J.ArrayComprehensionExpression:
2346
+ case J.DictionaryComprehensionExpression:
2347
+ case J.SetComprehensionExpression:
2348
+ case J.ComprehensionExpression:
2349
+ case J.ForStatement:
2350
+ wi(e, {
2195
2351
  state: n,
2196
2352
  variableName: r,
2197
2353
  scopeId: u,
2198
2354
  declarations: a
2199
2355
  });
2200
2356
  break;
2201
- case q.AssignStatement: {
2357
+ case J.AssignStatement: {
2202
2358
  let t = [], i = e.cursor();
2203
2359
  i.firstChild();
2204
2360
  do
2205
- i.name === q.AssignOp && t.push(i.from);
2361
+ i.name === J.AssignOp && t.push(i.from);
2206
2362
  while (i.nextSibling());
2207
2363
  let o = t[t.length - 1];
2208
2364
  if (o === void 0) break;
2209
2365
  let s = e.cursor();
2210
2366
  s.firstChild();
2211
2367
  do
2212
- s.from < o && Qr(s, {
2368
+ s.from < o && Si(s, {
2213
2369
  state: n,
2214
2370
  variableName: r,
2215
2371
  scopeId: u,
@@ -2218,14 +2374,14 @@ function ti(e, t) {
2218
2374
  while (s.nextSibling());
2219
2375
  break;
2220
2376
  }
2221
- case q.ImportStatement: {
2377
+ case J.ImportStatement: {
2222
2378
  let t = e.cursor();
2223
2379
  t.firstChild();
2224
2380
  let i = !1, o = null, s = () => {
2225
- o?.matches && Y(a, u, o.from), o = null;
2381
+ o?.matches && X(a, u, o.from), o = null;
2226
2382
  };
2227
2383
  do
2228
- t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
2384
+ t.name === Y.Import ? i = !0 : i && (t.name === Y.As ? o = null : t.name === J.VariableName ? (s(), o = {
2229
2385
  from: t.from,
2230
2386
  matches: n.doc.sliceString(t.from, t.to) === r
2231
2387
  }) : t.name === "," && s());
@@ -2233,19 +2389,19 @@ function ti(e, t) {
2233
2389
  s();
2234
2390
  break;
2235
2391
  }
2236
- case q.TryStatement:
2237
- case q.WithStatement: {
2392
+ case J.TryStatement:
2393
+ case J.WithStatement: {
2238
2394
  let t = e.cursor();
2239
2395
  t.firstChild();
2240
2396
  let i = !1;
2241
2397
  do
2242
- t.name === J.As ? i = !0 : i && t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r && (Y(a, u, t.from), i = !1);
2398
+ t.name === Y.As ? i = !0 : i && t.name === J.VariableName && n.doc.sliceString(t.from, t.to) === r && (X(a, u, t.from), i = !1);
2243
2399
  while (t.nextSibling());
2244
2400
  break;
2245
2401
  }
2246
2402
  }
2247
- Zr(o, (e) => {
2248
- ti(e, {
2403
+ xi(o, (e) => {
2404
+ Ti(e, {
2249
2405
  state: n,
2250
2406
  variableName: r,
2251
2407
  scopeStack: l,
@@ -2253,86 +2409,86 @@ function ti(e, t) {
2253
2409
  });
2254
2410
  });
2255
2411
  }
2256
- function ni(e, t, n) {
2257
- let r = ue(e), i = [];
2258
- ti(r, {
2412
+ function Ei(e, t, n) {
2413
+ let r = de(e), i = [];
2414
+ Ti(r, {
2259
2415
  state: e,
2260
2416
  variableName: t,
2261
2417
  scopeStack: [],
2262
2418
  declarations: i
2263
2419
  });
2264
2420
  let a = Math.max(0, Math.min(n, e.doc.length));
2265
- for (let e of Xr(r, a)) {
2266
- let t = i.filter((t) => t.scopeId === e.id).filter((t) => !qr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
2421
+ for (let e of bi(r, a)) {
2422
+ let t = i.filter((t) => t.scopeId === e.id).filter((t) => !_i.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
2267
2423
  if (t) return t.from;
2268
2424
  }
2269
2425
  return null;
2270
2426
  }
2271
- function ri(e, t, n) {
2272
- let { state: r } = e, i = n === void 0 ? Yr(r, t) : ni(r, t, n);
2273
- return i !== null && (Jr(e, i), !0);
2427
+ function Di(e, t, n) {
2428
+ let { state: r } = e, i = n === void 0 ? yi(r, t) : Ei(r, t, n);
2429
+ return i !== null && (vi(e, i), !0);
2274
2430
  }
2275
- function ii(e, t) {
2276
- return Jr(e, e.state.doc.line(t).from), !0;
2431
+ function Oi(e, t) {
2432
+ return vi(e, e.state.doc.line(t).from), !0;
2277
2433
  }
2278
2434
  //#endregion
2279
2435
  //#region src/core/network/connection.ts
2280
- var X = h({ state: A.NOT_STARTED });
2436
+ var Z = h({ state: k.NOT_STARTED });
2281
2437
  m(null, (e, t) => t === null ? null : {
2282
2438
  phase: t.phase,
2283
2439
  logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
2284
2440
  });
2285
- function ai() {
2286
- return b(X, (e) => e.state === A.OPEN);
2441
+ function ki() {
2442
+ return b(Z, (e) => e.state === k.OPEN);
2287
2443
  }
2288
- function oi() {
2289
- return he() ? ai() : Promise.resolve();
2444
+ function Ai() {
2445
+ return ge() ? ki() : Promise.resolve();
2290
2446
  }
2291
- h((e) => e(X).state === A.CONNECTING), h((e) => e(X).state === A.OPEN), h((e) => {
2292
- let t = e(X);
2293
- return t.state === A.OPEN || t.state === A.NOT_STARTED;
2294
- }), h((e) => e(X).state === A.CLOSED);
2447
+ h((e) => e(Z).state === k.CONNECTING), h((e) => e(Z).state === k.OPEN), h((e) => {
2448
+ let t = e(Z);
2449
+ return t.state === k.OPEN || t.state === k.NOT_STARTED;
2450
+ }), h((e) => e(Z).state === k.CLOSED);
2295
2451
  //#endregion
2296
2452
  //#region src/components/ui/checkbox.tsx
2297
- var si = E.forwardRef((e, t) => {
2298
- let r = (0, St.c)(13), i, a;
2453
+ var ji = T.forwardRef((e, t) => {
2454
+ let r = (0, $t.c)(13), i, a;
2299
2455
  r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
2300
2456
  let o;
2301
2457
  r[3] === i ? o = r[4] : (o = n("flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", i), r[3] = i, r[4] = o);
2302
2458
  let s;
2303
2459
  r[5] === Symbol.for("react.memo_cache_sentinel") ? (s = n("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), r[5] = s) : s = r[5];
2304
2460
  let c;
2305
- r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, D.jsx)(Ne, {
2461
+ r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, E.jsx)(Pe, {
2306
2462
  className: s,
2307
- children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, D.jsx)(xe, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, D.jsx)(l, { className: "h-4 w-4" })
2463
+ children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, E.jsx)(Se, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, E.jsx)(l, { className: "h-4 w-4" })
2308
2464
  }), r[6] = a.checked, r[7] = c);
2309
2465
  let u;
2310
- return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, D.jsx)(je, {
2466
+ return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, E.jsx)(Me, {
2311
2467
  ref: t,
2312
2468
  className: o,
2313
2469
  ...a,
2314
2470
  children: c
2315
2471
  }), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
2316
2472
  });
2317
- si.displayName = je.displayName;
2473
+ ji.displayName = Me.displayName;
2318
2474
  //#endregion
2319
2475
  //#region src/core/cells/scrollCellIntoView.ts
2320
- function ci({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
2476
+ function Mi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
2321
2477
  if (!n) return;
2322
- let o = document.getElementById(L.create(e));
2478
+ let o = document.getElementById(V.create(e));
2323
2479
  if (!o) t.warn("scrollCellIntoView: element not found");
2324
- else if (rr()) ir(o);
2480
+ else if (Dr()) Or(o);
2325
2481
  else {
2326
- if (r) ir(o);
2482
+ if (r) Or(o);
2327
2483
  else {
2328
- Bt.promote(e);
2484
+ sn.promote(e);
2329
2485
  let r = n.current?.editorView;
2330
2486
  if (!r) {
2331
2487
  t.warn("scrollCellIntoView: editor not found", e);
2332
2488
  return;
2333
2489
  }
2334
2490
  if (r.hasFocus || !document.hasFocus()) return;
2335
- if (ar(() => (r.focus(), r.hasFocus), {
2491
+ if (kr(() => (r.focus(), r.hasFocus), {
2336
2492
  retries: 5,
2337
2493
  delay: 20
2338
2494
  }), i === "top") r.dispatch({ selection: {
@@ -2345,7 +2501,7 @@ function ci({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
2345
2501
  anchor: e.from,
2346
2502
  head: e.from
2347
2503
  } });
2348
- } else a && ri(r, a);
2504
+ } else a && Di(r, a);
2349
2505
  }
2350
2506
  o.scrollIntoView({
2351
2507
  behavior: "smooth",
@@ -2353,21 +2509,21 @@ function ci({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
2353
2509
  });
2354
2510
  }
2355
2511
  }
2356
- function li() {
2512
+ function Ni() {
2357
2513
  let e = document.getElementById("App");
2358
2514
  e?.scrollTo({
2359
2515
  top: e.scrollHeight,
2360
2516
  behavior: "smooth"
2361
2517
  });
2362
2518
  }
2363
- function ui() {
2519
+ function Pi() {
2364
2520
  document.getElementById("App")?.scrollTo({
2365
2521
  top: 0,
2366
2522
  behavior: "smooth"
2367
2523
  });
2368
2524
  }
2369
- function di(e) {
2370
- let t = document.getElementById(L.create(e));
2525
+ function Fi(e) {
2526
+ let t = document.getElementById(V.create(e));
2371
2527
  return t?.scrollIntoView({
2372
2528
  behavior: "smooth",
2373
2529
  block: "center"
@@ -2375,7 +2531,7 @@ function di(e) {
2375
2531
  }
2376
2532
  //#endregion
2377
2533
  //#region src/core/cells/cells.ts
2378
- function fi(e) {
2534
+ function Ii(e) {
2379
2535
  let t = {
2380
2536
  column: 0,
2381
2537
  hide_code: !1,
@@ -2385,24 +2541,24 @@ function fi(e) {
2385
2541
  return {
2386
2542
  ...e,
2387
2543
  cellData: {
2388
- [I]: Nn({
2389
- id: I,
2544
+ [B]: tr({
2545
+ id: B,
2390
2546
  config: t
2391
2547
  }),
2392
2548
  ...e.cellData
2393
2549
  },
2394
2550
  cellRuntime: {
2395
- [I]: V(),
2551
+ [B]: rr(),
2396
2552
  ...e.cellRuntime
2397
2553
  },
2398
2554
  cellHandles: {
2399
- [I]: (0, E.createRef)(),
2555
+ [B]: (0, T.createRef)(),
2400
2556
  ...e.cellHandles
2401
2557
  }
2402
2558
  };
2403
2559
  }
2404
- function pi() {
2405
- return fi({
2560
+ function Li() {
2561
+ return Ii({
2406
2562
  cellIds: [],
2407
2563
  cellData: {},
2408
2564
  cellRuntime: {},
@@ -2412,8 +2568,8 @@ function pi() {
2412
2568
  cellLogs: []
2413
2569
  });
2414
2570
  }
2415
- var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
2416
- prepareForRun: (e, t) => Q({
2571
+ var { reducer: Ri, createActions: zi, useActions: Bi, valueAtom: Q } = ue(Li, {
2572
+ prepareForRun: (e, t) => Hi({
2417
2573
  state: e,
2418
2574
  cellId: t.cellId,
2419
2575
  cellReducer: (e) => ({
@@ -2422,14 +2578,14 @@ var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
2422
2578
  })
2423
2579
  }),
2424
2580
  handleCellMessage: (e, t) => {
2425
- let n = t.cell_id, r = Q({
2581
+ let n = t.cell_id, r = Hi({
2426
2582
  state: e,
2427
2583
  cellId: n,
2428
- cellReducer: (e) => $t(e, t)
2584
+ cellReducer: (e) => xn(e, t)
2429
2585
  });
2430
2586
  return {
2431
2587
  ...r,
2432
- cellLogs: [...r.cellLogs, ...$n(t)]
2588
+ cellLogs: [...r.cellLogs, ...Cr(t)]
2433
2589
  };
2434
2590
  },
2435
2591
  addLogs: (e, t) => ({
@@ -2437,13 +2593,13 @@ var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
2437
2593
  cellLogs: [...e.cellLogs, ...t.logs]
2438
2594
  }),
2439
2595
  reconcileDocument: (e, t) => {
2440
- let n = In(e, t);
2441
- for (let t of e.cellIds) t in n.cellData || ji(t);
2596
+ let n = ar(e, t);
2597
+ for (let t of e.cellIds) t in n.cellData || na(t);
2442
2598
  return n;
2443
2599
  },
2444
2600
  setStdinResponse: (e, n) => {
2445
2601
  let { cellId: r, response: i, outputIndex: a } = n;
2446
- return Q({
2602
+ return Hi({
2447
2603
  state: e,
2448
2604
  cellId: r,
2449
2605
  cellReducer: (e) => {
@@ -2464,10 +2620,10 @@ var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
2464
2620
  });
2465
2621
  },
2466
2622
  resetCellRuntimes: (e) => {
2467
- let t = me(), n = { ...e.cellRuntime };
2468
- for (let r of [...e.cellIds, I]) {
2623
+ let t = he(), n = { ...e.cellRuntime };
2624
+ for (let r of [...e.cellIds, B]) {
2469
2625
  let i = e.cellRuntime[r];
2470
- n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : V();
2626
+ n[r] = t && i !== void 0 && i.consoleOutputs.length > 0 ? i : rr();
2471
2627
  }
2472
2628
  return {
2473
2629
  ...e,
@@ -2478,10 +2634,10 @@ var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
2478
2634
  let t = e.scrollKey;
2479
2635
  if (t === null) return e;
2480
2636
  let n = t;
2481
- return ci({
2637
+ return Mi({
2482
2638
  cellId: n,
2483
2639
  cell: e.cellHandles[n],
2484
- isCodeHidden: zn(e.cellData[n]?.config.hide_code, w.get(H), n),
2640
+ isCodeHidden: cr(e.cellData[n]?.config.hide_code, C.get(W), n),
2485
2641
  codeFocus: void 0,
2486
2642
  variableName: void 0
2487
2643
  }), {
@@ -2489,49 +2645,30 @@ var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
2489
2645
  scrollKey: null
2490
2646
  };
2491
2647
  },
2492
- foldAll: (e) => (Ft(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2493
- unfoldAll: (e) => (It(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2648
+ foldAll: (e) => (tn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2649
+ unfoldAll: (e) => (nn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2494
2650
  clearLogs: (e) => ({
2495
2651
  ...e,
2496
2652
  cellLogs: []
2497
2653
  }),
2498
- clearCellOutput: (e, t) => {
2499
- let { cellId: n } = t;
2500
- return Q({
2501
- state: e,
2502
- cellId: n,
2503
- cellReducer: (e) => ({
2504
- ...e,
2505
- output: null,
2506
- consoleOutputs: []
2507
- })
2508
- });
2509
- },
2510
- clearCellConsoleOutput: (e, t) => {
2511
- let { cellId: n } = t;
2512
- return Q({
2513
- state: e,
2514
- cellId: n,
2515
- cellReducer: (e) => ({
2516
- ...e,
2517
- consoleOutputs: e.consoleOutputs.filter((e) => e.channel === "stdin" && e.response == null)
2518
- })
2519
- });
2520
- },
2521
- clearAllCellOutputs: (e) => {
2522
- let t = { ...e.cellRuntime };
2523
- for (let n of e.cellIds) t[n] = {
2524
- ...t[n],
2525
- output: null,
2526
- consoleOutputs: []
2527
- };
2528
- return {
2529
- ...e,
2530
- cellRuntime: t
2654
+ clearCellConsoleOutput: (e, t) => Vi(e, [t.cellId]),
2655
+ clearCellConsoleOutputs: (e, t) => Vi(e, t.cellIds)
2656
+ });
2657
+ function Vi(e, n) {
2658
+ let r = { ...e.cellRuntime };
2659
+ for (let e of n) {
2660
+ let n = r[e];
2661
+ n === void 0 ? t.warn(`Cell ${e} not found in state`) : r[e] = {
2662
+ ...n,
2663
+ consoleOutputs: n.consoleOutputs.filter((e) => e.channel === "stdin" && e.response == null)
2531
2664
  };
2532
2665
  }
2533
- });
2534
- function Q({ state: e, cellId: n, cellReducer: r }) {
2666
+ return {
2667
+ ...e,
2668
+ cellRuntime: r
2669
+ };
2670
+ }
2671
+ function Hi({ state: e, cellId: n, cellReducer: r }) {
2535
2672
  return n in e.cellRuntime ? {
2536
2673
  ...e,
2537
2674
  cellRuntime: {
@@ -2540,112 +2677,110 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
2540
2677
  }
2541
2678
  } : (t.warn(`Cell ${n} not found in state`), e);
2542
2679
  }
2543
- var _i = hi((e) => {
2544
- w.set(Z, (t) => mi(t, e));
2545
- }).addLogs, $ = h((e) => e(Z).cellIds);
2546
- h((e) => e($).length === 1), h((e) => cr(e(Z)).length > 0), h((e) => lr(e(Z)).length > 0), h((e) => ur(e(Z))), h((e) => dr(e(Z))), h((e) => or(e(Z), e(M), e(ft)));
2547
- var vi = h((e) => {
2548
- let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
2549
- return t.map((e) => {
2550
- let t = n[e], { name: i } = r[e];
2551
- if (P(t.output?.mimetype)) {
2552
- T(Array.isArray(t.output.data), "Expected array data");
2553
- let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
2554
- if (n.length > 0) return {
2680
+ var Ui = zi((e) => {
2681
+ C.set(Q, (t) => Ri(t, e));
2682
+ }).addLogs, $ = h((e) => e(Q).cellIds);
2683
+ h((e) => e($).length === 1), h((e) => Mr(e(Q)).length > 0), h((e) => Nr(e(Q)).length > 0), h((e) => Pr(e(Q))), h((e) => Fr(e(Q))), h((e) => Ar(e(Q), e(F), e(Rt)));
2684
+ var Wi = h((e) => {
2685
+ let { cellIds: t, cellData: n } = e(Q);
2686
+ return t.map((t) => {
2687
+ let r = e(I(t)), { name: i } = n[t];
2688
+ if (r !== null && R(r.mimetype)) {
2689
+ w(Array.isArray(r.data), "Expected array data");
2690
+ let e = r.data.filter((e) => !e.type.includes("ancestor"));
2691
+ if (e.length > 0) return {
2555
2692
  output: {
2556
- ...t.output,
2557
- data: n
2693
+ ...r,
2694
+ data: e
2558
2695
  },
2559
- cellId: e,
2696
+ cellId: t,
2560
2697
  cellName: i
2561
2698
  };
2562
2699
  }
2563
2700
  return null;
2564
2701
  }).filter(Boolean);
2565
- }), yi = y(h((e) => {
2702
+ }), Gi = y(h((e) => {
2566
2703
  let t = {};
2567
- for (let [n, r] of se.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
2704
+ for (let n of e($)) {
2705
+ let r = e(L(n));
2706
+ r !== null && r.items.length > 0 && (t[n] = r);
2707
+ }
2568
2708
  return t;
2569
- })), bi = h((e) => {
2570
- let t = e($), n = e(Di);
2571
- return At(t.map((e) => n[e].outline));
2572
- });
2573
- h((e) => e(vi).length);
2574
- var xi = y(h((e) => {
2575
- let { cellIds: t, cellData: n } = e(Z);
2576
- return se.fromEntries(t.map((e) => [e, n[e]?.name]));
2709
+ })), Ki = h((e) => Ke(e($).map((t) => e(L(t)))));
2710
+ h((e) => e(Wi).length);
2711
+ var qi = y(h((e) => {
2712
+ let { cellIds: t, cellData: n } = e(Q);
2713
+ return ce.fromEntries(t.map((e) => [e, n[e]?.name]));
2577
2714
  }));
2578
- h((e) => e(Z).scrollKey);
2579
- var Si = () => g($), Ci = () => g(xi), wi = () => w.get(Z), Ti = () => w.get(Z).cellIds, Ei = () => {
2580
- let { cellIds: e, cellData: t } = w.get(Z);
2715
+ h((e) => e(Q).scrollKey);
2716
+ var Ji = () => g($), Yi = () => g(qi), Xi = () => C.get(Q), Zi = () => C.get(Q).cellIds, Qi = () => {
2717
+ let { cellIds: e, cellData: t } = C.get(Q);
2581
2718
  return e.map((e) => t[e]?.name).filter(Boolean);
2582
2719
  };
2583
- p(ne(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
2584
- var Di = h((e) => e(Z).cellRuntime);
2585
- h((e) => e(Z).cellIds.length > 0);
2586
- var Oi = v((e) => h((t) => t(Z).cellData[e])), ki = v((e) => h((t) => t(Z).cellRuntime[e])), Ai = v((e) => h((t) => t(Z).cellHandles[e]));
2587
- function ji(e) {
2588
- Oi.remove(e), ki.remove(e), Ai.remove(e);
2589
- }
2590
- var Mi = (e) => {
2591
- let { cellHandles: t } = w.get(Z);
2720
+ p(ne(Q, (e) => e.cellIds.map((t) => e.cellData[t]))), h((e) => e(Q).cellIds.length > 0);
2721
+ var $i = v((e) => h((t) => t(Q).cellData[e])), ea = v((e) => h((t) => t(Q).cellRuntime[e])), ta = v((e) => h((t) => t(Q).cellHandles[e]));
2722
+ function na(e) {
2723
+ $i.remove(e), ea.remove(e), ta.remove(e), Ut(e);
2724
+ }
2725
+ var ra = (e) => {
2726
+ let { cellHandles: t } = C.get(Q);
2592
2727
  return t[e].current?.editorView;
2593
- }, Ni = (e) => (Bt.promote(e), Mi(e));
2594
- function Pi() {
2595
- return gi();
2728
+ }, ia = (e) => (sn.promote(e), ra(e));
2729
+ function aa() {
2730
+ return Bi();
2596
2731
  }
2597
2732
  //#endregion
2598
2733
  //#region src/core/errors/error-entries.ts
2599
- function Fi(e) {
2600
- if (Vt(e.mimetype)) {
2734
+ function oa(e) {
2735
+ if (cn(e.mimetype)) {
2601
2736
  if (!Array.isArray(e.data)) return null;
2602
2737
  let t = e.data.filter((e) => !e.type.includes("ancestor"));
2603
2738
  return t.length === 0 ? null : { errorData: t };
2604
2739
  }
2605
- return N(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
2740
+ return ln(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
2606
2741
  errorData: [],
2607
2742
  tracebackHtml: e.data
2608
2743
  } : null;
2609
2744
  }
2610
- function Ii(e) {
2745
+ function sa(e) {
2611
2746
  return e.some((e) => "traceback" in e && e.traceback);
2612
2747
  }
2613
- function Li(e) {
2614
- let t = e?.find((e) => N(e.mimetype));
2748
+ function ca(e) {
2749
+ let t = e?.find((e) => ln(e.mimetype));
2615
2750
  if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
2616
2751
  }
2617
- function Ri(e, t) {
2752
+ function la(e, t) {
2618
2753
  if (e.tracebackHtml) return e.tracebackHtml;
2619
- if (!Ii(e.errorData)) return Li(t);
2620
- }
2621
- function zi(e) {
2622
- let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
2623
- for (let [e, a] of t.entries()) {
2624
- let t = n[a], o = t.output;
2625
- if (!o || !P(o.mimetype)) continue;
2626
- let s = Fi(o);
2754
+ if (!sa(e.errorData)) return ca(t);
2755
+ }
2756
+ function ua(e) {
2757
+ let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Q), i = [];
2758
+ for (let [a, o] of t.entries()) {
2759
+ let t = e.get(I(o));
2760
+ if (t === null || !R(t.mimetype)) continue;
2761
+ let s = oa(t);
2627
2762
  if (!s) continue;
2628
- let c = jn(r[a].name, e), l = o.code ?? r[a].code;
2763
+ let c = $n(r[o].name, a), l = t.code ?? r[o].code;
2629
2764
  i.push({
2630
- cellId: a,
2765
+ cellId: o,
2631
2766
  cellName: c,
2632
2767
  cellCode: l,
2633
2768
  errorData: s.errorData,
2634
- tracebackHtml: Ri(s, t.consoleOutputs)
2769
+ tracebackHtml: la(s, n[o].consoleOutputs)
2635
2770
  });
2636
2771
  }
2637
2772
  return i;
2638
2773
  }
2639
- function Bi(e) {
2640
- return e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
2774
+ function da(e) {
2775
+ return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
2641
2776
  }
2642
- function Vi(e) {
2643
- let t = Bi(e);
2644
- return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
2777
+ function fa(e) {
2778
+ let t = da(e);
2779
+ return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${K(e.traceback)}`), t;
2645
2780
  }
2646
- function Hi(e) {
2781
+ function pa(e) {
2647
2782
  let t = [e.cellName];
2648
- return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Vi).join("\n\n")), t.join("\n\n");
2783
+ return e.tracebackHtml && t.push(K(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(fa).join("\n\n")), t.join("\n\n");
2649
2784
  }
2650
2785
  //#endregion
2651
- export { G as $, ii as A, on as At, Ar as B, lt as Bt, li as C, mn as Ct, X as D, pn as Dt, si as E, un as Et, K as F, kt as Ft, vr as G, vt as Gt, Or as H, _t as Ht, Br as I, wt as It, sr as J, A as Jt, yr as K, Je as Kt, Ir as L, yt as Lt, Ur as M, en as Mt, Vr as N, tn as Nt, ai as O, fn as Ot, Hr as P, Mt as Pt, Yn as Q, Lr as R, M as Rt, ci as S, dn as St, ui as T, I as Tt, Cr as U, mt as Ut, jr as V, xt as Vt, br as W, gt as Wt, _r as X, be as Xt, gr as Y, xe as Yt, nr as Z, mi as _, En as _t, _i as a, Ln as at, Ci as b, Sn as bt, hi as c, Mn as ct, Ei as d, R as dt, Hn as et, Ti as f, wn as ft, bi as g, Dn as gt, Z as h, Tn as ht, zi as i, Rn as it, Gr as j, nn as jt, oi as k, an as kt, Ni as l, kn as lt, pi as m, Cn as mt, Hi as n, Bn as nt, Oi as o, jn as ot, wi as p, z as pt, mr as q, Re as qt, Vi as r, H as rt, $ as s, An as st, Bi as t, zn as tt, Mi as u, hn as ut, ji as v, B as vt, di as w, L as wt, Pi as x, xn as xt, Si as y, gn as yt, Rr as z, ft as zt };
2786
+ export { K as $, Se as $t, Oi as A, Dn as At, ei as B, Wt as Bt, Ni as C, Fn as Ct, Z as D, Pn as Dt, ji as E, jn as Et, q as F, F as Ft, Hr as G, qt as Gt, Qr as H, Qt as Ht, ui as I, Rt as It, jr as J, Xe as Jt, Ur as K, Yt as Kt, oi as L, L as Lt, pi as M, Sn as Mt, di as N, Cn as Nt, ki as O, Nn as Ot, fi as P, Xt as Pt, yr as Q, Be as Qt, si as R, I as Rt, Mi as S, Mn as St, Pi as T, B as Tt, qr as U, Jt as Ut, ti as V, Ft as Vt, Wr as W, Gt as Wt, Vr as X, Je as Xt, Br as Y, k as Yt, Er as Z, Ge as Zt, Ri as _, Jn as _t, Ui as a, or as at, Yi as b, Wn as bt, zi as c, er as ct, Qi as d, H as dt, xe as en, fr as et, Zi as f, Kn as ft, Ki as g, Yn as gt, Q as h, qn as ht, ua as i, sr as it, hi as j, wn as jt, Ai as k, En as kt, ia as l, Zn as lt, Li as m, Gn as mt, pa as n, lr as nt, $i as o, $n as ot, Xi as p, U as pt, Rr as q, St as qt, fa as r, W as rt, $ as s, Qn as st, da as t, cr as tt, ra as u, In as ut, na as v, Hn as vt, Fi as w, V as wt, aa as x, Un as xt, Ji as y, Ln as yt, ci as z, Vt as zt };