@marimo-team/islands 0.26.1-dev19 → 0.26.1-dev21
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-CYipPzuL.js → ErrorBoundary-C5X_T831.js} +1 -1
- package/dist/{chat-ui-b1ERxzeA.js → chat-ui-qZdDDrzU.js} +3 -3
- package/dist/{code-visibility-D2uVdtAQ.js → code-visibility-7FxdzbDq.js} +2 -2
- package/dist/{common-d-UA4Z2n.js → common-D-iTRwaQ.js} +3 -3
- package/dist/{data-grid-overlay-editor-BfZIG_OX.js → data-grid-overlay-editor-DoWUW2oW.js} +1 -1
- package/dist/{error-entries-Bl8fzLQc.js → error-entries-DhI0hGvj.js} +448 -450
- package/dist/{feedback-button-Ct0bgfAh.js → feedback-button-OUiV15AL.js} +3 -3
- package/dist/{glide-data-editor-D9EGRA-V.js → glide-data-editor-CFouYM6e.js} +3 -3
- package/dist/{globals-UnK9bjY3.js → globals-B_U6Frqj.js} +1 -1
- package/dist/{html-to-image-D6A1lg0A.js → html-to-image-B803aaWE.js} +1 -1
- package/dist/main.js +3213 -3203
- package/dist/{number-overlay-editor-DMasuqqm.js → number-overlay-editor-CiQQjf9m.js} +1 -1
- package/dist/{process-output-w5omHedc.js → process-output-CnCLfvnL.js} +2 -2
- package/dist/{reveal-component-v6w_cxzA.js → reveal-component-B73BObRc.js} +2 -2
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +20 -19
- package/src/__mocks__/notebook.ts +1 -1
- package/src/__tests__/branded.ts +4 -0
- package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +1 -1
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +5 -5
- package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +5 -2
- package/src/components/tracing/tracing-keyboard.test.tsx +4 -3
- package/src/core/ai/context/providers/__tests__/error.test.ts +6 -3
- package/src/core/cells/__tests__/actions.test.ts +2 -2
- package/src/core/cells/__tests__/arrange.test.ts +1 -1
- package/src/core/cells/__tests__/harness.ts +9 -7
- package/src/core/cells/__tests__/layout.test.ts +1 -1
- package/src/core/cells/__tests__/runs.test.ts +14 -14
- package/src/core/cells/__tests__/utils.test.ts +3 -2
- package/src/core/cells/actions.ts +6 -6
- package/src/core/cells/cells.ts +1 -1
- package/src/core/cells/document.ts +1 -2
- package/src/core/cells/execution-console.ts +3 -3
- package/src/core/cells/ids.ts +2 -4
- package/src/core/cells/runs.ts +7 -5
- package/src/core/cells/session.ts +8 -5
- package/src/core/executions/__tests__/atoms.test.ts +7 -4
- package/src/core/executions/__tests__/freshness.test.ts +57 -53
- package/src/core/executions/__tests__/interrupt.test.ts +4 -3
- package/src/core/executions/__tests__/output-lifecycle.test.ts +3 -3
- package/src/core/executions/__tests__/output.test.ts +5 -3
- package/src/core/executions/__tests__/run.test.ts +4 -4
- package/src/core/executions/__tests__/select.test.ts +75 -67
- package/src/core/executions/atoms.ts +2 -2
- package/src/core/executions/freshness.ts +5 -5
- package/src/core/executions/output.ts +15 -21
- package/src/core/executions/select.ts +17 -9
- package/src/core/export/__tests__/hooks.test.ts +1 -1
- package/src/core/meta/__tests__/code-visibility.test.tsx +3 -2
- package/src/core/notebook/document/__tests__/codemirror.test.ts +8 -6
- package/src/core/notebook/document/__tests__/draft.test.ts +56 -58
- package/src/core/notebook/document/__tests__/fixtures.ts +8 -7
- package/src/core/notebook/document/__tests__/hooks.test.tsx +39 -35
- package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +8 -5
- package/src/core/notebook/document/__tests__/model.test.ts +8 -5
- package/src/core/notebook/document/__tests__/protocol-fixtures.ts +2 -2
- package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +37 -32
- package/src/core/notebook/document/__tests__/scenarios.test.ts +49 -45
- package/src/core/notebook/document/__tests__/state.test.ts +59 -56
- package/src/core/notebook/document/__tests__/submission.test.ts +15 -12
- package/src/core/notebook/document/__tests__/test-host.ts +3 -2
- package/src/core/notebook/document/__tests__/user.ts +7 -3
- package/src/core/notebook/document/draft.ts +29 -11
- package/src/core/notebook/document/state.ts +7 -6
- package/src/core/notebook/replica/__tests__/document.test.ts +9 -5
- package/src/core/notebook/replica/__tests__/executions.test.ts +16 -11
- package/src/core/notebook/replica/__tests__/fixtures.ts +6 -2
- package/src/core/notebook/replica/__tests__/replica.test.ts +7 -2
- package/src/core/notebook/replica/__tests__/results.test.ts +23 -19
- package/src/core/notebook/replica/execution-state.ts +2 -2
- package/src/core/notebook/replica/replica.ts +2 -2
- package/src/core/notebook/replica/resources/analysis.ts +1 -1
- package/src/core/notebook/replica/resources/document.ts +9 -8
- package/src/core/notebook/replica/resources/executions.ts +2 -2
- package/src/core/notebook/replica/resources/results.ts +2 -2
- package/src/core/saving/__tests__/document.test.tsx +1 -1
- package/src/core/saving/__tests__/state.test.ts +2 -2
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +9 -4
- package/src/core/session/useNotebookReplica.ts +1 -1
- package/src/core/session/useNotebookSession.tsx +1 -1
- package/src/core/transports/__tests__/static.test.ts +3 -2
- package/src/core/transports/static.ts +2 -2
- package/src/core/wasm/bridge.ts +5 -4
|
@@ -7,7 +7,7 @@ import { f as s, h as c } from "./tooltip-D0h-ZJ6j.js";
|
|
|
7
7
|
import { t as l } from "./check-D9vf6LYF.js";
|
|
8
8
|
import { n as u, r as d } from "./assertNever-CqwxSD_2.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-D8btoEHk.js";
|
|
10
|
-
import { At as p, Ct as m, Dt as h, Et as g, Ft as
|
|
10
|
+
import { At as p, Ct as m, Dt as h, Et as g, Ft as ee, Ht as _, It as v, Ot as y, Pt as b, St as x, Tt as te, _n as ne, f as re, hn as ie, jt as ae, mn as oe, pn as se, vn as ce, zt as le } from "./use-restore-focus-BFvwj2Hj.js";
|
|
11
11
|
import { n as ue } from "./toast-6V8Og7d5.js";
|
|
12
12
|
import { t as de } from "./objects-DCmMvZtn.js";
|
|
13
13
|
import { t as S } from "./invariant-DLmrl-hA.js";
|
|
@@ -42,7 +42,7 @@ function Me(e) {
|
|
|
42
42
|
defaultProp: i ?? !1,
|
|
43
43
|
onChange: c,
|
|
44
44
|
caller: De
|
|
45
|
-
}), [m, h] = C.useState(null), [g,
|
|
45
|
+
}), [m, h] = C.useState(null), [g, ee] = C.useState(null), [_, v] = C.useState(null), y = !m || !!o || !!m.closest("form"), b = {
|
|
46
46
|
checked: f,
|
|
47
47
|
disabled: a,
|
|
48
48
|
setChecked: p,
|
|
@@ -51,13 +51,13 @@ function Me(e) {
|
|
|
51
51
|
name: s,
|
|
52
52
|
form: o,
|
|
53
53
|
value: u,
|
|
54
|
-
userClick:
|
|
55
|
-
onUserClick:
|
|
54
|
+
userClick: _,
|
|
55
|
+
onUserClick: v,
|
|
56
56
|
required: l,
|
|
57
57
|
defaultChecked: !E(i) && i,
|
|
58
|
-
isFormControl:
|
|
58
|
+
isFormControl: y,
|
|
59
59
|
bubbleInput: g,
|
|
60
|
-
setBubbleInput:
|
|
60
|
+
setBubbleInput: ee
|
|
61
61
|
};
|
|
62
62
|
return /* @__PURE__ */ (0, w.jsx)(Ae, {
|
|
63
63
|
scope: t,
|
|
@@ -67,11 +67,11 @@ function Me(e) {
|
|
|
67
67
|
}
|
|
68
68
|
T(Me, "CheckboxProvider");
|
|
69
69
|
var Ne = "CheckboxTrigger", Pe = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(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 } = je(Ne, e), g = r(a, d),
|
|
70
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = je(Ne, e), g = r(a, d), ee = C.useRef(l);
|
|
71
71
|
return C.useEffect(() => {
|
|
72
72
|
let e = o?.form;
|
|
73
73
|
if (e) {
|
|
74
|
-
let t = /* @__PURE__ */ T(() => f(
|
|
74
|
+
let t = /* @__PURE__ */ T(() => f(ee.current), "reset");
|
|
75
75
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
76
76
|
}
|
|
77
77
|
}, [o, f]), /* @__PURE__ */ (0, w.jsx)(ce.button, {
|
|
@@ -130,21 +130,21 @@ var Ne = "CheckboxTrigger", Pe = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(
|
|
|
130
130
|
})
|
|
131
131
|
});
|
|
132
132
|
}, "CheckboxIndicator")), Re = "CheckboxBubbleInput", ze = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(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 } = je(Re, e),
|
|
133
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = je(Re, e), ee = r(i, g), _ = s(a), v = C.useRef(!1), y = C.useRef(c), b = C.useRef(o), x = C.useRef(null);
|
|
134
134
|
C.useEffect(() => {
|
|
135
135
|
let e = h;
|
|
136
136
|
if (!e) return;
|
|
137
137
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
138
138
|
if (!n) return;
|
|
139
|
-
let r =
|
|
140
|
-
|
|
139
|
+
let r = y.current !== c;
|
|
140
|
+
y.current = c;
|
|
141
141
|
let i = o !== null && o !== b.current;
|
|
142
142
|
if (b.current = o, i) x.current = r ? null : o, r && (e.indeterminate = E(c), n.call(e, !E(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
143
|
else if (r) {
|
|
144
144
|
let t = x.current;
|
|
145
145
|
x.current = null;
|
|
146
146
|
let r = t?.requestedChecked === c;
|
|
147
|
-
|
|
147
|
+
v.current = !0, e.indeterminate = E(c), n.call(e, !E(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), v.current = !1;
|
|
148
148
|
}
|
|
149
149
|
}, [
|
|
150
150
|
h,
|
|
@@ -163,13 +163,13 @@ var Ne = "CheckboxTrigger", Pe = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(
|
|
|
163
163
|
form: m,
|
|
164
164
|
...n,
|
|
165
165
|
tabIndex: -1,
|
|
166
|
-
ref:
|
|
166
|
+
ref: ee,
|
|
167
167
|
onClick: ie(t, (e) => {
|
|
168
|
-
|
|
168
|
+
v.current && e.stopPropagation();
|
|
169
169
|
}),
|
|
170
170
|
style: {
|
|
171
171
|
...n.style,
|
|
172
|
-
...
|
|
172
|
+
..._,
|
|
173
173
|
position: "absolute",
|
|
174
174
|
pointerEvents: "none",
|
|
175
175
|
opacity: 0,
|
|
@@ -578,12 +578,9 @@ function _t(e) {
|
|
|
578
578
|
//#endregion
|
|
579
579
|
//#region src/core/executions/output.ts
|
|
580
580
|
var vt = /* @__PURE__ */ new Map(), yt = "application/vnd.marimo+error";
|
|
581
|
-
function N(e) {
|
|
582
|
-
return e;
|
|
583
|
-
}
|
|
584
581
|
function bt(e) {
|
|
585
582
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
586
|
-
cell_id:
|
|
583
|
+
cell_id: e,
|
|
587
584
|
message: t
|
|
588
585
|
}));
|
|
589
586
|
}
|
|
@@ -601,7 +598,7 @@ function Ct(e, t) {
|
|
|
601
598
|
timestamp: St(e)
|
|
602
599
|
};
|
|
603
600
|
}
|
|
604
|
-
function
|
|
601
|
+
function N(e, t) {
|
|
605
602
|
return {
|
|
606
603
|
channel: "marimo-error",
|
|
607
604
|
mimetype: yt,
|
|
@@ -610,8 +607,7 @@ function P(e, t) {
|
|
|
610
607
|
};
|
|
611
608
|
}
|
|
612
609
|
function wt(e) {
|
|
613
|
-
|
|
614
|
-
return t === void 0 ? null : N(t.cell_id);
|
|
610
|
+
return e.related.at(0)?.cell_id ?? null;
|
|
615
611
|
}
|
|
616
612
|
function Tt(e) {
|
|
617
613
|
switch (e.kind) {
|
|
@@ -642,21 +638,21 @@ function Tt(e) {
|
|
|
642
638
|
}
|
|
643
639
|
function Et(e, t) {
|
|
644
640
|
let n = t.related[0];
|
|
645
|
-
if (n !== void 0 && t.reason === "upstream-stopped") return
|
|
641
|
+
if (n !== void 0 && t.reason === "upstream-stopped") return N(e, [{
|
|
646
642
|
type: "ancestor-stopped",
|
|
647
643
|
msg: t.message,
|
|
648
|
-
raising_cell:
|
|
644
|
+
raising_cell: n.cell_id
|
|
649
645
|
}]);
|
|
650
646
|
if (n !== void 0 && t.reason === "upstream-failed") {
|
|
651
647
|
let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
|
|
652
|
-
return
|
|
648
|
+
return N(e, [{
|
|
653
649
|
type: "ancestor-prevented",
|
|
654
650
|
msg: t.message,
|
|
655
|
-
raising_cell:
|
|
656
|
-
blamed_cell: r === void 0 ? null :
|
|
651
|
+
raising_cell: n.cell_id,
|
|
652
|
+
blamed_cell: r === void 0 ? null : r.cell_id
|
|
657
653
|
}]);
|
|
658
654
|
}
|
|
659
|
-
return
|
|
655
|
+
return N(e, [{
|
|
660
656
|
type: "diagnostic",
|
|
661
657
|
kind: t.reason,
|
|
662
658
|
msg: t.message,
|
|
@@ -679,8 +675,8 @@ function kt(e) {
|
|
|
679
675
|
if (n === null) return null;
|
|
680
676
|
switch (n.kind) {
|
|
681
677
|
case "output": return n.media === null ? null : Ct(t, n.media);
|
|
682
|
-
case "failed": return
|
|
683
|
-
case "cancelled": return
|
|
678
|
+
case "failed": return N(t, [Tt(n.error)]);
|
|
679
|
+
case "cancelled": return N(t, [{ type: "interruption" }]);
|
|
684
680
|
case "skipped": return Et(t, n);
|
|
685
681
|
}
|
|
686
682
|
}
|
|
@@ -701,7 +697,7 @@ function Nt(e) {
|
|
|
701
697
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
|
|
702
698
|
for (let r of n) {
|
|
703
699
|
let n = Mt(e, r);
|
|
704
|
-
n !== null && t.set(
|
|
700
|
+
n !== null && t.set(r, n);
|
|
705
701
|
}
|
|
706
702
|
return t;
|
|
707
703
|
}
|
|
@@ -747,23 +743,25 @@ function Lt(e, t) {
|
|
|
747
743
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
748
744
|
}
|
|
749
745
|
function Rt(e, t) {
|
|
750
|
-
let n = /* @__PURE__ */ new Set(), r = [...t].filter((e) => e.config.disabled);
|
|
751
|
-
if (
|
|
752
|
-
let
|
|
753
|
-
for (let t of
|
|
754
|
-
|
|
755
|
-
if (r
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
746
|
+
let n = /* @__PURE__ */ new Set(), r = [...t], i = r.filter((e) => e.config.disabled);
|
|
747
|
+
if (i.length === 0) return n;
|
|
748
|
+
let a = new Map(r.map(({ id: e }) => [e, []]));
|
|
749
|
+
for (let { id: t } of r) {
|
|
750
|
+
let r = e.cells[t];
|
|
751
|
+
if (!r) continue;
|
|
752
|
+
let { parents: i } = r;
|
|
753
|
+
if (i === void 0) return n;
|
|
754
|
+
for (let e of i) a.get(e)?.push(t);
|
|
755
|
+
}
|
|
756
|
+
let o = /* @__PURE__ */ new Map();
|
|
757
|
+
for (let e of i) {
|
|
760
758
|
let t = /* @__PURE__ */ new Set([e.id]);
|
|
761
759
|
for (let r of t) {
|
|
762
760
|
r !== e.id && n.add(r);
|
|
763
|
-
let
|
|
764
|
-
if (
|
|
765
|
-
|
|
766
|
-
for (let e of
|
|
761
|
+
let i = o.get(r) ?? 0;
|
|
762
|
+
if (i !== 2) {
|
|
763
|
+
o.set(r, i + 1);
|
|
764
|
+
for (let e of a.get(r) ?? []) t.add(e);
|
|
767
765
|
}
|
|
768
766
|
}
|
|
769
767
|
}
|
|
@@ -815,14 +813,14 @@ var Gt = {
|
|
|
815
813
|
latest: /* @__PURE__ */ new Map(),
|
|
816
814
|
results: /* @__PURE__ */ new Map(),
|
|
817
815
|
scratch: null
|
|
818
|
-
}, Kt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Map(), Jt = /* @__PURE__ */ new Set(), Yt = /* @__PURE__ */ new Set(), Xt = /* @__PURE__ */ new Set(), Zt = /* @__PURE__ */ new Map(),
|
|
816
|
+
}, Kt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Map(), Jt = /* @__PURE__ */ new Set(), Yt = /* @__PURE__ */ new Set(), Xt = /* @__PURE__ */ new Set(), Zt = /* @__PURE__ */ new Map(), P = _(null);
|
|
819
817
|
function Qt(e, t) {
|
|
820
818
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
821
819
|
}
|
|
822
820
|
function $t(e, t, n) {
|
|
823
821
|
return e !== null && Qt(e.notebook, t) ? e.value : n;
|
|
824
822
|
}
|
|
825
|
-
var en =
|
|
823
|
+
var en = _((e) => {
|
|
826
824
|
let t = e(h), n = t === null ? null : e(t.notebookAtom);
|
|
827
825
|
return t === null || n === null ? null : {
|
|
828
826
|
replica: t,
|
|
@@ -833,16 +831,16 @@ var en = v((e) => {
|
|
|
833
831
|
function tn(e, t) {
|
|
834
832
|
return Qt(t.notebook, e.get(en));
|
|
835
833
|
}
|
|
836
|
-
var nn =
|
|
837
|
-
let t = $t(e(
|
|
834
|
+
var nn = _((e) => {
|
|
835
|
+
let t = $t(e(P), e(en), Jt);
|
|
838
836
|
return t.size === 0 ? Yt : new Set([...t].flatMap((e) => e.cells));
|
|
839
|
-
}), rn =
|
|
837
|
+
}), rn = _((e) => {
|
|
840
838
|
let t = e(h), n = t && e(t.analysisAtom), r = n ? Rt(n.analysis, n.document.cells.values()) : Xt;
|
|
841
839
|
return {
|
|
842
840
|
shownBlocked: r,
|
|
843
841
|
blocked: n?.freshness === "current" ? r : Xt
|
|
844
842
|
};
|
|
845
|
-
}),
|
|
843
|
+
}), F = _((e) => {
|
|
846
844
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
847
845
|
return {
|
|
848
846
|
executions: t === null ? Gt : e(t.executionsAtom),
|
|
@@ -852,7 +850,7 @@ var nn = v((e) => {
|
|
|
852
850
|
...e(rn),
|
|
853
851
|
runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
|
|
854
852
|
};
|
|
855
|
-
}),
|
|
853
|
+
}), an = _((e) => {
|
|
856
854
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
857
855
|
return t === null || n === null ? {
|
|
858
856
|
cells: qt,
|
|
@@ -863,27 +861,27 @@ var nn = v((e) => {
|
|
|
863
861
|
executions: e(t.executionsAtom),
|
|
864
862
|
results: e(t.resultsAtom)
|
|
865
863
|
};
|
|
866
|
-
}),
|
|
864
|
+
}), on = _((e) => _t(e(an))), sn = _(null), cn = _((e) => {
|
|
867
865
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
868
866
|
return t === null || n === null ? null : {
|
|
869
867
|
replica: t,
|
|
870
868
|
id: n.revision.notebook_id,
|
|
871
869
|
generation: e(t.generationAtom)
|
|
872
870
|
};
|
|
873
|
-
}),
|
|
871
|
+
}), ln = _((e) => {
|
|
874
872
|
let t = e(h);
|
|
875
873
|
return {
|
|
876
874
|
executions: t === null ? Gt : e(t.executionsAtom),
|
|
877
875
|
results: t === null ? Kt : e(t.resultsAtom),
|
|
878
|
-
cleared: $t(e(
|
|
876
|
+
cleared: $t(e(sn), e(cn), Zt),
|
|
879
877
|
cells: t === null ? qt : e(t.documentAtom)?.cells ?? qt
|
|
880
878
|
};
|
|
881
|
-
}),
|
|
882
|
-
function
|
|
879
|
+
}), un = _((e) => Nt(e(ln))), I = p((e) => b(un, (t) => t.get(e) ?? null, v)), L = p((e) => _((t) => Xe(t(I(e)))));
|
|
880
|
+
function dn(e) {
|
|
883
881
|
I.remove(e), L.remove(e);
|
|
884
882
|
}
|
|
885
|
-
function
|
|
886
|
-
let n = e.get(
|
|
883
|
+
function fn(e, t) {
|
|
884
|
+
let n = e.get(ln), r = new Map(n.cleared);
|
|
887
885
|
for (let e of t) {
|
|
888
886
|
let t = At(n, e);
|
|
889
887
|
t != null && O(t) !== null && r.set(e, {
|
|
@@ -891,18 +889,18 @@ function pn(e, t) {
|
|
|
891
889
|
version: t.outputVersion
|
|
892
890
|
});
|
|
893
891
|
}
|
|
894
|
-
let i = e.get(
|
|
895
|
-
e.set(
|
|
892
|
+
let i = e.get(cn);
|
|
893
|
+
e.set(sn, i === null ? null : {
|
|
896
894
|
notebook: i,
|
|
897
895
|
value: r
|
|
898
896
|
});
|
|
899
897
|
}
|
|
900
|
-
var
|
|
898
|
+
var pn = _((e) => {
|
|
901
899
|
let t = e(h);
|
|
902
900
|
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
903
901
|
});
|
|
904
|
-
|
|
905
|
-
var
|
|
902
|
+
_((e) => Ut(e(F).executions)), _((e) => Wt(e(F)));
|
|
903
|
+
var mn = _((e) => {
|
|
906
904
|
let t = e(h);
|
|
907
905
|
if (t === null) return { refused: "No notebook is connected" };
|
|
908
906
|
if (e(t.connectionAtom).state === D.CLOSED) return { refused: "The notebook is disconnected" };
|
|
@@ -918,58 +916,58 @@ var hn = v((e) => {
|
|
|
918
916
|
default: return "waiting";
|
|
919
917
|
}
|
|
920
918
|
});
|
|
921
|
-
function
|
|
919
|
+
function hn(e) {
|
|
922
920
|
return new Promise((t, n) => {
|
|
923
|
-
let r = e.sub(
|
|
921
|
+
let r = e.sub(mn, i);
|
|
924
922
|
function i() {
|
|
925
|
-
let i = e.get(
|
|
923
|
+
let i = e.get(mn);
|
|
926
924
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
927
925
|
}
|
|
928
926
|
i();
|
|
929
927
|
});
|
|
930
928
|
}
|
|
931
|
-
function
|
|
929
|
+
function gn(e, t) {
|
|
932
930
|
let n = e.get(en);
|
|
933
931
|
if (n === null) return null;
|
|
934
932
|
let r = {
|
|
935
933
|
notebook: n,
|
|
936
934
|
cells: [...t]
|
|
937
|
-
}, i = $t(e.get(
|
|
938
|
-
return e.set(
|
|
935
|
+
}, i = $t(e.get(P), n, Jt);
|
|
936
|
+
return e.set(P, {
|
|
939
937
|
notebook: n,
|
|
940
938
|
value: new Set(i).add(r)
|
|
941
939
|
}), r;
|
|
942
940
|
}
|
|
943
|
-
function
|
|
944
|
-
let n = e.get(
|
|
941
|
+
function _n(e, t) {
|
|
942
|
+
let n = e.get(P);
|
|
945
943
|
if (n === null || !n.value.has(t)) return;
|
|
946
944
|
let r = new Set(n.value);
|
|
947
|
-
r.delete(t), e.set(
|
|
945
|
+
r.delete(t), e.set(P, {
|
|
948
946
|
notebook: n.notebook,
|
|
949
947
|
value: r
|
|
950
948
|
});
|
|
951
949
|
}
|
|
952
|
-
function
|
|
953
|
-
let r =
|
|
950
|
+
function vn(e, t, n) {
|
|
951
|
+
let r = _((e) => Qt(t.notebook, e(en)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
954
952
|
function a() {
|
|
955
|
-
e.get(r) || (i(),
|
|
953
|
+
e.get(r) || (i(), _n(e, t));
|
|
956
954
|
}
|
|
957
955
|
a();
|
|
958
956
|
}
|
|
959
957
|
//#endregion
|
|
960
958
|
//#region src/core/codemirror/editing/commands.ts
|
|
961
|
-
var
|
|
962
|
-
function
|
|
959
|
+
var yn = a();
|
|
960
|
+
function bn(e) {
|
|
963
961
|
return (t) => {
|
|
964
962
|
let n = !1;
|
|
965
963
|
for (let r of t) r && (n = e(r) || n);
|
|
966
964
|
return n;
|
|
967
965
|
};
|
|
968
966
|
}
|
|
969
|
-
var
|
|
967
|
+
var xn = bn(_e), Sn = bn(ge);
|
|
970
968
|
//#endregion
|
|
971
969
|
//#region src/utils/schedule-task.ts
|
|
972
|
-
function
|
|
970
|
+
function Cn() {
|
|
973
971
|
let e = globalThis.scheduler;
|
|
974
972
|
if (typeof e?.postTask == "function") return (t) => {
|
|
975
973
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -990,10 +988,10 @@ function wn() {
|
|
|
990
988
|
setTimeout(e, 0);
|
|
991
989
|
};
|
|
992
990
|
}
|
|
993
|
-
var
|
|
991
|
+
var wn = Cn();
|
|
994
992
|
//#endregion
|
|
995
993
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
996
|
-
function
|
|
994
|
+
function Tn(e = wn) {
|
|
997
995
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
998
996
|
function i() {
|
|
999
997
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -1036,21 +1034,21 @@ function En(e = Tn) {
|
|
|
1036
1034
|
}
|
|
1037
1035
|
};
|
|
1038
1036
|
}
|
|
1039
|
-
var
|
|
1037
|
+
var En = Tn();
|
|
1040
1038
|
//#endregion
|
|
1041
1039
|
//#region src/core/mime.ts
|
|
1042
|
-
function
|
|
1040
|
+
function Dn(e) {
|
|
1043
1041
|
return e === "application/vnd.marimo+error";
|
|
1044
1042
|
}
|
|
1045
|
-
function
|
|
1043
|
+
function On(e) {
|
|
1046
1044
|
return e === "application/vnd.marimo+traceback";
|
|
1047
1045
|
}
|
|
1048
1046
|
function R(e) {
|
|
1049
|
-
return
|
|
1047
|
+
return Dn(e) || On(e);
|
|
1050
1048
|
}
|
|
1051
1049
|
//#endregion
|
|
1052
1050
|
//#region src/core/cells/command-console.ts
|
|
1053
|
-
function
|
|
1051
|
+
function kn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
1054
1052
|
if (t === "callback-output" && !r && n.length === 0) return { entries: [] };
|
|
1055
1053
|
let o = r || n.length === 0, s = e?.entries ?? [], c = r && a !== void 0 ? n.findIndex((e) => e.command_id === a) : -1, l = n.slice(c + 1).map((e, n) => ({
|
|
1056
1054
|
...e,
|
|
@@ -1061,15 +1059,15 @@ function An(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1061
1059
|
}
|
|
1062
1060
|
//#endregion
|
|
1063
1061
|
//#region src/core/dom/ui-element-constants.ts
|
|
1064
|
-
var
|
|
1062
|
+
var An = "object-id", jn = "random-id", Mn = "abcdefghijklmnopqrstuvwxyz", Nn = Mn + Mn.toUpperCase(), Pn = /* @__PURE__ */ new Set(), z = "__scratch__", Fn = "setup", In = { create() {
|
|
1065
1063
|
let e = 0, t;
|
|
1066
1064
|
do {
|
|
1067
1065
|
let n = "";
|
|
1068
|
-
for (let e = 0; e < 4; e++) n +=
|
|
1066
|
+
for (let e = 0; e < 4; e++) n += Nn[Math.floor(Math.random() * 52)];
|
|
1069
1067
|
t = n, e++;
|
|
1070
|
-
} while (
|
|
1068
|
+
} while (Pn.has(t) && e < 100);
|
|
1071
1069
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1072
|
-
return
|
|
1070
|
+
return Pn.add(t), t;
|
|
1073
1071
|
} }, B = {
|
|
1074
1072
|
create(e) {
|
|
1075
1073
|
return S(e != null, "cellId is required"), `cell-${e}`;
|
|
@@ -1091,21 +1089,21 @@ var jn = "object-id", Mn = "random-id", Nn = "abcdefghijklmnopqrstuvwxyz", Pn =
|
|
|
1091
1089
|
return null;
|
|
1092
1090
|
}
|
|
1093
1091
|
};
|
|
1094
|
-
function
|
|
1092
|
+
function Ln(e) {
|
|
1095
1093
|
let t = null, n = B.findElementThroughShadowDOMs(e);
|
|
1096
1094
|
return n && (t = B.parse(n.id)), t;
|
|
1097
1095
|
}
|
|
1098
|
-
var
|
|
1096
|
+
var Rn = {
|
|
1099
1097
|
parse(e) {
|
|
1100
|
-
return e.getAttribute(
|
|
1098
|
+
return e.getAttribute(An);
|
|
1101
1099
|
},
|
|
1102
1100
|
parseOrThrow(e) {
|
|
1103
|
-
let t =
|
|
1101
|
+
let t = Rn.parse(e);
|
|
1104
1102
|
return S(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1105
1103
|
}
|
|
1106
|
-
},
|
|
1104
|
+
}, zn = { create(e) {
|
|
1107
1105
|
return `output-${e}`;
|
|
1108
|
-
} },
|
|
1106
|
+
} }, Bn = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, Vn = class e {
|
|
1109
1107
|
static get INSTANCE() {
|
|
1110
1108
|
let t = "_marimo_private_VirtualFileTracker";
|
|
1111
1109
|
return window[t] || (window[t] = new e()), window[t];
|
|
@@ -1127,7 +1125,7 @@ var zn = {
|
|
|
1127
1125
|
switch (t.mimetype) {
|
|
1128
1126
|
case "application/json":
|
|
1129
1127
|
case "text/html": {
|
|
1130
|
-
let r = n.get(e), i =
|
|
1128
|
+
let r = n.get(e), i = Hn(t.data);
|
|
1131
1129
|
r?.forEach((e) => i.add(e)), n.set(e, i);
|
|
1132
1130
|
return;
|
|
1133
1131
|
}
|
|
@@ -1143,15 +1141,15 @@ var zn = {
|
|
|
1143
1141
|
this.virtualFiles.delete(e), this.callbackFiles.delete(e);
|
|
1144
1142
|
}
|
|
1145
1143
|
};
|
|
1146
|
-
function
|
|
1144
|
+
function Hn(e) {
|
|
1147
1145
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1148
|
-
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(
|
|
1146
|
+
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(Bn);
|
|
1149
1147
|
if (n) for (let e of n) t.add(e);
|
|
1150
1148
|
return t;
|
|
1151
1149
|
}
|
|
1152
1150
|
//#endregion
|
|
1153
1151
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
1154
|
-
var
|
|
1152
|
+
var Un = class e {
|
|
1155
1153
|
lines = [""];
|
|
1156
1154
|
cursor = {
|
|
1157
1155
|
row: 0,
|
|
@@ -1253,7 +1251,7 @@ var Wn = class e {
|
|
|
1253
1251
|
render() {
|
|
1254
1252
|
return this.lines.join("\n");
|
|
1255
1253
|
}
|
|
1256
|
-
},
|
|
1254
|
+
}, Wn = class {
|
|
1257
1255
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
1258
1256
|
parse(e) {
|
|
1259
1257
|
let t = [], n = 0;
|
|
@@ -1272,13 +1270,13 @@ var Wn = class e {
|
|
|
1272
1270
|
value: e.slice(n)
|
|
1273
1271
|
}), t;
|
|
1274
1272
|
}
|
|
1275
|
-
},
|
|
1276
|
-
parser = new
|
|
1273
|
+
}, Gn = class e {
|
|
1274
|
+
parser = new Wn();
|
|
1277
1275
|
buffer;
|
|
1278
1276
|
incompleteEscape = "";
|
|
1279
1277
|
static INCOMPLETE_ESCAPE = new RegExp(String.raw`\u001B(?:\[[0-9;]*|\()?$`, "u");
|
|
1280
1278
|
constructor(e = 0) {
|
|
1281
|
-
this.buffer = new
|
|
1279
|
+
this.buffer = new Un(e);
|
|
1282
1280
|
}
|
|
1283
1281
|
copy(t = 0) {
|
|
1284
1282
|
let n = new e();
|
|
@@ -1302,7 +1300,7 @@ var Wn = class e {
|
|
|
1302
1300
|
for (let e of r) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
1303
1301
|
}
|
|
1304
1302
|
reset() {
|
|
1305
|
-
this.buffer = new
|
|
1303
|
+
this.buffer = new Un(), this.incompleteEscape = "";
|
|
1306
1304
|
}
|
|
1307
1305
|
render() {
|
|
1308
1306
|
return this.buffer.render();
|
|
@@ -1346,7 +1344,7 @@ var Wn = class e {
|
|
|
1346
1344
|
return n;
|
|
1347
1345
|
}
|
|
1348
1346
|
};
|
|
1349
|
-
function
|
|
1347
|
+
function Kn(e) {
|
|
1350
1348
|
let t = 1;
|
|
1351
1349
|
for (let n = 0; n < e.length; n++) {
|
|
1352
1350
|
let r = e.charCodeAt(n);
|
|
@@ -1377,14 +1375,14 @@ var V = class e {
|
|
|
1377
1375
|
}
|
|
1378
1376
|
appendData(t) {
|
|
1379
1377
|
if (!this.terminal) {
|
|
1380
|
-
let n =
|
|
1378
|
+
let n = Kn(t);
|
|
1381
1379
|
if (n !== void 0) return new e(this, {
|
|
1382
1380
|
data: this.data + t,
|
|
1383
1381
|
lineCount: this.lineCount + n - 1,
|
|
1384
1382
|
firstPlainRow: this.firstPlainRow
|
|
1385
1383
|
});
|
|
1386
1384
|
}
|
|
1387
|
-
let n = this.terminal?.copy() ?? new
|
|
1385
|
+
let n = this.terminal?.copy() ?? new Gn(this.firstPlainRow);
|
|
1388
1386
|
this.terminal || n.append(this.data), n.append(t);
|
|
1389
1387
|
let r = n.render();
|
|
1390
1388
|
return new e(this, {
|
|
@@ -1412,19 +1410,19 @@ var V = class e {
|
|
|
1412
1410
|
...this.code === void 0 ? {} : { code: this.code }
|
|
1413
1411
|
};
|
|
1414
1412
|
}
|
|
1415
|
-
},
|
|
1416
|
-
function
|
|
1413
|
+
}, qn = 5e3;
|
|
1414
|
+
function Jn(e, t = qn) {
|
|
1417
1415
|
let n = e.slice(0, -1), r = e.at(-1);
|
|
1418
|
-
return r &&
|
|
1416
|
+
return r && Xn(n, r), tr(n, t);
|
|
1419
1417
|
}
|
|
1420
|
-
function
|
|
1418
|
+
function Yn(e) {
|
|
1421
1419
|
let t = [];
|
|
1422
1420
|
for (let n = 0; n < e.length;) {
|
|
1423
1421
|
let r = e[n], i = n + 1;
|
|
1424
|
-
for (; i < e.length &&
|
|
1425
|
-
if (i === n + 1)
|
|
1422
|
+
for (; i < e.length && Zn(r, e[i]);) i++;
|
|
1423
|
+
if (i === n + 1) Xn(t, r);
|
|
1426
1424
|
else {
|
|
1427
|
-
let a = e.slice(n, i).map((e) => (
|
|
1425
|
+
let a = e.slice(n, i).map((e) => (er(e), e.data));
|
|
1428
1426
|
t.push(V.create({
|
|
1429
1427
|
...r,
|
|
1430
1428
|
data: a.join("")
|
|
@@ -1432,28 +1430,28 @@ function Xn(e) {
|
|
|
1432
1430
|
}
|
|
1433
1431
|
n = i;
|
|
1434
1432
|
}
|
|
1435
|
-
return
|
|
1433
|
+
return tr(t, qn);
|
|
1436
1434
|
}
|
|
1437
|
-
function
|
|
1435
|
+
function Xn(e, t) {
|
|
1438
1436
|
let n = e.at(-1);
|
|
1439
|
-
n &&
|
|
1437
|
+
n && Zn(n, t) ? (er(n), er(t), e[e.length - 1] = $n(n, t)) : e.push(Qn(t));
|
|
1440
1438
|
}
|
|
1441
|
-
function
|
|
1439
|
+
function Zn(e, t) {
|
|
1442
1440
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
1443
1441
|
if (!n) return !1;
|
|
1444
1442
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
1445
1443
|
return n && r && i;
|
|
1446
1444
|
}
|
|
1447
|
-
function
|
|
1445
|
+
function Qn(e) {
|
|
1448
1446
|
return e instanceof V ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? V.create(e) : e;
|
|
1449
1447
|
}
|
|
1450
|
-
function
|
|
1448
|
+
function $n(e, t) {
|
|
1451
1449
|
return e instanceof V ? e.appendData(t.data) : V.create(e).appendData(t.data);
|
|
1452
1450
|
}
|
|
1453
|
-
function
|
|
1451
|
+
function er(e) {
|
|
1454
1452
|
S(typeof e.data == "string", "expected string output");
|
|
1455
1453
|
}
|
|
1456
|
-
function
|
|
1454
|
+
function tr(e, t) {
|
|
1457
1455
|
let n = 0, r;
|
|
1458
1456
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1459
1457
|
let t = e[r];
|
|
@@ -1483,18 +1481,18 @@ function nr(e, t) {
|
|
|
1483
1481
|
}
|
|
1484
1482
|
//#endregion
|
|
1485
1483
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1486
|
-
function
|
|
1484
|
+
function nr(e, t) {
|
|
1487
1485
|
return Se(e * 1e3, t?.in);
|
|
1488
1486
|
}
|
|
1489
1487
|
//#endregion
|
|
1490
1488
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1491
|
-
var
|
|
1489
|
+
var rr = function(e, t) {
|
|
1492
1490
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1493
1491
|
}, H;
|
|
1494
1492
|
(function(e) {
|
|
1495
1493
|
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";
|
|
1496
1494
|
})(H ||= {});
|
|
1497
|
-
var
|
|
1495
|
+
var ir = class {
|
|
1498
1496
|
constructor() {
|
|
1499
1497
|
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 = {
|
|
1500
1498
|
http: 1,
|
|
@@ -1739,7 +1737,7 @@ var ar = class {
|
|
|
1739
1737
|
var r = this._buffer.charAt(1);
|
|
1740
1738
|
if (r != "[" && r != "]" && r != "(") return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1741
1739
|
if (r == "[") {
|
|
1742
|
-
this._csi_regex ||=
|
|
1740
|
+
this._csi_regex ||= ar(sr ||= rr(["\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 "]));
|
|
1743
1741
|
let t = this._buffer.match(this._csi_regex);
|
|
1744
1742
|
if (t === null) return e.kind = H.Incomplete, e;
|
|
1745
1743
|
if (t[4]) return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
@@ -1750,7 +1748,7 @@ var ar = class {
|
|
|
1750
1748
|
if (r == "]") {
|
|
1751
1749
|
if (t < 4) return e.kind = H.Incomplete, e;
|
|
1752
1750
|
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1753
|
-
this._osc_st ||=
|
|
1751
|
+
this._osc_st ||= or(cr ||= rr(["\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;
|
|
1754
1752
|
{
|
|
1755
1753
|
let t = this._osc_st.exec(this._buffer);
|
|
1756
1754
|
if (t === null) return e.kind = H.Incomplete, e;
|
|
@@ -1761,7 +1759,7 @@ var ar = class {
|
|
|
1761
1759
|
if (t === null) return e.kind = H.Incomplete, e;
|
|
1762
1760
|
if (t[3]) return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1763
1761
|
}
|
|
1764
|
-
this._osc_regex ||=
|
|
1762
|
+
this._osc_regex ||= ar(lr ||= rr(["\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 "]));
|
|
1765
1763
|
let n = this._buffer.match(this._osc_regex);
|
|
1766
1764
|
if (n === null) return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1767
1765
|
e.kind = H.OSCURL, e.url = n[1], e.text = n[2];
|
|
@@ -1846,15 +1844,15 @@ var ar = class {
|
|
|
1846
1844
|
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>`;
|
|
1847
1845
|
}
|
|
1848
1846
|
};
|
|
1849
|
-
function
|
|
1847
|
+
function ar(e, ...t) {
|
|
1850
1848
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1851
1849
|
return new RegExp(n);
|
|
1852
1850
|
}
|
|
1853
|
-
function
|
|
1851
|
+
function or(e, ...t) {
|
|
1854
1852
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1855
1853
|
return new RegExp(n, "g");
|
|
1856
1854
|
}
|
|
1857
|
-
var cr, lr, ur
|
|
1855
|
+
var sr, cr, lr, ur = new ir();
|
|
1858
1856
|
function U(e) {
|
|
1859
1857
|
try {
|
|
1860
1858
|
let t = document.createElement("div");
|
|
@@ -1863,24 +1861,24 @@ function U(e) {
|
|
|
1863
1861
|
return t.error("Error parsing HTML content:", n), e;
|
|
1864
1862
|
}
|
|
1865
1863
|
}
|
|
1866
|
-
function
|
|
1864
|
+
function dr(e) {
|
|
1867
1865
|
if (!e) return "";
|
|
1868
1866
|
try {
|
|
1869
|
-
return U(
|
|
1867
|
+
return U(ur.ansi_to_html(e));
|
|
1870
1868
|
} catch (n) {
|
|
1871
1869
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1872
1870
|
}
|
|
1873
1871
|
}
|
|
1874
1872
|
//#endregion
|
|
1875
1873
|
//#region src/core/errors/traceback-atom.ts
|
|
1876
|
-
var
|
|
1874
|
+
var fr = _(null);
|
|
1877
1875
|
//#endregion
|
|
1878
1876
|
//#region src/core/cells/logs.ts
|
|
1879
|
-
function
|
|
1877
|
+
function pr(e) {
|
|
1880
1878
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1881
1879
|
}
|
|
1882
|
-
var
|
|
1883
|
-
function
|
|
1880
|
+
var mr = !1;
|
|
1881
|
+
function hr(e) {
|
|
1884
1882
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1885
1883
|
for (let r of n) {
|
|
1886
1884
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1905,9 +1903,9 @@ function gr(e) {
|
|
|
1905
1903
|
}
|
|
1906
1904
|
}
|
|
1907
1905
|
}
|
|
1908
|
-
if (t.forEach(
|
|
1906
|
+
if (t.forEach(gr.log), n.length === 0 && R(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1909
1907
|
e.output.data.forEach((t) => {
|
|
1910
|
-
|
|
1908
|
+
gr.log({
|
|
1911
1909
|
level: "stderr",
|
|
1912
1910
|
source: {
|
|
1913
1911
|
type: "cell",
|
|
@@ -1918,8 +1916,8 @@ function gr(e) {
|
|
|
1918
1916
|
});
|
|
1919
1917
|
});
|
|
1920
1918
|
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = m.get(ye) === "read";
|
|
1921
|
-
if (t.length > 0 && !
|
|
1922
|
-
|
|
1919
|
+
if (t.length > 0 && !mr && n) {
|
|
1920
|
+
mr = !0;
|
|
1923
1921
|
let e = t.find((e) => e.traceback);
|
|
1924
1922
|
o(e ? {
|
|
1925
1923
|
title: "An internal error occurred",
|
|
@@ -1928,7 +1926,7 @@ function gr(e) {
|
|
|
1928
1926
|
action: C.createElement(ue, {
|
|
1929
1927
|
altText: "View traceback",
|
|
1930
1928
|
onClick: () => {
|
|
1931
|
-
m.set(
|
|
1929
|
+
m.set(fr, {
|
|
1932
1930
|
traceback: e.traceback,
|
|
1933
1931
|
errorMessage: e.msg || "An internal error occurred"
|
|
1934
1932
|
});
|
|
@@ -1943,13 +1941,13 @@ function gr(e) {
|
|
|
1943
1941
|
}
|
|
1944
1942
|
return t;
|
|
1945
1943
|
}
|
|
1946
|
-
var
|
|
1944
|
+
var gr = { log: (e) => {
|
|
1947
1945
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1948
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1946
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${_r(e.timestamp)}]`, `(${pr(e.source)}) ${e.message}`);
|
|
1949
1947
|
} };
|
|
1950
|
-
function
|
|
1948
|
+
function _r(e) {
|
|
1951
1949
|
try {
|
|
1952
|
-
return
|
|
1950
|
+
return nr(e).toLocaleTimeString(void 0, {
|
|
1953
1951
|
hour12: !0,
|
|
1954
1952
|
hour: "numeric",
|
|
1955
1953
|
minute: "numeric",
|
|
@@ -1959,26 +1957,26 @@ function vr(e) {
|
|
|
1959
1957
|
return "";
|
|
1960
1958
|
}
|
|
1961
1959
|
}
|
|
1962
|
-
var
|
|
1963
|
-
function
|
|
1960
|
+
var vr = /* @__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("."));
|
|
1961
|
+
function yr(e, t = !0) {
|
|
1964
1962
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
1965
1963
|
}
|
|
1966
|
-
function
|
|
1967
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
1964
|
+
function br(e, t) {
|
|
1965
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !vr.has(e);
|
|
1968
1966
|
if (i(e)) return e;
|
|
1969
1967
|
let a = 1;
|
|
1970
1968
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
1971
1969
|
return r;
|
|
1972
1970
|
}
|
|
1973
|
-
function
|
|
1974
|
-
return
|
|
1971
|
+
function xr(e, t) {
|
|
1972
|
+
return Sr(e) ? `cell-${t}` : e;
|
|
1975
1973
|
}
|
|
1976
|
-
function
|
|
1974
|
+
function Sr(e) {
|
|
1977
1975
|
return !e || e === "_" || e === "__";
|
|
1978
1976
|
}
|
|
1979
1977
|
//#endregion
|
|
1980
1978
|
//#region src/core/cells/types.ts
|
|
1981
|
-
function
|
|
1979
|
+
function Cr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
1982
1980
|
return {
|
|
1983
1981
|
id: e,
|
|
1984
1982
|
config: r || {
|
|
@@ -1991,7 +1989,7 @@ function wr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
1991
1989
|
code: n
|
|
1992
1990
|
};
|
|
1993
1991
|
}
|
|
1994
|
-
function
|
|
1992
|
+
function wr(e) {
|
|
1995
1993
|
return {
|
|
1996
1994
|
hide_code: !1,
|
|
1997
1995
|
disabled: !1,
|
|
@@ -2000,7 +1998,7 @@ function Tr(e) {
|
|
|
2000
1998
|
...e
|
|
2001
1999
|
};
|
|
2002
2000
|
}
|
|
2003
|
-
function
|
|
2001
|
+
function W(e) {
|
|
2004
2002
|
return {
|
|
2005
2003
|
embeddedConsole: [],
|
|
2006
2004
|
...e
|
|
@@ -2008,7 +2006,7 @@ function Er(e) {
|
|
|
2008
2006
|
}
|
|
2009
2007
|
//#endregion
|
|
2010
2008
|
//#region src/core/cells/execution-console.ts
|
|
2011
|
-
function
|
|
2009
|
+
function Tr(e, t, n) {
|
|
2012
2010
|
let r = e.time === void 0 ? t : Date.parse(e.time) / 1e3, i = e.seq + 1;
|
|
2013
2011
|
switch (e.kind) {
|
|
2014
2012
|
case "console":
|
|
@@ -2039,27 +2037,27 @@ function Dr(e, t, n) {
|
|
|
2039
2037
|
};
|
|
2040
2038
|
}
|
|
2041
2039
|
}
|
|
2042
|
-
function
|
|
2040
|
+
function Er(e, t) {
|
|
2043
2041
|
return {
|
|
2044
2042
|
onOutput(e, t) {
|
|
2045
|
-
|
|
2043
|
+
Vn.INSTANCE.trackOutput(e, t);
|
|
2046
2044
|
},
|
|
2047
2045
|
onExecution(n, r) {
|
|
2048
2046
|
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
2049
2047
|
},
|
|
2050
2048
|
onItem(t, n, r) {
|
|
2051
|
-
let i = t.cell_id ?? "__scratch__", a = k(t), o =
|
|
2052
|
-
o.channel === "media" &&
|
|
2049
|
+
let i = t.cell_id ?? "__scratch__", a = k(t), o = Tr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2050
|
+
o.channel === "media" && Vn.INSTANCE.track({
|
|
2053
2051
|
cell_id: i,
|
|
2054
2052
|
output: o
|
|
2055
|
-
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs:
|
|
2053
|
+
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs: hr({
|
|
2056
2054
|
cell_id: i,
|
|
2057
2055
|
console: o
|
|
2058
2056
|
}) });
|
|
2059
2057
|
}
|
|
2060
2058
|
};
|
|
2061
2059
|
}
|
|
2062
|
-
function
|
|
2060
|
+
function Dr(e, t) {
|
|
2063
2061
|
let n = e(h);
|
|
2064
2062
|
if (!n) return;
|
|
2065
2063
|
let r = e(n.executionsAtom);
|
|
@@ -2067,19 +2065,19 @@ function kr(e, t) {
|
|
|
2067
2065
|
let i = r.latest.get(t);
|
|
2068
2066
|
return i === void 0 ? void 0 : r.executions.get(i);
|
|
2069
2067
|
}
|
|
2070
|
-
function
|
|
2068
|
+
function Or(e, t) {
|
|
2071
2069
|
let { local: n, execution: r, code: i } = e;
|
|
2072
2070
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2073
2071
|
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && k(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2074
2072
|
if (o && o.executionId === a?.id && e.seq <= o.seq && !(e.kind === "input" && o.prompts.has(e.id)) || e.kind === "input" && s?.executionId === e.execution_id && s.ids.has(e.id)) return;
|
|
2075
|
-
let t =
|
|
2073
|
+
let t = Tr(e, l, i);
|
|
2076
2074
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
2077
2075
|
}, d = n.commandConsole?.entries, f = r?.append;
|
|
2078
2076
|
if (t && t.local === n && t.code === i && t.execution && f && f.before.deref() === t.execution.items && (!d?.length || d.every((e) => e.afterSeq !== void 0 && e.afterSeq < f.item.seq))) {
|
|
2079
2077
|
let n = u(f.item), r = t.rendered.consoleOutputs;
|
|
2080
2078
|
return {
|
|
2081
2079
|
...e,
|
|
2082
|
-
rendered: { consoleOutputs: n ?
|
|
2080
|
+
rendered: { consoleOutputs: n ? Jn([...r, n]) : r }
|
|
2083
2081
|
};
|
|
2084
2082
|
}
|
|
2085
2083
|
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : it(r).flatMap((e) => u(e) ?? []);
|
|
@@ -2092,12 +2090,12 @@ function Ar(e, t) {
|
|
|
2092
2090
|
}
|
|
2093
2091
|
return {
|
|
2094
2092
|
...e,
|
|
2095
|
-
rendered: { consoleOutputs:
|
|
2093
|
+
rendered: { consoleOutputs: Yn(p) }
|
|
2096
2094
|
};
|
|
2097
2095
|
}
|
|
2098
2096
|
//#endregion
|
|
2099
2097
|
//#region src/core/cells/columns.ts
|
|
2100
|
-
function
|
|
2098
|
+
function kr(e) {
|
|
2101
2099
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
2102
2100
|
for (let r of e.order) {
|
|
2103
2101
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -2105,9 +2103,9 @@ function jr(e) {
|
|
|
2105
2103
|
}
|
|
2106
2104
|
return t;
|
|
2107
2105
|
}
|
|
2108
|
-
function
|
|
2106
|
+
function Ar(e) {
|
|
2109
2107
|
let t = [[]];
|
|
2110
|
-
for (let [n, r] of
|
|
2108
|
+
for (let [n, r] of kr(e)) {
|
|
2111
2109
|
for (; t.length <= r;) t.push([]);
|
|
2112
2110
|
t[r].push(n);
|
|
2113
2111
|
}
|
|
@@ -2115,21 +2113,21 @@ function Mr(e) {
|
|
|
2115
2113
|
}
|
|
2116
2114
|
//#endregion
|
|
2117
2115
|
//#region src/core/cells/layout.ts
|
|
2118
|
-
var
|
|
2119
|
-
function
|
|
2120
|
-
return `column-${
|
|
2116
|
+
var jr = _(/* @__PURE__ */ new Set()), G = _([]), Mr = _([]);
|
|
2117
|
+
function Nr() {
|
|
2118
|
+
return `column-${In.create()}`;
|
|
2121
2119
|
}
|
|
2122
|
-
var
|
|
2123
|
-
let r =
|
|
2120
|
+
var Pr = _(null, (e, t, n) => {
|
|
2121
|
+
let r = Ar(n).length, i = e(G);
|
|
2124
2122
|
if (i.length === r) return;
|
|
2125
|
-
let a = e(
|
|
2126
|
-
for (; o.length < r;) o.push(
|
|
2127
|
-
t(
|
|
2128
|
-
}),
|
|
2123
|
+
let a = e(Mr), o = [...i, ...a].slice(0, r);
|
|
2124
|
+
for (; o.length < r;) o.push(Nr());
|
|
2125
|
+
t(G, o), t(Mr, a.slice(Math.max(0, r - i.length)));
|
|
2126
|
+
}), Fr = b(_((e) => {
|
|
2129
2127
|
let t = e(g);
|
|
2130
2128
|
return t === null ? null : e(t.documentAtom);
|
|
2131
|
-
}), (e) => e === null ? [[]] :
|
|
2132
|
-
let t = e(
|
|
2129
|
+
}), (e) => e === null ? [[]] : Ar(e), v), Ir = _((e) => {
|
|
2130
|
+
let t = e(Fr), n = e(G), r = e(Mr);
|
|
2133
2131
|
return [...t.map((e, t) => ({
|
|
2134
2132
|
id: n[t] ?? `column-${t}`,
|
|
2135
2133
|
ids: e
|
|
@@ -2138,7 +2136,7 @@ var Lr = v(null, (e, t, n) => {
|
|
|
2138
2136
|
ids: []
|
|
2139
2137
|
}))];
|
|
2140
2138
|
});
|
|
2141
|
-
function
|
|
2139
|
+
function Lr(e, t, n) {
|
|
2142
2140
|
let r = /* @__PURE__ */ new Map();
|
|
2143
2141
|
return e.forEach((i, a) => {
|
|
2144
2142
|
let o = t[a];
|
|
@@ -2147,9 +2145,9 @@ function Br(e, t, n) {
|
|
|
2147
2145
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2148
2146
|
}), r;
|
|
2149
2147
|
}
|
|
2150
|
-
function
|
|
2148
|
+
function Rr(e, t, n) {
|
|
2151
2149
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
2152
|
-
let i =
|
|
2150
|
+
let i = Lr(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
2153
2151
|
return {
|
|
2154
2152
|
id: e,
|
|
2155
2153
|
ids: r,
|
|
@@ -2158,36 +2156,36 @@ function Vr(e, t, n) {
|
|
|
2158
2156
|
};
|
|
2159
2157
|
}) };
|
|
2160
2158
|
}
|
|
2161
|
-
var
|
|
2162
|
-
let t = e(
|
|
2163
|
-
return
|
|
2164
|
-
}),
|
|
2165
|
-
function
|
|
2159
|
+
var zr = _((e) => {
|
|
2160
|
+
let t = e(va);
|
|
2161
|
+
return Rr(e(Ir), (e) => t[e] ?? null, e(jr));
|
|
2162
|
+
}), Br = () => le(zr), Vr = _((e) => e(zr).columns.length);
|
|
2163
|
+
function Hr(e, t) {
|
|
2166
2164
|
return e.columns.find((e) => e.id === t);
|
|
2167
2165
|
}
|
|
2168
|
-
function
|
|
2166
|
+
function Ur(e, t) {
|
|
2169
2167
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2170
2168
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
2171
2169
|
return n;
|
|
2172
2170
|
}
|
|
2173
|
-
function
|
|
2171
|
+
function Wr(e, t) {
|
|
2174
2172
|
for (let n of e.columns) {
|
|
2175
2173
|
let e = n.folds.get(t);
|
|
2176
2174
|
if (e !== void 0) return e;
|
|
2177
2175
|
}
|
|
2178
2176
|
}
|
|
2179
|
-
function
|
|
2177
|
+
function Gr(e, t) {
|
|
2180
2178
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2181
2179
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
2182
2180
|
}
|
|
2183
|
-
function
|
|
2184
|
-
let n =
|
|
2185
|
-
return
|
|
2181
|
+
function Kr(e, t) {
|
|
2182
|
+
let n = Gr(e, t);
|
|
2183
|
+
return Wr(e, t) === void 0 ? n : [...n, t];
|
|
2186
2184
|
}
|
|
2187
2185
|
//#endregion
|
|
2188
2186
|
//#region src/core/cells/document.ts
|
|
2189
|
-
function
|
|
2190
|
-
let n = t.code ?? e.code, r =
|
|
2187
|
+
function qr(e, t) {
|
|
2188
|
+
let n = t.code ?? e.code, r = v(e.config, t.config) ? e.config : wr(t.config);
|
|
2191
2189
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
2192
2190
|
...e,
|
|
2193
2191
|
name: t.name,
|
|
@@ -2199,30 +2197,30 @@ function Xr(e, t) {
|
|
|
2199
2197
|
config: r
|
|
2200
2198
|
};
|
|
2201
2199
|
}
|
|
2202
|
-
function
|
|
2203
|
-
let n =
|
|
2200
|
+
function Jr(e, t) {
|
|
2201
|
+
let n = v(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
2204
2202
|
for (let o of n) {
|
|
2205
2203
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
2206
2204
|
if (n === void 0) continue;
|
|
2207
2205
|
if (s === void 0) {
|
|
2208
2206
|
r = {
|
|
2209
2207
|
...r,
|
|
2210
|
-
[o]:
|
|
2208
|
+
[o]: Cr({
|
|
2211
2209
|
id: o,
|
|
2212
2210
|
code: n.code ?? "",
|
|
2213
2211
|
name: n.name,
|
|
2214
|
-
config:
|
|
2212
|
+
config: wr(n.config)
|
|
2215
2213
|
})
|
|
2216
2214
|
}, i = {
|
|
2217
2215
|
...i,
|
|
2218
|
-
[o]: i[o] ??
|
|
2216
|
+
[o]: i[o] ?? W()
|
|
2219
2217
|
}, a = {
|
|
2220
2218
|
...a,
|
|
2221
2219
|
[o]: (0, C.createRef)()
|
|
2222
2220
|
};
|
|
2223
2221
|
continue;
|
|
2224
2222
|
}
|
|
2225
|
-
let c =
|
|
2223
|
+
let c = qr(s, n);
|
|
2226
2224
|
c !== s && (r = {
|
|
2227
2225
|
...r,
|
|
2228
2226
|
[o]: c
|
|
@@ -2241,46 +2239,46 @@ function Zr(e, t) {
|
|
|
2241
2239
|
cellHandles: a
|
|
2242
2240
|
};
|
|
2243
2241
|
}
|
|
2244
|
-
function
|
|
2242
|
+
function Yr({ store: e, model: t, reconcile: n, signal: r }) {
|
|
2245
2243
|
let i = () => {
|
|
2246
2244
|
let r = e.get(t.documentAtom);
|
|
2247
|
-
r !== null && (n(r), e.set(
|
|
2245
|
+
r !== null && (n(r), e.set(Pr, r));
|
|
2248
2246
|
}, a = e.sub(t.documentAtom, i);
|
|
2249
2247
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
2250
2248
|
}
|
|
2251
|
-
async function
|
|
2249
|
+
async function Xr() {
|
|
2252
2250
|
let e = m.get(g);
|
|
2253
2251
|
e !== null && m.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
2254
2252
|
}
|
|
2255
2253
|
//#endregion
|
|
2256
2254
|
//#region src/core/cells/editor.ts
|
|
2257
|
-
var
|
|
2258
|
-
function
|
|
2255
|
+
var K = _(/* @__PURE__ */ new Set());
|
|
2256
|
+
function Zr(e, t, n) {
|
|
2259
2257
|
return !!e && !t.has(n);
|
|
2260
2258
|
}
|
|
2261
|
-
|
|
2262
|
-
t(
|
|
2263
|
-
}),
|
|
2259
|
+
_(null, (e, t, { cellId: n }) => {
|
|
2260
|
+
t(K, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2261
|
+
}), _(null, (e, t, { cellId: n }) => e(K).has(n) ? (t(K, (e) => {
|
|
2264
2262
|
let t = new Set(e);
|
|
2265
2263
|
return t.delete(n), t;
|
|
2266
2264
|
}), !0) : !1);
|
|
2267
|
-
var
|
|
2268
|
-
|
|
2269
|
-
t(
|
|
2265
|
+
var Qr = _(/* @__PURE__ */ new Map());
|
|
2266
|
+
_(null, (e, t, { cellId: n }) => {
|
|
2267
|
+
t(Qr, (e) => {
|
|
2270
2268
|
let t = new Map(e);
|
|
2271
2269
|
return t.delete(n), t;
|
|
2272
2270
|
});
|
|
2273
2271
|
});
|
|
2274
2272
|
//#endregion
|
|
2275
2273
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2276
|
-
function
|
|
2274
|
+
function $r(e, n) {
|
|
2277
2275
|
let r = document.getElementById(B.create(e));
|
|
2278
|
-
r ?
|
|
2276
|
+
r ? ti(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2279
2277
|
}
|
|
2280
|
-
function
|
|
2278
|
+
function ei() {
|
|
2281
2279
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2282
2280
|
}
|
|
2283
|
-
function
|
|
2281
|
+
function ti(e, n) {
|
|
2284
2282
|
try {
|
|
2285
2283
|
e.focus(n);
|
|
2286
2284
|
} catch {
|
|
@@ -2289,7 +2287,7 @@ function ii(e, n) {
|
|
|
2289
2287
|
}
|
|
2290
2288
|
//#endregion
|
|
2291
2289
|
//#region src/utils/timeout.ts
|
|
2292
|
-
function
|
|
2290
|
+
function ni(e, n) {
|
|
2293
2291
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
2294
2292
|
if (o < r) {
|
|
2295
2293
|
try {
|
|
@@ -2304,75 +2302,75 @@ function ai(e, n) {
|
|
|
2304
2302
|
}
|
|
2305
2303
|
//#endregion
|
|
2306
2304
|
//#region src/core/cells/utils.ts
|
|
2307
|
-
function
|
|
2305
|
+
function ri(e) {
|
|
2308
2306
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
2309
2307
|
}
|
|
2310
|
-
function
|
|
2308
|
+
function ii(e) {
|
|
2311
2309
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2312
2310
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
2313
2311
|
return r;
|
|
2314
2312
|
}
|
|
2315
|
-
function
|
|
2313
|
+
function ai(e) {
|
|
2316
2314
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2317
2315
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
2318
2316
|
return r;
|
|
2319
2317
|
}
|
|
2320
|
-
function
|
|
2318
|
+
function oi(e) {
|
|
2321
2319
|
return e.history.length > 0;
|
|
2322
2320
|
}
|
|
2323
|
-
function
|
|
2321
|
+
function si(e) {
|
|
2324
2322
|
let t = e.history[e.history.length - 1];
|
|
2325
2323
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2326
2324
|
}
|
|
2327
|
-
function
|
|
2328
|
-
return e.status === "idle" ?
|
|
2325
|
+
function ci(e, t, n) {
|
|
2326
|
+
return e.status === "idle" ? fi(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
2329
2327
|
}
|
|
2330
|
-
function*
|
|
2328
|
+
function* li(e, t, n) {
|
|
2331
2329
|
for (let r of e.cellIds) {
|
|
2332
|
-
let i = Vt(t, r), a = n(r), o =
|
|
2333
|
-
o === null ? a.sourceChanged &&
|
|
2330
|
+
let i = Vt(t, r), a = n(r), o = ci(i, a, e.cellData[r]);
|
|
2331
|
+
o === null ? a.sourceChanged && di(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2334
2332
|
}
|
|
2335
2333
|
}
|
|
2336
|
-
function
|
|
2334
|
+
function ui(e, t, n) {
|
|
2337
2335
|
let r = null;
|
|
2338
|
-
for (let [, i] of
|
|
2336
|
+
for (let [, i] of li(e, t, n)) {
|
|
2339
2337
|
if (i !== "inputs") return i;
|
|
2340
2338
|
r = i;
|
|
2341
2339
|
}
|
|
2342
2340
|
return r;
|
|
2343
2341
|
}
|
|
2344
|
-
function
|
|
2342
|
+
function di(e, t) {
|
|
2345
2343
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
2346
2344
|
return r !== void 0 && r.state.status !== "completed";
|
|
2347
2345
|
}
|
|
2348
|
-
function
|
|
2346
|
+
function fi({ status: e, outcome: t, live: n }) {
|
|
2349
2347
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
2350
2348
|
}
|
|
2351
|
-
function
|
|
2349
|
+
function pi({ errored: e, stopped: t }) {
|
|
2352
2350
|
return {
|
|
2353
2351
|
published: !0,
|
|
2354
2352
|
"has-error": e,
|
|
2355
2353
|
stopped: t
|
|
2356
2354
|
};
|
|
2357
2355
|
}
|
|
2358
|
-
function
|
|
2356
|
+
function mi({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
2359
2357
|
let a = R(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
2360
2358
|
return (e || t || n || a) && !o;
|
|
2361
2359
|
}
|
|
2362
2360
|
//#endregion
|
|
2363
2361
|
//#region src/core/network/requests.ts
|
|
2364
|
-
var
|
|
2365
|
-
function
|
|
2366
|
-
let e = le(
|
|
2362
|
+
var hi = _(null);
|
|
2363
|
+
function gi() {
|
|
2364
|
+
let e = le(hi);
|
|
2367
2365
|
return S(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2368
2366
|
}
|
|
2369
|
-
function
|
|
2370
|
-
let e = m.get(
|
|
2367
|
+
function _i() {
|
|
2368
|
+
let e = m.get(hi);
|
|
2371
2369
|
return S(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2372
2370
|
}
|
|
2373
2371
|
//#endregion
|
|
2374
2372
|
//#region src/utils/storage/storage.ts
|
|
2375
|
-
var
|
|
2373
|
+
var vi = class {
|
|
2376
2374
|
store = /* @__PURE__ */ new Map();
|
|
2377
2375
|
get length() {
|
|
2378
2376
|
return this.store.size;
|
|
@@ -2393,16 +2391,16 @@ var xi = class {
|
|
|
2393
2391
|
this.store.set(e, t);
|
|
2394
2392
|
}
|
|
2395
2393
|
};
|
|
2396
|
-
function
|
|
2394
|
+
function yi() {
|
|
2397
2395
|
let { hasLocalStorage: e, hasSessionStorage: t } = Ce();
|
|
2398
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2396
|
+
return e ? window.localStorage : t ? window.sessionStorage : new vi();
|
|
2399
2397
|
}
|
|
2400
|
-
var
|
|
2401
|
-
function
|
|
2402
|
-
return
|
|
2398
|
+
var bi = yi(), xi = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Si = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Ci = /^data:image\//i, wi = ["avatars.githubusercontent.com"];
|
|
2399
|
+
function Ti(e) {
|
|
2400
|
+
return Ci.test(e) ? [{
|
|
2403
2401
|
type: "image",
|
|
2404
2402
|
url: e
|
|
2405
|
-
}] : e.split(
|
|
2403
|
+
}] : e.split(xi).filter((e) => e !== "").map((e) => xi.test(e) ? Si.test(e) || Ci.test(e) || wi.some((t) => e.includes(t)) ? {
|
|
2406
2404
|
type: "image",
|
|
2407
2405
|
url: e
|
|
2408
2406
|
} : {
|
|
@@ -2415,48 +2413,48 @@ function Oi(e) {
|
|
|
2415
2413
|
}
|
|
2416
2414
|
//#endregion
|
|
2417
2415
|
//#region src/utils/json/json-parser.ts
|
|
2418
|
-
var
|
|
2416
|
+
var Ei = new RegExp(xi.source, "g");
|
|
2419
2417
|
BigInt.prototype.toJSON = function() {
|
|
2420
2418
|
return JSON.rawJSON(this.toString());
|
|
2421
2419
|
};
|
|
2422
|
-
function
|
|
2420
|
+
function Di(e) {
|
|
2423
2421
|
try {
|
|
2424
|
-
return JSON.parse(e, (e, t) =>
|
|
2422
|
+
return JSON.parse(e, (e, t) => ji(t));
|
|
2425
2423
|
} catch {}
|
|
2426
2424
|
if (e == null || e === "") return {};
|
|
2427
2425
|
try {
|
|
2428
|
-
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 :
|
|
2426
|
+
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 : ji(t) : ji(t));
|
|
2429
2427
|
} catch {
|
|
2430
2428
|
return {};
|
|
2431
2429
|
}
|
|
2432
2430
|
}
|
|
2433
|
-
function
|
|
2431
|
+
function Oi(e) {
|
|
2434
2432
|
if (e.length === 0) return "";
|
|
2435
2433
|
let t = Object.keys(e[0]);
|
|
2436
2434
|
return [
|
|
2437
2435
|
`| ${t.join(" | ")} |`,
|
|
2438
2436
|
`|${t.map(() => "---").join("|")}|`,
|
|
2439
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2437
|
+
...e.map((e) => `| ${t.map((t) => ki(e[t])).join(" | ")} |`)
|
|
2440
2438
|
].join("\n");
|
|
2441
2439
|
}
|
|
2442
|
-
function
|
|
2440
|
+
function ki(e) {
|
|
2443
2441
|
if (e == null) return "";
|
|
2444
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2442
|
+
if (Array.isArray(e) || typeof e == "object") return Ai(JSON.stringify(e));
|
|
2445
2443
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2446
2444
|
t = t.replaceAll(n, (e) => {
|
|
2447
2445
|
let t = `__MDLINK_${i++}__`;
|
|
2448
2446
|
return r.set(t, e), t;
|
|
2449
|
-
}), t = t.replaceAll(
|
|
2447
|
+
}), t = t.replaceAll(Ei, "[$1]($1)");
|
|
2450
2448
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2451
|
-
return
|
|
2449
|
+
return Ai(t);
|
|
2452
2450
|
}
|
|
2453
|
-
function
|
|
2451
|
+
function Ai(e) {
|
|
2454
2452
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2455
2453
|
}
|
|
2456
|
-
function
|
|
2454
|
+
function ji(e) {
|
|
2457
2455
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2458
2456
|
}
|
|
2459
|
-
var
|
|
2457
|
+
var Mi = new class {
|
|
2460
2458
|
getFilename() {
|
|
2461
2459
|
return this.getSearchParam("filename");
|
|
2462
2460
|
}
|
|
@@ -2483,20 +2481,20 @@ var Fi = new class {
|
|
|
2483
2481
|
}();
|
|
2484
2482
|
//#endregion
|
|
2485
2483
|
//#region src/core/dom/htmlUtils.ts
|
|
2486
|
-
function
|
|
2487
|
-
return
|
|
2484
|
+
function Ni(e) {
|
|
2485
|
+
return Di(e ?? "");
|
|
2488
2486
|
}
|
|
2489
|
-
function
|
|
2490
|
-
return de.mapValues(e.dataset, (e) => typeof e == "string" ?
|
|
2487
|
+
function Pi(e) {
|
|
2488
|
+
return de.mapValues(e.dataset, (e) => typeof e == "string" ? Ni(e) : e);
|
|
2491
2489
|
}
|
|
2492
|
-
function
|
|
2493
|
-
let n = e.parentElement ?
|
|
2494
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2490
|
+
function Fi(e, t) {
|
|
2491
|
+
let n = e.parentElement ? Rn.parse(e.parentElement) : void 0;
|
|
2492
|
+
return n && t.has(n) ? t.lookupValue(n) : Ni(e.dataset.initialValue);
|
|
2495
2493
|
}
|
|
2496
|
-
function
|
|
2494
|
+
function Ii() {
|
|
2497
2495
|
if (re()) return document.title || null;
|
|
2498
2496
|
if (xe()) {
|
|
2499
|
-
let e =
|
|
2497
|
+
let e = Mi.getFilename();
|
|
2500
2498
|
if (e) return e;
|
|
2501
2499
|
}
|
|
2502
2500
|
let e = document.querySelector("marimo-filename");
|
|
@@ -2506,16 +2504,16 @@ function zi() {
|
|
|
2506
2504
|
}
|
|
2507
2505
|
//#endregion
|
|
2508
2506
|
//#region src/core/saving/file-state.ts
|
|
2509
|
-
var
|
|
2510
|
-
|
|
2511
|
-
var
|
|
2512
|
-
|
|
2507
|
+
var Li = _(Ii());
|
|
2508
|
+
_(null);
|
|
2509
|
+
var Ri = _(null);
|
|
2510
|
+
_(void 0);
|
|
2513
2511
|
//#endregion
|
|
2514
2512
|
//#region src/utils/storage/typed.ts
|
|
2515
|
-
var
|
|
2513
|
+
var zi = class {
|
|
2516
2514
|
defaultValue;
|
|
2517
2515
|
storage;
|
|
2518
|
-
constructor(e, t =
|
|
2516
|
+
constructor(e, t = bi) {
|
|
2519
2517
|
this.defaultValue = e, this.storage = t;
|
|
2520
2518
|
}
|
|
2521
2519
|
get(e) {
|
|
@@ -2532,11 +2530,11 @@ var Vi = class {
|
|
|
2532
2530
|
remove(e) {
|
|
2533
2531
|
this.storage.removeItem(e);
|
|
2534
2532
|
}
|
|
2535
|
-
},
|
|
2533
|
+
}, Bi = class {
|
|
2536
2534
|
schema;
|
|
2537
2535
|
getDefaultValue;
|
|
2538
2536
|
storage;
|
|
2539
|
-
constructor(e, t, n =
|
|
2537
|
+
constructor(e, t, n = bi) {
|
|
2540
2538
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2541
2539
|
}
|
|
2542
2540
|
get(e) {
|
|
@@ -2555,15 +2553,15 @@ var Vi = class {
|
|
|
2555
2553
|
remove(e) {
|
|
2556
2554
|
this.storage.removeItem(e);
|
|
2557
2555
|
}
|
|
2558
|
-
},
|
|
2556
|
+
}, Vi = class extends Bi {
|
|
2559
2557
|
filename;
|
|
2560
2558
|
unsubscribeFromFilename;
|
|
2561
2559
|
constructor(e, t, n) {
|
|
2562
|
-
let r = m.get(
|
|
2560
|
+
let r = m.get(Li);
|
|
2563
2561
|
super(t, n), this.filename = r;
|
|
2564
2562
|
try {
|
|
2565
|
-
this.unsubscribeFromFilename = m.sub(
|
|
2566
|
-
let t = m.get(
|
|
2563
|
+
this.unsubscribeFromFilename = m.sub(Li, () => {
|
|
2564
|
+
let t = m.get(Li);
|
|
2567
2565
|
this.handleFilenameChange(e, t);
|
|
2568
2566
|
});
|
|
2569
2567
|
} catch {
|
|
@@ -2591,7 +2589,7 @@ var Vi = class {
|
|
|
2591
2589
|
dispose() {
|
|
2592
2590
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2593
2591
|
}
|
|
2594
|
-
},
|
|
2592
|
+
}, q = {
|
|
2595
2593
|
VariableName: "VariableName",
|
|
2596
2594
|
FunctionDefinition: "FunctionDefinition",
|
|
2597
2595
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2616,30 +2614,30 @@ var Vi = class {
|
|
|
2616
2614
|
Comment: "Comment",
|
|
2617
2615
|
String: "String",
|
|
2618
2616
|
FormatString: "FormatString"
|
|
2619
|
-
},
|
|
2617
|
+
}, J = {
|
|
2620
2618
|
For: "for",
|
|
2621
2619
|
In: "in",
|
|
2622
2620
|
As: "as",
|
|
2623
2621
|
Import: "import"
|
|
2624
|
-
},
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2622
|
+
}, Hi = /* @__PURE__ */ new Set([
|
|
2623
|
+
q.FunctionDefinition,
|
|
2624
|
+
q.LambdaExpression,
|
|
2625
|
+
q.ArrayComprehensionExpression,
|
|
2626
|
+
q.SetComprehensionExpression,
|
|
2627
|
+
q.DictionaryComprehensionExpression,
|
|
2628
|
+
q.ComprehensionExpression,
|
|
2629
|
+
q.ClassDefinition
|
|
2632
2630
|
]);
|
|
2633
|
-
|
|
2631
|
+
q.Comment, q.String, q.FormatString;
|
|
2634
2632
|
//#endregion
|
|
2635
2633
|
//#region src/core/codemirror/utils.ts
|
|
2636
|
-
function
|
|
2634
|
+
function Ui(e) {
|
|
2637
2635
|
e && e.dispatch({ selection: {
|
|
2638
2636
|
anchor: e.state.doc.length,
|
|
2639
2637
|
head: e.state.doc.length
|
|
2640
2638
|
} });
|
|
2641
2639
|
}
|
|
2642
|
-
function
|
|
2640
|
+
function Wi(e) {
|
|
2643
2641
|
let t = e.dom.closest(".marimo-cell");
|
|
2644
2642
|
t && requestAnimationFrame(() => {
|
|
2645
2643
|
t.scrollIntoView({
|
|
@@ -2651,8 +2649,8 @@ function Ki(e) {
|
|
|
2651
2649
|
}
|
|
2652
2650
|
//#endregion
|
|
2653
2651
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2654
|
-
var
|
|
2655
|
-
function
|
|
2652
|
+
var Gi = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2653
|
+
function Ki(e, t) {
|
|
2656
2654
|
requestAnimationFrame(() => {
|
|
2657
2655
|
e.focus(), e.dispatch({
|
|
2658
2656
|
selection: {
|
|
@@ -2661,19 +2659,19 @@ function Ji(e, t) {
|
|
|
2661
2659
|
},
|
|
2662
2660
|
effects: me.scrollIntoView(t, { y: "center" })
|
|
2663
2661
|
});
|
|
2664
|
-
}),
|
|
2662
|
+
}), Wi(e);
|
|
2665
2663
|
}
|
|
2666
|
-
function
|
|
2664
|
+
function qi(e, t) {
|
|
2667
2665
|
let n = he(e), r = null;
|
|
2668
2666
|
return n.iterate({ enter: (n) => {
|
|
2669
2667
|
if (r !== null) return !1;
|
|
2670
|
-
if (n.name ===
|
|
2671
|
-
if (n.name ===
|
|
2668
|
+
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2669
|
+
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2672
2670
|
} }), r;
|
|
2673
2671
|
}
|
|
2674
|
-
function
|
|
2672
|
+
function Ji(e, t) {
|
|
2675
2673
|
let n = [], r = e.resolveInner(t, 0);
|
|
2676
|
-
for (; r;)
|
|
2674
|
+
for (; r;) Hi.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2677
2675
|
id: r.from,
|
|
2678
2676
|
type: r.name
|
|
2679
2677
|
})), r = r.parent;
|
|
@@ -2682,70 +2680,70 @@ function Xi(e, t) {
|
|
|
2682
2680
|
type: "global"
|
|
2683
2681
|
}), n;
|
|
2684
2682
|
}
|
|
2685
|
-
function
|
|
2683
|
+
function Y(e, t, n) {
|
|
2686
2684
|
e.push({
|
|
2687
2685
|
scopeId: t,
|
|
2688
2686
|
from: n
|
|
2689
2687
|
});
|
|
2690
2688
|
}
|
|
2691
|
-
function
|
|
2689
|
+
function Yi(e, t) {
|
|
2692
2690
|
if (e.firstChild()) do
|
|
2693
2691
|
t(e.node);
|
|
2694
2692
|
while (e.nextSibling());
|
|
2695
2693
|
}
|
|
2696
|
-
function
|
|
2694
|
+
function Xi(e, t) {
|
|
2697
2695
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2698
2696
|
switch (e.name) {
|
|
2699
|
-
case
|
|
2700
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2697
|
+
case q.VariableName:
|
|
2698
|
+
n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2701
2699
|
break;
|
|
2702
|
-
case
|
|
2703
|
-
case
|
|
2700
|
+
case q.TupleExpression:
|
|
2701
|
+
case q.ArrayExpression: {
|
|
2704
2702
|
let n = e.node.cursor();
|
|
2705
2703
|
n.firstChild();
|
|
2706
2704
|
do
|
|
2707
|
-
|
|
2705
|
+
Xi(n, t);
|
|
2708
2706
|
while (n.nextSibling());
|
|
2709
2707
|
break;
|
|
2710
2708
|
}
|
|
2711
2709
|
}
|
|
2712
2710
|
}
|
|
2713
|
-
function
|
|
2711
|
+
function Zi(e, t) {
|
|
2714
2712
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2715
2713
|
o.firstChild();
|
|
2716
2714
|
do {
|
|
2717
|
-
if (o.name !==
|
|
2715
|
+
if (o.name !== q.ParamList) continue;
|
|
2718
2716
|
let e = o.node.cursor();
|
|
2719
2717
|
e.firstChild();
|
|
2720
2718
|
do
|
|
2721
|
-
e.name ===
|
|
2719
|
+
e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2722
2720
|
while (e.nextSibling());
|
|
2723
2721
|
} while (o.nextSibling());
|
|
2724
2722
|
}
|
|
2725
|
-
function
|
|
2723
|
+
function Qi(e, t) {
|
|
2726
2724
|
let n = e.cursor();
|
|
2727
2725
|
n.firstChild();
|
|
2728
2726
|
let r = !1;
|
|
2729
2727
|
do
|
|
2730
|
-
if (n.name ===
|
|
2731
|
-
else if (r && n.name ===
|
|
2732
|
-
else r &&
|
|
2728
|
+
if (n.name === J.For) r = !0;
|
|
2729
|
+
else if (r && n.name === J.In) break;
|
|
2730
|
+
else r && Xi(n, t);
|
|
2733
2731
|
while (n.nextSibling());
|
|
2734
2732
|
}
|
|
2735
|
-
function
|
|
2736
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2733
|
+
function $i(e, t) {
|
|
2734
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Hi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2737
2735
|
switch (s) {
|
|
2738
|
-
case
|
|
2739
|
-
case
|
|
2736
|
+
case q.FunctionDefinition:
|
|
2737
|
+
case q.ClassDefinition: {
|
|
2740
2738
|
let t = e.cursor();
|
|
2741
2739
|
t.firstChild();
|
|
2742
2740
|
do
|
|
2743
|
-
if (t.name ===
|
|
2744
|
-
|
|
2741
|
+
if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2742
|
+
Y(a, i[i.length - 1] ?? -1, t.from);
|
|
2745
2743
|
break;
|
|
2746
2744
|
}
|
|
2747
2745
|
while (t.nextSibling());
|
|
2748
|
-
s ===
|
|
2746
|
+
s === q.FunctionDefinition && Zi(e, {
|
|
2749
2747
|
state: n,
|
|
2750
2748
|
variableName: r,
|
|
2751
2749
|
scopeId: c,
|
|
@@ -2753,38 +2751,38 @@ function ta(e, t) {
|
|
|
2753
2751
|
});
|
|
2754
2752
|
break;
|
|
2755
2753
|
}
|
|
2756
|
-
case
|
|
2757
|
-
|
|
2754
|
+
case q.LambdaExpression:
|
|
2755
|
+
Zi(e, {
|
|
2758
2756
|
state: n,
|
|
2759
2757
|
variableName: r,
|
|
2760
2758
|
scopeId: c,
|
|
2761
2759
|
declarations: a
|
|
2762
2760
|
});
|
|
2763
2761
|
break;
|
|
2764
|
-
case
|
|
2765
|
-
case
|
|
2766
|
-
case
|
|
2767
|
-
case
|
|
2768
|
-
case
|
|
2769
|
-
|
|
2762
|
+
case q.ArrayComprehensionExpression:
|
|
2763
|
+
case q.DictionaryComprehensionExpression:
|
|
2764
|
+
case q.SetComprehensionExpression:
|
|
2765
|
+
case q.ComprehensionExpression:
|
|
2766
|
+
case q.ForStatement:
|
|
2767
|
+
Qi(e, {
|
|
2770
2768
|
state: n,
|
|
2771
2769
|
variableName: r,
|
|
2772
2770
|
scopeId: u,
|
|
2773
2771
|
declarations: a
|
|
2774
2772
|
});
|
|
2775
2773
|
break;
|
|
2776
|
-
case
|
|
2774
|
+
case q.AssignStatement: {
|
|
2777
2775
|
let t = [], i = e.cursor();
|
|
2778
2776
|
i.firstChild();
|
|
2779
2777
|
do
|
|
2780
|
-
i.name ===
|
|
2778
|
+
i.name === q.AssignOp && t.push(i.from);
|
|
2781
2779
|
while (i.nextSibling());
|
|
2782
2780
|
let o = t[t.length - 1];
|
|
2783
2781
|
if (o === void 0) break;
|
|
2784
2782
|
let s = e.cursor();
|
|
2785
2783
|
s.firstChild();
|
|
2786
2784
|
do
|
|
2787
|
-
s.from < o &&
|
|
2785
|
+
s.from < o && Xi(s, {
|
|
2788
2786
|
state: n,
|
|
2789
2787
|
variableName: r,
|
|
2790
2788
|
scopeId: u,
|
|
@@ -2793,14 +2791,14 @@ function ta(e, t) {
|
|
|
2793
2791
|
while (s.nextSibling());
|
|
2794
2792
|
break;
|
|
2795
2793
|
}
|
|
2796
|
-
case
|
|
2794
|
+
case q.ImportStatement: {
|
|
2797
2795
|
let t = e.cursor();
|
|
2798
2796
|
t.firstChild();
|
|
2799
2797
|
let i = !1, o = null, s = () => {
|
|
2800
|
-
o?.matches &&
|
|
2798
|
+
o?.matches && Y(a, u, o.from), o = null;
|
|
2801
2799
|
};
|
|
2802
2800
|
do
|
|
2803
|
-
t.name ===
|
|
2801
|
+
t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
|
|
2804
2802
|
from: t.from,
|
|
2805
2803
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2806
2804
|
}) : t.name === "," && s());
|
|
@@ -2808,19 +2806,19 @@ function ta(e, t) {
|
|
|
2808
2806
|
s();
|
|
2809
2807
|
break;
|
|
2810
2808
|
}
|
|
2811
|
-
case
|
|
2812
|
-
case
|
|
2809
|
+
case q.TryStatement:
|
|
2810
|
+
case q.WithStatement: {
|
|
2813
2811
|
let t = e.cursor();
|
|
2814
2812
|
t.firstChild();
|
|
2815
2813
|
let i = !1;
|
|
2816
2814
|
do
|
|
2817
|
-
t.name ===
|
|
2815
|
+
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);
|
|
2818
2816
|
while (t.nextSibling());
|
|
2819
2817
|
break;
|
|
2820
2818
|
}
|
|
2821
2819
|
}
|
|
2822
|
-
|
|
2823
|
-
|
|
2820
|
+
Yi(o, (e) => {
|
|
2821
|
+
$i(e, {
|
|
2824
2822
|
state: n,
|
|
2825
2823
|
variableName: r,
|
|
2826
2824
|
scopeStack: l,
|
|
@@ -2828,49 +2826,49 @@ function ta(e, t) {
|
|
|
2828
2826
|
});
|
|
2829
2827
|
});
|
|
2830
2828
|
}
|
|
2831
|
-
function
|
|
2829
|
+
function ea(e, t, n) {
|
|
2832
2830
|
let r = he(e), i = [];
|
|
2833
|
-
|
|
2831
|
+
$i(r, {
|
|
2834
2832
|
state: e,
|
|
2835
2833
|
variableName: t,
|
|
2836
2834
|
scopeStack: [],
|
|
2837
2835
|
declarations: i
|
|
2838
2836
|
});
|
|
2839
2837
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2840
|
-
for (let e of
|
|
2841
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2838
|
+
for (let e of Ji(r, a)) {
|
|
2839
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Gi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2842
2840
|
if (t) return t.from;
|
|
2843
2841
|
}
|
|
2844
2842
|
return null;
|
|
2845
2843
|
}
|
|
2846
|
-
function
|
|
2847
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2848
|
-
return i !== null && (
|
|
2844
|
+
function ta(e, t, n) {
|
|
2845
|
+
let { state: r } = e, i = n === void 0 ? qi(r, t) : ea(r, t, n);
|
|
2846
|
+
return i !== null && (Ki(e, i), !0);
|
|
2849
2847
|
}
|
|
2850
|
-
function
|
|
2851
|
-
return
|
|
2848
|
+
function na(e, t) {
|
|
2849
|
+
return Ki(e, e.state.doc.line(t).from), !0;
|
|
2852
2850
|
}
|
|
2853
2851
|
//#endregion
|
|
2854
2852
|
//#region src/core/network/connection.ts
|
|
2855
|
-
var
|
|
2853
|
+
var X = _({ state: D.NOT_STARTED });
|
|
2856
2854
|
ae(null, (e, t) => t === null ? null : {
|
|
2857
2855
|
phase: t.phase,
|
|
2858
2856
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2859
2857
|
});
|
|
2860
|
-
function
|
|
2861
|
-
return te(
|
|
2858
|
+
function ra() {
|
|
2859
|
+
return te(X, (e) => e.state === D.OPEN);
|
|
2862
2860
|
}
|
|
2863
|
-
function
|
|
2864
|
-
return ve() ?
|
|
2861
|
+
function ia() {
|
|
2862
|
+
return ve() ? ra() : Promise.resolve();
|
|
2865
2863
|
}
|
|
2866
|
-
|
|
2867
|
-
let t = e(
|
|
2864
|
+
_((e) => e(X).state === D.CONNECTING), _((e) => e(X).state === D.OPEN), _((e) => {
|
|
2865
|
+
let t = e(X);
|
|
2868
2866
|
return t.state === D.OPEN || t.state === D.NOT_STARTED;
|
|
2869
|
-
}),
|
|
2867
|
+
}), _((e) => e(X).state === D.CLOSED);
|
|
2870
2868
|
//#endregion
|
|
2871
2869
|
//#region src/components/ui/checkbox.tsx
|
|
2872
|
-
var
|
|
2873
|
-
let r = (0,
|
|
2870
|
+
var aa = C.forwardRef((e, t) => {
|
|
2871
|
+
let r = (0, yn.c)(13), i, a;
|
|
2874
2872
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2875
2873
|
let o;
|
|
2876
2874
|
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);
|
|
@@ -2889,25 +2887,25 @@ var sa = C.forwardRef((e, t) => {
|
|
|
2889
2887
|
children: c
|
|
2890
2888
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2891
2889
|
});
|
|
2892
|
-
|
|
2890
|
+
aa.displayName = Fe.displayName;
|
|
2893
2891
|
//#endregion
|
|
2894
2892
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2895
|
-
function
|
|
2893
|
+
function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2896
2894
|
if (!n) return;
|
|
2897
2895
|
let o = document.getElementById(B.create(e));
|
|
2898
2896
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2899
|
-
else if (
|
|
2897
|
+
else if (ei()) ti(o);
|
|
2900
2898
|
else {
|
|
2901
|
-
if (r)
|
|
2899
|
+
if (r) ti(o);
|
|
2902
2900
|
else {
|
|
2903
|
-
|
|
2901
|
+
En.promote(e);
|
|
2904
2902
|
let r = n.current?.editorView;
|
|
2905
2903
|
if (!r) {
|
|
2906
2904
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2907
2905
|
return;
|
|
2908
2906
|
}
|
|
2909
2907
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2910
|
-
if (
|
|
2908
|
+
if (ni(() => (r.focus(), r.hasFocus), {
|
|
2911
2909
|
retries: 5,
|
|
2912
2910
|
delay: 20
|
|
2913
2911
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2920,7 +2918,7 @@ function ca({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2920
2918
|
anchor: e.from,
|
|
2921
2919
|
head: e.from
|
|
2922
2920
|
} });
|
|
2923
|
-
} else a &&
|
|
2921
|
+
} else a && ta(r, a);
|
|
2924
2922
|
}
|
|
2925
2923
|
o.scrollIntoView({
|
|
2926
2924
|
behavior: "smooth",
|
|
@@ -2928,20 +2926,20 @@ function ca({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2928
2926
|
});
|
|
2929
2927
|
}
|
|
2930
2928
|
}
|
|
2931
|
-
function
|
|
2929
|
+
function sa() {
|
|
2932
2930
|
let e = document.getElementById("App");
|
|
2933
2931
|
e?.scrollTo({
|
|
2934
2932
|
top: e.scrollHeight,
|
|
2935
2933
|
behavior: "smooth"
|
|
2936
2934
|
});
|
|
2937
2935
|
}
|
|
2938
|
-
function
|
|
2936
|
+
function ca() {
|
|
2939
2937
|
document.getElementById("App")?.scrollTo({
|
|
2940
2938
|
top: 0,
|
|
2941
2939
|
behavior: "smooth"
|
|
2942
2940
|
});
|
|
2943
2941
|
}
|
|
2944
|
-
function
|
|
2942
|
+
function la(e) {
|
|
2945
2943
|
let t = document.getElementById(B.create(e));
|
|
2946
2944
|
return t?.scrollIntoView({
|
|
2947
2945
|
behavior: "smooth",
|
|
@@ -2950,7 +2948,7 @@ function da(e) {
|
|
|
2950
2948
|
}
|
|
2951
2949
|
//#endregion
|
|
2952
2950
|
//#region src/core/cells/cells.ts
|
|
2953
|
-
function
|
|
2951
|
+
function ua(e) {
|
|
2954
2952
|
let t = {
|
|
2955
2953
|
column: 0,
|
|
2956
2954
|
hide_code: !1,
|
|
@@ -2960,14 +2958,14 @@ function fa(e) {
|
|
|
2960
2958
|
return {
|
|
2961
2959
|
...e,
|
|
2962
2960
|
cellData: {
|
|
2963
|
-
[z]:
|
|
2961
|
+
[z]: Cr({
|
|
2964
2962
|
id: z,
|
|
2965
2963
|
config: t
|
|
2966
2964
|
}),
|
|
2967
2965
|
...e.cellData
|
|
2968
2966
|
},
|
|
2969
2967
|
cellRuntime: {
|
|
2970
|
-
[z]:
|
|
2968
|
+
[z]: W(),
|
|
2971
2969
|
...e.cellRuntime
|
|
2972
2970
|
},
|
|
2973
2971
|
cellHandles: {
|
|
@@ -2976,8 +2974,8 @@ function fa(e) {
|
|
|
2976
2974
|
}
|
|
2977
2975
|
};
|
|
2978
2976
|
}
|
|
2979
|
-
function
|
|
2980
|
-
return
|
|
2977
|
+
function da() {
|
|
2978
|
+
return ua({
|
|
2981
2979
|
cellIds: [],
|
|
2982
2980
|
cellData: {},
|
|
2983
2981
|
cellRuntime: {},
|
|
@@ -2987,8 +2985,8 @@ function pa() {
|
|
|
2987
2985
|
cellLogs: []
|
|
2988
2986
|
});
|
|
2989
2987
|
}
|
|
2990
|
-
var { reducer:
|
|
2991
|
-
startCellConsole: (e, { cellId: t }) =>
|
|
2988
|
+
var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = pe(da, {
|
|
2989
|
+
startCellConsole: (e, { cellId: t }) => Q({
|
|
2992
2990
|
state: e,
|
|
2993
2991
|
cellId: t,
|
|
2994
2992
|
cellReducer: (e) => ({
|
|
@@ -3000,17 +2998,17 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3000
2998
|
})
|
|
3001
2999
|
}),
|
|
3002
3000
|
showCommandOutput: (e, t) => {
|
|
3003
|
-
let { cell_id: n, entries: r, replace: i } = t, a =
|
|
3001
|
+
let { cell_id: n, entries: r, replace: i } = t, a = Q({
|
|
3004
3002
|
state: e,
|
|
3005
3003
|
cellId: n,
|
|
3006
3004
|
cellReducer: (e) => ({
|
|
3007
3005
|
...e,
|
|
3008
|
-
commandConsole:
|
|
3006
|
+
commandConsole: kn(e.commandConsole, t, e.clearedCommandIds?.[t.op])
|
|
3009
3007
|
})
|
|
3010
3008
|
});
|
|
3011
3009
|
return i || t.op === "pdb-output" ? a : {
|
|
3012
3010
|
...a,
|
|
3013
|
-
cellLogs: [...a.cellLogs, ...
|
|
3011
|
+
cellLogs: [...a.cellLogs, ...hr({
|
|
3014
3012
|
cell_id: n,
|
|
3015
3013
|
console: r
|
|
3016
3014
|
})]
|
|
@@ -3018,7 +3016,7 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3018
3016
|
},
|
|
3019
3017
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
3020
3018
|
let i = new Set(r);
|
|
3021
|
-
return
|
|
3019
|
+
return Q({
|
|
3022
3020
|
state: e,
|
|
3023
3021
|
cellId: t,
|
|
3024
3022
|
cellReducer: (e) => ({
|
|
@@ -3036,7 +3034,7 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3036
3034
|
let n = t[e];
|
|
3037
3035
|
n.commandConsole?.entries.some((e) => e.source === "pdb-output") && (t[e] = {
|
|
3038
3036
|
...n,
|
|
3039
|
-
commandConsole:
|
|
3037
|
+
commandConsole: kn(n.commandConsole, {
|
|
3040
3038
|
op: "pdb-output",
|
|
3041
3039
|
cell_id: e,
|
|
3042
3040
|
entries: [],
|
|
@@ -3054,13 +3052,13 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3054
3052
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
3055
3053
|
}),
|
|
3056
3054
|
reconcileDocument: (e, t) => {
|
|
3057
|
-
let n =
|
|
3058
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3055
|
+
let n = Jr(e, t);
|
|
3056
|
+
for (let t of e.cellIds) t in n.cellData || Aa(t);
|
|
3059
3057
|
return n;
|
|
3060
3058
|
},
|
|
3061
3059
|
setStdinResponse: (e, t) => {
|
|
3062
3060
|
let { cellId: n, response: r, inputId: i } = t;
|
|
3063
|
-
return
|
|
3061
|
+
return Q({
|
|
3064
3062
|
state: e,
|
|
3065
3063
|
cellId: n,
|
|
3066
3064
|
cellReducer: (e) => ({
|
|
@@ -3073,7 +3071,7 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3073
3071
|
let n = xe(), r = { ...e.cellRuntime };
|
|
3074
3072
|
for (let i of [...e.cellIds, z]) {
|
|
3075
3073
|
let a = e.cellRuntime[i];
|
|
3076
|
-
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a :
|
|
3074
|
+
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : W({
|
|
3077
3075
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
3078
3076
|
clearedCommandIds: t ? a?.clearedCommandIds : void 0
|
|
3079
3077
|
});
|
|
@@ -3087,10 +3085,10 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3087
3085
|
let t = e.scrollKey;
|
|
3088
3086
|
if (t === null) return e;
|
|
3089
3087
|
let n = t;
|
|
3090
|
-
return
|
|
3088
|
+
return oa({
|
|
3091
3089
|
cellId: n,
|
|
3092
3090
|
cell: e.cellHandles[n],
|
|
3093
|
-
isCodeHidden:
|
|
3091
|
+
isCodeHidden: Zr(e.cellData[n]?.config.hide_code, m.get(K), n),
|
|
3094
3092
|
codeFocus: void 0,
|
|
3095
3093
|
variableName: void 0
|
|
3096
3094
|
}), {
|
|
@@ -3098,13 +3096,13 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3098
3096
|
scrollKey: null
|
|
3099
3097
|
};
|
|
3100
3098
|
},
|
|
3101
|
-
foldAll: (e) => (
|
|
3102
|
-
unfoldAll: (e) => (
|
|
3099
|
+
foldAll: (e) => (xn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3100
|
+
unfoldAll: (e) => (Sn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3103
3101
|
clearLogs: (e) => ({
|
|
3104
3102
|
...e,
|
|
3105
3103
|
cellLogs: []
|
|
3106
3104
|
}),
|
|
3107
|
-
clearCellConsole: (e, t) =>
|
|
3105
|
+
clearCellConsole: (e, t) => Q({
|
|
3108
3106
|
state: e,
|
|
3109
3107
|
cellId: t.cellId,
|
|
3110
3108
|
cellReducer: (e) => {
|
|
@@ -3120,7 +3118,7 @@ var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
|
3120
3118
|
}
|
|
3121
3119
|
})
|
|
3122
3120
|
});
|
|
3123
|
-
function
|
|
3121
|
+
function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
3124
3122
|
return n in e.cellRuntime ? {
|
|
3125
3123
|
...e,
|
|
3126
3124
|
cellRuntime: {
|
|
@@ -3129,14 +3127,14 @@ function Z({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3129
3127
|
}
|
|
3130
3128
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3131
3129
|
}
|
|
3132
|
-
var
|
|
3133
|
-
m.set(
|
|
3134
|
-
}).addLogs,
|
|
3135
|
-
|
|
3136
|
-
var
|
|
3137
|
-
|
|
3138
|
-
var
|
|
3139
|
-
let { cellIds: t, cellData: n } = e(
|
|
3130
|
+
var ha = pa((e) => {
|
|
3131
|
+
m.set(Z, (t) => fa(t, e));
|
|
3132
|
+
}).addLogs, $ = _((e) => e(Z).cellIds);
|
|
3133
|
+
_((e) => e($).length === 1), _((e) => ii(e(Z)).length > 0), _((e) => ai(e(Z)).length > 0), _((e) => oi(e(Z))), _((e) => si(e(Z)));
|
|
3134
|
+
var ga = _((e) => ui(e(Z), e(F), e(on)));
|
|
3135
|
+
_((e) => e(ga) !== null);
|
|
3136
|
+
var _a = _((e) => {
|
|
3137
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3140
3138
|
return t.map((t) => {
|
|
3141
3139
|
let r = e(I(t)), { name: i } = n[t];
|
|
3142
3140
|
if (r !== null && R(r.mimetype)) {
|
|
@@ -3153,103 +3151,103 @@ var ya = v((e) => {
|
|
|
3153
3151
|
}
|
|
3154
3152
|
return null;
|
|
3155
3153
|
}).filter(Boolean);
|
|
3156
|
-
}),
|
|
3154
|
+
}), va = x(_((e) => {
|
|
3157
3155
|
let t = {};
|
|
3158
|
-
for (let n of e(
|
|
3156
|
+
for (let n of e($)) {
|
|
3159
3157
|
let r = e(L(n));
|
|
3160
3158
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3161
3159
|
}
|
|
3162
3160
|
return t;
|
|
3163
|
-
})),
|
|
3164
|
-
|
|
3165
|
-
var
|
|
3166
|
-
let { cellIds: t, cellData: n } = e(
|
|
3161
|
+
})), ya = _((e) => Ye(e($).map((t) => e(L(t)))));
|
|
3162
|
+
_((e) => e(_a).length);
|
|
3163
|
+
var ba = x(_((e) => {
|
|
3164
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3167
3165
|
return de.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3168
3166
|
}));
|
|
3169
|
-
|
|
3170
|
-
var
|
|
3171
|
-
let { cellIds: e, cellData: t } = m.get(
|
|
3167
|
+
_((e) => e(Z).scrollKey);
|
|
3168
|
+
var xa = () => le($), Sa = () => le(ba), Ca = () => m.get(Z), wa = () => m.get(Z).cellIds, Ta = () => {
|
|
3169
|
+
let { cellIds: e, cellData: t } = m.get(Z);
|
|
3172
3170
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3173
3171
|
};
|
|
3174
|
-
|
|
3175
|
-
var
|
|
3176
|
-
let t =
|
|
3177
|
-
let n =
|
|
3172
|
+
ee(b(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), _((e) => e(Z).cellIds.length > 0);
|
|
3173
|
+
var Ea = p((e) => _((t) => t(Z).cellData[e])), Da = W(), Oa = p((e) => {
|
|
3174
|
+
let t = _((t) => {
|
|
3175
|
+
let n = Dr(t, e), r = t(y)?.cells;
|
|
3178
3176
|
return {
|
|
3179
|
-
local: t(
|
|
3177
|
+
local: t(Z).cellRuntime[e] ?? Da,
|
|
3180
3178
|
execution: n,
|
|
3181
3179
|
code: n && Dt(n.record, r)
|
|
3182
3180
|
};
|
|
3183
|
-
}), n = b(t,
|
|
3184
|
-
return
|
|
3185
|
-
}),
|
|
3186
|
-
function
|
|
3187
|
-
|
|
3188
|
-
}
|
|
3189
|
-
var
|
|
3190
|
-
let { cellHandles: t } = m.get(
|
|
3181
|
+
}), n = b(t, Or);
|
|
3182
|
+
return _((e) => e(n).rendered);
|
|
3183
|
+
}), ka = p((e) => _((t) => t(Z).cellHandles[e]));
|
|
3184
|
+
function Aa(e) {
|
|
3185
|
+
Ea.remove(e), Oa.remove(e), ka.remove(e), dn(e);
|
|
3186
|
+
}
|
|
3187
|
+
var ja = (e) => {
|
|
3188
|
+
let { cellHandles: t } = m.get(Z);
|
|
3191
3189
|
return t[e].current?.editorView;
|
|
3192
|
-
},
|
|
3193
|
-
|
|
3190
|
+
}, Ma = (e) => (En.promote(e), ja(e));
|
|
3191
|
+
_((e) => e($).map((t) => ({
|
|
3192
|
+
...e(Ea(t)),
|
|
3194
3193
|
...e(Oa(t)),
|
|
3195
|
-
...e($(t)),
|
|
3196
3194
|
output: e(I(t))
|
|
3197
3195
|
})));
|
|
3198
|
-
function
|
|
3199
|
-
return
|
|
3196
|
+
function Na() {
|
|
3197
|
+
return ma();
|
|
3200
3198
|
}
|
|
3201
3199
|
//#endregion
|
|
3202
3200
|
//#region src/core/errors/error-entries.ts
|
|
3203
|
-
function
|
|
3204
|
-
if (
|
|
3201
|
+
function Pa(e) {
|
|
3202
|
+
if (Dn(e.mimetype)) {
|
|
3205
3203
|
if (!Array.isArray(e.data)) return null;
|
|
3206
3204
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
3207
3205
|
return t.length === 0 ? null : { errorData: t };
|
|
3208
3206
|
}
|
|
3209
|
-
return
|
|
3207
|
+
return On(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
3210
3208
|
errorData: [],
|
|
3211
3209
|
tracebackHtml: e.data
|
|
3212
3210
|
} : null;
|
|
3213
3211
|
}
|
|
3214
|
-
function
|
|
3212
|
+
function Fa(e) {
|
|
3215
3213
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3216
3214
|
}
|
|
3217
|
-
function
|
|
3218
|
-
let t = e?.find((e) =>
|
|
3215
|
+
function Ia(e) {
|
|
3216
|
+
let t = e?.find((e) => On(e.mimetype));
|
|
3219
3217
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3220
3218
|
}
|
|
3221
|
-
function
|
|
3219
|
+
function La(e, t) {
|
|
3222
3220
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3223
|
-
if (!
|
|
3221
|
+
if (!Fa(e.errorData)) return Ia(t);
|
|
3224
3222
|
}
|
|
3225
|
-
function
|
|
3226
|
-
let { cellIds: t, cellData: n } = e.get(
|
|
3223
|
+
function Ra(e) {
|
|
3224
|
+
let { cellIds: t, cellData: n } = e.get(Z), r = [];
|
|
3227
3225
|
for (let [i, a] of t.entries()) {
|
|
3228
3226
|
let t = e.get(I(a));
|
|
3229
3227
|
if (t === null || !R(t.mimetype)) continue;
|
|
3230
|
-
let o =
|
|
3228
|
+
let o = Pa(t);
|
|
3231
3229
|
if (!o) continue;
|
|
3232
|
-
let s =
|
|
3230
|
+
let s = xr(n[a].name, i), c = t.code ?? n[a].code;
|
|
3233
3231
|
r.push({
|
|
3234
3232
|
cellId: a,
|
|
3235
3233
|
cellName: s,
|
|
3236
3234
|
cellCode: c,
|
|
3237
3235
|
errorData: o.errorData,
|
|
3238
|
-
tracebackHtml:
|
|
3236
|
+
tracebackHtml: La(o, e.get(Oa(a)).consoleOutputs)
|
|
3239
3237
|
});
|
|
3240
3238
|
}
|
|
3241
3239
|
return r;
|
|
3242
3240
|
}
|
|
3243
|
-
function
|
|
3241
|
+
function za(e) {
|
|
3244
3242
|
return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
|
|
3245
3243
|
}
|
|
3246
|
-
function
|
|
3247
|
-
let t =
|
|
3244
|
+
function Ba(e) {
|
|
3245
|
+
let t = za(e);
|
|
3248
3246
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${U(e.traceback)}`), t;
|
|
3249
3247
|
}
|
|
3250
|
-
function
|
|
3248
|
+
function Va(e) {
|
|
3251
3249
|
let t = [e.cellName];
|
|
3252
|
-
return e.tracebackHtml && t.push(U(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
3250
|
+
return e.tracebackHtml && t.push(U(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Ba).join("\n\n")), t.join("\n\n");
|
|
3253
3251
|
}
|
|
3254
3252
|
//#endregion
|
|
3255
|
-
export {
|
|
3253
|
+
export { Zr as $, D as $t, ia as A, B as At, Fi as B, L as Bt, oa as C, hr as Ct, aa as D, Vn as Dt, ca as E, ir as Et, Bi as F, An as Ft, _i as G, gn as Gt, Oi as H, ln as Ht, Li as I, jn as It, fi as J, _n as Jt, hi as K, pn as Kt, Ri as L, vn as Lt, Ui as M, Fn as Mt, Vi as N, Rn as Nt, X as O, In as Ot, zi as P, Ln as Pt, $r as Q, $e as Qt, Ni as R, F as Rt, Na as S, yr as St, la as T, U as Tt, Ti as U, fn as Ut, Di as V, I as Vt, bi as W, tn as Wt, pi as X, mt as Xt, ri as Y, Vt as Yt, mi as Z, pt as Zt, ya as _, Dr as _t, ha as a, G as at, xa as b, br as bt, Oa as c, Hr as ct, ja as d, Gr as dt, Ze as en, Qr as et, Ta as f, zr as ft, Z as g, kr as gt, da as h, Br as ht, Ra as i, we as in, jr as it, na as j, z as jt, ra as k, zn as kt, pa as l, Wr as lt, Ca as m, Vr as mt, Va as n, Ue as nn, Xr as nt, Ea as o, Ur as ot, wa as p, Nr as pt, gi as q, hn as qt, Ba as r, Te as rn, Yr as rt, $ as s, Mr as st, za as t, Je as tn, K as tt, Ma as u, Kr as ut, fa as v, Er as vt, sa as w, dr as wt, Sa as x, Sr as xt, Aa as y, xr as yt, Pi as z, on as zt };
|