@marimo-team/islands 0.25.3-dev443 → 0.25.3-dev446
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-ChjR_qNc.js → ErrorBoundary-CBvdOZsh.js} +1 -1
- package/dist/{chat-ui-2c_3M6FX.js → chat-ui-9oyUBL6M.js} +3 -3
- package/dist/{code-visibility-5YDwPR_7.js → code-visibility-BVsBD2bm.js} +2 -2
- package/dist/{common-JUL1MI9m.js → common-Cz5kXzjw.js} +3413 -3410
- package/dist/{data-grid-overlay-editor-sJUTFqw-.js → data-grid-overlay-editor-B-PHwg_F.js} +1 -1
- package/dist/{error-entries-CNB7O2yS.js → error-entries-CWdDf7iZ.js} +465 -432
- package/dist/{feedback-button--GNPN1u6.js → feedback-button-DKfgWMh1.js} +3 -3
- package/dist/{glide-data-editor-CNcaA_Gh.js → glide-data-editor-BMrcgCud.js} +3 -3
- package/dist/{globals-DpXrMRNp.js → globals-vjja83iL.js} +1 -1
- package/dist/{html-to-image-B0UiwmMu.js → html-to-image-CexRSGAZ.js} +1 -1
- package/dist/main.js +6385 -6363
- package/dist/{number-overlay-editor-s6lOEbzd.js → number-overlay-editor-CQvIdVeX.js} +1 -1
- package/dist/{process-output-3Epq3rw6.js → process-output-hcyVRJCC.js} +2 -2
- package/dist/{reveal-component-CAvchMuM.js → reveal-component-DF7VRfN2.js} +39 -39
- package/package.json +1 -1
- package/src/__mocks__/requests.ts +1 -0
- package/src/components/editor/alerts/stdin-blocking-alert.tsx +5 -0
- package/src/components/editor/output/console/ConsoleOutput.tsx +27 -1
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +33 -0
- package/src/components/editor/stdin-blocking-alert.tsx +5 -0
- package/src/core/cells/cell.ts +3 -0
- package/src/core/cells/cells.ts +42 -3
- package/src/core/cells/types.ts +7 -0
- package/src/core/codemirror/cells/debugger-state.ts +5 -0
- package/src/core/errors/error-entries.ts +2 -1
- package/src/core/islands/bootstrap.ts +2 -0
- package/src/core/islands/bridge.ts +1 -0
- package/src/core/network/requests-network.ts +5 -0
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +1 -0
- package/src/core/network/types.ts +1 -0
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +69 -1
- package/src/core/session/useNotebookSession.tsx +29 -2
- package/src/core/wasm/bridge.ts +2 -0
|
@@ -566,10 +566,10 @@ var Dt = {
|
|
|
566
566
|
function Pt(e, t) {
|
|
567
567
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Ft(e, t, n) {
|
|
570
570
|
return e !== null && Pt(e.notebook, t) ? e.value : n;
|
|
571
571
|
}
|
|
572
|
-
var
|
|
572
|
+
var N = b((e) => {
|
|
573
573
|
let t = e(p), n = t === null ? null : e(t.notebookAtom);
|
|
574
574
|
return t === null || n === null ? null : {
|
|
575
575
|
replica: t,
|
|
@@ -577,23 +577,23 @@ var P = b((e) => {
|
|
|
577
577
|
generation: e(t.generationAtom)
|
|
578
578
|
};
|
|
579
579
|
});
|
|
580
|
-
function
|
|
581
|
-
return Pt(t.notebook, e.get(
|
|
580
|
+
function It(e, t) {
|
|
581
|
+
return Pt(t.notebook, e.get(N));
|
|
582
582
|
}
|
|
583
|
-
var
|
|
584
|
-
let t =
|
|
583
|
+
var Lt = b((e) => {
|
|
584
|
+
let t = Ft(e(M), e(N), kt);
|
|
585
585
|
return t.size === 0 ? At : new Set([...t].flatMap((e) => e.cells));
|
|
586
|
-
}),
|
|
586
|
+
}), P = b((e) => {
|
|
587
587
|
let t = e(p), n = t === null ? null : e(t.shownDocumentAtom);
|
|
588
588
|
return {
|
|
589
589
|
executions: t === null ? Dt : e(t.executionsAtom),
|
|
590
590
|
results: t === null ? Ot : e(t.resultsAtom),
|
|
591
591
|
cells: n?.cells ?? j,
|
|
592
|
-
requested: e(
|
|
593
|
-
blocked:
|
|
592
|
+
requested: e(Lt),
|
|
593
|
+
blocked: Ft(e(Nt), e(N), jt),
|
|
594
594
|
runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
|
|
595
595
|
};
|
|
596
|
-
}),
|
|
596
|
+
}), Rt = b((e) => {
|
|
597
597
|
let t = e(p), n = t === null ? null : e(t.shownDocumentAtom);
|
|
598
598
|
return t === null || n === null ? {
|
|
599
599
|
cells: j,
|
|
@@ -604,27 +604,27 @@ var It = b((e) => {
|
|
|
604
604
|
executions: e(t.executionsAtom),
|
|
605
605
|
results: e(t.resultsAtom)
|
|
606
606
|
};
|
|
607
|
-
}),
|
|
607
|
+
}), zt = b((e) => et(e(Rt))), Bt = b(null), Vt = b((e) => {
|
|
608
608
|
let t = e(p), n = t === null ? null : e(t.shownDocumentAtom);
|
|
609
609
|
return t === null || n === null ? null : {
|
|
610
610
|
replica: t,
|
|
611
611
|
id: n.revision.notebook_id,
|
|
612
612
|
generation: e(t.generationAtom)
|
|
613
613
|
};
|
|
614
|
-
}),
|
|
614
|
+
}), Ht = b((e) => {
|
|
615
615
|
let t = e(p);
|
|
616
616
|
return {
|
|
617
617
|
executions: t === null ? Dt : e(t.executionsAtom),
|
|
618
618
|
results: t === null ? Ot : e(t.resultsAtom),
|
|
619
|
-
cleared:
|
|
619
|
+
cleared: Ft(e(Bt), e(Vt), Mt),
|
|
620
620
|
cells: t === null ? j : e(t.documentAtom)?.cells ?? j
|
|
621
621
|
};
|
|
622
|
-
}),
|
|
623
|
-
function
|
|
624
|
-
|
|
622
|
+
}), Ut = b((e) => gt(e(Ht))), F = S((e) => h(Ut, (t) => t.get(e) ?? null, m)), I = S((e) => b((t) => Je(t(F(e)))));
|
|
623
|
+
function Wt(e) {
|
|
624
|
+
F.remove(e), I.remove(e);
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
let n = e.get(
|
|
626
|
+
function Gt(e, t) {
|
|
627
|
+
let n = e.get(Ht), r = new Map(n.cleared);
|
|
628
628
|
for (let e of t) {
|
|
629
629
|
let t = pt(n, e);
|
|
630
630
|
t?.record.outcome != null && r.set(e, {
|
|
@@ -632,18 +632,18 @@ function Wt(e, t) {
|
|
|
632
632
|
version: t.outputVersion
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
|
-
let i = e.get(
|
|
636
|
-
e.set(
|
|
635
|
+
let i = e.get(Vt);
|
|
636
|
+
e.set(Bt, i === null ? null : {
|
|
637
637
|
notebook: i,
|
|
638
638
|
value: r
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
|
-
var
|
|
641
|
+
var Kt = b((e) => {
|
|
642
642
|
let t = e(p);
|
|
643
643
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
644
644
|
});
|
|
645
|
-
b((e) => Tt(e(
|
|
646
|
-
var
|
|
645
|
+
b((e) => Tt(e(P).executions)), b((e) => Et(e(P)));
|
|
646
|
+
var qt = b((e) => {
|
|
647
647
|
let t = e(p);
|
|
648
648
|
if (t === null) return { refused: "No notebook is connected" };
|
|
649
649
|
if (e(t.connectionAtom).state === O.CLOSED) return { refused: "The notebook is disconnected" };
|
|
@@ -656,29 +656,29 @@ var Kt = b((e) => {
|
|
|
656
656
|
default: return "waiting";
|
|
657
657
|
}
|
|
658
658
|
});
|
|
659
|
-
function
|
|
659
|
+
function Jt(e) {
|
|
660
660
|
return new Promise((t, n) => {
|
|
661
|
-
let r = e.sub(
|
|
661
|
+
let r = e.sub(qt, i);
|
|
662
662
|
function i() {
|
|
663
|
-
let i = e.get(
|
|
663
|
+
let i = e.get(qt);
|
|
664
664
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
665
665
|
}
|
|
666
666
|
i();
|
|
667
667
|
});
|
|
668
668
|
}
|
|
669
|
-
function
|
|
670
|
-
let n = e.get(
|
|
669
|
+
function Yt(e, t) {
|
|
670
|
+
let n = e.get(N);
|
|
671
671
|
if (n === null) return null;
|
|
672
672
|
let r = {
|
|
673
673
|
notebook: n,
|
|
674
674
|
cells: [...t]
|
|
675
|
-
}, i =
|
|
675
|
+
}, i = Ft(e.get(M), n, kt);
|
|
676
676
|
return e.set(M, {
|
|
677
677
|
notebook: n,
|
|
678
678
|
value: new Set(i).add(r)
|
|
679
679
|
}), r;
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function Xt(e, t) {
|
|
682
682
|
let n = e.get(M);
|
|
683
683
|
if (n === null || !n.value.has(t)) return;
|
|
684
684
|
let r = new Set(n.value);
|
|
@@ -687,41 +687,41 @@ function Yt(e, t) {
|
|
|
687
687
|
value: r
|
|
688
688
|
});
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
let r = b((e) => Pt(t.notebook, e(
|
|
690
|
+
function Zt(e, t, n) {
|
|
691
|
+
let r = b((e) => Pt(t.notebook, e(N)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
692
692
|
function a() {
|
|
693
|
-
e.get(r) || (i(),
|
|
693
|
+
e.get(r) || (i(), Xt(e, t));
|
|
694
694
|
}
|
|
695
695
|
a();
|
|
696
696
|
}
|
|
697
|
-
function
|
|
698
|
-
let r = e.get(
|
|
697
|
+
function Qt(e, t, n) {
|
|
698
|
+
let r = e.get(P).blocked;
|
|
699
699
|
if (r.has(t) === n) return;
|
|
700
700
|
let i = new Set(r);
|
|
701
701
|
n ? i.add(t) : i.delete(t);
|
|
702
|
-
let a = e.get(
|
|
702
|
+
let a = e.get(N);
|
|
703
703
|
a !== null && e.set(Nt, {
|
|
704
704
|
notebook: a,
|
|
705
705
|
value: i
|
|
706
706
|
});
|
|
707
707
|
}
|
|
708
|
-
function
|
|
709
|
-
t.status != null &&
|
|
708
|
+
function $t(e, t) {
|
|
709
|
+
t.status != null && Qt(e, t.cell_id, t.status === "disabled-transitively");
|
|
710
710
|
}
|
|
711
711
|
//#endregion
|
|
712
712
|
//#region src/core/codemirror/editing/commands.ts
|
|
713
|
-
var
|
|
714
|
-
function
|
|
713
|
+
var en = a();
|
|
714
|
+
function tn(e) {
|
|
715
715
|
return (t) => {
|
|
716
716
|
let n = !1;
|
|
717
717
|
for (let r of t) r && (n = e(r) || n);
|
|
718
718
|
return n;
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
|
-
var
|
|
721
|
+
var nn = tn(he), rn = tn(me);
|
|
722
722
|
//#endregion
|
|
723
723
|
//#region src/utils/schedule-task.ts
|
|
724
|
-
function
|
|
724
|
+
function an() {
|
|
725
725
|
let e = globalThis.scheduler;
|
|
726
726
|
if (typeof e?.postTask == "function") return (t) => {
|
|
727
727
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -742,10 +742,10 @@ function rn() {
|
|
|
742
742
|
setTimeout(e, 0);
|
|
743
743
|
};
|
|
744
744
|
}
|
|
745
|
-
var
|
|
745
|
+
var on = an();
|
|
746
746
|
//#endregion
|
|
747
747
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
748
|
-
function
|
|
748
|
+
function sn(e = on) {
|
|
749
749
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
750
750
|
function i() {
|
|
751
751
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -788,21 +788,7 @@ function on(e = an) {
|
|
|
788
788
|
}
|
|
789
789
|
};
|
|
790
790
|
}
|
|
791
|
-
var
|
|
792
|
-
//#endregion
|
|
793
|
-
//#region src/core/mime.ts
|
|
794
|
-
function cn(e) {
|
|
795
|
-
return e === "application/vnd.marimo+error";
|
|
796
|
-
}
|
|
797
|
-
function ln(e) {
|
|
798
|
-
return e === "application/vnd.marimo+traceback";
|
|
799
|
-
}
|
|
800
|
-
function R(e) {
|
|
801
|
-
return cn(e) || ln(e);
|
|
802
|
-
}
|
|
803
|
-
//#endregion
|
|
804
|
-
//#region src/components/editor/output/ansi-reduce.ts
|
|
805
|
-
var un = class e {
|
|
791
|
+
var cn = sn(), ln = class e {
|
|
806
792
|
lines = [""];
|
|
807
793
|
cursor = {
|
|
808
794
|
row: 0,
|
|
@@ -891,7 +877,7 @@ var un = class e {
|
|
|
891
877
|
render() {
|
|
892
878
|
return this.lines.join("\n");
|
|
893
879
|
}
|
|
894
|
-
},
|
|
880
|
+
}, un = class {
|
|
895
881
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
896
882
|
parse(e) {
|
|
897
883
|
let t = [], n = 0;
|
|
@@ -910,9 +896,9 @@ var un = class e {
|
|
|
910
896
|
value: e.slice(n)
|
|
911
897
|
}), t;
|
|
912
898
|
}
|
|
913
|
-
},
|
|
914
|
-
parser = new
|
|
915
|
-
buffer = new
|
|
899
|
+
}, dn = class {
|
|
900
|
+
parser = new un();
|
|
901
|
+
buffer = new ln();
|
|
916
902
|
reduce(e) {
|
|
917
903
|
return this.reset(), this.append(e), this.render();
|
|
918
904
|
}
|
|
@@ -928,7 +914,7 @@ var un = class e {
|
|
|
928
914
|
for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
929
915
|
}
|
|
930
916
|
reset() {
|
|
931
|
-
this.buffer = new
|
|
917
|
+
this.buffer = new ln();
|
|
932
918
|
}
|
|
933
919
|
render() {
|
|
934
920
|
return this.buffer.render();
|
|
@@ -971,20 +957,20 @@ var un = class e {
|
|
|
971
957
|
for (let t of e) t >= " " && (n += t);
|
|
972
958
|
return n;
|
|
973
959
|
}
|
|
974
|
-
},
|
|
960
|
+
}, L = class e {
|
|
975
961
|
mimetype;
|
|
976
962
|
channel;
|
|
977
963
|
timestamp;
|
|
978
964
|
code;
|
|
979
965
|
id;
|
|
980
966
|
input_id;
|
|
981
|
-
ansiReducer = new
|
|
967
|
+
ansiReducer = new dn();
|
|
982
968
|
_data;
|
|
983
969
|
get data() {
|
|
984
970
|
return this._data;
|
|
985
971
|
}
|
|
986
972
|
static create(t) {
|
|
987
|
-
let n = new
|
|
973
|
+
let n = new dn();
|
|
988
974
|
return n.append(t.data), new e({
|
|
989
975
|
mimetype: t.mimetype,
|
|
990
976
|
channel: t.channel,
|
|
@@ -1021,28 +1007,28 @@ var un = class e {
|
|
|
1021
1007
|
};
|
|
1022
1008
|
//#endregion
|
|
1023
1009
|
//#region src/core/cells/collapseConsoleOutputs.tsx
|
|
1024
|
-
function
|
|
1010
|
+
function fn(e, t = 5e3) {
|
|
1025
1011
|
let n = [...e];
|
|
1026
|
-
if (n.length < 2) return
|
|
1012
|
+
if (n.length < 2) return _n(n.map(mn), t);
|
|
1027
1013
|
let r = n[n.length - 1], i = n[n.length - 2];
|
|
1028
|
-
return
|
|
1014
|
+
return pn(r, i) && (gn(r), gn(i), n[n.length - 2] = hn(i, r), n.pop()), _n(n, t);
|
|
1029
1015
|
}
|
|
1030
|
-
function
|
|
1016
|
+
function pn(e, t) {
|
|
1031
1017
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
1032
1018
|
if (!n) return !1;
|
|
1033
1019
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
1034
1020
|
return n && r && i;
|
|
1035
1021
|
}
|
|
1036
|
-
function
|
|
1037
|
-
return e instanceof
|
|
1022
|
+
function mn(e) {
|
|
1023
|
+
return e instanceof L ? e : typeof e.data == "string" ? L.create(e) : e;
|
|
1038
1024
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return e instanceof
|
|
1025
|
+
function hn(e, t) {
|
|
1026
|
+
return e instanceof L ? e.appendData(t.data) : L.create(e).appendData(t.data);
|
|
1041
1027
|
}
|
|
1042
|
-
function
|
|
1028
|
+
function gn(e) {
|
|
1043
1029
|
C(typeof e.data == "string", "expected string output");
|
|
1044
1030
|
}
|
|
1045
|
-
function
|
|
1031
|
+
function _n(e, t) {
|
|
1046
1032
|
let n = 0, r;
|
|
1047
1033
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1048
1034
|
let t = e[r];
|
|
@@ -1071,17 +1057,28 @@ function vn(e, t) {
|
|
|
1071
1057
|
return [a, ...e.slice(i + 1)];
|
|
1072
1058
|
}
|
|
1073
1059
|
//#endregion
|
|
1074
|
-
//#region src/core/
|
|
1060
|
+
//#region src/core/mime.ts
|
|
1061
|
+
function vn(e) {
|
|
1062
|
+
return e === "application/vnd.marimo+error";
|
|
1063
|
+
}
|
|
1075
1064
|
function yn(e) {
|
|
1076
|
-
return
|
|
1065
|
+
return e === "application/vnd.marimo+traceback";
|
|
1066
|
+
}
|
|
1067
|
+
function R(e) {
|
|
1068
|
+
return vn(e) || yn(e);
|
|
1077
1069
|
}
|
|
1070
|
+
//#endregion
|
|
1071
|
+
//#region src/core/cells/cell.ts
|
|
1078
1072
|
function bn(e) {
|
|
1073
|
+
return (e.at(-1)?.id ?? 0) + 1;
|
|
1074
|
+
}
|
|
1075
|
+
function xn(e) {
|
|
1079
1076
|
return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
|
|
1080
1077
|
}
|
|
1081
|
-
function
|
|
1078
|
+
function Sn(e, t) {
|
|
1082
1079
|
let n = { ...e };
|
|
1083
|
-
t.status === "queued" && (n.debuggerActive = !1), t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
1084
|
-
let r =
|
|
1080
|
+
t.status === "running" && n.pdbOutput && delete n.pdbOutput, t.status === "queued" && (n.debuggerActive = !1), t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
1081
|
+
let r = xn(t.output).includes("interruption"), i = e.consoleOutputs;
|
|
1085
1082
|
(r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
|
|
1086
1083
|
channel: e.channel,
|
|
1087
1084
|
mimetype: e.mimetype,
|
|
@@ -1092,26 +1089,26 @@ function xn(e, t) {
|
|
|
1092
1089
|
response: e.response ?? ""
|
|
1093
1090
|
} : e));
|
|
1094
1091
|
let a = t.console;
|
|
1095
|
-
a != null && (i =
|
|
1092
|
+
a != null && (i = fn(Array.isArray(a) ? a.map((e, t) => ({
|
|
1096
1093
|
...e,
|
|
1097
1094
|
id: t + 1
|
|
1098
1095
|
})) : [...i, {
|
|
1099
1096
|
...a,
|
|
1100
|
-
id:
|
|
1097
|
+
id: bn(i)
|
|
1101
1098
|
}])), n.consoleOutputs = i;
|
|
1102
1099
|
let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
|
|
1103
1100
|
return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
|
|
1104
1101
|
}
|
|
1105
|
-
function
|
|
1102
|
+
function Cn(e) {
|
|
1106
1103
|
return e === "running" || e === "queued";
|
|
1107
1104
|
}
|
|
1108
|
-
function
|
|
1105
|
+
function wn(e, t, n) {
|
|
1109
1106
|
let { status: r, outcome: i } = e;
|
|
1110
|
-
return
|
|
1107
|
+
return Cn(r) ? !1 : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
|
|
1111
1108
|
}
|
|
1112
1109
|
//#endregion
|
|
1113
1110
|
//#region src/core/cells/columns.ts
|
|
1114
|
-
function
|
|
1111
|
+
function Tn(e) {
|
|
1115
1112
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
1116
1113
|
for (let r of e.order) {
|
|
1117
1114
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -1119,9 +1116,9 @@ function wn(e) {
|
|
|
1119
1116
|
}
|
|
1120
1117
|
return t;
|
|
1121
1118
|
}
|
|
1122
|
-
function
|
|
1119
|
+
function En(e) {
|
|
1123
1120
|
let t = [[]];
|
|
1124
|
-
for (let [n, r] of
|
|
1121
|
+
for (let [n, r] of Tn(e)) {
|
|
1125
1122
|
for (; t.length <= r;) t.push([]);
|
|
1126
1123
|
t[r].push(n);
|
|
1127
1124
|
}
|
|
@@ -1129,16 +1126,16 @@ function Tn(e) {
|
|
|
1129
1126
|
}
|
|
1130
1127
|
//#endregion
|
|
1131
1128
|
//#region src/core/dom/ui-element-constants.ts
|
|
1132
|
-
var
|
|
1129
|
+
var Dn = "object-id", On = "random-id", kn = "abcdefghijklmnopqrstuvwxyz", An = kn + kn.toUpperCase(), jn = /* @__PURE__ */ new Set(), z = "__scratch__", Mn = "setup", Nn = { create() {
|
|
1133
1130
|
let e = 0, t;
|
|
1134
1131
|
do {
|
|
1135
1132
|
let n = "";
|
|
1136
|
-
for (let e = 0; e < 4; e++) n +=
|
|
1133
|
+
for (let e = 0; e < 4; e++) n += An[Math.floor(Math.random() * 52)];
|
|
1137
1134
|
t = n, e++;
|
|
1138
|
-
} while (
|
|
1135
|
+
} while (jn.has(t) && e < 100);
|
|
1139
1136
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1140
|
-
return
|
|
1141
|
-
} },
|
|
1137
|
+
return jn.add(t), t;
|
|
1138
|
+
} }, B = {
|
|
1142
1139
|
create(e) {
|
|
1143
1140
|
return C(e != null, "cellId is required"), `cell-${e}`;
|
|
1144
1141
|
},
|
|
@@ -1151,7 +1148,7 @@ var En = "object-id", Dn = "random-id", On = "abcdefghijklmnopqrstuvwxyz", kn =
|
|
|
1151
1148
|
findElementThroughShadowDOMs(e) {
|
|
1152
1149
|
let t = e;
|
|
1153
1150
|
for (; t;) {
|
|
1154
|
-
let e =
|
|
1151
|
+
let e = B.findElement(t);
|
|
1155
1152
|
if (e) return e;
|
|
1156
1153
|
let n = t.getRootNode();
|
|
1157
1154
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -1159,33 +1156,33 @@ var En = "object-id", Dn = "random-id", On = "abcdefghijklmnopqrstuvwxyz", kn =
|
|
|
1159
1156
|
return null;
|
|
1160
1157
|
}
|
|
1161
1158
|
};
|
|
1162
|
-
function
|
|
1163
|
-
let t = null, n =
|
|
1164
|
-
return n && (t =
|
|
1159
|
+
function Pn(e) {
|
|
1160
|
+
let t = null, n = B.findElementThroughShadowDOMs(e);
|
|
1161
|
+
return n && (t = B.parse(n.id)), t;
|
|
1165
1162
|
}
|
|
1166
|
-
var
|
|
1163
|
+
var Fn = {
|
|
1167
1164
|
parse(e) {
|
|
1168
|
-
return e.getAttribute(
|
|
1165
|
+
return e.getAttribute(Dn);
|
|
1169
1166
|
},
|
|
1170
1167
|
parseOrThrow(e) {
|
|
1171
|
-
let t =
|
|
1168
|
+
let t = Fn.parse(e);
|
|
1172
1169
|
return C(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1173
1170
|
}
|
|
1174
|
-
},
|
|
1171
|
+
}, In = { create(e) {
|
|
1175
1172
|
return `output-${e}`;
|
|
1176
|
-
} },
|
|
1177
|
-
function
|
|
1178
|
-
return `column-${
|
|
1173
|
+
} }, Ln = b(/* @__PURE__ */ new Set()), V = b([]), H = b([]);
|
|
1174
|
+
function Rn() {
|
|
1175
|
+
return `column-${Nn.create()}`;
|
|
1179
1176
|
}
|
|
1180
|
-
var
|
|
1181
|
-
let r =
|
|
1177
|
+
var zn = b(null, (e, t, n) => {
|
|
1178
|
+
let r = En(n).length, i = e(V);
|
|
1182
1179
|
if (i.length === r) return;
|
|
1183
|
-
let a = e(
|
|
1184
|
-
for (; o.length < r;) o.push(
|
|
1185
|
-
t(
|
|
1180
|
+
let a = e(H), o = [...i, ...a].slice(0, r);
|
|
1181
|
+
for (; o.length < r;) o.push(Rn());
|
|
1182
|
+
t(V, o), t(H, a.slice(Math.max(0, r - i.length)));
|
|
1186
1183
|
});
|
|
1187
|
-
function
|
|
1188
|
-
return [...(e === null ? [[]] :
|
|
1184
|
+
function Bn(e, t, n) {
|
|
1185
|
+
return [...(e === null ? [[]] : En(e)).map((e, n) => ({
|
|
1189
1186
|
id: t[n] ?? `column-${n}`,
|
|
1190
1187
|
ids: e
|
|
1191
1188
|
})), ...n.map((e) => ({
|
|
@@ -1193,7 +1190,7 @@ function zn(e, t, n) {
|
|
|
1193
1190
|
ids: []
|
|
1194
1191
|
}))];
|
|
1195
1192
|
}
|
|
1196
|
-
function
|
|
1193
|
+
function Vn(e, t, n) {
|
|
1197
1194
|
let r = /* @__PURE__ */ new Map();
|
|
1198
1195
|
return e.forEach((i, a) => {
|
|
1199
1196
|
let o = t[a];
|
|
@@ -1202,9 +1199,9 @@ function Bn(e, t, n) {
|
|
|
1202
1199
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
1203
1200
|
}), r;
|
|
1204
1201
|
}
|
|
1205
|
-
function
|
|
1202
|
+
function Hn(e, t, n) {
|
|
1206
1203
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
1207
|
-
let i =
|
|
1204
|
+
let i = Vn(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
1208
1205
|
return {
|
|
1209
1206
|
id: e,
|
|
1210
1207
|
ids: r,
|
|
@@ -1213,52 +1210,52 @@ function Vn(e, t, n) {
|
|
|
1213
1210
|
};
|
|
1214
1211
|
}) };
|
|
1215
1212
|
}
|
|
1216
|
-
var
|
|
1217
|
-
let t = e(y), n = t === null ? null : e(t.documentAtom), r = e(
|
|
1218
|
-
return
|
|
1219
|
-
}),
|
|
1220
|
-
function
|
|
1213
|
+
var Un = b((e) => {
|
|
1214
|
+
let t = e(y), n = t === null ? null : e(t.documentAtom), r = e(qi);
|
|
1215
|
+
return Hn(Bn(n, e(V), e(H)), (e) => r[e] ?? null, e(Ln));
|
|
1216
|
+
}), Wn = () => _(Un), Gn = b((e) => e(Un).columns.length);
|
|
1217
|
+
function Kn(e, t) {
|
|
1221
1218
|
return e.columns.find((e) => e.id === t);
|
|
1222
1219
|
}
|
|
1223
|
-
function
|
|
1220
|
+
function qn(e, t) {
|
|
1224
1221
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
1225
1222
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
1226
1223
|
return n;
|
|
1227
1224
|
}
|
|
1228
|
-
function
|
|
1225
|
+
function Jn(e, t) {
|
|
1229
1226
|
for (let n of e.columns) {
|
|
1230
1227
|
let e = n.folds.get(t);
|
|
1231
1228
|
if (e !== void 0) return e;
|
|
1232
1229
|
}
|
|
1233
1230
|
}
|
|
1234
|
-
function
|
|
1231
|
+
function Yn(e, t) {
|
|
1235
1232
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
1236
1233
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
1237
1234
|
}
|
|
1238
|
-
function
|
|
1239
|
-
let n =
|
|
1240
|
-
return
|
|
1235
|
+
function Xn(e, t) {
|
|
1236
|
+
let n = Yn(e, t);
|
|
1237
|
+
return Jn(e, t) === void 0 ? n : [...n, t];
|
|
1241
1238
|
}
|
|
1242
|
-
var
|
|
1243
|
-
function
|
|
1239
|
+
var Zn = /* @__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("."));
|
|
1240
|
+
function Qn(e, t = !0) {
|
|
1244
1241
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
1245
1242
|
}
|
|
1246
|
-
function
|
|
1247
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
1243
|
+
function $n(e, t) {
|
|
1244
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !Zn.has(e);
|
|
1248
1245
|
if (i(e)) return e;
|
|
1249
1246
|
let a = 1;
|
|
1250
1247
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
1251
1248
|
return r;
|
|
1252
1249
|
}
|
|
1253
|
-
function
|
|
1254
|
-
return
|
|
1250
|
+
function er(e, t) {
|
|
1251
|
+
return tr(e) ? `cell-${t}` : e;
|
|
1255
1252
|
}
|
|
1256
|
-
function
|
|
1253
|
+
function tr(e) {
|
|
1257
1254
|
return !e || e === "_" || e === "__";
|
|
1258
1255
|
}
|
|
1259
1256
|
//#endregion
|
|
1260
1257
|
//#region src/core/cells/types.ts
|
|
1261
|
-
function
|
|
1258
|
+
function nr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
1262
1259
|
return {
|
|
1263
1260
|
id: e,
|
|
1264
1261
|
config: r || {
|
|
@@ -1271,7 +1268,7 @@ function tr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
1271
1268
|
code: n
|
|
1272
1269
|
};
|
|
1273
1270
|
}
|
|
1274
|
-
function
|
|
1271
|
+
function rr(e) {
|
|
1275
1272
|
return {
|
|
1276
1273
|
hide_code: !1,
|
|
1277
1274
|
disabled: !1,
|
|
@@ -1280,17 +1277,23 @@ function nr(e) {
|
|
|
1280
1277
|
...e
|
|
1281
1278
|
};
|
|
1282
1279
|
}
|
|
1283
|
-
function
|
|
1280
|
+
function ir(e) {
|
|
1284
1281
|
return {
|
|
1285
1282
|
consoleOutputs: [],
|
|
1286
1283
|
debuggerActive: !1,
|
|
1287
1284
|
...e
|
|
1288
1285
|
};
|
|
1289
1286
|
}
|
|
1287
|
+
function ar(e) {
|
|
1288
|
+
return e?.pdbOutput?.length ? {
|
|
1289
|
+
...e,
|
|
1290
|
+
consoleOutputs: [...e.consoleOutputs, ...e.pdbOutput]
|
|
1291
|
+
} : e;
|
|
1292
|
+
}
|
|
1290
1293
|
//#endregion
|
|
1291
1294
|
//#region src/core/cells/document.ts
|
|
1292
|
-
function
|
|
1293
|
-
let n = t.code ?? e.code, r = m(e.config, t.config) ? e.config :
|
|
1295
|
+
function or(e, t) {
|
|
1296
|
+
let n = t.code ?? e.code, r = m(e.config, t.config) ? e.config : rr(t.config);
|
|
1294
1297
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
1295
1298
|
...e,
|
|
1296
1299
|
name: t.name,
|
|
@@ -1302,7 +1305,7 @@ function ir(e, t) {
|
|
|
1302
1305
|
config: r
|
|
1303
1306
|
};
|
|
1304
1307
|
}
|
|
1305
|
-
function
|
|
1308
|
+
function sr(e, t) {
|
|
1306
1309
|
let n = m(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
1307
1310
|
for (let o of n) {
|
|
1308
1311
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
@@ -1310,22 +1313,22 @@ function ar(e, t) {
|
|
|
1310
1313
|
if (s === void 0) {
|
|
1311
1314
|
r = {
|
|
1312
1315
|
...r,
|
|
1313
|
-
[o]:
|
|
1316
|
+
[o]: nr({
|
|
1314
1317
|
id: o,
|
|
1315
1318
|
code: n.code ?? "",
|
|
1316
1319
|
name: n.name,
|
|
1317
|
-
config:
|
|
1320
|
+
config: rr(n.config)
|
|
1318
1321
|
})
|
|
1319
1322
|
}, i = {
|
|
1320
1323
|
...i,
|
|
1321
|
-
[o]: i[o] ??
|
|
1324
|
+
[o]: i[o] ?? ir()
|
|
1322
1325
|
}, a = {
|
|
1323
1326
|
...a,
|
|
1324
1327
|
[o]: (0, w.createRef)()
|
|
1325
1328
|
};
|
|
1326
1329
|
continue;
|
|
1327
1330
|
}
|
|
1328
|
-
let c =
|
|
1331
|
+
let c = or(s, n);
|
|
1329
1332
|
c !== s && (r = {
|
|
1330
1333
|
...r,
|
|
1331
1334
|
[o]: c
|
|
@@ -1344,50 +1347,50 @@ function ar(e, t) {
|
|
|
1344
1347
|
cellHandles: a
|
|
1345
1348
|
};
|
|
1346
1349
|
}
|
|
1347
|
-
function
|
|
1350
|
+
function cr({ store: e, model: t, reconcile: n, signal: r }) {
|
|
1348
1351
|
let i = () => {
|
|
1349
1352
|
let r = e.get(t.documentAtom);
|
|
1350
|
-
r !== null && (n(r), e.set(
|
|
1353
|
+
r !== null && (n(r), e.set(zn, r));
|
|
1351
1354
|
}, a = e.sub(t.documentAtom, i);
|
|
1352
1355
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
1353
1356
|
}
|
|
1354
|
-
async function
|
|
1357
|
+
async function lr() {
|
|
1355
1358
|
let e = v.get(y);
|
|
1356
1359
|
e !== null && v.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
1357
1360
|
}
|
|
1358
1361
|
//#endregion
|
|
1359
1362
|
//#region src/core/cells/editor.ts
|
|
1360
|
-
var
|
|
1361
|
-
function
|
|
1363
|
+
var U = b(/* @__PURE__ */ new Set());
|
|
1364
|
+
function ur(e, t, n) {
|
|
1362
1365
|
return !!e && !t.has(n);
|
|
1363
1366
|
}
|
|
1364
1367
|
b(null, (e, t, { cellId: n }) => {
|
|
1365
|
-
t(
|
|
1366
|
-
}), b(null, (e, t, { cellId: n }) => e(
|
|
1368
|
+
t(U, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
1369
|
+
}), b(null, (e, t, { cellId: n }) => e(U).has(n) ? (t(U, (e) => {
|
|
1367
1370
|
let t = new Set(e);
|
|
1368
1371
|
return t.delete(n), t;
|
|
1369
1372
|
}), !0) : !1);
|
|
1370
|
-
var
|
|
1373
|
+
var dr = b(/* @__PURE__ */ new Map());
|
|
1371
1374
|
b(null, (e, t, { cellId: n }) => {
|
|
1372
|
-
t(
|
|
1375
|
+
t(dr, (e) => {
|
|
1373
1376
|
let t = new Map(e);
|
|
1374
1377
|
return t.delete(n), t;
|
|
1375
1378
|
});
|
|
1376
1379
|
});
|
|
1377
1380
|
//#endregion
|
|
1378
1381
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1379
|
-
function
|
|
1382
|
+
function fr(e, t) {
|
|
1380
1383
|
return be(e * 1e3, t?.in);
|
|
1381
1384
|
}
|
|
1382
1385
|
//#endregion
|
|
1383
1386
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1384
|
-
var
|
|
1387
|
+
var pr = function(e, t) {
|
|
1385
1388
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1386
|
-
},
|
|
1389
|
+
}, W;
|
|
1387
1390
|
(function(e) {
|
|
1388
1391
|
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";
|
|
1389
|
-
})(
|
|
1390
|
-
var
|
|
1392
|
+
})(W ||= {});
|
|
1393
|
+
var mr = class {
|
|
1391
1394
|
constructor() {
|
|
1392
1395
|
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 = {
|
|
1393
1396
|
http: 1,
|
|
@@ -1619,57 +1622,57 @@ var fr = class {
|
|
|
1619
1622
|
}
|
|
1620
1623
|
get_next_packet() {
|
|
1621
1624
|
var e = {
|
|
1622
|
-
kind:
|
|
1625
|
+
kind: W.EOS,
|
|
1623
1626
|
text: "",
|
|
1624
1627
|
url: ""
|
|
1625
1628
|
}, t = this._buffer.length;
|
|
1626
1629
|
if (t == 0) return e;
|
|
1627
1630
|
var n = this._buffer.indexOf("\x1B");
|
|
1628
|
-
if (n == -1) return e.kind =
|
|
1629
|
-
if (n > 0) return e.kind =
|
|
1631
|
+
if (n == -1) return e.kind = W.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1632
|
+
if (n > 0) return e.kind = W.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1630
1633
|
if (n == 0) {
|
|
1631
|
-
if (t < 3) return e.kind =
|
|
1634
|
+
if (t < 3) return e.kind = W.Incomplete, e;
|
|
1632
1635
|
var r = this._buffer.charAt(1);
|
|
1633
|
-
if (r != "[" && r != "]" && r != "(") return e.kind =
|
|
1636
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1634
1637
|
if (r == "[") {
|
|
1635
|
-
this._csi_regex ||=
|
|
1638
|
+
this._csi_regex ||= hr(_r ||= pr(["\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 "]));
|
|
1636
1639
|
let t = this._buffer.match(this._csi_regex);
|
|
1637
|
-
if (t === null) return e.kind =
|
|
1638
|
-
if (t[4]) return e.kind =
|
|
1639
|
-
e.kind = t[1] != "" || t[3] != "m" ?
|
|
1640
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1641
|
+
if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1642
|
+
e.kind = t[1] != "" || t[3] != "m" ? W.Unknown : W.SGR, e.text = t[2];
|
|
1640
1643
|
var i = t[0].length;
|
|
1641
1644
|
return this._buffer = this._buffer.slice(i), e;
|
|
1642
1645
|
}
|
|
1643
1646
|
if (r == "]") {
|
|
1644
|
-
if (t < 4) return e.kind =
|
|
1645
|
-
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind =
|
|
1646
|
-
this._osc_st ||=
|
|
1647
|
+
if (t < 4) return e.kind = W.Incomplete, e;
|
|
1648
|
+
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1649
|
+
this._osc_st ||= gr(vr ||= pr(["\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;
|
|
1647
1650
|
{
|
|
1648
1651
|
let t = this._osc_st.exec(this._buffer);
|
|
1649
|
-
if (t === null) return e.kind =
|
|
1650
|
-
if (t[3]) return e.kind =
|
|
1652
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1653
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1651
1654
|
}
|
|
1652
1655
|
{
|
|
1653
1656
|
let t = this._osc_st.exec(this._buffer);
|
|
1654
|
-
if (t === null) return e.kind =
|
|
1655
|
-
if (t[3]) return e.kind =
|
|
1657
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1658
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1656
1659
|
}
|
|
1657
|
-
this._osc_regex ||=
|
|
1660
|
+
this._osc_regex ||= hr(yr ||= pr(["\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 "]));
|
|
1658
1661
|
let n = this._buffer.match(this._osc_regex);
|
|
1659
|
-
if (n === null) return e.kind =
|
|
1660
|
-
e.kind =
|
|
1662
|
+
if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1663
|
+
e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
|
|
1661
1664
|
var i = n[0].length;
|
|
1662
1665
|
return this._buffer = this._buffer.slice(i), e;
|
|
1663
1666
|
}
|
|
1664
|
-
if (r == "(") return e.kind =
|
|
1667
|
+
if (r == "(") return e.kind = W.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1665
1668
|
}
|
|
1666
1669
|
}
|
|
1667
1670
|
ansi_to_html(e) {
|
|
1668
1671
|
this.append_buffer(e);
|
|
1669
1672
|
for (var t = [];;) {
|
|
1670
1673
|
var n = this.get_next_packet();
|
|
1671
|
-
if (n.kind ==
|
|
1672
|
-
n.kind !=
|
|
1674
|
+
if (n.kind == W.EOS || n.kind == W.Incomplete) break;
|
|
1675
|
+
n.kind != W.ESC && n.kind != W.Unknown && (n.kind == W.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == W.SGR ? this.process_ansi(n) : n.kind == W.OSCURL && t.push(this.process_hyperlink(n)));
|
|
1673
1676
|
}
|
|
1674
1677
|
return t.join("");
|
|
1675
1678
|
}
|
|
@@ -1739,16 +1742,16 @@ var fr = class {
|
|
|
1739
1742
|
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>`;
|
|
1740
1743
|
}
|
|
1741
1744
|
};
|
|
1742
|
-
function
|
|
1745
|
+
function hr(e, ...t) {
|
|
1743
1746
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1744
1747
|
return new RegExp(n);
|
|
1745
1748
|
}
|
|
1746
|
-
function
|
|
1749
|
+
function gr(e, ...t) {
|
|
1747
1750
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1748
1751
|
return new RegExp(n, "g");
|
|
1749
1752
|
}
|
|
1750
|
-
var
|
|
1751
|
-
function
|
|
1753
|
+
var _r, vr, yr, br = new mr();
|
|
1754
|
+
function G(e) {
|
|
1752
1755
|
try {
|
|
1753
1756
|
let t = document.createElement("div");
|
|
1754
1757
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
@@ -1756,24 +1759,24 @@ function K(e) {
|
|
|
1756
1759
|
return t.error("Error parsing HTML content:", n), e;
|
|
1757
1760
|
}
|
|
1758
1761
|
}
|
|
1759
|
-
function
|
|
1762
|
+
function xr(e) {
|
|
1760
1763
|
if (!e) return "";
|
|
1761
1764
|
try {
|
|
1762
|
-
return
|
|
1765
|
+
return G(br.ansi_to_html(e));
|
|
1763
1766
|
} catch (n) {
|
|
1764
1767
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1765
1768
|
}
|
|
1766
1769
|
}
|
|
1767
1770
|
//#endregion
|
|
1768
1771
|
//#region src/core/errors/traceback-atom.ts
|
|
1769
|
-
var
|
|
1772
|
+
var Sr = b(null);
|
|
1770
1773
|
//#endregion
|
|
1771
1774
|
//#region src/core/cells/logs.ts
|
|
1772
|
-
function
|
|
1775
|
+
function Cr(e) {
|
|
1773
1776
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1774
1777
|
}
|
|
1775
|
-
var
|
|
1776
|
-
function
|
|
1778
|
+
var wr = !1;
|
|
1779
|
+
function Tr(e) {
|
|
1777
1780
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1778
1781
|
for (let r of n) {
|
|
1779
1782
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1783,7 +1786,7 @@ function Cr(e) {
|
|
|
1783
1786
|
case "stdout":
|
|
1784
1787
|
case "stderr":
|
|
1785
1788
|
case "marimo-error": {
|
|
1786
|
-
let a = d.asString(r.data), o = i ?
|
|
1789
|
+
let a = d.asString(r.data), o = i ? G(a) : a;
|
|
1787
1790
|
t.push({
|
|
1788
1791
|
timestamp: r.timestamp || Date.now(),
|
|
1789
1792
|
level: n ? "stderr" : "stdout",
|
|
@@ -1798,9 +1801,9 @@ function Cr(e) {
|
|
|
1798
1801
|
}
|
|
1799
1802
|
}
|
|
1800
1803
|
}
|
|
1801
|
-
if (t.forEach(
|
|
1804
|
+
if (t.forEach(Er.log), n.length === 0 && R(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1802
1805
|
e.output.data.forEach((t) => {
|
|
1803
|
-
|
|
1806
|
+
Er.log({
|
|
1804
1807
|
level: "stderr",
|
|
1805
1808
|
source: {
|
|
1806
1809
|
type: "cell",
|
|
@@ -1811,8 +1814,8 @@ function Cr(e) {
|
|
|
1811
1814
|
});
|
|
1812
1815
|
});
|
|
1813
1816
|
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = v.get(_e) === "read";
|
|
1814
|
-
if (t.length > 0 && !
|
|
1815
|
-
|
|
1817
|
+
if (t.length > 0 && !wr && n) {
|
|
1818
|
+
wr = !0;
|
|
1816
1819
|
let e = t.find((e) => e.traceback);
|
|
1817
1820
|
o(e ? {
|
|
1818
1821
|
title: "An internal error occurred",
|
|
@@ -1821,7 +1824,7 @@ function Cr(e) {
|
|
|
1821
1824
|
action: w.createElement(ce, {
|
|
1822
1825
|
altText: "View traceback",
|
|
1823
1826
|
onClick: () => {
|
|
1824
|
-
v.set(
|
|
1827
|
+
v.set(Sr, {
|
|
1825
1828
|
traceback: e.traceback,
|
|
1826
1829
|
errorMessage: e.msg || "An internal error occurred"
|
|
1827
1830
|
});
|
|
@@ -1836,13 +1839,13 @@ function Cr(e) {
|
|
|
1836
1839
|
}
|
|
1837
1840
|
return t;
|
|
1838
1841
|
}
|
|
1839
|
-
var
|
|
1842
|
+
var Er = { log: (e) => {
|
|
1840
1843
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1841
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1844
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Dr(e.timestamp)}]`, `(${Cr(e.source)}) ${e.message}`);
|
|
1842
1845
|
} };
|
|
1843
|
-
function
|
|
1846
|
+
function Dr(e) {
|
|
1844
1847
|
try {
|
|
1845
|
-
return
|
|
1848
|
+
return fr(e).toLocaleTimeString(void 0, {
|
|
1846
1849
|
hour12: !0,
|
|
1847
1850
|
hour: "numeric",
|
|
1848
1851
|
minute: "numeric",
|
|
@@ -1854,14 +1857,14 @@ function Tr(e) {
|
|
|
1854
1857
|
}
|
|
1855
1858
|
//#endregion
|
|
1856
1859
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
1857
|
-
function
|
|
1858
|
-
let r = document.getElementById(
|
|
1859
|
-
r ?
|
|
1860
|
+
function Or(e, n) {
|
|
1861
|
+
let r = document.getElementById(B.create(e));
|
|
1862
|
+
r ? Ar(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
1860
1863
|
}
|
|
1861
|
-
function
|
|
1864
|
+
function kr() {
|
|
1862
1865
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
1863
1866
|
}
|
|
1864
|
-
function
|
|
1867
|
+
function Ar(e, n) {
|
|
1865
1868
|
try {
|
|
1866
1869
|
e.focus(n);
|
|
1867
1870
|
} catch {
|
|
@@ -1870,7 +1873,7 @@ function Or(e, n) {
|
|
|
1870
1873
|
}
|
|
1871
1874
|
//#endregion
|
|
1872
1875
|
//#region src/utils/timeout.ts
|
|
1873
|
-
function
|
|
1876
|
+
function jr(e, n) {
|
|
1874
1877
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
1875
1878
|
if (o < r) {
|
|
1876
1879
|
try {
|
|
@@ -1885,75 +1888,75 @@ function kr(e, n) {
|
|
|
1885
1888
|
}
|
|
1886
1889
|
//#endregion
|
|
1887
1890
|
//#region src/core/cells/utils.ts
|
|
1888
|
-
function
|
|
1891
|
+
function Mr(e) {
|
|
1889
1892
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
1890
1893
|
}
|
|
1891
|
-
function
|
|
1894
|
+
function Nr(e) {
|
|
1892
1895
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1893
1896
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
1894
1897
|
return r;
|
|
1895
1898
|
}
|
|
1896
|
-
function
|
|
1899
|
+
function Pr(e) {
|
|
1897
1900
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1898
1901
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
1899
1902
|
return r;
|
|
1900
1903
|
}
|
|
1901
|
-
function
|
|
1904
|
+
function Fr(e) {
|
|
1902
1905
|
return e.history.length > 0;
|
|
1903
1906
|
}
|
|
1904
|
-
function
|
|
1907
|
+
function Ir(e) {
|
|
1905
1908
|
let t = e.history[e.history.length - 1];
|
|
1906
1909
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
1907
1910
|
}
|
|
1908
|
-
function
|
|
1909
|
-
return e.status === "idle" ?
|
|
1911
|
+
function Lr(e, t, n) {
|
|
1912
|
+
return e.status === "idle" ? Vr(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "interrupted" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
1910
1913
|
}
|
|
1911
|
-
function*
|
|
1914
|
+
function* Rr(e, t, n) {
|
|
1912
1915
|
for (let r of e.cellIds) {
|
|
1913
|
-
let i = Ct(t, r), a = n(r), o =
|
|
1914
|
-
o === null ? a.sourceChanged &&
|
|
1916
|
+
let i = Ct(t, r), a = n(r), o = Lr(i, a, e.cellData[r]);
|
|
1917
|
+
o === null ? a.sourceChanged && Br(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
1915
1918
|
}
|
|
1916
1919
|
}
|
|
1917
|
-
function
|
|
1920
|
+
function zr(e, t, n) {
|
|
1918
1921
|
let r = null;
|
|
1919
|
-
for (let [, i] of
|
|
1922
|
+
for (let [, i] of Rr(e, t, n)) {
|
|
1920
1923
|
if (i !== "inputs") return i;
|
|
1921
1924
|
r = i;
|
|
1922
1925
|
}
|
|
1923
1926
|
return r;
|
|
1924
1927
|
}
|
|
1925
|
-
function
|
|
1928
|
+
function Br(e, t) {
|
|
1926
1929
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
1927
1930
|
return r !== void 0 && r.status !== "completed";
|
|
1928
1931
|
}
|
|
1929
|
-
function
|
|
1932
|
+
function Vr({ status: e, outcome: t, live: n }) {
|
|
1930
1933
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
1931
1934
|
}
|
|
1932
|
-
function
|
|
1935
|
+
function Hr({ errored: e, stopped: t }) {
|
|
1933
1936
|
return {
|
|
1934
1937
|
published: !0,
|
|
1935
1938
|
"has-error": e,
|
|
1936
1939
|
stopped: t
|
|
1937
1940
|
};
|
|
1938
1941
|
}
|
|
1939
|
-
function
|
|
1942
|
+
function Ur({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
1940
1943
|
let a = R(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
1941
1944
|
return (e || t || n || a) && !o;
|
|
1942
1945
|
}
|
|
1943
1946
|
//#endregion
|
|
1944
1947
|
//#region src/core/network/requests.ts
|
|
1945
|
-
var
|
|
1946
|
-
function
|
|
1947
|
-
let e = _(
|
|
1948
|
+
var Wr = b(null);
|
|
1949
|
+
function Gr() {
|
|
1950
|
+
let e = _(Wr);
|
|
1948
1951
|
return C(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
1949
1952
|
}
|
|
1950
|
-
function
|
|
1951
|
-
let e = v.get(
|
|
1953
|
+
function Kr() {
|
|
1954
|
+
let e = v.get(Wr);
|
|
1952
1955
|
return C(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
1953
1956
|
}
|
|
1954
1957
|
//#endregion
|
|
1955
1958
|
//#region src/utils/storage/storage.ts
|
|
1956
|
-
var
|
|
1959
|
+
var qr = class {
|
|
1957
1960
|
store = /* @__PURE__ */ new Map();
|
|
1958
1961
|
get length() {
|
|
1959
1962
|
return this.store.size;
|
|
@@ -1974,16 +1977,16 @@ var Gr = class {
|
|
|
1974
1977
|
this.store.set(e, t);
|
|
1975
1978
|
}
|
|
1976
1979
|
};
|
|
1977
|
-
function
|
|
1980
|
+
function Jr() {
|
|
1978
1981
|
let { hasLocalStorage: e, hasSessionStorage: t } = xe();
|
|
1979
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
1982
|
+
return e ? window.localStorage : t ? window.sessionStorage : new qr();
|
|
1980
1983
|
}
|
|
1981
|
-
var
|
|
1982
|
-
function
|
|
1983
|
-
return
|
|
1984
|
+
var Yr = Jr(), Xr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Zr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Qr = /^data:image\//i, $r = ["avatars.githubusercontent.com"];
|
|
1985
|
+
function ei(e) {
|
|
1986
|
+
return Qr.test(e) ? [{
|
|
1984
1987
|
type: "image",
|
|
1985
1988
|
url: e
|
|
1986
|
-
}] : e.split(
|
|
1989
|
+
}] : e.split(Xr).filter((e) => e !== "").map((e) => Xr.test(e) ? Zr.test(e) || Qr.test(e) || $r.some((t) => e.includes(t)) ? {
|
|
1987
1990
|
type: "image",
|
|
1988
1991
|
url: e
|
|
1989
1992
|
} : {
|
|
@@ -1996,48 +1999,48 @@ function Qr(e) {
|
|
|
1996
1999
|
}
|
|
1997
2000
|
//#endregion
|
|
1998
2001
|
//#region src/utils/json/json-parser.ts
|
|
1999
|
-
var
|
|
2002
|
+
var ti = new RegExp(Xr.source, "g");
|
|
2000
2003
|
BigInt.prototype.toJSON = function() {
|
|
2001
2004
|
return JSON.rawJSON(this.toString());
|
|
2002
2005
|
};
|
|
2003
|
-
function
|
|
2006
|
+
function ni(e) {
|
|
2004
2007
|
try {
|
|
2005
|
-
return JSON.parse(e, (e, t) =>
|
|
2008
|
+
return JSON.parse(e, (e, t) => oi(t));
|
|
2006
2009
|
} catch {}
|
|
2007
2010
|
if (e == null || e === "") return {};
|
|
2008
2011
|
try {
|
|
2009
|
-
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 :
|
|
2012
|
+
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 : oi(t) : oi(t));
|
|
2010
2013
|
} catch {
|
|
2011
2014
|
return {};
|
|
2012
2015
|
}
|
|
2013
2016
|
}
|
|
2014
|
-
function
|
|
2017
|
+
function ri(e) {
|
|
2015
2018
|
if (e.length === 0) return "";
|
|
2016
2019
|
let t = Object.keys(e[0]);
|
|
2017
2020
|
return [
|
|
2018
2021
|
`| ${t.join(" | ")} |`,
|
|
2019
2022
|
`|${t.map(() => "---").join("|")}|`,
|
|
2020
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2023
|
+
...e.map((e) => `| ${t.map((t) => ii(e[t])).join(" | ")} |`)
|
|
2021
2024
|
].join("\n");
|
|
2022
2025
|
}
|
|
2023
|
-
function
|
|
2026
|
+
function ii(e) {
|
|
2024
2027
|
if (e == null) return "";
|
|
2025
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2028
|
+
if (Array.isArray(e) || typeof e == "object") return ai(JSON.stringify(e));
|
|
2026
2029
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2027
2030
|
t = t.replaceAll(n, (e) => {
|
|
2028
2031
|
let t = `__MDLINK_${i++}__`;
|
|
2029
2032
|
return r.set(t, e), t;
|
|
2030
|
-
}), t = t.replaceAll(
|
|
2033
|
+
}), t = t.replaceAll(ti, "[$1]($1)");
|
|
2031
2034
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2032
|
-
return
|
|
2035
|
+
return ai(t);
|
|
2033
2036
|
}
|
|
2034
|
-
function
|
|
2037
|
+
function ai(e) {
|
|
2035
2038
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2036
2039
|
}
|
|
2037
|
-
function
|
|
2040
|
+
function oi(e) {
|
|
2038
2041
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2039
2042
|
}
|
|
2040
|
-
var
|
|
2043
|
+
var si = new class {
|
|
2041
2044
|
getFilename() {
|
|
2042
2045
|
return this.getSearchParam("filename");
|
|
2043
2046
|
}
|
|
@@ -2064,20 +2067,20 @@ var ai = new class {
|
|
|
2064
2067
|
}();
|
|
2065
2068
|
//#endregion
|
|
2066
2069
|
//#region src/core/dom/htmlUtils.ts
|
|
2067
|
-
function
|
|
2068
|
-
return
|
|
2070
|
+
function ci(e) {
|
|
2071
|
+
return ni(e ?? "");
|
|
2069
2072
|
}
|
|
2070
|
-
function
|
|
2071
|
-
return le.mapValues(e.dataset, (e) => typeof e == "string" ?
|
|
2073
|
+
function li(e) {
|
|
2074
|
+
return le.mapValues(e.dataset, (e) => typeof e == "string" ? ci(e) : e);
|
|
2072
2075
|
}
|
|
2073
|
-
function
|
|
2074
|
-
let n = e.parentElement ?
|
|
2075
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2076
|
+
function ui(e, t) {
|
|
2077
|
+
let n = e.parentElement ? Fn.parse(e.parentElement) : void 0;
|
|
2078
|
+
return n && t.has(n) ? t.lookupValue(n) : ci(e.dataset.initialValue);
|
|
2076
2079
|
}
|
|
2077
|
-
function
|
|
2080
|
+
function di() {
|
|
2078
2081
|
if (x()) return document.title || null;
|
|
2079
2082
|
if (ye()) {
|
|
2080
|
-
let e =
|
|
2083
|
+
let e = si.getFilename();
|
|
2081
2084
|
if (e) return e;
|
|
2082
2085
|
}
|
|
2083
2086
|
let e = document.querySelector("marimo-filename");
|
|
@@ -2087,16 +2090,16 @@ function li() {
|
|
|
2087
2090
|
}
|
|
2088
2091
|
//#endregion
|
|
2089
2092
|
//#region src/core/saving/file-state.ts
|
|
2090
|
-
var
|
|
2093
|
+
var K = b(di());
|
|
2091
2094
|
b(null);
|
|
2092
|
-
var
|
|
2095
|
+
var fi = b(null);
|
|
2093
2096
|
b(void 0);
|
|
2094
2097
|
//#endregion
|
|
2095
2098
|
//#region src/utils/storage/typed.ts
|
|
2096
|
-
var
|
|
2099
|
+
var pi = class {
|
|
2097
2100
|
defaultValue;
|
|
2098
2101
|
storage;
|
|
2099
|
-
constructor(e, t =
|
|
2102
|
+
constructor(e, t = Yr) {
|
|
2100
2103
|
this.defaultValue = e, this.storage = t;
|
|
2101
2104
|
}
|
|
2102
2105
|
get(e) {
|
|
@@ -2113,11 +2116,11 @@ var di = class {
|
|
|
2113
2116
|
remove(e) {
|
|
2114
2117
|
this.storage.removeItem(e);
|
|
2115
2118
|
}
|
|
2116
|
-
},
|
|
2119
|
+
}, mi = class {
|
|
2117
2120
|
schema;
|
|
2118
2121
|
getDefaultValue;
|
|
2119
2122
|
storage;
|
|
2120
|
-
constructor(e, t, n =
|
|
2123
|
+
constructor(e, t, n = Yr) {
|
|
2121
2124
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2122
2125
|
}
|
|
2123
2126
|
get(e) {
|
|
@@ -2136,15 +2139,15 @@ var di = class {
|
|
|
2136
2139
|
remove(e) {
|
|
2137
2140
|
this.storage.removeItem(e);
|
|
2138
2141
|
}
|
|
2139
|
-
},
|
|
2142
|
+
}, hi = class extends mi {
|
|
2140
2143
|
filename;
|
|
2141
2144
|
unsubscribeFromFilename;
|
|
2142
2145
|
constructor(e, t, n) {
|
|
2143
|
-
let r = v.get(
|
|
2146
|
+
let r = v.get(K);
|
|
2144
2147
|
super(t, n), this.filename = r;
|
|
2145
2148
|
try {
|
|
2146
|
-
this.unsubscribeFromFilename = v.sub(
|
|
2147
|
-
let t = v.get(
|
|
2149
|
+
this.unsubscribeFromFilename = v.sub(K, () => {
|
|
2150
|
+
let t = v.get(K);
|
|
2148
2151
|
this.handleFilenameChange(e, t);
|
|
2149
2152
|
});
|
|
2150
2153
|
} catch {
|
|
@@ -2172,7 +2175,7 @@ var di = class {
|
|
|
2172
2175
|
dispose() {
|
|
2173
2176
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2174
2177
|
}
|
|
2175
|
-
},
|
|
2178
|
+
}, q = {
|
|
2176
2179
|
VariableName: "VariableName",
|
|
2177
2180
|
FunctionDefinition: "FunctionDefinition",
|
|
2178
2181
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2197,30 +2200,30 @@ var di = class {
|
|
|
2197
2200
|
Comment: "Comment",
|
|
2198
2201
|
String: "String",
|
|
2199
2202
|
FormatString: "FormatString"
|
|
2200
|
-
},
|
|
2203
|
+
}, J = {
|
|
2201
2204
|
For: "for",
|
|
2202
2205
|
In: "in",
|
|
2203
2206
|
As: "as",
|
|
2204
2207
|
Import: "import"
|
|
2205
|
-
},
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2208
|
+
}, gi = /* @__PURE__ */ new Set([
|
|
2209
|
+
q.FunctionDefinition,
|
|
2210
|
+
q.LambdaExpression,
|
|
2211
|
+
q.ArrayComprehensionExpression,
|
|
2212
|
+
q.SetComprehensionExpression,
|
|
2213
|
+
q.DictionaryComprehensionExpression,
|
|
2214
|
+
q.ComprehensionExpression,
|
|
2215
|
+
q.ClassDefinition
|
|
2213
2216
|
]);
|
|
2214
|
-
|
|
2217
|
+
q.Comment, q.String, q.FormatString;
|
|
2215
2218
|
//#endregion
|
|
2216
2219
|
//#region src/core/codemirror/utils.ts
|
|
2217
|
-
function
|
|
2220
|
+
function _i(e) {
|
|
2218
2221
|
e && e.dispatch({ selection: {
|
|
2219
2222
|
anchor: e.state.doc.length,
|
|
2220
2223
|
head: e.state.doc.length
|
|
2221
2224
|
} });
|
|
2222
2225
|
}
|
|
2223
|
-
function
|
|
2226
|
+
function vi(e) {
|
|
2224
2227
|
let t = e.dom.closest(".marimo-cell");
|
|
2225
2228
|
t && requestAnimationFrame(() => {
|
|
2226
2229
|
t.scrollIntoView({
|
|
@@ -2232,8 +2235,8 @@ function gi(e) {
|
|
|
2232
2235
|
}
|
|
2233
2236
|
//#endregion
|
|
2234
2237
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2235
|
-
var
|
|
2236
|
-
function
|
|
2238
|
+
var yi = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2239
|
+
function bi(e, t) {
|
|
2237
2240
|
requestAnimationFrame(() => {
|
|
2238
2241
|
e.focus(), e.dispatch({
|
|
2239
2242
|
selection: {
|
|
@@ -2242,19 +2245,19 @@ function vi(e, t) {
|
|
|
2242
2245
|
},
|
|
2243
2246
|
effects: fe.scrollIntoView(t, { y: "center" })
|
|
2244
2247
|
});
|
|
2245
|
-
}),
|
|
2248
|
+
}), vi(e);
|
|
2246
2249
|
}
|
|
2247
|
-
function
|
|
2250
|
+
function xi(e, t) {
|
|
2248
2251
|
let n = pe(e), r = null;
|
|
2249
2252
|
return n.iterate({ enter: (n) => {
|
|
2250
2253
|
if (r !== null) return !1;
|
|
2251
|
-
if (n.name ===
|
|
2252
|
-
if (n.name ===
|
|
2254
|
+
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2255
|
+
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2253
2256
|
} }), r;
|
|
2254
2257
|
}
|
|
2255
|
-
function
|
|
2258
|
+
function Si(e, t) {
|
|
2256
2259
|
let n = [], r = e.resolveInner(t, 0);
|
|
2257
|
-
for (; r;)
|
|
2260
|
+
for (; r;) gi.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2258
2261
|
id: r.from,
|
|
2259
2262
|
type: r.name
|
|
2260
2263
|
})), r = r.parent;
|
|
@@ -2263,70 +2266,70 @@ function bi(e, t) {
|
|
|
2263
2266
|
type: "global"
|
|
2264
2267
|
}), n;
|
|
2265
2268
|
}
|
|
2266
|
-
function
|
|
2269
|
+
function Y(e, t, n) {
|
|
2267
2270
|
e.push({
|
|
2268
2271
|
scopeId: t,
|
|
2269
2272
|
from: n
|
|
2270
2273
|
});
|
|
2271
2274
|
}
|
|
2272
|
-
function
|
|
2275
|
+
function Ci(e, t) {
|
|
2273
2276
|
if (e.firstChild()) do
|
|
2274
2277
|
t(e.node);
|
|
2275
2278
|
while (e.nextSibling());
|
|
2276
2279
|
}
|
|
2277
|
-
function
|
|
2280
|
+
function wi(e, t) {
|
|
2278
2281
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2279
2282
|
switch (e.name) {
|
|
2280
|
-
case
|
|
2281
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2283
|
+
case q.VariableName:
|
|
2284
|
+
n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2282
2285
|
break;
|
|
2283
|
-
case
|
|
2284
|
-
case
|
|
2286
|
+
case q.TupleExpression:
|
|
2287
|
+
case q.ArrayExpression: {
|
|
2285
2288
|
let n = e.node.cursor();
|
|
2286
2289
|
n.firstChild();
|
|
2287
2290
|
do
|
|
2288
|
-
|
|
2291
|
+
wi(n, t);
|
|
2289
2292
|
while (n.nextSibling());
|
|
2290
2293
|
break;
|
|
2291
2294
|
}
|
|
2292
2295
|
}
|
|
2293
2296
|
}
|
|
2294
|
-
function
|
|
2297
|
+
function Ti(e, t) {
|
|
2295
2298
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2296
2299
|
o.firstChild();
|
|
2297
2300
|
do {
|
|
2298
|
-
if (o.name !==
|
|
2301
|
+
if (o.name !== q.ParamList) continue;
|
|
2299
2302
|
let e = o.node.cursor();
|
|
2300
2303
|
e.firstChild();
|
|
2301
2304
|
do
|
|
2302
|
-
e.name ===
|
|
2305
|
+
e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2303
2306
|
while (e.nextSibling());
|
|
2304
2307
|
} while (o.nextSibling());
|
|
2305
2308
|
}
|
|
2306
|
-
function
|
|
2309
|
+
function Ei(e, t) {
|
|
2307
2310
|
let n = e.cursor();
|
|
2308
2311
|
n.firstChild();
|
|
2309
2312
|
let r = !1;
|
|
2310
2313
|
do
|
|
2311
|
-
if (n.name ===
|
|
2312
|
-
else if (r && n.name ===
|
|
2313
|
-
else r &&
|
|
2314
|
+
if (n.name === J.For) r = !0;
|
|
2315
|
+
else if (r && n.name === J.In) break;
|
|
2316
|
+
else r && wi(n, t);
|
|
2314
2317
|
while (n.nextSibling());
|
|
2315
2318
|
}
|
|
2316
|
-
function
|
|
2317
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2319
|
+
function Di(e, t) {
|
|
2320
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = gi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2318
2321
|
switch (s) {
|
|
2319
|
-
case
|
|
2320
|
-
case
|
|
2322
|
+
case q.FunctionDefinition:
|
|
2323
|
+
case q.ClassDefinition: {
|
|
2321
2324
|
let t = e.cursor();
|
|
2322
2325
|
t.firstChild();
|
|
2323
2326
|
do
|
|
2324
|
-
if (t.name ===
|
|
2325
|
-
|
|
2327
|
+
if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2328
|
+
Y(a, i[i.length - 1] ?? -1, t.from);
|
|
2326
2329
|
break;
|
|
2327
2330
|
}
|
|
2328
2331
|
while (t.nextSibling());
|
|
2329
|
-
s ===
|
|
2332
|
+
s === q.FunctionDefinition && Ti(e, {
|
|
2330
2333
|
state: n,
|
|
2331
2334
|
variableName: r,
|
|
2332
2335
|
scopeId: c,
|
|
@@ -2334,38 +2337,38 @@ function Ti(e, t) {
|
|
|
2334
2337
|
});
|
|
2335
2338
|
break;
|
|
2336
2339
|
}
|
|
2337
|
-
case
|
|
2338
|
-
|
|
2340
|
+
case q.LambdaExpression:
|
|
2341
|
+
Ti(e, {
|
|
2339
2342
|
state: n,
|
|
2340
2343
|
variableName: r,
|
|
2341
2344
|
scopeId: c,
|
|
2342
2345
|
declarations: a
|
|
2343
2346
|
});
|
|
2344
2347
|
break;
|
|
2345
|
-
case
|
|
2346
|
-
case
|
|
2347
|
-
case
|
|
2348
|
-
case
|
|
2349
|
-
case
|
|
2350
|
-
|
|
2348
|
+
case q.ArrayComprehensionExpression:
|
|
2349
|
+
case q.DictionaryComprehensionExpression:
|
|
2350
|
+
case q.SetComprehensionExpression:
|
|
2351
|
+
case q.ComprehensionExpression:
|
|
2352
|
+
case q.ForStatement:
|
|
2353
|
+
Ei(e, {
|
|
2351
2354
|
state: n,
|
|
2352
2355
|
variableName: r,
|
|
2353
2356
|
scopeId: u,
|
|
2354
2357
|
declarations: a
|
|
2355
2358
|
});
|
|
2356
2359
|
break;
|
|
2357
|
-
case
|
|
2360
|
+
case q.AssignStatement: {
|
|
2358
2361
|
let t = [], i = e.cursor();
|
|
2359
2362
|
i.firstChild();
|
|
2360
2363
|
do
|
|
2361
|
-
i.name ===
|
|
2364
|
+
i.name === q.AssignOp && t.push(i.from);
|
|
2362
2365
|
while (i.nextSibling());
|
|
2363
2366
|
let o = t[t.length - 1];
|
|
2364
2367
|
if (o === void 0) break;
|
|
2365
2368
|
let s = e.cursor();
|
|
2366
2369
|
s.firstChild();
|
|
2367
2370
|
do
|
|
2368
|
-
s.from < o &&
|
|
2371
|
+
s.from < o && wi(s, {
|
|
2369
2372
|
state: n,
|
|
2370
2373
|
variableName: r,
|
|
2371
2374
|
scopeId: u,
|
|
@@ -2374,14 +2377,14 @@ function Ti(e, t) {
|
|
|
2374
2377
|
while (s.nextSibling());
|
|
2375
2378
|
break;
|
|
2376
2379
|
}
|
|
2377
|
-
case
|
|
2380
|
+
case q.ImportStatement: {
|
|
2378
2381
|
let t = e.cursor();
|
|
2379
2382
|
t.firstChild();
|
|
2380
2383
|
let i = !1, o = null, s = () => {
|
|
2381
|
-
o?.matches &&
|
|
2384
|
+
o?.matches && Y(a, u, o.from), o = null;
|
|
2382
2385
|
};
|
|
2383
2386
|
do
|
|
2384
|
-
t.name ===
|
|
2387
|
+
t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
|
|
2385
2388
|
from: t.from,
|
|
2386
2389
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2387
2390
|
}) : t.name === "," && s());
|
|
@@ -2389,19 +2392,19 @@ function Ti(e, t) {
|
|
|
2389
2392
|
s();
|
|
2390
2393
|
break;
|
|
2391
2394
|
}
|
|
2392
|
-
case
|
|
2393
|
-
case
|
|
2395
|
+
case q.TryStatement:
|
|
2396
|
+
case q.WithStatement: {
|
|
2394
2397
|
let t = e.cursor();
|
|
2395
2398
|
t.firstChild();
|
|
2396
2399
|
let i = !1;
|
|
2397
2400
|
do
|
|
2398
|
-
t.name ===
|
|
2401
|
+
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);
|
|
2399
2402
|
while (t.nextSibling());
|
|
2400
2403
|
break;
|
|
2401
2404
|
}
|
|
2402
2405
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2406
|
+
Ci(o, (e) => {
|
|
2407
|
+
Di(e, {
|
|
2405
2408
|
state: n,
|
|
2406
2409
|
variableName: r,
|
|
2407
2410
|
scopeStack: l,
|
|
@@ -2409,49 +2412,49 @@ function Ti(e, t) {
|
|
|
2409
2412
|
});
|
|
2410
2413
|
});
|
|
2411
2414
|
}
|
|
2412
|
-
function
|
|
2415
|
+
function Oi(e, t, n) {
|
|
2413
2416
|
let r = pe(e), i = [];
|
|
2414
|
-
|
|
2417
|
+
Di(r, {
|
|
2415
2418
|
state: e,
|
|
2416
2419
|
variableName: t,
|
|
2417
2420
|
scopeStack: [],
|
|
2418
2421
|
declarations: i
|
|
2419
2422
|
});
|
|
2420
2423
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2421
|
-
for (let e of
|
|
2422
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2424
|
+
for (let e of Si(r, a)) {
|
|
2425
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !yi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2423
2426
|
if (t) return t.from;
|
|
2424
2427
|
}
|
|
2425
2428
|
return null;
|
|
2426
2429
|
}
|
|
2427
|
-
function
|
|
2428
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2429
|
-
return i !== null && (
|
|
2430
|
+
function ki(e, t, n) {
|
|
2431
|
+
let { state: r } = e, i = n === void 0 ? xi(r, t) : Oi(r, t, n);
|
|
2432
|
+
return i !== null && (bi(e, i), !0);
|
|
2430
2433
|
}
|
|
2431
|
-
function
|
|
2432
|
-
return
|
|
2434
|
+
function Ai(e, t) {
|
|
2435
|
+
return bi(e, e.state.doc.line(t).from), !0;
|
|
2433
2436
|
}
|
|
2434
2437
|
//#endregion
|
|
2435
2438
|
//#region src/core/network/connection.ts
|
|
2436
|
-
var
|
|
2439
|
+
var X = b({ state: O.NOT_STARTED });
|
|
2437
2440
|
ee(null, (e, t) => t === null ? null : {
|
|
2438
2441
|
phase: t.phase,
|
|
2439
2442
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2440
2443
|
});
|
|
2441
|
-
function
|
|
2442
|
-
return oe(
|
|
2444
|
+
function ji() {
|
|
2445
|
+
return oe(X, (e) => e.state === O.OPEN);
|
|
2443
2446
|
}
|
|
2444
|
-
function
|
|
2445
|
-
return ge() ?
|
|
2447
|
+
function Mi() {
|
|
2448
|
+
return ge() ? ji() : Promise.resolve();
|
|
2446
2449
|
}
|
|
2447
|
-
b((e) => e(
|
|
2448
|
-
let t = e(
|
|
2450
|
+
b((e) => e(X).state === O.CONNECTING), b((e) => e(X).state === O.OPEN), b((e) => {
|
|
2451
|
+
let t = e(X);
|
|
2449
2452
|
return t.state === O.OPEN || t.state === O.NOT_STARTED;
|
|
2450
|
-
}), b((e) => e(
|
|
2453
|
+
}), b((e) => e(X).state === O.CLOSED);
|
|
2451
2454
|
//#endregion
|
|
2452
2455
|
//#region src/components/ui/checkbox.tsx
|
|
2453
|
-
var
|
|
2454
|
-
let r = (0,
|
|
2456
|
+
var Ni = w.forwardRef((e, t) => {
|
|
2457
|
+
let r = (0, en.c)(13), i, a;
|
|
2455
2458
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2456
2459
|
let o;
|
|
2457
2460
|
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);
|
|
@@ -2470,25 +2473,25 @@ var ji = w.forwardRef((e, t) => {
|
|
|
2470
2473
|
children: c
|
|
2471
2474
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2472
2475
|
});
|
|
2473
|
-
|
|
2476
|
+
Ni.displayName = Ne.displayName;
|
|
2474
2477
|
//#endregion
|
|
2475
2478
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2476
|
-
function
|
|
2479
|
+
function Pi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2477
2480
|
if (!n) return;
|
|
2478
|
-
let o = document.getElementById(
|
|
2481
|
+
let o = document.getElementById(B.create(e));
|
|
2479
2482
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2480
|
-
else if (
|
|
2483
|
+
else if (kr()) Ar(o);
|
|
2481
2484
|
else {
|
|
2482
|
-
if (r)
|
|
2485
|
+
if (r) Ar(o);
|
|
2483
2486
|
else {
|
|
2484
|
-
|
|
2487
|
+
cn.promote(e);
|
|
2485
2488
|
let r = n.current?.editorView;
|
|
2486
2489
|
if (!r) {
|
|
2487
2490
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2488
2491
|
return;
|
|
2489
2492
|
}
|
|
2490
2493
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2491
|
-
if (
|
|
2494
|
+
if (jr(() => (r.focus(), r.hasFocus), {
|
|
2492
2495
|
retries: 5,
|
|
2493
2496
|
delay: 20
|
|
2494
2497
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2501,7 +2504,7 @@ function Mi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2501
2504
|
anchor: e.from,
|
|
2502
2505
|
head: e.from
|
|
2503
2506
|
} });
|
|
2504
|
-
} else a &&
|
|
2507
|
+
} else a && ki(r, a);
|
|
2505
2508
|
}
|
|
2506
2509
|
o.scrollIntoView({
|
|
2507
2510
|
behavior: "smooth",
|
|
@@ -2509,21 +2512,21 @@ function Mi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2509
2512
|
});
|
|
2510
2513
|
}
|
|
2511
2514
|
}
|
|
2512
|
-
function
|
|
2515
|
+
function Fi() {
|
|
2513
2516
|
let e = document.getElementById("App");
|
|
2514
2517
|
e?.scrollTo({
|
|
2515
2518
|
top: e.scrollHeight,
|
|
2516
2519
|
behavior: "smooth"
|
|
2517
2520
|
});
|
|
2518
2521
|
}
|
|
2519
|
-
function
|
|
2522
|
+
function Ii() {
|
|
2520
2523
|
document.getElementById("App")?.scrollTo({
|
|
2521
2524
|
top: 0,
|
|
2522
2525
|
behavior: "smooth"
|
|
2523
2526
|
});
|
|
2524
2527
|
}
|
|
2525
|
-
function
|
|
2526
|
-
let t = document.getElementById(
|
|
2528
|
+
function Li(e) {
|
|
2529
|
+
let t = document.getElementById(B.create(e));
|
|
2527
2530
|
return t?.scrollIntoView({
|
|
2528
2531
|
behavior: "smooth",
|
|
2529
2532
|
block: "center"
|
|
@@ -2531,7 +2534,7 @@ function Fi(e) {
|
|
|
2531
2534
|
}
|
|
2532
2535
|
//#endregion
|
|
2533
2536
|
//#region src/core/cells/cells.ts
|
|
2534
|
-
function
|
|
2537
|
+
function Ri(e) {
|
|
2535
2538
|
let t = {
|
|
2536
2539
|
column: 0,
|
|
2537
2540
|
hide_code: !1,
|
|
@@ -2541,24 +2544,24 @@ function Ii(e) {
|
|
|
2541
2544
|
return {
|
|
2542
2545
|
...e,
|
|
2543
2546
|
cellData: {
|
|
2544
|
-
[
|
|
2545
|
-
id:
|
|
2547
|
+
[z]: nr({
|
|
2548
|
+
id: z,
|
|
2546
2549
|
config: t
|
|
2547
2550
|
}),
|
|
2548
2551
|
...e.cellData
|
|
2549
2552
|
},
|
|
2550
2553
|
cellRuntime: {
|
|
2551
|
-
[
|
|
2554
|
+
[z]: ir(),
|
|
2552
2555
|
...e.cellRuntime
|
|
2553
2556
|
},
|
|
2554
2557
|
cellHandles: {
|
|
2555
|
-
[
|
|
2558
|
+
[z]: (0, w.createRef)(),
|
|
2556
2559
|
...e.cellHandles
|
|
2557
2560
|
}
|
|
2558
2561
|
};
|
|
2559
2562
|
}
|
|
2560
|
-
function
|
|
2561
|
-
return
|
|
2563
|
+
function zi() {
|
|
2564
|
+
return Ri({
|
|
2562
2565
|
cellIds: [],
|
|
2563
2566
|
cellData: {},
|
|
2564
2567
|
cellRuntime: {},
|
|
@@ -2568,8 +2571,8 @@ function Li() {
|
|
|
2568
2571
|
cellLogs: []
|
|
2569
2572
|
});
|
|
2570
2573
|
}
|
|
2571
|
-
var { reducer:
|
|
2572
|
-
prepareForRun: (e, t) =>
|
|
2574
|
+
var { reducer: Bi, createActions: Vi, useActions: Hi, valueAtom: Z } = de(zi, {
|
|
2575
|
+
prepareForRun: (e, t) => Q({
|
|
2573
2576
|
state: e,
|
|
2574
2577
|
cellId: t.cellId,
|
|
2575
2578
|
cellReducer: (e) => ({
|
|
@@ -2577,15 +2580,44 @@ var { reducer: Ri, createActions: zi, useActions: Bi, valueAtom: Q } = de(Li, {
|
|
|
2577
2580
|
debuggerActive: !1
|
|
2578
2581
|
})
|
|
2579
2582
|
}),
|
|
2583
|
+
showPdbOutput: (e, { cell_id: t, entries: n, replace: r }) => Q({
|
|
2584
|
+
state: e,
|
|
2585
|
+
cellId: t,
|
|
2586
|
+
cellReducer: (e) => {
|
|
2587
|
+
let t = r || n.length === 0 ? [] : e.pdbOutput ?? [];
|
|
2588
|
+
for (let e of n) {
|
|
2589
|
+
let n = {
|
|
2590
|
+
...e,
|
|
2591
|
+
id: (t.at(-1)?.id ?? 0) - 1
|
|
2592
|
+
};
|
|
2593
|
+
t = fn([...t, n]);
|
|
2594
|
+
}
|
|
2595
|
+
return {
|
|
2596
|
+
...e,
|
|
2597
|
+
pdbOutput: t
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
}),
|
|
2601
|
+
clearDebuggerOutput: (e) => {
|
|
2602
|
+
let t = { ...e.cellRuntime };
|
|
2603
|
+
for (let e of Object.keys(t)) t[e].pdbOutput && (t[e] = {
|
|
2604
|
+
...t[e],
|
|
2605
|
+
pdbOutput: void 0
|
|
2606
|
+
});
|
|
2607
|
+
return {
|
|
2608
|
+
...e,
|
|
2609
|
+
cellRuntime: t
|
|
2610
|
+
};
|
|
2611
|
+
},
|
|
2580
2612
|
handleCellMessage: (e, t) => {
|
|
2581
|
-
let n = t.cell_id, r =
|
|
2613
|
+
let n = t.cell_id, r = Q({
|
|
2582
2614
|
state: e,
|
|
2583
2615
|
cellId: n,
|
|
2584
|
-
cellReducer: (e) =>
|
|
2616
|
+
cellReducer: (e) => Sn(e, t)
|
|
2585
2617
|
});
|
|
2586
2618
|
return {
|
|
2587
2619
|
...r,
|
|
2588
|
-
cellLogs: [...r.cellLogs, ...
|
|
2620
|
+
cellLogs: [...r.cellLogs, ...Tr(t)]
|
|
2589
2621
|
};
|
|
2590
2622
|
},
|
|
2591
2623
|
addLogs: (e, t) => ({
|
|
@@ -2593,13 +2625,13 @@ var { reducer: Ri, createActions: zi, useActions: Bi, valueAtom: Q } = de(Li, {
|
|
|
2593
2625
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
2594
2626
|
}),
|
|
2595
2627
|
reconcileDocument: (e, t) => {
|
|
2596
|
-
let n =
|
|
2597
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
2628
|
+
let n = sr(e, t);
|
|
2629
|
+
for (let t of e.cellIds) t in n.cellData || ia(t);
|
|
2598
2630
|
return n;
|
|
2599
2631
|
},
|
|
2600
2632
|
setStdinResponse: (e, n) => {
|
|
2601
2633
|
let { cellId: r, response: i, outputIndex: a } = n;
|
|
2602
|
-
return
|
|
2634
|
+
return Q({
|
|
2603
2635
|
state: e,
|
|
2604
2636
|
cellId: r,
|
|
2605
2637
|
cellReducer: (e) => {
|
|
@@ -2621,9 +2653,9 @@ var { reducer: Ri, createActions: zi, useActions: Bi, valueAtom: Q } = de(Li, {
|
|
|
2621
2653
|
},
|
|
2622
2654
|
resetCellRuntimes: (e) => {
|
|
2623
2655
|
let t = ye(), n = { ...e.cellRuntime };
|
|
2624
|
-
for (let r of [...e.cellIds,
|
|
2656
|
+
for (let r of [...e.cellIds, z]) {
|
|
2625
2657
|
let i = e.cellRuntime[r];
|
|
2626
|
-
n[r] = t && i !== void 0 && i.consoleOutputs.length > 0 ? i :
|
|
2658
|
+
n[r] = t && i !== void 0 && i.consoleOutputs.length > 0 ? i : ir();
|
|
2627
2659
|
}
|
|
2628
2660
|
return {
|
|
2629
2661
|
...e,
|
|
@@ -2634,10 +2666,10 @@ var { reducer: Ri, createActions: zi, useActions: Bi, valueAtom: Q } = de(Li, {
|
|
|
2634
2666
|
let t = e.scrollKey;
|
|
2635
2667
|
if (t === null) return e;
|
|
2636
2668
|
let n = t;
|
|
2637
|
-
return
|
|
2669
|
+
return Pi({
|
|
2638
2670
|
cellId: n,
|
|
2639
2671
|
cell: e.cellHandles[n],
|
|
2640
|
-
isCodeHidden:
|
|
2672
|
+
isCodeHidden: ur(e.cellData[n]?.config.hide_code, v.get(U), n),
|
|
2641
2673
|
codeFocus: void 0,
|
|
2642
2674
|
variableName: void 0
|
|
2643
2675
|
}), {
|
|
@@ -2645,21 +2677,22 @@ var { reducer: Ri, createActions: zi, useActions: Bi, valueAtom: Q } = de(Li, {
|
|
|
2645
2677
|
scrollKey: null
|
|
2646
2678
|
};
|
|
2647
2679
|
},
|
|
2648
|
-
foldAll: (e) => (
|
|
2649
|
-
unfoldAll: (e) => (
|
|
2680
|
+
foldAll: (e) => (nn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2681
|
+
unfoldAll: (e) => (rn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2650
2682
|
clearLogs: (e) => ({
|
|
2651
2683
|
...e,
|
|
2652
2684
|
cellLogs: []
|
|
2653
2685
|
}),
|
|
2654
|
-
clearCellConsoleOutput: (e, t) =>
|
|
2655
|
-
clearCellConsoleOutputs: (e, t) =>
|
|
2686
|
+
clearCellConsoleOutput: (e, t) => Ui(e, [t.cellId]),
|
|
2687
|
+
clearCellConsoleOutputs: (e, t) => Ui(e, t.cellIds)
|
|
2656
2688
|
});
|
|
2657
|
-
function
|
|
2689
|
+
function Ui(e, n) {
|
|
2658
2690
|
let r = { ...e.cellRuntime };
|
|
2659
2691
|
for (let e of n) {
|
|
2660
2692
|
let n = r[e];
|
|
2661
2693
|
n === void 0 ? t.warn(`Cell ${e} not found in state`) : r[e] = {
|
|
2662
2694
|
...n,
|
|
2695
|
+
pdbOutput: void 0,
|
|
2663
2696
|
consoleOutputs: n.consoleOutputs.filter((e) => e.channel === "stdin" && e.response == null)
|
|
2664
2697
|
};
|
|
2665
2698
|
}
|
|
@@ -2668,7 +2701,7 @@ function Vi(e, n) {
|
|
|
2668
2701
|
cellRuntime: r
|
|
2669
2702
|
};
|
|
2670
2703
|
}
|
|
2671
|
-
function
|
|
2704
|
+
function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
2672
2705
|
return n in e.cellRuntime ? {
|
|
2673
2706
|
...e,
|
|
2674
2707
|
cellRuntime: {
|
|
@@ -2677,16 +2710,16 @@ function Hi({ state: e, cellId: n, cellReducer: r }) {
|
|
|
2677
2710
|
}
|
|
2678
2711
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2679
2712
|
}
|
|
2680
|
-
var
|
|
2681
|
-
v.set(
|
|
2682
|
-
}).addLogs, $ = b((e) => e(
|
|
2683
|
-
b((e) => e($).length === 1), b((e) =>
|
|
2684
|
-
var
|
|
2685
|
-
b((e) => e(
|
|
2686
|
-
var
|
|
2687
|
-
let { cellIds: t, cellData: n } = e(
|
|
2713
|
+
var Wi = Vi((e) => {
|
|
2714
|
+
v.set(Z, (t) => Bi(t, e));
|
|
2715
|
+
}).addLogs, $ = b((e) => e(Z).cellIds);
|
|
2716
|
+
b((e) => e($).length === 1), b((e) => Nr(e(Z)).length > 0), b((e) => Pr(e(Z)).length > 0), b((e) => Fr(e(Z))), b((e) => Ir(e(Z)));
|
|
2717
|
+
var Gi = b((e) => zr(e(Z), e(P), e(zt)));
|
|
2718
|
+
b((e) => e(Gi) !== null);
|
|
2719
|
+
var Ki = b((e) => {
|
|
2720
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
2688
2721
|
return t.map((t) => {
|
|
2689
|
-
let r = e(
|
|
2722
|
+
let r = e(F(t)), { name: i } = n[t];
|
|
2690
2723
|
if (r !== null && R(r.mimetype)) {
|
|
2691
2724
|
C(Array.isArray(r.data), "Expected array data");
|
|
2692
2725
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
@@ -2701,88 +2734,88 @@ var Gi = b((e) => {
|
|
|
2701
2734
|
}
|
|
2702
2735
|
return null;
|
|
2703
2736
|
}).filter(Boolean);
|
|
2704
|
-
}),
|
|
2737
|
+
}), qi = se(b((e) => {
|
|
2705
2738
|
let t = {};
|
|
2706
2739
|
for (let n of e($)) {
|
|
2707
|
-
let r = e(
|
|
2740
|
+
let r = e(I(n));
|
|
2708
2741
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
2709
2742
|
}
|
|
2710
2743
|
return t;
|
|
2711
|
-
})),
|
|
2712
|
-
b((e) => e(
|
|
2713
|
-
var
|
|
2714
|
-
let { cellIds: t, cellData: n } = e(
|
|
2744
|
+
})), Ji = b((e) => qe(e($).map((t) => e(I(t)))));
|
|
2745
|
+
b((e) => e(Ki).length);
|
|
2746
|
+
var Yi = se(b((e) => {
|
|
2747
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
2715
2748
|
return le.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
2716
2749
|
}));
|
|
2717
|
-
b((e) => e(
|
|
2718
|
-
var
|
|
2719
|
-
let { cellIds: e, cellData: t } = v.get(
|
|
2750
|
+
b((e) => e(Z).scrollKey);
|
|
2751
|
+
var Xi = () => _($), Zi = () => _(Yi), Qi = () => v.get(Z), $i = () => v.get(Z).cellIds, ea = () => {
|
|
2752
|
+
let { cellIds: e, cellData: t } = v.get(Z);
|
|
2720
2753
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
2721
2754
|
};
|
|
2722
|
-
g(h(
|
|
2723
|
-
var
|
|
2724
|
-
function
|
|
2725
|
-
|
|
2755
|
+
g(h(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), b((e) => e(Z).cellIds.length > 0);
|
|
2756
|
+
var ta = S((e) => b((t) => t(Z).cellData[e])), na = S((e) => b((t) => ar(t(Z).cellRuntime[e]))), ra = S((e) => b((t) => t(Z).cellHandles[e]));
|
|
2757
|
+
function ia(e) {
|
|
2758
|
+
ta.remove(e), na.remove(e), ra.remove(e), Wt(e);
|
|
2726
2759
|
}
|
|
2727
|
-
var
|
|
2728
|
-
let { cellHandles: t } = v.get(
|
|
2760
|
+
var aa = (e) => {
|
|
2761
|
+
let { cellHandles: t } = v.get(Z);
|
|
2729
2762
|
return t[e].current?.editorView;
|
|
2730
|
-
},
|
|
2731
|
-
function
|
|
2732
|
-
return
|
|
2763
|
+
}, oa = (e) => (cn.promote(e), aa(e));
|
|
2764
|
+
function sa() {
|
|
2765
|
+
return Hi();
|
|
2733
2766
|
}
|
|
2734
2767
|
//#endregion
|
|
2735
2768
|
//#region src/core/errors/error-entries.ts
|
|
2736
|
-
function
|
|
2737
|
-
if (
|
|
2769
|
+
function ca(e) {
|
|
2770
|
+
if (vn(e.mimetype)) {
|
|
2738
2771
|
if (!Array.isArray(e.data)) return null;
|
|
2739
2772
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
2740
2773
|
return t.length === 0 ? null : { errorData: t };
|
|
2741
2774
|
}
|
|
2742
|
-
return
|
|
2775
|
+
return yn(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
2743
2776
|
errorData: [],
|
|
2744
2777
|
tracebackHtml: e.data
|
|
2745
2778
|
} : null;
|
|
2746
2779
|
}
|
|
2747
|
-
function
|
|
2780
|
+
function la(e) {
|
|
2748
2781
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
2749
2782
|
}
|
|
2750
|
-
function
|
|
2751
|
-
let t = e?.find((e) =>
|
|
2783
|
+
function ua(e) {
|
|
2784
|
+
let t = e?.find((e) => yn(e.mimetype));
|
|
2752
2785
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
2753
2786
|
}
|
|
2754
|
-
function
|
|
2787
|
+
function da(e, t) {
|
|
2755
2788
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
2756
|
-
if (!
|
|
2789
|
+
if (!la(e.errorData)) return ua(t);
|
|
2757
2790
|
}
|
|
2758
|
-
function
|
|
2759
|
-
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(
|
|
2791
|
+
function fa(e) {
|
|
2792
|
+
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
|
|
2760
2793
|
for (let [a, o] of t.entries()) {
|
|
2761
|
-
let t = e.get(
|
|
2794
|
+
let t = e.get(F(o));
|
|
2762
2795
|
if (t === null || !R(t.mimetype)) continue;
|
|
2763
|
-
let s =
|
|
2796
|
+
let s = ca(t);
|
|
2764
2797
|
if (!s) continue;
|
|
2765
|
-
let c =
|
|
2798
|
+
let c = er(r[o].name, a), l = t.code ?? r[o].code;
|
|
2766
2799
|
i.push({
|
|
2767
2800
|
cellId: o,
|
|
2768
2801
|
cellName: c,
|
|
2769
2802
|
cellCode: l,
|
|
2770
2803
|
errorData: s.errorData,
|
|
2771
|
-
tracebackHtml:
|
|
2804
|
+
tracebackHtml: da(s, ar(n[o]).consoleOutputs)
|
|
2772
2805
|
});
|
|
2773
2806
|
}
|
|
2774
2807
|
return i;
|
|
2775
2808
|
}
|
|
2776
|
-
function fa(e) {
|
|
2777
|
-
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");
|
|
2778
|
-
}
|
|
2779
2809
|
function pa(e) {
|
|
2780
|
-
|
|
2781
|
-
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${K(e.traceback)}`), t;
|
|
2810
|
+
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");
|
|
2782
2811
|
}
|
|
2783
2812
|
function ma(e) {
|
|
2813
|
+
let t = pa(e);
|
|
2814
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
|
|
2815
|
+
}
|
|
2816
|
+
function ha(e) {
|
|
2784
2817
|
let t = [e.cellName];
|
|
2785
|
-
return e.tracebackHtml && t.push(
|
|
2818
|
+
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(ma).join("\n\n")), t.join("\n\n");
|
|
2786
2819
|
}
|
|
2787
2820
|
//#endregion
|
|
2788
|
-
export {
|
|
2821
|
+
export { G as $, Ce as $t, Ai as A, On as At, ni as B, Gt as Bt, Fi as C, In as Ct, X as D, Fn as Dt, Ni as E, Mn as Et, K as F, P as Ft, Wr as G, Jt as Gt, ei as H, $t as Ht, fi as I, zt as It, Mr as J, Ze as Jt, Gr as K, Xt as Kt, ci as L, I as Lt, hi as M, Cn as Mt, pi as N, wn as Nt, ji as O, Pn as Ot, mi as P, Zt as Pt, xr as Q, Ve as Qt, li as R, F as Rt, Pi as S, Nn as St, Ii as T, z as Tt, Yr as U, Yt as Ut, ri as V, It as Vt, Kr as W, Kt as Wt, Ur as X, Ye as Xt, Hr as Y, O as Yt, Or as Z, Ke as Zt, Bi as _, Yn as _t, Wi as a, cr as at, Zi as b, Gn as bt, Vi as c, tr as ct, ea as d, V as dt, Se as en, mr as et, $i as f, qn as ft, Ji as g, Xn as gt, Z as h, Jn as ht, fa as i, lr as it, _i as j, Tn as jt, Mi as k, Dn as kt, oa as l, Qn as lt, zi as m, Kn as mt, ha as n, dr as nt, ta as o, er as ot, Qi as p, H as pt, Vr as q, Ct as qt, ma as r, U as rt, $ as s, $n as st, pa as t, ur as tt, aa as u, Ln as ut, ia as v, Un as vt, Li as w, B as wt, sa as x, Wn as xt, Xi as y, Rn as yt, ui as z, Ht as zt };
|