@marimo-team/islands 0.25.3-dev311 → 0.25.3-dev316
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-DdteSMhq.js → ErrorBoundary-C3G05Nb1.js} +1 -1
- package/dist/{chat-ui-DkuxGEDp.js → chat-ui-DASKYW38.js} +13 -13
- package/dist/{code-visibility-BzqsfUpE.js → code-visibility-B3_gXvem.js} +31 -32
- package/dist/{common-CfI-FyP-.js → common-Vd6TgXHQ.js} +5074 -5074
- package/dist/{config-BVYA1P0C.js → config-CL7mwGLX.js} +87 -129
- package/dist/{data-grid-overlay-editor-BM-WjDgA.js → data-grid-overlay-editor-DLEPVcX1.js} +1 -1
- package/dist/{error-entries-istW7Xbs.js → error-entries-kb4H6PAT.js} +533 -508
- package/dist/feedback-button-gqE30Uez.js +370 -0
- package/dist/{formats-CMa7L3E8.js → formats-qhBmYb0l.js} +1 -1
- package/dist/{glide-data-editor-BQCggnhx.js → glide-data-editor-BmtEcZoo.js} +3 -3
- package/dist/{globals-DJuYoG49.js → globals-BIt_qRYC.js} +1 -1
- package/dist/{html-to-image-pPbR2cDx.js → html-to-image-DR8VPB7E.js} +4018 -4021
- package/dist/main.js +4638 -4624
- package/dist/{number-overlay-editor-rhy7Cfzx.js → number-overlay-editor-Bbxt9i1c.js} +1 -1
- package/dist/{process-output-BySO1nIs.js → process-output-BDMtqL6K.js} +2 -2
- package/dist/{reveal-component-Deq9swmP.js → reveal-component-DXFsIk5S.js} +4 -4
- package/dist/static-state-Dtocd9UO.js +68 -0
- package/dist/{vega-component-Bly2lDhz.js → vega-component-CeN8zClP.js} +9 -9
- package/package.json +1 -1
- package/src/__tests__/mount.test.ts +17 -58
- package/src/components/editor/actions/useRestartKernel.tsx +0 -5
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +0 -3
- package/src/components/editor/cell/useRunCells.ts +2 -2
- package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +2 -16
- package/src/components/editor/renderers/cell-array.tsx +0 -3
- package/src/core/edit-app.tsx +2 -7
- package/src/core/executions/__tests__/run.test.ts +0 -3
- package/src/core/executions/index.ts +1 -1
- package/src/core/executions/run.ts +1 -14
- package/src/core/islands/bootstrap.ts +0 -1
- package/src/core/network/__tests__/requests-network.test.ts +0 -16
- package/src/core/network/connection.ts +0 -5
- package/src/core/network/requests-toasting.tsx +1 -49
- package/src/core/network/resolve.ts +1 -5
- package/src/core/notebook/replica/__tests__/replica.test.ts +3 -3
- package/src/core/notebook/replica/connection.ts +1 -5
- package/src/core/runtime/__tests__/createWsUrl.test.ts +4 -16
- package/src/core/runtime/__tests__/runtime.test.ts +58 -168
- package/src/core/runtime/adapter.ts +1 -8
- package/src/core/runtime/config.ts +4 -59
- package/src/core/runtime/runtime.ts +1 -31
- package/src/core/runtime/types.ts +0 -5
- package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +5 -5
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +125 -29
- package/src/core/session/connection-utils.ts +2 -14
- package/src/core/session/useNotebookSession.tsx +19 -12
- package/src/mount.tsx +3 -9
- package/src/utils/errors.ts +0 -7
- package/dist/feedback-button-BGtR35Ev.js +0 -371
- package/dist/toDate-5qPtZ6HL.js +0 -94
- package/src/components/editor/alerts/connecting-alert.tsx +0 -27
- package/src/core/network/__tests__/requests-lazy.test.ts +0 -322
- package/src/core/network/requests-lazy.ts +0 -222
|
@@ -7,16 +7,16 @@ import { f as s, h as c } from "./tooltip-BekOCQ3v.js";
|
|
|
7
7
|
import { t as l } from "./check-DCQEEsUn.js";
|
|
8
8
|
import { n as u, r as d } from "./assertNever-efcK_v3t.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-6ZiU38At.js";
|
|
10
|
-
import { At as p, Ct as m,
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
10
|
+
import { At as p, Ct as m, Dt as h, Et as g, Ft as _, Mt as v, Rt as y, St as b, d as x, dn as ee, jt as S, ln as te, mn as ne, pn as re, un as ie, vt as ae, xt as oe, yt as C } from "./use-restore-focus-DyrKLdSB.js";
|
|
11
|
+
import { n as se } from "./toast-xEFvuGpt.js";
|
|
12
|
+
import { t as ce } from "./objects-DCmMvZtn.js";
|
|
13
13
|
import { t as w } from "./invariant-DLmrl-hA.js";
|
|
14
|
-
import {
|
|
15
|
-
import { t as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { t as
|
|
19
|
-
var
|
|
14
|
+
import { t as T } from "./purify.es-DmnrIjg4.js";
|
|
15
|
+
import { t as le } from "./createReducer-DHfURLCk.js";
|
|
16
|
+
import { M as ue, N as de, V as fe, g as pe } from "./dist-B_xgcU0N.js";
|
|
17
|
+
import { a as me, i as he, l as ge, m as _e, u as ve } from "./static-state-Dtocd9UO.js";
|
|
18
|
+
import { t as ye } from "./capabilities-BiN90k7v.js";
|
|
19
|
+
var be = c("external-link", [
|
|
20
20
|
["path", {
|
|
21
21
|
d: "M15 3h6v6",
|
|
22
22
|
key: "1q9fwt"
|
|
@@ -29,20 +29,20 @@ var ye = c("external-link", [
|
|
|
29
29
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
30
30
|
key: "a6xqqp"
|
|
31
31
|
}]
|
|
32
|
-
]),
|
|
32
|
+
]), xe = c("minus", [["path", {
|
|
33
33
|
d: "M5 12h14",
|
|
34
34
|
key: "1ays0h"
|
|
35
|
-
}]]),
|
|
35
|
+
}]]), E = /* @__PURE__ */ e(i(), 1), D = f(), Se = Object.defineProperty, O = (e, t) => Se(e, "name", {
|
|
36
36
|
value: t,
|
|
37
37
|
configurable: !0
|
|
38
|
-
}),
|
|
38
|
+
}), Ce = "Checkbox", [we, Te] = re(Ce), [Ee, k] = we(Ce);
|
|
39
39
|
function De(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] =
|
|
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: Ce
|
|
45
|
+
}), [m, h] = E.useState(null), [g, _] = E.useState(null), [v, y] = E.useState(null), b = !m || !!o || !!m.closest("form"), x = {
|
|
46
46
|
checked: f,
|
|
47
47
|
disabled: a,
|
|
48
48
|
setChecked: p,
|
|
@@ -54,30 +54,30 @@ function De(e) {
|
|
|
54
54
|
userClick: v,
|
|
55
55
|
onUserClick: y,
|
|
56
56
|
required: l,
|
|
57
|
-
defaultChecked: !
|
|
57
|
+
defaultChecked: !A(i) && i,
|
|
58
58
|
isFormControl: b,
|
|
59
59
|
bubbleInput: g,
|
|
60
60
|
setBubbleInput: _
|
|
61
61
|
};
|
|
62
|
-
return /* @__PURE__ */ (0,
|
|
62
|
+
return /* @__PURE__ */ (0, D.jsx)(Ee, {
|
|
63
63
|
scope: t,
|
|
64
64
|
...x,
|
|
65
65
|
children: Fe(d) ? d(x) : r
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
var Oe = "CheckboxTrigger", ke = /* @__PURE__ */
|
|
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
|
+
O(De, "CheckboxProvider");
|
|
69
|
+
var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
|
|
70
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = k(Oe, e), g = r(a, d), _ = E.useRef(l);
|
|
71
|
+
return E.useEffect(() => {
|
|
72
72
|
let e = o?.form;
|
|
73
73
|
if (e) {
|
|
74
|
-
let t = /* @__PURE__ */
|
|
74
|
+
let t = /* @__PURE__ */ O(() => 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, D.jsx)(ne.button, {
|
|
78
78
|
type: "button",
|
|
79
79
|
role: "checkbox",
|
|
80
|
-
"aria-checked":
|
|
80
|
+
"aria-checked": A(l) ? "mixed" : l,
|
|
81
81
|
"aria-required": u,
|
|
82
82
|
"data-state": Ie(l),
|
|
83
83
|
"data-disabled": c ? "" : void 0,
|
|
@@ -85,20 +85,20 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
85
85
|
value: s,
|
|
86
86
|
...i,
|
|
87
87
|
ref: g,
|
|
88
|
-
onKeyDown:
|
|
88
|
+
onKeyDown: ee(t, (e) => {
|
|
89
89
|
e.key === "Enter" && e.preventDefault();
|
|
90
90
|
}),
|
|
91
|
-
onClick:
|
|
91
|
+
onClick: ee(n, (e) => {
|
|
92
92
|
let t = e.isPropagationStopped();
|
|
93
93
|
p({
|
|
94
|
-
requestedChecked:
|
|
94
|
+
requestedChecked: A(l) ? !0 : !l,
|
|
95
95
|
hasConsumerStoppedPropagation: t
|
|
96
|
-
}), f((e) =>
|
|
96
|
+
}), f((e) => A(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
97
97
|
})
|
|
98
98
|
});
|
|
99
|
-
}, "CheckboxTrigger")), Ae = /* @__PURE__ */
|
|
99
|
+
}, "CheckboxTrigger")), Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(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, D.jsx)(De, {
|
|
102
102
|
__scopeCheckbox: n,
|
|
103
103
|
checked: i,
|
|
104
104
|
defaultChecked: a,
|
|
@@ -108,17 +108,17 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
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, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(ke, {
|
|
112
112
|
...d,
|
|
113
113
|
ref: t,
|
|
114
114
|
__scopeCheckbox: n
|
|
115
|
-
}), e && /* @__PURE__ */ (0,
|
|
115
|
+
}), e && /* @__PURE__ */ (0, D.jsx)(Pe, { __scopeCheckbox: n })] })
|
|
116
116
|
});
|
|
117
|
-
}, "Checkbox")), je = "CheckboxIndicator", Me = /* @__PURE__ */
|
|
118
|
-
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a =
|
|
119
|
-
return /* @__PURE__ */ (0,
|
|
120
|
-
present: r ||
|
|
121
|
-
children: /* @__PURE__ */ (0,
|
|
117
|
+
}, "Checkbox")), je = "CheckboxIndicator", Me = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
|
|
118
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = k(je, n);
|
|
119
|
+
return /* @__PURE__ */ (0, D.jsx)(te, {
|
|
120
|
+
present: r || A(a.checked) || a.checked === !0,
|
|
121
|
+
children: /* @__PURE__ */ (0, D.jsx)(ne.span, {
|
|
122
122
|
"data-state": Ie(a.checked),
|
|
123
123
|
"data-disabled": a.disabled ? "" : void 0,
|
|
124
124
|
...i,
|
|
@@ -129,33 +129,33 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
131
|
});
|
|
132
|
-
}, "CheckboxIndicator")), Ne = "CheckboxBubbleInput", Pe = /* @__PURE__ */
|
|
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")), Ne = "CheckboxBubbleInput", Pe = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
|
|
133
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = k(Ne, e), _ = r(i, g), v = s(a), y = E.useRef(!1), b = E.useRef(c), x = E.useRef(o), S = E.useRef(null);
|
|
134
|
+
E.useEffect(() => {
|
|
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
139
|
let r = b.current !== c;
|
|
140
140
|
b.current = c;
|
|
141
|
-
let i = o !== null && o !==
|
|
142
|
-
if (
|
|
141
|
+
let i = o !== null && o !== x.current;
|
|
142
|
+
if (x.current = o, i) S.current = r ? null : o, r && (e.indeterminate = A(c), n.call(e, !A(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
143
|
else if (r) {
|
|
144
144
|
let t = S.current;
|
|
145
145
|
S.current = null;
|
|
146
146
|
let r = t?.requestedChecked === c;
|
|
147
|
-
y.current = !0, e.indeterminate =
|
|
147
|
+
y.current = !0, e.indeterminate = A(c), n.call(e, !A(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
|
|
148
148
|
}
|
|
149
149
|
}, [
|
|
150
150
|
h,
|
|
151
151
|
c,
|
|
152
152
|
o
|
|
153
153
|
]);
|
|
154
|
-
let
|
|
155
|
-
return /* @__PURE__ */ (0,
|
|
154
|
+
let te = E.useRef(!A(c) && c);
|
|
155
|
+
return /* @__PURE__ */ (0, D.jsx)(ne.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 Oe = "CheckboxTrigger", ke = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
164
164
|
...n,
|
|
165
165
|
tabIndex: -1,
|
|
166
166
|
ref: _,
|
|
167
|
-
onClick:
|
|
167
|
+
onClick: ee(t, (e) => {
|
|
168
168
|
y.current && e.stopPropagation();
|
|
169
169
|
}),
|
|
170
170
|
style: {
|
|
@@ -181,22 +181,30 @@ var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
181
181
|
function Fe(e) {
|
|
182
182
|
return typeof e == "function";
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
function
|
|
184
|
+
O(Fe, "isFunction");
|
|
185
|
+
function A(e) {
|
|
186
186
|
return e === "indeterminate";
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
O(A, "isIndeterminate");
|
|
189
189
|
function Ie(e) {
|
|
190
|
-
return
|
|
190
|
+
return A(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
O(Ie, "getState");
|
|
193
193
|
//#endregion
|
|
194
|
-
//#region src/core/
|
|
195
|
-
var
|
|
194
|
+
//#region src/core/notebook/replica/connection.ts
|
|
195
|
+
var j = {
|
|
196
|
+
NOT_STARTED: "NOT_STARTED",
|
|
197
|
+
CONNECTING: "CONNECTING",
|
|
198
|
+
OPEN: "OPEN",
|
|
199
|
+
CLOSED: "CLOSED"
|
|
200
|
+
}, Le = {
|
|
201
|
+
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
202
|
+
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
203
|
+
}, Re = {
|
|
196
204
|
sourceChanged: !1,
|
|
197
205
|
inputsChanged: !1
|
|
198
206
|
};
|
|
199
|
-
function
|
|
207
|
+
function ze(e) {
|
|
200
208
|
let t = /* @__PURE__ */ new Map();
|
|
201
209
|
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
202
210
|
let n = t.get(e.name);
|
|
@@ -204,8 +212,8 @@ function Re(e) {
|
|
|
204
212
|
}
|
|
205
213
|
return t;
|
|
206
214
|
}
|
|
207
|
-
function
|
|
208
|
-
let t =
|
|
215
|
+
function Be(e) {
|
|
216
|
+
let t = ze(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
209
217
|
function i(e, n) {
|
|
210
218
|
let i = new Set(n).add(e.id);
|
|
211
219
|
for (let [n, a] of Object.entries(e.depends_on)) {
|
|
@@ -242,12 +250,12 @@ function ze(e) {
|
|
|
242
250
|
}
|
|
243
251
|
return (t) => {
|
|
244
252
|
let n = e.results.get(t);
|
|
245
|
-
return n == null ?
|
|
253
|
+
return n == null ? Re : o(n, /* @__PURE__ */ new Set());
|
|
246
254
|
};
|
|
247
255
|
}
|
|
248
256
|
//#endregion
|
|
249
257
|
//#region src/utils/time.ts
|
|
250
|
-
var
|
|
258
|
+
var Ve = class e {
|
|
251
259
|
ms;
|
|
252
260
|
static fromMilliseconds(t) {
|
|
253
261
|
return t == null ? null : new e(t);
|
|
@@ -276,125 +284,125 @@ var k = class e {
|
|
|
276
284
|
};
|
|
277
285
|
//#endregion
|
|
278
286
|
//#region src/core/executions/select.ts
|
|
279
|
-
function
|
|
287
|
+
function He(e) {
|
|
280
288
|
let t = e.outcome;
|
|
281
289
|
return t === null ? null : t.kind;
|
|
282
290
|
}
|
|
283
|
-
function
|
|
284
|
-
return e === null ? null :
|
|
291
|
+
function Ue(e) {
|
|
292
|
+
return e === null ? null : Ve.parse(e).toMilliseconds();
|
|
285
293
|
}
|
|
286
|
-
function
|
|
294
|
+
function We(e, t) {
|
|
287
295
|
let n = e.latest.get(t);
|
|
288
296
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
289
297
|
}
|
|
290
|
-
function
|
|
298
|
+
function Ge(e, t) {
|
|
291
299
|
let n = e.cells.get(t);
|
|
292
300
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
293
301
|
}
|
|
294
|
-
function
|
|
295
|
-
if (!
|
|
302
|
+
function Ke(e, t) {
|
|
303
|
+
if (!Ge(e, t)) return !1;
|
|
296
304
|
if (e.requested.has(t)) return !0;
|
|
297
|
-
let n =
|
|
305
|
+
let n = We(e.executions, t)?.record.run_id ?? e.results.get(t)?.run_id;
|
|
298
306
|
for (let r of e.executions.runs.values()) if (r.status !== "completed" && r.id !== n && r.cells.includes(t)) return !0;
|
|
299
307
|
return !1;
|
|
300
308
|
}
|
|
301
|
-
function
|
|
302
|
-
let n =
|
|
303
|
-
n !== null && n.record.status !== "completed" ? (i = n.record.status, a =
|
|
304
|
-
let s = i === "idle", c = s && r !== null && r.started_at !== null && r.completed_at !== null ?
|
|
309
|
+
function qe(e, t) {
|
|
310
|
+
let n = We(e.executions, t), r = e.results.get(t) ?? null, i = "idle", a = r === null ? null : Ue(r.started_at), o = !1;
|
|
311
|
+
n !== null && n.record.status !== "completed" ? (i = n.record.status, a = Ue(n.record.started_at) ?? a, o = n.record.outcome !== null) : Ke(e, t) && (i = "queued");
|
|
312
|
+
let s = i === "idle", c = s && r !== null && r.started_at !== null && r.completed_at !== null ? Ve.parse(r.completed_at).since(Ve.parse(r.started_at)) : null;
|
|
305
313
|
return {
|
|
306
314
|
status: i,
|
|
307
315
|
blocked: e.blocked.has(t),
|
|
308
|
-
outcome: s && r !== null ?
|
|
316
|
+
outcome: s && r !== null ? He(r) : null,
|
|
309
317
|
startedAt: a,
|
|
310
318
|
duration: c,
|
|
311
319
|
rendered: o
|
|
312
320
|
};
|
|
313
321
|
}
|
|
314
|
-
function
|
|
322
|
+
function Je(e) {
|
|
315
323
|
return [...e.executions.values()].filter((e) => e.record.status !== "completed");
|
|
316
324
|
}
|
|
317
|
-
function
|
|
318
|
-
return
|
|
325
|
+
function Ye(e) {
|
|
326
|
+
return Je(e).some((e) => e.record.status === "running");
|
|
319
327
|
}
|
|
320
|
-
function
|
|
321
|
-
let t =
|
|
328
|
+
function Xe(e) {
|
|
329
|
+
let t = Je(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
322
330
|
for (let t of e.executions.runs.values()) if (t.status !== "completed") for (let e of t.cells) r.add(e);
|
|
323
331
|
let i = 0;
|
|
324
|
-
for (let t of r) !n.has(t) &&
|
|
332
|
+
for (let t of r) !n.has(t) && Ke(e, t) && (i += 1);
|
|
325
333
|
return t.length + i;
|
|
326
334
|
}
|
|
327
335
|
//#endregion
|
|
328
336
|
//#region src/core/executions/atoms.ts
|
|
329
|
-
var
|
|
337
|
+
var M = {
|
|
330
338
|
runs: /* @__PURE__ */ new Map(),
|
|
331
339
|
executions: /* @__PURE__ */ new Map(),
|
|
332
340
|
latest: /* @__PURE__ */ new Map()
|
|
333
|
-
},
|
|
334
|
-
function
|
|
341
|
+
}, Ze = /* @__PURE__ */ new Map(), Qe = /* @__PURE__ */ new Map(), $e = /* @__PURE__ */ new Set(), et = /* @__PURE__ */ new Set(), tt = /* @__PURE__ */ new Set(), nt = /* @__PURE__ */ new Map(), N = y(null), rt = y(null);
|
|
342
|
+
function it(e, t, n, r) {
|
|
335
343
|
return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
|
|
336
344
|
}
|
|
337
|
-
function
|
|
345
|
+
function at(e) {
|
|
338
346
|
let t = e.get(m), n = t === null ? null : e.get(t.notebookAtom);
|
|
339
347
|
return t === null || n === null ? null : {
|
|
340
348
|
replica: t,
|
|
341
349
|
id: n.id
|
|
342
350
|
};
|
|
343
351
|
}
|
|
344
|
-
function
|
|
345
|
-
let n =
|
|
352
|
+
function ot(e, t) {
|
|
353
|
+
let n = at(e);
|
|
346
354
|
return n === null ? null : {
|
|
347
355
|
notebook: n,
|
|
348
356
|
value: t
|
|
349
357
|
};
|
|
350
358
|
}
|
|
351
|
-
function
|
|
359
|
+
function st(e, t) {
|
|
352
360
|
let n = e.get(m);
|
|
353
361
|
if (n !== t.notebook.replica) return !1;
|
|
354
362
|
let r = e.get(n.notebookAtom);
|
|
355
363
|
return r === null || r.id === t.notebook.id;
|
|
356
364
|
}
|
|
357
|
-
var
|
|
358
|
-
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r =
|
|
359
|
-
return r.size === 0 ?
|
|
360
|
-
}),
|
|
365
|
+
var ct = y((e) => {
|
|
366
|
+
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = it(e(N), t, n, $e);
|
|
367
|
+
return r.size === 0 ? et : new Set([...r].flatMap((e) => e.cells));
|
|
368
|
+
}), P = y((e) => {
|
|
361
369
|
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = t === null ? null : e(t.documentAtom);
|
|
362
370
|
return {
|
|
363
|
-
executions: t === null ?
|
|
364
|
-
results: t === null ?
|
|
365
|
-
cells: r?.cells ??
|
|
366
|
-
requested: e(
|
|
367
|
-
blocked:
|
|
371
|
+
executions: t === null ? M : e(t.executionsAtom),
|
|
372
|
+
results: t === null ? Ze : e(t.resultsAtom),
|
|
373
|
+
cells: r?.cells ?? Qe,
|
|
374
|
+
requested: e(ct),
|
|
375
|
+
blocked: it(e(rt), t, n, tt)
|
|
368
376
|
};
|
|
369
|
-
}),
|
|
377
|
+
}), lt = y((e) => {
|
|
370
378
|
let t = e(m), n = t === null ? null : e(t.documentAtom);
|
|
371
379
|
return t === null || n === null ? {
|
|
372
|
-
cells:
|
|
373
|
-
executions:
|
|
374
|
-
results:
|
|
380
|
+
cells: Qe,
|
|
381
|
+
executions: M,
|
|
382
|
+
results: Ze
|
|
375
383
|
} : {
|
|
376
384
|
cells: n.cells,
|
|
377
385
|
executions: e(t.executionsAtom),
|
|
378
386
|
results: e(t.resultsAtom)
|
|
379
387
|
};
|
|
380
|
-
}),
|
|
381
|
-
|
|
388
|
+
}), ut = y((e) => Be(e(lt))), dt = y(null);
|
|
389
|
+
y((e) => {
|
|
382
390
|
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
|
|
383
391
|
return {
|
|
384
|
-
executions: t === null ?
|
|
385
|
-
results: t === null ?
|
|
386
|
-
cleared:
|
|
392
|
+
executions: t === null ? M : e(t.executionsAtom),
|
|
393
|
+
results: t === null ? Ze : e(t.resultsAtom),
|
|
394
|
+
cleared: it(e(dt), t, n, nt)
|
|
387
395
|
};
|
|
388
396
|
});
|
|
389
|
-
var
|
|
397
|
+
var ft = y((e) => {
|
|
390
398
|
let t = e(m);
|
|
391
399
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
392
400
|
});
|
|
393
|
-
|
|
394
|
-
var
|
|
401
|
+
y((e) => Ye(e(P).executions)), y((e) => Xe(e(P)));
|
|
402
|
+
var pt = y((e) => {
|
|
395
403
|
let t = e(m);
|
|
396
404
|
if (t === null) return { refused: "No notebook is connected" };
|
|
397
|
-
if (e(t.connectionAtom).state ===
|
|
405
|
+
if (e(t.connectionAtom).state === j.CLOSED) return { refused: "The notebook is disconnected" };
|
|
398
406
|
if (e(t.notebookAtom) === null) return "waiting";
|
|
399
407
|
let n = e(t.runtimeAtom);
|
|
400
408
|
if (n === null) return { refused: "The notebook has no runtime" };
|
|
@@ -404,65 +412,65 @@ var ut = v((e) => {
|
|
|
404
412
|
default: return "waiting";
|
|
405
413
|
}
|
|
406
414
|
});
|
|
407
|
-
function
|
|
415
|
+
function mt(e) {
|
|
408
416
|
return new Promise((t, n) => {
|
|
409
|
-
let r = e.sub(
|
|
417
|
+
let r = e.sub(pt, i);
|
|
410
418
|
function i() {
|
|
411
|
-
let i = e.get(
|
|
419
|
+
let i = e.get(pt);
|
|
412
420
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
413
421
|
}
|
|
414
422
|
i();
|
|
415
423
|
});
|
|
416
424
|
}
|
|
417
|
-
function
|
|
418
|
-
let n =
|
|
425
|
+
function ht(e, t) {
|
|
426
|
+
let n = at(e);
|
|
419
427
|
if (n === null) return null;
|
|
420
428
|
let r = {
|
|
421
429
|
notebook: n,
|
|
422
430
|
cells: [...t]
|
|
423
|
-
}, i = e.get(
|
|
424
|
-
return e.set(
|
|
431
|
+
}, i = e.get(N), a = i !== null && i.notebook.replica === n.replica && i.notebook.id === n.id ? i.value : $e;
|
|
432
|
+
return e.set(N, {
|
|
425
433
|
notebook: n,
|
|
426
434
|
value: new Set(a).add(r)
|
|
427
435
|
}), r;
|
|
428
436
|
}
|
|
429
|
-
function
|
|
430
|
-
let n = e.get(
|
|
437
|
+
function gt(e, t) {
|
|
438
|
+
let n = e.get(N);
|
|
431
439
|
if (n === null || !n.value.has(t)) return;
|
|
432
440
|
let r = new Set(n.value);
|
|
433
|
-
r.delete(t), e.set(
|
|
441
|
+
r.delete(t), e.set(N, {
|
|
434
442
|
notebook: n.notebook,
|
|
435
443
|
value: r
|
|
436
444
|
});
|
|
437
445
|
}
|
|
438
|
-
function
|
|
446
|
+
function _t(e, t, n) {
|
|
439
447
|
let { replica: r } = t.notebook, i = e.sub(r.executionsAtom, a);
|
|
440
448
|
function a() {
|
|
441
|
-
(!
|
|
449
|
+
(!st(e, t) || e.get(r.executionsAtom).runs.has(n.id)) && (i(), gt(e, t));
|
|
442
450
|
}
|
|
443
451
|
a();
|
|
444
452
|
}
|
|
445
|
-
function
|
|
446
|
-
let r = e.get(
|
|
453
|
+
function vt(e, t, n) {
|
|
454
|
+
let r = e.get(P).blocked;
|
|
447
455
|
if (r.has(t) === n) return;
|
|
448
456
|
let i = new Set(r);
|
|
449
|
-
n ? i.add(t) : i.delete(t), e.set(
|
|
457
|
+
n ? i.add(t) : i.delete(t), e.set(rt, ot(e, i));
|
|
450
458
|
}
|
|
451
|
-
function
|
|
452
|
-
t.status != null &&
|
|
459
|
+
function yt(e, t) {
|
|
460
|
+
t.status != null && vt(e, t.cell_id, t.status === "disabled-transitively");
|
|
453
461
|
}
|
|
454
462
|
//#endregion
|
|
455
463
|
//#region src/plugins/core/sanitize-html.ts
|
|
456
|
-
var
|
|
464
|
+
var bt = a(), xt = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
|
|
457
465
|
if (typeof document < "u") {
|
|
458
466
|
let e = "data-temp-href-target";
|
|
459
|
-
|
|
467
|
+
T.addHook("beforeSanitizeAttributes", (t) => {
|
|
460
468
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
461
|
-
}),
|
|
469
|
+
}), T.addHook("afterSanitizeAttributes", (t) => {
|
|
462
470
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
463
471
|
});
|
|
464
472
|
}
|
|
465
|
-
function
|
|
473
|
+
function St(e) {
|
|
466
474
|
let t = {
|
|
467
475
|
USE_PROFILES: {
|
|
468
476
|
html: !0,
|
|
@@ -471,7 +479,7 @@ function yt(e) {
|
|
|
471
479
|
},
|
|
472
480
|
ADD_TAGS: ["use"],
|
|
473
481
|
ADD_ATTR: ["href", "xlink:href"],
|
|
474
|
-
ALLOWED_URI_REGEXP:
|
|
482
|
+
ALLOWED_URI_REGEXP: xt,
|
|
475
483
|
FORCE_BODY: !0,
|
|
476
484
|
CUSTOM_ELEMENT_HANDLING: {
|
|
477
485
|
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
@@ -479,59 +487,59 @@ function yt(e) {
|
|
|
479
487
|
},
|
|
480
488
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
481
489
|
};
|
|
482
|
-
return
|
|
490
|
+
return T.sanitize(e, t);
|
|
483
491
|
}
|
|
484
492
|
//#endregion
|
|
485
493
|
//#region src/core/dom/outline.ts
|
|
486
|
-
var
|
|
494
|
+
var Ct = [
|
|
487
495
|
"marimo-carousel",
|
|
488
496
|
"marimo-tabs",
|
|
489
497
|
"marimo-accordion",
|
|
490
498
|
"marimo-sidebar"
|
|
491
|
-
],
|
|
492
|
-
function
|
|
499
|
+
], wt = "h1, h2, h3, h4, h5, h6";
|
|
500
|
+
function Tt(e) {
|
|
493
501
|
if (typeof DOMParser > "u") return null;
|
|
494
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
502
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(wt);
|
|
495
503
|
for (let e of Array.from(n)) {
|
|
496
504
|
let n = e.textContent;
|
|
497
|
-
if (
|
|
505
|
+
if (Ct.some((t) => e.closest(t)) || !n) continue;
|
|
498
506
|
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
499
507
|
name: n,
|
|
500
508
|
level: r,
|
|
501
|
-
by:
|
|
509
|
+
by: Dt(e)
|
|
502
510
|
};
|
|
503
|
-
i !== n && (a.html =
|
|
511
|
+
i !== n && (a.html = St(i)), t.push(a);
|
|
504
512
|
}
|
|
505
513
|
return { items: t };
|
|
506
514
|
}
|
|
507
|
-
function
|
|
515
|
+
function Et(e) {
|
|
508
516
|
if (!e.includes("\"")) return `"${e}"`;
|
|
509
517
|
if (!e.includes("'")) return `'${e}'`;
|
|
510
518
|
let t = e.split("\""), n = [];
|
|
511
519
|
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
512
520
|
return `concat(${n.join(", ")})`;
|
|
513
521
|
}
|
|
514
|
-
function
|
|
522
|
+
function Dt(e) {
|
|
515
523
|
let t = e.id;
|
|
516
524
|
if (t) return { id: t };
|
|
517
525
|
let n = e.textContent ?? "";
|
|
518
|
-
return { path: `//${e.tagName}[contains(., ${
|
|
526
|
+
return { path: `//${e.tagName}[contains(., ${Et(n)})]` };
|
|
519
527
|
}
|
|
520
|
-
function
|
|
528
|
+
function Ot(e) {
|
|
521
529
|
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
522
530
|
}
|
|
523
|
-
function
|
|
531
|
+
function kt(e) {
|
|
524
532
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
525
533
|
try {
|
|
526
|
-
return w(typeof e.data == "string", "expected string"),
|
|
534
|
+
return w(typeof e.data == "string", "expected string"), Tt(e.data);
|
|
527
535
|
} catch {
|
|
528
536
|
return t.error("Failed to parse outline"), null;
|
|
529
537
|
}
|
|
530
538
|
}
|
|
531
|
-
function
|
|
539
|
+
function At(e) {
|
|
532
540
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
533
541
|
}
|
|
534
|
-
function
|
|
542
|
+
function jt(e, n) {
|
|
535
543
|
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
536
544
|
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
537
545
|
let a = r(i), o = e + 1;
|
|
@@ -544,17 +552,17 @@ function Ot(e, n) {
|
|
|
544
552
|
}
|
|
545
553
|
//#endregion
|
|
546
554
|
//#region src/core/codemirror/editing/commands.ts
|
|
547
|
-
function
|
|
555
|
+
function Mt(e) {
|
|
548
556
|
return (t) => {
|
|
549
557
|
let n = !1;
|
|
550
558
|
for (let r of t) r && (n = e(r) || n);
|
|
551
559
|
return n;
|
|
552
560
|
};
|
|
553
561
|
}
|
|
554
|
-
var
|
|
562
|
+
var Nt = Mt(pe), Pt = Mt(de);
|
|
555
563
|
//#endregion
|
|
556
564
|
//#region src/utils/schedule-task.ts
|
|
557
|
-
function
|
|
565
|
+
function Ft() {
|
|
558
566
|
let e = globalThis.scheduler;
|
|
559
567
|
if (typeof e?.postTask == "function") return (t) => {
|
|
560
568
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -575,10 +583,10 @@ function Mt() {
|
|
|
575
583
|
setTimeout(e, 0);
|
|
576
584
|
};
|
|
577
585
|
}
|
|
578
|
-
var
|
|
586
|
+
var It = Ft();
|
|
579
587
|
//#endregion
|
|
580
588
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
581
|
-
function
|
|
589
|
+
function Lt(e = It) {
|
|
582
590
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
583
591
|
function i() {
|
|
584
592
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -621,21 +629,21 @@ function Pt(e = Nt) {
|
|
|
621
629
|
}
|
|
622
630
|
};
|
|
623
631
|
}
|
|
624
|
-
var
|
|
632
|
+
var Rt = Lt();
|
|
625
633
|
//#endregion
|
|
626
634
|
//#region src/core/mime.ts
|
|
627
|
-
function
|
|
635
|
+
function zt(e) {
|
|
628
636
|
return e === "application/vnd.marimo+error";
|
|
629
637
|
}
|
|
630
|
-
function
|
|
638
|
+
function Bt(e) {
|
|
631
639
|
return e === "application/vnd.marimo+traceback";
|
|
632
640
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
641
|
+
function F(e) {
|
|
642
|
+
return zt(e) || Bt(e);
|
|
635
643
|
}
|
|
636
644
|
//#endregion
|
|
637
645
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
638
|
-
var
|
|
646
|
+
var Vt = class e {
|
|
639
647
|
lines = [""];
|
|
640
648
|
cursor = {
|
|
641
649
|
row: 0,
|
|
@@ -724,7 +732,7 @@ var Rt = class e {
|
|
|
724
732
|
render() {
|
|
725
733
|
return this.lines.join("\n");
|
|
726
734
|
}
|
|
727
|
-
},
|
|
735
|
+
}, Ht = class {
|
|
728
736
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
729
737
|
parse(e) {
|
|
730
738
|
let t = [], n = 0;
|
|
@@ -743,9 +751,9 @@ var Rt = class e {
|
|
|
743
751
|
value: e.slice(n)
|
|
744
752
|
}), t;
|
|
745
753
|
}
|
|
746
|
-
},
|
|
747
|
-
parser = new
|
|
748
|
-
buffer = new
|
|
754
|
+
}, Ut = class {
|
|
755
|
+
parser = new Ht();
|
|
756
|
+
buffer = new Vt();
|
|
749
757
|
reduce(e) {
|
|
750
758
|
return this.reset(), this.append(e), this.render();
|
|
751
759
|
}
|
|
@@ -761,7 +769,7 @@ var Rt = class e {
|
|
|
761
769
|
for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
762
770
|
}
|
|
763
771
|
reset() {
|
|
764
|
-
this.buffer = new
|
|
772
|
+
this.buffer = new Vt();
|
|
765
773
|
}
|
|
766
774
|
render() {
|
|
767
775
|
return this.buffer.render();
|
|
@@ -804,20 +812,20 @@ var Rt = class e {
|
|
|
804
812
|
for (let t of e) t >= " " && (n += t);
|
|
805
813
|
return n;
|
|
806
814
|
}
|
|
807
|
-
},
|
|
815
|
+
}, I = class e {
|
|
808
816
|
mimetype;
|
|
809
817
|
channel;
|
|
810
818
|
timestamp;
|
|
811
819
|
code;
|
|
812
820
|
id;
|
|
813
821
|
input_id;
|
|
814
|
-
ansiReducer = new
|
|
822
|
+
ansiReducer = new Ut();
|
|
815
823
|
_data;
|
|
816
824
|
get data() {
|
|
817
825
|
return this._data;
|
|
818
826
|
}
|
|
819
827
|
static create(t) {
|
|
820
|
-
let n = new
|
|
828
|
+
let n = new Ut();
|
|
821
829
|
return n.append(t.data), new e({
|
|
822
830
|
mimetype: t.mimetype,
|
|
823
831
|
channel: t.channel,
|
|
@@ -854,28 +862,28 @@ var Rt = class e {
|
|
|
854
862
|
};
|
|
855
863
|
//#endregion
|
|
856
864
|
//#region src/core/cells/collapseConsoleOutputs.tsx
|
|
857
|
-
function
|
|
865
|
+
function Wt(e, t = 5e3) {
|
|
858
866
|
let n = [...e];
|
|
859
|
-
if (n.length < 2) return
|
|
867
|
+
if (n.length < 2) return Yt(n.map(Kt), t);
|
|
860
868
|
let r = n[n.length - 1], i = n[n.length - 2];
|
|
861
|
-
return
|
|
869
|
+
return Gt(r, i) && (Jt(r), Jt(i), n[n.length - 2] = qt(i, r), n.pop()), Yt(n, t);
|
|
862
870
|
}
|
|
863
|
-
function
|
|
871
|
+
function Gt(e, t) {
|
|
864
872
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
865
873
|
if (!n) return !1;
|
|
866
874
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
867
875
|
return n && r && i;
|
|
868
876
|
}
|
|
869
|
-
function
|
|
870
|
-
return e instanceof
|
|
877
|
+
function Kt(e) {
|
|
878
|
+
return e instanceof I ? e : typeof e.data == "string" ? I.create(e) : e;
|
|
871
879
|
}
|
|
872
|
-
function
|
|
873
|
-
return e instanceof
|
|
880
|
+
function qt(e, t) {
|
|
881
|
+
return e instanceof I ? e.appendData(t.data) : I.create(e).appendData(t.data);
|
|
874
882
|
}
|
|
875
|
-
function
|
|
883
|
+
function Jt(e) {
|
|
876
884
|
w(typeof e.data == "string", "expected string output");
|
|
877
885
|
}
|
|
878
|
-
function
|
|
886
|
+
function Yt(e, t) {
|
|
879
887
|
let n = 0, r;
|
|
880
888
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
881
889
|
let t = e[r];
|
|
@@ -905,16 +913,16 @@ function Kt(e, t) {
|
|
|
905
913
|
}
|
|
906
914
|
//#endregion
|
|
907
915
|
//#region src/core/cells/cell.ts
|
|
908
|
-
function
|
|
916
|
+
function Xt(e) {
|
|
909
917
|
return (e.at(-1)?.id ?? 0) + 1;
|
|
910
918
|
}
|
|
911
|
-
function
|
|
919
|
+
function Zt(e) {
|
|
912
920
|
return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
|
|
913
921
|
}
|
|
914
|
-
function
|
|
922
|
+
function Qt(e, t) {
|
|
915
923
|
let n = { ...e };
|
|
916
|
-
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" &&
|
|
917
|
-
let r =
|
|
924
|
+
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" && Zt(e.output).some((e) => e.includes("ancestor")) && (n.output = null), n.output = t.output ?? n.output, t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
925
|
+
let r = Zt(t.output).includes("interruption"), i = e.consoleOutputs;
|
|
918
926
|
(r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
|
|
919
927
|
channel: e.channel,
|
|
920
928
|
mimetype: e.mimetype,
|
|
@@ -925,26 +933,26 @@ function Yt(e, t) {
|
|
|
925
933
|
response: e.response ?? ""
|
|
926
934
|
} : e));
|
|
927
935
|
let a = t.console;
|
|
928
|
-
a != null && (i =
|
|
936
|
+
a != null && (i = Wt(Array.isArray(a) ? a.map((e, t) => ({
|
|
929
937
|
...e,
|
|
930
938
|
id: t + 1
|
|
931
939
|
})) : [...i, {
|
|
932
940
|
...a,
|
|
933
|
-
id:
|
|
934
|
-
}])), n.consoleOutputs = i, n.outline =
|
|
941
|
+
id: Xt(i)
|
|
942
|
+
}])), n.consoleOutputs = i, n.outline = kt(n.output);
|
|
935
943
|
let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
|
|
936
944
|
return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
|
|
937
945
|
}
|
|
938
|
-
function
|
|
946
|
+
function $t(e) {
|
|
939
947
|
return e === "running" || e === "queued";
|
|
940
948
|
}
|
|
941
|
-
function
|
|
949
|
+
function en(e, t, n) {
|
|
942
950
|
let { status: r, outcome: i, rendered: a } = e;
|
|
943
|
-
return
|
|
951
|
+
return $t(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
|
|
944
952
|
}
|
|
945
953
|
//#endregion
|
|
946
954
|
//#region src/core/cells/columns.ts
|
|
947
|
-
function
|
|
955
|
+
function tn(e) {
|
|
948
956
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
949
957
|
for (let r of e.order) {
|
|
950
958
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -952,9 +960,9 @@ function Qt(e) {
|
|
|
952
960
|
}
|
|
953
961
|
return t;
|
|
954
962
|
}
|
|
955
|
-
function
|
|
963
|
+
function nn(e) {
|
|
956
964
|
let t = [[]];
|
|
957
|
-
for (let [n, r] of
|
|
965
|
+
for (let [n, r] of tn(e)) {
|
|
958
966
|
for (; t.length <= r;) t.push([]);
|
|
959
967
|
t[r].push(n);
|
|
960
968
|
}
|
|
@@ -962,16 +970,16 @@ function $t(e) {
|
|
|
962
970
|
}
|
|
963
971
|
//#endregion
|
|
964
972
|
//#region src/core/dom/ui-element-constants.ts
|
|
965
|
-
var
|
|
973
|
+
var rn = "object-id", an = "random-id", on = "abcdefghijklmnopqrstuvwxyz", sn = on + on.toUpperCase(), cn = /* @__PURE__ */ new Set(), L = "__scratch__", ln = "setup", un = { create() {
|
|
966
974
|
let e = 0, t;
|
|
967
975
|
do {
|
|
968
976
|
let n = "";
|
|
969
|
-
for (let e = 0; e < 4; e++) n +=
|
|
977
|
+
for (let e = 0; e < 4; e++) n += sn[Math.floor(Math.random() * 52)];
|
|
970
978
|
t = n, e++;
|
|
971
|
-
} while (
|
|
979
|
+
} while (cn.has(t) && e < 100);
|
|
972
980
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
973
|
-
return
|
|
974
|
-
} },
|
|
981
|
+
return cn.add(t), t;
|
|
982
|
+
} }, R = {
|
|
975
983
|
create(e) {
|
|
976
984
|
return w(e != null, "cellId is required"), `cell-${e}`;
|
|
977
985
|
},
|
|
@@ -984,7 +992,7 @@ var en = "object-id", tn = "random-id", nn = "abcdefghijklmnopqrstuvwxyz", rn =
|
|
|
984
992
|
findElementThroughShadowDOMs(e) {
|
|
985
993
|
let t = e;
|
|
986
994
|
for (; t;) {
|
|
987
|
-
let e =
|
|
995
|
+
let e = R.findElement(t);
|
|
988
996
|
if (e) return e;
|
|
989
997
|
let n = t.getRootNode();
|
|
990
998
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -992,33 +1000,33 @@ var en = "object-id", tn = "random-id", nn = "abcdefghijklmnopqrstuvwxyz", rn =
|
|
|
992
1000
|
return null;
|
|
993
1001
|
}
|
|
994
1002
|
};
|
|
995
|
-
function
|
|
996
|
-
let t = null, n =
|
|
997
|
-
return n && (t =
|
|
1003
|
+
function dn(e) {
|
|
1004
|
+
let t = null, n = R.findElementThroughShadowDOMs(e);
|
|
1005
|
+
return n && (t = R.parse(n.id)), t;
|
|
998
1006
|
}
|
|
999
|
-
var
|
|
1007
|
+
var fn = {
|
|
1000
1008
|
parse(e) {
|
|
1001
|
-
return e.getAttribute(
|
|
1009
|
+
return e.getAttribute(rn);
|
|
1002
1010
|
},
|
|
1003
1011
|
parseOrThrow(e) {
|
|
1004
|
-
let t =
|
|
1012
|
+
let t = fn.parse(e);
|
|
1005
1013
|
return w(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1006
1014
|
}
|
|
1007
|
-
},
|
|
1015
|
+
}, pn = { create(e) {
|
|
1008
1016
|
return `output-${e}`;
|
|
1009
|
-
} },
|
|
1010
|
-
function
|
|
1011
|
-
return `column-${
|
|
1017
|
+
} }, mn = y(/* @__PURE__ */ new Set()), z = y([]), B = y([]);
|
|
1018
|
+
function hn() {
|
|
1019
|
+
return `column-${un.create()}`;
|
|
1012
1020
|
}
|
|
1013
|
-
var
|
|
1014
|
-
let r =
|
|
1021
|
+
var gn = y(null, (e, t, n) => {
|
|
1022
|
+
let r = nn(n).length, i = e(z);
|
|
1015
1023
|
if (i.length === r) return;
|
|
1016
|
-
let a = e(
|
|
1017
|
-
for (; o.length < r;) o.push(
|
|
1018
|
-
t(
|
|
1024
|
+
let a = e(B), o = [...i, ...a].slice(0, r);
|
|
1025
|
+
for (; o.length < r;) o.push(hn());
|
|
1026
|
+
t(z, o), t(B, a.slice(Math.max(0, r - i.length)));
|
|
1019
1027
|
});
|
|
1020
|
-
function
|
|
1021
|
-
return [...(e === null ? [[]] :
|
|
1028
|
+
function _n(e, t, n) {
|
|
1029
|
+
return [...(e === null ? [[]] : nn(e)).map((e, n) => ({
|
|
1022
1030
|
id: t[n] ?? `column-${n}`,
|
|
1023
1031
|
ids: e
|
|
1024
1032
|
})), ...n.map((e) => ({
|
|
@@ -1026,18 +1034,18 @@ function mn(e, t, n) {
|
|
|
1026
1034
|
ids: []
|
|
1027
1035
|
}))];
|
|
1028
1036
|
}
|
|
1029
|
-
function
|
|
1037
|
+
function vn(e, t, n) {
|
|
1030
1038
|
let r = /* @__PURE__ */ new Map();
|
|
1031
1039
|
return e.forEach((i, a) => {
|
|
1032
1040
|
let o = t[a];
|
|
1033
1041
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
1034
|
-
let s =
|
|
1042
|
+
let s = jt(a, t);
|
|
1035
1043
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
1036
1044
|
}), r;
|
|
1037
1045
|
}
|
|
1038
|
-
function
|
|
1046
|
+
function yn(e, t, n) {
|
|
1039
1047
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
1040
|
-
let i =
|
|
1048
|
+
let i = vn(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
1041
1049
|
return {
|
|
1042
1050
|
id: e,
|
|
1043
1051
|
ids: r,
|
|
@@ -1046,52 +1054,52 @@ function gn(e, t, n) {
|
|
|
1046
1054
|
};
|
|
1047
1055
|
}) };
|
|
1048
1056
|
}
|
|
1049
|
-
var
|
|
1050
|
-
let t = e(
|
|
1051
|
-
return
|
|
1052
|
-
}),
|
|
1053
|
-
function
|
|
1057
|
+
var bn = y((e) => {
|
|
1058
|
+
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(yi);
|
|
1059
|
+
return yn(_n(n, e(z), e(B)), (e) => r[e] ?? null, e(mn));
|
|
1060
|
+
}), xn = () => _(bn), Sn = y((e) => e(bn).columns.length);
|
|
1061
|
+
function Cn(e, t) {
|
|
1054
1062
|
return e.columns.find((e) => e.id === t);
|
|
1055
1063
|
}
|
|
1056
|
-
function
|
|
1064
|
+
function wn(e, t) {
|
|
1057
1065
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
1058
1066
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
1059
1067
|
return n;
|
|
1060
1068
|
}
|
|
1061
|
-
function
|
|
1069
|
+
function Tn(e, t) {
|
|
1062
1070
|
for (let n of e.columns) {
|
|
1063
1071
|
let e = n.folds.get(t);
|
|
1064
1072
|
if (e !== void 0) return e;
|
|
1065
1073
|
}
|
|
1066
1074
|
}
|
|
1067
|
-
function
|
|
1075
|
+
function En(e, t) {
|
|
1068
1076
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
1069
1077
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
1070
1078
|
}
|
|
1071
|
-
function
|
|
1072
|
-
let n =
|
|
1073
|
-
return
|
|
1079
|
+
function Dn(e, t) {
|
|
1080
|
+
let n = En(e, t);
|
|
1081
|
+
return Tn(e, t) === void 0 ? n : [...n, t];
|
|
1074
1082
|
}
|
|
1075
|
-
var
|
|
1076
|
-
function
|
|
1083
|
+
var On = /* @__PURE__ */ new Set(/* @__PURE__ */ "__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup".split("."));
|
|
1084
|
+
function kn(e, t = !0) {
|
|
1077
1085
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
1078
1086
|
}
|
|
1079
|
-
function
|
|
1080
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
1087
|
+
function An(e, t) {
|
|
1088
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !On.has(e);
|
|
1081
1089
|
if (i(e)) return e;
|
|
1082
1090
|
let a = 1;
|
|
1083
1091
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
1084
1092
|
return r;
|
|
1085
1093
|
}
|
|
1086
|
-
function
|
|
1087
|
-
return
|
|
1094
|
+
function jn(e, t) {
|
|
1095
|
+
return Mn(e) ? `cell-${t}` : e;
|
|
1088
1096
|
}
|
|
1089
|
-
function
|
|
1097
|
+
function Mn(e) {
|
|
1090
1098
|
return !e || e === "_" || e === "__";
|
|
1091
1099
|
}
|
|
1092
1100
|
//#endregion
|
|
1093
1101
|
//#region src/core/cells/types.ts
|
|
1094
|
-
function
|
|
1102
|
+
function Nn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
1095
1103
|
return {
|
|
1096
1104
|
id: e,
|
|
1097
1105
|
config: r || {
|
|
@@ -1104,7 +1112,7 @@ function kn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
1104
1112
|
code: n
|
|
1105
1113
|
};
|
|
1106
1114
|
}
|
|
1107
|
-
function
|
|
1115
|
+
function Pn(e) {
|
|
1108
1116
|
return {
|
|
1109
1117
|
hide_code: !1,
|
|
1110
1118
|
disabled: !1,
|
|
@@ -1124,8 +1132,8 @@ function V(e) {
|
|
|
1124
1132
|
}
|
|
1125
1133
|
//#endregion
|
|
1126
1134
|
//#region src/core/cells/document.ts
|
|
1127
|
-
function
|
|
1128
|
-
let n = t.code ?? e.code, r =
|
|
1135
|
+
function Fn(e, t) {
|
|
1136
|
+
let n = t.code ?? e.code, r = v(e.config, t.config) ? e.config : Pn(t.config);
|
|
1129
1137
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
1130
1138
|
...e,
|
|
1131
1139
|
name: t.name,
|
|
@@ -1137,30 +1145,30 @@ function jn(e, t) {
|
|
|
1137
1145
|
config: r
|
|
1138
1146
|
};
|
|
1139
1147
|
}
|
|
1140
|
-
function
|
|
1141
|
-
let n =
|
|
1148
|
+
function In(e, t) {
|
|
1149
|
+
let n = v(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
1142
1150
|
for (let o of n) {
|
|
1143
1151
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
1144
1152
|
if (n === void 0) continue;
|
|
1145
1153
|
if (s === void 0) {
|
|
1146
1154
|
r = {
|
|
1147
1155
|
...r,
|
|
1148
|
-
[o]:
|
|
1156
|
+
[o]: Nn({
|
|
1149
1157
|
id: o,
|
|
1150
1158
|
code: n.code ?? "",
|
|
1151
1159
|
name: n.name,
|
|
1152
|
-
config:
|
|
1160
|
+
config: Pn(n.config)
|
|
1153
1161
|
})
|
|
1154
1162
|
}, i = {
|
|
1155
1163
|
...i,
|
|
1156
1164
|
[o]: i[o] ?? V()
|
|
1157
1165
|
}, a = {
|
|
1158
1166
|
...a,
|
|
1159
|
-
[o]: (0,
|
|
1167
|
+
[o]: (0, E.createRef)()
|
|
1160
1168
|
};
|
|
1161
1169
|
continue;
|
|
1162
1170
|
}
|
|
1163
|
-
let c =
|
|
1171
|
+
let c = Fn(s, n);
|
|
1164
1172
|
c !== s && (r = {
|
|
1165
1173
|
...r,
|
|
1166
1174
|
[o]: c
|
|
@@ -1179,40 +1187,40 @@ function Mn(e, t) {
|
|
|
1179
1187
|
cellHandles: a
|
|
1180
1188
|
};
|
|
1181
1189
|
}
|
|
1182
|
-
function
|
|
1190
|
+
function Ln({ store: e, model: t, reconcile: n, signal: r }) {
|
|
1183
1191
|
let i = () => {
|
|
1184
1192
|
let r = e.get(t.documentAtom);
|
|
1185
|
-
r !== null && (n(r), e.set(
|
|
1193
|
+
r !== null && (n(r), e.set(gn, r));
|
|
1186
1194
|
}, a = e.sub(t.documentAtom, i);
|
|
1187
1195
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
1188
1196
|
}
|
|
1189
|
-
async function
|
|
1190
|
-
let e = C.get(
|
|
1197
|
+
async function Rn() {
|
|
1198
|
+
let e = C.get(b);
|
|
1191
1199
|
e !== null && C.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
1192
1200
|
}
|
|
1193
1201
|
//#endregion
|
|
1194
1202
|
//#region src/core/cells/editor.ts
|
|
1195
|
-
var H =
|
|
1196
|
-
function
|
|
1203
|
+
var H = y(/* @__PURE__ */ new Set());
|
|
1204
|
+
function zn(e, t, n) {
|
|
1197
1205
|
return !!e && !t.has(n);
|
|
1198
1206
|
}
|
|
1199
|
-
|
|
1207
|
+
y(null, (e, t, { cellId: n }) => {
|
|
1200
1208
|
t(H, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
1201
|
-
}),
|
|
1209
|
+
}), y(null, (e, t, { cellId: n }) => e(H).has(n) ? (t(H, (e) => {
|
|
1202
1210
|
let t = new Set(e);
|
|
1203
1211
|
return t.delete(n), t;
|
|
1204
1212
|
}), !0) : !1);
|
|
1205
|
-
var
|
|
1206
|
-
|
|
1207
|
-
t(
|
|
1213
|
+
var Bn = y(/* @__PURE__ */ new Map());
|
|
1214
|
+
y(null, (e, t, { cellId: n }) => {
|
|
1215
|
+
t(Bn, (e) => {
|
|
1208
1216
|
let t = new Map(e);
|
|
1209
1217
|
return t.delete(n), t;
|
|
1210
1218
|
});
|
|
1211
1219
|
});
|
|
1212
1220
|
//#endregion
|
|
1213
1221
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1214
|
-
function
|
|
1215
|
-
return
|
|
1222
|
+
function Vn(e, t) {
|
|
1223
|
+
return ve(e * 1e3, t?.in);
|
|
1216
1224
|
}
|
|
1217
1225
|
//#endregion
|
|
1218
1226
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
@@ -1222,7 +1230,7 @@ var U = function(e, t) {
|
|
|
1222
1230
|
(function(e) {
|
|
1223
1231
|
e[e.EOS = 0] = "EOS", e[e.Text = 1] = "Text", e[e.Incomplete = 2] = "Incomplete", e[e.ESC = 3] = "ESC", e[e.Unknown = 4] = "Unknown", e[e.SGR = 5] = "SGR", e[e.OSCURL = 6] = "OSCURL";
|
|
1224
1232
|
})(W ||= {});
|
|
1225
|
-
var
|
|
1233
|
+
var Hn = class {
|
|
1226
1234
|
constructor() {
|
|
1227
1235
|
this.VERSION = "6.0.6", this.setup_palettes(), this._use_classes = !1, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1, this.fg = this.bg = null, this._buffer = "", this._url_allowlist = {
|
|
1228
1236
|
http: 1,
|
|
@@ -1467,7 +1475,7 @@ var Rn = class {
|
|
|
1467
1475
|
var r = this._buffer.charAt(1);
|
|
1468
1476
|
if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1469
1477
|
if (r == "[") {
|
|
1470
|
-
this._csi_regex ||=
|
|
1478
|
+
this._csi_regex ||= Un(Gn ||= U(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \x1B[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \x1B[ # CSI\n [ -~]* # anything legal\n ([\0-:]) # anything illegal\n )\n "], ["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]));
|
|
1471
1479
|
let t = this._buffer.match(this._csi_regex);
|
|
1472
1480
|
if (t === null) return e.kind = W.Incomplete, e;
|
|
1473
1481
|
if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
@@ -1478,7 +1486,7 @@ var Rn = class {
|
|
|
1478
1486
|
if (r == "]") {
|
|
1479
1487
|
if (t < 4) return e.kind = W.Incomplete, e;
|
|
1480
1488
|
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1481
|
-
this._osc_st ||=
|
|
1489
|
+
this._osc_st ||= Wn(Kn ||= U(["\n (?: # legal sequence\n (\x1B\\) # ESC | # alternate\n (\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-] # anything illegal\n | # alternate\n [\b-] # anything illegal\n | # alternate\n [-] # anything illegal\n )\n "], ["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "])), this._osc_st.lastIndex = 0;
|
|
1482
1490
|
{
|
|
1483
1491
|
let t = this._osc_st.exec(this._buffer);
|
|
1484
1492
|
if (t === null) return e.kind = W.Incomplete, e;
|
|
@@ -1489,7 +1497,7 @@ var Rn = class {
|
|
|
1489
1497
|
if (t === null) return e.kind = W.Incomplete, e;
|
|
1490
1498
|
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1491
1499
|
}
|
|
1492
|
-
this._osc_regex ||=
|
|
1500
|
+
this._osc_regex ||= Un(qn ||= U(["\n ^ # beginning of line\n #\n \x1B]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n \x1B]8;; # OSC Hyperlink End\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n "], ["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]));
|
|
1493
1501
|
let n = this._buffer.match(this._osc_regex);
|
|
1494
1502
|
if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1495
1503
|
e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
|
|
@@ -1574,15 +1582,15 @@ var Rn = class {
|
|
|
1574
1582
|
return t.length < 1 || !this._url_allowlist[t[0]] ? "" : `<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`;
|
|
1575
1583
|
}
|
|
1576
1584
|
};
|
|
1577
|
-
function
|
|
1585
|
+
function Un(e, ...t) {
|
|
1578
1586
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1579
1587
|
return new RegExp(n);
|
|
1580
1588
|
}
|
|
1581
|
-
function
|
|
1589
|
+
function Wn(e, ...t) {
|
|
1582
1590
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1583
1591
|
return new RegExp(n, "g");
|
|
1584
1592
|
}
|
|
1585
|
-
var
|
|
1593
|
+
var Gn, Kn, qn, Jn = new Hn();
|
|
1586
1594
|
function G(e) {
|
|
1587
1595
|
try {
|
|
1588
1596
|
let t = document.createElement("div");
|
|
@@ -1591,24 +1599,24 @@ function G(e) {
|
|
|
1591
1599
|
return t.error("Error parsing HTML content:", n), e;
|
|
1592
1600
|
}
|
|
1593
1601
|
}
|
|
1594
|
-
function
|
|
1602
|
+
function Yn(e) {
|
|
1595
1603
|
if (!e) return "";
|
|
1596
1604
|
try {
|
|
1597
|
-
return G(
|
|
1605
|
+
return G(Jn.ansi_to_html(e));
|
|
1598
1606
|
} catch (n) {
|
|
1599
1607
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1600
1608
|
}
|
|
1601
1609
|
}
|
|
1602
1610
|
//#endregion
|
|
1603
1611
|
//#region src/core/errors/traceback-atom.ts
|
|
1604
|
-
var
|
|
1612
|
+
var Xn = y(null);
|
|
1605
1613
|
//#endregion
|
|
1606
1614
|
//#region src/core/cells/logs.ts
|
|
1607
|
-
function
|
|
1615
|
+
function Zn(e) {
|
|
1608
1616
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1609
1617
|
}
|
|
1610
|
-
var
|
|
1611
|
-
function
|
|
1618
|
+
var Qn = !1;
|
|
1619
|
+
function $n(e) {
|
|
1612
1620
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1613
1621
|
for (let r of n) {
|
|
1614
1622
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1633,9 +1641,9 @@ function Yn(e) {
|
|
|
1633
1641
|
}
|
|
1634
1642
|
}
|
|
1635
1643
|
}
|
|
1636
|
-
if (t.forEach(
|
|
1644
|
+
if (t.forEach(er.log), n.length === 0 && F(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1637
1645
|
e.output.data.forEach((t) => {
|
|
1638
|
-
|
|
1646
|
+
er.log({
|
|
1639
1647
|
level: "stderr",
|
|
1640
1648
|
source: {
|
|
1641
1649
|
type: "cell",
|
|
@@ -1645,18 +1653,18 @@ function Yn(e) {
|
|
|
1645
1653
|
message: JSON.stringify(t)
|
|
1646
1654
|
});
|
|
1647
1655
|
});
|
|
1648
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(
|
|
1649
|
-
if (t.length > 0 && !
|
|
1650
|
-
|
|
1656
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(he) === "read";
|
|
1657
|
+
if (t.length > 0 && !Qn && n) {
|
|
1658
|
+
Qn = !0;
|
|
1651
1659
|
let e = t.find((e) => e.traceback);
|
|
1652
1660
|
o(e ? {
|
|
1653
1661
|
title: "An internal error occurred",
|
|
1654
1662
|
description: e.msg || "Click 'View' to see traceback",
|
|
1655
1663
|
variant: "danger",
|
|
1656
|
-
action:
|
|
1664
|
+
action: E.createElement(se, {
|
|
1657
1665
|
altText: "View traceback",
|
|
1658
1666
|
onClick: () => {
|
|
1659
|
-
C.set(
|
|
1667
|
+
C.set(Xn, {
|
|
1660
1668
|
traceback: e.traceback,
|
|
1661
1669
|
errorMessage: e.msg || "An internal error occurred"
|
|
1662
1670
|
});
|
|
@@ -1671,13 +1679,13 @@ function Yn(e) {
|
|
|
1671
1679
|
}
|
|
1672
1680
|
return t;
|
|
1673
1681
|
}
|
|
1674
|
-
var
|
|
1682
|
+
var er = { log: (e) => {
|
|
1675
1683
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1676
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1684
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${tr(e.timestamp)}]`, `(${Zn(e.source)}) ${e.message}`);
|
|
1677
1685
|
} };
|
|
1678
|
-
function
|
|
1686
|
+
function tr(e) {
|
|
1679
1687
|
try {
|
|
1680
|
-
return
|
|
1688
|
+
return Vn(e).toLocaleTimeString(void 0, {
|
|
1681
1689
|
hour12: !0,
|
|
1682
1690
|
hour: "numeric",
|
|
1683
1691
|
minute: "numeric",
|
|
@@ -1689,14 +1697,14 @@ function Zn(e) {
|
|
|
1689
1697
|
}
|
|
1690
1698
|
//#endregion
|
|
1691
1699
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
1692
|
-
function
|
|
1693
|
-
let r = document.getElementById(
|
|
1694
|
-
r ?
|
|
1700
|
+
function nr(e, n) {
|
|
1701
|
+
let r = document.getElementById(R.create(e));
|
|
1702
|
+
r ? ir(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
1695
1703
|
}
|
|
1696
|
-
function
|
|
1704
|
+
function rr() {
|
|
1697
1705
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
1698
1706
|
}
|
|
1699
|
-
function
|
|
1707
|
+
function ir(e, n) {
|
|
1700
1708
|
try {
|
|
1701
1709
|
e.focus(n);
|
|
1702
1710
|
} catch {
|
|
@@ -1705,7 +1713,7 @@ function er(e, n) {
|
|
|
1705
1713
|
}
|
|
1706
1714
|
//#endregion
|
|
1707
1715
|
//#region src/utils/timeout.ts
|
|
1708
|
-
function
|
|
1716
|
+
function ar(e, n) {
|
|
1709
1717
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
1710
1718
|
if (o < r) {
|
|
1711
1719
|
try {
|
|
@@ -1720,76 +1728,76 @@ function tr(e, n) {
|
|
|
1720
1728
|
}
|
|
1721
1729
|
//#endregion
|
|
1722
1730
|
//#region src/core/cells/utils.ts
|
|
1723
|
-
function
|
|
1724
|
-
return
|
|
1731
|
+
function or(e, t, n) {
|
|
1732
|
+
return fr(e, t, n).length > 0;
|
|
1725
1733
|
}
|
|
1726
|
-
function
|
|
1734
|
+
function sr(e) {
|
|
1727
1735
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
1728
1736
|
}
|
|
1729
|
-
function
|
|
1737
|
+
function cr(e) {
|
|
1730
1738
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1731
1739
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
1732
1740
|
return r;
|
|
1733
1741
|
}
|
|
1734
|
-
function
|
|
1742
|
+
function lr(e) {
|
|
1735
1743
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1736
1744
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
1737
1745
|
return r;
|
|
1738
1746
|
}
|
|
1739
|
-
function
|
|
1747
|
+
function ur(e) {
|
|
1740
1748
|
return e.history.length > 0;
|
|
1741
1749
|
}
|
|
1742
|
-
function
|
|
1750
|
+
function dr(e) {
|
|
1743
1751
|
let t = e.history[e.history.length - 1];
|
|
1744
1752
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
1745
1753
|
}
|
|
1746
|
-
function
|
|
1754
|
+
function fr(e, t, n) {
|
|
1747
1755
|
let { cellIds: r, cellData: i } = e;
|
|
1748
1756
|
return r.filter((e) => {
|
|
1749
|
-
let r =
|
|
1750
|
-
return r.status === "idle" ?
|
|
1757
|
+
let r = qe(t, e);
|
|
1758
|
+
return r.status === "idle" ? mr(r) || hr({
|
|
1751
1759
|
freshness: n(e),
|
|
1752
1760
|
interrupted: r.outcome === "interrupted",
|
|
1753
1761
|
disabled: i[e].config.disabled,
|
|
1754
1762
|
blocked: r.blocked
|
|
1755
|
-
}) :
|
|
1763
|
+
}) : pr(t.executions, e) && n(e).sourceChanged;
|
|
1756
1764
|
});
|
|
1757
1765
|
}
|
|
1758
|
-
function
|
|
1766
|
+
function pr(e, t) {
|
|
1759
1767
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
1760
1768
|
return r !== void 0 && r.status !== "completed";
|
|
1761
1769
|
}
|
|
1762
|
-
function
|
|
1770
|
+
function mr({ status: e, outcome: t }) {
|
|
1763
1771
|
return t === null && e !== "queued" && e !== "running";
|
|
1764
1772
|
}
|
|
1765
|
-
function
|
|
1773
|
+
function hr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
|
|
1766
1774
|
return e.sourceChanged || t || e.inputsChanged && !(n || r);
|
|
1767
1775
|
}
|
|
1768
|
-
function
|
|
1776
|
+
function gr({ errored: e, stopped: t }) {
|
|
1769
1777
|
return {
|
|
1770
1778
|
published: !0,
|
|
1771
1779
|
"has-error": e,
|
|
1772
1780
|
stopped: t
|
|
1773
1781
|
};
|
|
1774
1782
|
}
|
|
1775
|
-
function
|
|
1776
|
-
let a =
|
|
1783
|
+
function _r({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
1784
|
+
let a = F(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
1777
1785
|
return (e || t || n || a) && !o;
|
|
1778
1786
|
}
|
|
1779
1787
|
//#endregion
|
|
1780
1788
|
//#region src/core/network/requests.ts
|
|
1781
|
-
var
|
|
1782
|
-
function
|
|
1783
|
-
let e =
|
|
1789
|
+
var vr = y(null);
|
|
1790
|
+
function yr() {
|
|
1791
|
+
let e = _(vr);
|
|
1784
1792
|
return w(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
1785
1793
|
}
|
|
1786
|
-
function
|
|
1787
|
-
let e = C.get(
|
|
1794
|
+
function br() {
|
|
1795
|
+
let e = C.get(vr);
|
|
1788
1796
|
return w(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
1789
1797
|
}
|
|
1790
1798
|
//#endregion
|
|
1791
1799
|
//#region src/utils/storage/storage.ts
|
|
1792
|
-
var
|
|
1800
|
+
var xr = class {
|
|
1793
1801
|
store = /* @__PURE__ */ new Map();
|
|
1794
1802
|
get length() {
|
|
1795
1803
|
return this.store.size;
|
|
@@ -1810,16 +1818,16 @@ var _r = class {
|
|
|
1810
1818
|
this.store.set(e, t);
|
|
1811
1819
|
}
|
|
1812
1820
|
};
|
|
1813
|
-
function
|
|
1814
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
1815
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
1821
|
+
function Sr() {
|
|
1822
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = ye();
|
|
1823
|
+
return e ? window.localStorage : t ? window.sessionStorage : new xr();
|
|
1816
1824
|
}
|
|
1817
|
-
var
|
|
1818
|
-
function
|
|
1819
|
-
return
|
|
1825
|
+
var Cr = Sr(), wr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Tr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Er = /^data:image\//i, Dr = ["avatars.githubusercontent.com"];
|
|
1826
|
+
function Or(e) {
|
|
1827
|
+
return Er.test(e) ? [{
|
|
1820
1828
|
type: "image",
|
|
1821
1829
|
url: e
|
|
1822
|
-
}] : e.split(
|
|
1830
|
+
}] : e.split(wr).filter((e) => e !== "").map((e) => wr.test(e) ? Tr.test(e) || Er.test(e) || Dr.some((t) => e.includes(t)) ? {
|
|
1823
1831
|
type: "image",
|
|
1824
1832
|
url: e
|
|
1825
1833
|
} : {
|
|
@@ -1832,48 +1840,48 @@ function wr(e) {
|
|
|
1832
1840
|
}
|
|
1833
1841
|
//#endregion
|
|
1834
1842
|
//#region src/utils/json/json-parser.ts
|
|
1835
|
-
var
|
|
1843
|
+
var kr = new RegExp(wr.source, "g");
|
|
1836
1844
|
BigInt.prototype.toJSON = function() {
|
|
1837
1845
|
return JSON.rawJSON(this.toString());
|
|
1838
1846
|
};
|
|
1839
|
-
function
|
|
1847
|
+
function Ar(e) {
|
|
1840
1848
|
try {
|
|
1841
|
-
return JSON.parse(e, (e, t) =>
|
|
1849
|
+
return JSON.parse(e, (e, t) => Pr(t));
|
|
1842
1850
|
} catch {}
|
|
1843
1851
|
if (e == null || e === "") return {};
|
|
1844
1852
|
try {
|
|
1845
|
-
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 :
|
|
1853
|
+
return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : Pr(t) : Pr(t));
|
|
1846
1854
|
} catch {
|
|
1847
1855
|
return {};
|
|
1848
1856
|
}
|
|
1849
1857
|
}
|
|
1850
|
-
function
|
|
1858
|
+
function jr(e) {
|
|
1851
1859
|
if (e.length === 0) return "";
|
|
1852
1860
|
let t = Object.keys(e[0]);
|
|
1853
1861
|
return [
|
|
1854
1862
|
`| ${t.join(" | ")} |`,
|
|
1855
1863
|
`|${t.map(() => "---").join("|")}|`,
|
|
1856
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
1864
|
+
...e.map((e) => `| ${t.map((t) => Mr(e[t])).join(" | ")} |`)
|
|
1857
1865
|
].join("\n");
|
|
1858
1866
|
}
|
|
1859
|
-
function
|
|
1867
|
+
function Mr(e) {
|
|
1860
1868
|
if (e == null) return "";
|
|
1861
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
1869
|
+
if (Array.isArray(e) || typeof e == "object") return Nr(JSON.stringify(e));
|
|
1862
1870
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
1863
1871
|
t = t.replaceAll(n, (e) => {
|
|
1864
1872
|
let t = `__MDLINK_${i++}__`;
|
|
1865
1873
|
return r.set(t, e), t;
|
|
1866
|
-
}), t = t.replaceAll(
|
|
1874
|
+
}), t = t.replaceAll(kr, "[$1]($1)");
|
|
1867
1875
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
1868
|
-
return
|
|
1876
|
+
return Nr(t);
|
|
1869
1877
|
}
|
|
1870
|
-
function
|
|
1878
|
+
function Nr(e) {
|
|
1871
1879
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
1872
1880
|
}
|
|
1873
|
-
function
|
|
1881
|
+
function Pr(e) {
|
|
1874
1882
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
1875
1883
|
}
|
|
1876
|
-
var
|
|
1884
|
+
var Fr = new class {
|
|
1877
1885
|
getFilename() {
|
|
1878
1886
|
return this.getSearchParam("filename");
|
|
1879
1887
|
}
|
|
@@ -1900,39 +1908,39 @@ var jr = new class {
|
|
|
1900
1908
|
}();
|
|
1901
1909
|
//#endregion
|
|
1902
1910
|
//#region src/core/dom/htmlUtils.ts
|
|
1903
|
-
function
|
|
1904
|
-
return
|
|
1911
|
+
function Ir(e) {
|
|
1912
|
+
return Ar(e ?? "");
|
|
1905
1913
|
}
|
|
1906
|
-
function
|
|
1907
|
-
return
|
|
1914
|
+
function Lr(e) {
|
|
1915
|
+
return ce.mapValues(e.dataset, (e) => typeof e == "string" ? Ir(e) : e);
|
|
1908
1916
|
}
|
|
1909
|
-
function
|
|
1910
|
-
let n = e.parentElement ?
|
|
1911
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
1917
|
+
function Rr(e, t) {
|
|
1918
|
+
let n = e.parentElement ? fn.parse(e.parentElement) : void 0;
|
|
1919
|
+
return n && t.has(n) ? t.lookupValue(n) : Ir(e.dataset.initialValue);
|
|
1912
1920
|
}
|
|
1913
|
-
function
|
|
1914
|
-
if (
|
|
1915
|
-
if (
|
|
1916
|
-
let e =
|
|
1921
|
+
function zr() {
|
|
1922
|
+
if (x()) return document.title || null;
|
|
1923
|
+
if (_e()) {
|
|
1924
|
+
let e = Fr.getFilename();
|
|
1917
1925
|
if (e) return e;
|
|
1918
1926
|
}
|
|
1919
1927
|
let e = document.querySelector("marimo-filename");
|
|
1920
|
-
|
|
1928
|
+
ge(e, "marimo-filename tag not found");
|
|
1921
1929
|
let t = e.innerHTML;
|
|
1922
1930
|
return t.length === 0 ? null : t;
|
|
1923
1931
|
}
|
|
1924
1932
|
//#endregion
|
|
1925
1933
|
//#region src/core/saving/file-state.ts
|
|
1926
|
-
var
|
|
1927
|
-
|
|
1928
|
-
var
|
|
1929
|
-
|
|
1934
|
+
var K = y(zr());
|
|
1935
|
+
y(null);
|
|
1936
|
+
var Br = y(null);
|
|
1937
|
+
y(void 0);
|
|
1930
1938
|
//#endregion
|
|
1931
1939
|
//#region src/utils/storage/typed.ts
|
|
1932
|
-
var
|
|
1940
|
+
var Vr = class {
|
|
1933
1941
|
defaultValue;
|
|
1934
1942
|
storage;
|
|
1935
|
-
constructor(e, t =
|
|
1943
|
+
constructor(e, t = Cr) {
|
|
1936
1944
|
this.defaultValue = e, this.storage = t;
|
|
1937
1945
|
}
|
|
1938
1946
|
get(e) {
|
|
@@ -1949,11 +1957,11 @@ var Ir = class {
|
|
|
1949
1957
|
remove(e) {
|
|
1950
1958
|
this.storage.removeItem(e);
|
|
1951
1959
|
}
|
|
1952
|
-
},
|
|
1960
|
+
}, Hr = class {
|
|
1953
1961
|
schema;
|
|
1954
1962
|
getDefaultValue;
|
|
1955
1963
|
storage;
|
|
1956
|
-
constructor(e, t, n =
|
|
1964
|
+
constructor(e, t, n = Cr) {
|
|
1957
1965
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
1958
1966
|
}
|
|
1959
1967
|
get(e) {
|
|
@@ -1972,15 +1980,15 @@ var Ir = class {
|
|
|
1972
1980
|
remove(e) {
|
|
1973
1981
|
this.storage.removeItem(e);
|
|
1974
1982
|
}
|
|
1975
|
-
},
|
|
1983
|
+
}, Ur = class extends Hr {
|
|
1976
1984
|
filename;
|
|
1977
1985
|
unsubscribeFromFilename;
|
|
1978
1986
|
constructor(e, t, n) {
|
|
1979
|
-
let r = C.get(
|
|
1987
|
+
let r = C.get(K);
|
|
1980
1988
|
super(t, n), this.filename = r;
|
|
1981
1989
|
try {
|
|
1982
|
-
this.unsubscribeFromFilename = C.sub(
|
|
1983
|
-
let t = C.get(
|
|
1990
|
+
this.unsubscribeFromFilename = C.sub(K, () => {
|
|
1991
|
+
let t = C.get(K);
|
|
1984
1992
|
this.handleFilenameChange(e, t);
|
|
1985
1993
|
});
|
|
1986
1994
|
} catch {
|
|
@@ -2008,7 +2016,7 @@ var Ir = class {
|
|
|
2008
2016
|
dispose() {
|
|
2009
2017
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2010
2018
|
}
|
|
2011
|
-
},
|
|
2019
|
+
}, q = {
|
|
2012
2020
|
VariableName: "VariableName",
|
|
2013
2021
|
FunctionDefinition: "FunctionDefinition",
|
|
2014
2022
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2033,30 +2041,30 @@ var Ir = class {
|
|
|
2033
2041
|
Comment: "Comment",
|
|
2034
2042
|
String: "String",
|
|
2035
2043
|
FormatString: "FormatString"
|
|
2036
|
-
},
|
|
2044
|
+
}, J = {
|
|
2037
2045
|
For: "for",
|
|
2038
2046
|
In: "in",
|
|
2039
2047
|
As: "as",
|
|
2040
2048
|
Import: "import"
|
|
2041
|
-
},
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
+
}, Wr = /* @__PURE__ */ new Set([
|
|
2050
|
+
q.FunctionDefinition,
|
|
2051
|
+
q.LambdaExpression,
|
|
2052
|
+
q.ArrayComprehensionExpression,
|
|
2053
|
+
q.SetComprehensionExpression,
|
|
2054
|
+
q.DictionaryComprehensionExpression,
|
|
2055
|
+
q.ComprehensionExpression,
|
|
2056
|
+
q.ClassDefinition
|
|
2049
2057
|
]);
|
|
2050
|
-
|
|
2058
|
+
q.Comment, q.String, q.FormatString;
|
|
2051
2059
|
//#endregion
|
|
2052
2060
|
//#region src/core/codemirror/utils.ts
|
|
2053
|
-
function
|
|
2061
|
+
function Gr(e) {
|
|
2054
2062
|
e && e.dispatch({ selection: {
|
|
2055
2063
|
anchor: e.state.doc.length,
|
|
2056
2064
|
head: e.state.doc.length
|
|
2057
2065
|
} });
|
|
2058
2066
|
}
|
|
2059
|
-
function
|
|
2067
|
+
function Kr(e) {
|
|
2060
2068
|
let t = e.dom.closest(".marimo-cell");
|
|
2061
2069
|
t && requestAnimationFrame(() => {
|
|
2062
2070
|
t.scrollIntoView({
|
|
@@ -2068,29 +2076,29 @@ function Vr(e) {
|
|
|
2068
2076
|
}
|
|
2069
2077
|
//#endregion
|
|
2070
2078
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2071
|
-
var
|
|
2072
|
-
function
|
|
2079
|
+
var qr = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2080
|
+
function Jr(e, t) {
|
|
2073
2081
|
requestAnimationFrame(() => {
|
|
2074
2082
|
e.focus(), e.dispatch({
|
|
2075
2083
|
selection: {
|
|
2076
2084
|
anchor: t,
|
|
2077
2085
|
head: t
|
|
2078
2086
|
},
|
|
2079
|
-
effects:
|
|
2087
|
+
effects: fe.scrollIntoView(t, { y: "center" })
|
|
2080
2088
|
});
|
|
2081
|
-
}),
|
|
2089
|
+
}), Kr(e);
|
|
2082
2090
|
}
|
|
2083
|
-
function
|
|
2084
|
-
let n =
|
|
2091
|
+
function Yr(e, t) {
|
|
2092
|
+
let n = ue(e), r = null;
|
|
2085
2093
|
return n.iterate({ enter: (n) => {
|
|
2086
2094
|
if (r !== null) return !1;
|
|
2087
|
-
if (n.name ===
|
|
2088
|
-
if (n.name ===
|
|
2095
|
+
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2096
|
+
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2089
2097
|
} }), r;
|
|
2090
2098
|
}
|
|
2091
|
-
function
|
|
2099
|
+
function Xr(e, t) {
|
|
2092
2100
|
let n = [], r = e.resolveInner(t, 0);
|
|
2093
|
-
for (; r;)
|
|
2101
|
+
for (; r;) Wr.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2094
2102
|
id: r.from,
|
|
2095
2103
|
type: r.name
|
|
2096
2104
|
})), r = r.parent;
|
|
@@ -2099,70 +2107,70 @@ function Gr(e, t) {
|
|
|
2099
2107
|
type: "global"
|
|
2100
2108
|
}), n;
|
|
2101
2109
|
}
|
|
2102
|
-
function
|
|
2110
|
+
function Y(e, t, n) {
|
|
2103
2111
|
e.push({
|
|
2104
2112
|
scopeId: t,
|
|
2105
2113
|
from: n
|
|
2106
2114
|
});
|
|
2107
2115
|
}
|
|
2108
|
-
function
|
|
2116
|
+
function Zr(e, t) {
|
|
2109
2117
|
if (e.firstChild()) do
|
|
2110
2118
|
t(e.node);
|
|
2111
2119
|
while (e.nextSibling());
|
|
2112
2120
|
}
|
|
2113
|
-
function
|
|
2121
|
+
function Qr(e, t) {
|
|
2114
2122
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2115
2123
|
switch (e.name) {
|
|
2116
|
-
case
|
|
2117
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2124
|
+
case q.VariableName:
|
|
2125
|
+
n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2118
2126
|
break;
|
|
2119
|
-
case
|
|
2120
|
-
case
|
|
2127
|
+
case q.TupleExpression:
|
|
2128
|
+
case q.ArrayExpression: {
|
|
2121
2129
|
let n = e.node.cursor();
|
|
2122
2130
|
n.firstChild();
|
|
2123
2131
|
do
|
|
2124
|
-
|
|
2132
|
+
Qr(n, t);
|
|
2125
2133
|
while (n.nextSibling());
|
|
2126
2134
|
break;
|
|
2127
2135
|
}
|
|
2128
2136
|
}
|
|
2129
2137
|
}
|
|
2130
|
-
function
|
|
2138
|
+
function $r(e, t) {
|
|
2131
2139
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2132
2140
|
o.firstChild();
|
|
2133
2141
|
do {
|
|
2134
|
-
if (o.name !==
|
|
2142
|
+
if (o.name !== q.ParamList) continue;
|
|
2135
2143
|
let e = o.node.cursor();
|
|
2136
2144
|
e.firstChild();
|
|
2137
2145
|
do
|
|
2138
|
-
e.name ===
|
|
2146
|
+
e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2139
2147
|
while (e.nextSibling());
|
|
2140
2148
|
} while (o.nextSibling());
|
|
2141
2149
|
}
|
|
2142
|
-
function
|
|
2150
|
+
function ei(e, t) {
|
|
2143
2151
|
let n = e.cursor();
|
|
2144
2152
|
n.firstChild();
|
|
2145
2153
|
let r = !1;
|
|
2146
2154
|
do
|
|
2147
|
-
if (n.name ===
|
|
2148
|
-
else if (r && n.name ===
|
|
2149
|
-
else r &&
|
|
2155
|
+
if (n.name === J.For) r = !0;
|
|
2156
|
+
else if (r && n.name === J.In) break;
|
|
2157
|
+
else r && Qr(n, t);
|
|
2150
2158
|
while (n.nextSibling());
|
|
2151
2159
|
}
|
|
2152
|
-
function
|
|
2153
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2160
|
+
function ti(e, t) {
|
|
2161
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Wr.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2154
2162
|
switch (s) {
|
|
2155
|
-
case
|
|
2156
|
-
case
|
|
2163
|
+
case q.FunctionDefinition:
|
|
2164
|
+
case q.ClassDefinition: {
|
|
2157
2165
|
let t = e.cursor();
|
|
2158
2166
|
t.firstChild();
|
|
2159
2167
|
do
|
|
2160
|
-
if (t.name ===
|
|
2161
|
-
|
|
2168
|
+
if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2169
|
+
Y(a, i[i.length - 1] ?? -1, t.from);
|
|
2162
2170
|
break;
|
|
2163
2171
|
}
|
|
2164
2172
|
while (t.nextSibling());
|
|
2165
|
-
s ===
|
|
2173
|
+
s === q.FunctionDefinition && $r(e, {
|
|
2166
2174
|
state: n,
|
|
2167
2175
|
variableName: r,
|
|
2168
2176
|
scopeId: c,
|
|
@@ -2170,38 +2178,38 @@ function Xr(e, t) {
|
|
|
2170
2178
|
});
|
|
2171
2179
|
break;
|
|
2172
2180
|
}
|
|
2173
|
-
case
|
|
2174
|
-
|
|
2181
|
+
case q.LambdaExpression:
|
|
2182
|
+
$r(e, {
|
|
2175
2183
|
state: n,
|
|
2176
2184
|
variableName: r,
|
|
2177
2185
|
scopeId: c,
|
|
2178
2186
|
declarations: a
|
|
2179
2187
|
});
|
|
2180
2188
|
break;
|
|
2181
|
-
case
|
|
2182
|
-
case
|
|
2183
|
-
case
|
|
2184
|
-
case
|
|
2185
|
-
case
|
|
2186
|
-
|
|
2189
|
+
case q.ArrayComprehensionExpression:
|
|
2190
|
+
case q.DictionaryComprehensionExpression:
|
|
2191
|
+
case q.SetComprehensionExpression:
|
|
2192
|
+
case q.ComprehensionExpression:
|
|
2193
|
+
case q.ForStatement:
|
|
2194
|
+
ei(e, {
|
|
2187
2195
|
state: n,
|
|
2188
2196
|
variableName: r,
|
|
2189
2197
|
scopeId: u,
|
|
2190
2198
|
declarations: a
|
|
2191
2199
|
});
|
|
2192
2200
|
break;
|
|
2193
|
-
case
|
|
2201
|
+
case q.AssignStatement: {
|
|
2194
2202
|
let t = [], i = e.cursor();
|
|
2195
2203
|
i.firstChild();
|
|
2196
2204
|
do
|
|
2197
|
-
i.name ===
|
|
2205
|
+
i.name === q.AssignOp && t.push(i.from);
|
|
2198
2206
|
while (i.nextSibling());
|
|
2199
2207
|
let o = t[t.length - 1];
|
|
2200
2208
|
if (o === void 0) break;
|
|
2201
2209
|
let s = e.cursor();
|
|
2202
2210
|
s.firstChild();
|
|
2203
2211
|
do
|
|
2204
|
-
s.from < o &&
|
|
2212
|
+
s.from < o && Qr(s, {
|
|
2205
2213
|
state: n,
|
|
2206
2214
|
variableName: r,
|
|
2207
2215
|
scopeId: u,
|
|
@@ -2210,14 +2218,14 @@ function Xr(e, t) {
|
|
|
2210
2218
|
while (s.nextSibling());
|
|
2211
2219
|
break;
|
|
2212
2220
|
}
|
|
2213
|
-
case
|
|
2221
|
+
case q.ImportStatement: {
|
|
2214
2222
|
let t = e.cursor();
|
|
2215
2223
|
t.firstChild();
|
|
2216
2224
|
let i = !1, o = null, s = () => {
|
|
2217
|
-
o?.matches &&
|
|
2225
|
+
o?.matches && Y(a, u, o.from), o = null;
|
|
2218
2226
|
};
|
|
2219
2227
|
do
|
|
2220
|
-
t.name ===
|
|
2228
|
+
t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
|
|
2221
2229
|
from: t.from,
|
|
2222
2230
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2223
2231
|
}) : t.name === "," && s());
|
|
@@ -2225,19 +2233,19 @@ function Xr(e, t) {
|
|
|
2225
2233
|
s();
|
|
2226
2234
|
break;
|
|
2227
2235
|
}
|
|
2228
|
-
case
|
|
2229
|
-
case
|
|
2236
|
+
case q.TryStatement:
|
|
2237
|
+
case q.WithStatement: {
|
|
2230
2238
|
let t = e.cursor();
|
|
2231
2239
|
t.firstChild();
|
|
2232
2240
|
let i = !1;
|
|
2233
2241
|
do
|
|
2234
|
-
t.name ===
|
|
2242
|
+
t.name === J.As ? i = !0 : i && t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r && (Y(a, u, t.from), i = !1);
|
|
2235
2243
|
while (t.nextSibling());
|
|
2236
2244
|
break;
|
|
2237
2245
|
}
|
|
2238
2246
|
}
|
|
2239
|
-
|
|
2240
|
-
|
|
2247
|
+
Zr(o, (e) => {
|
|
2248
|
+
ti(e, {
|
|
2241
2249
|
state: n,
|
|
2242
2250
|
variableName: r,
|
|
2243
2251
|
scopeStack: l,
|
|
@@ -2245,69 +2253,86 @@ function Xr(e, t) {
|
|
|
2245
2253
|
});
|
|
2246
2254
|
});
|
|
2247
2255
|
}
|
|
2248
|
-
function
|
|
2249
|
-
let r =
|
|
2250
|
-
|
|
2256
|
+
function ni(e, t, n) {
|
|
2257
|
+
let r = ue(e), i = [];
|
|
2258
|
+
ti(r, {
|
|
2251
2259
|
state: e,
|
|
2252
2260
|
variableName: t,
|
|
2253
2261
|
scopeStack: [],
|
|
2254
2262
|
declarations: i
|
|
2255
2263
|
});
|
|
2256
2264
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2257
|
-
for (let e of
|
|
2258
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2265
|
+
for (let e of Xr(r, a)) {
|
|
2266
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !qr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2259
2267
|
if (t) return t.from;
|
|
2260
2268
|
}
|
|
2261
2269
|
return null;
|
|
2262
2270
|
}
|
|
2263
|
-
function
|
|
2264
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2265
|
-
return i !== null && (
|
|
2271
|
+
function ri(e, t, n) {
|
|
2272
|
+
let { state: r } = e, i = n === void 0 ? Yr(r, t) : ni(r, t, n);
|
|
2273
|
+
return i !== null && (Jr(e, i), !0);
|
|
2266
2274
|
}
|
|
2267
|
-
function
|
|
2268
|
-
return
|
|
2275
|
+
function ii(e, t) {
|
|
2276
|
+
return Jr(e, e.state.doc.line(t).from), !0;
|
|
2269
2277
|
}
|
|
2270
2278
|
//#endregion
|
|
2279
|
+
//#region src/core/network/connection.ts
|
|
2280
|
+
var X = y({ state: j.NOT_STARTED });
|
|
2281
|
+
h(null, (e, t) => t === null ? null : {
|
|
2282
|
+
phase: t.phase,
|
|
2283
|
+
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2284
|
+
});
|
|
2285
|
+
function ai() {
|
|
2286
|
+
return oe(X, (e) => e.state === j.OPEN);
|
|
2287
|
+
}
|
|
2288
|
+
function oi() {
|
|
2289
|
+
return me() ? ai() : Promise.resolve();
|
|
2290
|
+
}
|
|
2291
|
+
y((e) => e(X).state === j.CONNECTING), y((e) => e(X).state === j.OPEN), y((e) => {
|
|
2292
|
+
let t = e(X);
|
|
2293
|
+
return t.state === j.OPEN || t.state === j.NOT_STARTED;
|
|
2294
|
+
}), y((e) => e(X).state === j.CLOSED);
|
|
2295
|
+
//#endregion
|
|
2271
2296
|
//#region src/components/ui/checkbox.tsx
|
|
2272
|
-
var
|
|
2273
|
-
let r = (0,
|
|
2297
|
+
var si = E.forwardRef((e, t) => {
|
|
2298
|
+
let r = (0, bt.c)(13), i, a;
|
|
2274
2299
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2275
2300
|
let o;
|
|
2276
2301
|
r[3] === i ? o = r[4] : (o = n("flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", i), r[3] = i, r[4] = o);
|
|
2277
2302
|
let s;
|
|
2278
2303
|
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];
|
|
2279
2304
|
let c;
|
|
2280
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0,
|
|
2305
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, D.jsx)(Me, {
|
|
2281
2306
|
className: s,
|
|
2282
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
2307
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, D.jsx)(xe, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, D.jsx)(l, { className: "h-4 w-4" })
|
|
2283
2308
|
}), r[6] = a.checked, r[7] = c);
|
|
2284
2309
|
let u;
|
|
2285
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0,
|
|
2310
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, D.jsx)(Ae, {
|
|
2286
2311
|
ref: t,
|
|
2287
2312
|
className: o,
|
|
2288
2313
|
...a,
|
|
2289
2314
|
children: c
|
|
2290
2315
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2291
2316
|
});
|
|
2292
|
-
|
|
2317
|
+
si.displayName = Ae.displayName;
|
|
2293
2318
|
//#endregion
|
|
2294
2319
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2295
|
-
function
|
|
2320
|
+
function ci({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2296
2321
|
if (!n) return;
|
|
2297
|
-
let o = document.getElementById(
|
|
2322
|
+
let o = document.getElementById(R.create(e));
|
|
2298
2323
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2299
|
-
else if (
|
|
2324
|
+
else if (rr()) ir(o);
|
|
2300
2325
|
else {
|
|
2301
|
-
if (r)
|
|
2326
|
+
if (r) ir(o);
|
|
2302
2327
|
else {
|
|
2303
|
-
|
|
2328
|
+
Rt.promote(e);
|
|
2304
2329
|
let r = n.current?.editorView;
|
|
2305
2330
|
if (!r) {
|
|
2306
2331
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2307
2332
|
return;
|
|
2308
2333
|
}
|
|
2309
2334
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2310
|
-
if (
|
|
2335
|
+
if (ar(() => (r.focus(), r.hasFocus), {
|
|
2311
2336
|
retries: 5,
|
|
2312
2337
|
delay: 20
|
|
2313
2338
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2320,7 +2345,7 @@ function ti({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2320
2345
|
anchor: e.from,
|
|
2321
2346
|
head: e.from
|
|
2322
2347
|
} });
|
|
2323
|
-
} else a &&
|
|
2348
|
+
} else a && ri(r, a);
|
|
2324
2349
|
}
|
|
2325
2350
|
o.scrollIntoView({
|
|
2326
2351
|
behavior: "smooth",
|
|
@@ -2328,21 +2353,21 @@ function ti({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2328
2353
|
});
|
|
2329
2354
|
}
|
|
2330
2355
|
}
|
|
2331
|
-
function
|
|
2356
|
+
function li() {
|
|
2332
2357
|
let e = document.getElementById("App");
|
|
2333
2358
|
e?.scrollTo({
|
|
2334
2359
|
top: e.scrollHeight,
|
|
2335
2360
|
behavior: "smooth"
|
|
2336
2361
|
});
|
|
2337
2362
|
}
|
|
2338
|
-
function
|
|
2363
|
+
function ui() {
|
|
2339
2364
|
document.getElementById("App")?.scrollTo({
|
|
2340
2365
|
top: 0,
|
|
2341
2366
|
behavior: "smooth"
|
|
2342
2367
|
});
|
|
2343
2368
|
}
|
|
2344
|
-
function
|
|
2345
|
-
let t = document.getElementById(
|
|
2369
|
+
function di(e) {
|
|
2370
|
+
let t = document.getElementById(R.create(e));
|
|
2346
2371
|
return t?.scrollIntoView({
|
|
2347
2372
|
behavior: "smooth",
|
|
2348
2373
|
block: "center"
|
|
@@ -2350,7 +2375,7 @@ function ii(e) {
|
|
|
2350
2375
|
}
|
|
2351
2376
|
//#endregion
|
|
2352
2377
|
//#region src/core/cells/cells.ts
|
|
2353
|
-
function
|
|
2378
|
+
function fi(e) {
|
|
2354
2379
|
let t = {
|
|
2355
2380
|
column: 0,
|
|
2356
2381
|
hide_code: !1,
|
|
@@ -2360,24 +2385,24 @@ function ai(e) {
|
|
|
2360
2385
|
return {
|
|
2361
2386
|
...e,
|
|
2362
2387
|
cellData: {
|
|
2363
|
-
[
|
|
2364
|
-
id:
|
|
2388
|
+
[L]: Nn({
|
|
2389
|
+
id: L,
|
|
2365
2390
|
config: t
|
|
2366
2391
|
}),
|
|
2367
2392
|
...e.cellData
|
|
2368
2393
|
},
|
|
2369
2394
|
cellRuntime: {
|
|
2370
|
-
[
|
|
2395
|
+
[L]: V(),
|
|
2371
2396
|
...e.cellRuntime
|
|
2372
2397
|
},
|
|
2373
2398
|
cellHandles: {
|
|
2374
|
-
[
|
|
2399
|
+
[L]: (0, E.createRef)(),
|
|
2375
2400
|
...e.cellHandles
|
|
2376
2401
|
}
|
|
2377
2402
|
};
|
|
2378
2403
|
}
|
|
2379
|
-
function
|
|
2380
|
-
return
|
|
2404
|
+
function pi() {
|
|
2405
|
+
return fi({
|
|
2381
2406
|
cellIds: [],
|
|
2382
2407
|
cellData: {},
|
|
2383
2408
|
cellRuntime: {},
|
|
@@ -2387,7 +2412,7 @@ function oi() {
|
|
|
2387
2412
|
cellLogs: []
|
|
2388
2413
|
});
|
|
2389
2414
|
}
|
|
2390
|
-
var { reducer:
|
|
2415
|
+
var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
|
|
2391
2416
|
prepareForRun: (e, t) => Q({
|
|
2392
2417
|
state: e,
|
|
2393
2418
|
cellId: t.cellId,
|
|
@@ -2400,11 +2425,11 @@ var { reducer: si, createActions: ci, useActions: li, valueAtom: Z } = pe(oi, {
|
|
|
2400
2425
|
let n = t.cell_id, r = Q({
|
|
2401
2426
|
state: e,
|
|
2402
2427
|
cellId: n,
|
|
2403
|
-
cellReducer: (e) =>
|
|
2428
|
+
cellReducer: (e) => Qt(e, t)
|
|
2404
2429
|
});
|
|
2405
2430
|
return {
|
|
2406
2431
|
...r,
|
|
2407
|
-
cellLogs: [...r.cellLogs,
|
|
2432
|
+
cellLogs: [...r.cellLogs, ...$n(t)]
|
|
2408
2433
|
};
|
|
2409
2434
|
},
|
|
2410
2435
|
addLogs: (e, t) => ({
|
|
@@ -2412,8 +2437,8 @@ var { reducer: si, createActions: ci, useActions: li, valueAtom: Z } = pe(oi, {
|
|
|
2412
2437
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
2413
2438
|
}),
|
|
2414
2439
|
reconcileDocument: (e, t) => {
|
|
2415
|
-
let n =
|
|
2416
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
2440
|
+
let n = In(e, t);
|
|
2441
|
+
for (let t of e.cellIds) t in n.cellData || ji(t);
|
|
2417
2442
|
return n;
|
|
2418
2443
|
},
|
|
2419
2444
|
setStdinResponse: (e, n) => {
|
|
@@ -2439,8 +2464,8 @@ var { reducer: si, createActions: ci, useActions: li, valueAtom: Z } = pe(oi, {
|
|
|
2439
2464
|
});
|
|
2440
2465
|
},
|
|
2441
2466
|
resetCellRuntimes: (e) => {
|
|
2442
|
-
let t =
|
|
2443
|
-
for (let r of [...e.cellIds,
|
|
2467
|
+
let t = _e(), n = { ...e.cellRuntime };
|
|
2468
|
+
for (let r of [...e.cellIds, L]) {
|
|
2444
2469
|
let i = e.cellRuntime[r];
|
|
2445
2470
|
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : V();
|
|
2446
2471
|
}
|
|
@@ -2453,10 +2478,10 @@ var { reducer: si, createActions: ci, useActions: li, valueAtom: Z } = pe(oi, {
|
|
|
2453
2478
|
let t = e.scrollKey;
|
|
2454
2479
|
if (t === null) return e;
|
|
2455
2480
|
let n = t;
|
|
2456
|
-
return
|
|
2481
|
+
return ci({
|
|
2457
2482
|
cellId: n,
|
|
2458
2483
|
cell: e.cellHandles[n],
|
|
2459
|
-
isCodeHidden:
|
|
2484
|
+
isCodeHidden: zn(e.cellData[n]?.config.hide_code, C.get(H), n),
|
|
2460
2485
|
codeFocus: void 0,
|
|
2461
2486
|
variableName: void 0
|
|
2462
2487
|
}), {
|
|
@@ -2464,8 +2489,8 @@ var { reducer: si, createActions: ci, useActions: li, valueAtom: Z } = pe(oi, {
|
|
|
2464
2489
|
scrollKey: null
|
|
2465
2490
|
};
|
|
2466
2491
|
},
|
|
2467
|
-
foldAll: (e) => (
|
|
2468
|
-
unfoldAll: (e) => (
|
|
2492
|
+
foldAll: (e) => (Nt(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2493
|
+
unfoldAll: (e) => (Pt(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2469
2494
|
clearLogs: (e) => ({
|
|
2470
2495
|
...e,
|
|
2471
2496
|
cellLogs: []
|
|
@@ -2515,15 +2540,15 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
2515
2540
|
}
|
|
2516
2541
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2517
2542
|
}
|
|
2518
|
-
var
|
|
2519
|
-
C.set(Z, (t) =>
|
|
2520
|
-
}).addLogs, $ =
|
|
2521
|
-
|
|
2522
|
-
var
|
|
2543
|
+
var _i = hi((e) => {
|
|
2544
|
+
C.set(Z, (t) => mi(t, e));
|
|
2545
|
+
}).addLogs, $ = y((e) => e(Z).cellIds);
|
|
2546
|
+
y((e) => e($).length === 1), y((e) => cr(e(Z)).length > 0), y((e) => lr(e(Z)).length > 0), y((e) => ur(e(Z))), y((e) => dr(e(Z))), y((e) => or(e(Z), e(P), e(ut)));
|
|
2547
|
+
var vi = y((e) => {
|
|
2523
2548
|
let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
|
|
2524
2549
|
return t.map((e) => {
|
|
2525
2550
|
let t = n[e], { name: i } = r[e];
|
|
2526
|
-
if (
|
|
2551
|
+
if (F(t.output?.mimetype)) {
|
|
2527
2552
|
w(Array.isArray(t.output.data), "Expected array data");
|
|
2528
2553
|
let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
|
|
2529
2554
|
if (n.length > 0) return {
|
|
@@ -2537,90 +2562,90 @@ var di = v((e) => {
|
|
|
2537
2562
|
}
|
|
2538
2563
|
return null;
|
|
2539
2564
|
}).filter(Boolean);
|
|
2540
|
-
}),
|
|
2565
|
+
}), yi = ae(y((e) => {
|
|
2541
2566
|
let t = {};
|
|
2542
|
-
for (let [n, r] of
|
|
2567
|
+
for (let [n, r] of ce.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
|
|
2543
2568
|
return t;
|
|
2544
|
-
})),
|
|
2545
|
-
let t = e($), n = e(
|
|
2546
|
-
return
|
|
2569
|
+
})), bi = y((e) => {
|
|
2570
|
+
let t = e($), n = e(Di);
|
|
2571
|
+
return Ot(t.map((e) => n[e].outline));
|
|
2547
2572
|
});
|
|
2548
|
-
|
|
2549
|
-
var
|
|
2573
|
+
y((e) => e(vi).length);
|
|
2574
|
+
var xi = ae(y((e) => {
|
|
2550
2575
|
let { cellIds: t, cellData: n } = e(Z);
|
|
2551
|
-
return
|
|
2576
|
+
return ce.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
2552
2577
|
}));
|
|
2553
|
-
|
|
2554
|
-
var
|
|
2578
|
+
y((e) => e(Z).scrollKey);
|
|
2579
|
+
var Si = () => _($), Ci = () => _(xi), wi = () => C.get(Z), Ti = () => C.get(Z).cellIds, Ei = () => {
|
|
2555
2580
|
let { cellIds: e, cellData: t } = C.get(Z);
|
|
2556
2581
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
2557
2582
|
};
|
|
2558
|
-
|
|
2559
|
-
var
|
|
2560
|
-
|
|
2561
|
-
var
|
|
2562
|
-
function
|
|
2563
|
-
|
|
2564
|
-
}
|
|
2565
|
-
var
|
|
2583
|
+
S(p(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
|
|
2584
|
+
var Di = y((e) => e(Z).cellRuntime);
|
|
2585
|
+
y((e) => e(Z).cellIds.length > 0);
|
|
2586
|
+
var Oi = g((e) => y((t) => t(Z).cellData[e])), ki = g((e) => y((t) => t(Z).cellRuntime[e])), Ai = g((e) => y((t) => t(Z).cellHandles[e]));
|
|
2587
|
+
function ji(e) {
|
|
2588
|
+
Oi.remove(e), ki.remove(e), Ai.remove(e);
|
|
2589
|
+
}
|
|
2590
|
+
var Mi = (e) => {
|
|
2566
2591
|
let { cellHandles: t } = C.get(Z);
|
|
2567
2592
|
return t[e].current?.editorView;
|
|
2568
|
-
},
|
|
2569
|
-
function
|
|
2570
|
-
return
|
|
2593
|
+
}, Ni = (e) => (Rt.promote(e), Mi(e));
|
|
2594
|
+
function Pi() {
|
|
2595
|
+
return gi();
|
|
2571
2596
|
}
|
|
2572
2597
|
//#endregion
|
|
2573
2598
|
//#region src/core/errors/error-entries.ts
|
|
2574
|
-
function
|
|
2575
|
-
if (
|
|
2599
|
+
function Fi(e) {
|
|
2600
|
+
if (zt(e.mimetype)) {
|
|
2576
2601
|
if (!Array.isArray(e.data)) return null;
|
|
2577
2602
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
2578
2603
|
return t.length === 0 ? null : { errorData: t };
|
|
2579
2604
|
}
|
|
2580
|
-
return
|
|
2605
|
+
return Bt(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
2581
2606
|
errorData: [],
|
|
2582
2607
|
tracebackHtml: e.data
|
|
2583
2608
|
} : null;
|
|
2584
2609
|
}
|
|
2585
|
-
function
|
|
2610
|
+
function Ii(e) {
|
|
2586
2611
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
2587
2612
|
}
|
|
2588
|
-
function
|
|
2589
|
-
let t = e?.find((e) =>
|
|
2613
|
+
function Li(e) {
|
|
2614
|
+
let t = e?.find((e) => Bt(e.mimetype));
|
|
2590
2615
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
2591
2616
|
}
|
|
2592
|
-
function
|
|
2617
|
+
function Ri(e, t) {
|
|
2593
2618
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
2594
|
-
if (!
|
|
2619
|
+
if (!Ii(e.errorData)) return Li(t);
|
|
2595
2620
|
}
|
|
2596
|
-
function
|
|
2621
|
+
function zi(e) {
|
|
2597
2622
|
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
|
|
2598
2623
|
for (let [e, a] of t.entries()) {
|
|
2599
2624
|
let t = n[a], o = t.output;
|
|
2600
|
-
if (!o || !
|
|
2601
|
-
let s =
|
|
2625
|
+
if (!o || !F(o.mimetype)) continue;
|
|
2626
|
+
let s = Fi(o);
|
|
2602
2627
|
if (!s) continue;
|
|
2603
|
-
let c =
|
|
2628
|
+
let c = jn(r[a].name, e), l = o.code ?? r[a].code;
|
|
2604
2629
|
i.push({
|
|
2605
2630
|
cellId: a,
|
|
2606
2631
|
cellName: c,
|
|
2607
2632
|
cellCode: l,
|
|
2608
2633
|
errorData: s.errorData,
|
|
2609
|
-
tracebackHtml:
|
|
2634
|
+
tracebackHtml: Ri(s, t.consoleOutputs)
|
|
2610
2635
|
});
|
|
2611
2636
|
}
|
|
2612
2637
|
return i;
|
|
2613
2638
|
}
|
|
2614
|
-
function
|
|
2639
|
+
function Bi(e) {
|
|
2615
2640
|
return e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
|
|
2616
2641
|
}
|
|
2617
|
-
function
|
|
2618
|
-
let t =
|
|
2642
|
+
function Vi(e) {
|
|
2643
|
+
let t = Bi(e);
|
|
2619
2644
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
|
|
2620
2645
|
}
|
|
2621
|
-
function
|
|
2646
|
+
function Hi(e) {
|
|
2622
2647
|
let t = [e.cellName];
|
|
2623
|
-
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
2648
|
+
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Vi).join("\n\n")), t.join("\n\n");
|
|
2624
2649
|
}
|
|
2625
2650
|
//#endregion
|
|
2626
|
-
export {
|
|
2651
|
+
export { G as $, ii as A, an as At, Ar as B, st as Bt, li as C, pn as Ct, X as D, fn as Dt, si as E, ln as Et, K as F, Dt as Ft, vr as G, gt as Gt, Or as H, ht as Ht, Br as I, St as It, sr as J, j as Jt, yr as K, qe as Kt, Ir as L, _t as Lt, Ur as M, $t as Mt, Vr as N, en as Nt, ai as O, dn as Ot, Hr as P, At as Pt, Yn as Q, Lr as R, P as Rt, ci as S, un as St, ui as T, L as Tt, Cr as U, ft as Ut, jr as V, yt as Vt, br as W, mt as Wt, _r as X, be as Xt, gr as Y, xe as Yt, nr as Z, mi as _, En as _t, _i as a, Ln as at, Ci as b, Sn as bt, hi as c, Mn as ct, Ei as d, z as dt, Hn as et, Ti as f, wn as ft, bi as g, Dn as gt, Z as h, Tn as ht, zi as i, Rn as it, Gr as j, tn as jt, oi as k, rn as kt, Ni as l, kn as lt, pi as m, Cn as mt, Hi as n, Bn as nt, Oi as o, jn as ot, wi as p, B as pt, mr as q, Le as qt, Vi as r, H as rt, $ as s, An as st, Bi as t, zn as tt, Mi as u, mn as ut, ji as v, bn as vt, di as w, R as wt, Pi as x, xn as xt, Si as y, hn as yt, Rr as z, ut as zt };
|