@marimo-team/islands 0.26.1-dev103 → 0.26.1-dev104
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-B5MVsi73.js → ErrorBoundary-DLR6xE2E.js} +1 -1
- package/dist/{chat-ui-BbJTFtyC.js → chat-ui-Bs3rgm2m.js} +3 -3
- package/dist/{code-visibility-DLPZ_eYq.js → code-visibility-BhWW3jkv.js} +2 -2
- package/dist/{common-B2K9WgcL.js → common-i4mVHMGl.js} +3 -3
- package/dist/{data-grid-overlay-editor-1bQ1lRk0.js → data-grid-overlay-editor-7durYJXa.js} +1 -1
- package/dist/{error-entries-DhZotdzQ.js → error-entries-BcAyFIeh.js} +382 -377
- package/dist/{feedback-button-DdJjyfKE.js → feedback-button-CeuzSBrq.js} +3 -3
- package/dist/{glide-data-editor-wPYhuqFs.js → glide-data-editor-BLGr2vQF.js} +3 -3
- package/dist/{globals-DyJvKfkF.js → globals-DorvG5dC.js} +1 -1
- package/dist/{html-to-image-B8erjaaD.js → html-to-image-BmLTjaGw.js} +1 -1
- package/dist/main.js +10 -10
- package/dist/{number-overlay-editor-BPSNY0UK.js → number-overlay-editor-DQAdvZrn.js} +1 -1
- package/dist/{process-output-C-2_O5Ry.js → process-output-CcNpl5Qu.js} +2 -2
- package/dist/{reveal-component-CX1LQkT7.js → reveal-component-B6xeeht1.js} +2 -2
- package/package.json +1 -1
- package/src/core/executions/__tests__/select.test.ts +32 -0
- package/src/core/executions/select.ts +18 -1
|
@@ -850,15 +850,20 @@ function Ut(e, t) {
|
|
|
850
850
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
851
851
|
}
|
|
852
852
|
function Wt(e, t) {
|
|
853
|
-
return Ut(e, t) ? e.requested.has(t) ? !0 :
|
|
853
|
+
return Ut(e, t) ? e.requested.has(t) ? !0 : qt(e.executions.runs, t, Vt(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id) : !1;
|
|
854
854
|
}
|
|
855
|
-
|
|
856
|
-
|
|
855
|
+
var Gt = /* @__PURE__ */ new WeakMap();
|
|
856
|
+
function Kt(e) {
|
|
857
|
+
let t = Gt.get(e);
|
|
858
|
+
return t === void 0 && (t = new Set(e), Gt.set(e, t)), t;
|
|
859
|
+
}
|
|
860
|
+
function qt(e, t, n) {
|
|
861
|
+
for (let r of e.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" && Kt(r.origin.cell_ids).has(t)) return !0;
|
|
857
862
|
return !1;
|
|
858
863
|
}
|
|
859
|
-
function
|
|
864
|
+
function Jt(e, t) {
|
|
860
865
|
let n = Vt(e.executions, t), r = e.results.get(t)?.record ?? null;
|
|
861
|
-
return
|
|
866
|
+
return Yt({
|
|
862
867
|
latest: n?.record ?? null,
|
|
863
868
|
result: r,
|
|
864
869
|
queued: Wt(e, t),
|
|
@@ -867,7 +872,7 @@ function Kt(e, t) {
|
|
|
867
872
|
runtimeId: e.runtimeId
|
|
868
873
|
});
|
|
869
874
|
}
|
|
870
|
-
function
|
|
875
|
+
function Yt({ latest: e, result: t, queued: n, blocked: r, shownBlocked: i, runtimeId: a }) {
|
|
871
876
|
let o = "idle", s = t === null ? null : Bt(t), c = s?.startedAt?.toMilliseconds() ?? null;
|
|
872
877
|
e !== null && e.state.status !== "completed" ? (o = e.state.status, c = Bt(e).startedAt?.toMilliseconds() ?? c) : n && (o = "queued");
|
|
873
878
|
let l = o === "idle", u = l ? s?.duration ?? null : null;
|
|
@@ -881,14 +886,14 @@ function qt({ latest: e, result: t, queued: n, blocked: r, shownBlocked: i, runt
|
|
|
881
886
|
duration: u
|
|
882
887
|
};
|
|
883
888
|
}
|
|
884
|
-
function
|
|
889
|
+
function Xt(e) {
|
|
885
890
|
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
886
891
|
}
|
|
887
|
-
function
|
|
888
|
-
return
|
|
892
|
+
function Zt(e) {
|
|
893
|
+
return Xt(e).some((e) => e.record.state.status === "running");
|
|
889
894
|
}
|
|
890
|
-
function
|
|
891
|
-
let t =
|
|
895
|
+
function Qt(e) {
|
|
896
|
+
let t = Xt(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
892
897
|
for (let t of e.executions.runs.values()) if (t.state.status !== "completed" && t.origin.kind === "cells") for (let e of t.origin.cell_ids) r.add(e);
|
|
893
898
|
let i = 0;
|
|
894
899
|
for (let t of r) !n.has(t) && Wt(e, t) && (i += 1);
|
|
@@ -896,21 +901,21 @@ function Xt(e) {
|
|
|
896
901
|
}
|
|
897
902
|
//#endregion
|
|
898
903
|
//#region src/core/executions/atoms.ts
|
|
899
|
-
var
|
|
904
|
+
var $t = {
|
|
900
905
|
variables: /* @__PURE__ */ new Map(),
|
|
901
906
|
runs: /* @__PURE__ */ new Map(),
|
|
902
907
|
executions: /* @__PURE__ */ new Map(),
|
|
903
908
|
latest: /* @__PURE__ */ new Map(),
|
|
904
909
|
results: /* @__PURE__ */ new Map(),
|
|
905
910
|
scratch: null
|
|
906
|
-
},
|
|
907
|
-
function
|
|
911
|
+
}, en = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), tn = /* @__PURE__ */ new Set(), nn = /* @__PURE__ */ new Set(), rn = /* @__PURE__ */ new Set(), an = /* @__PURE__ */ new Map(), L = _(null);
|
|
912
|
+
function on(e, t) {
|
|
908
913
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
909
914
|
}
|
|
910
|
-
function
|
|
911
|
-
return e !== null &&
|
|
915
|
+
function sn(e, t, n) {
|
|
916
|
+
return e !== null && on(e.notebook, t) ? e.value : n;
|
|
912
917
|
}
|
|
913
|
-
function
|
|
918
|
+
function cn(e) {
|
|
914
919
|
return _((t) => {
|
|
915
920
|
let n = t(p), r = t(e);
|
|
916
921
|
if (n === null || r === null) return null;
|
|
@@ -922,26 +927,26 @@ function on(e) {
|
|
|
922
927
|
};
|
|
923
928
|
});
|
|
924
929
|
}
|
|
925
|
-
var
|
|
926
|
-
function
|
|
927
|
-
return
|
|
930
|
+
var ln = cn(p);
|
|
931
|
+
function un(e, t) {
|
|
932
|
+
return on(t.notebook, e.get(ln));
|
|
928
933
|
}
|
|
929
|
-
function
|
|
930
|
-
let t =
|
|
931
|
-
let n =
|
|
932
|
-
return n.size === 0 ?
|
|
934
|
+
function dn(e) {
|
|
935
|
+
let t = cn(e), n = _((e) => {
|
|
936
|
+
let n = sn(e(L), e(t), tn);
|
|
937
|
+
return n.size === 0 ? nn : new Set([...n].flatMap((e) => e.cells));
|
|
933
938
|
}), r = _((t) => {
|
|
934
|
-
let n = t(e), r = n && t(n.analysisAtom), i = r ? Ht(r.analysis, r.document.cells.values()) :
|
|
939
|
+
let n = t(e), r = n && t(n.analysisAtom), i = r ? Ht(r.analysis, r.document.cells.values()) : rn;
|
|
935
940
|
return {
|
|
936
941
|
shownBlocked: i,
|
|
937
|
-
blocked: r?.freshness === "current" ? i :
|
|
942
|
+
blocked: r?.freshness === "current" ? i : rn
|
|
938
943
|
};
|
|
939
944
|
});
|
|
940
945
|
return _((t) => {
|
|
941
946
|
let i = t(e), a = i === null ? null : t(i.shownDocumentAtom);
|
|
942
947
|
return {
|
|
943
|
-
executions: i === null ?
|
|
944
|
-
results: i === null ?
|
|
948
|
+
executions: i === null ? $t : t(i.executionsAtom),
|
|
949
|
+
results: i === null ? en : t(i.resultsAtom),
|
|
945
950
|
cells: a?.cells ?? I,
|
|
946
951
|
requested: t(n),
|
|
947
952
|
...t(r),
|
|
@@ -949,30 +954,30 @@ function ln(e) {
|
|
|
949
954
|
};
|
|
950
955
|
});
|
|
951
956
|
}
|
|
952
|
-
var
|
|
953
|
-
function
|
|
957
|
+
var fn = dn(p), pn = dn(C);
|
|
958
|
+
function mn(e) {
|
|
954
959
|
let t = y(_((t) => {
|
|
955
960
|
let n = t(e), r = n === null ? null : t(n.shownDocumentAtom);
|
|
956
961
|
return n === null || r === null ? {
|
|
957
962
|
cells: I,
|
|
958
|
-
executions:
|
|
959
|
-
results:
|
|
963
|
+
executions: $t,
|
|
964
|
+
results: en
|
|
960
965
|
} : {
|
|
961
966
|
cells: r.cells,
|
|
962
967
|
executions: t(n.executionsAtom),
|
|
963
968
|
results: t(n.resultsAtom)
|
|
964
969
|
};
|
|
965
|
-
}), (e) => e, (e, t) => e.cells === t.cells && e.executions.variables === t.executions.variables && e.executions.latest === t.executions.latest &&
|
|
970
|
+
}), (e) => e, (e, t) => e.cells === t.cells && e.executions.variables === t.executions.variables && e.executions.latest === t.executions.latest && hn(e.executions.executions, t.executions.executions) && hn(e.results, t.results));
|
|
966
971
|
return _((e) => yt(e(t)));
|
|
967
972
|
}
|
|
968
|
-
function
|
|
973
|
+
function hn(e, t) {
|
|
969
974
|
if (e === t) return !0;
|
|
970
975
|
if (e.size !== t.size) return !1;
|
|
971
976
|
for (let [n, r] of e) if (!t.has(n) || r?.record !== t.get(n)?.record) return !1;
|
|
972
977
|
return !0;
|
|
973
978
|
}
|
|
974
|
-
|
|
975
|
-
var
|
|
979
|
+
mn(p);
|
|
980
|
+
var gn = mn(C), _n = _(null), vn = _((e) => {
|
|
976
981
|
let t = e(p), n = e(C), r = n === null ? null : e(n.shownDocumentAtom);
|
|
977
982
|
return t === null || n === null || r === null ? null : {
|
|
978
983
|
replica: t,
|
|
@@ -982,27 +987,27 @@ var mn = fn(C), hn = _(null), gn = _((e) => {
|
|
|
982
987
|
}), R = _((e) => {
|
|
983
988
|
let t = e(C);
|
|
984
989
|
return {
|
|
985
|
-
executions: t === null ?
|
|
986
|
-
results: t === null ?
|
|
987
|
-
cleared:
|
|
990
|
+
executions: t === null ? $t : e(t.executionsAtom),
|
|
991
|
+
results: t === null ? en : e(t.resultsAtom),
|
|
992
|
+
cleared: sn(e(_n), e(vn), an),
|
|
988
993
|
cells: t === null ? I : e(t.documentAtom)?.cells ?? I
|
|
989
994
|
};
|
|
990
|
-
}),
|
|
995
|
+
}), yn = y(R, (e) => [.../* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()])], de);
|
|
991
996
|
_((e) => {
|
|
992
997
|
let t = /* @__PURE__ */ new Map();
|
|
993
|
-
for (let n of e(
|
|
998
|
+
for (let n of e(yn)) {
|
|
994
999
|
let r = e(z(n));
|
|
995
1000
|
r !== null && t.set(n, r);
|
|
996
1001
|
}
|
|
997
1002
|
return t;
|
|
998
1003
|
});
|
|
999
|
-
function
|
|
1004
|
+
function bn(e, t) {
|
|
1000
1005
|
let n = e.latest.get(t);
|
|
1001
1006
|
return n === void 0 ? void 0 : e.executions.get(n);
|
|
1002
1007
|
}
|
|
1003
|
-
var
|
|
1004
|
-
let t = gt(
|
|
1005
|
-
|
|
1008
|
+
var xn = v((e) => {
|
|
1009
|
+
let t = gt(pn, (t) => [
|
|
1010
|
+
bn(t.executions, e)?.record,
|
|
1006
1011
|
t.results.get(e)?.record,
|
|
1007
1012
|
t.cells.get(e),
|
|
1008
1013
|
t.requested.has(e),
|
|
@@ -1010,18 +1015,18 @@ var yn = v((e) => {
|
|
|
1010
1015
|
t.shownBlocked.has(e),
|
|
1011
1016
|
t.runtimeId,
|
|
1012
1017
|
t.executions.runs
|
|
1013
|
-
], ([t, n, r, i, a, o, s, c]) =>
|
|
1018
|
+
], ([t, n, r, i, a, o, s, c]) => Yt({
|
|
1014
1019
|
latest: t ?? null,
|
|
1015
1020
|
result: n ?? null,
|
|
1016
1021
|
blocked: a,
|
|
1017
1022
|
shownBlocked: o,
|
|
1018
1023
|
runtimeId: s,
|
|
1019
|
-
queued: r !== void 0 && !r.config.disabled && !a && (i ||
|
|
1024
|
+
queued: r !== void 0 && !r.config.disabled && !a && (i || qt(c, e, t?.run_id ?? n?.run_id))
|
|
1020
1025
|
}));
|
|
1021
1026
|
return y(t, (e) => e, m);
|
|
1022
1027
|
}), z = v((e) => {
|
|
1023
1028
|
let t = gt(R, (t) => {
|
|
1024
|
-
let n =
|
|
1029
|
+
let n = bn(t.executions, e);
|
|
1025
1030
|
return [
|
|
1026
1031
|
n?.record,
|
|
1027
1032
|
n?.output,
|
|
@@ -1041,11 +1046,11 @@ y(gt(R, ({ executions: e }) => [e.scratch, e.scratchFailure], ([e, t]) => It({
|
|
|
1041
1046
|
scratch: e,
|
|
1042
1047
|
scratchFailure: t
|
|
1043
1048
|
})), (e) => e, m);
|
|
1044
|
-
var
|
|
1045
|
-
function
|
|
1046
|
-
z.remove(e),
|
|
1049
|
+
var Sn = v((e) => y(gn, (t) => t(e), (e, t) => e.sourceChanged === t.sourceChanged && e.inputsChanged === t.inputsChanged)), Cn = v((e) => _((t) => Ye(t(z(e)))));
|
|
1050
|
+
function wn(e) {
|
|
1051
|
+
z.remove(e), xn.remove(e), Sn.remove(e), Cn.remove(e);
|
|
1047
1052
|
}
|
|
1048
|
-
function
|
|
1053
|
+
function Tn(e, t) {
|
|
1049
1054
|
let n = e.get(R), r = new Map(n.cleared);
|
|
1050
1055
|
for (let e of t) {
|
|
1051
1056
|
let t = Nt(n, e);
|
|
@@ -1054,18 +1059,18 @@ function Cn(e, t) {
|
|
|
1054
1059
|
version: t.outputVersion
|
|
1055
1060
|
});
|
|
1056
1061
|
}
|
|
1057
|
-
let i = e.get(
|
|
1058
|
-
e.set(
|
|
1062
|
+
let i = e.get(vn);
|
|
1063
|
+
e.set(_n, i === null ? null : {
|
|
1059
1064
|
notebook: i,
|
|
1060
1065
|
value: r
|
|
1061
1066
|
});
|
|
1062
1067
|
}
|
|
1063
|
-
var
|
|
1068
|
+
var En = _((e) => {
|
|
1064
1069
|
let t = e(p);
|
|
1065
1070
|
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
1066
1071
|
});
|
|
1067
|
-
_((e) =>
|
|
1068
|
-
var
|
|
1072
|
+
_((e) => Zt(e(fn).executions)), _((e) => Qt(e(fn)));
|
|
1073
|
+
var Dn = _((e) => {
|
|
1069
1074
|
let t = e(p);
|
|
1070
1075
|
if (t === null) return { refused: "No notebook is connected" };
|
|
1071
1076
|
if (e(t.connectionAtom).state === k.CLOSED) return { refused: "The notebook is disconnected" };
|
|
@@ -1081,29 +1086,29 @@ var Tn = _((e) => {
|
|
|
1081
1086
|
default: return "waiting";
|
|
1082
1087
|
}
|
|
1083
1088
|
});
|
|
1084
|
-
function
|
|
1089
|
+
function On(e) {
|
|
1085
1090
|
return new Promise((t, n) => {
|
|
1086
|
-
let r = e.sub(
|
|
1091
|
+
let r = e.sub(Dn, i);
|
|
1087
1092
|
function i() {
|
|
1088
|
-
let i = e.get(
|
|
1093
|
+
let i = e.get(Dn);
|
|
1089
1094
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
1090
1095
|
}
|
|
1091
1096
|
i();
|
|
1092
1097
|
});
|
|
1093
1098
|
}
|
|
1094
|
-
function
|
|
1095
|
-
let n = e.get(
|
|
1099
|
+
function kn(e, t) {
|
|
1100
|
+
let n = e.get(ln);
|
|
1096
1101
|
if (n === null) return null;
|
|
1097
1102
|
let r = {
|
|
1098
1103
|
notebook: n,
|
|
1099
1104
|
cells: [...t]
|
|
1100
|
-
}, i =
|
|
1105
|
+
}, i = sn(e.get(L), n, tn);
|
|
1101
1106
|
return e.set(L, {
|
|
1102
1107
|
notebook: n,
|
|
1103
1108
|
value: new Set(i).add(r)
|
|
1104
1109
|
}), r;
|
|
1105
1110
|
}
|
|
1106
|
-
function
|
|
1111
|
+
function An(e, t) {
|
|
1107
1112
|
let n = e.get(L);
|
|
1108
1113
|
if (n === null || !n.value.has(t)) return;
|
|
1109
1114
|
let r = new Set(n.value);
|
|
@@ -1112,17 +1117,17 @@ function On(e, t) {
|
|
|
1112
1117
|
value: r
|
|
1113
1118
|
});
|
|
1114
1119
|
}
|
|
1115
|
-
function
|
|
1116
|
-
let r = _((e) =>
|
|
1120
|
+
function jn(e, t, n) {
|
|
1121
|
+
let r = _((e) => on(t.notebook, e(ln)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
1117
1122
|
function a() {
|
|
1118
|
-
e.get(r) || (i(),
|
|
1123
|
+
e.get(r) || (i(), An(e, t));
|
|
1119
1124
|
}
|
|
1120
1125
|
a();
|
|
1121
1126
|
}
|
|
1122
1127
|
//#endregion
|
|
1123
1128
|
//#region src/core/state/create-keyed-atom-hook.ts
|
|
1124
|
-
var
|
|
1125
|
-
function
|
|
1129
|
+
var Mn = a();
|
|
1130
|
+
function Nn(e) {
|
|
1126
1131
|
return function(t) {
|
|
1127
1132
|
let n = (0, T.useMemo)(() => e(t), [t]);
|
|
1128
1133
|
return S(n);
|
|
@@ -1130,17 +1135,17 @@ function jn(e) {
|
|
|
1130
1135
|
}
|
|
1131
1136
|
//#endregion
|
|
1132
1137
|
//#region src/core/codemirror/editing/commands.ts
|
|
1133
|
-
function
|
|
1138
|
+
function Pn(e) {
|
|
1134
1139
|
return (t) => {
|
|
1135
1140
|
let n = !1;
|
|
1136
1141
|
for (let r of t) r && (n = e(r) || n);
|
|
1137
1142
|
return n;
|
|
1138
1143
|
};
|
|
1139
1144
|
}
|
|
1140
|
-
var
|
|
1145
|
+
var Fn = Pn(ge), In = Pn(he);
|
|
1141
1146
|
//#endregion
|
|
1142
1147
|
//#region src/utils/schedule-task.ts
|
|
1143
|
-
function
|
|
1148
|
+
function Ln() {
|
|
1144
1149
|
let e = globalThis.scheduler;
|
|
1145
1150
|
if (typeof e?.postTask == "function") return (t) => {
|
|
1146
1151
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -1161,10 +1166,10 @@ function Fn() {
|
|
|
1161
1166
|
setTimeout(e, 0);
|
|
1162
1167
|
};
|
|
1163
1168
|
}
|
|
1164
|
-
var
|
|
1169
|
+
var Rn = Ln();
|
|
1165
1170
|
//#endregion
|
|
1166
1171
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
1167
|
-
function
|
|
1172
|
+
function zn(e = Rn) {
|
|
1168
1173
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
1169
1174
|
function i() {
|
|
1170
1175
|
r || n.size === 0 || (r = !0, e(s));
|
|
@@ -1201,21 +1206,21 @@ function Ln(e = In) {
|
|
|
1201
1206
|
}
|
|
1202
1207
|
};
|
|
1203
1208
|
}
|
|
1204
|
-
var
|
|
1209
|
+
var Bn = zn();
|
|
1205
1210
|
//#endregion
|
|
1206
1211
|
//#region src/core/mime.ts
|
|
1207
|
-
function
|
|
1212
|
+
function Vn(e) {
|
|
1208
1213
|
return e === "application/vnd.marimo+error";
|
|
1209
1214
|
}
|
|
1210
|
-
function
|
|
1215
|
+
function Hn(e) {
|
|
1211
1216
|
return e === "application/vnd.marimo+traceback";
|
|
1212
1217
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return
|
|
1218
|
+
function Un(e) {
|
|
1219
|
+
return Vn(e) || Hn(e);
|
|
1215
1220
|
}
|
|
1216
1221
|
//#endregion
|
|
1217
1222
|
//#region src/core/cells/command-console.ts
|
|
1218
|
-
function
|
|
1223
|
+
function Wn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
1219
1224
|
if (t === "callback-output" && !r && n.length === 0) return { entries: [] };
|
|
1220
1225
|
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) => ({
|
|
1221
1226
|
...e,
|
|
@@ -1226,15 +1231,15 @@ function Hn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1226
1231
|
}
|
|
1227
1232
|
//#endregion
|
|
1228
1233
|
//#region src/core/dom/ui-element-constants.ts
|
|
1229
|
-
var
|
|
1234
|
+
var Gn = "object-id", Kn = "random-id", qn = "abcdefghijklmnopqrstuvwxyz", Jn = qn + qn.toUpperCase(), Yn = /* @__PURE__ */ new Set(), B = "__scratch__", Xn = "setup", Zn = { create() {
|
|
1230
1235
|
let e = 0, t;
|
|
1231
1236
|
do {
|
|
1232
1237
|
let n = "";
|
|
1233
|
-
for (let e = 0; e < 4; e++) n +=
|
|
1238
|
+
for (let e = 0; e < 4; e++) n += Jn[Math.floor(Math.random() * 52)];
|
|
1234
1239
|
t = n, e++;
|
|
1235
|
-
} while (
|
|
1240
|
+
} while (Yn.has(t) && e < 100);
|
|
1236
1241
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1237
|
-
return
|
|
1242
|
+
return Yn.add(t), t;
|
|
1238
1243
|
} }, V = {
|
|
1239
1244
|
create(e) {
|
|
1240
1245
|
return w(e != null, "cellId is required"), `cell-${e}`;
|
|
@@ -1256,21 +1261,21 @@ var Un = "object-id", Wn = "random-id", Gn = "abcdefghijklmnopqrstuvwxyz", Kn =
|
|
|
1256
1261
|
return null;
|
|
1257
1262
|
}
|
|
1258
1263
|
};
|
|
1259
|
-
function
|
|
1264
|
+
function Qn(e) {
|
|
1260
1265
|
let t = null, n = V.findElementThroughShadowDOMs(e);
|
|
1261
1266
|
return n && (t = V.parse(n.id)), t;
|
|
1262
1267
|
}
|
|
1263
|
-
var
|
|
1268
|
+
var $n = {
|
|
1264
1269
|
parse(e) {
|
|
1265
|
-
return e.getAttribute(
|
|
1270
|
+
return e.getAttribute(Gn);
|
|
1266
1271
|
},
|
|
1267
1272
|
parseOrThrow(e) {
|
|
1268
|
-
let t =
|
|
1273
|
+
let t = $n.parse(e);
|
|
1269
1274
|
return w(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1270
1275
|
}
|
|
1271
|
-
},
|
|
1276
|
+
}, er = { create(e) {
|
|
1272
1277
|
return `output-${e}`;
|
|
1273
|
-
} },
|
|
1278
|
+
} }, tr = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, nr = class e {
|
|
1274
1279
|
static get INSTANCE() {
|
|
1275
1280
|
let t = "_marimo_private_VirtualFileTracker";
|
|
1276
1281
|
return window[t] || (window[t] = new e()), window[t];
|
|
@@ -1292,7 +1297,7 @@ var Zn = {
|
|
|
1292
1297
|
switch (t.mimetype) {
|
|
1293
1298
|
case "application/json":
|
|
1294
1299
|
case "text/html": {
|
|
1295
|
-
let r = n.get(e), i =
|
|
1300
|
+
let r = n.get(e), i = rr(t.data);
|
|
1296
1301
|
r?.forEach((e) => i.add(e)), n.set(e, i);
|
|
1297
1302
|
return;
|
|
1298
1303
|
}
|
|
@@ -1308,15 +1313,15 @@ var Zn = {
|
|
|
1308
1313
|
this.virtualFiles.delete(e), this.callbackFiles.delete(e);
|
|
1309
1314
|
}
|
|
1310
1315
|
};
|
|
1311
|
-
function
|
|
1316
|
+
function rr(e) {
|
|
1312
1317
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1313
|
-
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(
|
|
1318
|
+
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(tr);
|
|
1314
1319
|
if (n) for (let e of n) t.add(e);
|
|
1315
1320
|
return t;
|
|
1316
1321
|
}
|
|
1317
1322
|
//#endregion
|
|
1318
1323
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
1319
|
-
var
|
|
1324
|
+
var ir = class e {
|
|
1320
1325
|
lines = [""];
|
|
1321
1326
|
cursor = {
|
|
1322
1327
|
row: 0,
|
|
@@ -1418,7 +1423,7 @@ var nr = class e {
|
|
|
1418
1423
|
render() {
|
|
1419
1424
|
return this.lines.join("\n");
|
|
1420
1425
|
}
|
|
1421
|
-
},
|
|
1426
|
+
}, ar = class {
|
|
1422
1427
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
1423
1428
|
parse(e) {
|
|
1424
1429
|
let t = [], n = 0;
|
|
@@ -1437,13 +1442,13 @@ var nr = class e {
|
|
|
1437
1442
|
value: e.slice(n)
|
|
1438
1443
|
}), t;
|
|
1439
1444
|
}
|
|
1440
|
-
},
|
|
1441
|
-
parser = new
|
|
1445
|
+
}, or = class e {
|
|
1446
|
+
parser = new ar();
|
|
1442
1447
|
buffer;
|
|
1443
1448
|
incompleteEscape = "";
|
|
1444
1449
|
static INCOMPLETE_ESCAPE = new RegExp(String.raw`\u001B(?:\[[0-9;]*|\()?$`, "u");
|
|
1445
1450
|
constructor(e = 0) {
|
|
1446
|
-
this.buffer = new
|
|
1451
|
+
this.buffer = new ir(e);
|
|
1447
1452
|
}
|
|
1448
1453
|
copy(t = 0) {
|
|
1449
1454
|
let n = new e();
|
|
@@ -1467,7 +1472,7 @@ var nr = class e {
|
|
|
1467
1472
|
for (let e of r) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
1468
1473
|
}
|
|
1469
1474
|
reset() {
|
|
1470
|
-
this.buffer = new
|
|
1475
|
+
this.buffer = new ir(), this.incompleteEscape = "";
|
|
1471
1476
|
}
|
|
1472
1477
|
render() {
|
|
1473
1478
|
return this.buffer.render();
|
|
@@ -1511,7 +1516,7 @@ var nr = class e {
|
|
|
1511
1516
|
return n;
|
|
1512
1517
|
}
|
|
1513
1518
|
};
|
|
1514
|
-
function
|
|
1519
|
+
function sr(e) {
|
|
1515
1520
|
let t = 1;
|
|
1516
1521
|
for (let n = 0; n < e.length; n++) {
|
|
1517
1522
|
let r = e.charCodeAt(n);
|
|
@@ -1542,14 +1547,14 @@ var H = class e {
|
|
|
1542
1547
|
}
|
|
1543
1548
|
appendData(t) {
|
|
1544
1549
|
if (!this.terminal) {
|
|
1545
|
-
let n =
|
|
1550
|
+
let n = sr(t);
|
|
1546
1551
|
if (n !== void 0) return new e(this, {
|
|
1547
1552
|
data: this.data + t,
|
|
1548
1553
|
lineCount: this.lineCount + n - 1,
|
|
1549
1554
|
firstPlainRow: this.firstPlainRow
|
|
1550
1555
|
});
|
|
1551
1556
|
}
|
|
1552
|
-
let n = this.terminal?.copy() ?? new
|
|
1557
|
+
let n = this.terminal?.copy() ?? new or(this.firstPlainRow);
|
|
1553
1558
|
this.terminal || n.append(this.data), n.append(t);
|
|
1554
1559
|
let r = n.render();
|
|
1555
1560
|
return new e(this, {
|
|
@@ -1577,19 +1582,19 @@ var H = class e {
|
|
|
1577
1582
|
...this.code === void 0 ? {} : { code: this.code }
|
|
1578
1583
|
};
|
|
1579
1584
|
}
|
|
1580
|
-
},
|
|
1581
|
-
function
|
|
1585
|
+
}, cr = 5e3;
|
|
1586
|
+
function lr(e, t = cr) {
|
|
1582
1587
|
let n = e.slice(0, -1), r = e.at(-1);
|
|
1583
|
-
return r &&
|
|
1588
|
+
return r && dr(n, r), gr(n, t);
|
|
1584
1589
|
}
|
|
1585
|
-
function
|
|
1590
|
+
function ur(e) {
|
|
1586
1591
|
let t = [];
|
|
1587
1592
|
for (let n = 0; n < e.length;) {
|
|
1588
1593
|
let r = e[n], i = n + 1;
|
|
1589
|
-
for (; i < e.length &&
|
|
1590
|
-
if (i === n + 1)
|
|
1594
|
+
for (; i < e.length && fr(r, e[i]);) i++;
|
|
1595
|
+
if (i === n + 1) dr(t, r);
|
|
1591
1596
|
else {
|
|
1592
|
-
let a = e.slice(n, i).map((e) => (
|
|
1597
|
+
let a = e.slice(n, i).map((e) => (hr(e), e.data));
|
|
1593
1598
|
t.push(H.create({
|
|
1594
1599
|
...r,
|
|
1595
1600
|
data: a.join("")
|
|
@@ -1597,28 +1602,28 @@ function cr(e) {
|
|
|
1597
1602
|
}
|
|
1598
1603
|
n = i;
|
|
1599
1604
|
}
|
|
1600
|
-
return
|
|
1605
|
+
return gr(t, cr);
|
|
1601
1606
|
}
|
|
1602
|
-
function
|
|
1607
|
+
function dr(e, t) {
|
|
1603
1608
|
let n = e.at(-1);
|
|
1604
|
-
n &&
|
|
1609
|
+
n && fr(n, t) ? (hr(n), hr(t), e[e.length - 1] = mr(n, t)) : e.push(pr(t));
|
|
1605
1610
|
}
|
|
1606
|
-
function
|
|
1611
|
+
function fr(e, t) {
|
|
1607
1612
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
1608
1613
|
if (!n) return !1;
|
|
1609
1614
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
1610
1615
|
return n && r && i;
|
|
1611
1616
|
}
|
|
1612
|
-
function
|
|
1617
|
+
function pr(e) {
|
|
1613
1618
|
return e instanceof H ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? H.create(e) : e;
|
|
1614
1619
|
}
|
|
1615
|
-
function
|
|
1620
|
+
function mr(e, t) {
|
|
1616
1621
|
return e instanceof H ? e.appendData(t.data) : H.create(e).appendData(t.data);
|
|
1617
1622
|
}
|
|
1618
|
-
function
|
|
1623
|
+
function hr(e) {
|
|
1619
1624
|
w(typeof e.data == "string", "expected string output");
|
|
1620
1625
|
}
|
|
1621
|
-
function
|
|
1626
|
+
function gr(e, t) {
|
|
1622
1627
|
let n = 0, r;
|
|
1623
1628
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1624
1629
|
let t = e[r];
|
|
@@ -1648,18 +1653,18 @@ function mr(e, t) {
|
|
|
1648
1653
|
}
|
|
1649
1654
|
//#endregion
|
|
1650
1655
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1651
|
-
function
|
|
1656
|
+
function _r(e, t) {
|
|
1652
1657
|
return xe(e * 1e3, t?.in);
|
|
1653
1658
|
}
|
|
1654
1659
|
//#endregion
|
|
1655
1660
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1656
|
-
var
|
|
1661
|
+
var vr = function(e, t) {
|
|
1657
1662
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1658
1663
|
}, U;
|
|
1659
1664
|
(function(e) {
|
|
1660
1665
|
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";
|
|
1661
1666
|
})(U ||= {});
|
|
1662
|
-
var
|
|
1667
|
+
var yr = class {
|
|
1663
1668
|
constructor() {
|
|
1664
1669
|
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 = {
|
|
1665
1670
|
http: 1,
|
|
@@ -1904,7 +1909,7 @@ var _r = class {
|
|
|
1904
1909
|
var r = this._buffer.charAt(1);
|
|
1905
1910
|
if (r != "[" && r != "]" && r != "(") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1906
1911
|
if (r == "[") {
|
|
1907
|
-
this._csi_regex ||=
|
|
1912
|
+
this._csi_regex ||= br(Sr ||= vr(["\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 "]));
|
|
1908
1913
|
let t = this._buffer.match(this._csi_regex);
|
|
1909
1914
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1910
1915
|
if (t[4]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
@@ -1915,7 +1920,7 @@ var _r = class {
|
|
|
1915
1920
|
if (r == "]") {
|
|
1916
1921
|
if (t < 4) return e.kind = U.Incomplete, e;
|
|
1917
1922
|
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1918
|
-
this._osc_st ||=
|
|
1923
|
+
this._osc_st ||= xr(Cr ||= vr(["\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;
|
|
1919
1924
|
{
|
|
1920
1925
|
let t = this._osc_st.exec(this._buffer);
|
|
1921
1926
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
@@ -1926,7 +1931,7 @@ var _r = class {
|
|
|
1926
1931
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1927
1932
|
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1928
1933
|
}
|
|
1929
|
-
this._osc_regex ||=
|
|
1934
|
+
this._osc_regex ||= br(wr ||= vr(["\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 "]));
|
|
1930
1935
|
let n = this._buffer.match(this._osc_regex);
|
|
1931
1936
|
if (n === null) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1932
1937
|
e.kind = U.OSCURL, e.url = n[1], e.text = n[2];
|
|
@@ -2011,15 +2016,15 @@ var _r = class {
|
|
|
2011
2016
|
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>`;
|
|
2012
2017
|
}
|
|
2013
2018
|
};
|
|
2014
|
-
function
|
|
2019
|
+
function br(e, ...t) {
|
|
2015
2020
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
2016
2021
|
return new RegExp(n);
|
|
2017
2022
|
}
|
|
2018
|
-
function
|
|
2023
|
+
function xr(e, ...t) {
|
|
2019
2024
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
2020
2025
|
return new RegExp(n, "g");
|
|
2021
2026
|
}
|
|
2022
|
-
var
|
|
2027
|
+
var Sr, Cr, wr, Tr = new yr();
|
|
2023
2028
|
function W(e) {
|
|
2024
2029
|
try {
|
|
2025
2030
|
let t = document.createElement("div");
|
|
@@ -2028,24 +2033,24 @@ function W(e) {
|
|
|
2028
2033
|
return t.error("Error parsing HTML content:", n), e;
|
|
2029
2034
|
}
|
|
2030
2035
|
}
|
|
2031
|
-
function
|
|
2036
|
+
function Er(e) {
|
|
2032
2037
|
if (!e) return "";
|
|
2033
2038
|
try {
|
|
2034
|
-
return W(
|
|
2039
|
+
return W(Tr.ansi_to_html(e));
|
|
2035
2040
|
} catch (n) {
|
|
2036
2041
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
2037
2042
|
}
|
|
2038
2043
|
}
|
|
2039
2044
|
//#endregion
|
|
2040
2045
|
//#region src/core/errors/traceback-atom.ts
|
|
2041
|
-
var
|
|
2046
|
+
var Dr = _(null);
|
|
2042
2047
|
//#endregion
|
|
2043
2048
|
//#region src/core/cells/logs.ts
|
|
2044
|
-
function
|
|
2049
|
+
function Or(e) {
|
|
2045
2050
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
2046
2051
|
}
|
|
2047
|
-
var
|
|
2048
|
-
function
|
|
2052
|
+
var kr = !1;
|
|
2053
|
+
function Ar(e) {
|
|
2049
2054
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
2050
2055
|
for (let r of n) {
|
|
2051
2056
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -2070,9 +2075,9 @@ function Or(e) {
|
|
|
2070
2075
|
}
|
|
2071
2076
|
}
|
|
2072
2077
|
}
|
|
2073
|
-
if (t.forEach(
|
|
2078
|
+
if (t.forEach(jr.log), n.length === 0 && Un(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
2074
2079
|
e.output.data.forEach((t) => {
|
|
2075
|
-
|
|
2080
|
+
jr.log({
|
|
2076
2081
|
level: "stderr",
|
|
2077
2082
|
source: {
|
|
2078
2083
|
type: "cell",
|
|
@@ -2083,8 +2088,8 @@ function Or(e) {
|
|
|
2083
2088
|
});
|
|
2084
2089
|
});
|
|
2085
2090
|
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = h.get(ve) === "read";
|
|
2086
|
-
if (t.length > 0 && !
|
|
2087
|
-
|
|
2091
|
+
if (t.length > 0 && !kr && n) {
|
|
2092
|
+
kr = !0;
|
|
2088
2093
|
let e = t.find((e) => e.traceback);
|
|
2089
2094
|
o(e ? {
|
|
2090
2095
|
title: "An internal error occurred",
|
|
@@ -2093,7 +2098,7 @@ function Or(e) {
|
|
|
2093
2098
|
action: T.createElement(ce, {
|
|
2094
2099
|
altText: "View traceback",
|
|
2095
2100
|
onClick: () => {
|
|
2096
|
-
h.set(
|
|
2101
|
+
h.set(Dr, {
|
|
2097
2102
|
traceback: e.traceback,
|
|
2098
2103
|
errorMessage: e.msg || "An internal error occurred"
|
|
2099
2104
|
});
|
|
@@ -2108,13 +2113,13 @@ function Or(e) {
|
|
|
2108
2113
|
}
|
|
2109
2114
|
return t;
|
|
2110
2115
|
}
|
|
2111
|
-
var
|
|
2116
|
+
var jr = { log: (e) => {
|
|
2112
2117
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
2113
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
2118
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Mr(e.timestamp)}]`, `(${Or(e.source)}) ${e.message}`);
|
|
2114
2119
|
} };
|
|
2115
|
-
function
|
|
2120
|
+
function Mr(e) {
|
|
2116
2121
|
try {
|
|
2117
|
-
return
|
|
2122
|
+
return _r(e).toLocaleTimeString(void 0, {
|
|
2118
2123
|
hour12: !0,
|
|
2119
2124
|
hour: "numeric",
|
|
2120
2125
|
minute: "numeric",
|
|
@@ -2124,26 +2129,26 @@ function Ar(e) {
|
|
|
2124
2129
|
return "";
|
|
2125
2130
|
}
|
|
2126
2131
|
}
|
|
2127
|
-
var
|
|
2128
|
-
function
|
|
2132
|
+
var Nr = /* @__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("."));
|
|
2133
|
+
function Pr(e, t = !0) {
|
|
2129
2134
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
2130
2135
|
}
|
|
2131
|
-
function
|
|
2132
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
2136
|
+
function Fr(e, t) {
|
|
2137
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !Nr.has(e);
|
|
2133
2138
|
if (i(e)) return e;
|
|
2134
2139
|
let a = 1;
|
|
2135
2140
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
2136
2141
|
return r;
|
|
2137
2142
|
}
|
|
2138
|
-
function
|
|
2139
|
-
return
|
|
2143
|
+
function Ir(e, t) {
|
|
2144
|
+
return Lr(e) ? `cell-${t}` : e;
|
|
2140
2145
|
}
|
|
2141
|
-
function
|
|
2146
|
+
function Lr(e) {
|
|
2142
2147
|
return !e || e === "_" || e === "__";
|
|
2143
2148
|
}
|
|
2144
2149
|
//#endregion
|
|
2145
2150
|
//#region src/core/cells/types.ts
|
|
2146
|
-
function
|
|
2151
|
+
function Rr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
2147
2152
|
return {
|
|
2148
2153
|
id: e,
|
|
2149
2154
|
config: r || {
|
|
@@ -2156,7 +2161,7 @@ function Ir({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
2156
2161
|
code: n
|
|
2157
2162
|
};
|
|
2158
2163
|
}
|
|
2159
|
-
function
|
|
2164
|
+
function zr(e) {
|
|
2160
2165
|
return {
|
|
2161
2166
|
hide_code: !1,
|
|
2162
2167
|
disabled: !1,
|
|
@@ -2165,7 +2170,7 @@ function Lr(e) {
|
|
|
2165
2170
|
...e
|
|
2166
2171
|
};
|
|
2167
2172
|
}
|
|
2168
|
-
function
|
|
2173
|
+
function Br(e) {
|
|
2169
2174
|
return {
|
|
2170
2175
|
embeddedConsole: [],
|
|
2171
2176
|
...e
|
|
@@ -2173,7 +2178,7 @@ function Rr(e) {
|
|
|
2173
2178
|
}
|
|
2174
2179
|
//#endregion
|
|
2175
2180
|
//#region src/core/cells/execution-console.ts
|
|
2176
|
-
function
|
|
2181
|
+
function Vr(e, t, n) {
|
|
2177
2182
|
let r = e.time === void 0 ? t : Date.parse(e.time) / 1e3, i = e.seq + 1;
|
|
2178
2183
|
switch (e.kind) {
|
|
2179
2184
|
case "console":
|
|
@@ -2204,46 +2209,46 @@ function zr(e, t, n) {
|
|
|
2204
2209
|
};
|
|
2205
2210
|
}
|
|
2206
2211
|
}
|
|
2207
|
-
function
|
|
2212
|
+
function Hr(e, t) {
|
|
2208
2213
|
return {
|
|
2209
2214
|
onOutput(e, t) {
|
|
2210
|
-
|
|
2215
|
+
nr.INSTANCE.trackOutput(e, t);
|
|
2211
2216
|
},
|
|
2212
2217
|
onExecution(n, r) {
|
|
2213
2218
|
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
2214
2219
|
},
|
|
2215
2220
|
onItem(t, n, r) {
|
|
2216
|
-
let i = t.cell_id ?? "__scratch__", a = j(t), o =
|
|
2217
|
-
o.channel === "media" &&
|
|
2221
|
+
let i = t.cell_id ?? "__scratch__", a = j(t), o = Vr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2222
|
+
o.channel === "media" && nr.INSTANCE.track({
|
|
2218
2223
|
cell_id: i,
|
|
2219
2224
|
output: o
|
|
2220
|
-
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs:
|
|
2225
|
+
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs: Ar({
|
|
2221
2226
|
cell_id: i,
|
|
2222
2227
|
console: o
|
|
2223
2228
|
}) });
|
|
2224
2229
|
}
|
|
2225
2230
|
};
|
|
2226
2231
|
}
|
|
2227
|
-
function
|
|
2232
|
+
function Ur(e, t, n = e(p)) {
|
|
2228
2233
|
if (!n) return;
|
|
2229
2234
|
let r = e(n.executionsAtom);
|
|
2230
2235
|
if (t === "__scratch__") return r.scratchConsole;
|
|
2231
2236
|
let i = r.latest.get(t);
|
|
2232
2237
|
return i === void 0 ? void 0 : r.executions.get(i);
|
|
2233
2238
|
}
|
|
2234
|
-
function
|
|
2239
|
+
function Wr(e, t) {
|
|
2235
2240
|
let { local: n, execution: r, code: i } = e;
|
|
2236
2241
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2237
2242
|
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && j(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2238
2243
|
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;
|
|
2239
|
-
let t =
|
|
2244
|
+
let t = Vr(e, l, i);
|
|
2240
2245
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
2241
2246
|
}, d = n.commandConsole?.entries, f = r?.append;
|
|
2242
2247
|
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))) {
|
|
2243
2248
|
let n = u(f.item), r = t.rendered.consoleOutputs;
|
|
2244
2249
|
return {
|
|
2245
2250
|
...e,
|
|
2246
|
-
rendered: { consoleOutputs: n ?
|
|
2251
|
+
rendered: { consoleOutputs: n ? lr([...r, n]) : r }
|
|
2247
2252
|
};
|
|
2248
2253
|
}
|
|
2249
2254
|
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : rt(r).flatMap((e) => u(e) ?? []);
|
|
@@ -2256,12 +2261,12 @@ function Hr(e, t) {
|
|
|
2256
2261
|
}
|
|
2257
2262
|
return {
|
|
2258
2263
|
...e,
|
|
2259
|
-
rendered: { consoleOutputs:
|
|
2264
|
+
rendered: { consoleOutputs: ur(p) }
|
|
2260
2265
|
};
|
|
2261
2266
|
}
|
|
2262
2267
|
//#endregion
|
|
2263
2268
|
//#region src/core/cells/columns.ts
|
|
2264
|
-
function
|
|
2269
|
+
function Gr(e) {
|
|
2265
2270
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
2266
2271
|
for (let r of e.order) {
|
|
2267
2272
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -2269,9 +2274,9 @@ function Ur(e) {
|
|
|
2269
2274
|
}
|
|
2270
2275
|
return t;
|
|
2271
2276
|
}
|
|
2272
|
-
function
|
|
2277
|
+
function Kr(e) {
|
|
2273
2278
|
let t = [[]];
|
|
2274
|
-
for (let [n, r] of
|
|
2279
|
+
for (let [n, r] of Gr(e)) {
|
|
2275
2280
|
for (; t.length <= r;) t.push([]);
|
|
2276
2281
|
t[r].push(n);
|
|
2277
2282
|
}
|
|
@@ -2279,21 +2284,21 @@ function Wr(e) {
|
|
|
2279
2284
|
}
|
|
2280
2285
|
//#endregion
|
|
2281
2286
|
//#region src/core/cells/layout.ts
|
|
2282
|
-
var
|
|
2283
|
-
function
|
|
2284
|
-
return `column-${
|
|
2287
|
+
var qr = _(/* @__PURE__ */ new Set()), Jr = _([]), Yr = _([]);
|
|
2288
|
+
function Xr() {
|
|
2289
|
+
return `column-${Zn.create()}`;
|
|
2285
2290
|
}
|
|
2286
|
-
var
|
|
2287
|
-
let r =
|
|
2291
|
+
var Zr = _(null, (e, t, n) => {
|
|
2292
|
+
let r = Kr(n).length, i = e(Jr);
|
|
2288
2293
|
if (i.length === r) return;
|
|
2289
|
-
let a = e(
|
|
2290
|
-
for (; o.length < r;) o.push(
|
|
2291
|
-
t(
|
|
2292
|
-
}),
|
|
2294
|
+
let a = e(Yr), o = [...i, ...a].slice(0, r);
|
|
2295
|
+
for (; o.length < r;) o.push(Xr());
|
|
2296
|
+
t(Jr, o), t(Yr, a.slice(Math.max(0, r - i.length)));
|
|
2297
|
+
}), Qr = y(_((e) => {
|
|
2293
2298
|
let t = e(g);
|
|
2294
2299
|
return t === null ? null : e(t.documentAtom);
|
|
2295
|
-
}), (e) => e === null ? [[]] :
|
|
2296
|
-
let t = e(
|
|
2300
|
+
}), (e) => e === null ? [[]] : Kr(e), m), $r = _((e) => {
|
|
2301
|
+
let t = e(Qr), n = e(Jr), r = e(Yr);
|
|
2297
2302
|
return [...t.map((e, t) => ({
|
|
2298
2303
|
id: n[t] ?? `column-${t}`,
|
|
2299
2304
|
ids: e
|
|
@@ -2302,7 +2307,7 @@ var Yr = _(null, (e, t, n) => {
|
|
|
2302
2307
|
ids: []
|
|
2303
2308
|
}))];
|
|
2304
2309
|
});
|
|
2305
|
-
function
|
|
2310
|
+
function ei(e, t, n) {
|
|
2306
2311
|
let r = /* @__PURE__ */ new Map();
|
|
2307
2312
|
return e.forEach((i, a) => {
|
|
2308
2313
|
let o = t[a];
|
|
@@ -2311,9 +2316,9 @@ function Qr(e, t, n) {
|
|
|
2311
2316
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2312
2317
|
}), r;
|
|
2313
2318
|
}
|
|
2314
|
-
function
|
|
2319
|
+
function ti(e, t, n) {
|
|
2315
2320
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
2316
|
-
let i =
|
|
2321
|
+
let i = ei(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
2317
2322
|
return {
|
|
2318
2323
|
id: e,
|
|
2319
2324
|
ids: r,
|
|
@@ -2322,36 +2327,36 @@ function $r(e, t, n) {
|
|
|
2322
2327
|
};
|
|
2323
2328
|
}) };
|
|
2324
2329
|
}
|
|
2325
|
-
var
|
|
2326
|
-
let t = e(
|
|
2327
|
-
return
|
|
2328
|
-
}),
|
|
2329
|
-
function
|
|
2330
|
+
var ni = _((e) => {
|
|
2331
|
+
let t = e(Ia);
|
|
2332
|
+
return ti(e($r), (e) => t[e] ?? null, e(qr));
|
|
2333
|
+
}), ri = () => S(ni), ii = _((e) => e(ni).columns.length);
|
|
2334
|
+
function ai(e, t) {
|
|
2330
2335
|
return e.columns.find((e) => e.id === t);
|
|
2331
2336
|
}
|
|
2332
|
-
function
|
|
2337
|
+
function oi(e, t) {
|
|
2333
2338
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2334
2339
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
2335
2340
|
return n;
|
|
2336
2341
|
}
|
|
2337
|
-
function
|
|
2342
|
+
function si(e, t) {
|
|
2338
2343
|
for (let n of e.columns) {
|
|
2339
2344
|
let e = n.folds.get(t);
|
|
2340
2345
|
if (e !== void 0) return e;
|
|
2341
2346
|
}
|
|
2342
2347
|
}
|
|
2343
|
-
function
|
|
2348
|
+
function ci(e, t) {
|
|
2344
2349
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2345
2350
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
2346
2351
|
}
|
|
2347
|
-
function
|
|
2348
|
-
let n =
|
|
2349
|
-
return
|
|
2352
|
+
function li(e, t) {
|
|
2353
|
+
let n = ci(e, t);
|
|
2354
|
+
return si(e, t) === void 0 ? n : [...n, t];
|
|
2350
2355
|
}
|
|
2351
2356
|
//#endregion
|
|
2352
2357
|
//#region src/core/cells/document.ts
|
|
2353
|
-
function
|
|
2354
|
-
let n = t.code ?? e.code, r = m(e.config, t.config) ? e.config :
|
|
2358
|
+
function ui(e, t) {
|
|
2359
|
+
let n = t.code ?? e.code, r = m(e.config, t.config) ? e.config : zr(t.config);
|
|
2355
2360
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
2356
2361
|
...e,
|
|
2357
2362
|
name: t.name,
|
|
@@ -2363,7 +2368,7 @@ function ci(e, t) {
|
|
|
2363
2368
|
config: r
|
|
2364
2369
|
};
|
|
2365
2370
|
}
|
|
2366
|
-
function
|
|
2371
|
+
function di(e, t) {
|
|
2367
2372
|
let n = m(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
2368
2373
|
for (let o of n) {
|
|
2369
2374
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
@@ -2371,22 +2376,22 @@ function li(e, t) {
|
|
|
2371
2376
|
if (s === void 0) {
|
|
2372
2377
|
r = {
|
|
2373
2378
|
...r,
|
|
2374
|
-
[o]:
|
|
2379
|
+
[o]: Rr({
|
|
2375
2380
|
id: o,
|
|
2376
2381
|
code: n.code ?? "",
|
|
2377
2382
|
name: n.name,
|
|
2378
|
-
config:
|
|
2383
|
+
config: zr(n.config)
|
|
2379
2384
|
})
|
|
2380
2385
|
}, i = {
|
|
2381
2386
|
...i,
|
|
2382
|
-
[o]: i[o] ??
|
|
2387
|
+
[o]: i[o] ?? Br()
|
|
2383
2388
|
}, a = {
|
|
2384
2389
|
...a,
|
|
2385
2390
|
[o]: (0, T.createRef)()
|
|
2386
2391
|
};
|
|
2387
2392
|
continue;
|
|
2388
2393
|
}
|
|
2389
|
-
let c =
|
|
2394
|
+
let c = ui(s, n);
|
|
2390
2395
|
c !== s && (r = {
|
|
2391
2396
|
...r,
|
|
2392
2397
|
[o]: c
|
|
@@ -2405,21 +2410,21 @@ function li(e, t) {
|
|
|
2405
2410
|
cellHandles: a
|
|
2406
2411
|
};
|
|
2407
2412
|
}
|
|
2408
|
-
function
|
|
2413
|
+
function fi({ store: e, model: t, reconcile: n, signal: r }) {
|
|
2409
2414
|
let i = () => {
|
|
2410
2415
|
let r = e.get(t.documentAtom);
|
|
2411
|
-
r !== null && (n(r), e.set(
|
|
2416
|
+
r !== null && (n(r), e.set(Zr, r));
|
|
2412
2417
|
}, a = e.sub(t.documentAtom, i);
|
|
2413
2418
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
2414
2419
|
}
|
|
2415
|
-
async function
|
|
2420
|
+
async function pi() {
|
|
2416
2421
|
let e = h.get(g);
|
|
2417
2422
|
e !== null && h.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
2418
2423
|
}
|
|
2419
2424
|
//#endregion
|
|
2420
2425
|
//#region src/core/cells/editor.ts
|
|
2421
2426
|
var G = _(/* @__PURE__ */ new Set());
|
|
2422
|
-
function
|
|
2427
|
+
function mi(e, t, n) {
|
|
2423
2428
|
return !!e && !t.has(n);
|
|
2424
2429
|
}
|
|
2425
2430
|
_(null, (e, t, { cellId: n }) => {
|
|
@@ -2428,16 +2433,16 @@ _(null, (e, t, { cellId: n }) => {
|
|
|
2428
2433
|
let t = new Set(e);
|
|
2429
2434
|
return t.delete(n), t;
|
|
2430
2435
|
}), !0) : !1);
|
|
2431
|
-
var
|
|
2436
|
+
var hi = _(/* @__PURE__ */ new Map());
|
|
2432
2437
|
_(null, (e, t, { cellId: n }) => {
|
|
2433
|
-
t(
|
|
2438
|
+
t(hi, (e) => {
|
|
2434
2439
|
let t = new Map(e);
|
|
2435
2440
|
return t.delete(n), t;
|
|
2436
2441
|
});
|
|
2437
2442
|
});
|
|
2438
2443
|
//#endregion
|
|
2439
2444
|
//#region src/utils/timeout.ts
|
|
2440
|
-
function
|
|
2445
|
+
function gi(e, n) {
|
|
2441
2446
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
2442
2447
|
if (o < r) {
|
|
2443
2448
|
try {
|
|
@@ -2452,20 +2457,20 @@ function mi(e, n) {
|
|
|
2452
2457
|
}
|
|
2453
2458
|
//#endregion
|
|
2454
2459
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2455
|
-
function
|
|
2456
|
-
|
|
2460
|
+
function _i(e) {
|
|
2461
|
+
gi(() => (e.focus(), e.hasFocus), {
|
|
2457
2462
|
retries: 5,
|
|
2458
2463
|
delay: 20
|
|
2459
2464
|
});
|
|
2460
2465
|
}
|
|
2461
|
-
function
|
|
2466
|
+
function vi(e, n) {
|
|
2462
2467
|
let r = document.getElementById(V.create(e));
|
|
2463
|
-
r ?
|
|
2468
|
+
r ? bi(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2464
2469
|
}
|
|
2465
|
-
function
|
|
2470
|
+
function yi() {
|
|
2466
2471
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2467
2472
|
}
|
|
2468
|
-
function
|
|
2473
|
+
function bi(e, n) {
|
|
2469
2474
|
try {
|
|
2470
2475
|
e.focus(n);
|
|
2471
2476
|
} catch {
|
|
@@ -2474,18 +2479,18 @@ function vi(e, n) {
|
|
|
2474
2479
|
}
|
|
2475
2480
|
//#endregion
|
|
2476
2481
|
//#region src/core/network/requests.ts
|
|
2477
|
-
var
|
|
2478
|
-
function
|
|
2479
|
-
let e = S(
|
|
2482
|
+
var xi = _(null);
|
|
2483
|
+
function Si() {
|
|
2484
|
+
let e = S(xi);
|
|
2480
2485
|
return w(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2481
2486
|
}
|
|
2482
|
-
function
|
|
2483
|
-
let e = h.get(
|
|
2487
|
+
function Ci() {
|
|
2488
|
+
let e = h.get(xi);
|
|
2484
2489
|
return w(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2485
2490
|
}
|
|
2486
2491
|
//#endregion
|
|
2487
2492
|
//#region src/utils/storage/storage.ts
|
|
2488
|
-
var
|
|
2493
|
+
var wi = class {
|
|
2489
2494
|
store = /* @__PURE__ */ new Map();
|
|
2490
2495
|
get length() {
|
|
2491
2496
|
return this.store.size;
|
|
@@ -2506,16 +2511,16 @@ var Si = class {
|
|
|
2506
2511
|
this.store.set(e, t);
|
|
2507
2512
|
}
|
|
2508
2513
|
};
|
|
2509
|
-
function
|
|
2514
|
+
function Ti() {
|
|
2510
2515
|
let { hasLocalStorage: e, hasSessionStorage: t } = Se();
|
|
2511
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2516
|
+
return e ? window.localStorage : t ? window.sessionStorage : new wi();
|
|
2512
2517
|
}
|
|
2513
|
-
var
|
|
2514
|
-
function
|
|
2515
|
-
return
|
|
2518
|
+
var Ei = Ti(), Di = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Oi = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, ki = /^data:image\//i, Ai = ["avatars.githubusercontent.com"];
|
|
2519
|
+
function ji(e) {
|
|
2520
|
+
return ki.test(e) ? [{
|
|
2516
2521
|
type: "image",
|
|
2517
2522
|
url: e
|
|
2518
|
-
}] : e.split(
|
|
2523
|
+
}] : e.split(Di).filter((e) => e !== "").map((e) => Di.test(e) ? Oi.test(e) || ki.test(e) || Ai.some((t) => e.includes(t)) ? {
|
|
2519
2524
|
type: "image",
|
|
2520
2525
|
url: e
|
|
2521
2526
|
} : {
|
|
@@ -2528,48 +2533,48 @@ function ki(e) {
|
|
|
2528
2533
|
}
|
|
2529
2534
|
//#endregion
|
|
2530
2535
|
//#region src/utils/json/json-parser.ts
|
|
2531
|
-
var
|
|
2536
|
+
var Mi = new RegExp(Di.source, "g");
|
|
2532
2537
|
BigInt.prototype.toJSON = function() {
|
|
2533
2538
|
return JSON.rawJSON(this.toString());
|
|
2534
2539
|
};
|
|
2535
|
-
function
|
|
2540
|
+
function Ni(e) {
|
|
2536
2541
|
try {
|
|
2537
|
-
return JSON.parse(e, (e, t) =>
|
|
2542
|
+
return JSON.parse(e, (e, t) => Li(t));
|
|
2538
2543
|
} catch {}
|
|
2539
2544
|
if (e == null || e === "") return {};
|
|
2540
2545
|
try {
|
|
2541
|
-
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 :
|
|
2546
|
+
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 : Li(t) : Li(t));
|
|
2542
2547
|
} catch {
|
|
2543
2548
|
return {};
|
|
2544
2549
|
}
|
|
2545
2550
|
}
|
|
2546
|
-
function
|
|
2551
|
+
function Pi(e) {
|
|
2547
2552
|
if (e.length === 0) return "";
|
|
2548
2553
|
let t = Object.keys(e[0]);
|
|
2549
2554
|
return [
|
|
2550
2555
|
`| ${t.join(" | ")} |`,
|
|
2551
2556
|
`|${t.map(() => "---").join("|")}|`,
|
|
2552
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2557
|
+
...e.map((e) => `| ${t.map((t) => Fi(e[t])).join(" | ")} |`)
|
|
2553
2558
|
].join("\n");
|
|
2554
2559
|
}
|
|
2555
|
-
function
|
|
2560
|
+
function Fi(e) {
|
|
2556
2561
|
if (e == null) return "";
|
|
2557
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2562
|
+
if (Array.isArray(e) || typeof e == "object") return Ii(JSON.stringify(e));
|
|
2558
2563
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2559
2564
|
t = t.replaceAll(n, (e) => {
|
|
2560
2565
|
let t = `__MDLINK_${i++}__`;
|
|
2561
2566
|
return r.set(t, e), t;
|
|
2562
|
-
}), t = t.replaceAll(
|
|
2567
|
+
}), t = t.replaceAll(Mi, "[$1]($1)");
|
|
2563
2568
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2564
|
-
return
|
|
2569
|
+
return Ii(t);
|
|
2565
2570
|
}
|
|
2566
|
-
function
|
|
2571
|
+
function Ii(e) {
|
|
2567
2572
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2568
2573
|
}
|
|
2569
|
-
function
|
|
2574
|
+
function Li(e) {
|
|
2570
2575
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2571
2576
|
}
|
|
2572
|
-
var
|
|
2577
|
+
var Ri = new class {
|
|
2573
2578
|
getFilename() {
|
|
2574
2579
|
return this.getSearchParam("filename");
|
|
2575
2580
|
}
|
|
@@ -2596,20 +2601,20 @@ var Ii = new class {
|
|
|
2596
2601
|
}();
|
|
2597
2602
|
//#endregion
|
|
2598
2603
|
//#region src/core/dom/htmlUtils.ts
|
|
2599
|
-
function
|
|
2600
|
-
return
|
|
2604
|
+
function zi(e) {
|
|
2605
|
+
return Ni(e ?? "");
|
|
2601
2606
|
}
|
|
2602
|
-
function
|
|
2603
|
-
return le.mapValues(e.dataset, (e) => typeof e == "string" ?
|
|
2607
|
+
function Bi(e) {
|
|
2608
|
+
return le.mapValues(e.dataset, (e) => typeof e == "string" ? zi(e) : e);
|
|
2604
2609
|
}
|
|
2605
|
-
function
|
|
2606
|
-
let n = e.parentElement ?
|
|
2607
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2610
|
+
function Vi(e, t) {
|
|
2611
|
+
let n = e.parentElement ? $n.parse(e.parentElement) : void 0;
|
|
2612
|
+
return n && t.has(n) ? t.lookupValue(n) : zi(e.dataset.initialValue);
|
|
2608
2613
|
}
|
|
2609
|
-
function
|
|
2614
|
+
function Hi() {
|
|
2610
2615
|
if (re()) return document.title || null;
|
|
2611
2616
|
if (be()) {
|
|
2612
|
-
let e =
|
|
2617
|
+
let e = Ri.getFilename();
|
|
2613
2618
|
if (e) return e;
|
|
2614
2619
|
}
|
|
2615
2620
|
let e = document.querySelector("marimo-filename");
|
|
@@ -2619,16 +2624,16 @@ function Bi() {
|
|
|
2619
2624
|
}
|
|
2620
2625
|
//#endregion
|
|
2621
2626
|
//#region src/core/saving/file-state.ts
|
|
2622
|
-
var
|
|
2627
|
+
var Ui = _(Hi());
|
|
2623
2628
|
_(null);
|
|
2624
|
-
var
|
|
2629
|
+
var Wi = _(null);
|
|
2625
2630
|
_(void 0);
|
|
2626
2631
|
//#endregion
|
|
2627
2632
|
//#region src/utils/storage/typed.ts
|
|
2628
|
-
var
|
|
2633
|
+
var Gi = class {
|
|
2629
2634
|
defaultValue;
|
|
2630
2635
|
storage;
|
|
2631
|
-
constructor(e, t =
|
|
2636
|
+
constructor(e, t = Ei) {
|
|
2632
2637
|
this.defaultValue = e, this.storage = t;
|
|
2633
2638
|
}
|
|
2634
2639
|
get(e) {
|
|
@@ -2645,11 +2650,11 @@ var Ui = class {
|
|
|
2645
2650
|
remove(e) {
|
|
2646
2651
|
this.storage.removeItem(e);
|
|
2647
2652
|
}
|
|
2648
|
-
},
|
|
2653
|
+
}, Ki = class {
|
|
2649
2654
|
schema;
|
|
2650
2655
|
getDefaultValue;
|
|
2651
2656
|
storage;
|
|
2652
|
-
constructor(e, t, n =
|
|
2657
|
+
constructor(e, t, n = Ei) {
|
|
2653
2658
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2654
2659
|
}
|
|
2655
2660
|
get(e) {
|
|
@@ -2668,15 +2673,15 @@ var Ui = class {
|
|
|
2668
2673
|
remove(e) {
|
|
2669
2674
|
this.storage.removeItem(e);
|
|
2670
2675
|
}
|
|
2671
|
-
},
|
|
2676
|
+
}, qi = class extends Ki {
|
|
2672
2677
|
filename;
|
|
2673
2678
|
unsubscribeFromFilename;
|
|
2674
2679
|
constructor(e, t, n) {
|
|
2675
|
-
let r = h.get(
|
|
2680
|
+
let r = h.get(Ui);
|
|
2676
2681
|
super(t, n), this.filename = r;
|
|
2677
2682
|
try {
|
|
2678
|
-
this.unsubscribeFromFilename = h.sub(
|
|
2679
|
-
let t = h.get(
|
|
2683
|
+
this.unsubscribeFromFilename = h.sub(Ui, () => {
|
|
2684
|
+
let t = h.get(Ui);
|
|
2680
2685
|
this.handleFilenameChange(e, t);
|
|
2681
2686
|
});
|
|
2682
2687
|
} catch {
|
|
@@ -2734,7 +2739,7 @@ var Ui = class {
|
|
|
2734
2739
|
In: "in",
|
|
2735
2740
|
As: "as",
|
|
2736
2741
|
Import: "import"
|
|
2737
|
-
},
|
|
2742
|
+
}, Ji = /* @__PURE__ */ new Set([
|
|
2738
2743
|
K.FunctionDefinition,
|
|
2739
2744
|
K.LambdaExpression,
|
|
2740
2745
|
K.ArrayComprehensionExpression,
|
|
@@ -2746,13 +2751,13 @@ var Ui = class {
|
|
|
2746
2751
|
K.Comment, K.String, K.FormatString;
|
|
2747
2752
|
//#endregion
|
|
2748
2753
|
//#region src/core/codemirror/utils.ts
|
|
2749
|
-
function
|
|
2754
|
+
function Yi(e) {
|
|
2750
2755
|
e && e.dispatch({ selection: {
|
|
2751
2756
|
anchor: e.state.doc.length,
|
|
2752
2757
|
head: e.state.doc.length
|
|
2753
2758
|
} });
|
|
2754
2759
|
}
|
|
2755
|
-
function
|
|
2760
|
+
function Xi(e) {
|
|
2756
2761
|
requestAnimationFrame(() => {
|
|
2757
2762
|
e.dom.closest(".marimo-cell")?.scrollIntoView({
|
|
2758
2763
|
behavior: "instant",
|
|
@@ -2763,8 +2768,8 @@ function Ji(e) {
|
|
|
2763
2768
|
}
|
|
2764
2769
|
//#endregion
|
|
2765
2770
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2766
|
-
var
|
|
2767
|
-
function
|
|
2771
|
+
var Zi = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
2772
|
+
function Qi(e, t) {
|
|
2768
2773
|
requestAnimationFrame(() => {
|
|
2769
2774
|
e.focus(), e.dispatch({
|
|
2770
2775
|
selection: {
|
|
@@ -2773,9 +2778,9 @@ function Xi(e, t) {
|
|
|
2773
2778
|
},
|
|
2774
2779
|
effects: pe.scrollIntoView(t, { y: "center" })
|
|
2775
2780
|
});
|
|
2776
|
-
}),
|
|
2781
|
+
}), Xi(e);
|
|
2777
2782
|
}
|
|
2778
|
-
function
|
|
2783
|
+
function $i(e, t) {
|
|
2779
2784
|
let n = me(e), r = null;
|
|
2780
2785
|
return n.iterate({ enter: (n) => {
|
|
2781
2786
|
if (r !== null) return !1;
|
|
@@ -2783,9 +2788,9 @@ function Zi(e, t) {
|
|
|
2783
2788
|
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
2784
2789
|
} }), r;
|
|
2785
2790
|
}
|
|
2786
|
-
function
|
|
2791
|
+
function ea(e, t) {
|
|
2787
2792
|
let n = [], r = e.resolveInner(t, 0);
|
|
2788
|
-
for (; r;)
|
|
2793
|
+
for (; r;) Ji.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
2789
2794
|
id: r.from,
|
|
2790
2795
|
type: r.name
|
|
2791
2796
|
})), r = r.parent;
|
|
@@ -2800,12 +2805,12 @@ function J(e, t, n) {
|
|
|
2800
2805
|
from: n
|
|
2801
2806
|
});
|
|
2802
2807
|
}
|
|
2803
|
-
function
|
|
2808
|
+
function ta(e, t) {
|
|
2804
2809
|
if (e.firstChild()) do
|
|
2805
2810
|
t(e.node);
|
|
2806
2811
|
while (e.nextSibling());
|
|
2807
2812
|
}
|
|
2808
|
-
function
|
|
2813
|
+
function na(e, t) {
|
|
2809
2814
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2810
2815
|
switch (e.name) {
|
|
2811
2816
|
case K.VariableName:
|
|
@@ -2816,13 +2821,13 @@ function ea(e, t) {
|
|
|
2816
2821
|
let n = e.node.cursor();
|
|
2817
2822
|
n.firstChild();
|
|
2818
2823
|
do
|
|
2819
|
-
|
|
2824
|
+
na(n, t);
|
|
2820
2825
|
while (n.nextSibling());
|
|
2821
2826
|
break;
|
|
2822
2827
|
}
|
|
2823
2828
|
}
|
|
2824
2829
|
}
|
|
2825
|
-
function
|
|
2830
|
+
function ra(e, t) {
|
|
2826
2831
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2827
2832
|
o.firstChild();
|
|
2828
2833
|
do {
|
|
@@ -2834,18 +2839,18 @@ function ta(e, t) {
|
|
|
2834
2839
|
while (e.nextSibling());
|
|
2835
2840
|
} while (o.nextSibling());
|
|
2836
2841
|
}
|
|
2837
|
-
function
|
|
2842
|
+
function ia(e, t) {
|
|
2838
2843
|
let n = e.cursor();
|
|
2839
2844
|
n.firstChild();
|
|
2840
2845
|
let r = !1;
|
|
2841
2846
|
do
|
|
2842
2847
|
if (n.name === q.For) r = !0;
|
|
2843
2848
|
else if (r && n.name === q.In) break;
|
|
2844
|
-
else r &&
|
|
2849
|
+
else r && na(n, t);
|
|
2845
2850
|
while (n.nextSibling());
|
|
2846
2851
|
}
|
|
2847
|
-
function
|
|
2848
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2852
|
+
function aa(e, t) {
|
|
2853
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Ji.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2849
2854
|
switch (s) {
|
|
2850
2855
|
case K.FunctionDefinition:
|
|
2851
2856
|
case K.ClassDefinition: {
|
|
@@ -2857,7 +2862,7 @@ function ra(e, t) {
|
|
|
2857
2862
|
break;
|
|
2858
2863
|
}
|
|
2859
2864
|
while (t.nextSibling());
|
|
2860
|
-
s === K.FunctionDefinition &&
|
|
2865
|
+
s === K.FunctionDefinition && ra(e, {
|
|
2861
2866
|
state: n,
|
|
2862
2867
|
variableName: r,
|
|
2863
2868
|
scopeId: c,
|
|
@@ -2866,7 +2871,7 @@ function ra(e, t) {
|
|
|
2866
2871
|
break;
|
|
2867
2872
|
}
|
|
2868
2873
|
case K.LambdaExpression:
|
|
2869
|
-
|
|
2874
|
+
ra(e, {
|
|
2870
2875
|
state: n,
|
|
2871
2876
|
variableName: r,
|
|
2872
2877
|
scopeId: c,
|
|
@@ -2878,7 +2883,7 @@ function ra(e, t) {
|
|
|
2878
2883
|
case K.SetComprehensionExpression:
|
|
2879
2884
|
case K.ComprehensionExpression:
|
|
2880
2885
|
case K.ForStatement:
|
|
2881
|
-
|
|
2886
|
+
ia(e, {
|
|
2882
2887
|
state: n,
|
|
2883
2888
|
variableName: r,
|
|
2884
2889
|
scopeId: u,
|
|
@@ -2896,7 +2901,7 @@ function ra(e, t) {
|
|
|
2896
2901
|
let s = e.cursor();
|
|
2897
2902
|
s.firstChild();
|
|
2898
2903
|
do
|
|
2899
|
-
s.from < o &&
|
|
2904
|
+
s.from < o && na(s, {
|
|
2900
2905
|
state: n,
|
|
2901
2906
|
variableName: r,
|
|
2902
2907
|
scopeId: u,
|
|
@@ -2931,8 +2936,8 @@ function ra(e, t) {
|
|
|
2931
2936
|
break;
|
|
2932
2937
|
}
|
|
2933
2938
|
}
|
|
2934
|
-
|
|
2935
|
-
|
|
2939
|
+
ta(o, (e) => {
|
|
2940
|
+
aa(e, {
|
|
2936
2941
|
state: n,
|
|
2937
2942
|
variableName: r,
|
|
2938
2943
|
scopeStack: l,
|
|
@@ -2940,27 +2945,27 @@ function ra(e, t) {
|
|
|
2940
2945
|
});
|
|
2941
2946
|
});
|
|
2942
2947
|
}
|
|
2943
|
-
function
|
|
2948
|
+
function oa(e, t, n) {
|
|
2944
2949
|
let r = me(e), i = [];
|
|
2945
|
-
|
|
2950
|
+
aa(r, {
|
|
2946
2951
|
state: e,
|
|
2947
2952
|
variableName: t,
|
|
2948
2953
|
scopeStack: [],
|
|
2949
2954
|
declarations: i
|
|
2950
2955
|
});
|
|
2951
2956
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2952
|
-
for (let e of
|
|
2953
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2957
|
+
for (let e of ea(r, a)) {
|
|
2958
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Zi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2954
2959
|
if (t) return t.from;
|
|
2955
2960
|
}
|
|
2956
2961
|
return null;
|
|
2957
2962
|
}
|
|
2958
|
-
function
|
|
2959
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2960
|
-
return i !== null && (
|
|
2963
|
+
function sa(e, t, n) {
|
|
2964
|
+
let { state: r } = e, i = n === void 0 ? $i(r, t) : oa(r, t, n);
|
|
2965
|
+
return i !== null && (Qi(e, i), !0);
|
|
2961
2966
|
}
|
|
2962
|
-
function
|
|
2963
|
-
return
|
|
2967
|
+
function ca(e, t) {
|
|
2968
|
+
return Qi(e, e.state.doc.line(t).from), !0;
|
|
2964
2969
|
}
|
|
2965
2970
|
//#endregion
|
|
2966
2971
|
//#region src/core/network/connection.ts
|
|
@@ -2969,11 +2974,11 @@ ee(null, (e, t) => t === null ? null : {
|
|
|
2969
2974
|
phase: t.phase,
|
|
2970
2975
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2971
2976
|
});
|
|
2972
|
-
function
|
|
2977
|
+
function la() {
|
|
2973
2978
|
return x(Y, (e) => e.state === k.OPEN);
|
|
2974
2979
|
}
|
|
2975
|
-
function
|
|
2976
|
-
return _e() ?
|
|
2980
|
+
function ua() {
|
|
2981
|
+
return _e() ? la() : Promise.resolve();
|
|
2977
2982
|
}
|
|
2978
2983
|
_((e) => e(Y).state === k.CONNECTING), _((e) => e(Y).state === k.OPEN), _((e) => {
|
|
2979
2984
|
let t = e(Y);
|
|
@@ -2981,8 +2986,8 @@ _((e) => e(Y).state === k.CONNECTING), _((e) => e(Y).state === k.OPEN), _((e) =>
|
|
|
2981
2986
|
}), _((e) => e(Y).state === k.CLOSED);
|
|
2982
2987
|
//#endregion
|
|
2983
2988
|
//#region src/components/ui/checkbox.tsx
|
|
2984
|
-
var
|
|
2985
|
-
let r = (0,
|
|
2989
|
+
var da = T.forwardRef((e, t) => {
|
|
2990
|
+
let r = (0, Mn.c)(13), i, a;
|
|
2986
2991
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2987
2992
|
let o;
|
|
2988
2993
|
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);
|
|
@@ -3001,25 +3006,25 @@ var la = T.forwardRef((e, t) => {
|
|
|
3001
3006
|
children: c
|
|
3002
3007
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
3003
3008
|
});
|
|
3004
|
-
|
|
3009
|
+
da.displayName = Pe.displayName;
|
|
3005
3010
|
//#endregion
|
|
3006
3011
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
3007
|
-
function
|
|
3012
|
+
function fa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
3008
3013
|
if (!n) return;
|
|
3009
3014
|
let o = document.getElementById(V.create(e));
|
|
3010
3015
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
3011
|
-
else if (
|
|
3016
|
+
else if (yi()) bi(o);
|
|
3012
3017
|
else {
|
|
3013
|
-
if (r)
|
|
3018
|
+
if (r) bi(o);
|
|
3014
3019
|
else {
|
|
3015
|
-
|
|
3020
|
+
Bn.promote(e);
|
|
3016
3021
|
let r = n.current?.editorView;
|
|
3017
3022
|
if (!r) {
|
|
3018
3023
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
3019
3024
|
return;
|
|
3020
3025
|
}
|
|
3021
3026
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
3022
|
-
if (
|
|
3027
|
+
if (_i(r), i === "top") r.dispatch({ selection: {
|
|
3023
3028
|
anchor: 0,
|
|
3024
3029
|
head: 0
|
|
3025
3030
|
} });
|
|
@@ -3029,7 +3034,7 @@ function ua({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
3029
3034
|
anchor: e.from,
|
|
3030
3035
|
head: e.from
|
|
3031
3036
|
} });
|
|
3032
|
-
} else a &&
|
|
3037
|
+
} else a && sa(r, a);
|
|
3033
3038
|
}
|
|
3034
3039
|
o.scrollIntoView({
|
|
3035
3040
|
behavior: "smooth",
|
|
@@ -3037,20 +3042,20 @@ function ua({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
3037
3042
|
});
|
|
3038
3043
|
}
|
|
3039
3044
|
}
|
|
3040
|
-
function
|
|
3045
|
+
function pa() {
|
|
3041
3046
|
let e = document.getElementById("App");
|
|
3042
3047
|
e?.scrollTo({
|
|
3043
3048
|
top: e.scrollHeight,
|
|
3044
3049
|
behavior: "smooth"
|
|
3045
3050
|
});
|
|
3046
3051
|
}
|
|
3047
|
-
function
|
|
3052
|
+
function ma() {
|
|
3048
3053
|
document.getElementById("App")?.scrollTo({
|
|
3049
3054
|
top: 0,
|
|
3050
3055
|
behavior: "smooth"
|
|
3051
3056
|
});
|
|
3052
3057
|
}
|
|
3053
|
-
function
|
|
3058
|
+
function ha(e) {
|
|
3054
3059
|
let t = document.getElementById(V.create(e));
|
|
3055
3060
|
return t?.scrollIntoView({
|
|
3056
3061
|
behavior: "smooth",
|
|
@@ -3059,64 +3064,64 @@ function pa(e) {
|
|
|
3059
3064
|
}
|
|
3060
3065
|
//#endregion
|
|
3061
3066
|
//#region src/core/cells/utils.ts
|
|
3062
|
-
function
|
|
3067
|
+
function ga(e) {
|
|
3063
3068
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
3064
3069
|
}
|
|
3065
|
-
function
|
|
3070
|
+
function _a(e) {
|
|
3066
3071
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
3067
3072
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
3068
3073
|
return r;
|
|
3069
3074
|
}
|
|
3070
|
-
function
|
|
3075
|
+
function va(e) {
|
|
3071
3076
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
3072
3077
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
3073
3078
|
return r;
|
|
3074
3079
|
}
|
|
3075
|
-
function
|
|
3080
|
+
function ya(e) {
|
|
3076
3081
|
return e.history.length > 0;
|
|
3077
3082
|
}
|
|
3078
|
-
function
|
|
3083
|
+
function ba(e) {
|
|
3079
3084
|
let t = e.history[e.history.length - 1];
|
|
3080
3085
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
3081
3086
|
}
|
|
3082
|
-
function
|
|
3083
|
-
return e.status === "idle" ?
|
|
3087
|
+
function xa(e, t, n) {
|
|
3088
|
+
return e.status === "idle" ? Ta(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
3084
3089
|
}
|
|
3085
|
-
function*
|
|
3090
|
+
function* Sa(e, t, n) {
|
|
3086
3091
|
for (let r of e.cellIds) {
|
|
3087
|
-
let i =
|
|
3088
|
-
o === null ? a.sourceChanged &&
|
|
3092
|
+
let i = Jt(t, r), a = n(r), o = xa(i, a, e.cellData[r]);
|
|
3093
|
+
o === null ? a.sourceChanged && wa(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
3089
3094
|
}
|
|
3090
3095
|
}
|
|
3091
|
-
function
|
|
3096
|
+
function Ca(e, t, n) {
|
|
3092
3097
|
let r = null;
|
|
3093
|
-
for (let [, i] of
|
|
3098
|
+
for (let [, i] of Sa(e, t, n)) {
|
|
3094
3099
|
if (i !== "inputs") return i;
|
|
3095
3100
|
r = i;
|
|
3096
3101
|
}
|
|
3097
3102
|
return r;
|
|
3098
3103
|
}
|
|
3099
|
-
function
|
|
3104
|
+
function wa(e, t) {
|
|
3100
3105
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
3101
3106
|
return r !== void 0 && r.state.status !== "completed";
|
|
3102
3107
|
}
|
|
3103
|
-
function
|
|
3108
|
+
function Ta({ status: e, outcome: t, live: n }) {
|
|
3104
3109
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
3105
3110
|
}
|
|
3106
|
-
function
|
|
3111
|
+
function Ea({ errored: e, stopped: t }) {
|
|
3107
3112
|
return {
|
|
3108
3113
|
published: !0,
|
|
3109
3114
|
"has-error": e,
|
|
3110
3115
|
stopped: t
|
|
3111
3116
|
};
|
|
3112
3117
|
}
|
|
3113
|
-
function
|
|
3114
|
-
let a =
|
|
3118
|
+
function Da({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
3119
|
+
let a = Un(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
3115
3120
|
return (e || t || n || a) && !o;
|
|
3116
3121
|
}
|
|
3117
3122
|
//#endregion
|
|
3118
3123
|
//#region src/core/cells/cells.ts
|
|
3119
|
-
function
|
|
3124
|
+
function Oa(e) {
|
|
3120
3125
|
let t = {
|
|
3121
3126
|
column: 0,
|
|
3122
3127
|
hide_code: !1,
|
|
@@ -3126,14 +3131,14 @@ function Ea(e) {
|
|
|
3126
3131
|
return {
|
|
3127
3132
|
...e,
|
|
3128
3133
|
cellData: {
|
|
3129
|
-
[B]:
|
|
3134
|
+
[B]: Rr({
|
|
3130
3135
|
id: B,
|
|
3131
3136
|
config: t
|
|
3132
3137
|
}),
|
|
3133
3138
|
...e.cellData
|
|
3134
3139
|
},
|
|
3135
3140
|
cellRuntime: {
|
|
3136
|
-
[B]:
|
|
3141
|
+
[B]: Br(),
|
|
3137
3142
|
...e.cellRuntime
|
|
3138
3143
|
},
|
|
3139
3144
|
cellHandles: {
|
|
@@ -3142,8 +3147,8 @@ function Ea(e) {
|
|
|
3142
3147
|
}
|
|
3143
3148
|
};
|
|
3144
3149
|
}
|
|
3145
|
-
function
|
|
3146
|
-
return
|
|
3150
|
+
function ka() {
|
|
3151
|
+
return Oa({
|
|
3147
3152
|
cellIds: [],
|
|
3148
3153
|
cellData: {},
|
|
3149
3154
|
cellRuntime: {},
|
|
@@ -3153,7 +3158,7 @@ function Da() {
|
|
|
3153
3158
|
cellLogs: []
|
|
3154
3159
|
});
|
|
3155
3160
|
}
|
|
3156
|
-
var { reducer:
|
|
3161
|
+
var { reducer: Aa, createActions: ja, useActions: Ma, valueAtom: X } = fe(ka, {
|
|
3157
3162
|
startCellConsole: (e, { cellId: t }) => Z({
|
|
3158
3163
|
state: e,
|
|
3159
3164
|
cellId: t,
|
|
@@ -3171,12 +3176,12 @@ var { reducer: Oa, createActions: ka, useActions: Aa, valueAtom: X } = fe(Da, {
|
|
|
3171
3176
|
cellId: n,
|
|
3172
3177
|
cellReducer: (e) => ({
|
|
3173
3178
|
...e,
|
|
3174
|
-
commandConsole:
|
|
3179
|
+
commandConsole: Wn(e.commandConsole, t, e.clearedCommandIds?.[t.op])
|
|
3175
3180
|
})
|
|
3176
3181
|
});
|
|
3177
3182
|
return i || t.op === "pdb-output" ? a : {
|
|
3178
3183
|
...a,
|
|
3179
|
-
cellLogs: [...a.cellLogs, ...
|
|
3184
|
+
cellLogs: [...a.cellLogs, ...Ar({
|
|
3180
3185
|
cell_id: n,
|
|
3181
3186
|
console: r
|
|
3182
3187
|
})]
|
|
@@ -3202,7 +3207,7 @@ var { reducer: Oa, createActions: ka, useActions: Aa, valueAtom: X } = fe(Da, {
|
|
|
3202
3207
|
let n = t[e];
|
|
3203
3208
|
n.commandConsole?.entries.some((e) => e.source === "pdb-output") && (t[e] = {
|
|
3204
3209
|
...n,
|
|
3205
|
-
commandConsole:
|
|
3210
|
+
commandConsole: Wn(n.commandConsole, {
|
|
3206
3211
|
op: "pdb-output",
|
|
3207
3212
|
cell_id: e,
|
|
3208
3213
|
entries: [],
|
|
@@ -3220,8 +3225,8 @@ var { reducer: Oa, createActions: ka, useActions: Aa, valueAtom: X } = fe(Da, {
|
|
|
3220
3225
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
3221
3226
|
}),
|
|
3222
3227
|
reconcileDocument: (e, t) => {
|
|
3223
|
-
let n =
|
|
3224
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3228
|
+
let n = di(e, t);
|
|
3229
|
+
for (let t of e.cellIds) t in n.cellData || qa(t);
|
|
3225
3230
|
return n;
|
|
3226
3231
|
},
|
|
3227
3232
|
setStdinResponse: (e, t) => {
|
|
@@ -3239,7 +3244,7 @@ var { reducer: Oa, createActions: ka, useActions: Aa, valueAtom: X } = fe(Da, {
|
|
|
3239
3244
|
let n = be(), r = { ...e.cellRuntime };
|
|
3240
3245
|
for (let i of [...e.cellIds, B]) {
|
|
3241
3246
|
let a = e.cellRuntime[i];
|
|
3242
|
-
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a :
|
|
3247
|
+
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : Br({
|
|
3243
3248
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
3244
3249
|
clearedCommandIds: t ? a?.clearedCommandIds : void 0
|
|
3245
3250
|
});
|
|
@@ -3253,10 +3258,10 @@ var { reducer: Oa, createActions: ka, useActions: Aa, valueAtom: X } = fe(Da, {
|
|
|
3253
3258
|
let t = e.scrollKey;
|
|
3254
3259
|
if (t === null) return e;
|
|
3255
3260
|
let n = t;
|
|
3256
|
-
return
|
|
3261
|
+
return fa({
|
|
3257
3262
|
cellId: n,
|
|
3258
3263
|
cell: e.cellHandles[n],
|
|
3259
|
-
isCodeHidden:
|
|
3264
|
+
isCodeHidden: mi(e.cellData[n]?.config.hide_code, h.get(G), n),
|
|
3260
3265
|
codeFocus: void 0,
|
|
3261
3266
|
variableName: void 0
|
|
3262
3267
|
}), {
|
|
@@ -3264,8 +3269,8 @@ var { reducer: Oa, createActions: ka, useActions: Aa, valueAtom: X } = fe(Da, {
|
|
|
3264
3269
|
scrollKey: null
|
|
3265
3270
|
};
|
|
3266
3271
|
},
|
|
3267
|
-
foldAll: (e) => (
|
|
3268
|
-
unfoldAll: (e) => (
|
|
3272
|
+
foldAll: (e) => (Fn(Object.keys(e.cellHandles).map((e) => Ya(e))), e),
|
|
3273
|
+
unfoldAll: (e) => (In(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3269
3274
|
clearLogs: (e) => ({
|
|
3270
3275
|
...e,
|
|
3271
3276
|
cellLogs: []
|
|
@@ -3295,17 +3300,17 @@ function Z({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3295
3300
|
}
|
|
3296
3301
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3297
3302
|
}
|
|
3298
|
-
var
|
|
3299
|
-
h.set(X, (t) =>
|
|
3303
|
+
var Na = ja((e) => {
|
|
3304
|
+
h.set(X, (t) => Aa(t, e));
|
|
3300
3305
|
}).addLogs, Q = _((e) => e(X).cellIds);
|
|
3301
|
-
_((e) => e(Q).length === 1), _((e) =>
|
|
3302
|
-
var
|
|
3303
|
-
_((e) => e(
|
|
3304
|
-
var
|
|
3306
|
+
_((e) => e(Q).length === 1), _((e) => _a(e(X)).length > 0), _((e) => va(e(X)).length > 0), _((e) => ya(e(X))), _((e) => ba(e(X)));
|
|
3307
|
+
var Pa = _((e) => Ca(e(X), e(pn), e(gn)));
|
|
3308
|
+
_((e) => e(Pa) !== null);
|
|
3309
|
+
var Fa = _((e) => {
|
|
3305
3310
|
let { cellIds: t, cellData: n } = e(X);
|
|
3306
3311
|
return t.map((t) => {
|
|
3307
3312
|
let r = e(z(t)), { name: i } = n[t];
|
|
3308
|
-
if (r !== null &&
|
|
3313
|
+
if (r !== null && Un(r.mimetype)) {
|
|
3309
3314
|
w(Array.isArray(r.data), "Expected array data");
|
|
3310
3315
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
3311
3316
|
if (e.length > 0) return {
|
|
@@ -3319,103 +3324,103 @@ var Na = _((e) => {
|
|
|
3319
3324
|
}
|
|
3320
3325
|
return null;
|
|
3321
3326
|
}).filter(Boolean);
|
|
3322
|
-
}),
|
|
3327
|
+
}), Ia = te(_((e) => {
|
|
3323
3328
|
let t = {};
|
|
3324
3329
|
for (let n of e(Q)) {
|
|
3325
|
-
let r = e(
|
|
3330
|
+
let r = e(Cn(n));
|
|
3326
3331
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3327
3332
|
}
|
|
3328
3333
|
return t;
|
|
3329
|
-
})),
|
|
3330
|
-
_((e) => e(
|
|
3331
|
-
var
|
|
3334
|
+
})), La = _((e) => Je(e(Q).map((t) => e(Cn(t)))));
|
|
3335
|
+
_((e) => e(Fa).length);
|
|
3336
|
+
var Ra = te(_((e) => {
|
|
3332
3337
|
let { cellIds: t, cellData: n } = e(X);
|
|
3333
3338
|
return le.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3334
3339
|
}));
|
|
3335
3340
|
_((e) => e(X).scrollKey);
|
|
3336
|
-
var
|
|
3341
|
+
var za = () => S(Q), Ba = () => S(Ra), Va = () => h.get(X), Ha = () => h.get(X).cellIds, Ua = () => {
|
|
3337
3342
|
let { cellIds: e, cellData: t } = h.get(X);
|
|
3338
3343
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3339
3344
|
};
|
|
3340
3345
|
se(y(X, (e) => e.cellIds.map((t) => e.cellData[t]))), _((e) => e(X).cellIds.length > 0);
|
|
3341
|
-
var
|
|
3342
|
-
let t = _((t) =>
|
|
3346
|
+
var Wa = v((e) => _((t) => t(X).cellData[e])), Ga = Br(), $ = v((e) => {
|
|
3347
|
+
let t = _((t) => Ur(t, e, t(C))), n = _((t) => t(X).cellRuntime[e] ?? Ga), r = _((e) => {
|
|
3343
3348
|
let r = e(t), i = e(C), a = i && e(i.shownDocumentAtom)?.cells;
|
|
3344
3349
|
return {
|
|
3345
3350
|
local: e(n),
|
|
3346
3351
|
execution: r,
|
|
3347
3352
|
code: r && kt(r.record, a ?? void 0)
|
|
3348
3353
|
};
|
|
3349
|
-
}), i = y(r,
|
|
3354
|
+
}), i = y(r, Wr);
|
|
3350
3355
|
return _((e) => e(i).rendered);
|
|
3351
|
-
}),
|
|
3352
|
-
function
|
|
3353
|
-
|
|
3356
|
+
}), Ka = v((e) => _((t) => t(X).cellHandles[e]));
|
|
3357
|
+
function qa(e) {
|
|
3358
|
+
Wa.remove(e), $.remove(e), Ka.remove(e), wn(e);
|
|
3354
3359
|
}
|
|
3355
|
-
var
|
|
3360
|
+
var Ja = (e) => {
|
|
3356
3361
|
let { cellHandles: t } = h.get(X);
|
|
3357
3362
|
return t[e]?.current?.editorView ?? void 0;
|
|
3358
|
-
},
|
|
3363
|
+
}, Ya = (e) => (Bn.promote(e), Ja(e));
|
|
3359
3364
|
_((e) => e(Q).map((t) => ({
|
|
3360
|
-
...e(
|
|
3365
|
+
...e(Wa(t)),
|
|
3361
3366
|
...e($(t)),
|
|
3362
3367
|
output: e(z(t))
|
|
3363
3368
|
})));
|
|
3364
|
-
function
|
|
3365
|
-
return
|
|
3369
|
+
function Xa() {
|
|
3370
|
+
return Ma();
|
|
3366
3371
|
}
|
|
3367
3372
|
//#endregion
|
|
3368
3373
|
//#region src/core/errors/error-entries.ts
|
|
3369
|
-
function
|
|
3370
|
-
if (
|
|
3374
|
+
function Za(e) {
|
|
3375
|
+
if (Vn(e.mimetype)) {
|
|
3371
3376
|
if (!Array.isArray(e.data)) return null;
|
|
3372
3377
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
3373
3378
|
return t.length === 0 ? null : { errorData: t };
|
|
3374
3379
|
}
|
|
3375
|
-
return
|
|
3380
|
+
return Hn(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
3376
3381
|
errorData: [],
|
|
3377
3382
|
tracebackHtml: e.data
|
|
3378
3383
|
} : null;
|
|
3379
3384
|
}
|
|
3380
|
-
function
|
|
3385
|
+
function Qa(e) {
|
|
3381
3386
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3382
3387
|
}
|
|
3383
|
-
function
|
|
3384
|
-
let t = e?.find((e) =>
|
|
3388
|
+
function $a(e) {
|
|
3389
|
+
let t = e?.find((e) => Hn(e.mimetype));
|
|
3385
3390
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3386
3391
|
}
|
|
3387
|
-
function
|
|
3392
|
+
function eo(e, t) {
|
|
3388
3393
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3389
|
-
if (!
|
|
3394
|
+
if (!Qa(e.errorData)) return $a(t);
|
|
3390
3395
|
}
|
|
3391
|
-
function
|
|
3396
|
+
function to(e) {
|
|
3392
3397
|
let { cellIds: t, cellData: n } = e.get(X), r = [];
|
|
3393
3398
|
for (let [i, a] of t.entries()) {
|
|
3394
3399
|
let t = e.get(z(a));
|
|
3395
|
-
if (t === null || !
|
|
3396
|
-
let o =
|
|
3400
|
+
if (t === null || !Un(t.mimetype)) continue;
|
|
3401
|
+
let o = Za(t);
|
|
3397
3402
|
if (!o) continue;
|
|
3398
|
-
let s =
|
|
3403
|
+
let s = Ir(n[a].name, i), c = t.code ?? n[a].code;
|
|
3399
3404
|
r.push({
|
|
3400
3405
|
cellId: a,
|
|
3401
3406
|
cellName: s,
|
|
3402
3407
|
cellCode: c,
|
|
3403
3408
|
errorData: o.errorData,
|
|
3404
|
-
tracebackHtml:
|
|
3409
|
+
tracebackHtml: eo(o, e.get($(a)).consoleOutputs)
|
|
3405
3410
|
});
|
|
3406
3411
|
}
|
|
3407
3412
|
return r;
|
|
3408
3413
|
}
|
|
3409
|
-
function
|
|
3414
|
+
function no(e) {
|
|
3410
3415
|
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");
|
|
3411
3416
|
}
|
|
3412
|
-
function
|
|
3413
|
-
let t =
|
|
3417
|
+
function ro(e) {
|
|
3418
|
+
let t = no(e);
|
|
3414
3419
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
3415
3420
|
}
|
|
3416
|
-
function
|
|
3421
|
+
function io(e) {
|
|
3417
3422
|
let t = [e.cellName];
|
|
3418
|
-
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
3423
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(ro).join("\n\n")), t.join("\n\n");
|
|
3419
3424
|
}
|
|
3420
3425
|
//#endregion
|
|
3421
|
-
export {
|
|
3426
|
+
export { mi as $, mt as $t, da as A, V as At, Wi as B, fn as Bt, ga as C, Ar as Ct, pa as D, nr as Dt, fa as E, yr as Et, Yi as F, Gn as Ft, Pi as G, Tn as Gt, Bi as H, Cn as Ht, qi as I, Kn as It, Ci as J, En as Jt, ji as K, un as Kt, Gi as L, Nn as Lt, la as M, Xn as Mt, ua as N, $n as Nt, ha as O, Zn as Ot, ca as P, Qn as Pt, _i as Q, ht as Qt, Ki as R, jn as Rt, Ta as S, Pr as St, Da as T, W as Tt, Vi as U, z as Ut, zi as V, Sn as Vt, Ni as W, R as Wt, Si as X, An as Xt, xi as Y, On as Yt, vi as Z, Jt as Zt, Aa as _, Ur as _t, Na as a, we as an, Jr as at, Ba as b, Fr as bt, $ as c, ai as ct, Ua as d, ci as dt, Qe as en, hi as et, Ha as f, ni as ft, La as g, Gr as gt, X as h, ri as ht, to as i, He as in, qr as it, Y as j, B as jt, ma as k, er as kt, ja as l, si as lt, ka as m, ii as mt, io as n, Xe as nn, pi as nt, Wa as o, Ce as on, oi as ot, Va as p, Xr as pt, Ei as q, kn as qt, ro as r, qe as rn, fi as rt, Q as s, Yr as st, no as t, k as tn, G as tt, Ya as u, li as ut, qa as v, Hr as vt, Ea as w, Er as wt, Xa as x, Lr as xt, za as y, Ir as yt, Ui as z, xn as zt };
|