@marimo-team/islands 0.25.3-dev275 → 0.25.3-dev279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ErrorBoundary-BuIXiuc5.js → ErrorBoundary-DmTMuDPR.js} +1 -1
- package/dist/{chat-ui-SZ6lSH52.js → chat-ui-v1Fdh0NA.js} +270 -270
- package/dist/{code-visibility-BEAPMrC-.js → code-visibility-Dw4-TXN0.js} +2 -2
- package/dist/{common-CEmzaoJ8.js → common-BXMFi4lr.js} +4947 -4943
- package/dist/{data-grid-overlay-editor-CUo25_W8.js → data-grid-overlay-editor-hZzwX7Ia.js} +1 -1
- package/dist/{error-entries-B-1yUdcH.js → error-entries-C1S-Rmyt.js} +545 -535
- package/dist/{feedback-button-BqiR7zMO.js → feedback-button-6Ui2TDLR.js} +5 -5
- package/dist/{glide-data-editor-B7dguvqk.js → glide-data-editor-PZNlrSDI.js} +3 -3
- package/dist/{globals-CYykXfGI.js → globals-DX6FPZYq.js} +1 -1
- package/dist/{html-to-image-DC_pmZLs.js → html-to-image-CqGUd58T.js} +14452 -14452
- package/dist/main.js +6031 -6036
- package/dist/{number-overlay-editor-C4u7SJAJ.js → number-overlay-editor-D0CsL3_R.js} +1 -1
- package/dist/{process-output-DYu84VfZ.js → process-output-DskX9jLa.js} +2 -2
- package/dist/{reveal-component-DGi-irHV.js → reveal-component-D7xeI1QR.js} +906 -906
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +4 -2
- package/src/__mocks__/notebook.ts +0 -2
- package/src/__tests__/CellStatus.test.tsx +6 -6
- package/src/components/editor/__tests__/data-attributes.test.tsx +0 -2
- package/src/components/editor/__tests__/output-persistence.test.tsx +20 -5
- package/src/components/editor/cell/CellStatus.tsx +6 -5
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +169 -0
- package/src/components/editor/cell/collapse.tsx +3 -4
- package/src/components/editor/cell/useRunCells.ts +32 -3
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +2 -3
- package/src/components/editor/notebook-cell.tsx +23 -37
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +4 -10
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -2
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +8 -5
- package/src/components/slides/minimap.tsx +3 -2
- package/src/components/slides/reveal-component.tsx +3 -2
- package/src/components/slides/slide-cell-view.tsx +8 -8
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -101
- package/src/core/cells/__tests__/actions.test.ts +0 -1
- package/src/core/cells/__tests__/cell.test.ts +81 -17
- package/src/core/cells/__tests__/cells.test.ts +0 -100
- package/src/core/cells/__tests__/document.test.ts +2 -8
- package/src/core/cells/__tests__/utils.test.ts +93 -24
- package/src/core/cells/actions.ts +0 -1
- package/src/core/cells/cell.ts +37 -14
- package/src/core/cells/cells.ts +10 -99
- package/src/core/cells/document.ts +2 -13
- package/src/core/cells/types.ts +0 -23
- package/src/core/cells/utils.ts +44 -17
- package/src/core/codemirror/cells/extensions.ts +0 -14
- package/src/core/errors/__tests__/error-entries.test.ts +40 -1
- package/src/core/errors/error-entries.ts +2 -3
- package/src/core/executions/__tests__/freshness.test.ts +420 -0
- package/src/core/executions/__tests__/hooks.test.tsx +106 -0
- package/src/core/executions/atoms.ts +22 -0
- package/src/core/executions/freshness.ts +164 -0
- package/src/core/executions/hooks.ts +17 -1
- package/src/core/executions/index.ts +3 -1
- package/src/core/islands/bootstrap.ts +0 -1
- package/src/core/kernel/handlers.ts +0 -4
- package/src/core/session/useNotebookSession.tsx +2 -7
- package/src/stories/cell-status.stories.tsx +12 -14
- package/src/stories/cell.stories.tsx +44 -10
- package/src/stories/layout/vertical/one-column.stories.tsx +0 -10
- package/src/components/editor/cell/__tests__/useRunCells.test.ts +0 -45
|
@@ -7,16 +7,16 @@ import { f as s, h as c } from "./tooltip-DMMiOn2f.js";
|
|
|
7
7
|
import { t as l } from "./check-XFzZeH-y.js";
|
|
8
8
|
import { n as u, r as d } from "./assertNever-B-YzWzbL.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-3BD1kT0s.js";
|
|
10
|
-
import { At as p, Ct as m, Dt as h, Et as g, Ft as _, Mt as v, Rt as y, St as b, d as x, dn as S, jt as C, ln as ee, mn as
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { M as
|
|
16
|
-
import { t as
|
|
17
|
-
import { a as
|
|
18
|
-
import { t as
|
|
19
|
-
var
|
|
10
|
+
import { At as p, Ct as m, Dt as h, Et as g, Ft as _, Mt as v, Rt as y, St as b, d as x, dn as S, jt as C, ln as ee, mn as w, pn as te, un as ne, vt as re, xt as ie, yt as T } from "./use-restore-focus-CosX7-gx.js";
|
|
11
|
+
import { n as ae } from "./toast-BhjIy3Tq.js";
|
|
12
|
+
import { t as oe } from "./objects-DCmMvZtn.js";
|
|
13
|
+
import { t as E } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as se } from "./createReducer-DRqwmaTc.js";
|
|
15
|
+
import { M as ce, N as le, V as ue, g as de } from "./dist-CYeqK4Xw.js";
|
|
16
|
+
import { t as D } from "./purify.es-DMv5zIkJ.js";
|
|
17
|
+
import { a as fe, i as pe, l as me, m as he, u as ge } from "./static-state-D-Q-Ajaa.js";
|
|
18
|
+
import { t as _e } from "./capabilities-D9FskwsK.js";
|
|
19
|
+
var ve = c("external-link", [
|
|
20
20
|
["path", {
|
|
21
21
|
d: "M15 3h6v6",
|
|
22
22
|
key: "1q9fwt"
|
|
@@ -29,20 +29,20 @@ var ye = 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
|
-
]),
|
|
32
|
+
]), ye = c("minus", [["path", {
|
|
33
33
|
d: "M5 12h14",
|
|
34
34
|
key: "1ays0h"
|
|
35
|
-
}]]),
|
|
35
|
+
}]]), O = /* @__PURE__ */ e(i(), 1), k = f(), be = Object.defineProperty, A = (e, t) => be(e, "name", {
|
|
36
36
|
value: t,
|
|
37
37
|
configurable: !0
|
|
38
|
-
}),
|
|
39
|
-
function
|
|
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] =
|
|
38
|
+
}), j = "Checkbox", [xe, Se] = te(j), [Ce, M] = xe(j);
|
|
39
|
+
function we(e) {
|
|
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] = ne({
|
|
41
41
|
prop: n,
|
|
42
42
|
defaultProp: i ?? !1,
|
|
43
43
|
onChange: c,
|
|
44
|
-
caller:
|
|
45
|
-
}), [m, h] =
|
|
44
|
+
caller: j
|
|
45
|
+
}), [m, h] = O.useState(null), [g, _] = O.useState(null), [v, y] = O.useState(null), b = !m || !!o || !!m.closest("form"), x = {
|
|
46
46
|
checked: f,
|
|
47
47
|
disabled: a,
|
|
48
48
|
setChecked: p,
|
|
@@ -54,32 +54,32 @@ function De(e) {
|
|
|
54
54
|
userClick: v,
|
|
55
55
|
onUserClick: y,
|
|
56
56
|
required: l,
|
|
57
|
-
defaultChecked: !
|
|
57
|
+
defaultChecked: !N(i) && i,
|
|
58
58
|
isFormControl: b,
|
|
59
59
|
bubbleInput: g,
|
|
60
60
|
setBubbleInput: _
|
|
61
61
|
};
|
|
62
|
-
return /* @__PURE__ */ (0,
|
|
62
|
+
return /* @__PURE__ */ (0, k.jsx)(Ce, {
|
|
63
63
|
scope: t,
|
|
64
64
|
...x,
|
|
65
|
-
children:
|
|
65
|
+
children: Me(d) ? d(x) : r
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } =
|
|
71
|
-
return
|
|
68
|
+
A(we, "CheckboxProvider");
|
|
69
|
+
var Te = "CheckboxTrigger", Ee = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(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 } = M(Te, e), g = r(a, d), _ = O.useRef(l);
|
|
71
|
+
return O.useEffect(() => {
|
|
72
72
|
let e = o?.form;
|
|
73
73
|
if (e) {
|
|
74
|
-
let t = /* @__PURE__ */
|
|
74
|
+
let t = /* @__PURE__ */ A(() => f(_.current), "reset");
|
|
75
75
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
76
76
|
}
|
|
77
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
77
|
+
}, [o, f]), /* @__PURE__ */ (0, k.jsx)(w.button, {
|
|
78
78
|
type: "button",
|
|
79
79
|
role: "checkbox",
|
|
80
|
-
"aria-checked":
|
|
80
|
+
"aria-checked": N(l) ? "mixed" : l,
|
|
81
81
|
"aria-required": u,
|
|
82
|
-
"data-state":
|
|
82
|
+
"data-state": P(l),
|
|
83
83
|
"data-disabled": c ? "" : void 0,
|
|
84
84
|
disabled: c,
|
|
85
85
|
value: s,
|
|
@@ -91,14 +91,14 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(
|
|
|
91
91
|
onClick: S(n, (e) => {
|
|
92
92
|
let t = e.isPropagationStopped();
|
|
93
93
|
p({
|
|
94
|
-
requestedChecked:
|
|
94
|
+
requestedChecked: N(l) ? !0 : !l,
|
|
95
95
|
hasConsumerStoppedPropagation: t
|
|
96
|
-
}), f((e) =>
|
|
96
|
+
}), f((e) => N(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
97
97
|
})
|
|
98
98
|
});
|
|
99
|
-
}, "CheckboxTrigger")),
|
|
99
|
+
}, "CheckboxTrigger")), De = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(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,
|
|
101
|
+
return /* @__PURE__ */ (0, k.jsx)(we, {
|
|
102
102
|
__scopeCheckbox: n,
|
|
103
103
|
checked: i,
|
|
104
104
|
defaultChecked: a,
|
|
@@ -108,18 +108,18 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(
|
|
|
108
108
|
name: r,
|
|
109
109
|
form: u,
|
|
110
110
|
value: c,
|
|
111
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0,
|
|
111
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, k.jsxs)(k.Fragment, { children: [/* @__PURE__ */ (0, k.jsx)(Ee, {
|
|
112
112
|
...d,
|
|
113
113
|
ref: t,
|
|
114
114
|
__scopeCheckbox: n
|
|
115
|
-
}), e && /* @__PURE__ */ (0,
|
|
115
|
+
}), e && /* @__PURE__ */ (0, k.jsx)(je, { __scopeCheckbox: n })] })
|
|
116
116
|
});
|
|
117
|
-
}, "Checkbox")),
|
|
118
|
-
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a =
|
|
119
|
-
return /* @__PURE__ */ (0,
|
|
120
|
-
present: r ||
|
|
121
|
-
children: /* @__PURE__ */ (0,
|
|
122
|
-
"data-state":
|
|
117
|
+
}, "Checkbox")), Oe = "CheckboxIndicator", ke = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function(e, t) {
|
|
118
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = M(Oe, n);
|
|
119
|
+
return /* @__PURE__ */ (0, k.jsx)(ee, {
|
|
120
|
+
present: r || N(a.checked) || a.checked === !0,
|
|
121
|
+
children: /* @__PURE__ */ (0, k.jsx)(w.span, {
|
|
122
|
+
"data-state": P(a.checked),
|
|
123
123
|
"data-disabled": a.disabled ? "" : void 0,
|
|
124
124
|
...i,
|
|
125
125
|
ref: t,
|
|
@@ -129,9 +129,9 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(
|
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
131
|
});
|
|
132
|
-
}, "CheckboxIndicator")),
|
|
133
|
-
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } =
|
|
134
|
-
|
|
132
|
+
}, "CheckboxIndicator")), Ae = "CheckboxBubbleInput", je = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(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 } = M(Ae, e), _ = r(i, g), v = s(a), y = O.useRef(!1), b = O.useRef(c), x = O.useRef(o), C = O.useRef(null);
|
|
134
|
+
O.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 Oe = "CheckboxTrigger", ke = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(
|
|
|
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) C.current = r ? null : o, r && (e.indeterminate =
|
|
142
|
+
if (x.current = o, i) C.current = r ? null : o, r && (e.indeterminate = N(c), n.call(e, !N(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
143
|
else if (r) {
|
|
144
144
|
let t = C.current;
|
|
145
145
|
C.current = null;
|
|
146
146
|
let r = t?.requestedChecked === c;
|
|
147
|
-
y.current = !0, e.indeterminate =
|
|
147
|
+
y.current = !0, e.indeterminate = N(c), n.call(e, !N(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 =
|
|
155
|
-
return /* @__PURE__ */ (0,
|
|
154
|
+
let ee = O.useRef(!N(c) && c);
|
|
155
|
+
return /* @__PURE__ */ (0, k.jsx)(w.input, {
|
|
156
156
|
type: "checkbox",
|
|
157
157
|
"aria-hidden": !0,
|
|
158
158
|
defaultChecked: l ?? ee.current,
|
|
@@ -178,21 +178,72 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(
|
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
}, "CheckboxBubbleInput"));
|
|
181
|
-
function
|
|
181
|
+
function Me(e) {
|
|
182
182
|
return typeof e == "function";
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
function
|
|
184
|
+
A(Me, "isFunction");
|
|
185
|
+
function N(e) {
|
|
186
186
|
return e === "indeterminate";
|
|
187
187
|
}
|
|
188
|
-
|
|
189
|
-
function
|
|
190
|
-
return
|
|
188
|
+
A(N, "isIndeterminate");
|
|
189
|
+
function P(e) {
|
|
190
|
+
return N(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
|
+
}
|
|
192
|
+
A(P, "getState");
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/core/executions/freshness.ts
|
|
195
|
+
var Ne = {
|
|
196
|
+
sourceChanged: !1,
|
|
197
|
+
inputsChanged: !1
|
|
198
|
+
};
|
|
199
|
+
function Pe(e) {
|
|
200
|
+
let t = /* @__PURE__ */ new Map();
|
|
201
|
+
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
202
|
+
let n = t.get(e.name);
|
|
203
|
+
n === void 0 ? t.set(e.name, [e]) : n.push(e);
|
|
204
|
+
}
|
|
205
|
+
return t;
|
|
206
|
+
}
|
|
207
|
+
function Fe(e) {
|
|
208
|
+
let t = Pe(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
209
|
+
function i(e, n) {
|
|
210
|
+
let i = new Set(n).add(e.id);
|
|
211
|
+
for (let [n, a] of Object.entries(e.depends_on)) {
|
|
212
|
+
let s = t.get(n) ?? [];
|
|
213
|
+
if (a === null) {
|
|
214
|
+
if (s.some((t) => r(t.execution_id)?.runtime_id === e.runtime_id)) return !0;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
let c = s.find((e) => e.revision.execution === a.execution);
|
|
218
|
+
if (c === void 0 || c.revision.update !== a.update) return !0;
|
|
219
|
+
let l = r(c.execution_id);
|
|
220
|
+
if (l === void 0 || !i.has(l.id) && o(l, i).inputsChanged) return !0;
|
|
221
|
+
}
|
|
222
|
+
return !1;
|
|
223
|
+
}
|
|
224
|
+
function a(t, n) {
|
|
225
|
+
let i = e.executions.latest.get(t.id);
|
|
226
|
+
if (i === void 0 || i === n.id) return !1;
|
|
227
|
+
let a = r(i);
|
|
228
|
+
return a !== void 0 && a.status !== "completed" && a.code_fingerprint === t.code_fingerprint;
|
|
229
|
+
}
|
|
230
|
+
function o(t, r) {
|
|
231
|
+
let o = n.get(t.id);
|
|
232
|
+
if (o !== void 0) return o;
|
|
233
|
+
let s = t.cell_id === null ? void 0 : e.cells.get(t.cell_id), c = {
|
|
234
|
+
sourceChanged: s === void 0 || s.code_fingerprint !== t.code_fingerprint && !a(s, t),
|
|
235
|
+
inputsChanged: i(t, r)
|
|
236
|
+
};
|
|
237
|
+
return n.set(t.id, c), c;
|
|
238
|
+
}
|
|
239
|
+
return (t) => {
|
|
240
|
+
let n = e.results.get(t);
|
|
241
|
+
return n == null ? Ne : o(n, /* @__PURE__ */ new Set());
|
|
242
|
+
};
|
|
191
243
|
}
|
|
192
|
-
k(Ie, "getState");
|
|
193
244
|
//#endregion
|
|
194
245
|
//#region src/utils/time.ts
|
|
195
|
-
var
|
|
246
|
+
var Ie = class e {
|
|
196
247
|
ms;
|
|
197
248
|
static fromMilliseconds(t) {
|
|
198
249
|
return t == null ? null : new e(t);
|
|
@@ -221,51 +272,51 @@ var Le = class e {
|
|
|
221
272
|
};
|
|
222
273
|
//#endregion
|
|
223
274
|
//#region src/core/executions/select.ts
|
|
224
|
-
function
|
|
275
|
+
function Le(e) {
|
|
225
276
|
let t = e.outcome;
|
|
226
277
|
return t === null ? null : t.kind;
|
|
227
278
|
}
|
|
228
|
-
function
|
|
229
|
-
return e === null ? null :
|
|
279
|
+
function Re(e) {
|
|
280
|
+
return e === null ? null : Ie.parse(e).toMilliseconds();
|
|
230
281
|
}
|
|
231
|
-
function
|
|
282
|
+
function ze(e, t) {
|
|
232
283
|
let n = e.latest.get(t);
|
|
233
284
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
234
285
|
}
|
|
235
|
-
function
|
|
286
|
+
function Be(e, t) {
|
|
236
287
|
return e.executions.latest.get(t) ?? e.results.get(t)?.id ?? null;
|
|
237
288
|
}
|
|
238
|
-
function
|
|
239
|
-
let n =
|
|
240
|
-
n !== null && n.record.status !== "completed" ? (a = n.record.status, o =
|
|
241
|
-
let c = a === "idle", l = c && r !== null && r.started_at !== null && r.completed_at !== null ?
|
|
289
|
+
function Ve(e, t) {
|
|
290
|
+
let n = ze(e.executions, t), r = e.results.get(t) ?? null, i = e.submissions.has(t) && e.submissions.get(t) === Be(e, t), a = "idle", o = r === null ? null : Re(r.started_at), s = !1;
|
|
291
|
+
n !== null && n.record.status !== "completed" ? (a = n.record.status, o = Re(n.record.started_at) ?? o, s = n.record.outcome !== null) : i && (a = "queued");
|
|
292
|
+
let c = a === "idle", l = c && r !== null && r.started_at !== null && r.completed_at !== null ? Ie.parse(r.completed_at).since(Ie.parse(r.started_at)) : null;
|
|
242
293
|
return {
|
|
243
294
|
status: a,
|
|
244
295
|
blocked: e.blocked.has(t),
|
|
245
|
-
outcome: c && r !== null ?
|
|
296
|
+
outcome: c && r !== null ? Le(r) : null,
|
|
246
297
|
startedAt: o,
|
|
247
298
|
duration: l,
|
|
248
299
|
rendered: s
|
|
249
300
|
};
|
|
250
301
|
}
|
|
251
|
-
function
|
|
302
|
+
function He(e) {
|
|
252
303
|
return [...e.executions.values()].filter((e) => e.record.status !== "completed");
|
|
253
304
|
}
|
|
254
|
-
function
|
|
255
|
-
return
|
|
305
|
+
function Ue(e) {
|
|
306
|
+
return He(e).some((e) => e.record.status === "running");
|
|
256
307
|
}
|
|
257
|
-
function
|
|
258
|
-
let t =
|
|
259
|
-
for (let [t, i] of e.submissions) !n.has(t) && i ===
|
|
308
|
+
function We(e) {
|
|
309
|
+
let t = He(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = 0;
|
|
310
|
+
for (let [t, i] of e.submissions) !n.has(t) && i === Be(e, t) && (r += 1);
|
|
260
311
|
return t.length + r;
|
|
261
312
|
}
|
|
262
313
|
//#endregion
|
|
263
314
|
//#region src/core/executions/atoms.ts
|
|
264
|
-
var
|
|
315
|
+
var Ge = {
|
|
265
316
|
runs: /* @__PURE__ */ new Map(),
|
|
266
317
|
executions: /* @__PURE__ */ new Map(),
|
|
267
318
|
latest: /* @__PURE__ */ new Map()
|
|
268
|
-
}, qe = /* @__PURE__ */ new Map(), Je = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Set(), Xe = y(null), Ze = y(null);
|
|
319
|
+
}, Ke = /* @__PURE__ */ new Map(), qe = /* @__PURE__ */ new Map(), Je = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Set(), Xe = y(null), Ze = y(null);
|
|
269
320
|
function Qe(e, t, n, r) {
|
|
270
321
|
return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
|
|
271
322
|
}
|
|
@@ -279,51 +330,62 @@ function $e(e, t) {
|
|
|
279
330
|
value: t
|
|
280
331
|
};
|
|
281
332
|
}
|
|
282
|
-
var
|
|
333
|
+
var F = y((e) => {
|
|
283
334
|
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
|
|
284
335
|
return {
|
|
285
|
-
executions: t === null ?
|
|
286
|
-
results: t === null ?
|
|
336
|
+
executions: t === null ? Ge : e(t.executionsAtom),
|
|
337
|
+
results: t === null ? Ke : e(t.resultsAtom),
|
|
287
338
|
submissions: Qe(e(Xe), t, n, Je),
|
|
288
339
|
blocked: Qe(e(Ze), t, n, Ye)
|
|
289
340
|
};
|
|
290
341
|
}), et = y((e) => {
|
|
342
|
+
let t = e(m), n = t === null ? null : e(t.documentAtom);
|
|
343
|
+
return t === null || n === null ? {
|
|
344
|
+
cells: qe,
|
|
345
|
+
executions: Ge,
|
|
346
|
+
results: Ke
|
|
347
|
+
} : {
|
|
348
|
+
cells: n.cells,
|
|
349
|
+
executions: e(t.executionsAtom),
|
|
350
|
+
results: e(t.resultsAtom)
|
|
351
|
+
};
|
|
352
|
+
}), tt = y((e) => Fe(e(et))), nt = y((e) => {
|
|
291
353
|
let t = e(m);
|
|
292
354
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
293
355
|
});
|
|
294
|
-
y((e) =>
|
|
295
|
-
function
|
|
356
|
+
y((e) => Ue(e(F).executions)), y((e) => We(e(F)));
|
|
357
|
+
function rt(e, t) {
|
|
296
358
|
e.set(Xe, $e(e, t));
|
|
297
359
|
}
|
|
298
|
-
function
|
|
299
|
-
let n = new Map(e.get(
|
|
360
|
+
function it(e, t) {
|
|
361
|
+
let n = new Map(e.get(F).submissions);
|
|
300
362
|
for (let e of t) n.delete(e);
|
|
301
|
-
|
|
363
|
+
rt(e, n);
|
|
302
364
|
}
|
|
303
|
-
function
|
|
304
|
-
let r = e.get(
|
|
365
|
+
function at(e, t, n) {
|
|
366
|
+
let r = e.get(F).blocked;
|
|
305
367
|
if (r.has(t) === n) return;
|
|
306
368
|
let i = new Set(r);
|
|
307
369
|
n ? i.add(t) : i.delete(t), e.set(Ze, $e(e, i));
|
|
308
370
|
}
|
|
309
|
-
function
|
|
371
|
+
function ot(e, t) {
|
|
310
372
|
let n = t.cell_id, r = t.status === "disabled-transitively";
|
|
311
|
-
t.status != null &&
|
|
373
|
+
t.status != null && at(e, n, r), (r || t.output?.mimetype === "application/vnd.marimo+error") && it(e, [n]);
|
|
312
374
|
}
|
|
313
375
|
//#endregion
|
|
314
376
|
//#region src/core/codemirror/editing/commands.ts
|
|
315
|
-
var
|
|
316
|
-
function
|
|
377
|
+
var st = a();
|
|
378
|
+
function ct(e) {
|
|
317
379
|
return (t) => {
|
|
318
380
|
let n = !1;
|
|
319
381
|
for (let r of t) r && (n = e(r) || n);
|
|
320
382
|
return n;
|
|
321
383
|
};
|
|
322
384
|
}
|
|
323
|
-
var
|
|
385
|
+
var lt = ct(de), ut = ct(le);
|
|
324
386
|
//#endregion
|
|
325
387
|
//#region src/utils/schedule-task.ts
|
|
326
|
-
function
|
|
388
|
+
function dt() {
|
|
327
389
|
let e = globalThis.scheduler;
|
|
328
390
|
if (typeof e?.postTask == "function") return (t) => {
|
|
329
391
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -344,10 +406,10 @@ function lt() {
|
|
|
344
406
|
setTimeout(e, 0);
|
|
345
407
|
};
|
|
346
408
|
}
|
|
347
|
-
var
|
|
409
|
+
var ft = dt();
|
|
348
410
|
//#endregion
|
|
349
411
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
350
|
-
function
|
|
412
|
+
function pt(e = ft) {
|
|
351
413
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
352
414
|
function i() {
|
|
353
415
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -390,18 +452,18 @@ function dt(e = ut) {
|
|
|
390
452
|
}
|
|
391
453
|
};
|
|
392
454
|
}
|
|
393
|
-
var
|
|
455
|
+
var mt = pt();
|
|
394
456
|
//#endregion
|
|
395
457
|
//#region src/plugins/core/sanitize-html.ts
|
|
396
458
|
if (typeof document < "u") {
|
|
397
459
|
let e = "data-temp-href-target";
|
|
398
|
-
|
|
460
|
+
D.addHook("beforeSanitizeAttributes", (t) => {
|
|
399
461
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
400
|
-
}),
|
|
462
|
+
}), D.addHook("afterSanitizeAttributes", (t) => {
|
|
401
463
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
402
464
|
});
|
|
403
465
|
}
|
|
404
|
-
function
|
|
466
|
+
function ht(e) {
|
|
405
467
|
let t = {
|
|
406
468
|
USE_PROFILES: {
|
|
407
469
|
html: !0,
|
|
@@ -417,59 +479,59 @@ function pt(e) {
|
|
|
417
479
|
},
|
|
418
480
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
419
481
|
};
|
|
420
|
-
return
|
|
482
|
+
return D.sanitize(e, t);
|
|
421
483
|
}
|
|
422
484
|
//#endregion
|
|
423
485
|
//#region src/core/dom/outline.ts
|
|
424
|
-
var
|
|
486
|
+
var gt = [
|
|
425
487
|
"marimo-carousel",
|
|
426
488
|
"marimo-tabs",
|
|
427
489
|
"marimo-accordion",
|
|
428
490
|
"marimo-sidebar"
|
|
429
|
-
],
|
|
430
|
-
function
|
|
491
|
+
], _t = "h1, h2, h3, h4, h5, h6";
|
|
492
|
+
function vt(e) {
|
|
431
493
|
if (typeof DOMParser > "u") return null;
|
|
432
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
494
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(_t);
|
|
433
495
|
for (let e of Array.from(n)) {
|
|
434
496
|
let n = e.textContent;
|
|
435
|
-
if (
|
|
497
|
+
if (gt.some((t) => e.closest(t)) || !n) continue;
|
|
436
498
|
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
437
499
|
name: n,
|
|
438
500
|
level: r,
|
|
439
|
-
by:
|
|
501
|
+
by: bt(e)
|
|
440
502
|
};
|
|
441
|
-
i !== n && (a.html =
|
|
503
|
+
i !== n && (a.html = ht(i)), t.push(a);
|
|
442
504
|
}
|
|
443
505
|
return { items: t };
|
|
444
506
|
}
|
|
445
|
-
function
|
|
507
|
+
function yt(e) {
|
|
446
508
|
if (!e.includes("\"")) return `"${e}"`;
|
|
447
509
|
if (!e.includes("'")) return `'${e}'`;
|
|
448
510
|
let t = e.split("\""), n = [];
|
|
449
511
|
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
450
512
|
return `concat(${n.join(", ")})`;
|
|
451
513
|
}
|
|
452
|
-
function
|
|
514
|
+
function bt(e) {
|
|
453
515
|
let t = e.id;
|
|
454
516
|
if (t) return { id: t };
|
|
455
517
|
let n = e.textContent ?? "";
|
|
456
|
-
return { path: `//${e.tagName}[contains(., ${
|
|
518
|
+
return { path: `//${e.tagName}[contains(., ${yt(n)})]` };
|
|
457
519
|
}
|
|
458
|
-
function
|
|
520
|
+
function xt(e) {
|
|
459
521
|
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
460
522
|
}
|
|
461
|
-
function
|
|
523
|
+
function St(e) {
|
|
462
524
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
463
525
|
try {
|
|
464
|
-
return
|
|
526
|
+
return E(typeof e.data == "string", "expected string"), vt(e.data);
|
|
465
527
|
} catch {
|
|
466
528
|
return t.error("Failed to parse outline"), null;
|
|
467
529
|
}
|
|
468
530
|
}
|
|
469
|
-
function
|
|
531
|
+
function Ct(e) {
|
|
470
532
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
471
533
|
}
|
|
472
|
-
function
|
|
534
|
+
function wt(e, n) {
|
|
473
535
|
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
474
536
|
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
475
537
|
let a = r(i), o = e + 1;
|
|
@@ -482,18 +544,18 @@ function St(e, n) {
|
|
|
482
544
|
}
|
|
483
545
|
//#endregion
|
|
484
546
|
//#region src/core/mime.ts
|
|
485
|
-
function
|
|
547
|
+
function Tt(e) {
|
|
486
548
|
return e === "application/vnd.marimo+error";
|
|
487
549
|
}
|
|
488
|
-
function
|
|
550
|
+
function Et(e) {
|
|
489
551
|
return e === "application/vnd.marimo+traceback";
|
|
490
552
|
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
553
|
+
function I(e) {
|
|
554
|
+
return Tt(e) || Et(e);
|
|
493
555
|
}
|
|
494
556
|
//#endregion
|
|
495
557
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
496
|
-
var
|
|
558
|
+
var Dt = class e {
|
|
497
559
|
lines = [""];
|
|
498
560
|
cursor = {
|
|
499
561
|
row: 0,
|
|
@@ -582,7 +644,7 @@ var Tt = class e {
|
|
|
582
644
|
render() {
|
|
583
645
|
return this.lines.join("\n");
|
|
584
646
|
}
|
|
585
|
-
},
|
|
647
|
+
}, Ot = class {
|
|
586
648
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
587
649
|
parse(e) {
|
|
588
650
|
let t = [], n = 0;
|
|
@@ -601,9 +663,9 @@ var Tt = class e {
|
|
|
601
663
|
value: e.slice(n)
|
|
602
664
|
}), t;
|
|
603
665
|
}
|
|
604
|
-
},
|
|
605
|
-
parser = new
|
|
606
|
-
buffer = new
|
|
666
|
+
}, kt = class {
|
|
667
|
+
parser = new Ot();
|
|
668
|
+
buffer = new Dt();
|
|
607
669
|
reduce(e) {
|
|
608
670
|
return this.reset(), this.append(e), this.render();
|
|
609
671
|
}
|
|
@@ -619,7 +681,7 @@ var Tt = class e {
|
|
|
619
681
|
for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
620
682
|
}
|
|
621
683
|
reset() {
|
|
622
|
-
this.buffer = new
|
|
684
|
+
this.buffer = new Dt();
|
|
623
685
|
}
|
|
624
686
|
render() {
|
|
625
687
|
return this.buffer.render();
|
|
@@ -662,19 +724,19 @@ var Tt = class e {
|
|
|
662
724
|
for (let t of e) t >= " " && (n += t);
|
|
663
725
|
return n;
|
|
664
726
|
}
|
|
665
|
-
},
|
|
727
|
+
}, L = class e {
|
|
666
728
|
mimetype;
|
|
667
729
|
channel;
|
|
668
730
|
timestamp;
|
|
669
731
|
code;
|
|
670
732
|
id;
|
|
671
|
-
ansiReducer = new
|
|
733
|
+
ansiReducer = new kt();
|
|
672
734
|
_data;
|
|
673
735
|
get data() {
|
|
674
736
|
return this._data;
|
|
675
737
|
}
|
|
676
738
|
static create(t) {
|
|
677
|
-
let n = new
|
|
739
|
+
let n = new kt();
|
|
678
740
|
return n.append(t.data), new e({
|
|
679
741
|
mimetype: t.mimetype,
|
|
680
742
|
channel: t.channel,
|
|
@@ -709,32 +771,32 @@ var Tt = class e {
|
|
|
709
771
|
};
|
|
710
772
|
//#endregion
|
|
711
773
|
//#region src/core/cells/collapseConsoleOutputs.tsx
|
|
712
|
-
function
|
|
774
|
+
function At(e, t = 5e3) {
|
|
713
775
|
let n = [...e];
|
|
714
|
-
if (n.length < 2) return
|
|
776
|
+
if (n.length < 2) return Ft(n.map(Mt), t);
|
|
715
777
|
let r = n[n.length - 1], i = n[n.length - 2];
|
|
716
|
-
return
|
|
778
|
+
return jt(r, i) && (Pt(r), Pt(i), n[n.length - 2] = Nt(i, r), n.pop()), Ft(n, t);
|
|
717
779
|
}
|
|
718
|
-
function
|
|
780
|
+
function jt(e, t) {
|
|
719
781
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
720
782
|
if (!n) return !1;
|
|
721
783
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
722
784
|
return n && r && i;
|
|
723
785
|
}
|
|
724
|
-
function At(e) {
|
|
725
|
-
return e instanceof N ? e : typeof e.data == "string" ? N.create(e) : e;
|
|
726
|
-
}
|
|
727
|
-
function jt(e, t) {
|
|
728
|
-
return e instanceof N ? e.appendData(t.data) : N.create(e).appendData(t.data);
|
|
729
|
-
}
|
|
730
786
|
function Mt(e) {
|
|
731
|
-
|
|
787
|
+
return e instanceof L ? e : typeof e.data == "string" ? L.create(e) : e;
|
|
732
788
|
}
|
|
733
789
|
function Nt(e, t) {
|
|
790
|
+
return e instanceof L ? e.appendData(t.data) : L.create(e).appendData(t.data);
|
|
791
|
+
}
|
|
792
|
+
function Pt(e) {
|
|
793
|
+
E(typeof e.data == "string", "expected string output");
|
|
794
|
+
}
|
|
795
|
+
function Ft(e, t) {
|
|
734
796
|
let n = 0, r;
|
|
735
797
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
736
798
|
let t = e[r];
|
|
737
|
-
t.mimetype === "text/plain" ? (
|
|
799
|
+
t.mimetype === "text/plain" ? (E(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
|
|
738
800
|
}
|
|
739
801
|
if (n < t) return e;
|
|
740
802
|
let i = r + 1, a = {
|
|
@@ -745,7 +807,7 @@ function Nt(e, t) {
|
|
|
745
807
|
}, o = e[i];
|
|
746
808
|
if (o == null) return [a, ...e.slice(i + 1)];
|
|
747
809
|
if (o.mimetype === "text/plain") {
|
|
748
|
-
|
|
810
|
+
E(typeof o.data == "string", "expected string");
|
|
749
811
|
let r = o.data.split("\n"), s = t - (n - r.length);
|
|
750
812
|
return [
|
|
751
813
|
a,
|
|
@@ -760,16 +822,16 @@ function Nt(e, t) {
|
|
|
760
822
|
}
|
|
761
823
|
//#endregion
|
|
762
824
|
//#region src/core/cells/cell.ts
|
|
763
|
-
function
|
|
825
|
+
function It(e) {
|
|
764
826
|
return (e.at(-1)?.id ?? 0) + 1;
|
|
765
827
|
}
|
|
766
|
-
function
|
|
828
|
+
function Lt(e) {
|
|
767
829
|
return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
|
|
768
830
|
}
|
|
769
|
-
function
|
|
831
|
+
function Rt(e, t) {
|
|
770
832
|
let n = { ...e };
|
|
771
|
-
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" &&
|
|
772
|
-
let r =
|
|
833
|
+
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" && Lt(e.output).some((e) => e.includes("ancestor")) && (n.output = null), n.output = t.output ?? n.output, t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
834
|
+
let r = Lt(t.output).includes("interruption"), i = e.consoleOutputs;
|
|
773
835
|
(r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
|
|
774
836
|
channel: e.channel,
|
|
775
837
|
mimetype: e.mimetype,
|
|
@@ -779,26 +841,26 @@ function It(e, t) {
|
|
|
779
841
|
response: e.response ?? ""
|
|
780
842
|
} : e));
|
|
781
843
|
let a = t.console;
|
|
782
|
-
a != null && (i =
|
|
844
|
+
a != null && (i = At(Array.isArray(a) ? a.map((e, t) => ({
|
|
783
845
|
...e,
|
|
784
846
|
id: t + 1
|
|
785
847
|
})) : [...i, {
|
|
786
848
|
...a,
|
|
787
|
-
id:
|
|
788
|
-
}])), n.consoleOutputs = i, n.outline =
|
|
849
|
+
id: It(i)
|
|
850
|
+
}])), n.consoleOutputs = i, n.outline = St(n.output);
|
|
789
851
|
let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
|
|
790
852
|
return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
|
|
791
853
|
}
|
|
792
|
-
function
|
|
854
|
+
function zt(e) {
|
|
793
855
|
return e === "running" || e === "queued";
|
|
794
856
|
}
|
|
795
|
-
function
|
|
857
|
+
function Bt(e, t, n) {
|
|
796
858
|
let { status: r, outcome: i, rendered: a } = e;
|
|
797
|
-
return
|
|
859
|
+
return zt(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
|
|
798
860
|
}
|
|
799
861
|
//#endregion
|
|
800
862
|
//#region src/core/cells/columns.ts
|
|
801
|
-
function
|
|
863
|
+
function Vt(e) {
|
|
802
864
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
803
865
|
for (let r of e.order) {
|
|
804
866
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -806,9 +868,9 @@ function zt(e) {
|
|
|
806
868
|
}
|
|
807
869
|
return t;
|
|
808
870
|
}
|
|
809
|
-
function
|
|
871
|
+
function Ht(e) {
|
|
810
872
|
let t = [[]];
|
|
811
|
-
for (let [n, r] of
|
|
873
|
+
for (let [n, r] of Vt(e)) {
|
|
812
874
|
for (; t.length <= r;) t.push([]);
|
|
813
875
|
t[r].push(n);
|
|
814
876
|
}
|
|
@@ -816,18 +878,18 @@ function Bt(e) {
|
|
|
816
878
|
}
|
|
817
879
|
//#endregion
|
|
818
880
|
//#region src/core/dom/ui-element-constants.ts
|
|
819
|
-
var
|
|
881
|
+
var Ut = "object-id", Wt = "random-id", Gt = "abcdefghijklmnopqrstuvwxyz", Kt = Gt + Gt.toUpperCase(), qt = /* @__PURE__ */ new Set(), R = "__scratch__", Jt = "setup", Yt = { create() {
|
|
820
882
|
let e = 0, t;
|
|
821
883
|
do {
|
|
822
884
|
let n = "";
|
|
823
|
-
for (let e = 0; e < 4; e++) n +=
|
|
885
|
+
for (let e = 0; e < 4; e++) n += Kt[Math.floor(Math.random() * 52)];
|
|
824
886
|
t = n, e++;
|
|
825
|
-
} while (
|
|
887
|
+
} while (qt.has(t) && e < 100);
|
|
826
888
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
827
|
-
return
|
|
828
|
-
} },
|
|
889
|
+
return qt.add(t), t;
|
|
890
|
+
} }, z = {
|
|
829
891
|
create(e) {
|
|
830
|
-
return
|
|
892
|
+
return E(e != null, "cellId is required"), `cell-${e}`;
|
|
831
893
|
},
|
|
832
894
|
parse(e) {
|
|
833
895
|
return e.slice(5);
|
|
@@ -838,7 +900,7 @@ var Vt = "object-id", Ht = "random-id", Ut = "abcdefghijklmnopqrstuvwxyz", Wt =
|
|
|
838
900
|
findElementThroughShadowDOMs(e) {
|
|
839
901
|
let t = e;
|
|
840
902
|
for (; t;) {
|
|
841
|
-
let e =
|
|
903
|
+
let e = z.findElement(t);
|
|
842
904
|
if (e) return e;
|
|
843
905
|
let n = t.getRootNode();
|
|
844
906
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -846,33 +908,33 @@ var Vt = "object-id", Ht = "random-id", Ut = "abcdefghijklmnopqrstuvwxyz", Wt =
|
|
|
846
908
|
return null;
|
|
847
909
|
}
|
|
848
910
|
};
|
|
849
|
-
function
|
|
850
|
-
let t = null, n =
|
|
851
|
-
return n && (t =
|
|
911
|
+
function Xt(e) {
|
|
912
|
+
let t = null, n = z.findElementThroughShadowDOMs(e);
|
|
913
|
+
return n && (t = z.parse(n.id)), t;
|
|
852
914
|
}
|
|
853
|
-
var
|
|
915
|
+
var Zt = {
|
|
854
916
|
parse(e) {
|
|
855
|
-
return e.getAttribute(
|
|
917
|
+
return e.getAttribute(Ut);
|
|
856
918
|
},
|
|
857
919
|
parseOrThrow(e) {
|
|
858
|
-
let t =
|
|
859
|
-
return
|
|
920
|
+
let t = Zt.parse(e);
|
|
921
|
+
return E(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
860
922
|
}
|
|
861
|
-
},
|
|
923
|
+
}, Qt = { create(e) {
|
|
862
924
|
return `output-${e}`;
|
|
863
|
-
} },
|
|
864
|
-
function
|
|
865
|
-
return `column-${
|
|
925
|
+
} }, $t = y(/* @__PURE__ */ new Set()), B = y([]), V = y([]);
|
|
926
|
+
function en() {
|
|
927
|
+
return `column-${Yt.create()}`;
|
|
866
928
|
}
|
|
867
|
-
var
|
|
868
|
-
let r =
|
|
929
|
+
var tn = y(null, (e, t, n) => {
|
|
930
|
+
let r = Ht(n).length, i = e(B);
|
|
869
931
|
if (i.length === r) return;
|
|
870
|
-
let a = e(
|
|
871
|
-
for (; o.length < r;) o.push(
|
|
872
|
-
t(
|
|
932
|
+
let a = e(V), o = [...i, ...a].slice(0, r);
|
|
933
|
+
for (; o.length < r;) o.push(en());
|
|
934
|
+
t(B, o), t(V, a.slice(Math.max(0, r - i.length)));
|
|
873
935
|
});
|
|
874
|
-
function
|
|
875
|
-
return [...(e === null ? [[]] :
|
|
936
|
+
function nn(e, t, n) {
|
|
937
|
+
return [...(e === null ? [[]] : Ht(e)).map((e, n) => ({
|
|
876
938
|
id: t[n] ?? `column-${n}`,
|
|
877
939
|
ids: e
|
|
878
940
|
})), ...n.map((e) => ({
|
|
@@ -880,18 +942,18 @@ function $t(e, t, n) {
|
|
|
880
942
|
ids: []
|
|
881
943
|
}))];
|
|
882
944
|
}
|
|
883
|
-
function
|
|
945
|
+
function rn(e, t, n) {
|
|
884
946
|
let r = /* @__PURE__ */ new Map();
|
|
885
947
|
return e.forEach((i, a) => {
|
|
886
948
|
let o = t[a];
|
|
887
949
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
888
|
-
let s =
|
|
950
|
+
let s = wt(a, t);
|
|
889
951
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
890
952
|
}), r;
|
|
891
953
|
}
|
|
892
|
-
function
|
|
954
|
+
function an(e, t, n) {
|
|
893
955
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
894
|
-
let i =
|
|
956
|
+
let i = rn(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
895
957
|
return {
|
|
896
958
|
id: e,
|
|
897
959
|
ids: r,
|
|
@@ -900,70 +962,65 @@ function tn(e, t, n) {
|
|
|
900
962
|
};
|
|
901
963
|
}) };
|
|
902
964
|
}
|
|
903
|
-
var
|
|
904
|
-
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(
|
|
905
|
-
return
|
|
906
|
-
}),
|
|
907
|
-
function
|
|
965
|
+
var on = y((e) => {
|
|
966
|
+
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(ci);
|
|
967
|
+
return an(nn(n, e(B), e(V)), (e) => r[e] ?? null, e($t));
|
|
968
|
+
}), sn = () => _(on), cn = y((e) => e(on).columns.length);
|
|
969
|
+
function ln(e, t) {
|
|
908
970
|
return e.columns.find((e) => e.id === t);
|
|
909
971
|
}
|
|
910
|
-
function
|
|
972
|
+
function un(e, t) {
|
|
911
973
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
912
974
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
913
975
|
return n;
|
|
914
976
|
}
|
|
915
|
-
function
|
|
977
|
+
function dn(e, t) {
|
|
916
978
|
for (let n of e.columns) {
|
|
917
979
|
let e = n.folds.get(t);
|
|
918
980
|
if (e !== void 0) return e;
|
|
919
981
|
}
|
|
920
982
|
}
|
|
921
|
-
function
|
|
983
|
+
function fn(e, t) {
|
|
922
984
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
923
985
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
924
986
|
}
|
|
925
|
-
function
|
|
926
|
-
let n =
|
|
927
|
-
return
|
|
987
|
+
function pn(e, t) {
|
|
988
|
+
let n = fn(e, t);
|
|
989
|
+
return dn(e, t) === void 0 ? n : [...n, t];
|
|
928
990
|
}
|
|
929
|
-
var
|
|
930
|
-
function
|
|
991
|
+
var mn = /* @__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("."));
|
|
992
|
+
function hn(e, t = !0) {
|
|
931
993
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
932
994
|
}
|
|
933
|
-
function
|
|
934
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
995
|
+
function gn(e, t) {
|
|
996
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !mn.has(e);
|
|
935
997
|
if (i(e)) return e;
|
|
936
998
|
let a = 1;
|
|
937
999
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
938
1000
|
return r;
|
|
939
1001
|
}
|
|
940
|
-
function
|
|
941
|
-
return
|
|
1002
|
+
function _n(e, t) {
|
|
1003
|
+
return vn(e) ? `cell-${t}` : e;
|
|
942
1004
|
}
|
|
943
|
-
function
|
|
1005
|
+
function vn(e) {
|
|
944
1006
|
return !e || e === "_" || e === "__";
|
|
945
1007
|
}
|
|
946
1008
|
//#endregion
|
|
947
1009
|
//#region src/core/cells/types.ts
|
|
948
|
-
function
|
|
949
|
-
return e === null ? t.trim().length > 0 : e.trim() !== t.trim();
|
|
950
|
-
}
|
|
951
|
-
function gn({ id: e, name: t = "_", code: n = "", lastCodeRun: r = null, edited: i = !1, config: a }) {
|
|
1010
|
+
function yn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
952
1011
|
return {
|
|
953
1012
|
id: e,
|
|
954
|
-
config:
|
|
1013
|
+
config: r || {
|
|
955
1014
|
hide_code: !1,
|
|
956
1015
|
disabled: !1,
|
|
957
1016
|
column: null,
|
|
958
1017
|
expand_output: !1
|
|
959
1018
|
},
|
|
960
1019
|
name: t,
|
|
961
|
-
code: n
|
|
962
|
-
edited: i,
|
|
963
|
-
lastCodeRun: r
|
|
1020
|
+
code: n
|
|
964
1021
|
};
|
|
965
1022
|
}
|
|
966
|
-
function
|
|
1023
|
+
function bn(e) {
|
|
967
1024
|
return {
|
|
968
1025
|
hide_code: !1,
|
|
969
1026
|
disabled: !1,
|
|
@@ -972,20 +1029,19 @@ function _n(e) {
|
|
|
972
1029
|
...e
|
|
973
1030
|
};
|
|
974
1031
|
}
|
|
975
|
-
function
|
|
1032
|
+
function xn(e) {
|
|
976
1033
|
return {
|
|
977
1034
|
outline: null,
|
|
978
1035
|
output: null,
|
|
979
1036
|
consoleOutputs: [],
|
|
980
|
-
staleInputs: !1,
|
|
981
1037
|
debuggerActive: !1,
|
|
982
1038
|
...e
|
|
983
1039
|
};
|
|
984
1040
|
}
|
|
985
1041
|
//#endregion
|
|
986
1042
|
//#region src/core/cells/document.ts
|
|
987
|
-
function
|
|
988
|
-
let n = t.code ?? e.code, r = v(e.config, t.config) ? e.config :
|
|
1043
|
+
function Sn(e, t) {
|
|
1044
|
+
let n = t.code ?? e.code, r = v(e.config, t.config) ? e.config : bn(t.config);
|
|
989
1045
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
990
1046
|
...e,
|
|
991
1047
|
name: t.name,
|
|
@@ -994,36 +1050,33 @@ function yn(e, t) {
|
|
|
994
1050
|
...e,
|
|
995
1051
|
code: n,
|
|
996
1052
|
name: t.name,
|
|
997
|
-
config: r
|
|
998
|
-
edited: z(e.lastCodeRun, n)
|
|
1053
|
+
config: r
|
|
999
1054
|
};
|
|
1000
1055
|
}
|
|
1001
|
-
function
|
|
1056
|
+
function Cn(e, t) {
|
|
1002
1057
|
let n = v(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
1003
1058
|
for (let o of n) {
|
|
1004
1059
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
1005
1060
|
if (n === void 0) continue;
|
|
1006
1061
|
if (s === void 0) {
|
|
1007
|
-
let e = n.code ?? "";
|
|
1008
1062
|
r = {
|
|
1009
1063
|
...r,
|
|
1010
|
-
[o]:
|
|
1064
|
+
[o]: yn({
|
|
1011
1065
|
id: o,
|
|
1012
|
-
code:
|
|
1066
|
+
code: n.code ?? "",
|
|
1013
1067
|
name: n.name,
|
|
1014
|
-
config:
|
|
1015
|
-
edited: z(null, e)
|
|
1068
|
+
config: bn(n.config)
|
|
1016
1069
|
})
|
|
1017
1070
|
}, i = {
|
|
1018
1071
|
...i,
|
|
1019
|
-
[o]: i[o] ??
|
|
1072
|
+
[o]: i[o] ?? xn()
|
|
1020
1073
|
}, a = {
|
|
1021
1074
|
...a,
|
|
1022
|
-
[o]: (0,
|
|
1075
|
+
[o]: (0, O.createRef)()
|
|
1023
1076
|
};
|
|
1024
1077
|
continue;
|
|
1025
1078
|
}
|
|
1026
|
-
let c =
|
|
1079
|
+
let c = Sn(s, n);
|
|
1027
1080
|
c !== s && (r = {
|
|
1028
1081
|
...r,
|
|
1029
1082
|
[o]: c
|
|
@@ -1042,50 +1095,50 @@ function bn(e, t) {
|
|
|
1042
1095
|
cellHandles: a
|
|
1043
1096
|
};
|
|
1044
1097
|
}
|
|
1045
|
-
function
|
|
1098
|
+
function wn({ store: e, model: t, reconcile: n, signal: r }) {
|
|
1046
1099
|
let i = () => {
|
|
1047
1100
|
let r = e.get(t.documentAtom);
|
|
1048
|
-
r !== null && (n(r), e.set(
|
|
1101
|
+
r !== null && (n(r), e.set(tn, r));
|
|
1049
1102
|
}, a = e.sub(t.documentAtom, i);
|
|
1050
1103
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
1051
1104
|
}
|
|
1052
|
-
async function
|
|
1053
|
-
let e =
|
|
1054
|
-
e !== null &&
|
|
1105
|
+
async function Tn() {
|
|
1106
|
+
let e = T.get(b);
|
|
1107
|
+
e !== null && T.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
1055
1108
|
}
|
|
1056
1109
|
//#endregion
|
|
1057
1110
|
//#region src/core/cells/editor.ts
|
|
1058
|
-
var
|
|
1059
|
-
function
|
|
1111
|
+
var H = y(/* @__PURE__ */ new Set());
|
|
1112
|
+
function En(e, t, n) {
|
|
1060
1113
|
return !!e && !t.has(n);
|
|
1061
1114
|
}
|
|
1062
1115
|
y(null, (e, t, { cellId: n }) => {
|
|
1063
|
-
t(
|
|
1064
|
-
}), y(null, (e, t, { cellId: n }) => e(
|
|
1116
|
+
t(H, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
1117
|
+
}), y(null, (e, t, { cellId: n }) => e(H).has(n) ? (t(H, (e) => {
|
|
1065
1118
|
let t = new Set(e);
|
|
1066
1119
|
return t.delete(n), t;
|
|
1067
1120
|
}), !0) : !1);
|
|
1068
|
-
var
|
|
1121
|
+
var Dn = y(/* @__PURE__ */ new Map());
|
|
1069
1122
|
y(null, (e, t, { cellId: n }) => {
|
|
1070
|
-
t(
|
|
1123
|
+
t(Dn, (e) => {
|
|
1071
1124
|
let t = new Map(e);
|
|
1072
1125
|
return t.delete(n), t;
|
|
1073
1126
|
});
|
|
1074
1127
|
});
|
|
1075
1128
|
//#endregion
|
|
1076
1129
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1077
|
-
function
|
|
1078
|
-
return
|
|
1130
|
+
function On(e, t) {
|
|
1131
|
+
return ge(e * 1e3, t?.in);
|
|
1079
1132
|
}
|
|
1080
1133
|
//#endregion
|
|
1081
1134
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1082
|
-
var
|
|
1135
|
+
var kn = function(e, t) {
|
|
1083
1136
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1084
|
-
},
|
|
1137
|
+
}, U;
|
|
1085
1138
|
(function(e) {
|
|
1086
1139
|
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";
|
|
1087
|
-
})(
|
|
1088
|
-
var
|
|
1140
|
+
})(U ||= {});
|
|
1141
|
+
var An = class {
|
|
1089
1142
|
constructor() {
|
|
1090
1143
|
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 = {
|
|
1091
1144
|
http: 1,
|
|
@@ -1317,57 +1370,57 @@ var Dn = class {
|
|
|
1317
1370
|
}
|
|
1318
1371
|
get_next_packet() {
|
|
1319
1372
|
var e = {
|
|
1320
|
-
kind:
|
|
1373
|
+
kind: U.EOS,
|
|
1321
1374
|
text: "",
|
|
1322
1375
|
url: ""
|
|
1323
1376
|
}, t = this._buffer.length;
|
|
1324
1377
|
if (t == 0) return e;
|
|
1325
1378
|
var n = this._buffer.indexOf("\x1B");
|
|
1326
|
-
if (n == -1) return e.kind =
|
|
1327
|
-
if (n > 0) return e.kind =
|
|
1379
|
+
if (n == -1) return e.kind = U.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1380
|
+
if (n > 0) return e.kind = U.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1328
1381
|
if (n == 0) {
|
|
1329
|
-
if (t < 3) return e.kind =
|
|
1382
|
+
if (t < 3) return e.kind = U.Incomplete, e;
|
|
1330
1383
|
var r = this._buffer.charAt(1);
|
|
1331
|
-
if (r != "[" && r != "]" && r != "(") return e.kind =
|
|
1384
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1332
1385
|
if (r == "[") {
|
|
1333
|
-
this._csi_regex ||=
|
|
1386
|
+
this._csi_regex ||= jn(Nn ||= kn(["\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 "]));
|
|
1334
1387
|
let t = this._buffer.match(this._csi_regex);
|
|
1335
|
-
if (t === null) return e.kind =
|
|
1336
|
-
if (t[4]) return e.kind =
|
|
1337
|
-
e.kind = t[1] != "" || t[3] != "m" ?
|
|
1388
|
+
if (t === null) return e.kind = U.Incomplete, e;
|
|
1389
|
+
if (t[4]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1390
|
+
e.kind = t[1] != "" || t[3] != "m" ? U.Unknown : U.SGR, e.text = t[2];
|
|
1338
1391
|
var i = t[0].length;
|
|
1339
1392
|
return this._buffer = this._buffer.slice(i), e;
|
|
1340
1393
|
}
|
|
1341
1394
|
if (r == "]") {
|
|
1342
|
-
if (t < 4) return e.kind =
|
|
1343
|
-
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind =
|
|
1344
|
-
this._osc_st ||=
|
|
1395
|
+
if (t < 4) return e.kind = U.Incomplete, e;
|
|
1396
|
+
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1397
|
+
this._osc_st ||= Mn(Pn ||= kn(["\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;
|
|
1345
1398
|
{
|
|
1346
1399
|
let t = this._osc_st.exec(this._buffer);
|
|
1347
|
-
if (t === null) return e.kind =
|
|
1348
|
-
if (t[3]) return e.kind =
|
|
1400
|
+
if (t === null) return e.kind = U.Incomplete, e;
|
|
1401
|
+
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1349
1402
|
}
|
|
1350
1403
|
{
|
|
1351
1404
|
let t = this._osc_st.exec(this._buffer);
|
|
1352
|
-
if (t === null) return e.kind =
|
|
1353
|
-
if (t[3]) return e.kind =
|
|
1405
|
+
if (t === null) return e.kind = U.Incomplete, e;
|
|
1406
|
+
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1354
1407
|
}
|
|
1355
|
-
this._osc_regex ||=
|
|
1408
|
+
this._osc_regex ||= jn(Fn ||= kn(["\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 "]));
|
|
1356
1409
|
let n = this._buffer.match(this._osc_regex);
|
|
1357
|
-
if (n === null) return e.kind =
|
|
1358
|
-
e.kind =
|
|
1410
|
+
if (n === null) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1411
|
+
e.kind = U.OSCURL, e.url = n[1], e.text = n[2];
|
|
1359
1412
|
var i = n[0].length;
|
|
1360
1413
|
return this._buffer = this._buffer.slice(i), e;
|
|
1361
1414
|
}
|
|
1362
|
-
if (r == "(") return e.kind =
|
|
1415
|
+
if (r == "(") return e.kind = U.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1363
1416
|
}
|
|
1364
1417
|
}
|
|
1365
1418
|
ansi_to_html(e) {
|
|
1366
1419
|
this.append_buffer(e);
|
|
1367
1420
|
for (var t = [];;) {
|
|
1368
1421
|
var n = this.get_next_packet();
|
|
1369
|
-
if (n.kind ==
|
|
1370
|
-
n.kind !=
|
|
1422
|
+
if (n.kind == U.EOS || n.kind == U.Incomplete) break;
|
|
1423
|
+
n.kind != U.ESC && n.kind != U.Unknown && (n.kind == U.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == U.SGR ? this.process_ansi(n) : n.kind == U.OSCURL && t.push(this.process_hyperlink(n)));
|
|
1371
1424
|
}
|
|
1372
1425
|
return t.join("");
|
|
1373
1426
|
}
|
|
@@ -1437,16 +1490,16 @@ var Dn = class {
|
|
|
1437
1490
|
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>`;
|
|
1438
1491
|
}
|
|
1439
1492
|
};
|
|
1440
|
-
function
|
|
1493
|
+
function jn(e, ...t) {
|
|
1441
1494
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1442
1495
|
return new RegExp(n);
|
|
1443
1496
|
}
|
|
1444
|
-
function
|
|
1497
|
+
function Mn(e, ...t) {
|
|
1445
1498
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1446
1499
|
return new RegExp(n, "g");
|
|
1447
1500
|
}
|
|
1448
|
-
var
|
|
1449
|
-
function
|
|
1501
|
+
var Nn, Pn, Fn, In = new An();
|
|
1502
|
+
function W(e) {
|
|
1450
1503
|
try {
|
|
1451
1504
|
let t = document.createElement("div");
|
|
1452
1505
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
@@ -1454,24 +1507,24 @@ function H(e) {
|
|
|
1454
1507
|
return t.error("Error parsing HTML content:", n), e;
|
|
1455
1508
|
}
|
|
1456
1509
|
}
|
|
1457
|
-
function
|
|
1510
|
+
function Ln(e) {
|
|
1458
1511
|
if (!e) return "";
|
|
1459
1512
|
try {
|
|
1460
|
-
return
|
|
1513
|
+
return W(In.ansi_to_html(e));
|
|
1461
1514
|
} catch (n) {
|
|
1462
1515
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1463
1516
|
}
|
|
1464
1517
|
}
|
|
1465
1518
|
//#endregion
|
|
1466
1519
|
//#region src/core/errors/traceback-atom.ts
|
|
1467
|
-
var
|
|
1520
|
+
var Rn = y(null);
|
|
1468
1521
|
//#endregion
|
|
1469
1522
|
//#region src/core/cells/logs.ts
|
|
1470
|
-
function
|
|
1523
|
+
function zn(e) {
|
|
1471
1524
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1472
1525
|
}
|
|
1473
|
-
var
|
|
1474
|
-
function
|
|
1526
|
+
var Bn = !1;
|
|
1527
|
+
function Vn(e) {
|
|
1475
1528
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1476
1529
|
for (let r of n) {
|
|
1477
1530
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1481,7 +1534,7 @@ function Rn(e) {
|
|
|
1481
1534
|
case "stdout":
|
|
1482
1535
|
case "stderr":
|
|
1483
1536
|
case "marimo-error": {
|
|
1484
|
-
let a = d.asString(r.data), o = i ?
|
|
1537
|
+
let a = d.asString(r.data), o = i ? W(a) : a;
|
|
1485
1538
|
t.push({
|
|
1486
1539
|
timestamp: r.timestamp || Date.now(),
|
|
1487
1540
|
level: n ? "stderr" : "stdout",
|
|
@@ -1496,9 +1549,9 @@ function Rn(e) {
|
|
|
1496
1549
|
}
|
|
1497
1550
|
}
|
|
1498
1551
|
}
|
|
1499
|
-
if (t.forEach(
|
|
1552
|
+
if (t.forEach(Hn.log), n.length === 0 && I(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1500
1553
|
e.output.data.forEach((t) => {
|
|
1501
|
-
|
|
1554
|
+
Hn.log({
|
|
1502
1555
|
level: "stderr",
|
|
1503
1556
|
source: {
|
|
1504
1557
|
type: "cell",
|
|
@@ -1508,18 +1561,18 @@ function Rn(e) {
|
|
|
1508
1561
|
message: JSON.stringify(t)
|
|
1509
1562
|
});
|
|
1510
1563
|
});
|
|
1511
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n =
|
|
1512
|
-
if (t.length > 0 && !
|
|
1513
|
-
|
|
1564
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = T.get(pe) === "read";
|
|
1565
|
+
if (t.length > 0 && !Bn && n) {
|
|
1566
|
+
Bn = !0;
|
|
1514
1567
|
let e = t.find((e) => e.traceback);
|
|
1515
1568
|
o(e ? {
|
|
1516
1569
|
title: "An internal error occurred",
|
|
1517
1570
|
description: e.msg || "Click 'View' to see traceback",
|
|
1518
1571
|
variant: "danger",
|
|
1519
|
-
action:
|
|
1572
|
+
action: O.createElement(ae, {
|
|
1520
1573
|
altText: "View traceback",
|
|
1521
1574
|
onClick: () => {
|
|
1522
|
-
|
|
1575
|
+
T.set(Rn, {
|
|
1523
1576
|
traceback: e.traceback,
|
|
1524
1577
|
errorMessage: e.msg || "An internal error occurred"
|
|
1525
1578
|
});
|
|
@@ -1534,13 +1587,13 @@ function Rn(e) {
|
|
|
1534
1587
|
}
|
|
1535
1588
|
return t;
|
|
1536
1589
|
}
|
|
1537
|
-
var
|
|
1590
|
+
var Hn = { log: (e) => {
|
|
1538
1591
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1539
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1592
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Un(e.timestamp)}]`, `(${zn(e.source)}) ${e.message}`);
|
|
1540
1593
|
} };
|
|
1541
|
-
function
|
|
1594
|
+
function Un(e) {
|
|
1542
1595
|
try {
|
|
1543
|
-
return
|
|
1596
|
+
return On(e).toLocaleTimeString(void 0, {
|
|
1544
1597
|
hour12: !0,
|
|
1545
1598
|
hour: "numeric",
|
|
1546
1599
|
minute: "numeric",
|
|
@@ -1552,14 +1605,14 @@ function Bn(e) {
|
|
|
1552
1605
|
}
|
|
1553
1606
|
//#endregion
|
|
1554
1607
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
1555
|
-
function
|
|
1556
|
-
let r = document.getElementById(
|
|
1557
|
-
r ?
|
|
1608
|
+
function Wn(e, n) {
|
|
1609
|
+
let r = document.getElementById(z.create(e));
|
|
1610
|
+
r ? Kn(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
1558
1611
|
}
|
|
1559
|
-
function
|
|
1612
|
+
function Gn() {
|
|
1560
1613
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
1561
1614
|
}
|
|
1562
|
-
function
|
|
1615
|
+
function Kn(e, n) {
|
|
1563
1616
|
try {
|
|
1564
1617
|
e.focus(n);
|
|
1565
1618
|
} catch {
|
|
@@ -1568,7 +1621,7 @@ function U(e, n) {
|
|
|
1568
1621
|
}
|
|
1569
1622
|
//#endregion
|
|
1570
1623
|
//#region src/utils/timeout.ts
|
|
1571
|
-
function
|
|
1624
|
+
function qn(e, n) {
|
|
1572
1625
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
1573
1626
|
if (o < r) {
|
|
1574
1627
|
try {
|
|
@@ -1583,64 +1636,76 @@ function Un(e, n) {
|
|
|
1583
1636
|
}
|
|
1584
1637
|
//#endregion
|
|
1585
1638
|
//#region src/core/cells/utils.ts
|
|
1586
|
-
function
|
|
1587
|
-
return
|
|
1639
|
+
function Jn(e, t, n) {
|
|
1640
|
+
return er(e, t, n).length > 0;
|
|
1588
1641
|
}
|
|
1589
|
-
function
|
|
1642
|
+
function Yn(e) {
|
|
1590
1643
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
1591
1644
|
}
|
|
1592
|
-
function
|
|
1645
|
+
function Xn(e) {
|
|
1593
1646
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1594
1647
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
1595
1648
|
return r;
|
|
1596
1649
|
}
|
|
1597
|
-
function
|
|
1650
|
+
function Zn(e) {
|
|
1598
1651
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1599
1652
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
1600
1653
|
return r;
|
|
1601
1654
|
}
|
|
1602
|
-
function
|
|
1655
|
+
function Qn(e) {
|
|
1603
1656
|
return e.history.length > 0;
|
|
1604
1657
|
}
|
|
1605
|
-
function
|
|
1658
|
+
function $n(e) {
|
|
1606
1659
|
let t = e.history[e.history.length - 1];
|
|
1607
1660
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
1608
1661
|
}
|
|
1609
|
-
function
|
|
1610
|
-
let { cellIds:
|
|
1611
|
-
return
|
|
1612
|
-
let
|
|
1613
|
-
return
|
|
1662
|
+
function er(e, t, n) {
|
|
1663
|
+
let { cellIds: r, cellData: i } = e;
|
|
1664
|
+
return r.filter((e) => {
|
|
1665
|
+
let r = Ve(t, e);
|
|
1666
|
+
return r.status === "idle" ? nr(r) || rr({
|
|
1667
|
+
freshness: n(e),
|
|
1668
|
+
interrupted: r.outcome === "interrupted",
|
|
1669
|
+
disabled: i[e].config.disabled,
|
|
1670
|
+
blocked: r.blocked
|
|
1671
|
+
}) : tr(t.executions, e) && n(e).sourceChanged;
|
|
1614
1672
|
});
|
|
1615
1673
|
}
|
|
1616
|
-
function
|
|
1674
|
+
function tr(e, t) {
|
|
1675
|
+
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
1676
|
+
return r !== void 0 && r.status !== "completed";
|
|
1677
|
+
}
|
|
1678
|
+
function nr({ status: e, outcome: t }) {
|
|
1617
1679
|
return t === null && e !== "queued" && e !== "running";
|
|
1618
1680
|
}
|
|
1619
|
-
function
|
|
1681
|
+
function rr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
|
|
1682
|
+
return e.sourceChanged || t || e.inputsChanged && !(n || r);
|
|
1683
|
+
}
|
|
1684
|
+
function ir({ errored: e, stopped: t }) {
|
|
1620
1685
|
return {
|
|
1621
1686
|
published: !0,
|
|
1622
1687
|
"has-error": e,
|
|
1623
1688
|
stopped: t
|
|
1624
1689
|
};
|
|
1625
1690
|
}
|
|
1626
|
-
function
|
|
1627
|
-
let a =
|
|
1691
|
+
function ar({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
1692
|
+
let a = I(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
1628
1693
|
return (e || t || n || a) && !o;
|
|
1629
1694
|
}
|
|
1630
1695
|
//#endregion
|
|
1631
1696
|
//#region src/core/network/requests.ts
|
|
1632
|
-
var
|
|
1633
|
-
function
|
|
1634
|
-
let e = _(
|
|
1635
|
-
return
|
|
1697
|
+
var or = y(null);
|
|
1698
|
+
function sr() {
|
|
1699
|
+
let e = _(or);
|
|
1700
|
+
return E(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
1636
1701
|
}
|
|
1637
|
-
function
|
|
1638
|
-
let e =
|
|
1639
|
-
return
|
|
1702
|
+
function cr() {
|
|
1703
|
+
let e = T.get(or);
|
|
1704
|
+
return E(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
1640
1705
|
}
|
|
1641
1706
|
//#endregion
|
|
1642
1707
|
//#region src/utils/storage/storage.ts
|
|
1643
|
-
var
|
|
1708
|
+
var lr = class {
|
|
1644
1709
|
store = /* @__PURE__ */ new Map();
|
|
1645
1710
|
get length() {
|
|
1646
1711
|
return this.store.size;
|
|
@@ -1661,16 +1726,16 @@ var nr = class {
|
|
|
1661
1726
|
this.store.set(e, t);
|
|
1662
1727
|
}
|
|
1663
1728
|
};
|
|
1664
|
-
function
|
|
1665
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
1666
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
1729
|
+
function ur() {
|
|
1730
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = _e();
|
|
1731
|
+
return e ? window.localStorage : t ? window.sessionStorage : new lr();
|
|
1667
1732
|
}
|
|
1668
|
-
var
|
|
1669
|
-
function
|
|
1670
|
-
return
|
|
1733
|
+
var dr = ur(), fr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, pr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, mr = /^data:image\//i, hr = ["avatars.githubusercontent.com"];
|
|
1734
|
+
function gr(e) {
|
|
1735
|
+
return mr.test(e) ? [{
|
|
1671
1736
|
type: "image",
|
|
1672
1737
|
url: e
|
|
1673
|
-
}] : e.split(
|
|
1738
|
+
}] : e.split(fr).filter((e) => e !== "").map((e) => fr.test(e) ? pr.test(e) || mr.test(e) || hr.some((t) => e.includes(t)) ? {
|
|
1674
1739
|
type: "image",
|
|
1675
1740
|
url: e
|
|
1676
1741
|
} : {
|
|
@@ -1683,48 +1748,48 @@ function lr(e) {
|
|
|
1683
1748
|
}
|
|
1684
1749
|
//#endregion
|
|
1685
1750
|
//#region src/utils/json/json-parser.ts
|
|
1686
|
-
var
|
|
1751
|
+
var _r = new RegExp(fr.source, "g");
|
|
1687
1752
|
BigInt.prototype.toJSON = function() {
|
|
1688
1753
|
return JSON.rawJSON(this.toString());
|
|
1689
1754
|
};
|
|
1690
|
-
function
|
|
1755
|
+
function vr(e) {
|
|
1691
1756
|
try {
|
|
1692
|
-
return JSON.parse(e, (e, t) =>
|
|
1757
|
+
return JSON.parse(e, (e, t) => Sr(t));
|
|
1693
1758
|
} catch {}
|
|
1694
1759
|
if (e == null || e === "") return {};
|
|
1695
1760
|
try {
|
|
1696
|
-
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 :
|
|
1761
|
+
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 : Sr(t) : Sr(t));
|
|
1697
1762
|
} catch {
|
|
1698
1763
|
return {};
|
|
1699
1764
|
}
|
|
1700
1765
|
}
|
|
1701
|
-
function
|
|
1766
|
+
function yr(e) {
|
|
1702
1767
|
if (e.length === 0) return "";
|
|
1703
1768
|
let t = Object.keys(e[0]);
|
|
1704
1769
|
return [
|
|
1705
1770
|
`| ${t.join(" | ")} |`,
|
|
1706
1771
|
`|${t.map(() => "---").join("|")}|`,
|
|
1707
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
1772
|
+
...e.map((e) => `| ${t.map((t) => br(e[t])).join(" | ")} |`)
|
|
1708
1773
|
].join("\n");
|
|
1709
1774
|
}
|
|
1710
|
-
function
|
|
1775
|
+
function br(e) {
|
|
1711
1776
|
if (e == null) return "";
|
|
1712
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
1777
|
+
if (Array.isArray(e) || typeof e == "object") return xr(JSON.stringify(e));
|
|
1713
1778
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
1714
1779
|
t = t.replaceAll(n, (e) => {
|
|
1715
1780
|
let t = `__MDLINK_${i++}__`;
|
|
1716
1781
|
return r.set(t, e), t;
|
|
1717
|
-
}), t = t.replaceAll(
|
|
1782
|
+
}), t = t.replaceAll(_r, "[$1]($1)");
|
|
1718
1783
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
1719
|
-
return
|
|
1784
|
+
return xr(t);
|
|
1720
1785
|
}
|
|
1721
|
-
function
|
|
1786
|
+
function xr(e) {
|
|
1722
1787
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
1723
1788
|
}
|
|
1724
|
-
function
|
|
1789
|
+
function Sr(e) {
|
|
1725
1790
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
1726
1791
|
}
|
|
1727
|
-
var
|
|
1792
|
+
var Cr = new class {
|
|
1728
1793
|
getFilename() {
|
|
1729
1794
|
return this.getSearchParam("filename");
|
|
1730
1795
|
}
|
|
@@ -1751,39 +1816,39 @@ var gr = new class {
|
|
|
1751
1816
|
}();
|
|
1752
1817
|
//#endregion
|
|
1753
1818
|
//#region src/core/dom/htmlUtils.ts
|
|
1754
|
-
function
|
|
1755
|
-
return
|
|
1819
|
+
function wr(e) {
|
|
1820
|
+
return vr(e ?? "");
|
|
1756
1821
|
}
|
|
1757
|
-
function
|
|
1758
|
-
return
|
|
1822
|
+
function Tr(e) {
|
|
1823
|
+
return oe.mapValues(e.dataset, (e) => typeof e == "string" ? wr(e) : e);
|
|
1759
1824
|
}
|
|
1760
|
-
function
|
|
1761
|
-
let n = e.parentElement ?
|
|
1762
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
1825
|
+
function Er(e, t) {
|
|
1826
|
+
let n = e.parentElement ? Zt.parse(e.parentElement) : void 0;
|
|
1827
|
+
return n && t.has(n) ? t.lookupValue(n) : wr(e.dataset.initialValue);
|
|
1763
1828
|
}
|
|
1764
|
-
function
|
|
1829
|
+
function Dr() {
|
|
1765
1830
|
if (x()) return document.title || null;
|
|
1766
|
-
if (
|
|
1767
|
-
let e =
|
|
1831
|
+
if (he()) {
|
|
1832
|
+
let e = Cr.getFilename();
|
|
1768
1833
|
if (e) return e;
|
|
1769
1834
|
}
|
|
1770
1835
|
let e = document.querySelector("marimo-filename");
|
|
1771
|
-
|
|
1836
|
+
me(e, "marimo-filename tag not found");
|
|
1772
1837
|
let t = e.innerHTML;
|
|
1773
1838
|
return t.length === 0 ? null : t;
|
|
1774
1839
|
}
|
|
1775
1840
|
//#endregion
|
|
1776
1841
|
//#region src/core/saving/file-state.ts
|
|
1777
|
-
var G = y(
|
|
1842
|
+
var G = y(Dr());
|
|
1778
1843
|
y(null);
|
|
1779
|
-
var
|
|
1844
|
+
var Or = y(null);
|
|
1780
1845
|
y(void 0);
|
|
1781
1846
|
//#endregion
|
|
1782
1847
|
//#region src/utils/storage/typed.ts
|
|
1783
|
-
var
|
|
1848
|
+
var kr = class {
|
|
1784
1849
|
defaultValue;
|
|
1785
1850
|
storage;
|
|
1786
|
-
constructor(e, t =
|
|
1851
|
+
constructor(e, t = dr) {
|
|
1787
1852
|
this.defaultValue = e, this.storage = t;
|
|
1788
1853
|
}
|
|
1789
1854
|
get(e) {
|
|
@@ -1800,11 +1865,11 @@ var Sr = class {
|
|
|
1800
1865
|
remove(e) {
|
|
1801
1866
|
this.storage.removeItem(e);
|
|
1802
1867
|
}
|
|
1803
|
-
},
|
|
1868
|
+
}, Ar = class {
|
|
1804
1869
|
schema;
|
|
1805
1870
|
getDefaultValue;
|
|
1806
1871
|
storage;
|
|
1807
|
-
constructor(e, t, n =
|
|
1872
|
+
constructor(e, t, n = dr) {
|
|
1808
1873
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
1809
1874
|
}
|
|
1810
1875
|
get(e) {
|
|
@@ -1823,15 +1888,15 @@ var Sr = class {
|
|
|
1823
1888
|
remove(e) {
|
|
1824
1889
|
this.storage.removeItem(e);
|
|
1825
1890
|
}
|
|
1826
|
-
},
|
|
1891
|
+
}, jr = class extends Ar {
|
|
1827
1892
|
filename;
|
|
1828
1893
|
unsubscribeFromFilename;
|
|
1829
1894
|
constructor(e, t, n) {
|
|
1830
|
-
let r =
|
|
1895
|
+
let r = T.get(G);
|
|
1831
1896
|
super(t, n), this.filename = r;
|
|
1832
1897
|
try {
|
|
1833
|
-
this.unsubscribeFromFilename =
|
|
1834
|
-
let t =
|
|
1898
|
+
this.unsubscribeFromFilename = T.sub(G, () => {
|
|
1899
|
+
let t = T.get(G);
|
|
1835
1900
|
this.handleFilenameChange(e, t);
|
|
1836
1901
|
});
|
|
1837
1902
|
} catch {
|
|
@@ -1889,7 +1954,7 @@ var Sr = class {
|
|
|
1889
1954
|
In: "in",
|
|
1890
1955
|
As: "as",
|
|
1891
1956
|
Import: "import"
|
|
1892
|
-
},
|
|
1957
|
+
}, Mr = /* @__PURE__ */ new Set([
|
|
1893
1958
|
K.FunctionDefinition,
|
|
1894
1959
|
K.LambdaExpression,
|
|
1895
1960
|
K.ArrayComprehensionExpression,
|
|
@@ -1901,13 +1966,13 @@ var Sr = class {
|
|
|
1901
1966
|
K.Comment, K.String, K.FormatString;
|
|
1902
1967
|
//#endregion
|
|
1903
1968
|
//#region src/core/codemirror/utils.ts
|
|
1904
|
-
function
|
|
1969
|
+
function Nr(e) {
|
|
1905
1970
|
e && e.dispatch({ selection: {
|
|
1906
1971
|
anchor: e.state.doc.length,
|
|
1907
1972
|
head: e.state.doc.length
|
|
1908
1973
|
} });
|
|
1909
1974
|
}
|
|
1910
|
-
function
|
|
1975
|
+
function Pr(e) {
|
|
1911
1976
|
let t = e.dom.closest(".marimo-cell");
|
|
1912
1977
|
t && requestAnimationFrame(() => {
|
|
1913
1978
|
t.scrollIntoView({
|
|
@@ -1919,29 +1984,29 @@ function Dr(e) {
|
|
|
1919
1984
|
}
|
|
1920
1985
|
//#endregion
|
|
1921
1986
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
1922
|
-
var
|
|
1923
|
-
function
|
|
1987
|
+
var Fr = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
1988
|
+
function Ir(e, t) {
|
|
1924
1989
|
requestAnimationFrame(() => {
|
|
1925
1990
|
e.focus(), e.dispatch({
|
|
1926
1991
|
selection: {
|
|
1927
1992
|
anchor: t,
|
|
1928
1993
|
head: t
|
|
1929
1994
|
},
|
|
1930
|
-
effects:
|
|
1995
|
+
effects: ue.scrollIntoView(t, { y: "center" })
|
|
1931
1996
|
});
|
|
1932
|
-
}),
|
|
1997
|
+
}), Pr(e);
|
|
1933
1998
|
}
|
|
1934
|
-
function
|
|
1935
|
-
let n =
|
|
1999
|
+
function Lr(e, t) {
|
|
2000
|
+
let n = ce(e), r = null;
|
|
1936
2001
|
return n.iterate({ enter: (n) => {
|
|
1937
2002
|
if (r !== null) return !1;
|
|
1938
2003
|
if (n.name === K.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
1939
2004
|
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
1940
2005
|
} }), r;
|
|
1941
2006
|
}
|
|
1942
|
-
function
|
|
2007
|
+
function Rr(e, t) {
|
|
1943
2008
|
let n = [], r = e.resolveInner(t, 0);
|
|
1944
|
-
for (; r;)
|
|
2009
|
+
for (; r;) Mr.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
1945
2010
|
id: r.from,
|
|
1946
2011
|
type: r.name
|
|
1947
2012
|
})), r = r.parent;
|
|
@@ -1956,12 +2021,12 @@ function J(e, t, n) {
|
|
|
1956
2021
|
from: n
|
|
1957
2022
|
});
|
|
1958
2023
|
}
|
|
1959
|
-
function
|
|
2024
|
+
function zr(e, t) {
|
|
1960
2025
|
if (e.firstChild()) do
|
|
1961
2026
|
t(e.node);
|
|
1962
2027
|
while (e.nextSibling());
|
|
1963
2028
|
}
|
|
1964
|
-
function
|
|
2029
|
+
function Br(e, t) {
|
|
1965
2030
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
1966
2031
|
switch (e.name) {
|
|
1967
2032
|
case K.VariableName:
|
|
@@ -1972,13 +2037,13 @@ function Nr(e, t) {
|
|
|
1972
2037
|
let n = e.node.cursor();
|
|
1973
2038
|
n.firstChild();
|
|
1974
2039
|
do
|
|
1975
|
-
|
|
2040
|
+
Br(n, t);
|
|
1976
2041
|
while (n.nextSibling());
|
|
1977
2042
|
break;
|
|
1978
2043
|
}
|
|
1979
2044
|
}
|
|
1980
2045
|
}
|
|
1981
|
-
function
|
|
2046
|
+
function Vr(e, t) {
|
|
1982
2047
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
1983
2048
|
o.firstChild();
|
|
1984
2049
|
do {
|
|
@@ -1990,18 +2055,18 @@ function Pr(e, t) {
|
|
|
1990
2055
|
while (e.nextSibling());
|
|
1991
2056
|
} while (o.nextSibling());
|
|
1992
2057
|
}
|
|
1993
|
-
function
|
|
2058
|
+
function Hr(e, t) {
|
|
1994
2059
|
let n = e.cursor();
|
|
1995
2060
|
n.firstChild();
|
|
1996
2061
|
let r = !1;
|
|
1997
2062
|
do
|
|
1998
2063
|
if (n.name === q.For) r = !0;
|
|
1999
2064
|
else if (r && n.name === q.In) break;
|
|
2000
|
-
else r &&
|
|
2065
|
+
else r && Br(n, t);
|
|
2001
2066
|
while (n.nextSibling());
|
|
2002
2067
|
}
|
|
2003
|
-
function
|
|
2004
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2068
|
+
function Ur(e, t) {
|
|
2069
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Mr.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2005
2070
|
switch (s) {
|
|
2006
2071
|
case K.FunctionDefinition:
|
|
2007
2072
|
case K.ClassDefinition: {
|
|
@@ -2013,7 +2078,7 @@ function Ir(e, t) {
|
|
|
2013
2078
|
break;
|
|
2014
2079
|
}
|
|
2015
2080
|
while (t.nextSibling());
|
|
2016
|
-
s === K.FunctionDefinition &&
|
|
2081
|
+
s === K.FunctionDefinition && Vr(e, {
|
|
2017
2082
|
state: n,
|
|
2018
2083
|
variableName: r,
|
|
2019
2084
|
scopeId: c,
|
|
@@ -2022,7 +2087,7 @@ function Ir(e, t) {
|
|
|
2022
2087
|
break;
|
|
2023
2088
|
}
|
|
2024
2089
|
case K.LambdaExpression:
|
|
2025
|
-
|
|
2090
|
+
Vr(e, {
|
|
2026
2091
|
state: n,
|
|
2027
2092
|
variableName: r,
|
|
2028
2093
|
scopeId: c,
|
|
@@ -2034,7 +2099,7 @@ function Ir(e, t) {
|
|
|
2034
2099
|
case K.SetComprehensionExpression:
|
|
2035
2100
|
case K.ComprehensionExpression:
|
|
2036
2101
|
case K.ForStatement:
|
|
2037
|
-
|
|
2102
|
+
Hr(e, {
|
|
2038
2103
|
state: n,
|
|
2039
2104
|
variableName: r,
|
|
2040
2105
|
scopeId: u,
|
|
@@ -2052,7 +2117,7 @@ function Ir(e, t) {
|
|
|
2052
2117
|
let s = e.cursor();
|
|
2053
2118
|
s.firstChild();
|
|
2054
2119
|
do
|
|
2055
|
-
s.from < o &&
|
|
2120
|
+
s.from < o && Br(s, {
|
|
2056
2121
|
state: n,
|
|
2057
2122
|
variableName: r,
|
|
2058
2123
|
scopeId: u,
|
|
@@ -2097,8 +2162,8 @@ function Ir(e, t) {
|
|
|
2097
2162
|
break;
|
|
2098
2163
|
}
|
|
2099
2164
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2165
|
+
zr(o, (e) => {
|
|
2166
|
+
Ur(e, {
|
|
2102
2167
|
state: n,
|
|
2103
2168
|
variableName: r,
|
|
2104
2169
|
scopeStack: l,
|
|
@@ -2106,27 +2171,27 @@ function Ir(e, t) {
|
|
|
2106
2171
|
});
|
|
2107
2172
|
});
|
|
2108
2173
|
}
|
|
2109
|
-
function
|
|
2110
|
-
let r =
|
|
2111
|
-
|
|
2174
|
+
function Wr(e, t, n) {
|
|
2175
|
+
let r = ce(e), i = [];
|
|
2176
|
+
Ur(r, {
|
|
2112
2177
|
state: e,
|
|
2113
2178
|
variableName: t,
|
|
2114
2179
|
scopeStack: [],
|
|
2115
2180
|
declarations: i
|
|
2116
2181
|
});
|
|
2117
2182
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2118
|
-
for (let e of
|
|
2119
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2183
|
+
for (let e of Rr(r, a)) {
|
|
2184
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Fr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2120
2185
|
if (t) return t.from;
|
|
2121
2186
|
}
|
|
2122
2187
|
return null;
|
|
2123
2188
|
}
|
|
2124
|
-
function
|
|
2125
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2126
|
-
return i !== null && (
|
|
2189
|
+
function Gr(e, t, n) {
|
|
2190
|
+
let { state: r } = e, i = n === void 0 ? Lr(r, t) : Wr(r, t, n);
|
|
2191
|
+
return i !== null && (Ir(e, i), !0);
|
|
2127
2192
|
}
|
|
2128
|
-
function
|
|
2129
|
-
return
|
|
2193
|
+
function Kr(e, t) {
|
|
2194
|
+
return Ir(e, e.state.doc.line(t).from), !0;
|
|
2130
2195
|
}
|
|
2131
2196
|
//#endregion
|
|
2132
2197
|
//#region src/core/notebook/replica/connection.ts
|
|
@@ -2136,7 +2201,7 @@ var Y = {
|
|
|
2136
2201
|
OPEN: "OPEN",
|
|
2137
2202
|
CLOSING: "CLOSING",
|
|
2138
2203
|
CLOSED: "CLOSED"
|
|
2139
|
-
},
|
|
2204
|
+
}, qr = {
|
|
2140
2205
|
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
2141
2206
|
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
2142
2207
|
}, X = y({ state: Y.NOT_STARTED });
|
|
@@ -2144,11 +2209,11 @@ h(null, (e, t) => t === null ? null : {
|
|
|
2144
2209
|
phase: t.phase,
|
|
2145
2210
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2146
2211
|
});
|
|
2147
|
-
function
|
|
2148
|
-
return
|
|
2212
|
+
function Jr() {
|
|
2213
|
+
return ie(X, (e) => e.state === Y.OPEN);
|
|
2149
2214
|
}
|
|
2150
|
-
function
|
|
2151
|
-
return
|
|
2215
|
+
function Yr() {
|
|
2216
|
+
return fe() ? Jr() : Promise.resolve();
|
|
2152
2217
|
}
|
|
2153
2218
|
y((e) => e(X).state === Y.CONNECTING), y((e) => e(X).state === Y.OPEN), y((e) => {
|
|
2154
2219
|
let t = e(X);
|
|
@@ -2156,50 +2221,50 @@ y((e) => e(X).state === Y.CONNECTING), y((e) => e(X).state === Y.OPEN), y((e) =>
|
|
|
2156
2221
|
}), y((e) => e(X).state === Y.CLOSED), y((e) => e(X).state === Y.NOT_STARTED);
|
|
2157
2222
|
//#endregion
|
|
2158
2223
|
//#region src/components/ui/checkbox.tsx
|
|
2159
|
-
var
|
|
2160
|
-
let r = (0,
|
|
2224
|
+
var Xr = O.forwardRef((e, t) => {
|
|
2225
|
+
let r = (0, st.c)(13), i, a;
|
|
2161
2226
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2162
2227
|
let o;
|
|
2163
2228
|
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);
|
|
2164
2229
|
let s;
|
|
2165
2230
|
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];
|
|
2166
2231
|
let c;
|
|
2167
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0,
|
|
2232
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, k.jsx)(ke, {
|
|
2168
2233
|
className: s,
|
|
2169
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
2234
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, k.jsx)(ye, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, k.jsx)(l, { className: "h-4 w-4" })
|
|
2170
2235
|
}), r[6] = a.checked, r[7] = c);
|
|
2171
2236
|
let u;
|
|
2172
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0,
|
|
2237
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, k.jsx)(De, {
|
|
2173
2238
|
ref: t,
|
|
2174
2239
|
className: o,
|
|
2175
2240
|
...a,
|
|
2176
2241
|
children: c
|
|
2177
2242
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2178
2243
|
});
|
|
2179
|
-
|
|
2244
|
+
Xr.displayName = De.displayName;
|
|
2180
2245
|
//#endregion
|
|
2181
2246
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2182
|
-
function
|
|
2247
|
+
function Zr({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2183
2248
|
if (!n) return;
|
|
2184
|
-
let o = document.getElementById(
|
|
2249
|
+
let o = document.getElementById(z.create(e));
|
|
2185
2250
|
if (!o) {
|
|
2186
2251
|
t.warn("scrollCellIntoView: element not found");
|
|
2187
2252
|
return;
|
|
2188
2253
|
}
|
|
2189
|
-
if (
|
|
2190
|
-
|
|
2254
|
+
if (Gn()) {
|
|
2255
|
+
Kn(o);
|
|
2191
2256
|
return;
|
|
2192
2257
|
}
|
|
2193
|
-
if (r)
|
|
2258
|
+
if (r) Kn(o);
|
|
2194
2259
|
else {
|
|
2195
|
-
|
|
2260
|
+
mt.promote(e);
|
|
2196
2261
|
let r = n.current?.editorView;
|
|
2197
2262
|
if (!r) {
|
|
2198
2263
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2199
2264
|
return;
|
|
2200
2265
|
}
|
|
2201
2266
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2202
|
-
if (
|
|
2267
|
+
if (qn(() => (r.focus(), r.hasFocus), {
|
|
2203
2268
|
retries: 5,
|
|
2204
2269
|
delay: 20
|
|
2205
2270
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2212,28 +2277,28 @@ function Wr({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2212
2277
|
anchor: e.from,
|
|
2213
2278
|
head: e.from
|
|
2214
2279
|
} });
|
|
2215
|
-
} else a &&
|
|
2280
|
+
} else a && Gr(r, a);
|
|
2216
2281
|
}
|
|
2217
2282
|
o.scrollIntoView({
|
|
2218
2283
|
behavior: "smooth",
|
|
2219
2284
|
block: "nearest"
|
|
2220
2285
|
});
|
|
2221
2286
|
}
|
|
2222
|
-
function
|
|
2287
|
+
function Qr() {
|
|
2223
2288
|
let e = document.getElementById("App");
|
|
2224
2289
|
e?.scrollTo({
|
|
2225
2290
|
top: e.scrollHeight,
|
|
2226
2291
|
behavior: "smooth"
|
|
2227
2292
|
});
|
|
2228
2293
|
}
|
|
2229
|
-
function
|
|
2294
|
+
function $r() {
|
|
2230
2295
|
document.getElementById("App")?.scrollTo({
|
|
2231
2296
|
top: 0,
|
|
2232
2297
|
behavior: "smooth"
|
|
2233
2298
|
});
|
|
2234
2299
|
}
|
|
2235
|
-
function
|
|
2236
|
-
let t = document.getElementById(
|
|
2300
|
+
function ei(e) {
|
|
2301
|
+
let t = document.getElementById(z.create(e));
|
|
2237
2302
|
return t?.scrollIntoView({
|
|
2238
2303
|
behavior: "smooth",
|
|
2239
2304
|
block: "center"
|
|
@@ -2241,7 +2306,7 @@ function qr(e) {
|
|
|
2241
2306
|
}
|
|
2242
2307
|
//#endregion
|
|
2243
2308
|
//#region src/core/cells/cells.ts
|
|
2244
|
-
function
|
|
2309
|
+
function ti(e) {
|
|
2245
2310
|
let t = {
|
|
2246
2311
|
column: 0,
|
|
2247
2312
|
hide_code: !1,
|
|
@@ -2251,24 +2316,24 @@ function Jr(e) {
|
|
|
2251
2316
|
return {
|
|
2252
2317
|
...e,
|
|
2253
2318
|
cellData: {
|
|
2254
|
-
[
|
|
2255
|
-
id:
|
|
2319
|
+
[R]: yn({
|
|
2320
|
+
id: R,
|
|
2256
2321
|
config: t
|
|
2257
2322
|
}),
|
|
2258
2323
|
...e.cellData
|
|
2259
2324
|
},
|
|
2260
2325
|
cellRuntime: {
|
|
2261
|
-
[
|
|
2326
|
+
[R]: xn(),
|
|
2262
2327
|
...e.cellRuntime
|
|
2263
2328
|
},
|
|
2264
2329
|
cellHandles: {
|
|
2265
|
-
[
|
|
2330
|
+
[R]: (0, O.createRef)(),
|
|
2266
2331
|
...e.cellHandles
|
|
2267
2332
|
}
|
|
2268
2333
|
};
|
|
2269
2334
|
}
|
|
2270
|
-
function
|
|
2271
|
-
return
|
|
2335
|
+
function ni() {
|
|
2336
|
+
return ti({
|
|
2272
2337
|
cellIds: [],
|
|
2273
2338
|
cellData: {},
|
|
2274
2339
|
cellRuntime: {},
|
|
@@ -2278,55 +2343,24 @@ function Yr() {
|
|
|
2278
2343
|
cellLogs: []
|
|
2279
2344
|
});
|
|
2280
2345
|
}
|
|
2281
|
-
var { reducer:
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
return e.cellData[n] ? $r({
|
|
2285
|
-
state: e,
|
|
2286
|
-
cellId: n,
|
|
2287
|
-
cellReducer: (e) => {
|
|
2288
|
-
let t = z(e.lastCodeRun, r) ? e.lastCodeRun : i;
|
|
2289
|
-
return {
|
|
2290
|
-
...e,
|
|
2291
|
-
lastCodeRun: t,
|
|
2292
|
-
edited: z(t, e.code)
|
|
2293
|
-
};
|
|
2294
|
-
}
|
|
2295
|
-
}) : e;
|
|
2296
|
-
},
|
|
2297
|
-
prepareForRun: (e, t) => $r({
|
|
2298
|
-
state: Q({
|
|
2299
|
-
state: e,
|
|
2300
|
-
cellId: t.cellId,
|
|
2301
|
-
cellReducer: (e) => ({
|
|
2302
|
-
...e,
|
|
2303
|
-
debuggerActive: !1
|
|
2304
|
-
})
|
|
2305
|
-
}),
|
|
2346
|
+
var { reducer: ri, createActions: ii, useActions: ai, valueAtom: Z } = se(ni, {
|
|
2347
|
+
prepareForRun: (e, t) => Q({
|
|
2348
|
+
state: e,
|
|
2306
2349
|
cellId: t.cellId,
|
|
2307
2350
|
cellReducer: (e) => ({
|
|
2308
2351
|
...e,
|
|
2309
|
-
|
|
2310
|
-
lastCodeRun: e.code.trim()
|
|
2352
|
+
debuggerActive: !1
|
|
2311
2353
|
})
|
|
2312
2354
|
}),
|
|
2313
2355
|
handleCellMessage: (e, t) => {
|
|
2314
2356
|
let n = t.cell_id, r = Q({
|
|
2315
2357
|
state: e,
|
|
2316
2358
|
cellId: n,
|
|
2317
|
-
cellReducer: (e) =>
|
|
2359
|
+
cellReducer: (e) => Rt(e, t)
|
|
2318
2360
|
});
|
|
2319
|
-
return
|
|
2320
|
-
state: r,
|
|
2321
|
-
cellId: n,
|
|
2322
|
-
cellReducer: (e) => ({
|
|
2323
|
-
...e,
|
|
2324
|
-
lastCodeRun: e.code.trim(),
|
|
2325
|
-
edited: !1
|
|
2326
|
-
})
|
|
2327
|
-
})), {
|
|
2361
|
+
return {
|
|
2328
2362
|
...r,
|
|
2329
|
-
cellLogs: [...r.cellLogs, ...
|
|
2363
|
+
cellLogs: [...r.cellLogs, ...Vn(t)]
|
|
2330
2364
|
};
|
|
2331
2365
|
},
|
|
2332
2366
|
addLogs: (e, t) => ({
|
|
@@ -2334,8 +2368,8 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ce(Yr, {
|
|
|
2334
2368
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
2335
2369
|
}),
|
|
2336
2370
|
reconcileDocument: (e, t) => {
|
|
2337
|
-
let n =
|
|
2338
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
2371
|
+
let n = Cn(e, t);
|
|
2372
|
+
for (let t of e.cellIds) t in n.cellData || bi(t);
|
|
2339
2373
|
return n;
|
|
2340
2374
|
},
|
|
2341
2375
|
setStdinResponse: (e, n) => {
|
|
@@ -2360,26 +2394,11 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ce(Yr, {
|
|
|
2360
2394
|
}
|
|
2361
2395
|
});
|
|
2362
2396
|
},
|
|
2363
|
-
setLastRun: (e, t) => {
|
|
2364
|
-
let n = { ...e.cellData };
|
|
2365
|
-
for (let r of e.cellIds) {
|
|
2366
|
-
let i = e.cellData[r], a = t.lastCodeRun[r] ?? null;
|
|
2367
|
-
n[r] = {
|
|
2368
|
-
...i,
|
|
2369
|
-
lastCodeRun: a,
|
|
2370
|
-
edited: a !== null && z(a, i.code)
|
|
2371
|
-
};
|
|
2372
|
-
}
|
|
2373
|
-
return {
|
|
2374
|
-
...e,
|
|
2375
|
-
cellData: n
|
|
2376
|
-
};
|
|
2377
|
-
},
|
|
2378
2397
|
resetCellRuntimes: (e) => {
|
|
2379
|
-
let t =
|
|
2380
|
-
for (let r of [...e.cellIds,
|
|
2398
|
+
let t = he(), n = { ...e.cellRuntime };
|
|
2399
|
+
for (let r of [...e.cellIds, R]) {
|
|
2381
2400
|
let i = e.cellRuntime[r];
|
|
2382
|
-
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i :
|
|
2401
|
+
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : xn();
|
|
2383
2402
|
}
|
|
2384
2403
|
return {
|
|
2385
2404
|
...e,
|
|
@@ -2390,10 +2409,10 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ce(Yr, {
|
|
|
2390
2409
|
let t = e.scrollKey;
|
|
2391
2410
|
if (t === null) return e;
|
|
2392
2411
|
let n = t;
|
|
2393
|
-
return
|
|
2412
|
+
return Zr({
|
|
2394
2413
|
cellId: n,
|
|
2395
2414
|
cell: e.cellHandles[n],
|
|
2396
|
-
isCodeHidden:
|
|
2415
|
+
isCodeHidden: En(e.cellData[n]?.config.hide_code, T.get(H), n),
|
|
2397
2416
|
codeFocus: void 0,
|
|
2398
2417
|
variableName: void 0
|
|
2399
2418
|
}), {
|
|
@@ -2401,8 +2420,8 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ce(Yr, {
|
|
|
2401
2420
|
scrollKey: null
|
|
2402
2421
|
};
|
|
2403
2422
|
},
|
|
2404
|
-
foldAll: (e) => (
|
|
2405
|
-
unfoldAll: (e) => (
|
|
2423
|
+
foldAll: (e) => (lt(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2424
|
+
unfoldAll: (e) => (ut(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2406
2425
|
clearLogs: (e) => ({
|
|
2407
2426
|
...e,
|
|
2408
2427
|
cellLogs: []
|
|
@@ -2452,25 +2471,16 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
2452
2471
|
}
|
|
2453
2472
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2454
2473
|
}
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
...e,
|
|
2458
|
-
cellData: {
|
|
2459
|
-
...e.cellData,
|
|
2460
|
-
[n]: r(e.cellData[n])
|
|
2461
|
-
}
|
|
2462
|
-
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2463
|
-
}
|
|
2464
|
-
var ei = Zr((e) => {
|
|
2465
|
-
w.set(Z, (t) => Xr(t, e));
|
|
2474
|
+
var oi = ii((e) => {
|
|
2475
|
+
T.set(Z, (t) => ri(t, e));
|
|
2466
2476
|
}).addLogs, $ = y((e) => e(Z).cellIds);
|
|
2467
|
-
y((e) => e($).length === 1), y((e) =>
|
|
2468
|
-
var
|
|
2477
|
+
y((e) => e($).length === 1), y((e) => Xn(e(Z)).length > 0), y((e) => Zn(e(Z)).length > 0), y((e) => Qn(e(Z))), y((e) => $n(e(Z))), y((e) => Jn(e(Z), e(F), e(tt)));
|
|
2478
|
+
var si = y((e) => {
|
|
2469
2479
|
let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
|
|
2470
2480
|
return t.map((e) => {
|
|
2471
2481
|
let t = n[e], { name: i } = r[e];
|
|
2472
|
-
if (
|
|
2473
|
-
|
|
2482
|
+
if (I(t.output?.mimetype)) {
|
|
2483
|
+
E(Array.isArray(t.output.data), "Expected array data");
|
|
2474
2484
|
let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
|
|
2475
2485
|
if (n.length > 0) return {
|
|
2476
2486
|
output: {
|
|
@@ -2483,90 +2493,90 @@ var ti = y((e) => {
|
|
|
2483
2493
|
}
|
|
2484
2494
|
return null;
|
|
2485
2495
|
}).filter(Boolean);
|
|
2486
|
-
}),
|
|
2496
|
+
}), ci = re(y((e) => {
|
|
2487
2497
|
let t = {};
|
|
2488
|
-
for (let [n, r] of
|
|
2498
|
+
for (let [n, r] of oe.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
|
|
2489
2499
|
return t;
|
|
2490
|
-
})),
|
|
2491
|
-
let t = e($), n = e(
|
|
2492
|
-
return
|
|
2500
|
+
})), li = y((e) => {
|
|
2501
|
+
let t = e($), n = e(gi);
|
|
2502
|
+
return xt(t.map((e) => n[e].outline));
|
|
2493
2503
|
});
|
|
2494
|
-
y((e) => e(
|
|
2495
|
-
var
|
|
2504
|
+
y((e) => e(si).length);
|
|
2505
|
+
var ui = re(y((e) => {
|
|
2496
2506
|
let { cellIds: t, cellData: n } = e(Z);
|
|
2497
|
-
return
|
|
2507
|
+
return oe.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
2498
2508
|
}));
|
|
2499
2509
|
y((e) => e(Z).scrollKey);
|
|
2500
|
-
var
|
|
2501
|
-
let { cellIds: e, cellData: t } =
|
|
2510
|
+
var di = () => _($), fi = () => _(ui), pi = () => T.get(Z), mi = () => T.get(Z).cellIds, hi = () => {
|
|
2511
|
+
let { cellIds: e, cellData: t } = T.get(Z);
|
|
2502
2512
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
2503
2513
|
};
|
|
2504
2514
|
C(p(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
|
|
2505
|
-
var
|
|
2515
|
+
var gi = y((e) => e(Z).cellRuntime);
|
|
2506
2516
|
y((e) => e(Z).cellIds.length > 0);
|
|
2507
|
-
var
|
|
2508
|
-
function
|
|
2509
|
-
|
|
2517
|
+
var _i = g((e) => y((t) => t(Z).cellData[e])), vi = g((e) => y((t) => t(Z).cellRuntime[e])), yi = g((e) => y((t) => t(Z).cellHandles[e]));
|
|
2518
|
+
function bi(e) {
|
|
2519
|
+
_i.remove(e), vi.remove(e), yi.remove(e), it(T, [e]);
|
|
2510
2520
|
}
|
|
2511
|
-
var
|
|
2512
|
-
let { cellHandles: t } =
|
|
2521
|
+
var xi = (e) => {
|
|
2522
|
+
let { cellHandles: t } = T.get(Z);
|
|
2513
2523
|
return t[e].current?.editorView;
|
|
2514
|
-
},
|
|
2515
|
-
function
|
|
2516
|
-
return
|
|
2524
|
+
}, Si = (e) => (mt.promote(e), xi(e));
|
|
2525
|
+
function Ci() {
|
|
2526
|
+
return ai();
|
|
2517
2527
|
}
|
|
2518
2528
|
//#endregion
|
|
2519
2529
|
//#region src/core/errors/error-entries.ts
|
|
2520
|
-
function
|
|
2521
|
-
if (
|
|
2530
|
+
function wi(e) {
|
|
2531
|
+
if (Tt(e.mimetype)) {
|
|
2522
2532
|
if (!Array.isArray(e.data)) return null;
|
|
2523
2533
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
2524
2534
|
return t.length === 0 ? null : { errorData: t };
|
|
2525
2535
|
}
|
|
2526
|
-
return
|
|
2536
|
+
return Et(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
2527
2537
|
errorData: [],
|
|
2528
2538
|
tracebackHtml: e.data
|
|
2529
2539
|
} : null;
|
|
2530
2540
|
}
|
|
2531
|
-
function
|
|
2541
|
+
function Ti(e) {
|
|
2532
2542
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
2533
2543
|
}
|
|
2534
|
-
function
|
|
2535
|
-
let t = e?.find((e) =>
|
|
2544
|
+
function Ei(e) {
|
|
2545
|
+
let t = e?.find((e) => Et(e.mimetype));
|
|
2536
2546
|
if (!(!t || typeof t.data != "string" || t.data.length === 0)) return t.data;
|
|
2537
2547
|
}
|
|
2538
|
-
function
|
|
2548
|
+
function Di(e, t) {
|
|
2539
2549
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
2540
|
-
if (!
|
|
2550
|
+
if (!Ti(e.errorData)) return Ei(t);
|
|
2541
2551
|
}
|
|
2542
|
-
function
|
|
2552
|
+
function Oi(e) {
|
|
2543
2553
|
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
|
|
2544
2554
|
for (let [e, a] of t.entries()) {
|
|
2545
2555
|
let t = n[a], o = t.output;
|
|
2546
|
-
if (!o || !
|
|
2547
|
-
let s =
|
|
2556
|
+
if (!o || !I(o.mimetype)) continue;
|
|
2557
|
+
let s = wi(o);
|
|
2548
2558
|
if (!s) continue;
|
|
2549
|
-
let c =
|
|
2559
|
+
let c = _n(r[a].name, e), l = o.code ?? r[a].code;
|
|
2550
2560
|
i.push({
|
|
2551
2561
|
cellId: a,
|
|
2552
2562
|
cellName: c,
|
|
2553
2563
|
cellCode: l,
|
|
2554
2564
|
errorData: s.errorData,
|
|
2555
|
-
tracebackHtml:
|
|
2565
|
+
tracebackHtml: Di(s, t.consoleOutputs)
|
|
2556
2566
|
});
|
|
2557
2567
|
}
|
|
2558
2568
|
return i;
|
|
2559
2569
|
}
|
|
2560
|
-
function
|
|
2570
|
+
function ki(e) {
|
|
2561
2571
|
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");
|
|
2562
2572
|
}
|
|
2563
|
-
function
|
|
2564
|
-
let t =
|
|
2565
|
-
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${
|
|
2573
|
+
function Ai(e) {
|
|
2574
|
+
let t = ki(e);
|
|
2575
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
2566
2576
|
}
|
|
2567
|
-
function
|
|
2577
|
+
function ji(e) {
|
|
2568
2578
|
let t = [e.cellName];
|
|
2569
|
-
return e.tracebackHtml && t.push(
|
|
2579
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Ai).join("\n\n")), t.join("\n\n");
|
|
2570
2580
|
}
|
|
2571
2581
|
//#endregion
|
|
2572
|
-
export {
|
|
2582
|
+
export { Wn as $, qr as A, Xt as At, Tr as B, tt as Bt, Qr as C, sn as Ct, X as D, R as Dt, Xr as E, z as Et, kr as F, Bt as Ft, dr as G, ve as Gt, vr as H, nt as Ht, Ar as I, Ct as It, sr as J, cr as K, G as L, bt as Lt, Kr as M, Wt as Mt, Nr as N, Vt as Nt, Jr as O, Jt as Ot, jr as P, zt as Pt, ar as Q, Or as R, ht as Rt, Zr as S, cn as St, $r as T, Qt as Tt, yr as U, Ve as Ut, Er as V, ot as Vt, gr as W, ye as Wt, Yn as X, nr as Y, ir as Z, ri as _, dn as _t, oi as a, H as at, fi as b, on as bt, ii as c, _n as ct, hi as d, hn as dt, Ln as et, mi as f, $t as ft, li as g, ln as gt, Z as h, V as ht, Oi as i, Dn as it, Y as j, Ut as jt, Yr as k, Zt as kt, Si as l, gn as lt, ni as m, un as mt, ji as n, An as nt, _i as o, Tn as ot, pi as p, B as pt, or as q, Ai as r, En as rt, $ as s, wn as st, ki as t, W as tt, xi as u, vn as ut, bi as v, pn as vt, ei as w, Yt as wt, Ci as x, en as xt, di as y, fn as yt, wr as z, F as zt };
|