@marimo-team/islands 0.26.1-dev27 → 0.26.1-dev30
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-zpe6C93k.js → ErrorBoundary-BsbtzE4_.js} +1 -1
- package/dist/{chat-ui-DOvIzlMA.js → chat-ui-CWmSnBs8.js} +899 -899
- package/dist/{code-visibility-BtvMUvQ6.js → code-visibility-XN_3KbPf.js} +2 -2
- package/dist/{common-B46KECgx.js → common-LxQtzU-2.js} +6565 -6565
- package/dist/{config-DL9e-OWE.js → config-1ku0tAiU.js} +27 -28
- package/dist/{data-grid-overlay-editor-CLCJ44fs.js → data-grid-overlay-editor-DOgicOan.js} +1 -1
- package/dist/{dropdown-menu-DYN2RV5d.js → dropdown-menu-D65ZUqka.js} +1983 -1983
- package/dist/{error-entries-CncQR572.js → error-entries-DFHEq_SO.js} +515 -519
- package/dist/{feedback-button-CnyHlwaY.js → feedback-button-Bdpv5VWt.js} +19 -19
- package/dist/{glide-data-editor-C3znsea0.js → glide-data-editor-CZTp4A6s.js} +35 -35
- package/dist/{globals-DHoGn4Qt.js → globals-CI6U88UW.js} +1 -1
- package/dist/{html-to-image-BU7H-AM1.js → html-to-image-D6Gtk5ik.js} +24005 -23992
- package/dist/main.js +864 -864
- package/dist/{number-overlay-editor-DwK5S3_f.js → number-overlay-editor-D8MSe8ZJ.js} +1 -1
- package/dist/{process-output-xJm8T5-E.js → process-output-ZBdibqlG.js} +2 -2
- package/dist/{reveal-component-Dsp5kSt3.js → reveal-component-CNHAgCQ4.js} +3 -3
- package/dist/style.css +1 -1
- package/dist/{vega-component-DpTyTrz3.js → vega-component-D61CTW1X.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/intersection-observer.ts +45 -0
- package/src/components/databases/engine-variable.tsx +2 -2
- package/src/components/dependency-graph/panels.tsx +2 -2
- package/src/components/editor/actions/useCellActionButton.tsx +2 -8
- package/src/components/editor/cell/code/__tests__/code-placeholder.test.tsx +40 -0
- package/src/components/editor/cell/code/cell-editor.tsx +41 -104
- package/src/components/editor/cell/code/code-placeholder.css +61 -11
- package/src/components/editor/cell/code/code-placeholder.tsx +52 -29
- package/src/components/editor/cell/useSplitCell.tsx +2 -2
- package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +6 -10
- package/src/components/editor/errors/auto-fix.tsx +8 -7
- package/src/components/editor/navigation/__tests__/navigation.test.ts +3 -12
- package/src/components/editor/navigation/focus-utils.ts +20 -8
- package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +3 -11
- package/src/components/editor/navigation/navigation.ts +2 -2
- package/src/components/editor/notebook-cell.tsx +15 -24
- package/src/components/editor/output/MarimoTracebackOutput.tsx +2 -2
- package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +6 -9
- package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +2 -5
- package/src/components/find-replace/find-replace.tsx +3 -7
- package/src/components/variables/__tests__/variables-table.test.tsx +1 -2
- package/src/core/ai/__tests__/staged-cells.test.ts +6 -39
- package/src/core/ai/staged-cells.ts +2 -20
- package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +15 -13
- package/src/core/ai/tools/edit-notebook-tool.ts +13 -8
- package/src/core/cells/__tests__/cell-editor-view.test.ts +44 -0
- package/src/core/cells/__tests__/cells.test.ts +0 -1
- package/src/core/cells/__tests__/focus.test.ts +1 -7
- package/src/core/cells/__tests__/harness.ts +0 -1
- package/src/core/cells/cells.ts +15 -10
- package/src/core/cells/focus.ts +1 -1
- package/src/core/cells/scrollCellIntoView.ts +4 -14
- package/src/core/cells/utils.ts +0 -13
- package/src/core/codemirror/__tests__/cell-documents.test.ts +79 -0
- package/src/core/codemirror/__tests__/editor-mount-scheduler.test.ts +75 -105
- package/src/core/codemirror/__tests__/format.test.ts +85 -63
- package/src/core/codemirror/__tests__/use-lazy-editor-mount.test.tsx +193 -0
- package/src/core/codemirror/cell-documents.ts +132 -0
- package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +0 -1
- package/src/core/codemirror/copilot/getCodes.ts +3 -14
- package/src/core/codemirror/editor-mount-scheduler.ts +41 -48
- package/src/core/codemirror/extensions.ts +2 -2
- package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +42 -16
- package/src/core/codemirror/find-replace/__tests__/search-highlight.test.ts +30 -0
- package/src/core/codemirror/find-replace/__tests__/unmounted-cells.test.ts +145 -0
- package/src/core/codemirror/find-replace/navigate.ts +88 -129
- package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
- package/src/core/codemirror/find-replace/state.ts +7 -2
- package/src/core/codemirror/format.ts +25 -31
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +8 -9
- package/src/core/codemirror/language/cell-code.ts +7 -0
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +25 -0
- package/src/core/codemirror/lsp/notebook-lsp.ts +6 -16
- package/src/core/codemirror/use-lazy-editor-mount.ts +67 -0
- package/src/core/codemirror/utils.ts +2 -6
- package/src/utils/__tests__/shared-intersection-observer.test.ts +49 -0
- package/src/utils/shared-intersection-observer.ts +53 -0
|
@@ -7,16 +7,16 @@ import { f as s, h as c } from "./tooltip-DSWC_Td_.js";
|
|
|
7
7
|
import { t as l } from "./check-LtjuWmNn.js";
|
|
8
8
|
import { n as u, r as d } from "./assertNever-BHnIohkX.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-D8btoEHk.js";
|
|
10
|
-
import { Bt as p, Ct as m, Dt as h, Et as g, Ft as _, It as ee, Lt as v, Mt as
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { H as
|
|
17
|
-
import { a as
|
|
18
|
-
import { t as
|
|
19
|
-
var
|
|
10
|
+
import { Bt as p, Ct as m, Dt as h, Et as g, Ft as _, It as ee, Lt as v, Mt as y, Ot as b, St as x, Tt as te, Ut as S, f as ne, gn as re, hn as ie, jt as C, mn as ae, vn as oe, yn as se } from "./use-restore-focus-ocw7t85i.js";
|
|
11
|
+
import { n as ce } from "./toast-bhZHUEal.js";
|
|
12
|
+
import { t as le } from "./objects-DCmMvZtn.js";
|
|
13
|
+
import { t as w } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as ue } from "./purify.es-DmnrIjg4.js";
|
|
15
|
+
import { t as de } from "./createReducer-BdiSrxHu.js";
|
|
16
|
+
import { H as fe, N as pe, P as me, _ as he } from "./dist-BIaGGUbU.js";
|
|
17
|
+
import { a as ge, i as _e, l as ve, m as ye, u as be } from "./static-state-DZ1nSa6e.js";
|
|
18
|
+
import { t as xe } from "./capabilities-ba3Dyv8n.js";
|
|
19
|
+
var Se = c("external-link", [
|
|
20
20
|
["path", {
|
|
21
21
|
d: "M15 3h6v6",
|
|
22
22
|
key: "1q9fwt"
|
|
@@ -29,20 +29,20 @@ var Ce = 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
|
+
]), Ce = c("minus", [["path", {
|
|
33
33
|
d: "M5 12h14",
|
|
34
34
|
key: "1ays0h"
|
|
35
|
-
}]]),
|
|
35
|
+
}]]), T = /* @__PURE__ */ e(i(), 1), E = f(), we = Object.defineProperty, D = (e, t) => we(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
|
+
}), Te = "Checkbox", [Ee, De] = oe(Te), [Oe, ke] = Ee(Te);
|
|
39
|
+
function Ae(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] = ie({
|
|
41
41
|
prop: n,
|
|
42
42
|
defaultProp: i ?? !1,
|
|
43
43
|
onChange: c,
|
|
44
|
-
caller:
|
|
45
|
-
}), [m, h] =
|
|
44
|
+
caller: Te
|
|
45
|
+
}), [m, h] = T.useState(null), [g, _] = T.useState(null), [ee, v] = T.useState(null), y = !m || !!o || !!m.closest("form"), b = {
|
|
46
46
|
checked: f,
|
|
47
47
|
disabled: a,
|
|
48
48
|
setChecked: p,
|
|
@@ -54,51 +54,51 @@ function je(e) {
|
|
|
54
54
|
userClick: ee,
|
|
55
55
|
onUserClick: v,
|
|
56
56
|
required: l,
|
|
57
|
-
defaultChecked: !
|
|
58
|
-
isFormControl:
|
|
57
|
+
defaultChecked: !O(i) && i,
|
|
58
|
+
isFormControl: y,
|
|
59
59
|
bubbleInput: g,
|
|
60
60
|
setBubbleInput: _
|
|
61
61
|
};
|
|
62
|
-
return /* @__PURE__ */ (0,
|
|
62
|
+
return /* @__PURE__ */ (0, E.jsx)(Oe, {
|
|
63
63
|
scope: t,
|
|
64
|
-
...
|
|
65
|
-
children:
|
|
64
|
+
...b,
|
|
65
|
+
children: Re(d) ? d(b) : 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
|
+
D(Ae, "CheckboxProvider");
|
|
69
|
+
var je = "CheckboxTrigger", Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
|
|
70
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = ke(je, e), g = r(a, d), _ = T.useRef(l);
|
|
71
|
+
return T.useEffect(() => {
|
|
72
72
|
let e = o?.form;
|
|
73
73
|
if (e) {
|
|
74
|
-
let t = /* @__PURE__ */
|
|
74
|
+
let t = /* @__PURE__ */ D(() => f(_.current), "reset");
|
|
75
75
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
76
76
|
}
|
|
77
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
77
|
+
}, [o, f]), /* @__PURE__ */ (0, E.jsx)(se.button, {
|
|
78
78
|
type: "button",
|
|
79
79
|
role: "checkbox",
|
|
80
|
-
"aria-checked":
|
|
80
|
+
"aria-checked": O(l) ? "mixed" : l,
|
|
81
81
|
"aria-required": u,
|
|
82
|
-
"data-state":
|
|
82
|
+
"data-state": ze(l),
|
|
83
83
|
"data-disabled": c ? "" : void 0,
|
|
84
84
|
disabled: c,
|
|
85
85
|
value: s,
|
|
86
86
|
...i,
|
|
87
87
|
ref: g,
|
|
88
|
-
onKeyDown:
|
|
88
|
+
onKeyDown: re(t, (e) => {
|
|
89
89
|
e.key === "Enter" && e.preventDefault();
|
|
90
90
|
}),
|
|
91
|
-
onClick:
|
|
91
|
+
onClick: re(n, (e) => {
|
|
92
92
|
let t = e.isPropagationStopped();
|
|
93
93
|
p({
|
|
94
|
-
requestedChecked:
|
|
94
|
+
requestedChecked: O(l) ? !0 : !l,
|
|
95
95
|
hasConsumerStoppedPropagation: t
|
|
96
|
-
}), f((e) =>
|
|
96
|
+
}), f((e) => O(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
97
97
|
})
|
|
98
98
|
});
|
|
99
|
-
}, "CheckboxTrigger")),
|
|
99
|
+
}, "CheckboxTrigger")), Ne = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
|
|
100
100
|
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
101
|
-
return /* @__PURE__ */ (0,
|
|
101
|
+
return /* @__PURE__ */ (0, E.jsx)(Ae, {
|
|
102
102
|
__scopeCheckbox: n,
|
|
103
103
|
checked: i,
|
|
104
104
|
defaultChecked: a,
|
|
@@ -108,18 +108,18 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
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, E.jsxs)(E.Fragment, { children: [/* @__PURE__ */ (0, E.jsx)(Me, {
|
|
112
112
|
...d,
|
|
113
113
|
ref: t,
|
|
114
114
|
__scopeCheckbox: n
|
|
115
|
-
}), e && /* @__PURE__ */ (0,
|
|
115
|
+
}), e && /* @__PURE__ */ (0, E.jsx)(Le, { __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")), Pe = "CheckboxIndicator", Fe = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
|
|
118
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = ke(Pe, n);
|
|
119
|
+
return /* @__PURE__ */ (0, E.jsx)(ae, {
|
|
120
|
+
present: r || O(a.checked) || a.checked === !0,
|
|
121
|
+
children: /* @__PURE__ */ (0, E.jsx)(se.span, {
|
|
122
|
+
"data-state": ze(a.checked),
|
|
123
123
|
"data-disabled": a.disabled ? "" : void 0,
|
|
124
124
|
...i,
|
|
125
125
|
ref: t,
|
|
@@ -129,33 +129,33 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
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")), Ie = "CheckboxBubbleInput", Le = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
|
|
133
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = ke(Ie, e), _ = r(i, g), ee = s(a), v = T.useRef(!1), y = T.useRef(c), b = T.useRef(o), x = T.useRef(null);
|
|
134
|
+
T.useEffect(() => {
|
|
135
135
|
let e = h;
|
|
136
136
|
if (!e) return;
|
|
137
137
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
138
138
|
if (!n) return;
|
|
139
|
-
let r =
|
|
140
|
-
|
|
141
|
-
let i = o !== null && o !==
|
|
142
|
-
if (
|
|
139
|
+
let r = y.current !== c;
|
|
140
|
+
y.current = c;
|
|
141
|
+
let i = o !== null && o !== b.current;
|
|
142
|
+
if (b.current = o, i) x.current = r ? null : o, r && (e.indeterminate = O(c), n.call(e, !O(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
143
|
else if (r) {
|
|
144
|
-
let t =
|
|
145
|
-
|
|
144
|
+
let t = x.current;
|
|
145
|
+
x.current = null;
|
|
146
146
|
let r = t?.requestedChecked === c;
|
|
147
|
-
v.current = !0, e.indeterminate =
|
|
147
|
+
v.current = !0, e.indeterminate = O(c), n.call(e, !O(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), v.current = !1;
|
|
148
148
|
}
|
|
149
149
|
}, [
|
|
150
150
|
h,
|
|
151
151
|
c,
|
|
152
152
|
o
|
|
153
153
|
]);
|
|
154
|
-
let
|
|
155
|
-
return /* @__PURE__ */ (0,
|
|
154
|
+
let te = T.useRef(!O(c) && c);
|
|
155
|
+
return /* @__PURE__ */ (0, E.jsx)(se.input, {
|
|
156
156
|
type: "checkbox",
|
|
157
157
|
"aria-hidden": !0,
|
|
158
|
-
defaultChecked: l ??
|
|
158
|
+
defaultChecked: l ?? te.current,
|
|
159
159
|
required: u,
|
|
160
160
|
disabled: d,
|
|
161
161
|
name: f,
|
|
@@ -164,7 +164,7 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
164
164
|
...n,
|
|
165
165
|
tabIndex: -1,
|
|
166
166
|
ref: _,
|
|
167
|
-
onClick:
|
|
167
|
+
onClick: re(t, (e) => {
|
|
168
168
|
v.current && e.stopPropagation();
|
|
169
169
|
}),
|
|
170
170
|
style: {
|
|
@@ -178,30 +178,30 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
}, "CheckboxBubbleInput"));
|
|
181
|
-
function
|
|
181
|
+
function Re(e) {
|
|
182
182
|
return typeof e == "function";
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
function
|
|
184
|
+
D(Re, "isFunction");
|
|
185
|
+
function O(e) {
|
|
186
186
|
return e === "indeterminate";
|
|
187
187
|
}
|
|
188
|
-
|
|
189
|
-
function
|
|
190
|
-
return
|
|
188
|
+
D(O, "isIndeterminate");
|
|
189
|
+
function ze(e) {
|
|
190
|
+
return O(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
D(ze, "getState");
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/plugins/core/sanitize-html.ts
|
|
195
|
-
var
|
|
195
|
+
var Be = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
|
|
196
196
|
if (typeof document < "u") {
|
|
197
197
|
let e = "data-temp-href-target";
|
|
198
|
-
|
|
198
|
+
ue.addHook("beforeSanitizeAttributes", (t) => {
|
|
199
199
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
200
|
-
}),
|
|
200
|
+
}), ue.addHook("afterSanitizeAttributes", (t) => {
|
|
201
201
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function Ve(e) {
|
|
205
205
|
let t = {
|
|
206
206
|
USE_PROFILES: {
|
|
207
207
|
html: !0,
|
|
@@ -210,7 +210,7 @@ function He(e) {
|
|
|
210
210
|
},
|
|
211
211
|
ADD_TAGS: ["use"],
|
|
212
212
|
ADD_ATTR: ["href", "xlink:href"],
|
|
213
|
-
ALLOWED_URI_REGEXP:
|
|
213
|
+
ALLOWED_URI_REGEXP: Be,
|
|
214
214
|
FORCE_BODY: !0,
|
|
215
215
|
CUSTOM_ELEMENT_HANDLING: {
|
|
216
216
|
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
@@ -218,59 +218,59 @@ function He(e) {
|
|
|
218
218
|
},
|
|
219
219
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
220
220
|
};
|
|
221
|
-
return
|
|
221
|
+
return ue.sanitize(e, t);
|
|
222
222
|
}
|
|
223
223
|
//#endregion
|
|
224
224
|
//#region src/core/dom/outline.ts
|
|
225
|
-
var
|
|
225
|
+
var He = [
|
|
226
226
|
"marimo-carousel",
|
|
227
227
|
"marimo-tabs",
|
|
228
228
|
"marimo-accordion",
|
|
229
229
|
"marimo-sidebar"
|
|
230
|
-
],
|
|
231
|
-
function
|
|
230
|
+
], Ue = "h1, h2, h3, h4, h5, h6";
|
|
231
|
+
function We(e) {
|
|
232
232
|
if (typeof DOMParser > "u") return null;
|
|
233
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
233
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Ue);
|
|
234
234
|
for (let e of Array.from(n)) {
|
|
235
235
|
let n = e.textContent;
|
|
236
|
-
if (
|
|
236
|
+
if (He.some((t) => e.closest(t)) || !n) continue;
|
|
237
237
|
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
238
238
|
name: n,
|
|
239
239
|
level: r,
|
|
240
|
-
by:
|
|
240
|
+
by: Ke(e)
|
|
241
241
|
};
|
|
242
|
-
i !== n && (a.html =
|
|
242
|
+
i !== n && (a.html = Ve(i)), t.push(a);
|
|
243
243
|
}
|
|
244
244
|
return { items: t };
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function Ge(e) {
|
|
247
247
|
if (!e.includes("\"")) return `"${e}"`;
|
|
248
248
|
if (!e.includes("'")) return `'${e}'`;
|
|
249
249
|
let t = e.split("\""), n = [];
|
|
250
250
|
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
251
251
|
return `concat(${n.join(", ")})`;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function Ke(e) {
|
|
254
254
|
let t = e.id;
|
|
255
255
|
if (t) return { id: t };
|
|
256
256
|
let n = e.textContent ?? "";
|
|
257
|
-
return { path: `//${e.tagName}[contains(., ${
|
|
257
|
+
return { path: `//${e.tagName}[contains(., ${Ge(n)})]` };
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function qe(e) {
|
|
260
260
|
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function Je(e) {
|
|
263
263
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
264
264
|
try {
|
|
265
|
-
return
|
|
265
|
+
return w(typeof e.data == "string", "expected string"), We(e.data);
|
|
266
266
|
} catch {
|
|
267
267
|
return t.error("Failed to parse outline"), null;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Ye(e) {
|
|
271
271
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Xe(e, n) {
|
|
274
274
|
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
275
275
|
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
276
276
|
let a = r(i), o = e + 1;
|
|
@@ -283,18 +283,18 @@ function Ze(e, n) {
|
|
|
283
283
|
}
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/core/notebook/replica/connection.ts
|
|
286
|
-
var
|
|
286
|
+
var k = {
|
|
287
287
|
NOT_STARTED: "NOT_STARTED",
|
|
288
288
|
CONNECTING: "CONNECTING",
|
|
289
289
|
OPEN: "OPEN",
|
|
290
290
|
CLOSED: "CLOSED"
|
|
291
|
-
},
|
|
291
|
+
}, Ze = {
|
|
292
292
|
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
293
293
|
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
294
294
|
};
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/core/notebook/replica/execution-state.ts
|
|
297
|
-
function
|
|
297
|
+
function A(e) {
|
|
298
298
|
let { state: t } = e.record;
|
|
299
299
|
return t.status === "completed" && t.outcome.kind !== "succeeded" ? t.outcome : e.output === null ? t.status === "completed" ? {
|
|
300
300
|
kind: "output",
|
|
@@ -304,18 +304,18 @@ function k(e) {
|
|
|
304
304
|
media: e.output.media
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function j(e) {
|
|
308
308
|
return e.state.status === "queued" ? null : e.state.started_at;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function M(e) {
|
|
311
311
|
return e.state.status === "completed" ? e.state.completed_at : null;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Qe(e) {
|
|
314
314
|
return e.state.status === "completed" ? e.state.depends_on : {};
|
|
315
315
|
}
|
|
316
316
|
//#endregion
|
|
317
317
|
//#region src/core/notebook/replica/resources/results.ts
|
|
318
|
-
function
|
|
318
|
+
function $e(e, t) {
|
|
319
319
|
let { record: n, output: r, outputVersion: i } = t, a = n.cell_id;
|
|
320
320
|
return a === null || n.state.status !== "completed" || !e.has(a) || n.state.outcome.kind === "skipped" && n.state.outcome.reason === "superseded" ? e : new Map(e).set(a, {
|
|
321
321
|
record: n,
|
|
@@ -323,10 +323,10 @@ function et(e, t) {
|
|
|
323
323
|
outputVersion: i
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function et(e, t) {
|
|
327
327
|
let { record: n, output: r, outputVersion: i } = t;
|
|
328
|
-
if (n.cell_id !== null ||
|
|
329
|
-
let a = (e) => Date.parse(
|
|
328
|
+
if (n.cell_id !== null || A(t) === null) return e;
|
|
329
|
+
let a = (e) => Date.parse(M(e) ?? j(e) ?? "1970-01-01T00:00:00Z");
|
|
330
330
|
return e !== null && a(e.record) > a(n) ? e : {
|
|
331
331
|
record: n,
|
|
332
332
|
output: r,
|
|
@@ -335,7 +335,7 @@ function tt(e, t) {
|
|
|
335
335
|
}
|
|
336
336
|
//#endregion
|
|
337
337
|
//#region src/core/notebook/replica/resources/executions.ts
|
|
338
|
-
function
|
|
338
|
+
function tt(e) {
|
|
339
339
|
let { state: t } = e;
|
|
340
340
|
return t.status === "completed" && t.outcome.kind === "failed" && t.outcome.message !== null ? {
|
|
341
341
|
runId: e.id,
|
|
@@ -343,50 +343,50 @@ function nt(e) {
|
|
|
343
343
|
completedAt: t.completed_at
|
|
344
344
|
} : void 0;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function nt(e) {
|
|
347
347
|
return [...e.items.values()].toSorted((e, t) => e.seq - t.seq);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function N(e, t) {
|
|
350
350
|
if (!e.has(t)) return e;
|
|
351
351
|
let n = new Map(e);
|
|
352
352
|
return n.delete(t), n;
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a =
|
|
354
|
+
function rt(e, t) {
|
|
355
|
+
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a = j(t.record);
|
|
356
356
|
if (i !== null || a === null) return n;
|
|
357
357
|
if (!n || n.record.id === r) return t;
|
|
358
358
|
let o = e.executions.get(r);
|
|
359
|
-
return o &&
|
|
359
|
+
return o && j(o.record) !== null ? n : Date.parse(a) >= Date.parse(j(n.record) ?? "") ? t : n;
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function it(e, t) {
|
|
362
362
|
let { id: n, cell_id: r } = t.record;
|
|
363
363
|
return {
|
|
364
364
|
...e,
|
|
365
365
|
executions: new Map(e.executions).set(n, t),
|
|
366
|
-
scratchConsole:
|
|
366
|
+
scratchConsole: rt(e, t),
|
|
367
367
|
latest: r === null || e.latest.get(r) === n ? e.latest : new Map(e.latest).set(r, n)
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function at(e, t) {
|
|
371
371
|
let n = e.executions.get(t);
|
|
372
372
|
if (n === void 0) return e;
|
|
373
373
|
let r = n.record.cell_id, i = r !== null && e.latest.get(r) === t;
|
|
374
374
|
return {
|
|
375
375
|
...e,
|
|
376
|
-
executions:
|
|
377
|
-
variables: i ?
|
|
376
|
+
executions: N(e.executions, t),
|
|
377
|
+
variables: i ? N(e.variables, r) : e.variables,
|
|
378
378
|
scratchConsole: e.scratchConsole?.record.id === t ? void 0 : e.scratchConsole,
|
|
379
|
-
latest: i ?
|
|
379
|
+
latest: i ? N(e.latest, r) : e.latest
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function ot(e, t) {
|
|
383
383
|
let n = e.executions.get(t.execution_id);
|
|
384
384
|
if (n === void 0) return e;
|
|
385
385
|
let r = n.items.get(t.id);
|
|
386
386
|
return r && (t = {
|
|
387
387
|
...t,
|
|
388
388
|
time: r.time
|
|
389
|
-
}),
|
|
389
|
+
}), it(e, {
|
|
390
390
|
...n,
|
|
391
391
|
append: !r && t.seq > (n.lastSeq ?? -1) ? {
|
|
392
392
|
before: new WeakRef(n.items),
|
|
@@ -396,15 +396,15 @@ function st(e, t) {
|
|
|
396
396
|
items: new Map(n.items).set(t.id, t)
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
|
-
function
|
|
400
|
-
for (let n of e.executions.values()) if (n.items.has(t)) return
|
|
399
|
+
function st(e, t) {
|
|
400
|
+
for (let n of e.executions.values()) if (n.items.has(t)) return it(e, {
|
|
401
401
|
...n,
|
|
402
402
|
append: void 0,
|
|
403
|
-
items:
|
|
403
|
+
items: N(n.items, t)
|
|
404
404
|
});
|
|
405
405
|
return e;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function ct(e, t) {
|
|
408
408
|
let n = e.executions.get(t.execution_id)?.record.cell_id;
|
|
409
409
|
if (n == null) return e;
|
|
410
410
|
let r = new Map(e.variables.get(n)).set(t.id, t);
|
|
@@ -413,33 +413,33 @@ function lt(e, t) {
|
|
|
413
413
|
variables: new Map(e.variables).set(n, r)
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function lt(e, t) {
|
|
417
417
|
for (let [n, r] of e.variables) if (r.has(t)) {
|
|
418
418
|
let i = new Map(e.variables);
|
|
419
|
-
return r.size === 1 ? i.delete(n) : i.set(n,
|
|
419
|
+
return r.size === 1 ? i.delete(n) : i.set(n, N(r, t)), {
|
|
420
420
|
...e,
|
|
421
421
|
variables: i
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
424
|
return e;
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
return JSON.stringify(
|
|
426
|
+
function ut(e, t) {
|
|
427
|
+
return JSON.stringify(A(e)) === JSON.stringify(A(t));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function dt(e, t) {
|
|
430
430
|
return {
|
|
431
|
-
...
|
|
432
|
-
results:
|
|
433
|
-
scratch:
|
|
431
|
+
...it(e, t),
|
|
432
|
+
results: $e(e.results, t),
|
|
433
|
+
scratch: et(e.scratch, t)
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function ft(e, t, n) {
|
|
437
437
|
let r = new Map(e.executions);
|
|
438
438
|
for (let [e, n] of r) {
|
|
439
439
|
let i = n.record.cell_id === null ? t.scratch : t.results.get(n.record.cell_id), a = t.executions.get(e) ?? (i?.record.id === e ? i : void 0);
|
|
440
440
|
a !== void 0 && r.set(e, {
|
|
441
441
|
...n,
|
|
442
|
-
outputVersion: a.outputVersion + +!
|
|
442
|
+
outputVersion: a.outputVersion + +!ut(a, n)
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
let i = new Map(e.results);
|
|
@@ -457,10 +457,10 @@ function pt(e, t, n) {
|
|
|
457
457
|
executions: r,
|
|
458
458
|
results: i,
|
|
459
459
|
scratchConsole: e.scratchConsole ?? (t.scratchConsole?.record.state.status === "completed" && t.scratchConsole.record.runtime_id === n ? t.scratchConsole : void 0),
|
|
460
|
-
scratch: a == null ? t.scratch :
|
|
460
|
+
scratch: a == null ? t.scratch : et(t.scratch, a)
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
|
-
var
|
|
463
|
+
var pt = {
|
|
464
464
|
initial: {
|
|
465
465
|
runs: /* @__PURE__ */ new Map(),
|
|
466
466
|
executions: /* @__PURE__ */ new Map(),
|
|
@@ -476,31 +476,31 @@ var mt = {
|
|
|
476
476
|
},
|
|
477
477
|
"cell.removed": (e, { data: t }) => ({
|
|
478
478
|
...e,
|
|
479
|
-
results:
|
|
479
|
+
results: N(e.results, t.id)
|
|
480
480
|
}),
|
|
481
481
|
run: (e, { data: t }) => ({
|
|
482
482
|
...e,
|
|
483
483
|
runs: new Map(e.runs).set(t.run.id, t.run),
|
|
484
|
-
scratchFailure: t.run.origin.kind === "code" ?
|
|
484
|
+
scratchFailure: t.run.origin.kind === "code" ? tt(t.run) : e.scratchFailure
|
|
485
485
|
}),
|
|
486
486
|
"run.removed": (e, { data: t }) => e.runs.has(t.id) ? {
|
|
487
487
|
...e,
|
|
488
|
-
runs:
|
|
488
|
+
runs: N(e.runs, t.id)
|
|
489
489
|
} : e,
|
|
490
490
|
execution: (e, { data: { execution: t } }) => {
|
|
491
491
|
let n = e.executions.get(t.id), r = {
|
|
492
492
|
record: t,
|
|
493
493
|
output: n?.output ?? null
|
|
494
494
|
};
|
|
495
|
-
return
|
|
495
|
+
return dt(e, {
|
|
496
496
|
...r,
|
|
497
|
-
outputVersion: n === void 0 ? 0 : n.outputVersion + +!
|
|
497
|
+
outputVersion: n === void 0 ? 0 : n.outputVersion + +!ut(n, r),
|
|
498
498
|
append: n?.append,
|
|
499
499
|
lastSeq: n?.lastSeq,
|
|
500
500
|
items: n?.items ?? /* @__PURE__ */ new Map()
|
|
501
501
|
});
|
|
502
502
|
},
|
|
503
|
-
"execution.removed": (e, { data: t }) =>
|
|
503
|
+
"execution.removed": (e, { data: t }) => at(e, t.id),
|
|
504
504
|
output: (e, { data: { output: t } }) => {
|
|
505
505
|
let n = e.executions.get(t.execution_id);
|
|
506
506
|
if (n === void 0) return e;
|
|
@@ -508,31 +508,31 @@ var mt = {
|
|
|
508
508
|
...n,
|
|
509
509
|
output: t
|
|
510
510
|
};
|
|
511
|
-
return
|
|
511
|
+
return dt(e, {
|
|
512
512
|
...r,
|
|
513
|
-
outputVersion: n.outputVersion + +!
|
|
513
|
+
outputVersion: n.outputVersion + +!ut(n, r)
|
|
514
514
|
});
|
|
515
515
|
},
|
|
516
516
|
"output.removed": (e) => e,
|
|
517
|
-
console: (e, { data: t }) =>
|
|
517
|
+
console: (e, { data: t }) => ot(e, {
|
|
518
518
|
...t.console,
|
|
519
519
|
kind: "console",
|
|
520
520
|
time: t.time
|
|
521
521
|
}),
|
|
522
|
-
"console.removed": (e, { data: t }) =>
|
|
523
|
-
input: (e, { data: t }) =>
|
|
522
|
+
"console.removed": (e, { data: t }) => st(e, t.id),
|
|
523
|
+
input: (e, { data: t }) => ot(e, {
|
|
524
524
|
...t.input,
|
|
525
525
|
kind: "input",
|
|
526
526
|
time: t.time
|
|
527
527
|
}),
|
|
528
|
-
variable: (e, { data: t }) =>
|
|
529
|
-
"variable.removed": (e, { data: t }) =>
|
|
528
|
+
variable: (e, { data: t }) => ct(e, t.variable),
|
|
529
|
+
"variable.removed": (e, { data: t }) => lt(e, t.id)
|
|
530
530
|
}
|
|
531
|
-
},
|
|
531
|
+
}, mt = {
|
|
532
532
|
sourceChanged: !1,
|
|
533
533
|
inputsChanged: !1
|
|
534
534
|
};
|
|
535
|
-
function
|
|
535
|
+
function ht(e) {
|
|
536
536
|
let t = /* @__PURE__ */ new Map();
|
|
537
537
|
for (let n of e.variables.values()) for (let e of n.values()) {
|
|
538
538
|
let n = t.get(e.name);
|
|
@@ -540,18 +540,18 @@ function gt(e) {
|
|
|
540
540
|
}
|
|
541
541
|
return t;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
544
|
-
let t =
|
|
543
|
+
function gt(e) {
|
|
544
|
+
let t = ht(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
545
545
|
function i(e, n) {
|
|
546
546
|
let i = new Set(n).add(e.id);
|
|
547
|
-
for (let [n, a] of Object.entries(
|
|
547
|
+
for (let [n, a] of Object.entries(Qe(e))) {
|
|
548
548
|
let s = t.get(n) ?? [];
|
|
549
549
|
if (a === null) {
|
|
550
550
|
if (s.some((t) => {
|
|
551
551
|
let n = r(t.execution_id);
|
|
552
552
|
if (n === void 0) return !1;
|
|
553
553
|
if (n.runtime_id === e.runtime_id) return !0;
|
|
554
|
-
let i =
|
|
554
|
+
let i = M(n) ?? j(n), a = M(e);
|
|
555
555
|
return i !== null && a !== null && Date.parse(i) > Date.parse(a);
|
|
556
556
|
})) return !0;
|
|
557
557
|
continue;
|
|
@@ -578,50 +578,50 @@ function _t(e) {
|
|
|
578
578
|
}
|
|
579
579
|
return (t) => {
|
|
580
580
|
let n = e.results.get(t)?.record;
|
|
581
|
-
return n == null ?
|
|
581
|
+
return n == null ? mt : o(n, /* @__PURE__ */ new Set());
|
|
582
582
|
};
|
|
583
583
|
}
|
|
584
584
|
//#endregion
|
|
585
585
|
//#region src/core/executions/output.ts
|
|
586
|
-
var
|
|
587
|
-
function
|
|
586
|
+
var _t = /* @__PURE__ */ new Map(), vt = "application/vnd.marimo+error";
|
|
587
|
+
function yt(e) {
|
|
588
588
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
589
589
|
cell_id: e,
|
|
590
590
|
message: t
|
|
591
591
|
}));
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function bt(e) {
|
|
594
594
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
return
|
|
596
|
+
function xt(e) {
|
|
597
|
+
return bt(M(e) ?? j(e));
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function St(e, t) {
|
|
600
600
|
return {
|
|
601
601
|
channel: "output",
|
|
602
602
|
mimetype: t.mimetype,
|
|
603
603
|
data: t.data,
|
|
604
|
-
timestamp:
|
|
604
|
+
timestamp: xt(e)
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function P(e, t) {
|
|
608
608
|
return {
|
|
609
609
|
channel: "marimo-error",
|
|
610
|
-
mimetype:
|
|
610
|
+
mimetype: vt,
|
|
611
611
|
data: t,
|
|
612
|
-
timestamp:
|
|
612
|
+
timestamp: xt(e)
|
|
613
613
|
};
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function Ct(e) {
|
|
616
616
|
return e.related.at(0)?.cell_id ?? null;
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function wt(e) {
|
|
619
619
|
switch (e.kind) {
|
|
620
620
|
case "exception": return {
|
|
621
621
|
type: "exception",
|
|
622
622
|
exception_type: e.name ?? "Exception",
|
|
623
623
|
msg: e.message,
|
|
624
|
-
raising_cell:
|
|
624
|
+
raising_cell: Ct(e),
|
|
625
625
|
traceback: e.traceback?.data ?? null
|
|
626
626
|
};
|
|
627
627
|
case "invalid-syntax": return {
|
|
@@ -638,78 +638,78 @@ function Tt(e) {
|
|
|
638
638
|
type: "diagnostic",
|
|
639
639
|
kind: e.kind,
|
|
640
640
|
msg: e.message,
|
|
641
|
-
related:
|
|
641
|
+
related: yt(e.related)
|
|
642
642
|
};
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
function
|
|
645
|
+
function Tt(e, t) {
|
|
646
646
|
let n = t.related[0];
|
|
647
|
-
if (n !== void 0 && t.reason === "upstream-stopped") return
|
|
647
|
+
if (n !== void 0 && t.reason === "upstream-stopped") return P(e, [{
|
|
648
648
|
type: "ancestor-stopped",
|
|
649
649
|
msg: t.message,
|
|
650
650
|
raising_cell: n.cell_id
|
|
651
651
|
}]);
|
|
652
652
|
if (n !== void 0 && t.reason === "upstream-failed") {
|
|
653
653
|
let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
|
|
654
|
-
return
|
|
654
|
+
return P(e, [{
|
|
655
655
|
type: "ancestor-prevented",
|
|
656
656
|
msg: t.message,
|
|
657
657
|
raising_cell: n.cell_id,
|
|
658
658
|
blamed_cell: r === void 0 ? null : r.cell_id
|
|
659
659
|
}]);
|
|
660
660
|
}
|
|
661
|
-
return
|
|
661
|
+
return P(e, [{
|
|
662
662
|
type: "diagnostic",
|
|
663
663
|
kind: t.reason,
|
|
664
664
|
msg: t.message,
|
|
665
|
-
related:
|
|
665
|
+
related: yt(t.related)
|
|
666
666
|
}]);
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function Et(e, t = _t) {
|
|
669
669
|
let n = e.cell_id === null ? void 0 : t.get(e.cell_id);
|
|
670
670
|
return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
|
|
671
671
|
}
|
|
672
|
-
function
|
|
673
|
-
let n =
|
|
672
|
+
function Dt(e, t = _t) {
|
|
673
|
+
let n = Ot(e), r = Et(e.record, t);
|
|
674
674
|
return n === null || r === void 0 ? n : {
|
|
675
675
|
...n,
|
|
676
676
|
code: r
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
let { record: t } = e, n =
|
|
679
|
+
function Ot(e) {
|
|
680
|
+
let { record: t } = e, n = A(e);
|
|
681
681
|
if (n === null) return null;
|
|
682
682
|
switch (n.kind) {
|
|
683
|
-
case "output": return n.media === null ? null :
|
|
684
|
-
case "failed": return
|
|
685
|
-
case "cancelled": return
|
|
686
|
-
case "skipped": return
|
|
683
|
+
case "output": return n.media === null ? null : St(t, n.media);
|
|
684
|
+
case "failed": return P(t, [wt(n.error)]);
|
|
685
|
+
case "cancelled": return P(t, [{ type: "interruption" }]);
|
|
686
|
+
case "skipped": return Tt(t, n);
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
function
|
|
689
|
+
function kt(e, t) {
|
|
690
690
|
let n = e.executions.latest.get(t), r = n === void 0 ? void 0 : e.executions.executions.get(n);
|
|
691
|
-
if (r !== void 0 &&
|
|
691
|
+
if (r !== void 0 && A(r) !== null && r.record.state.status !== "completed") return r;
|
|
692
692
|
let i = e.results.get(t) ?? null;
|
|
693
|
-
return r?.record.state.status === "running" && i !== null &&
|
|
693
|
+
return r?.record.state.status === "running" && i !== null && A(i)?.kind === "skipped" ? null : i;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function At(e, t) {
|
|
696
696
|
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
let n =
|
|
700
|
-
return n === null ||
|
|
698
|
+
function jt(e, t) {
|
|
699
|
+
let n = kt(e, t);
|
|
700
|
+
return n === null || At(e.cleared.get(t), n) ? null : Dt(n, e.cells);
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function Mt(e) {
|
|
703
703
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
|
|
704
704
|
for (let r of n) {
|
|
705
|
-
let n =
|
|
705
|
+
let n = jt(e, r);
|
|
706
706
|
n !== null && t.set(r, n);
|
|
707
707
|
}
|
|
708
708
|
return t;
|
|
709
709
|
}
|
|
710
710
|
//#endregion
|
|
711
711
|
//#region src/utils/time.ts
|
|
712
|
-
var
|
|
712
|
+
var Nt = class e {
|
|
713
713
|
ms;
|
|
714
714
|
static fromMilliseconds(t) {
|
|
715
715
|
return t == null ? null : new e(t);
|
|
@@ -738,17 +738,17 @@ var Pt = class e {
|
|
|
738
738
|
};
|
|
739
739
|
//#endregion
|
|
740
740
|
//#region src/core/executions/select.ts
|
|
741
|
-
function
|
|
741
|
+
function Pt(e) {
|
|
742
742
|
return e.state.status === "completed" ? e.state.outcome.kind : null;
|
|
743
743
|
}
|
|
744
|
-
function
|
|
745
|
-
return e === null ? null :
|
|
744
|
+
function Ft(e) {
|
|
745
|
+
return e === null ? null : Nt.parse(e).toMilliseconds();
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function It(e, t) {
|
|
748
748
|
let n = e.latest.get(t);
|
|
749
749
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
750
750
|
}
|
|
751
|
-
function
|
|
751
|
+
function Lt(e, t) {
|
|
752
752
|
let n = /* @__PURE__ */ new Set(), r = [...t], i = r.filter((e) => e.config.disabled);
|
|
753
753
|
if (i.length === 0) return n;
|
|
754
754
|
let a = new Map(r.map(({ id: e }) => [e, []]));
|
|
@@ -773,61 +773,61 @@ function Rt(e, t) {
|
|
|
773
773
|
}
|
|
774
774
|
return n;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Rt(e, t) {
|
|
777
777
|
let n = e.cells.get(t);
|
|
778
778
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
779
779
|
}
|
|
780
|
-
function
|
|
781
|
-
if (!
|
|
780
|
+
function zt(e, t) {
|
|
781
|
+
if (!Rt(e, t)) return !1;
|
|
782
782
|
if (e.requested.has(t)) return !0;
|
|
783
|
-
let n =
|
|
783
|
+
let n = It(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id;
|
|
784
784
|
for (let r of e.executions.runs.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" && r.origin.cell_ids.includes(t)) return !0;
|
|
785
785
|
return !1;
|
|
786
786
|
}
|
|
787
|
-
function
|
|
788
|
-
let n =
|
|
789
|
-
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s =
|
|
790
|
-
let c = i === "idle", l = c && a !== null && o !== null ?
|
|
787
|
+
function Bt(e, t) {
|
|
788
|
+
let n = It(e.executions, t), r = e.results.get(t)?.record ?? null, i = "idle", a = r === null ? null : j(r), o = r === null ? null : M(r), s = Ft(a);
|
|
789
|
+
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s = Ft(j(n.record)) ?? s) : zt(e, t) && (i = "queued");
|
|
790
|
+
let c = i === "idle", l = c && a !== null && o !== null ? Nt.parse(o).since(Nt.parse(a)) : null, u = e.blocked.has(t);
|
|
791
791
|
return {
|
|
792
792
|
status: i,
|
|
793
793
|
blocked: u,
|
|
794
794
|
shownBlock: u ? "current" : e.shownBlocked.has(t) ? "stale" : null,
|
|
795
|
-
outcome: c && r !== null ?
|
|
795
|
+
outcome: c && r !== null ? Pt(r) : null,
|
|
796
796
|
live: r === null || e.runtimeId === null || r.runtime_id === e.runtimeId,
|
|
797
797
|
startedAt: s,
|
|
798
798
|
duration: l
|
|
799
799
|
};
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Vt(e) {
|
|
802
802
|
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
803
803
|
}
|
|
804
|
-
function
|
|
805
|
-
return
|
|
804
|
+
function Ht(e) {
|
|
805
|
+
return Vt(e).some((e) => e.record.state.status === "running");
|
|
806
806
|
}
|
|
807
|
-
function
|
|
808
|
-
let t =
|
|
807
|
+
function Ut(e) {
|
|
808
|
+
let t = Vt(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
809
809
|
for (let t of e.executions.runs.values()) if (t.state.status !== "completed" && t.origin.kind === "cells") for (let e of t.origin.cell_ids) r.add(e);
|
|
810
810
|
let i = 0;
|
|
811
|
-
for (let t of r) !n.has(t) &&
|
|
811
|
+
for (let t of r) !n.has(t) && zt(e, t) && (i += 1);
|
|
812
812
|
return t.length + i;
|
|
813
813
|
}
|
|
814
814
|
//#endregion
|
|
815
815
|
//#region src/core/executions/atoms.ts
|
|
816
|
-
var
|
|
816
|
+
var Wt = {
|
|
817
817
|
variables: /* @__PURE__ */ new Map(),
|
|
818
818
|
runs: /* @__PURE__ */ new Map(),
|
|
819
819
|
executions: /* @__PURE__ */ new Map(),
|
|
820
820
|
latest: /* @__PURE__ */ new Map(),
|
|
821
821
|
results: /* @__PURE__ */ new Map(),
|
|
822
822
|
scratch: null
|
|
823
|
-
},
|
|
823
|
+
}, Gt = /* @__PURE__ */ new Map(), Kt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Set(), Jt = /* @__PURE__ */ new Set(), Yt = /* @__PURE__ */ new Set(), Xt = /* @__PURE__ */ new Map(), F = S(null);
|
|
824
824
|
function Zt(e, t) {
|
|
825
825
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
826
826
|
}
|
|
827
827
|
function Qt(e, t, n) {
|
|
828
828
|
return e !== null && Zt(e.notebook, t) ? e.value : n;
|
|
829
829
|
}
|
|
830
|
-
var I =
|
|
830
|
+
var I = S((e) => {
|
|
831
831
|
let t = e(h), n = t === null ? null : e(t.notebookAtom);
|
|
832
832
|
return t === null || n === null ? null : {
|
|
833
833
|
replica: t,
|
|
@@ -838,60 +838,60 @@ var I = x((e) => {
|
|
|
838
838
|
function $t(e, t) {
|
|
839
839
|
return Zt(t.notebook, e.get(I));
|
|
840
840
|
}
|
|
841
|
-
var en =
|
|
841
|
+
var en = S((e) => {
|
|
842
842
|
let t = Qt(e(F), e(I), qt);
|
|
843
843
|
return t.size === 0 ? Jt : new Set([...t].flatMap((e) => e.cells));
|
|
844
|
-
}), tn =
|
|
845
|
-
let t = e(h), n = t && e(t.analysisAtom), r = n ?
|
|
844
|
+
}), tn = S((e) => {
|
|
845
|
+
let t = e(h), n = t && e(t.analysisAtom), r = n ? Lt(n.analysis, n.document.cells.values()) : Yt;
|
|
846
846
|
return {
|
|
847
847
|
shownBlocked: r,
|
|
848
848
|
blocked: n?.freshness === "current" ? r : Yt
|
|
849
849
|
};
|
|
850
|
-
}), L =
|
|
850
|
+
}), L = S((e) => {
|
|
851
851
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
852
852
|
return {
|
|
853
|
-
executions: t === null ?
|
|
854
|
-
results: t === null ?
|
|
855
|
-
cells: n?.cells ??
|
|
853
|
+
executions: t === null ? Wt : e(t.executionsAtom),
|
|
854
|
+
results: t === null ? Gt : e(t.resultsAtom),
|
|
855
|
+
cells: n?.cells ?? Kt,
|
|
856
856
|
requested: e(en),
|
|
857
857
|
...e(tn),
|
|
858
858
|
runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
|
|
859
859
|
};
|
|
860
|
-
}), nn =
|
|
860
|
+
}), nn = S((e) => {
|
|
861
861
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
862
862
|
return t === null || n === null ? {
|
|
863
|
-
cells:
|
|
864
|
-
executions:
|
|
865
|
-
results:
|
|
863
|
+
cells: Kt,
|
|
864
|
+
executions: Wt,
|
|
865
|
+
results: Gt
|
|
866
866
|
} : {
|
|
867
867
|
cells: n.cells,
|
|
868
868
|
executions: e(t.executionsAtom),
|
|
869
869
|
results: e(t.resultsAtom)
|
|
870
870
|
};
|
|
871
|
-
}), rn =
|
|
871
|
+
}), rn = S((e) => gt(e(nn))), an = S(null), on = S((e) => {
|
|
872
872
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
873
873
|
return t === null || n === null ? null : {
|
|
874
874
|
replica: t,
|
|
875
875
|
id: n.revision.notebook_id,
|
|
876
876
|
generation: e(t.generationAtom)
|
|
877
877
|
};
|
|
878
|
-
}), sn =
|
|
878
|
+
}), sn = S((e) => {
|
|
879
879
|
let t = e(h);
|
|
880
880
|
return {
|
|
881
|
-
executions: t === null ?
|
|
882
|
-
results: t === null ?
|
|
881
|
+
executions: t === null ? Wt : e(t.executionsAtom),
|
|
882
|
+
results: t === null ? Gt : e(t.resultsAtom),
|
|
883
883
|
cleared: Qt(e(an), e(on), Xt),
|
|
884
|
-
cells: t === null ?
|
|
884
|
+
cells: t === null ? Kt : e(t.documentAtom)?.cells ?? Kt
|
|
885
885
|
};
|
|
886
|
-
}), cn =
|
|
886
|
+
}), cn = S((e) => Mt(e(sn))), R = C((e) => _(cn, (t) => t.get(e) ?? null, v)), z = C((e) => S((t) => Je(t(R(e)))));
|
|
887
887
|
function ln(e) {
|
|
888
888
|
R.remove(e), z.remove(e);
|
|
889
889
|
}
|
|
890
890
|
function un(e, t) {
|
|
891
891
|
let n = e.get(sn), r = new Map(n.cleared);
|
|
892
892
|
for (let e of t) {
|
|
893
|
-
let t =
|
|
894
|
-
t != null &&
|
|
893
|
+
let t = kt(n, e);
|
|
894
|
+
t != null && A(t) !== null && r.set(e, {
|
|
895
895
|
execution: t.record.id,
|
|
896
896
|
version: t.outputVersion
|
|
897
897
|
});
|
|
@@ -902,15 +902,15 @@ function un(e, t) {
|
|
|
902
902
|
value: r
|
|
903
903
|
});
|
|
904
904
|
}
|
|
905
|
-
var dn =
|
|
905
|
+
var dn = S((e) => {
|
|
906
906
|
let t = e(h);
|
|
907
907
|
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
908
908
|
});
|
|
909
|
-
|
|
910
|
-
var fn =
|
|
909
|
+
S((e) => Ht(e(L).executions)), S((e) => Ut(e(L)));
|
|
910
|
+
var fn = S((e) => {
|
|
911
911
|
let t = e(h);
|
|
912
912
|
if (t === null) return { refused: "No notebook is connected" };
|
|
913
|
-
if (e(t.connectionAtom).state ===
|
|
913
|
+
if (e(t.connectionAtom).state === k.CLOSED) return { refused: "The notebook is disconnected" };
|
|
914
914
|
if (e(t.notebookAtom) === null) return "waiting";
|
|
915
915
|
let n = e(t.runtimeAtom);
|
|
916
916
|
if (n === null) return { refused: "The notebook has no runtime" };
|
|
@@ -955,7 +955,7 @@ function hn(e, t) {
|
|
|
955
955
|
});
|
|
956
956
|
}
|
|
957
957
|
function gn(e, t, n) {
|
|
958
|
-
let r =
|
|
958
|
+
let r = S((e) => Zt(t.notebook, e(I)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
959
959
|
function a() {
|
|
960
960
|
e.get(r) || (i(), hn(e, t));
|
|
961
961
|
}
|
|
@@ -971,7 +971,7 @@ function vn(e) {
|
|
|
971
971
|
return n;
|
|
972
972
|
};
|
|
973
973
|
}
|
|
974
|
-
var yn = vn(
|
|
974
|
+
var yn = vn(he), bn = vn(me);
|
|
975
975
|
//#endregion
|
|
976
976
|
//#region src/utils/schedule-task.ts
|
|
977
977
|
function xn() {
|
|
@@ -1001,43 +1001,37 @@ var Sn = xn();
|
|
|
1001
1001
|
function Cn(e = Sn) {
|
|
1002
1002
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
1003
1003
|
function i() {
|
|
1004
|
-
r ||
|
|
1004
|
+
r || n.size === 0 || (r = !0, e(s));
|
|
1005
1005
|
}
|
|
1006
|
-
function a() {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1006
|
+
function a(e) {
|
|
1007
|
+
t.delete(e), n.delete(e);
|
|
1008
|
+
}
|
|
1009
|
+
function o(e) {
|
|
1010
|
+
let n = t.get(e);
|
|
1011
|
+
a(e), n?.build();
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1013
|
+
function s() {
|
|
1014
1014
|
r = !1;
|
|
1015
1015
|
try {
|
|
1016
|
-
let e =
|
|
1017
|
-
|
|
1018
|
-
let r = t.get(e);
|
|
1019
|
-
t.delete(e), n.delete(e), r?.();
|
|
1020
|
-
}
|
|
1016
|
+
let e = n.values().next();
|
|
1017
|
+
e.done || o(e.value);
|
|
1021
1018
|
} finally {
|
|
1022
1019
|
i();
|
|
1023
1020
|
}
|
|
1024
1021
|
}
|
|
1025
1022
|
return {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
r && (t.delete(e), n.delete(e), r());
|
|
1023
|
+
register(e, n) {
|
|
1024
|
+
let r = { build: n };
|
|
1025
|
+
return a(e), t.set(e, r), () => {
|
|
1026
|
+
t.get(e) === r && a(e);
|
|
1027
|
+
};
|
|
1032
1028
|
},
|
|
1029
|
+
promote: o,
|
|
1033
1030
|
prioritize(e) {
|
|
1034
|
-
t.has(e) && n.add(e);
|
|
1031
|
+
t.has(e) && (n.add(e), i());
|
|
1035
1032
|
},
|
|
1036
1033
|
deprioritize(e) {
|
|
1037
1034
|
n.delete(e);
|
|
1038
|
-
},
|
|
1039
|
-
cancel(e) {
|
|
1040
|
-
t.delete(e), n.delete(e);
|
|
1041
1035
|
}
|
|
1042
1036
|
};
|
|
1043
1037
|
}
|
|
@@ -1077,7 +1071,7 @@ var On = "object-id", kn = "random-id", An = "abcdefghijklmnopqrstuvwxyz", jn =
|
|
|
1077
1071
|
return Mn.add(t), t;
|
|
1078
1072
|
} }, H = {
|
|
1079
1073
|
create(e) {
|
|
1080
|
-
return
|
|
1074
|
+
return w(e != null, "cellId is required"), `cell-${e}`;
|
|
1081
1075
|
},
|
|
1082
1076
|
parse(e) {
|
|
1083
1077
|
return e.slice(5);
|
|
@@ -1106,7 +1100,7 @@ var In = {
|
|
|
1106
1100
|
},
|
|
1107
1101
|
parseOrThrow(e) {
|
|
1108
1102
|
let t = In.parse(e);
|
|
1109
|
-
return
|
|
1103
|
+
return w(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1110
1104
|
}
|
|
1111
1105
|
}, Ln = { create(e) {
|
|
1112
1106
|
return `output-${e}`;
|
|
@@ -1456,13 +1450,13 @@ function Zn(e, t) {
|
|
|
1456
1450
|
return e instanceof U ? e.appendData(t.data) : U.create(e).appendData(t.data);
|
|
1457
1451
|
}
|
|
1458
1452
|
function Qn(e) {
|
|
1459
|
-
|
|
1453
|
+
w(typeof e.data == "string", "expected string output");
|
|
1460
1454
|
}
|
|
1461
1455
|
function $n(e, t) {
|
|
1462
1456
|
let n = 0, r;
|
|
1463
1457
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1464
1458
|
let t = e[r];
|
|
1465
|
-
t.mimetype === "text/plain" ? (
|
|
1459
|
+
t.mimetype === "text/plain" ? (w(typeof t.data == "string", "expected string"), n += t instanceof U ? t.lineCount : t.data.split("\n").length) : n++;
|
|
1466
1460
|
}
|
|
1467
1461
|
if (n < t) return e;
|
|
1468
1462
|
let i = r + 1, a = [{
|
|
@@ -1473,7 +1467,7 @@ function $n(e, t) {
|
|
|
1473
1467
|
}, ...e.slice(0, i).filter((e) => e.channel === "stdin" && e.response === void 0)], o = e[i];
|
|
1474
1468
|
if (o?.channel === "stdin" && o.response === void 0) return [...a, ...e.slice(i)];
|
|
1475
1469
|
if (o?.mimetype === "text/plain") {
|
|
1476
|
-
|
|
1470
|
+
w(typeof o.data == "string", "expected string");
|
|
1477
1471
|
let r = n - t, s = o instanceof U ? o.dropFirstLines(r) : {
|
|
1478
1472
|
...o,
|
|
1479
1473
|
data: o.data.split("\n").slice(r).join("\n")
|
|
@@ -1489,7 +1483,7 @@ function $n(e, t) {
|
|
|
1489
1483
|
//#endregion
|
|
1490
1484
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1491
1485
|
function er(e, t) {
|
|
1492
|
-
return
|
|
1486
|
+
return be(e * 1e3, t?.in);
|
|
1493
1487
|
}
|
|
1494
1488
|
//#endregion
|
|
1495
1489
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
@@ -1878,7 +1872,7 @@ function lr(e) {
|
|
|
1878
1872
|
}
|
|
1879
1873
|
//#endregion
|
|
1880
1874
|
//#region src/core/errors/traceback-atom.ts
|
|
1881
|
-
var ur =
|
|
1875
|
+
var ur = S(null);
|
|
1882
1876
|
//#endregion
|
|
1883
1877
|
//#region src/core/cells/logs.ts
|
|
1884
1878
|
function dr(e) {
|
|
@@ -1922,7 +1916,7 @@ function pr(e) {
|
|
|
1922
1916
|
message: JSON.stringify(t)
|
|
1923
1917
|
});
|
|
1924
1918
|
});
|
|
1925
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = m.get(
|
|
1919
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = m.get(_e) === "read";
|
|
1926
1920
|
if (t.length > 0 && !fr && n) {
|
|
1927
1921
|
fr = !0;
|
|
1928
1922
|
let e = t.find((e) => e.traceback);
|
|
@@ -1930,7 +1924,7 @@ function pr(e) {
|
|
|
1930
1924
|
title: "An internal error occurred",
|
|
1931
1925
|
description: e.msg || "Click 'View' to see traceback",
|
|
1932
1926
|
variant: "danger",
|
|
1933
|
-
action:
|
|
1927
|
+
action: T.createElement(ce, {
|
|
1934
1928
|
altText: "View traceback",
|
|
1935
1929
|
onClick: () => {
|
|
1936
1930
|
m.set(ur, {
|
|
@@ -2053,7 +2047,7 @@ function Tr(e, t) {
|
|
|
2053
2047
|
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
2054
2048
|
},
|
|
2055
2049
|
onItem(t, n, r) {
|
|
2056
|
-
let i = t.cell_id ?? "__scratch__", a =
|
|
2050
|
+
let i = t.cell_id ?? "__scratch__", a = j(t), o = wr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2057
2051
|
o.channel === "media" && zn.INSTANCE.track({
|
|
2058
2052
|
cell_id: i,
|
|
2059
2053
|
output: o
|
|
@@ -2075,7 +2069,7 @@ function Er(e, t) {
|
|
|
2075
2069
|
function Dr(e, t) {
|
|
2076
2070
|
let { local: n, execution: r, code: i } = e;
|
|
2077
2071
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2078
|
-
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a &&
|
|
2072
|
+
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && j(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2079
2073
|
if (o && o.executionId === a?.id && e.seq <= o.seq && !(e.kind === "input" && o.prompts.has(e.id)) || e.kind === "input" && s?.executionId === e.execution_id && s.ids.has(e.id)) return;
|
|
2080
2074
|
let t = wr(e, l, i);
|
|
2081
2075
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
@@ -2087,7 +2081,7 @@ function Dr(e, t) {
|
|
|
2087
2081
|
rendered: { consoleOutputs: n ? Kn([...r, n]) : r }
|
|
2088
2082
|
};
|
|
2089
2083
|
}
|
|
2090
|
-
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole :
|
|
2084
|
+
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : nt(r).flatMap((e) => u(e) ?? []);
|
|
2091
2085
|
if (d?.length) {
|
|
2092
2086
|
let e = d.every((e) => e.afterSeq !== void 0) && p.every((e) => e.id !== void 0), t = (e) => e.afterSeq === void 0 ? e.id ?? 0 : e.afterSeq + 1.5;
|
|
2093
2087
|
p = [...p, ...d.map((e, t) => ({
|
|
@@ -2120,20 +2114,20 @@ function kr(e) {
|
|
|
2120
2114
|
}
|
|
2121
2115
|
//#endregion
|
|
2122
2116
|
//#region src/core/cells/layout.ts
|
|
2123
|
-
var Ar =
|
|
2117
|
+
var Ar = S(/* @__PURE__ */ new Set()), jr = S([]), Mr = S([]);
|
|
2124
2118
|
function Nr() {
|
|
2125
2119
|
return `column-${Pn.create()}`;
|
|
2126
2120
|
}
|
|
2127
|
-
var Pr =
|
|
2121
|
+
var Pr = S(null, (e, t, n) => {
|
|
2128
2122
|
let r = kr(n).length, i = e(jr);
|
|
2129
2123
|
if (i.length === r) return;
|
|
2130
2124
|
let a = e(Mr), o = [...i, ...a].slice(0, r);
|
|
2131
2125
|
for (; o.length < r;) o.push(Nr());
|
|
2132
2126
|
t(jr, o), t(Mr, a.slice(Math.max(0, r - i.length)));
|
|
2133
|
-
}), Fr = _(
|
|
2127
|
+
}), Fr = _(S((e) => {
|
|
2134
2128
|
let t = e(g);
|
|
2135
2129
|
return t === null ? null : e(t.documentAtom);
|
|
2136
|
-
}), (e) => e === null ? [[]] : kr(e), v), Ir =
|
|
2130
|
+
}), (e) => e === null ? [[]] : kr(e), v), Ir = S((e) => {
|
|
2137
2131
|
let t = e(Fr), n = e(jr), r = e(Mr);
|
|
2138
2132
|
return [...t.map((e, t) => ({
|
|
2139
2133
|
id: n[t] ?? `column-${t}`,
|
|
@@ -2148,7 +2142,7 @@ function Lr(e, t, n) {
|
|
|
2148
2142
|
return e.forEach((i, a) => {
|
|
2149
2143
|
let o = t[a];
|
|
2150
2144
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
2151
|
-
let s =
|
|
2145
|
+
let s = Xe(a, t);
|
|
2152
2146
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2153
2147
|
}), r;
|
|
2154
2148
|
}
|
|
@@ -2163,10 +2157,10 @@ function Rr(e, t, n) {
|
|
|
2163
2157
|
};
|
|
2164
2158
|
}) };
|
|
2165
2159
|
}
|
|
2166
|
-
var zr =
|
|
2167
|
-
let t = e(
|
|
2160
|
+
var zr = S((e) => {
|
|
2161
|
+
let t = e(ya);
|
|
2168
2162
|
return Rr(e(Ir), (e) => t[e] ?? null, e(Ar));
|
|
2169
|
-
}), Br = () => p(zr), Vr =
|
|
2163
|
+
}), Br = () => p(zr), Vr = S((e) => e(zr).columns.length);
|
|
2170
2164
|
function Hr(e, t) {
|
|
2171
2165
|
return e.columns.find((e) => e.id === t);
|
|
2172
2166
|
}
|
|
@@ -2223,7 +2217,7 @@ function Jr(e, t) {
|
|
|
2223
2217
|
[o]: i[o] ?? Cr()
|
|
2224
2218
|
}, a = {
|
|
2225
2219
|
...a,
|
|
2226
|
-
[o]: (0,
|
|
2220
|
+
[o]: (0, T.createRef)()
|
|
2227
2221
|
};
|
|
2228
2222
|
continue;
|
|
2229
2223
|
}
|
|
@@ -2259,42 +2253,26 @@ async function Xr() {
|
|
|
2259
2253
|
}
|
|
2260
2254
|
//#endregion
|
|
2261
2255
|
//#region src/core/cells/editor.ts
|
|
2262
|
-
var K =
|
|
2256
|
+
var K = S(/* @__PURE__ */ new Set());
|
|
2263
2257
|
function Zr(e, t, n) {
|
|
2264
2258
|
return !!e && !t.has(n);
|
|
2265
2259
|
}
|
|
2266
|
-
|
|
2260
|
+
S(null, (e, t, { cellId: n }) => {
|
|
2267
2261
|
t(K, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2268
|
-
}),
|
|
2262
|
+
}), S(null, (e, t, { cellId: n }) => e(K).has(n) ? (t(K, (e) => {
|
|
2269
2263
|
let t = new Set(e);
|
|
2270
2264
|
return t.delete(n), t;
|
|
2271
2265
|
}), !0) : !1);
|
|
2272
|
-
var Qr =
|
|
2273
|
-
|
|
2266
|
+
var Qr = S(/* @__PURE__ */ new Map());
|
|
2267
|
+
S(null, (e, t, { cellId: n }) => {
|
|
2274
2268
|
t(Qr, (e) => {
|
|
2275
2269
|
let t = new Map(e);
|
|
2276
2270
|
return t.delete(n), t;
|
|
2277
2271
|
});
|
|
2278
2272
|
});
|
|
2279
2273
|
//#endregion
|
|
2280
|
-
//#region src/components/editor/navigation/focus-utils.ts
|
|
2281
|
-
function $r(e, n) {
|
|
2282
|
-
let r = document.getElementById(H.create(e));
|
|
2283
|
-
r ? ti(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2284
|
-
}
|
|
2285
|
-
function ei() {
|
|
2286
|
-
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2287
|
-
}
|
|
2288
|
-
function ti(e, n) {
|
|
2289
|
-
try {
|
|
2290
|
-
e.focus(n);
|
|
2291
|
-
} catch {
|
|
2292
|
-
t.warn("[CellFocusManager] element may not be focusable", e);
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
//#endregion
|
|
2296
2274
|
//#region src/utils/timeout.ts
|
|
2297
|
-
function
|
|
2275
|
+
function $r(e, n) {
|
|
2298
2276
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
2299
2277
|
if (o < r) {
|
|
2300
2278
|
try {
|
|
@@ -2308,76 +2286,41 @@ function ni(e, n) {
|
|
|
2308
2286
|
a > 0 ? setTimeout(s, a) : s();
|
|
2309
2287
|
}
|
|
2310
2288
|
//#endregion
|
|
2311
|
-
//#region src/
|
|
2312
|
-
function
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
for (let e of t) n[e].config.disabled && r.push(e);
|
|
2318
|
-
return r;
|
|
2319
|
-
}
|
|
2320
|
-
function ai(e) {
|
|
2321
|
-
let { cellIds: t, cellData: n } = e, r = [];
|
|
2322
|
-
for (let e of t) n[e].config.disabled || r.push(e);
|
|
2323
|
-
return r;
|
|
2324
|
-
}
|
|
2325
|
-
function oi(e) {
|
|
2326
|
-
return e.history.length > 0;
|
|
2327
|
-
}
|
|
2328
|
-
function si(e) {
|
|
2329
|
-
let t = e.history[e.history.length - 1];
|
|
2330
|
-
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2289
|
+
//#region src/components/editor/navigation/focus-utils.ts
|
|
2290
|
+
function ei(e) {
|
|
2291
|
+
$r(() => (e.focus(), e.hasFocus), {
|
|
2292
|
+
retries: 5,
|
|
2293
|
+
delay: 20
|
|
2294
|
+
});
|
|
2331
2295
|
}
|
|
2332
|
-
function
|
|
2333
|
-
|
|
2296
|
+
function ti(e, n) {
|
|
2297
|
+
let r = document.getElementById(H.create(e));
|
|
2298
|
+
r ? ri(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2334
2299
|
}
|
|
2335
|
-
function
|
|
2336
|
-
|
|
2337
|
-
let i = Vt(t, r), a = n(r), o = ci(i, a, e.cellData[r]);
|
|
2338
|
-
o === null ? a.sourceChanged && di(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2339
|
-
}
|
|
2300
|
+
function ni() {
|
|
2301
|
+
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2340
2302
|
}
|
|
2341
|
-
function
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2303
|
+
function ri(e, n) {
|
|
2304
|
+
try {
|
|
2305
|
+
e.focus(n);
|
|
2306
|
+
} catch {
|
|
2307
|
+
t.warn("[CellFocusManager] element may not be focusable", e);
|
|
2346
2308
|
}
|
|
2347
|
-
return r;
|
|
2348
|
-
}
|
|
2349
|
-
function di(e, t) {
|
|
2350
|
-
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
2351
|
-
return r !== void 0 && r.state.status !== "completed";
|
|
2352
|
-
}
|
|
2353
|
-
function fi({ status: e, outcome: t, live: n }) {
|
|
2354
|
-
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
2355
|
-
}
|
|
2356
|
-
function pi({ errored: e, stopped: t }) {
|
|
2357
|
-
return {
|
|
2358
|
-
published: !0,
|
|
2359
|
-
"has-error": e,
|
|
2360
|
-
stopped: t
|
|
2361
|
-
};
|
|
2362
|
-
}
|
|
2363
|
-
function mi({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
2364
|
-
let a = B(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
2365
|
-
return (e || t || n || a) && !o;
|
|
2366
2309
|
}
|
|
2367
2310
|
//#endregion
|
|
2368
2311
|
//#region src/core/network/requests.ts
|
|
2369
|
-
var
|
|
2370
|
-
function
|
|
2371
|
-
let e = p(
|
|
2372
|
-
return
|
|
2312
|
+
var ii = S(null);
|
|
2313
|
+
function ai() {
|
|
2314
|
+
let e = p(ii);
|
|
2315
|
+
return w(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2373
2316
|
}
|
|
2374
|
-
function
|
|
2375
|
-
let e = m.get(
|
|
2376
|
-
return
|
|
2317
|
+
function oi() {
|
|
2318
|
+
let e = m.get(ii);
|
|
2319
|
+
return w(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2377
2320
|
}
|
|
2378
2321
|
//#endregion
|
|
2379
2322
|
//#region src/utils/storage/storage.ts
|
|
2380
|
-
var
|
|
2323
|
+
var si = class {
|
|
2381
2324
|
store = /* @__PURE__ */ new Map();
|
|
2382
2325
|
get length() {
|
|
2383
2326
|
return this.store.size;
|
|
@@ -2398,16 +2341,16 @@ var vi = class {
|
|
|
2398
2341
|
this.store.set(e, t);
|
|
2399
2342
|
}
|
|
2400
2343
|
};
|
|
2401
|
-
function
|
|
2402
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
2403
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2344
|
+
function ci() {
|
|
2345
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = xe();
|
|
2346
|
+
return e ? window.localStorage : t ? window.sessionStorage : new si();
|
|
2404
2347
|
}
|
|
2405
|
-
var
|
|
2406
|
-
function
|
|
2407
|
-
return
|
|
2348
|
+
var li = ci(), ui = /(https?:\/\/[^\s"<>`{}|\\^]+)/, di = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, fi = /^data:image\//i, pi = ["avatars.githubusercontent.com"];
|
|
2349
|
+
function mi(e) {
|
|
2350
|
+
return fi.test(e) ? [{
|
|
2408
2351
|
type: "image",
|
|
2409
2352
|
url: e
|
|
2410
|
-
}] : e.split(
|
|
2353
|
+
}] : e.split(ui).filter((e) => e !== "").map((e) => ui.test(e) ? di.test(e) || fi.test(e) || pi.some((t) => e.includes(t)) ? {
|
|
2411
2354
|
type: "image",
|
|
2412
2355
|
url: e
|
|
2413
2356
|
} : {
|
|
@@ -2420,48 +2363,48 @@ function Ti(e) {
|
|
|
2420
2363
|
}
|
|
2421
2364
|
//#endregion
|
|
2422
2365
|
//#region src/utils/json/json-parser.ts
|
|
2423
|
-
var
|
|
2366
|
+
var hi = new RegExp(ui.source, "g");
|
|
2424
2367
|
BigInt.prototype.toJSON = function() {
|
|
2425
2368
|
return JSON.rawJSON(this.toString());
|
|
2426
2369
|
};
|
|
2427
|
-
function
|
|
2370
|
+
function gi(e) {
|
|
2428
2371
|
try {
|
|
2429
|
-
return JSON.parse(e, (e, t) =>
|
|
2372
|
+
return JSON.parse(e, (e, t) => bi(t));
|
|
2430
2373
|
} catch {}
|
|
2431
2374
|
if (e == null || e === "") return {};
|
|
2432
2375
|
try {
|
|
2433
|
-
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 :
|
|
2376
|
+
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 : bi(t) : bi(t));
|
|
2434
2377
|
} catch {
|
|
2435
2378
|
return {};
|
|
2436
2379
|
}
|
|
2437
2380
|
}
|
|
2438
|
-
function
|
|
2381
|
+
function _i(e) {
|
|
2439
2382
|
if (e.length === 0) return "";
|
|
2440
2383
|
let t = Object.keys(e[0]);
|
|
2441
2384
|
return [
|
|
2442
2385
|
`| ${t.join(" | ")} |`,
|
|
2443
2386
|
`|${t.map(() => "---").join("|")}|`,
|
|
2444
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2387
|
+
...e.map((e) => `| ${t.map((t) => vi(e[t])).join(" | ")} |`)
|
|
2445
2388
|
].join("\n");
|
|
2446
2389
|
}
|
|
2447
|
-
function
|
|
2390
|
+
function vi(e) {
|
|
2448
2391
|
if (e == null) return "";
|
|
2449
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2392
|
+
if (Array.isArray(e) || typeof e == "object") return yi(JSON.stringify(e));
|
|
2450
2393
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2451
2394
|
t = t.replaceAll(n, (e) => {
|
|
2452
2395
|
let t = `__MDLINK_${i++}__`;
|
|
2453
2396
|
return r.set(t, e), t;
|
|
2454
|
-
}), t = t.replaceAll(
|
|
2397
|
+
}), t = t.replaceAll(hi, "[$1]($1)");
|
|
2455
2398
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2456
|
-
return
|
|
2399
|
+
return yi(t);
|
|
2457
2400
|
}
|
|
2458
|
-
function
|
|
2401
|
+
function yi(e) {
|
|
2459
2402
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2460
2403
|
}
|
|
2461
|
-
function
|
|
2404
|
+
function bi(e) {
|
|
2462
2405
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2463
2406
|
}
|
|
2464
|
-
var
|
|
2407
|
+
var xi = new class {
|
|
2465
2408
|
getFilename() {
|
|
2466
2409
|
return this.getSearchParam("filename");
|
|
2467
2410
|
}
|
|
@@ -2488,39 +2431,39 @@ var Mi = new class {
|
|
|
2488
2431
|
}();
|
|
2489
2432
|
//#endregion
|
|
2490
2433
|
//#region src/core/dom/htmlUtils.ts
|
|
2491
|
-
function
|
|
2492
|
-
return
|
|
2434
|
+
function Si(e) {
|
|
2435
|
+
return gi(e ?? "");
|
|
2493
2436
|
}
|
|
2494
|
-
function
|
|
2495
|
-
return
|
|
2437
|
+
function Ci(e) {
|
|
2438
|
+
return le.mapValues(e.dataset, (e) => typeof e == "string" ? Si(e) : e);
|
|
2496
2439
|
}
|
|
2497
|
-
function
|
|
2440
|
+
function wi(e, t) {
|
|
2498
2441
|
let n = e.parentElement ? In.parse(e.parentElement) : void 0;
|
|
2499
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2442
|
+
return n && t.has(n) ? t.lookupValue(n) : Si(e.dataset.initialValue);
|
|
2500
2443
|
}
|
|
2501
|
-
function
|
|
2502
|
-
if (
|
|
2503
|
-
if (
|
|
2504
|
-
let e =
|
|
2444
|
+
function Ti() {
|
|
2445
|
+
if (ne()) return document.title || null;
|
|
2446
|
+
if (ye()) {
|
|
2447
|
+
let e = xi.getFilename();
|
|
2505
2448
|
if (e) return e;
|
|
2506
2449
|
}
|
|
2507
2450
|
let e = document.querySelector("marimo-filename");
|
|
2508
|
-
|
|
2451
|
+
ve(e, "marimo-filename tag not found");
|
|
2509
2452
|
let t = e.innerHTML;
|
|
2510
2453
|
return t.length === 0 ? null : t;
|
|
2511
2454
|
}
|
|
2512
2455
|
//#endregion
|
|
2513
2456
|
//#region src/core/saving/file-state.ts
|
|
2514
|
-
var
|
|
2515
|
-
|
|
2516
|
-
var
|
|
2517
|
-
|
|
2457
|
+
var Ei = S(Ti());
|
|
2458
|
+
S(null);
|
|
2459
|
+
var Di = S(null);
|
|
2460
|
+
S(void 0);
|
|
2518
2461
|
//#endregion
|
|
2519
2462
|
//#region src/utils/storage/typed.ts
|
|
2520
|
-
var
|
|
2463
|
+
var Oi = class {
|
|
2521
2464
|
defaultValue;
|
|
2522
2465
|
storage;
|
|
2523
|
-
constructor(e, t =
|
|
2466
|
+
constructor(e, t = li) {
|
|
2524
2467
|
this.defaultValue = e, this.storage = t;
|
|
2525
2468
|
}
|
|
2526
2469
|
get(e) {
|
|
@@ -2537,11 +2480,11 @@ var zi = class {
|
|
|
2537
2480
|
remove(e) {
|
|
2538
2481
|
this.storage.removeItem(e);
|
|
2539
2482
|
}
|
|
2540
|
-
},
|
|
2483
|
+
}, ki = class {
|
|
2541
2484
|
schema;
|
|
2542
2485
|
getDefaultValue;
|
|
2543
2486
|
storage;
|
|
2544
|
-
constructor(e, t, n =
|
|
2487
|
+
constructor(e, t, n = li) {
|
|
2545
2488
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2546
2489
|
}
|
|
2547
2490
|
get(e) {
|
|
@@ -2560,15 +2503,15 @@ var zi = class {
|
|
|
2560
2503
|
remove(e) {
|
|
2561
2504
|
this.storage.removeItem(e);
|
|
2562
2505
|
}
|
|
2563
|
-
},
|
|
2506
|
+
}, Ai = class extends ki {
|
|
2564
2507
|
filename;
|
|
2565
2508
|
unsubscribeFromFilename;
|
|
2566
2509
|
constructor(e, t, n) {
|
|
2567
|
-
let r = m.get(
|
|
2510
|
+
let r = m.get(Ei);
|
|
2568
2511
|
super(t, n), this.filename = r;
|
|
2569
2512
|
try {
|
|
2570
|
-
this.unsubscribeFromFilename = m.sub(
|
|
2571
|
-
let t = m.get(
|
|
2513
|
+
this.unsubscribeFromFilename = m.sub(Ei, () => {
|
|
2514
|
+
let t = m.get(Ei);
|
|
2572
2515
|
this.handleFilenameChange(e, t);
|
|
2573
2516
|
});
|
|
2574
2517
|
} catch {
|
|
@@ -2626,7 +2569,7 @@ var zi = class {
|
|
|
2626
2569
|
In: "in",
|
|
2627
2570
|
As: "as",
|
|
2628
2571
|
Import: "import"
|
|
2629
|
-
},
|
|
2572
|
+
}, ji = /* @__PURE__ */ new Set([
|
|
2630
2573
|
q.FunctionDefinition,
|
|
2631
2574
|
q.LambdaExpression,
|
|
2632
2575
|
q.ArrayComprehensionExpression,
|
|
@@ -2638,16 +2581,15 @@ var zi = class {
|
|
|
2638
2581
|
q.Comment, q.String, q.FormatString;
|
|
2639
2582
|
//#endregion
|
|
2640
2583
|
//#region src/core/codemirror/utils.ts
|
|
2641
|
-
function
|
|
2584
|
+
function Mi(e) {
|
|
2642
2585
|
e && e.dispatch({ selection: {
|
|
2643
2586
|
anchor: e.state.doc.length,
|
|
2644
2587
|
head: e.state.doc.length
|
|
2645
2588
|
} });
|
|
2646
2589
|
}
|
|
2647
|
-
function
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
t.scrollIntoView({
|
|
2590
|
+
function Ni(e) {
|
|
2591
|
+
requestAnimationFrame(() => {
|
|
2592
|
+
e.dom.closest(".marimo-cell")?.scrollIntoView({
|
|
2651
2593
|
behavior: "instant",
|
|
2652
2594
|
block: "nearest",
|
|
2653
2595
|
inline: "nearest"
|
|
@@ -2656,29 +2598,29 @@ function Wi(e) {
|
|
|
2656
2598
|
}
|
|
2657
2599
|
//#endregion
|
|
2658
2600
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2659
|
-
var
|
|
2660
|
-
function
|
|
2601
|
+
var Pi = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2602
|
+
function Fi(e, t) {
|
|
2661
2603
|
requestAnimationFrame(() => {
|
|
2662
2604
|
e.focus(), e.dispatch({
|
|
2663
2605
|
selection: {
|
|
2664
2606
|
anchor: t,
|
|
2665
2607
|
head: t
|
|
2666
2608
|
},
|
|
2667
|
-
effects:
|
|
2609
|
+
effects: fe.scrollIntoView(t, { y: "center" })
|
|
2668
2610
|
});
|
|
2669
|
-
}),
|
|
2611
|
+
}), Ni(e);
|
|
2670
2612
|
}
|
|
2671
|
-
function
|
|
2672
|
-
let n =
|
|
2613
|
+
function Ii(e, t) {
|
|
2614
|
+
let n = pe(e), r = null;
|
|
2673
2615
|
return n.iterate({ enter: (n) => {
|
|
2674
2616
|
if (r !== null) return !1;
|
|
2675
2617
|
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2676
2618
|
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2677
2619
|
} }), r;
|
|
2678
2620
|
}
|
|
2679
|
-
function
|
|
2621
|
+
function Li(e, t) {
|
|
2680
2622
|
let n = [], r = e.resolveInner(t, 0);
|
|
2681
|
-
for (; r;)
|
|
2623
|
+
for (; r;) ji.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2682
2624
|
id: r.from,
|
|
2683
2625
|
type: r.name
|
|
2684
2626
|
})), r = r.parent;
|
|
@@ -2693,12 +2635,12 @@ function Y(e, t, n) {
|
|
|
2693
2635
|
from: n
|
|
2694
2636
|
});
|
|
2695
2637
|
}
|
|
2696
|
-
function
|
|
2638
|
+
function Ri(e, t) {
|
|
2697
2639
|
if (e.firstChild()) do
|
|
2698
2640
|
t(e.node);
|
|
2699
2641
|
while (e.nextSibling());
|
|
2700
2642
|
}
|
|
2701
|
-
function
|
|
2643
|
+
function zi(e, t) {
|
|
2702
2644
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2703
2645
|
switch (e.name) {
|
|
2704
2646
|
case q.VariableName:
|
|
@@ -2709,13 +2651,13 @@ function Xi(e, t) {
|
|
|
2709
2651
|
let n = e.node.cursor();
|
|
2710
2652
|
n.firstChild();
|
|
2711
2653
|
do
|
|
2712
|
-
|
|
2654
|
+
zi(n, t);
|
|
2713
2655
|
while (n.nextSibling());
|
|
2714
2656
|
break;
|
|
2715
2657
|
}
|
|
2716
2658
|
}
|
|
2717
2659
|
}
|
|
2718
|
-
function
|
|
2660
|
+
function Bi(e, t) {
|
|
2719
2661
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2720
2662
|
o.firstChild();
|
|
2721
2663
|
do {
|
|
@@ -2727,18 +2669,18 @@ function Zi(e, t) {
|
|
|
2727
2669
|
while (e.nextSibling());
|
|
2728
2670
|
} while (o.nextSibling());
|
|
2729
2671
|
}
|
|
2730
|
-
function
|
|
2672
|
+
function Vi(e, t) {
|
|
2731
2673
|
let n = e.cursor();
|
|
2732
2674
|
n.firstChild();
|
|
2733
2675
|
let r = !1;
|
|
2734
2676
|
do
|
|
2735
2677
|
if (n.name === J.For) r = !0;
|
|
2736
2678
|
else if (r && n.name === J.In) break;
|
|
2737
|
-
else r &&
|
|
2679
|
+
else r && zi(n, t);
|
|
2738
2680
|
while (n.nextSibling());
|
|
2739
2681
|
}
|
|
2740
|
-
function
|
|
2741
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2682
|
+
function Hi(e, t) {
|
|
2683
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = ji.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2742
2684
|
switch (s) {
|
|
2743
2685
|
case q.FunctionDefinition:
|
|
2744
2686
|
case q.ClassDefinition: {
|
|
@@ -2750,7 +2692,7 @@ function $i(e, t) {
|
|
|
2750
2692
|
break;
|
|
2751
2693
|
}
|
|
2752
2694
|
while (t.nextSibling());
|
|
2753
|
-
s === q.FunctionDefinition &&
|
|
2695
|
+
s === q.FunctionDefinition && Bi(e, {
|
|
2754
2696
|
state: n,
|
|
2755
2697
|
variableName: r,
|
|
2756
2698
|
scopeId: c,
|
|
@@ -2759,7 +2701,7 @@ function $i(e, t) {
|
|
|
2759
2701
|
break;
|
|
2760
2702
|
}
|
|
2761
2703
|
case q.LambdaExpression:
|
|
2762
|
-
|
|
2704
|
+
Bi(e, {
|
|
2763
2705
|
state: n,
|
|
2764
2706
|
variableName: r,
|
|
2765
2707
|
scopeId: c,
|
|
@@ -2771,7 +2713,7 @@ function $i(e, t) {
|
|
|
2771
2713
|
case q.SetComprehensionExpression:
|
|
2772
2714
|
case q.ComprehensionExpression:
|
|
2773
2715
|
case q.ForStatement:
|
|
2774
|
-
|
|
2716
|
+
Vi(e, {
|
|
2775
2717
|
state: n,
|
|
2776
2718
|
variableName: r,
|
|
2777
2719
|
scopeId: u,
|
|
@@ -2789,7 +2731,7 @@ function $i(e, t) {
|
|
|
2789
2731
|
let s = e.cursor();
|
|
2790
2732
|
s.firstChild();
|
|
2791
2733
|
do
|
|
2792
|
-
s.from < o &&
|
|
2734
|
+
s.from < o && zi(s, {
|
|
2793
2735
|
state: n,
|
|
2794
2736
|
variableName: r,
|
|
2795
2737
|
scopeId: u,
|
|
@@ -2824,8 +2766,8 @@ function $i(e, t) {
|
|
|
2824
2766
|
break;
|
|
2825
2767
|
}
|
|
2826
2768
|
}
|
|
2827
|
-
|
|
2828
|
-
|
|
2769
|
+
Ri(o, (e) => {
|
|
2770
|
+
Hi(e, {
|
|
2829
2771
|
state: n,
|
|
2830
2772
|
variableName: r,
|
|
2831
2773
|
scopeStack: l,
|
|
@@ -2833,48 +2775,48 @@ function $i(e, t) {
|
|
|
2833
2775
|
});
|
|
2834
2776
|
});
|
|
2835
2777
|
}
|
|
2836
|
-
function
|
|
2837
|
-
let r =
|
|
2838
|
-
|
|
2778
|
+
function Ui(e, t, n) {
|
|
2779
|
+
let r = pe(e), i = [];
|
|
2780
|
+
Hi(r, {
|
|
2839
2781
|
state: e,
|
|
2840
2782
|
variableName: t,
|
|
2841
2783
|
scopeStack: [],
|
|
2842
2784
|
declarations: i
|
|
2843
2785
|
});
|
|
2844
2786
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2845
|
-
for (let e of
|
|
2846
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2787
|
+
for (let e of Li(r, a)) {
|
|
2788
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Pi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2847
2789
|
if (t) return t.from;
|
|
2848
2790
|
}
|
|
2849
2791
|
return null;
|
|
2850
2792
|
}
|
|
2851
|
-
function
|
|
2852
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2853
|
-
return i !== null && (
|
|
2793
|
+
function Wi(e, t, n) {
|
|
2794
|
+
let { state: r } = e, i = n === void 0 ? Ii(r, t) : Ui(r, t, n);
|
|
2795
|
+
return i !== null && (Fi(e, i), !0);
|
|
2854
2796
|
}
|
|
2855
|
-
function
|
|
2856
|
-
return
|
|
2797
|
+
function Gi(e, t) {
|
|
2798
|
+
return Fi(e, e.state.doc.line(t).from), !0;
|
|
2857
2799
|
}
|
|
2858
2800
|
//#endregion
|
|
2859
2801
|
//#region src/core/network/connection.ts
|
|
2860
|
-
var X =
|
|
2861
|
-
|
|
2802
|
+
var X = S({ state: k.NOT_STARTED });
|
|
2803
|
+
y(null, (e, t) => t === null ? null : {
|
|
2862
2804
|
phase: t.phase,
|
|
2863
2805
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2864
2806
|
});
|
|
2865
|
-
function
|
|
2866
|
-
return
|
|
2807
|
+
function Ki() {
|
|
2808
|
+
return te(X, (e) => e.state === k.OPEN);
|
|
2867
2809
|
}
|
|
2868
|
-
function
|
|
2869
|
-
return
|
|
2810
|
+
function qi() {
|
|
2811
|
+
return ge() ? Ki() : Promise.resolve();
|
|
2870
2812
|
}
|
|
2871
|
-
|
|
2813
|
+
S((e) => e(X).state === k.CONNECTING), S((e) => e(X).state === k.OPEN), S((e) => {
|
|
2872
2814
|
let t = e(X);
|
|
2873
|
-
return t.state ===
|
|
2874
|
-
}),
|
|
2815
|
+
return t.state === k.OPEN || t.state === k.NOT_STARTED;
|
|
2816
|
+
}), S((e) => e(X).state === k.CLOSED);
|
|
2875
2817
|
//#endregion
|
|
2876
2818
|
//#region src/components/ui/checkbox.tsx
|
|
2877
|
-
var
|
|
2819
|
+
var Ji = T.forwardRef((e, t) => {
|
|
2878
2820
|
let r = (0, _n.c)(13), i, a;
|
|
2879
2821
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2880
2822
|
let o;
|
|
@@ -2882,28 +2824,28 @@ var aa = w.forwardRef((e, t) => {
|
|
|
2882
2824
|
let s;
|
|
2883
2825
|
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];
|
|
2884
2826
|
let c;
|
|
2885
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0,
|
|
2827
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, E.jsx)(Fe, {
|
|
2886
2828
|
className: s,
|
|
2887
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
2829
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, E.jsx)(Ce, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, E.jsx)(l, { className: "h-4 w-4" })
|
|
2888
2830
|
}), r[6] = a.checked, r[7] = c);
|
|
2889
2831
|
let u;
|
|
2890
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0,
|
|
2832
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, E.jsx)(Ne, {
|
|
2891
2833
|
ref: t,
|
|
2892
2834
|
className: o,
|
|
2893
2835
|
...a,
|
|
2894
2836
|
children: c
|
|
2895
2837
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2896
2838
|
});
|
|
2897
|
-
|
|
2839
|
+
Ji.displayName = Ne.displayName;
|
|
2898
2840
|
//#endregion
|
|
2899
2841
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2900
|
-
function
|
|
2842
|
+
function Yi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2901
2843
|
if (!n) return;
|
|
2902
2844
|
let o = document.getElementById(H.create(e));
|
|
2903
2845
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2904
|
-
else if (
|
|
2846
|
+
else if (ni()) ri(o);
|
|
2905
2847
|
else {
|
|
2906
|
-
if (r)
|
|
2848
|
+
if (r) ri(o);
|
|
2907
2849
|
else {
|
|
2908
2850
|
wn.promote(e);
|
|
2909
2851
|
let r = n.current?.editorView;
|
|
@@ -2912,10 +2854,7 @@ function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2912
2854
|
return;
|
|
2913
2855
|
}
|
|
2914
2856
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2915
|
-
if (
|
|
2916
|
-
retries: 5,
|
|
2917
|
-
delay: 20
|
|
2918
|
-
}), i === "top") r.dispatch({ selection: {
|
|
2857
|
+
if (ei(r), i === "top") r.dispatch({ selection: {
|
|
2919
2858
|
anchor: 0,
|
|
2920
2859
|
head: 0
|
|
2921
2860
|
} });
|
|
@@ -2925,7 +2864,7 @@ function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2925
2864
|
anchor: e.from,
|
|
2926
2865
|
head: e.from
|
|
2927
2866
|
} });
|
|
2928
|
-
} else a &&
|
|
2867
|
+
} else a && Wi(r, a);
|
|
2929
2868
|
}
|
|
2930
2869
|
o.scrollIntoView({
|
|
2931
2870
|
behavior: "smooth",
|
|
@@ -2933,20 +2872,20 @@ function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2933
2872
|
});
|
|
2934
2873
|
}
|
|
2935
2874
|
}
|
|
2936
|
-
function
|
|
2875
|
+
function Xi() {
|
|
2937
2876
|
let e = document.getElementById("App");
|
|
2938
2877
|
e?.scrollTo({
|
|
2939
2878
|
top: e.scrollHeight,
|
|
2940
2879
|
behavior: "smooth"
|
|
2941
2880
|
});
|
|
2942
2881
|
}
|
|
2943
|
-
function
|
|
2882
|
+
function Zi() {
|
|
2944
2883
|
document.getElementById("App")?.scrollTo({
|
|
2945
2884
|
top: 0,
|
|
2946
2885
|
behavior: "smooth"
|
|
2947
2886
|
});
|
|
2948
2887
|
}
|
|
2949
|
-
function
|
|
2888
|
+
function Qi(e) {
|
|
2950
2889
|
let t = document.getElementById(H.create(e));
|
|
2951
2890
|
return t?.scrollIntoView({
|
|
2952
2891
|
behavior: "smooth",
|
|
@@ -2954,8 +2893,65 @@ function la(e) {
|
|
|
2954
2893
|
}), t;
|
|
2955
2894
|
}
|
|
2956
2895
|
//#endregion
|
|
2896
|
+
//#region src/core/cells/utils.ts
|
|
2897
|
+
function $i(e) {
|
|
2898
|
+
return e.cellIds.map((t) => e.cellData[t]);
|
|
2899
|
+
}
|
|
2900
|
+
function ea(e) {
|
|
2901
|
+
let { cellIds: t, cellData: n } = e, r = [];
|
|
2902
|
+
for (let e of t) n[e].config.disabled && r.push(e);
|
|
2903
|
+
return r;
|
|
2904
|
+
}
|
|
2905
|
+
function ta(e) {
|
|
2906
|
+
let { cellIds: t, cellData: n } = e, r = [];
|
|
2907
|
+
for (let e of t) n[e].config.disabled || r.push(e);
|
|
2908
|
+
return r;
|
|
2909
|
+
}
|
|
2910
|
+
function na(e) {
|
|
2911
|
+
return e.history.length > 0;
|
|
2912
|
+
}
|
|
2913
|
+
function ra(e) {
|
|
2914
|
+
let t = e.history[e.history.length - 1];
|
|
2915
|
+
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2916
|
+
}
|
|
2917
|
+
function ia(e, t, n) {
|
|
2918
|
+
return e.status === "idle" ? ca(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
2919
|
+
}
|
|
2920
|
+
function* aa(e, t, n) {
|
|
2921
|
+
for (let r of e.cellIds) {
|
|
2922
|
+
let i = Bt(t, r), a = n(r), o = ia(i, a, e.cellData[r]);
|
|
2923
|
+
o === null ? a.sourceChanged && sa(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
function oa(e, t, n) {
|
|
2927
|
+
let r = null;
|
|
2928
|
+
for (let [, i] of aa(e, t, n)) {
|
|
2929
|
+
if (i !== "inputs") return i;
|
|
2930
|
+
r = i;
|
|
2931
|
+
}
|
|
2932
|
+
return r;
|
|
2933
|
+
}
|
|
2934
|
+
function sa(e, t) {
|
|
2935
|
+
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
2936
|
+
return r !== void 0 && r.state.status !== "completed";
|
|
2937
|
+
}
|
|
2938
|
+
function ca({ status: e, outcome: t, live: n }) {
|
|
2939
|
+
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
2940
|
+
}
|
|
2941
|
+
function la({ errored: e, stopped: t }) {
|
|
2942
|
+
return {
|
|
2943
|
+
published: !0,
|
|
2944
|
+
"has-error": e,
|
|
2945
|
+
stopped: t
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
function ua({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
2949
|
+
let a = B(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
2950
|
+
return (e || t || n || a) && !o;
|
|
2951
|
+
}
|
|
2952
|
+
//#endregion
|
|
2957
2953
|
//#region src/core/cells/cells.ts
|
|
2958
|
-
function
|
|
2954
|
+
function da(e) {
|
|
2959
2955
|
let t = {
|
|
2960
2956
|
column: 0,
|
|
2961
2957
|
hide_code: !1,
|
|
@@ -2976,13 +2972,13 @@ function ua(e) {
|
|
|
2976
2972
|
...e.cellRuntime
|
|
2977
2973
|
},
|
|
2978
2974
|
cellHandles: {
|
|
2979
|
-
[V]: (0,
|
|
2975
|
+
[V]: (0, T.createRef)(),
|
|
2980
2976
|
...e.cellHandles
|
|
2981
2977
|
}
|
|
2982
2978
|
};
|
|
2983
2979
|
}
|
|
2984
|
-
function
|
|
2985
|
-
return
|
|
2980
|
+
function fa() {
|
|
2981
|
+
return da({
|
|
2986
2982
|
cellIds: [],
|
|
2987
2983
|
cellData: {},
|
|
2988
2984
|
cellRuntime: {},
|
|
@@ -2992,7 +2988,7 @@ function da() {
|
|
|
2992
2988
|
cellLogs: []
|
|
2993
2989
|
});
|
|
2994
2990
|
}
|
|
2995
|
-
var { reducer:
|
|
2991
|
+
var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
2996
2992
|
startCellConsole: (e, { cellId: t }) => Q({
|
|
2997
2993
|
state: e,
|
|
2998
2994
|
cellId: t,
|
|
@@ -3060,7 +3056,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3060
3056
|
}),
|
|
3061
3057
|
reconcileDocument: (e, t) => {
|
|
3062
3058
|
let n = Jr(e, t);
|
|
3063
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3059
|
+
for (let t of e.cellIds) t in n.cellData || ja(t);
|
|
3064
3060
|
return n;
|
|
3065
3061
|
},
|
|
3066
3062
|
setStdinResponse: (e, t) => {
|
|
@@ -3075,7 +3071,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3075
3071
|
});
|
|
3076
3072
|
},
|
|
3077
3073
|
resetCellRuntimes: (e, t) => {
|
|
3078
|
-
let n =
|
|
3074
|
+
let n = ye(), r = { ...e.cellRuntime };
|
|
3079
3075
|
for (let i of [...e.cellIds, V]) {
|
|
3080
3076
|
let a = e.cellRuntime[i];
|
|
3081
3077
|
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : Cr({
|
|
@@ -3092,7 +3088,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3092
3088
|
let t = e.scrollKey;
|
|
3093
3089
|
if (t === null) return e;
|
|
3094
3090
|
let n = t;
|
|
3095
|
-
return
|
|
3091
|
+
return Yi({
|
|
3096
3092
|
cellId: n,
|
|
3097
3093
|
cell: e.cellHandles[n],
|
|
3098
3094
|
isCodeHidden: Zr(e.cellData[n]?.config.hide_code, m.get(K), n),
|
|
@@ -3103,7 +3099,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3103
3099
|
scrollKey: null
|
|
3104
3100
|
};
|
|
3105
3101
|
},
|
|
3106
|
-
foldAll: (e) => (yn(Object.
|
|
3102
|
+
foldAll: (e) => (yn(Object.keys(e.cellHandles).map((e) => Na(e))), e),
|
|
3107
3103
|
unfoldAll: (e) => (bn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3108
3104
|
clearLogs: (e) => ({
|
|
3109
3105
|
...e,
|
|
@@ -3134,18 +3130,18 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3134
3130
|
}
|
|
3135
3131
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3136
3132
|
}
|
|
3137
|
-
var
|
|
3138
|
-
m.set(Z, (t) =>
|
|
3139
|
-
}).addLogs, $ =
|
|
3140
|
-
|
|
3141
|
-
var
|
|
3142
|
-
|
|
3143
|
-
var
|
|
3133
|
+
var ga = ma((e) => {
|
|
3134
|
+
m.set(Z, (t) => pa(t, e));
|
|
3135
|
+
}).addLogs, $ = S((e) => e(Z).cellIds);
|
|
3136
|
+
S((e) => e($).length === 1), S((e) => ea(e(Z)).length > 0), S((e) => ta(e(Z)).length > 0), S((e) => na(e(Z))), S((e) => ra(e(Z)));
|
|
3137
|
+
var _a = S((e) => oa(e(Z), e(L), e(rn)));
|
|
3138
|
+
S((e) => e(_a) !== null);
|
|
3139
|
+
var va = S((e) => {
|
|
3144
3140
|
let { cellIds: t, cellData: n } = e(Z);
|
|
3145
3141
|
return t.map((t) => {
|
|
3146
3142
|
let r = e(R(t)), { name: i } = n[t];
|
|
3147
3143
|
if (r !== null && B(r.mimetype)) {
|
|
3148
|
-
|
|
3144
|
+
w(Array.isArray(r.data), "Expected array data");
|
|
3149
3145
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
3150
3146
|
if (e.length > 0) return {
|
|
3151
3147
|
output: {
|
|
@@ -3158,54 +3154,54 @@ var _a = x((e) => {
|
|
|
3158
3154
|
}
|
|
3159
3155
|
return null;
|
|
3160
3156
|
}).filter(Boolean);
|
|
3161
|
-
}),
|
|
3157
|
+
}), ya = x(S((e) => {
|
|
3162
3158
|
let t = {};
|
|
3163
3159
|
for (let n of e($)) {
|
|
3164
3160
|
let r = e(z(n));
|
|
3165
3161
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3166
3162
|
}
|
|
3167
3163
|
return t;
|
|
3168
|
-
})),
|
|
3169
|
-
|
|
3170
|
-
var
|
|
3164
|
+
})), ba = S((e) => qe(e($).map((t) => e(z(t)))));
|
|
3165
|
+
S((e) => e(va).length);
|
|
3166
|
+
var xa = x(S((e) => {
|
|
3171
3167
|
let { cellIds: t, cellData: n } = e(Z);
|
|
3172
|
-
return
|
|
3168
|
+
return le.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3173
3169
|
}));
|
|
3174
|
-
|
|
3175
|
-
var
|
|
3170
|
+
S((e) => e(Z).scrollKey);
|
|
3171
|
+
var Sa = () => p($), Ca = () => p(xa), wa = () => m.get(Z), Ta = () => m.get(Z).cellIds, Ea = () => {
|
|
3176
3172
|
let { cellIds: e, cellData: t } = m.get(Z);
|
|
3177
3173
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3178
3174
|
};
|
|
3179
|
-
ee(_(Z, (e) => e.cellIds.map((t) => e.cellData[t]))),
|
|
3180
|
-
var
|
|
3181
|
-
let t =
|
|
3182
|
-
let n = Er(t, e), r = t(
|
|
3175
|
+
ee(_(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), S((e) => e(Z).cellIds.length > 0);
|
|
3176
|
+
var Da = C((e) => S((t) => t(Z).cellData[e])), Oa = Cr(), ka = C((e) => {
|
|
3177
|
+
let t = S((t) => {
|
|
3178
|
+
let n = Er(t, e), r = t(b)?.cells;
|
|
3183
3179
|
return {
|
|
3184
|
-
local: t(Z).cellRuntime[e] ??
|
|
3180
|
+
local: t(Z).cellRuntime[e] ?? Oa,
|
|
3185
3181
|
execution: n,
|
|
3186
|
-
code: n &&
|
|
3182
|
+
code: n && Et(n.record, r)
|
|
3187
3183
|
};
|
|
3188
3184
|
}), n = _(t, Dr);
|
|
3189
|
-
return
|
|
3190
|
-
}),
|
|
3191
|
-
function
|
|
3192
|
-
|
|
3185
|
+
return S((e) => e(n).rendered);
|
|
3186
|
+
}), Aa = C((e) => S((t) => t(Z).cellHandles[e]));
|
|
3187
|
+
function ja(e) {
|
|
3188
|
+
Da.remove(e), ka.remove(e), Aa.remove(e), ln(e);
|
|
3193
3189
|
}
|
|
3194
|
-
var
|
|
3190
|
+
var Ma = (e) => {
|
|
3195
3191
|
let { cellHandles: t } = m.get(Z);
|
|
3196
|
-
return t[e]
|
|
3197
|
-
},
|
|
3198
|
-
|
|
3199
|
-
...e(
|
|
3200
|
-
...e(
|
|
3192
|
+
return t[e]?.current?.editorView ?? void 0;
|
|
3193
|
+
}, Na = (e) => (wn.promote(e), Ma(e));
|
|
3194
|
+
S((e) => e($).map((t) => ({
|
|
3195
|
+
...e(Da(t)),
|
|
3196
|
+
...e(ka(t)),
|
|
3201
3197
|
output: e(R(t))
|
|
3202
3198
|
})));
|
|
3203
|
-
function
|
|
3204
|
-
return
|
|
3199
|
+
function Pa() {
|
|
3200
|
+
return ha();
|
|
3205
3201
|
}
|
|
3206
3202
|
//#endregion
|
|
3207
3203
|
//#region src/core/errors/error-entries.ts
|
|
3208
|
-
function
|
|
3204
|
+
function Fa(e) {
|
|
3209
3205
|
if (Tn(e.mimetype)) {
|
|
3210
3206
|
if (!Array.isArray(e.data)) return null;
|
|
3211
3207
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
@@ -3216,23 +3212,23 @@ function Pa(e) {
|
|
|
3216
3212
|
tracebackHtml: e.data
|
|
3217
3213
|
} : null;
|
|
3218
3214
|
}
|
|
3219
|
-
function
|
|
3215
|
+
function Ia(e) {
|
|
3220
3216
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3221
3217
|
}
|
|
3222
|
-
function
|
|
3218
|
+
function La(e) {
|
|
3223
3219
|
let t = e?.find((e) => En(e.mimetype));
|
|
3224
3220
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3225
3221
|
}
|
|
3226
|
-
function
|
|
3222
|
+
function Ra(e, t) {
|
|
3227
3223
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3228
|
-
if (!
|
|
3224
|
+
if (!Ia(e.errorData)) return La(t);
|
|
3229
3225
|
}
|
|
3230
|
-
function
|
|
3226
|
+
function za(e) {
|
|
3231
3227
|
let { cellIds: t, cellData: n } = e.get(Z), r = [];
|
|
3232
3228
|
for (let [i, a] of t.entries()) {
|
|
3233
3229
|
let t = e.get(R(a));
|
|
3234
3230
|
if (t === null || !B(t.mimetype)) continue;
|
|
3235
|
-
let o =
|
|
3231
|
+
let o = Fa(t);
|
|
3236
3232
|
if (!o) continue;
|
|
3237
3233
|
let s = yr(n[a].name, i), c = t.code ?? n[a].code;
|
|
3238
3234
|
r.push({
|
|
@@ -3240,21 +3236,21 @@ function Ra(e) {
|
|
|
3240
3236
|
cellName: s,
|
|
3241
3237
|
cellCode: c,
|
|
3242
3238
|
errorData: o.errorData,
|
|
3243
|
-
tracebackHtml:
|
|
3239
|
+
tracebackHtml: Ra(o, e.get(ka(a)).consoleOutputs)
|
|
3244
3240
|
});
|
|
3245
3241
|
}
|
|
3246
3242
|
return r;
|
|
3247
3243
|
}
|
|
3248
|
-
function
|
|
3244
|
+
function Ba(e) {
|
|
3249
3245
|
return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
|
|
3250
3246
|
}
|
|
3251
|
-
function
|
|
3252
|
-
let t =
|
|
3247
|
+
function Va(e) {
|
|
3248
|
+
let t = Ba(e);
|
|
3253
3249
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
|
|
3254
3250
|
}
|
|
3255
|
-
function
|
|
3251
|
+
function Ha(e) {
|
|
3256
3252
|
let t = [e.cellName];
|
|
3257
|
-
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
3253
|
+
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Va).join("\n\n")), t.join("\n\n");
|
|
3258
3254
|
}
|
|
3259
3255
|
//#endregion
|
|
3260
|
-
export { Zr as $,
|
|
3256
|
+
export { Zr as $, k as $t, Ji as A, H as At, Di as B, z as Bt, $i as C, pr as Ct, Xi as D, zn as Dt, Yi as E, nr as Et, Mi as F, On as Ft, _i as G, mn as Gt, Ci as H, sn as Ht, Ai as I, kn as It, oi as J, hn as Jt, mi as K, dn as Kt, Oi as L, gn as Lt, Ki as M, Nn as Mt, qi as N, In as Nt, Qi as O, Pn as Ot, Gi as P, Fn as Pt, ei as Q, Ze as Qt, ki as R, L as Rt, ca as S, _r as St, ua as T, G as Tt, wi as U, un as Ut, Si as V, R as Vt, gi as W, $t as Wt, ai as X, pt as Xt, ii as Y, Bt as Yt, ti as Z, ft as Zt, pa as _, Er as _t, ga as a, jr as at, Ca as b, vr as bt, ka as c, Hr as ct, Ea as d, Gr as dt, Ye as en, Qr as et, Ta as f, zr as ft, ba as g, Or as gt, Z as h, Br as ht, za as i, Se as in, Ar as it, X as j, V as jt, Zi as k, Ln as kt, ma as l, Wr as lt, fa as m, Vr as mt, Ha as n, Ve as nn, Xr as nt, Da as o, Ur as ot, wa as p, Nr as pt, li as q, pn as qt, Va as r, Ce as rn, Yr as rt, $ as s, Mr as st, Ba as t, Ke as tn, K as tt, Na as u, Kr as ut, ja as v, Tr as vt, la as w, lr as wt, Pa as x, br as xt, Sa as y, yr as yt, Ei as z, rn as zt };
|