@marimo-team/islands 0.26.1-dev42 → 0.26.1-dev46
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/{ConnectedDataExplorerComponent-BVMWCBON.js → ConnectedDataExplorerComponent-yQVBQBUW.js} +16 -16
- package/dist/{ErrorBoundary-BzyGrUMt.js → ErrorBoundary-i7VCVA53.js} +18 -18
- package/dist/{abnfDiagram-VCTEODGH-BRj77JhY.js → abnfDiagram-VCTEODGH-Ck_lXwQR.js} +2 -2
- package/dist/{any-language-editor-BQ9dhxg5.js → any-language-editor-Cx4idbgX.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-CDnAsvE1.js → architectureDiagram-5GKGNRK7-XeVhic7Z.js} +1 -1
- package/dist/{assertNever-DeSqnr83.js → assertNever-473SFxLt.js} +2 -2
- package/dist/{chat-ui-CXyZb62N.js → chat-ui-6qTQeEIx.js} +870 -870
- package/dist/{check-COXd6cXw.js → check-DmTIavbZ.js} +1 -1
- package/dist/{chunk-IMKFNOWR-BFtu1O6j.js → chunk-IMKFNOWR-DdQni67K.js} +1 -1
- package/dist/{chunk-SHT3W25Y-B9zWo9Da.js → chunk-SHT3W25Y-BdK-vMct.js} +1 -1
- package/dist/{chunk-SVP7TREG-kKS-I24p.js → chunk-SVP7TREG-cpFZk4Ca.js} +1 -1
- package/dist/{chunk-TICWLB2K-EY3w5-eg.js → chunk-TICWLB2K-DDgQFRgT.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-BR66X7fj.js → classDiagram-ZZMXUADV-DeojX9X4.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-DPcxw_9g.js → classDiagram-v2-VYDZK3BY-DPfTAiQ6.js} +2 -2
- package/dist/{code-visibility-DcxCjPS7.js → code-visibility-DNUnnMY_.js} +27 -27
- package/dist/{common-CA3E-SaD.js → common-CXvbAyqO.js} +4892 -4900
- package/dist/{config-DE3A8m65.js → config-D-lhQq-h.js} +3 -3
- package/dist/{copy-icon-gSCLWI50.js → copy-icon-DuxRkh7T.js} +2 -2
- package/dist/{createReducer-BFfuVhJG.js → createReducer-D3pBhIVD.js} +5 -5
- package/dist/{cynefinDiagram-5FMLGOSQ-B9kG0Adl.js → cynefinDiagram-5FMLGOSQ-DyY9TvuI.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-ClnyHQzL.js → dagre-GXQ25YYZ-BPCOgtKg.js} +1 -1
- package/dist/{data-grid-overlay-editor-DjSnRyGz.js → data-grid-overlay-editor-_B2yWrZg.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-afCjSSlp.js → diagram-S7CK7UJ4-KaF-C6kd.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-BCHefG5P.js → diagram-UQ7AKVKN-DkeqoSvK.js} +1 -1
- package/dist/{diagram-VX7I27RA-9jXA0khj.js → diagram-VX7I27RA-DExolTAf.js} +1 -1
- package/dist/{diagram-Z3DM3KII-C8tsbK7Q.js → diagram-Z3DM3KII-BioFuBF3.js} +1 -1
- package/dist/{dialog-Dn_UHaEl.js → dialog-CvyFEwby.js} +28 -28
- package/dist/{dropdown-menu-D0nePAlm.js → dropdown-menu-BiXHfje7.js} +651 -651
- package/dist/{ebnfDiagram-PWID7BFC-It0ZS33j.js → ebnfDiagram-PWID7BFC-BSb9k1ed.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-Z0Qfo02H.js → erDiagram-RLTQ6QDP-PWA30a_r.js} +1 -1
- package/dist/{error-banner-DChjSagB.js → error-banner-B9HQMSaH.js} +70 -70
- package/dist/{error-entries-DYoi03MZ.js → error-entries-8CPw0aYH.js} +812 -698
- package/dist/{feedback-button-DeA5LGUm.js → feedback-button-BOJ6pfBP.js} +52 -52
- package/dist/{flowDiagram-HODETNUW-8DeXLUFK.js → flowDiagram-HODETNUW-BPtD__Zz.js} +2 -2
- package/dist/{formats-6QF5hRsy.js → formats-BF95BoCT.js} +1 -1
- package/dist/{glide-data-editor-DD03A2zN.js → glide-data-editor-oQ3lCfvU.js} +11 -11
- package/dist/{glide-utils-B7gy9Her.js → glide-utils-iHKKQPJ8.js} +2 -2
- package/dist/{globals-CXh7buzB.js → globals-a3k2q2j7.js} +3 -3
- package/dist/{html-to-image-CUFNjxtw.js → html-to-image-BIom70fW.js} +404 -404
- package/dist/{infoDiagram-27XIBGKW-B5wmzeRz.js → infoDiagram-27XIBGKW-SJuilBEE.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-BcbPwik7.js → ishikawaDiagram-5VMMS53U-DjzyxMr8.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-AfQmkIoH.js → kanban-definition-UXKFOSKX-D2_qopGt.js} +1 -1
- package/dist/main.js +5811 -5766
- package/dist/{mermaid-az53hfgW.js → mermaid-DcowNmCx.js} +34 -34
- package/dist/{mindmap-definition-YA3MSWOX-B7eBrMap.js → mindmap-definition-YA3MSWOX-pEra10M0.js} +1 -1
- package/dist/{number-overlay-editor-DJFSx1CC.js → number-overlay-editor-CUwIpUt4.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-BwjpXSLR.js → pegDiagram-XKGWAZYB-CHOPKVOf.js} +2 -2
- package/dist/{pencil-pQhLU2Up.js → pencil-FAv6JUvp.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-D5AyRqAQ.js → pieDiagram-E7YTZNPT-yGDhsyEN.js} +1 -1
- package/dist/{process-output-DMMs8Ywh.js → process-output-ns7N5ovS.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-Hhrla0Qq.js → railroadDiagram-O6MQD6OU-CeKEPdyc.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-MgDRuFUM.js → requirementDiagram-BXWQKSXE-DSAbAzKe.js} +1 -1
- package/dist/{reveal-component-DwB1-KYy.js → reveal-component-BAhQeB3o.js} +7 -7
- package/dist/{select-C4rPKgSx.js → select-BszV-bbI.js} +307 -307
- package/dist/{sequenceDiagram-WJ2MYXX4-xZYdOGbe.js → sequenceDiagram-WJ2MYXX4-DVhWj_9H.js} +1 -1
- package/dist/{spec-BsiCag5K.js → spec-CRfw-lOm.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-DdhE3Yx9.js → stateDiagram-D77RDMKH-CDQ2MltG.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-DENKYVKr.js → stateDiagram-v2-MP3YSRHH-BQmvwBaz.js} +2 -2
- package/dist/{static-state-CNnjDcOR.js → static-state-BtDNJuc2.js} +5 -5
- package/dist/{swimlanes-42K2YHIH-Bw7xuGAn.js → swimlanes-42K2YHIH-DLOUTCEL.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-L91TUeh5.js → swimlanesDiagram-VR7AAH4N-BVKrkNJ6.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-BeGrmws1.js → timeline-definition-24CTP7MA-Cb2JoCSd.js} +1 -1
- package/dist/{toast-qyBwbZJ0.js → toast-QsOAIPfq.js} +192 -192
- package/dist/{tooltip-COQxCMLx.js → tooltip-BQZ-Bm6h.js} +76 -76
- package/dist/{use-restore-focus-D5-Hgr1l.js → use-restore-focus-DT1TZACX.js} +1167 -1167
- package/dist/{useDateFormatter-L8edl513.js → useDateFormatter-D3gyMY-g.js} +2 -2
- package/dist/{useDeepCompareMemoize-B6yhm6sM.js → useDeepCompareMemoize-CO6rO5Mq.js} +1 -1
- package/dist/{useLifecycle-Dnxradbp.js → useLifecycle-C9UTzCY8.js} +1 -1
- package/dist/{vega-component-CWKS3tOU.js → vega-component-i5lZ23n7.js} +17 -17
- package/dist/{vennDiagram-4TSXK5OY-fknCUyJ2.js → vennDiagram-4TSXK5OY-Cm3EcCcP.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-DvoVMCdj.js → wardleyDiagram-VM6X3IG4-DjlUs2CC.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-0TYtO6UV.js → xychartDiagram-S5SC5T6Z-DxNDul9l.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/animation-frames.ts +31 -0
- package/src/__mocks__/executions.ts +6 -1
- package/src/components/editor/cell/collapse.tsx +6 -3
- package/src/components/editor/header/status.tsx +5 -2
- package/src/components/scratchpad/scratchpad.tsx +2 -2
- package/src/core/cells/cells.ts +24 -16
- package/src/core/cells/execution-console.ts +7 -2
- package/src/core/executions/__tests__/atoms.test.ts +204 -1
- package/src/core/executions/__tests__/output-lifecycle.test.ts +20 -3
- package/src/core/executions/__tests__/select.test.ts +32 -1
- package/src/core/executions/atoms.ts +245 -81
- package/src/core/executions/hooks.ts +15 -59
- package/src/core/executions/index.ts +2 -0
- package/src/core/executions/output.ts +34 -14
- package/src/core/executions/select.ts +70 -25
- package/src/core/islands/bootstrap.ts +7 -2
- package/src/core/notebook/replica/__tests__/executions.test.ts +8 -12
- package/src/core/notebook/replica/__tests__/frame.test.ts +206 -0
- package/src/core/notebook/replica/__tests__/once-per-frame.test.ts +95 -0
- package/src/core/notebook/replica/__tests__/results.test.ts +3 -9
- package/src/core/notebook/replica/frame.ts +54 -0
- package/src/core/notebook/replica/index.ts +1 -0
- package/src/core/notebook/replica/once-per-frame.ts +60 -0
- package/src/core/notebook/replica/resources/executions.ts +0 -2
- package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +53 -7
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +29 -7
- package/src/core/session/active-notebook.ts +4 -1
- package/src/core/session/useNotebookReplica.ts +14 -1
- package/src/core/state/__tests__/atom-with-selected-inputs.test.ts +48 -0
- package/src/core/state/__tests__/create-keyed-selector-hook.test.tsx +16 -7
- package/src/core/state/atom-with-selected-inputs.ts +24 -0
- package/src/core/state/create-keyed-atom-hook.ts +18 -0
- package/src/core/state/create-keyed-selector-hook.ts +5 -9
- package/src/core/wasm/__tests__/bridge.test.ts +73 -1
- package/src/utils/arrays.ts +4 -1
|
@@ -2,19 +2,20 @@ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
|
|
|
2
2
|
import { g as t, h as n, p as r } from "./button-Z2R2272J.js";
|
|
3
3
|
import { t as i } from "./react-Bgs_wQh3.js";
|
|
4
4
|
import { t as a } from "./compiler-runtime-C5KHtL5D.js";
|
|
5
|
-
import { i as o } from "./copy-icon-
|
|
6
|
-
import { f as s, h as c } from "./tooltip-
|
|
7
|
-
import { t as l } from "./check-
|
|
8
|
-
import { n as u, r as d } from "./assertNever-
|
|
5
|
+
import { i as o } from "./copy-icon-DuxRkh7T.js";
|
|
6
|
+
import { f as s, h as c } from "./tooltip-BQZ-Bm6h.js";
|
|
7
|
+
import { t as l } from "./check-DmTIavbZ.js";
|
|
8
|
+
import { n as u, r as d } from "./assertNever-473SFxLt.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-D8btoEHk.js";
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import {
|
|
10
|
+
import { Ct as p, Dt as m, Et as h, It as g, Lt as _, Mt as v, Nt as y, Ot as b, Rt as x, St as S, Tt as ee, Vt as C, Wt as w, _n as te, bn as ne, f as re, gn as ie, hn as ae, yn as oe } from "./use-restore-focus-DT1TZACX.js";
|
|
11
|
+
import { n as se } from "./toast-QsOAIPfq.js";
|
|
12
|
+
import { t as ce } from "./objects-DCmMvZtn.js";
|
|
13
|
+
import { t as T } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as le } from "./purify.es-DmnrIjg4.js";
|
|
15
|
+
import { r as ue } from "./arrays-DoQ-AILx.js";
|
|
16
|
+
import { t as de } from "./createReducer-D3pBhIVD.js";
|
|
16
17
|
import { H as fe, N as pe, P as me, _ as he } from "./dist-BIaGGUbU.js";
|
|
17
|
-
import { a as ge, i as _e, l as ve, m as ye, u as be } from "./static-state-
|
|
18
|
+
import { a as ge, i as _e, l as ve, m as ye, u as be } from "./static-state-BtDNJuc2.js";
|
|
18
19
|
import { t as xe } from "./capabilities-ba3Dyv8n.js";
|
|
19
20
|
var Se = c("external-link", [
|
|
20
21
|
["path", {
|
|
@@ -32,7 +33,7 @@ var Se = c("external-link", [
|
|
|
32
33
|
]), Ce = c("minus", [["path", {
|
|
33
34
|
d: "M5 12h14",
|
|
34
35
|
key: "1ays0h"
|
|
35
|
-
}]]),
|
|
36
|
+
}]]), E = /* @__PURE__ */ e(i(), 1), D = f(), we = Object.defineProperty, O = (e, t) => we(e, "name", {
|
|
36
37
|
value: t,
|
|
37
38
|
configurable: !0
|
|
38
39
|
}), Te = "Checkbox", [Ee, De] = oe(Te), [Oe, ke] = Ee(Te);
|
|
@@ -42,7 +43,7 @@ function Ae(e) {
|
|
|
42
43
|
defaultProp: i ?? !1,
|
|
43
44
|
onChange: c,
|
|
44
45
|
caller: Te
|
|
45
|
-
}), [m, h] =
|
|
46
|
+
}), [m, h] = E.useState(null), [g, _] = E.useState(null), [v, y] = E.useState(null), b = !m || !!o || !!m.closest("form"), x = {
|
|
46
47
|
checked: f,
|
|
47
48
|
disabled: a,
|
|
48
49
|
setChecked: p,
|
|
@@ -51,33 +52,33 @@ function Ae(e) {
|
|
|
51
52
|
name: s,
|
|
52
53
|
form: o,
|
|
53
54
|
value: u,
|
|
54
|
-
userClick:
|
|
55
|
-
onUserClick:
|
|
55
|
+
userClick: v,
|
|
56
|
+
onUserClick: y,
|
|
56
57
|
required: l,
|
|
57
|
-
defaultChecked: !
|
|
58
|
-
isFormControl:
|
|
58
|
+
defaultChecked: !k(i) && i,
|
|
59
|
+
isFormControl: b,
|
|
59
60
|
bubbleInput: g,
|
|
60
61
|
setBubbleInput: _
|
|
61
62
|
};
|
|
62
|
-
return /* @__PURE__ */ (0,
|
|
63
|
+
return /* @__PURE__ */ (0, D.jsx)(Oe, {
|
|
63
64
|
scope: t,
|
|
64
|
-
...
|
|
65
|
-
children: Re(d) ? d(
|
|
65
|
+
...x,
|
|
66
|
+
children: Re(d) ? d(x) : r
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
var je = "CheckboxTrigger", Me = /* @__PURE__ */
|
|
70
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = ke(je, e), g = r(a, d), _ =
|
|
71
|
-
return
|
|
69
|
+
O(Ae, "CheckboxProvider");
|
|
70
|
+
var je = "CheckboxTrigger", Me = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
|
|
71
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = ke(je, e), g = r(a, d), _ = E.useRef(l);
|
|
72
|
+
return E.useEffect(() => {
|
|
72
73
|
let e = o?.form;
|
|
73
74
|
if (e) {
|
|
74
|
-
let t = /* @__PURE__ */
|
|
75
|
+
let t = /* @__PURE__ */ O(() => f(_.current), "reset");
|
|
75
76
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
76
77
|
}
|
|
77
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
78
|
+
}, [o, f]), /* @__PURE__ */ (0, D.jsx)(ne.button, {
|
|
78
79
|
type: "button",
|
|
79
80
|
role: "checkbox",
|
|
80
|
-
"aria-checked":
|
|
81
|
+
"aria-checked": k(l) ? "mixed" : l,
|
|
81
82
|
"aria-required": u,
|
|
82
83
|
"data-state": ze(l),
|
|
83
84
|
"data-disabled": c ? "" : void 0,
|
|
@@ -85,20 +86,20 @@ var je = "CheckboxTrigger", Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
85
86
|
value: s,
|
|
86
87
|
...i,
|
|
87
88
|
ref: g,
|
|
88
|
-
onKeyDown:
|
|
89
|
+
onKeyDown: te(t, (e) => {
|
|
89
90
|
e.key === "Enter" && e.preventDefault();
|
|
90
91
|
}),
|
|
91
|
-
onClick:
|
|
92
|
+
onClick: te(n, (e) => {
|
|
92
93
|
let t = e.isPropagationStopped();
|
|
93
94
|
p({
|
|
94
|
-
requestedChecked:
|
|
95
|
+
requestedChecked: k(l) ? !0 : !l,
|
|
95
96
|
hasConsumerStoppedPropagation: t
|
|
96
|
-
}), f((e) =>
|
|
97
|
+
}), f((e) => k(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
97
98
|
})
|
|
98
99
|
});
|
|
99
|
-
}, "CheckboxTrigger")), Ne = /* @__PURE__ */
|
|
100
|
+
}, "CheckboxTrigger")), Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
|
|
100
101
|
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
101
|
-
return /* @__PURE__ */ (0,
|
|
102
|
+
return /* @__PURE__ */ (0, D.jsx)(Ae, {
|
|
102
103
|
__scopeCheckbox: n,
|
|
103
104
|
checked: i,
|
|
104
105
|
defaultChecked: a,
|
|
@@ -108,17 +109,17 @@ var je = "CheckboxTrigger", Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
108
109
|
name: r,
|
|
109
110
|
form: u,
|
|
110
111
|
value: c,
|
|
111
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0,
|
|
112
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(Me, {
|
|
112
113
|
...d,
|
|
113
114
|
ref: t,
|
|
114
115
|
__scopeCheckbox: n
|
|
115
|
-
}), e && /* @__PURE__ */ (0,
|
|
116
|
+
}), e && /* @__PURE__ */ (0, D.jsx)(Le, { __scopeCheckbox: n })] })
|
|
116
117
|
});
|
|
117
|
-
}, "Checkbox")), Pe = "CheckboxIndicator", Fe = /* @__PURE__ */
|
|
118
|
+
}, "Checkbox")), Pe = "CheckboxIndicator", Fe = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
|
|
118
119
|
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = ke(Pe, n);
|
|
119
|
-
return /* @__PURE__ */ (0,
|
|
120
|
-
present: r ||
|
|
121
|
-
children: /* @__PURE__ */ (0,
|
|
120
|
+
return /* @__PURE__ */ (0, D.jsx)(ae, {
|
|
121
|
+
present: r || k(a.checked) || a.checked === !0,
|
|
122
|
+
children: /* @__PURE__ */ (0, D.jsx)(ne.span, {
|
|
122
123
|
"data-state": ze(a.checked),
|
|
123
124
|
"data-disabled": a.disabled ? "" : void 0,
|
|
124
125
|
...i,
|
|
@@ -129,33 +130,33 @@ var je = "CheckboxTrigger", Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
129
130
|
}
|
|
130
131
|
})
|
|
131
132
|
});
|
|
132
|
-
}, "CheckboxIndicator")), Ie = "CheckboxBubbleInput", Le = /* @__PURE__ */
|
|
133
|
-
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = ke(Ie, e), _ = r(i, g),
|
|
134
|
-
|
|
133
|
+
}, "CheckboxIndicator")), Ie = "CheckboxBubbleInput", Le = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
|
|
134
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = ke(Ie, e), _ = r(i, g), v = s(a), y = E.useRef(!1), b = E.useRef(c), x = E.useRef(o), S = E.useRef(null);
|
|
135
|
+
E.useEffect(() => {
|
|
135
136
|
let e = h;
|
|
136
137
|
if (!e) return;
|
|
137
138
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
138
139
|
if (!n) return;
|
|
139
|
-
let r =
|
|
140
|
-
|
|
141
|
-
let i = o !== null && o !==
|
|
142
|
-
if (
|
|
140
|
+
let r = b.current !== c;
|
|
141
|
+
b.current = c;
|
|
142
|
+
let i = o !== null && o !== x.current;
|
|
143
|
+
if (x.current = o, i) S.current = r ? null : o, r && (e.indeterminate = k(c), n.call(e, !k(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
144
|
else if (r) {
|
|
144
|
-
let t =
|
|
145
|
-
|
|
145
|
+
let t = S.current;
|
|
146
|
+
S.current = null;
|
|
146
147
|
let r = t?.requestedChecked === c;
|
|
147
|
-
|
|
148
|
+
y.current = !0, e.indeterminate = k(c), n.call(e, !k(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
|
|
148
149
|
}
|
|
149
150
|
}, [
|
|
150
151
|
h,
|
|
151
152
|
c,
|
|
152
153
|
o
|
|
153
154
|
]);
|
|
154
|
-
let
|
|
155
|
-
return /* @__PURE__ */ (0,
|
|
155
|
+
let ee = E.useRef(!k(c) && c);
|
|
156
|
+
return /* @__PURE__ */ (0, D.jsx)(ne.input, {
|
|
156
157
|
type: "checkbox",
|
|
157
158
|
"aria-hidden": !0,
|
|
158
|
-
defaultChecked: l ??
|
|
159
|
+
defaultChecked: l ?? ee.current,
|
|
159
160
|
required: u,
|
|
160
161
|
disabled: d,
|
|
161
162
|
name: f,
|
|
@@ -164,12 +165,12 @@ var je = "CheckboxTrigger", Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
164
165
|
...n,
|
|
165
166
|
tabIndex: -1,
|
|
166
167
|
ref: _,
|
|
167
|
-
onClick:
|
|
168
|
-
|
|
168
|
+
onClick: te(t, (e) => {
|
|
169
|
+
y.current && e.stopPropagation();
|
|
169
170
|
}),
|
|
170
171
|
style: {
|
|
171
172
|
...n.style,
|
|
172
|
-
...
|
|
173
|
+
...v,
|
|
173
174
|
position: "absolute",
|
|
174
175
|
pointerEvents: "none",
|
|
175
176
|
opacity: 0,
|
|
@@ -181,23 +182,23 @@ var je = "CheckboxTrigger", Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
181
182
|
function Re(e) {
|
|
182
183
|
return typeof e == "function";
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
-
function
|
|
185
|
+
O(Re, "isFunction");
|
|
186
|
+
function k(e) {
|
|
186
187
|
return e === "indeterminate";
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
+
O(k, "isIndeterminate");
|
|
189
190
|
function ze(e) {
|
|
190
|
-
return
|
|
191
|
+
return k(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
192
|
}
|
|
192
|
-
|
|
193
|
+
O(ze, "getState");
|
|
193
194
|
//#endregion
|
|
194
195
|
//#region src/plugins/core/sanitize-html.ts
|
|
195
196
|
var Be = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
|
|
196
197
|
if (typeof document < "u") {
|
|
197
198
|
let e = "data-temp-href-target";
|
|
198
|
-
|
|
199
|
+
le.addHook("beforeSanitizeAttributes", (t) => {
|
|
199
200
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
200
|
-
}),
|
|
201
|
+
}), le.addHook("afterSanitizeAttributes", (t) => {
|
|
201
202
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
202
203
|
});
|
|
203
204
|
}
|
|
@@ -218,7 +219,7 @@ function Ve(e) {
|
|
|
218
219
|
},
|
|
219
220
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
220
221
|
};
|
|
221
|
-
return
|
|
222
|
+
return le.sanitize(e, t);
|
|
222
223
|
}
|
|
223
224
|
//#endregion
|
|
224
225
|
//#region src/core/dom/outline.ts
|
|
@@ -262,7 +263,7 @@ function qe(e) {
|
|
|
262
263
|
function Je(e) {
|
|
263
264
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
264
265
|
try {
|
|
265
|
-
return
|
|
266
|
+
return T(typeof e.data == "string", "expected string"), We(e.data);
|
|
266
267
|
} catch {
|
|
267
268
|
return t.error("Failed to parse outline"), null;
|
|
268
269
|
}
|
|
@@ -283,7 +284,7 @@ function Xe(e, n) {
|
|
|
283
284
|
}
|
|
284
285
|
//#endregion
|
|
285
286
|
//#region src/core/notebook/replica/connection.ts
|
|
286
|
-
var
|
|
287
|
+
var A = {
|
|
287
288
|
NOT_STARTED: "NOT_STARTED",
|
|
288
289
|
CONNECTING: "CONNECTING",
|
|
289
290
|
OPEN: "OPEN",
|
|
@@ -294,7 +295,7 @@ var k = {
|
|
|
294
295
|
};
|
|
295
296
|
//#endregion
|
|
296
297
|
//#region src/core/notebook/replica/execution-state.ts
|
|
297
|
-
function
|
|
298
|
+
function j(e) {
|
|
298
299
|
let { state: t } = e.record;
|
|
299
300
|
return t.status === "completed" && t.outcome.kind !== "succeeded" ? t.outcome : e.output === null ? t.status === "completed" ? {
|
|
300
301
|
kind: "output",
|
|
@@ -304,10 +305,10 @@ function A(e) {
|
|
|
304
305
|
media: e.output.media
|
|
305
306
|
};
|
|
306
307
|
}
|
|
307
|
-
function
|
|
308
|
+
function M(e) {
|
|
308
309
|
return e.state.status === "queued" ? null : e.state.started_at;
|
|
309
310
|
}
|
|
310
|
-
function
|
|
311
|
+
function N(e) {
|
|
311
312
|
return e.state.status === "completed" ? e.state.completed_at : null;
|
|
312
313
|
}
|
|
313
314
|
function Qe(e) {
|
|
@@ -325,8 +326,8 @@ function $e(e, t) {
|
|
|
325
326
|
}
|
|
326
327
|
function et(e, t) {
|
|
327
328
|
let { record: n, output: r, outputVersion: i } = t;
|
|
328
|
-
if (n.cell_id !== null ||
|
|
329
|
-
let a = (e) => Date.parse(
|
|
329
|
+
if (n.cell_id !== null || j(t) === null) return e;
|
|
330
|
+
let a = (e) => Date.parse(N(e) ?? M(e) ?? "1970-01-01T00:00:00Z");
|
|
330
331
|
return e !== null && a(e.record) > a(n) ? e : {
|
|
331
332
|
record: n,
|
|
332
333
|
output: r,
|
|
@@ -346,17 +347,17 @@ function tt(e) {
|
|
|
346
347
|
function nt(e) {
|
|
347
348
|
return [...e.items.values()].toSorted((e, t) => e.seq - t.seq);
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
+
function P(e, t) {
|
|
350
351
|
if (!e.has(t)) return e;
|
|
351
352
|
let n = new Map(e);
|
|
352
353
|
return n.delete(t), n;
|
|
353
354
|
}
|
|
354
355
|
function rt(e, t) {
|
|
355
|
-
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a =
|
|
356
|
+
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a = M(t.record);
|
|
356
357
|
if (i !== null || a === null) return n;
|
|
357
358
|
if (!n || n.record.id === r) return t;
|
|
358
359
|
let o = e.executions.get(r);
|
|
359
|
-
return o &&
|
|
360
|
+
return o && M(o.record) !== null ? n : Date.parse(a) >= Date.parse(M(n.record) ?? "") ? t : n;
|
|
360
361
|
}
|
|
361
362
|
function it(e, t) {
|
|
362
363
|
let { id: n, cell_id: r } = t.record;
|
|
@@ -373,10 +374,10 @@ function at(e, t) {
|
|
|
373
374
|
let r = n.record.cell_id, i = r !== null && e.latest.get(r) === t;
|
|
374
375
|
return {
|
|
375
376
|
...e,
|
|
376
|
-
executions:
|
|
377
|
-
variables: i ?
|
|
377
|
+
executions: P(e.executions, t),
|
|
378
|
+
variables: i ? P(e.variables, r) : e.variables,
|
|
378
379
|
scratchConsole: e.scratchConsole?.record.id === t ? void 0 : e.scratchConsole,
|
|
379
|
-
latest: i ?
|
|
380
|
+
latest: i ? P(e.latest, r) : e.latest
|
|
380
381
|
};
|
|
381
382
|
}
|
|
382
383
|
function ot(e, t) {
|
|
@@ -400,7 +401,7 @@ function st(e, t) {
|
|
|
400
401
|
for (let n of e.executions.values()) if (n.items.has(t)) return it(e, {
|
|
401
402
|
...n,
|
|
402
403
|
append: void 0,
|
|
403
|
-
items:
|
|
404
|
+
items: P(n.items, t)
|
|
404
405
|
});
|
|
405
406
|
return e;
|
|
406
407
|
}
|
|
@@ -416,7 +417,7 @@ function ct(e, t) {
|
|
|
416
417
|
function lt(e, t) {
|
|
417
418
|
for (let [n, r] of e.variables) if (r.has(t)) {
|
|
418
419
|
let i = new Map(e.variables);
|
|
419
|
-
return r.size === 1 ? i.delete(n) : i.set(n,
|
|
420
|
+
return r.size === 1 ? i.delete(n) : i.set(n, P(r, t)), {
|
|
420
421
|
...e,
|
|
421
422
|
variables: i
|
|
422
423
|
};
|
|
@@ -424,7 +425,7 @@ function lt(e, t) {
|
|
|
424
425
|
return e;
|
|
425
426
|
}
|
|
426
427
|
function ut(e, t) {
|
|
427
|
-
return JSON.stringify(
|
|
428
|
+
return JSON.stringify(j(e)) === JSON.stringify(j(t));
|
|
428
429
|
}
|
|
429
430
|
function dt(e, t) {
|
|
430
431
|
return {
|
|
@@ -476,7 +477,7 @@ var pt = {
|
|
|
476
477
|
},
|
|
477
478
|
"cell.removed": (e, { data: t }) => ({
|
|
478
479
|
...e,
|
|
479
|
-
results:
|
|
480
|
+
results: P(e.results, t.id)
|
|
480
481
|
}),
|
|
481
482
|
run: (e, { data: t }) => ({
|
|
482
483
|
...e,
|
|
@@ -485,7 +486,7 @@ var pt = {
|
|
|
485
486
|
}),
|
|
486
487
|
"run.removed": (e, { data: t }) => e.runs.has(t.id) ? {
|
|
487
488
|
...e,
|
|
488
|
-
runs:
|
|
489
|
+
runs: P(e.runs, t.id)
|
|
489
490
|
} : e,
|
|
490
491
|
execution: (e, { data: { execution: t } }) => {
|
|
491
492
|
let n = e.executions.get(t.id), r = {
|
|
@@ -513,7 +514,6 @@ var pt = {
|
|
|
513
514
|
outputVersion: n.outputVersion + +!ut(n, r)
|
|
514
515
|
});
|
|
515
516
|
},
|
|
516
|
-
"output.removed": (e) => e,
|
|
517
517
|
console: (e, { data: t }) => ot(e, {
|
|
518
518
|
...t.console,
|
|
519
519
|
kind: "console",
|
|
@@ -528,11 +528,20 @@ var pt = {
|
|
|
528
528
|
variable: (e, { data: t }) => ct(e, t.variable),
|
|
529
529
|
"variable.removed": (e, { data: t }) => lt(e, t.id)
|
|
530
530
|
}
|
|
531
|
-
}
|
|
531
|
+
};
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/core/state/atom-with-selected-inputs.ts
|
|
534
|
+
function mt(e, t, n) {
|
|
535
|
+
let r = g(e, t, ue);
|
|
536
|
+
return w((e) => n(e(r)));
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/core/executions/freshness.ts
|
|
540
|
+
var ht = {
|
|
532
541
|
sourceChanged: !1,
|
|
533
542
|
inputsChanged: !1
|
|
534
543
|
};
|
|
535
|
-
function
|
|
544
|
+
function gt(e) {
|
|
536
545
|
let t = /* @__PURE__ */ new Map();
|
|
537
546
|
for (let n of e.variables.values()) for (let e of n.values()) {
|
|
538
547
|
let n = t.get(e.name);
|
|
@@ -540,8 +549,8 @@ function ht(e) {
|
|
|
540
549
|
}
|
|
541
550
|
return t;
|
|
542
551
|
}
|
|
543
|
-
function
|
|
544
|
-
let t =
|
|
552
|
+
function _t(e) {
|
|
553
|
+
let t = gt(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
545
554
|
function i(e, n) {
|
|
546
555
|
let i = new Set(n).add(e.id);
|
|
547
556
|
for (let [n, a] of Object.entries(Qe(e))) {
|
|
@@ -551,7 +560,7 @@ function gt(e) {
|
|
|
551
560
|
let n = r(t.execution_id);
|
|
552
561
|
if (n === void 0) return !1;
|
|
553
562
|
if (n.runtime_id === e.runtime_id) return !0;
|
|
554
|
-
let i =
|
|
563
|
+
let i = N(n) ?? M(n), a = N(e);
|
|
555
564
|
return i !== null && a !== null && Date.parse(i) > Date.parse(a);
|
|
556
565
|
})) return !0;
|
|
557
566
|
continue;
|
|
@@ -578,50 +587,50 @@ function gt(e) {
|
|
|
578
587
|
}
|
|
579
588
|
return (t) => {
|
|
580
589
|
let n = e.results.get(t)?.record;
|
|
581
|
-
return n == null ?
|
|
590
|
+
return n == null ? ht : o(n, /* @__PURE__ */ new Set());
|
|
582
591
|
};
|
|
583
592
|
}
|
|
584
593
|
//#endregion
|
|
585
594
|
//#region src/core/executions/output.ts
|
|
586
|
-
var
|
|
587
|
-
function
|
|
595
|
+
var vt = /* @__PURE__ */ new Map(), yt = "application/vnd.marimo+error";
|
|
596
|
+
function bt(e) {
|
|
588
597
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
589
598
|
cell_id: e,
|
|
590
599
|
message: t
|
|
591
600
|
}));
|
|
592
601
|
}
|
|
593
|
-
function
|
|
602
|
+
function xt(e) {
|
|
594
603
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
595
604
|
}
|
|
596
|
-
function
|
|
597
|
-
return
|
|
605
|
+
function St(e) {
|
|
606
|
+
return xt(N(e) ?? M(e));
|
|
598
607
|
}
|
|
599
|
-
function
|
|
608
|
+
function Ct(e, t) {
|
|
600
609
|
return {
|
|
601
610
|
channel: "output",
|
|
602
611
|
mimetype: t.mimetype,
|
|
603
612
|
data: t.data,
|
|
604
|
-
timestamp:
|
|
613
|
+
timestamp: St(e)
|
|
605
614
|
};
|
|
606
615
|
}
|
|
607
|
-
function
|
|
616
|
+
function F(e, t) {
|
|
608
617
|
return {
|
|
609
618
|
channel: "marimo-error",
|
|
610
|
-
mimetype:
|
|
619
|
+
mimetype: yt,
|
|
611
620
|
data: t,
|
|
612
|
-
timestamp:
|
|
621
|
+
timestamp: St(e)
|
|
613
622
|
};
|
|
614
623
|
}
|
|
615
|
-
function
|
|
624
|
+
function wt(e) {
|
|
616
625
|
return e.related.at(0)?.cell_id ?? null;
|
|
617
626
|
}
|
|
618
|
-
function
|
|
627
|
+
function Tt(e) {
|
|
619
628
|
switch (e.kind) {
|
|
620
629
|
case "exception": return {
|
|
621
630
|
type: "exception",
|
|
622
631
|
exception_type: e.name ?? "Exception",
|
|
623
632
|
msg: e.message,
|
|
624
|
-
raising_cell:
|
|
633
|
+
raising_cell: wt(e),
|
|
625
634
|
traceback: e.traceback?.data ?? null
|
|
626
635
|
};
|
|
627
636
|
case "invalid-syntax": return {
|
|
@@ -638,78 +647,83 @@ function wt(e) {
|
|
|
638
647
|
type: "diagnostic",
|
|
639
648
|
kind: e.kind,
|
|
640
649
|
msg: e.message,
|
|
641
|
-
related:
|
|
650
|
+
related: bt(e.related)
|
|
642
651
|
};
|
|
643
652
|
}
|
|
644
653
|
}
|
|
645
|
-
function
|
|
654
|
+
function Et(e, t) {
|
|
646
655
|
let n = t.related[0];
|
|
647
|
-
if (n !== void 0 && t.reason === "upstream-stopped") return
|
|
656
|
+
if (n !== void 0 && t.reason === "upstream-stopped") return F(e, [{
|
|
648
657
|
type: "ancestor-stopped",
|
|
649
658
|
msg: t.message,
|
|
650
659
|
raising_cell: n.cell_id
|
|
651
660
|
}]);
|
|
652
661
|
if (n !== void 0 && t.reason === "upstream-failed") {
|
|
653
662
|
let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
|
|
654
|
-
return
|
|
663
|
+
return F(e, [{
|
|
655
664
|
type: "ancestor-prevented",
|
|
656
665
|
msg: t.message,
|
|
657
666
|
raising_cell: n.cell_id,
|
|
658
667
|
blamed_cell: r === void 0 ? null : r.cell_id
|
|
659
668
|
}]);
|
|
660
669
|
}
|
|
661
|
-
return
|
|
670
|
+
return F(e, [{
|
|
662
671
|
type: "diagnostic",
|
|
663
672
|
kind: t.reason,
|
|
664
673
|
msg: t.message,
|
|
665
|
-
related:
|
|
674
|
+
related: bt(t.related)
|
|
666
675
|
}]);
|
|
667
676
|
}
|
|
668
|
-
function
|
|
669
|
-
|
|
670
|
-
return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
|
|
677
|
+
function Dt(e, t = vt) {
|
|
678
|
+
return Ot(e, e.cell_id === null ? void 0 : t.get(e.cell_id));
|
|
671
679
|
}
|
|
672
|
-
function
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
680
|
+
function Ot(e, t) {
|
|
681
|
+
return t !== void 0 && t.code !== null && t.code_fingerprint === e.code_fingerprint ? t.code : void 0;
|
|
682
|
+
}
|
|
683
|
+
function kt(e, t, n) {
|
|
684
|
+
if (e === null || Nt(n, e)) return null;
|
|
685
|
+
let r = At(e), i = Ot(e.record, t);
|
|
686
|
+
return r === null || i === void 0 ? r : {
|
|
687
|
+
...r,
|
|
688
|
+
code: i
|
|
677
689
|
};
|
|
678
690
|
}
|
|
679
|
-
function
|
|
680
|
-
let { record: t } = e, n =
|
|
691
|
+
function At(e) {
|
|
692
|
+
let { record: t } = e, n = j(e);
|
|
681
693
|
if (n === null) return null;
|
|
682
694
|
switch (n.kind) {
|
|
683
|
-
case "output": return n.media === null ? null :
|
|
684
|
-
case "failed": return
|
|
685
|
-
case "cancelled": return
|
|
686
|
-
case "skipped": return
|
|
695
|
+
case "output": return n.media === null ? null : Ct(t, n.media);
|
|
696
|
+
case "failed": return F(t, [Tt(n.error)]);
|
|
697
|
+
case "cancelled": return F(t, [{ type: "interruption" }]);
|
|
698
|
+
case "skipped": return Et(t, n);
|
|
687
699
|
}
|
|
688
700
|
}
|
|
689
|
-
function
|
|
690
|
-
let n = e.executions.latest.get(t)
|
|
691
|
-
|
|
692
|
-
let i = e.results.get(t) ?? null;
|
|
693
|
-
return r?.record.state.status === "running" && i !== null && A(i)?.kind === "skipped" ? null : i;
|
|
701
|
+
function jt(e, t) {
|
|
702
|
+
let n = e.executions.latest.get(t);
|
|
703
|
+
return Mt(n === void 0 ? void 0 : e.executions.executions.get(n), e.results.get(t) ?? null);
|
|
694
704
|
}
|
|
695
|
-
function
|
|
696
|
-
return e
|
|
705
|
+
function Mt(e, t) {
|
|
706
|
+
return e !== void 0 && j(e) !== null && e.record.state.status !== "completed" ? e : e?.record.state.status === "running" && t !== null && j(t)?.kind === "skipped" ? null : t;
|
|
697
707
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
return n === null || At(e.cleared.get(t), n) ? null : Dt(n, e.cells);
|
|
708
|
+
function Nt(e, t) {
|
|
709
|
+
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
701
710
|
}
|
|
702
|
-
function
|
|
703
|
-
let t =
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
711
|
+
function Pt(e) {
|
|
712
|
+
let t = e.scratchFailure;
|
|
713
|
+
return t !== void 0 && e.scratch?.record.run_id !== t.runId ? {
|
|
714
|
+
channel: "marimo-error",
|
|
715
|
+
mimetype: yt,
|
|
716
|
+
data: [{
|
|
717
|
+
type: "unknown",
|
|
718
|
+
msg: t.message,
|
|
719
|
+
error_type: null
|
|
720
|
+
}],
|
|
721
|
+
timestamp: xt(t.completedAt)
|
|
722
|
+
} : kt(e.scratch);
|
|
709
723
|
}
|
|
710
724
|
//#endregion
|
|
711
725
|
//#region src/utils/time.ts
|
|
712
|
-
var
|
|
726
|
+
var Ft = class e {
|
|
713
727
|
ms;
|
|
714
728
|
static fromMilliseconds(t) {
|
|
715
729
|
return t == null ? null : new e(t);
|
|
@@ -738,17 +752,24 @@ var Nt = class e {
|
|
|
738
752
|
};
|
|
739
753
|
//#endregion
|
|
740
754
|
//#region src/core/executions/select.ts
|
|
741
|
-
function
|
|
755
|
+
function It(e) {
|
|
742
756
|
return e.state.status === "completed" ? e.state.outcome.kind : null;
|
|
743
757
|
}
|
|
744
|
-
|
|
745
|
-
|
|
758
|
+
var Lt = /* @__PURE__ */ new WeakMap();
|
|
759
|
+
function Rt(e) {
|
|
760
|
+
let t = Lt.get(e);
|
|
761
|
+
if (t) return t;
|
|
762
|
+
let n = M(e), r = N(e), i = n === null ? null : Ft.parse(n), a = {
|
|
763
|
+
startedAt: i,
|
|
764
|
+
duration: i === null || r === null ? null : Ft.parse(r).since(i)
|
|
765
|
+
};
|
|
766
|
+
return Lt.set(e, a), a;
|
|
746
767
|
}
|
|
747
|
-
function
|
|
768
|
+
function zt(e, t) {
|
|
748
769
|
let n = e.latest.get(t);
|
|
749
770
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
750
771
|
}
|
|
751
|
-
function
|
|
772
|
+
function Bt(e, t) {
|
|
752
773
|
let n = /* @__PURE__ */ new Set(), r = [...t], i = r.filter((e) => e.config.disabled);
|
|
753
774
|
if (i.length === 0) return n;
|
|
754
775
|
let a = new Map(r.map(({ id: e }) => [e, []]));
|
|
@@ -773,144 +794,230 @@ function Lt(e, t) {
|
|
|
773
794
|
}
|
|
774
795
|
return n;
|
|
775
796
|
}
|
|
776
|
-
function
|
|
797
|
+
function Vt(e, t) {
|
|
777
798
|
let n = e.cells.get(t);
|
|
778
799
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
779
800
|
}
|
|
780
|
-
function
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
for (let r of e.
|
|
801
|
+
function Ht(e, t) {
|
|
802
|
+
return Vt(e, t) ? e.requested.has(t) ? !0 : Ut(e.executions.runs, t, zt(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id) : !1;
|
|
803
|
+
}
|
|
804
|
+
function Ut(e, t, n) {
|
|
805
|
+
for (let r of e.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" && r.origin.cell_ids.includes(t)) return !0;
|
|
785
806
|
return !1;
|
|
786
807
|
}
|
|
787
|
-
function
|
|
788
|
-
let n =
|
|
789
|
-
|
|
790
|
-
|
|
808
|
+
function Wt(e, t) {
|
|
809
|
+
let n = zt(e.executions, t), r = e.results.get(t)?.record ?? null;
|
|
810
|
+
return Gt({
|
|
811
|
+
latest: n?.record ?? null,
|
|
812
|
+
result: r,
|
|
813
|
+
queued: Ht(e, t),
|
|
814
|
+
blocked: e.blocked.has(t),
|
|
815
|
+
shownBlocked: e.shownBlocked.has(t),
|
|
816
|
+
runtimeId: e.runtimeId
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
function Gt({ latest: e, result: t, queued: n, blocked: r, shownBlocked: i, runtimeId: a }) {
|
|
820
|
+
let o = "idle", s = t === null ? null : Rt(t), c = s?.startedAt?.toMilliseconds() ?? null;
|
|
821
|
+
e !== null && e.state.status !== "completed" ? (o = e.state.status, c = Rt(e).startedAt?.toMilliseconds() ?? c) : n && (o = "queued");
|
|
822
|
+
let l = o === "idle", u = l ? s?.duration ?? null : null;
|
|
791
823
|
return {
|
|
792
|
-
status:
|
|
793
|
-
blocked:
|
|
794
|
-
shownBlock:
|
|
795
|
-
outcome:
|
|
796
|
-
live:
|
|
797
|
-
startedAt:
|
|
798
|
-
duration:
|
|
824
|
+
status: o,
|
|
825
|
+
blocked: r,
|
|
826
|
+
shownBlock: r ? "current" : i ? "stale" : null,
|
|
827
|
+
outcome: l && t !== null ? It(t) : null,
|
|
828
|
+
live: t === null || a === null || t.runtime_id === a,
|
|
829
|
+
startedAt: c,
|
|
830
|
+
duration: u
|
|
799
831
|
};
|
|
800
832
|
}
|
|
801
|
-
function
|
|
833
|
+
function Kt(e) {
|
|
802
834
|
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
803
835
|
}
|
|
804
|
-
function
|
|
805
|
-
return
|
|
836
|
+
function qt(e) {
|
|
837
|
+
return Kt(e).some((e) => e.record.state.status === "running");
|
|
806
838
|
}
|
|
807
|
-
function
|
|
808
|
-
let t =
|
|
839
|
+
function Jt(e) {
|
|
840
|
+
let t = Kt(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
809
841
|
for (let t of e.executions.runs.values()) if (t.state.status !== "completed" && t.origin.kind === "cells") for (let e of t.origin.cell_ids) r.add(e);
|
|
810
842
|
let i = 0;
|
|
811
|
-
for (let t of r) !n.has(t) &&
|
|
843
|
+
for (let t of r) !n.has(t) && Ht(e, t) && (i += 1);
|
|
812
844
|
return t.length + i;
|
|
813
845
|
}
|
|
814
846
|
//#endregion
|
|
815
847
|
//#region src/core/executions/atoms.ts
|
|
816
|
-
var
|
|
848
|
+
var Yt = {
|
|
817
849
|
variables: /* @__PURE__ */ new Map(),
|
|
818
850
|
runs: /* @__PURE__ */ new Map(),
|
|
819
851
|
executions: /* @__PURE__ */ new Map(),
|
|
820
852
|
latest: /* @__PURE__ */ new Map(),
|
|
821
853
|
results: /* @__PURE__ */ new Map(),
|
|
822
854
|
scratch: null
|
|
823
|
-
},
|
|
824
|
-
function
|
|
855
|
+
}, Xt = /* @__PURE__ */ new Map(), Zt = /* @__PURE__ */ new Map(), Qt = /* @__PURE__ */ new Set(), $t = /* @__PURE__ */ new Set(), en = /* @__PURE__ */ new Set(), tn = /* @__PURE__ */ new Map(), I = w(null);
|
|
856
|
+
function nn(e, t) {
|
|
825
857
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
826
858
|
}
|
|
827
|
-
function
|
|
828
|
-
return e !== null &&
|
|
859
|
+
function rn(e, t, n) {
|
|
860
|
+
return e !== null && nn(e.notebook, t) ? e.value : n;
|
|
861
|
+
}
|
|
862
|
+
function an(e) {
|
|
863
|
+
return w((t) => {
|
|
864
|
+
let n = t(b), r = t(e);
|
|
865
|
+
if (n === null || r === null) return null;
|
|
866
|
+
let i = t(r.notebookAtom);
|
|
867
|
+
return i === null ? null : {
|
|
868
|
+
replica: n,
|
|
869
|
+
id: i.id,
|
|
870
|
+
generation: t(r.generationAtom)
|
|
871
|
+
};
|
|
872
|
+
});
|
|
829
873
|
}
|
|
830
|
-
var
|
|
831
|
-
|
|
832
|
-
return t
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
})
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
+
var on = an(b);
|
|
875
|
+
function sn(e, t) {
|
|
876
|
+
return nn(t.notebook, e.get(on));
|
|
877
|
+
}
|
|
878
|
+
function cn(e) {
|
|
879
|
+
let t = an(e), n = w((e) => {
|
|
880
|
+
let n = rn(e(I), e(t), Qt);
|
|
881
|
+
return n.size === 0 ? $t : new Set([...n].flatMap((e) => e.cells));
|
|
882
|
+
}), r = w((t) => {
|
|
883
|
+
let n = t(e), r = n && t(n.analysisAtom), i = r ? Bt(r.analysis, r.document.cells.values()) : en;
|
|
884
|
+
return {
|
|
885
|
+
shownBlocked: i,
|
|
886
|
+
blocked: r?.freshness === "current" ? i : en
|
|
887
|
+
};
|
|
888
|
+
});
|
|
889
|
+
return w((t) => {
|
|
890
|
+
let i = t(e), a = i === null ? null : t(i.shownDocumentAtom);
|
|
891
|
+
return {
|
|
892
|
+
executions: i === null ? Yt : t(i.executionsAtom),
|
|
893
|
+
results: i === null ? Xt : t(i.resultsAtom),
|
|
894
|
+
cells: a?.cells ?? Zt,
|
|
895
|
+
requested: t(n),
|
|
896
|
+
...t(r),
|
|
897
|
+
runtimeId: i === null ? null : t(i.runtimeAtom)?.id ?? null
|
|
898
|
+
};
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
var ln = cn(b), un = cn(m);
|
|
902
|
+
function dn(e) {
|
|
903
|
+
let t = g(w((t) => {
|
|
904
|
+
let n = t(e), r = n === null ? null : t(n.shownDocumentAtom);
|
|
905
|
+
return n === null || r === null ? {
|
|
906
|
+
cells: Zt,
|
|
907
|
+
executions: Yt,
|
|
908
|
+
results: Xt
|
|
909
|
+
} : {
|
|
910
|
+
cells: r.cells,
|
|
911
|
+
executions: t(n.executionsAtom),
|
|
912
|
+
results: t(n.resultsAtom)
|
|
913
|
+
};
|
|
914
|
+
}), (e) => e, (e, t) => e.cells === t.cells && e.executions.variables === t.executions.variables && e.executions.latest === t.executions.latest && fn(e.executions.executions, t.executions.executions) && fn(e.results, t.results));
|
|
915
|
+
return w((e) => _t(e(t)));
|
|
916
|
+
}
|
|
917
|
+
function fn(e, t) {
|
|
918
|
+
if (e === t) return !0;
|
|
919
|
+
if (e.size !== t.size) return !1;
|
|
920
|
+
for (let [n, r] of e) if (!t.has(n) || r?.record !== t.get(n)?.record) return !1;
|
|
921
|
+
return !0;
|
|
922
|
+
}
|
|
923
|
+
dn(b);
|
|
924
|
+
var pn = dn(m), mn = w(null), hn = w((e) => {
|
|
925
|
+
let t = e(b), n = e(m), r = n === null ? null : e(n.shownDocumentAtom);
|
|
926
|
+
return t === null || n === null || r === null ? null : {
|
|
874
927
|
replica: t,
|
|
875
|
-
id:
|
|
876
|
-
generation: e(
|
|
928
|
+
id: r.revision.notebook_id,
|
|
929
|
+
generation: e(n.generationAtom)
|
|
877
930
|
};
|
|
878
|
-
}),
|
|
879
|
-
let t = e(
|
|
931
|
+
}), L = w((e) => {
|
|
932
|
+
let t = e(m);
|
|
880
933
|
return {
|
|
881
|
-
executions: t === null ?
|
|
882
|
-
results: t === null ?
|
|
883
|
-
cleared:
|
|
884
|
-
cells: t === null ?
|
|
934
|
+
executions: t === null ? Yt : e(t.executionsAtom),
|
|
935
|
+
results: t === null ? Xt : e(t.resultsAtom),
|
|
936
|
+
cleared: rn(e(mn), e(hn), tn),
|
|
937
|
+
cells: t === null ? Zt : e(t.documentAtom)?.cells ?? Zt
|
|
885
938
|
};
|
|
886
|
-
}),
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
939
|
+
}), gn = g(L, (e) => [.../* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()])], ue);
|
|
940
|
+
w((e) => {
|
|
941
|
+
let t = /* @__PURE__ */ new Map();
|
|
942
|
+
for (let n of e(gn)) {
|
|
943
|
+
let r = e(R(n));
|
|
944
|
+
r !== null && t.set(n, r);
|
|
945
|
+
}
|
|
946
|
+
return t;
|
|
947
|
+
});
|
|
948
|
+
function _n(e, t) {
|
|
949
|
+
let n = e.latest.get(t);
|
|
950
|
+
return n === void 0 ? void 0 : e.executions.get(n);
|
|
951
|
+
}
|
|
952
|
+
var vn = v((e) => {
|
|
953
|
+
let t = mt(un, (t) => [
|
|
954
|
+
_n(t.executions, e)?.record,
|
|
955
|
+
t.results.get(e)?.record,
|
|
956
|
+
t.cells.get(e),
|
|
957
|
+
t.requested.has(e),
|
|
958
|
+
t.blocked.has(e),
|
|
959
|
+
t.shownBlocked.has(e),
|
|
960
|
+
t.runtimeId,
|
|
961
|
+
t.executions.runs
|
|
962
|
+
], ([t, n, r, i, a, o, s, c]) => Gt({
|
|
963
|
+
latest: t ?? null,
|
|
964
|
+
result: n ?? null,
|
|
965
|
+
blocked: a,
|
|
966
|
+
shownBlocked: o,
|
|
967
|
+
runtimeId: s,
|
|
968
|
+
queued: r !== void 0 && !r.config.disabled && !a && (i || Ut(c, e, t?.run_id ?? n?.run_id))
|
|
969
|
+
}));
|
|
970
|
+
return g(t, (e) => e, x);
|
|
971
|
+
}), R = v((e) => {
|
|
972
|
+
let t = mt(L, (t) => {
|
|
973
|
+
let n = _n(t.executions, e);
|
|
974
|
+
return [
|
|
975
|
+
n?.record,
|
|
976
|
+
n?.output,
|
|
977
|
+
n?.outputVersion,
|
|
978
|
+
t.results.get(e),
|
|
979
|
+
t.cleared.get(e),
|
|
980
|
+
t.cells.get(e)
|
|
981
|
+
];
|
|
982
|
+
}, ([e, t, n, r, i, a]) => kt(Mt(e ? {
|
|
983
|
+
record: e,
|
|
984
|
+
output: t ?? null,
|
|
985
|
+
outputVersion: n ?? 0
|
|
986
|
+
} : void 0, r ?? null), a, i));
|
|
987
|
+
return g(t, (e) => e, x);
|
|
988
|
+
});
|
|
989
|
+
g(mt(L, ({ executions: e }) => [e.scratch, e.scratchFailure], ([e, t]) => Pt({
|
|
990
|
+
scratch: e,
|
|
991
|
+
scratchFailure: t
|
|
992
|
+
})), (e) => e, x);
|
|
993
|
+
var yn = v((e) => g(pn, (t) => t(e), (e, t) => e.sourceChanged === t.sourceChanged && e.inputsChanged === t.inputsChanged)), bn = v((e) => w((t) => Je(t(R(e)))));
|
|
994
|
+
function xn(e) {
|
|
995
|
+
R.remove(e), vn.remove(e), yn.remove(e), bn.remove(e);
|
|
996
|
+
}
|
|
997
|
+
function Sn(e, t) {
|
|
998
|
+
let n = e.get(L), r = new Map(n.cleared);
|
|
892
999
|
for (let e of t) {
|
|
893
|
-
let t =
|
|
894
|
-
t != null &&
|
|
1000
|
+
let t = jt(n, e);
|
|
1001
|
+
t != null && j(t) !== null && r.set(e, {
|
|
895
1002
|
execution: t.record.id,
|
|
896
1003
|
version: t.outputVersion
|
|
897
1004
|
});
|
|
898
1005
|
}
|
|
899
|
-
let i = e.get(
|
|
900
|
-
e.set(
|
|
1006
|
+
let i = e.get(hn);
|
|
1007
|
+
e.set(mn, i === null ? null : {
|
|
901
1008
|
notebook: i,
|
|
902
1009
|
value: r
|
|
903
1010
|
});
|
|
904
1011
|
}
|
|
905
|
-
var
|
|
906
|
-
let t = e(
|
|
1012
|
+
var Cn = w((e) => {
|
|
1013
|
+
let t = e(b);
|
|
907
1014
|
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
908
1015
|
});
|
|
909
|
-
|
|
910
|
-
var
|
|
911
|
-
let t = e(
|
|
1016
|
+
w((e) => qt(e(ln).executions)), w((e) => Jt(e(ln)));
|
|
1017
|
+
var wn = w((e) => {
|
|
1018
|
+
let t = e(b);
|
|
912
1019
|
if (t === null) return { refused: "No notebook is connected" };
|
|
913
|
-
if (e(t.connectionAtom).state ===
|
|
1020
|
+
if (e(t.connectionAtom).state === A.CLOSED) return { refused: "The notebook is disconnected" };
|
|
914
1021
|
if (e(t.notebookAtom) === null) return "waiting";
|
|
915
1022
|
let n = e(t.runtimeAtom);
|
|
916
1023
|
if (n === null) return { refused: "The notebook has no runtime" };
|
|
@@ -923,58 +1030,66 @@ var fn = S((e) => {
|
|
|
923
1030
|
default: return "waiting";
|
|
924
1031
|
}
|
|
925
1032
|
});
|
|
926
|
-
function
|
|
1033
|
+
function Tn(e) {
|
|
927
1034
|
return new Promise((t, n) => {
|
|
928
|
-
let r = e.sub(
|
|
1035
|
+
let r = e.sub(wn, i);
|
|
929
1036
|
function i() {
|
|
930
|
-
let i = e.get(
|
|
1037
|
+
let i = e.get(wn);
|
|
931
1038
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
932
1039
|
}
|
|
933
1040
|
i();
|
|
934
1041
|
});
|
|
935
1042
|
}
|
|
936
|
-
function
|
|
937
|
-
let n = e.get(
|
|
1043
|
+
function En(e, t) {
|
|
1044
|
+
let n = e.get(on);
|
|
938
1045
|
if (n === null) return null;
|
|
939
1046
|
let r = {
|
|
940
1047
|
notebook: n,
|
|
941
1048
|
cells: [...t]
|
|
942
|
-
}, i =
|
|
943
|
-
return e.set(
|
|
1049
|
+
}, i = rn(e.get(I), n, Qt);
|
|
1050
|
+
return e.set(I, {
|
|
944
1051
|
notebook: n,
|
|
945
1052
|
value: new Set(i).add(r)
|
|
946
1053
|
}), r;
|
|
947
1054
|
}
|
|
948
|
-
function
|
|
949
|
-
let n = e.get(
|
|
1055
|
+
function Dn(e, t) {
|
|
1056
|
+
let n = e.get(I);
|
|
950
1057
|
if (n === null || !n.value.has(t)) return;
|
|
951
1058
|
let r = new Set(n.value);
|
|
952
|
-
r.delete(t), e.set(
|
|
1059
|
+
r.delete(t), e.set(I, {
|
|
953
1060
|
notebook: n.notebook,
|
|
954
1061
|
value: r
|
|
955
1062
|
});
|
|
956
1063
|
}
|
|
957
|
-
function
|
|
958
|
-
let r =
|
|
1064
|
+
function On(e, t, n) {
|
|
1065
|
+
let r = w((e) => nn(t.notebook, e(on)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
959
1066
|
function a() {
|
|
960
|
-
e.get(r) || (i(),
|
|
1067
|
+
e.get(r) || (i(), Dn(e, t));
|
|
961
1068
|
}
|
|
962
1069
|
a();
|
|
963
1070
|
}
|
|
964
1071
|
//#endregion
|
|
1072
|
+
//#region src/core/state/create-keyed-atom-hook.ts
|
|
1073
|
+
var kn = a();
|
|
1074
|
+
function An(e) {
|
|
1075
|
+
return function(t) {
|
|
1076
|
+
let n = (0, E.useMemo)(() => e(t), [t]);
|
|
1077
|
+
return C(n);
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
//#endregion
|
|
965
1081
|
//#region src/core/codemirror/editing/commands.ts
|
|
966
|
-
|
|
967
|
-
function vn(e) {
|
|
1082
|
+
function jn(e) {
|
|
968
1083
|
return (t) => {
|
|
969
1084
|
let n = !1;
|
|
970
1085
|
for (let r of t) r && (n = e(r) || n);
|
|
971
1086
|
return n;
|
|
972
1087
|
};
|
|
973
1088
|
}
|
|
974
|
-
var
|
|
1089
|
+
var Mn = jn(he), Nn = jn(me);
|
|
975
1090
|
//#endregion
|
|
976
1091
|
//#region src/utils/schedule-task.ts
|
|
977
|
-
function
|
|
1092
|
+
function Pn() {
|
|
978
1093
|
let e = globalThis.scheduler;
|
|
979
1094
|
if (typeof e?.postTask == "function") return (t) => {
|
|
980
1095
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -995,10 +1110,10 @@ function xn() {
|
|
|
995
1110
|
setTimeout(e, 0);
|
|
996
1111
|
};
|
|
997
1112
|
}
|
|
998
|
-
var
|
|
1113
|
+
var Fn = Pn();
|
|
999
1114
|
//#endregion
|
|
1000
1115
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
1001
|
-
function
|
|
1116
|
+
function In(e = Fn) {
|
|
1002
1117
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
1003
1118
|
function i() {
|
|
1004
1119
|
r || n.size === 0 || (r = !0, e(s));
|
|
@@ -1035,21 +1150,21 @@ function Cn(e = Sn) {
|
|
|
1035
1150
|
}
|
|
1036
1151
|
};
|
|
1037
1152
|
}
|
|
1038
|
-
var
|
|
1153
|
+
var Ln = In();
|
|
1039
1154
|
//#endregion
|
|
1040
1155
|
//#region src/core/mime.ts
|
|
1041
|
-
function
|
|
1156
|
+
function Rn(e) {
|
|
1042
1157
|
return e === "application/vnd.marimo+error";
|
|
1043
1158
|
}
|
|
1044
|
-
function
|
|
1159
|
+
function zn(e) {
|
|
1045
1160
|
return e === "application/vnd.marimo+traceback";
|
|
1046
1161
|
}
|
|
1047
|
-
function
|
|
1048
|
-
return
|
|
1162
|
+
function Bn(e) {
|
|
1163
|
+
return Rn(e) || zn(e);
|
|
1049
1164
|
}
|
|
1050
1165
|
//#endregion
|
|
1051
1166
|
//#region src/core/cells/command-console.ts
|
|
1052
|
-
function
|
|
1167
|
+
function Vn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
1053
1168
|
if (t === "callback-output" && !r && n.length === 0) return { entries: [] };
|
|
1054
1169
|
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) => ({
|
|
1055
1170
|
...e,
|
|
@@ -1060,18 +1175,18 @@ function Dn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1060
1175
|
}
|
|
1061
1176
|
//#endregion
|
|
1062
1177
|
//#region src/core/dom/ui-element-constants.ts
|
|
1063
|
-
var
|
|
1178
|
+
var Hn = "object-id", Un = "random-id", Wn = "abcdefghijklmnopqrstuvwxyz", Gn = Wn + Wn.toUpperCase(), Kn = /* @__PURE__ */ new Set(), z = "__scratch__", qn = "setup", Jn = { create() {
|
|
1064
1179
|
let e = 0, t;
|
|
1065
1180
|
do {
|
|
1066
1181
|
let n = "";
|
|
1067
|
-
for (let e = 0; e < 4; e++) n +=
|
|
1182
|
+
for (let e = 0; e < 4; e++) n += Gn[Math.floor(Math.random() * 52)];
|
|
1068
1183
|
t = n, e++;
|
|
1069
|
-
} while (
|
|
1184
|
+
} while (Kn.has(t) && e < 100);
|
|
1070
1185
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1071
|
-
return
|
|
1072
|
-
} },
|
|
1186
|
+
return Kn.add(t), t;
|
|
1187
|
+
} }, B = {
|
|
1073
1188
|
create(e) {
|
|
1074
|
-
return
|
|
1189
|
+
return T(e != null, "cellId is required"), `cell-${e}`;
|
|
1075
1190
|
},
|
|
1076
1191
|
parse(e) {
|
|
1077
1192
|
return e.slice(5);
|
|
@@ -1082,7 +1197,7 @@ var On = "object-id", kn = "random-id", An = "abcdefghijklmnopqrstuvwxyz", jn =
|
|
|
1082
1197
|
findElementThroughShadowDOMs(e) {
|
|
1083
1198
|
let t = e;
|
|
1084
1199
|
for (; t;) {
|
|
1085
|
-
let e =
|
|
1200
|
+
let e = B.findElement(t);
|
|
1086
1201
|
if (e) return e;
|
|
1087
1202
|
let n = t.getRootNode();
|
|
1088
1203
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -1090,21 +1205,21 @@ var On = "object-id", kn = "random-id", An = "abcdefghijklmnopqrstuvwxyz", jn =
|
|
|
1090
1205
|
return null;
|
|
1091
1206
|
}
|
|
1092
1207
|
};
|
|
1093
|
-
function
|
|
1094
|
-
let t = null, n =
|
|
1095
|
-
return n && (t =
|
|
1208
|
+
function Yn(e) {
|
|
1209
|
+
let t = null, n = B.findElementThroughShadowDOMs(e);
|
|
1210
|
+
return n && (t = B.parse(n.id)), t;
|
|
1096
1211
|
}
|
|
1097
|
-
var
|
|
1212
|
+
var Xn = {
|
|
1098
1213
|
parse(e) {
|
|
1099
|
-
return e.getAttribute(
|
|
1214
|
+
return e.getAttribute(Hn);
|
|
1100
1215
|
},
|
|
1101
1216
|
parseOrThrow(e) {
|
|
1102
|
-
let t =
|
|
1103
|
-
return
|
|
1217
|
+
let t = Xn.parse(e);
|
|
1218
|
+
return T(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1104
1219
|
}
|
|
1105
|
-
},
|
|
1220
|
+
}, Zn = { create(e) {
|
|
1106
1221
|
return `output-${e}`;
|
|
1107
|
-
} },
|
|
1222
|
+
} }, Qn = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, $n = class e {
|
|
1108
1223
|
static get INSTANCE() {
|
|
1109
1224
|
let t = "_marimo_private_VirtualFileTracker";
|
|
1110
1225
|
return window[t] || (window[t] = new e()), window[t];
|
|
@@ -1126,7 +1241,7 @@ var In = {
|
|
|
1126
1241
|
switch (t.mimetype) {
|
|
1127
1242
|
case "application/json":
|
|
1128
1243
|
case "text/html": {
|
|
1129
|
-
let r = n.get(e), i =
|
|
1244
|
+
let r = n.get(e), i = er(t.data);
|
|
1130
1245
|
r?.forEach((e) => i.add(e)), n.set(e, i);
|
|
1131
1246
|
return;
|
|
1132
1247
|
}
|
|
@@ -1142,15 +1257,15 @@ var In = {
|
|
|
1142
1257
|
this.virtualFiles.delete(e), this.callbackFiles.delete(e);
|
|
1143
1258
|
}
|
|
1144
1259
|
};
|
|
1145
|
-
function
|
|
1260
|
+
function er(e) {
|
|
1146
1261
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1147
|
-
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(
|
|
1262
|
+
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(Qn);
|
|
1148
1263
|
if (n) for (let e of n) t.add(e);
|
|
1149
1264
|
return t;
|
|
1150
1265
|
}
|
|
1151
1266
|
//#endregion
|
|
1152
1267
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
1153
|
-
var
|
|
1268
|
+
var tr = class e {
|
|
1154
1269
|
lines = [""];
|
|
1155
1270
|
cursor = {
|
|
1156
1271
|
row: 0,
|
|
@@ -1252,7 +1367,7 @@ var Vn = class e {
|
|
|
1252
1367
|
render() {
|
|
1253
1368
|
return this.lines.join("\n");
|
|
1254
1369
|
}
|
|
1255
|
-
},
|
|
1370
|
+
}, nr = class {
|
|
1256
1371
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
1257
1372
|
parse(e) {
|
|
1258
1373
|
let t = [], n = 0;
|
|
@@ -1271,13 +1386,13 @@ var Vn = class e {
|
|
|
1271
1386
|
value: e.slice(n)
|
|
1272
1387
|
}), t;
|
|
1273
1388
|
}
|
|
1274
|
-
},
|
|
1275
|
-
parser = new
|
|
1389
|
+
}, rr = class e {
|
|
1390
|
+
parser = new nr();
|
|
1276
1391
|
buffer;
|
|
1277
1392
|
incompleteEscape = "";
|
|
1278
1393
|
static INCOMPLETE_ESCAPE = new RegExp(String.raw`\u001B(?:\[[0-9;]*|\()?$`, "u");
|
|
1279
1394
|
constructor(e = 0) {
|
|
1280
|
-
this.buffer = new
|
|
1395
|
+
this.buffer = new tr(e);
|
|
1281
1396
|
}
|
|
1282
1397
|
copy(t = 0) {
|
|
1283
1398
|
let n = new e();
|
|
@@ -1301,7 +1416,7 @@ var Vn = class e {
|
|
|
1301
1416
|
for (let e of r) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
1302
1417
|
}
|
|
1303
1418
|
reset() {
|
|
1304
|
-
this.buffer = new
|
|
1419
|
+
this.buffer = new tr(), this.incompleteEscape = "";
|
|
1305
1420
|
}
|
|
1306
1421
|
render() {
|
|
1307
1422
|
return this.buffer.render();
|
|
@@ -1345,7 +1460,7 @@ var Vn = class e {
|
|
|
1345
1460
|
return n;
|
|
1346
1461
|
}
|
|
1347
1462
|
};
|
|
1348
|
-
function
|
|
1463
|
+
function ir(e) {
|
|
1349
1464
|
let t = 1;
|
|
1350
1465
|
for (let n = 0; n < e.length; n++) {
|
|
1351
1466
|
let r = e.charCodeAt(n);
|
|
@@ -1354,7 +1469,7 @@ function Wn(e) {
|
|
|
1354
1469
|
}
|
|
1355
1470
|
return t;
|
|
1356
1471
|
}
|
|
1357
|
-
var
|
|
1472
|
+
var V = class e {
|
|
1358
1473
|
mimetype;
|
|
1359
1474
|
channel;
|
|
1360
1475
|
timestamp;
|
|
@@ -1376,14 +1491,14 @@ var U = class e {
|
|
|
1376
1491
|
}
|
|
1377
1492
|
appendData(t) {
|
|
1378
1493
|
if (!this.terminal) {
|
|
1379
|
-
let n =
|
|
1494
|
+
let n = ir(t);
|
|
1380
1495
|
if (n !== void 0) return new e(this, {
|
|
1381
1496
|
data: this.data + t,
|
|
1382
1497
|
lineCount: this.lineCount + n - 1,
|
|
1383
1498
|
firstPlainRow: this.firstPlainRow
|
|
1384
1499
|
});
|
|
1385
1500
|
}
|
|
1386
|
-
let n = this.terminal?.copy() ?? new
|
|
1501
|
+
let n = this.terminal?.copy() ?? new rr(this.firstPlainRow);
|
|
1387
1502
|
this.terminal || n.append(this.data), n.append(t);
|
|
1388
1503
|
let r = n.render();
|
|
1389
1504
|
return new e(this, {
|
|
@@ -1411,52 +1526,52 @@ var U = class e {
|
|
|
1411
1526
|
...this.code === void 0 ? {} : { code: this.code }
|
|
1412
1527
|
};
|
|
1413
1528
|
}
|
|
1414
|
-
},
|
|
1415
|
-
function
|
|
1529
|
+
}, ar = 5e3;
|
|
1530
|
+
function or(e, t = ar) {
|
|
1416
1531
|
let n = e.slice(0, -1), r = e.at(-1);
|
|
1417
|
-
return r &&
|
|
1532
|
+
return r && cr(n, r), pr(n, t);
|
|
1418
1533
|
}
|
|
1419
|
-
function
|
|
1534
|
+
function sr(e) {
|
|
1420
1535
|
let t = [];
|
|
1421
1536
|
for (let n = 0; n < e.length;) {
|
|
1422
1537
|
let r = e[n], i = n + 1;
|
|
1423
|
-
for (; i < e.length &&
|
|
1424
|
-
if (i === n + 1)
|
|
1538
|
+
for (; i < e.length && lr(r, e[i]);) i++;
|
|
1539
|
+
if (i === n + 1) cr(t, r);
|
|
1425
1540
|
else {
|
|
1426
|
-
let a = e.slice(n, i).map((e) => (
|
|
1427
|
-
t.push(
|
|
1541
|
+
let a = e.slice(n, i).map((e) => (fr(e), e.data));
|
|
1542
|
+
t.push(V.create({
|
|
1428
1543
|
...r,
|
|
1429
1544
|
data: a.join("")
|
|
1430
1545
|
}));
|
|
1431
1546
|
}
|
|
1432
1547
|
n = i;
|
|
1433
1548
|
}
|
|
1434
|
-
return
|
|
1549
|
+
return pr(t, ar);
|
|
1435
1550
|
}
|
|
1436
|
-
function
|
|
1551
|
+
function cr(e, t) {
|
|
1437
1552
|
let n = e.at(-1);
|
|
1438
|
-
n &&
|
|
1553
|
+
n && lr(n, t) ? (fr(n), fr(t), e[e.length - 1] = dr(n, t)) : e.push(ur(t));
|
|
1439
1554
|
}
|
|
1440
|
-
function
|
|
1555
|
+
function lr(e, t) {
|
|
1441
1556
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
1442
1557
|
if (!n) return !1;
|
|
1443
1558
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
1444
1559
|
return n && r && i;
|
|
1445
1560
|
}
|
|
1446
|
-
function
|
|
1447
|
-
return e instanceof
|
|
1561
|
+
function ur(e) {
|
|
1562
|
+
return e instanceof V ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? V.create(e) : e;
|
|
1448
1563
|
}
|
|
1449
|
-
function
|
|
1450
|
-
return e instanceof
|
|
1564
|
+
function dr(e, t) {
|
|
1565
|
+
return e instanceof V ? e.appendData(t.data) : V.create(e).appendData(t.data);
|
|
1451
1566
|
}
|
|
1452
|
-
function
|
|
1453
|
-
|
|
1567
|
+
function fr(e) {
|
|
1568
|
+
T(typeof e.data == "string", "expected string output");
|
|
1454
1569
|
}
|
|
1455
|
-
function
|
|
1570
|
+
function pr(e, t) {
|
|
1456
1571
|
let n = 0, r;
|
|
1457
1572
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1458
1573
|
let t = e[r];
|
|
1459
|
-
t.mimetype === "text/plain" ? (
|
|
1574
|
+
t.mimetype === "text/plain" ? (T(typeof t.data == "string", "expected string"), n += t instanceof V ? t.lineCount : t.data.split("\n").length) : n++;
|
|
1460
1575
|
}
|
|
1461
1576
|
if (n < t) return e;
|
|
1462
1577
|
let i = r + 1, a = [{
|
|
@@ -1467,8 +1582,8 @@ function $n(e, t) {
|
|
|
1467
1582
|
}, ...e.slice(0, i).filter((e) => e.channel === "stdin" && e.response === void 0)], o = e[i];
|
|
1468
1583
|
if (o?.channel === "stdin" && o.response === void 0) return [...a, ...e.slice(i)];
|
|
1469
1584
|
if (o?.mimetype === "text/plain") {
|
|
1470
|
-
|
|
1471
|
-
let r = n - t, s = o instanceof
|
|
1585
|
+
T(typeof o.data == "string", "expected string");
|
|
1586
|
+
let r = n - t, s = o instanceof V ? o.dropFirstLines(r) : {
|
|
1472
1587
|
...o,
|
|
1473
1588
|
data: o.data.split("\n").slice(r).join("\n")
|
|
1474
1589
|
};
|
|
@@ -1482,18 +1597,18 @@ function $n(e, t) {
|
|
|
1482
1597
|
}
|
|
1483
1598
|
//#endregion
|
|
1484
1599
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1485
|
-
function
|
|
1600
|
+
function mr(e, t) {
|
|
1486
1601
|
return be(e * 1e3, t?.in);
|
|
1487
1602
|
}
|
|
1488
1603
|
//#endregion
|
|
1489
1604
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1490
|
-
var
|
|
1605
|
+
var hr = function(e, t) {
|
|
1491
1606
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1492
|
-
},
|
|
1607
|
+
}, H;
|
|
1493
1608
|
(function(e) {
|
|
1494
1609
|
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";
|
|
1495
|
-
})(
|
|
1496
|
-
var
|
|
1610
|
+
})(H ||= {});
|
|
1611
|
+
var gr = class {
|
|
1497
1612
|
constructor() {
|
|
1498
1613
|
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 = {
|
|
1499
1614
|
http: 1,
|
|
@@ -1725,57 +1840,57 @@ var nr = class {
|
|
|
1725
1840
|
}
|
|
1726
1841
|
get_next_packet() {
|
|
1727
1842
|
var e = {
|
|
1728
|
-
kind:
|
|
1843
|
+
kind: H.EOS,
|
|
1729
1844
|
text: "",
|
|
1730
1845
|
url: ""
|
|
1731
1846
|
}, t = this._buffer.length;
|
|
1732
1847
|
if (t == 0) return e;
|
|
1733
1848
|
var n = this._buffer.indexOf("\x1B");
|
|
1734
|
-
if (n == -1) return e.kind =
|
|
1735
|
-
if (n > 0) return e.kind =
|
|
1849
|
+
if (n == -1) return e.kind = H.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1850
|
+
if (n > 0) return e.kind = H.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1736
1851
|
if (n == 0) {
|
|
1737
|
-
if (t < 3) return e.kind =
|
|
1852
|
+
if (t < 3) return e.kind = H.Incomplete, e;
|
|
1738
1853
|
var r = this._buffer.charAt(1);
|
|
1739
|
-
if (r != "[" && r != "]" && r != "(") return e.kind =
|
|
1854
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1740
1855
|
if (r == "[") {
|
|
1741
|
-
this._csi_regex ||=
|
|
1856
|
+
this._csi_regex ||= _r(yr ||= hr(["\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 "]));
|
|
1742
1857
|
let t = this._buffer.match(this._csi_regex);
|
|
1743
|
-
if (t === null) return e.kind =
|
|
1744
|
-
if (t[4]) return e.kind =
|
|
1745
|
-
e.kind = t[1] != "" || t[3] != "m" ?
|
|
1858
|
+
if (t === null) return e.kind = H.Incomplete, e;
|
|
1859
|
+
if (t[4]) return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1860
|
+
e.kind = t[1] != "" || t[3] != "m" ? H.Unknown : H.SGR, e.text = t[2];
|
|
1746
1861
|
var i = t[0].length;
|
|
1747
1862
|
return this._buffer = this._buffer.slice(i), e;
|
|
1748
1863
|
}
|
|
1749
1864
|
if (r == "]") {
|
|
1750
|
-
if (t < 4) return e.kind =
|
|
1751
|
-
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind =
|
|
1752
|
-
this._osc_st ||=
|
|
1865
|
+
if (t < 4) return e.kind = H.Incomplete, e;
|
|
1866
|
+
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1867
|
+
this._osc_st ||= vr(br ||= hr(["\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;
|
|
1753
1868
|
{
|
|
1754
1869
|
let t = this._osc_st.exec(this._buffer);
|
|
1755
|
-
if (t === null) return e.kind =
|
|
1756
|
-
if (t[3]) return e.kind =
|
|
1870
|
+
if (t === null) return e.kind = H.Incomplete, e;
|
|
1871
|
+
if (t[3]) return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1757
1872
|
}
|
|
1758
1873
|
{
|
|
1759
1874
|
let t = this._osc_st.exec(this._buffer);
|
|
1760
|
-
if (t === null) return e.kind =
|
|
1761
|
-
if (t[3]) return e.kind =
|
|
1875
|
+
if (t === null) return e.kind = H.Incomplete, e;
|
|
1876
|
+
if (t[3]) return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1762
1877
|
}
|
|
1763
|
-
this._osc_regex ||=
|
|
1878
|
+
this._osc_regex ||= _r(xr ||= hr(["\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 "]));
|
|
1764
1879
|
let n = this._buffer.match(this._osc_regex);
|
|
1765
|
-
if (n === null) return e.kind =
|
|
1766
|
-
e.kind =
|
|
1880
|
+
if (n === null) return e.kind = H.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1881
|
+
e.kind = H.OSCURL, e.url = n[1], e.text = n[2];
|
|
1767
1882
|
var i = n[0].length;
|
|
1768
1883
|
return this._buffer = this._buffer.slice(i), e;
|
|
1769
1884
|
}
|
|
1770
|
-
if (r == "(") return e.kind =
|
|
1885
|
+
if (r == "(") return e.kind = H.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1771
1886
|
}
|
|
1772
1887
|
}
|
|
1773
1888
|
ansi_to_html(e) {
|
|
1774
1889
|
this.append_buffer(e);
|
|
1775
1890
|
for (var t = [];;) {
|
|
1776
1891
|
var n = this.get_next_packet();
|
|
1777
|
-
if (n.kind ==
|
|
1778
|
-
n.kind !=
|
|
1892
|
+
if (n.kind == H.EOS || n.kind == H.Incomplete) break;
|
|
1893
|
+
n.kind != H.ESC && n.kind != H.Unknown && (n.kind == H.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == H.SGR ? this.process_ansi(n) : n.kind == H.OSCURL && t.push(this.process_hyperlink(n)));
|
|
1779
1894
|
}
|
|
1780
1895
|
return t.join("");
|
|
1781
1896
|
}
|
|
@@ -1845,16 +1960,16 @@ var nr = class {
|
|
|
1845
1960
|
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>`;
|
|
1846
1961
|
}
|
|
1847
1962
|
};
|
|
1848
|
-
function
|
|
1963
|
+
function _r(e, ...t) {
|
|
1849
1964
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1850
1965
|
return new RegExp(n);
|
|
1851
1966
|
}
|
|
1852
|
-
function
|
|
1967
|
+
function vr(e, ...t) {
|
|
1853
1968
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1854
1969
|
return new RegExp(n, "g");
|
|
1855
1970
|
}
|
|
1856
|
-
var
|
|
1857
|
-
function
|
|
1971
|
+
var yr, br, xr, Sr = new gr();
|
|
1972
|
+
function U(e) {
|
|
1858
1973
|
try {
|
|
1859
1974
|
let t = document.createElement("div");
|
|
1860
1975
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
@@ -1862,24 +1977,24 @@ function G(e) {
|
|
|
1862
1977
|
return t.error("Error parsing HTML content:", n), e;
|
|
1863
1978
|
}
|
|
1864
1979
|
}
|
|
1865
|
-
function
|
|
1980
|
+
function Cr(e) {
|
|
1866
1981
|
if (!e) return "";
|
|
1867
1982
|
try {
|
|
1868
|
-
return
|
|
1983
|
+
return U(Sr.ansi_to_html(e));
|
|
1869
1984
|
} catch (n) {
|
|
1870
1985
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1871
1986
|
}
|
|
1872
1987
|
}
|
|
1873
1988
|
//#endregion
|
|
1874
1989
|
//#region src/core/errors/traceback-atom.ts
|
|
1875
|
-
var
|
|
1990
|
+
var wr = w(null);
|
|
1876
1991
|
//#endregion
|
|
1877
1992
|
//#region src/core/cells/logs.ts
|
|
1878
|
-
function
|
|
1993
|
+
function Tr(e) {
|
|
1879
1994
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1880
1995
|
}
|
|
1881
|
-
var
|
|
1882
|
-
function
|
|
1996
|
+
var Er = !1;
|
|
1997
|
+
function Dr(e) {
|
|
1883
1998
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1884
1999
|
for (let r of n) {
|
|
1885
2000
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1889,7 +2004,7 @@ function pr(e) {
|
|
|
1889
2004
|
case "stdout":
|
|
1890
2005
|
case "stderr":
|
|
1891
2006
|
case "marimo-error": {
|
|
1892
|
-
let a = d.asString(r.data), o = i ?
|
|
2007
|
+
let a = d.asString(r.data), o = i ? U(a) : a;
|
|
1893
2008
|
t.push({
|
|
1894
2009
|
timestamp: r.timestamp || Date.now(),
|
|
1895
2010
|
level: n ? "stderr" : "stdout",
|
|
@@ -1904,9 +2019,9 @@ function pr(e) {
|
|
|
1904
2019
|
}
|
|
1905
2020
|
}
|
|
1906
2021
|
}
|
|
1907
|
-
if (t.forEach(
|
|
2022
|
+
if (t.forEach(Or.log), n.length === 0 && Bn(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1908
2023
|
e.output.data.forEach((t) => {
|
|
1909
|
-
|
|
2024
|
+
Or.log({
|
|
1910
2025
|
level: "stderr",
|
|
1911
2026
|
source: {
|
|
1912
2027
|
type: "cell",
|
|
@@ -1916,18 +2031,18 @@ function pr(e) {
|
|
|
1916
2031
|
message: JSON.stringify(t)
|
|
1917
2032
|
});
|
|
1918
2033
|
});
|
|
1919
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n =
|
|
1920
|
-
if (t.length > 0 && !
|
|
1921
|
-
|
|
2034
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = p.get(_e) === "read";
|
|
2035
|
+
if (t.length > 0 && !Er && n) {
|
|
2036
|
+
Er = !0;
|
|
1922
2037
|
let e = t.find((e) => e.traceback);
|
|
1923
2038
|
o(e ? {
|
|
1924
2039
|
title: "An internal error occurred",
|
|
1925
2040
|
description: e.msg || "Click 'View' to see traceback",
|
|
1926
2041
|
variant: "danger",
|
|
1927
|
-
action:
|
|
2042
|
+
action: E.createElement(se, {
|
|
1928
2043
|
altText: "View traceback",
|
|
1929
2044
|
onClick: () => {
|
|
1930
|
-
|
|
2045
|
+
p.set(wr, {
|
|
1931
2046
|
traceback: e.traceback,
|
|
1932
2047
|
errorMessage: e.msg || "An internal error occurred"
|
|
1933
2048
|
});
|
|
@@ -1942,13 +2057,13 @@ function pr(e) {
|
|
|
1942
2057
|
}
|
|
1943
2058
|
return t;
|
|
1944
2059
|
}
|
|
1945
|
-
var
|
|
2060
|
+
var Or = { log: (e) => {
|
|
1946
2061
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1947
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
2062
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${kr(e.timestamp)}]`, `(${Tr(e.source)}) ${e.message}`);
|
|
1948
2063
|
} };
|
|
1949
|
-
function
|
|
2064
|
+
function kr(e) {
|
|
1950
2065
|
try {
|
|
1951
|
-
return
|
|
2066
|
+
return mr(e).toLocaleTimeString(void 0, {
|
|
1952
2067
|
hour12: !0,
|
|
1953
2068
|
hour: "numeric",
|
|
1954
2069
|
minute: "numeric",
|
|
@@ -1958,26 +2073,26 @@ function hr(e) {
|
|
|
1958
2073
|
return "";
|
|
1959
2074
|
}
|
|
1960
2075
|
}
|
|
1961
|
-
var
|
|
1962
|
-
function
|
|
2076
|
+
var Ar = /* @__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("."));
|
|
2077
|
+
function jr(e, t = !0) {
|
|
1963
2078
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
1964
2079
|
}
|
|
1965
|
-
function
|
|
1966
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
2080
|
+
function Mr(e, t) {
|
|
2081
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !Ar.has(e);
|
|
1967
2082
|
if (i(e)) return e;
|
|
1968
2083
|
let a = 1;
|
|
1969
2084
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
1970
2085
|
return r;
|
|
1971
2086
|
}
|
|
1972
|
-
function
|
|
1973
|
-
return
|
|
2087
|
+
function Nr(e, t) {
|
|
2088
|
+
return Pr(e) ? `cell-${t}` : e;
|
|
1974
2089
|
}
|
|
1975
|
-
function
|
|
2090
|
+
function Pr(e) {
|
|
1976
2091
|
return !e || e === "_" || e === "__";
|
|
1977
2092
|
}
|
|
1978
2093
|
//#endregion
|
|
1979
2094
|
//#region src/core/cells/types.ts
|
|
1980
|
-
function
|
|
2095
|
+
function Fr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
1981
2096
|
return {
|
|
1982
2097
|
id: e,
|
|
1983
2098
|
config: r || {
|
|
@@ -1990,7 +2105,7 @@ function xr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
1990
2105
|
code: n
|
|
1991
2106
|
};
|
|
1992
2107
|
}
|
|
1993
|
-
function
|
|
2108
|
+
function Ir(e) {
|
|
1994
2109
|
return {
|
|
1995
2110
|
hide_code: !1,
|
|
1996
2111
|
disabled: !1,
|
|
@@ -1999,7 +2114,7 @@ function Sr(e) {
|
|
|
1999
2114
|
...e
|
|
2000
2115
|
};
|
|
2001
2116
|
}
|
|
2002
|
-
function
|
|
2117
|
+
function Lr(e) {
|
|
2003
2118
|
return {
|
|
2004
2119
|
embeddedConsole: [],
|
|
2005
2120
|
...e
|
|
@@ -2007,7 +2122,7 @@ function Cr(e) {
|
|
|
2007
2122
|
}
|
|
2008
2123
|
//#endregion
|
|
2009
2124
|
//#region src/core/cells/execution-console.ts
|
|
2010
|
-
function
|
|
2125
|
+
function Rr(e, t, n) {
|
|
2011
2126
|
let r = e.time === void 0 ? t : Date.parse(e.time) / 1e3, i = e.seq + 1;
|
|
2012
2127
|
switch (e.kind) {
|
|
2013
2128
|
case "console":
|
|
@@ -2038,47 +2153,46 @@ function wr(e, t, n) {
|
|
|
2038
2153
|
};
|
|
2039
2154
|
}
|
|
2040
2155
|
}
|
|
2041
|
-
function
|
|
2156
|
+
function zr(e, t) {
|
|
2042
2157
|
return {
|
|
2043
2158
|
onOutput(e, t) {
|
|
2044
|
-
|
|
2159
|
+
$n.INSTANCE.trackOutput(e, t);
|
|
2045
2160
|
},
|
|
2046
2161
|
onExecution(n, r) {
|
|
2047
2162
|
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
2048
2163
|
},
|
|
2049
2164
|
onItem(t, n, r) {
|
|
2050
|
-
let i = t.cell_id ?? "__scratch__", a =
|
|
2051
|
-
o.channel === "media" &&
|
|
2165
|
+
let i = t.cell_id ?? "__scratch__", a = M(t), o = Rr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2166
|
+
o.channel === "media" && $n.INSTANCE.track({
|
|
2052
2167
|
cell_id: i,
|
|
2053
2168
|
output: o
|
|
2054
|
-
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs:
|
|
2169
|
+
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs: Dr({
|
|
2055
2170
|
cell_id: i,
|
|
2056
2171
|
console: o
|
|
2057
2172
|
}) });
|
|
2058
2173
|
}
|
|
2059
2174
|
};
|
|
2060
2175
|
}
|
|
2061
|
-
function
|
|
2062
|
-
let n = e(h);
|
|
2176
|
+
function Br(e, t, n = e(b)) {
|
|
2063
2177
|
if (!n) return;
|
|
2064
2178
|
let r = e(n.executionsAtom);
|
|
2065
2179
|
if (t === "__scratch__") return r.scratchConsole;
|
|
2066
2180
|
let i = r.latest.get(t);
|
|
2067
2181
|
return i === void 0 ? void 0 : r.executions.get(i);
|
|
2068
2182
|
}
|
|
2069
|
-
function
|
|
2183
|
+
function Vr(e, t) {
|
|
2070
2184
|
let { local: n, execution: r, code: i } = e;
|
|
2071
2185
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2072
|
-
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a &&
|
|
2186
|
+
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && M(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2073
2187
|
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;
|
|
2074
|
-
let t =
|
|
2188
|
+
let t = Rr(e, l, i);
|
|
2075
2189
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
2076
2190
|
}, d = n.commandConsole?.entries, f = r?.append;
|
|
2077
2191
|
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))) {
|
|
2078
2192
|
let n = u(f.item), r = t.rendered.consoleOutputs;
|
|
2079
2193
|
return {
|
|
2080
2194
|
...e,
|
|
2081
|
-
rendered: { consoleOutputs: n ?
|
|
2195
|
+
rendered: { consoleOutputs: n ? or([...r, n]) : r }
|
|
2082
2196
|
};
|
|
2083
2197
|
}
|
|
2084
2198
|
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : nt(r).flatMap((e) => u(e) ?? []);
|
|
@@ -2091,12 +2205,12 @@ function Dr(e, t) {
|
|
|
2091
2205
|
}
|
|
2092
2206
|
return {
|
|
2093
2207
|
...e,
|
|
2094
|
-
rendered: { consoleOutputs:
|
|
2208
|
+
rendered: { consoleOutputs: sr(p) }
|
|
2095
2209
|
};
|
|
2096
2210
|
}
|
|
2097
2211
|
//#endregion
|
|
2098
2212
|
//#region src/core/cells/columns.ts
|
|
2099
|
-
function
|
|
2213
|
+
function Hr(e) {
|
|
2100
2214
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
2101
2215
|
for (let r of e.order) {
|
|
2102
2216
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -2104,9 +2218,9 @@ function Or(e) {
|
|
|
2104
2218
|
}
|
|
2105
2219
|
return t;
|
|
2106
2220
|
}
|
|
2107
|
-
function
|
|
2221
|
+
function Ur(e) {
|
|
2108
2222
|
let t = [[]];
|
|
2109
|
-
for (let [n, r] of
|
|
2223
|
+
for (let [n, r] of Hr(e)) {
|
|
2110
2224
|
for (; t.length <= r;) t.push([]);
|
|
2111
2225
|
t[r].push(n);
|
|
2112
2226
|
}
|
|
@@ -2114,21 +2228,21 @@ function kr(e) {
|
|
|
2114
2228
|
}
|
|
2115
2229
|
//#endregion
|
|
2116
2230
|
//#region src/core/cells/layout.ts
|
|
2117
|
-
var
|
|
2118
|
-
function
|
|
2119
|
-
return `column-${
|
|
2231
|
+
var Wr = w(/* @__PURE__ */ new Set()), Gr = w([]), Kr = w([]);
|
|
2232
|
+
function qr() {
|
|
2233
|
+
return `column-${Jn.create()}`;
|
|
2120
2234
|
}
|
|
2121
|
-
var
|
|
2122
|
-
let r =
|
|
2235
|
+
var Jr = w(null, (e, t, n) => {
|
|
2236
|
+
let r = Ur(n).length, i = e(Gr);
|
|
2123
2237
|
if (i.length === r) return;
|
|
2124
|
-
let a = e(
|
|
2125
|
-
for (; o.length < r;) o.push(
|
|
2126
|
-
t(
|
|
2127
|
-
}),
|
|
2128
|
-
let t = e(
|
|
2238
|
+
let a = e(Kr), o = [...i, ...a].slice(0, r);
|
|
2239
|
+
for (; o.length < r;) o.push(qr());
|
|
2240
|
+
t(Gr, o), t(Kr, a.slice(Math.max(0, r - i.length)));
|
|
2241
|
+
}), Yr = g(w((e) => {
|
|
2242
|
+
let t = e(h);
|
|
2129
2243
|
return t === null ? null : e(t.documentAtom);
|
|
2130
|
-
}), (e) => e === null ? [[]] :
|
|
2131
|
-
let t = e(
|
|
2244
|
+
}), (e) => e === null ? [[]] : Ur(e), x), Xr = w((e) => {
|
|
2245
|
+
let t = e(Yr), n = e(Gr), r = e(Kr);
|
|
2132
2246
|
return [...t.map((e, t) => ({
|
|
2133
2247
|
id: n[t] ?? `column-${t}`,
|
|
2134
2248
|
ids: e
|
|
@@ -2137,7 +2251,7 @@ var Pr = S(null, (e, t, n) => {
|
|
|
2137
2251
|
ids: []
|
|
2138
2252
|
}))];
|
|
2139
2253
|
});
|
|
2140
|
-
function
|
|
2254
|
+
function Zr(e, t, n) {
|
|
2141
2255
|
let r = /* @__PURE__ */ new Map();
|
|
2142
2256
|
return e.forEach((i, a) => {
|
|
2143
2257
|
let o = t[a];
|
|
@@ -2146,9 +2260,9 @@ function Lr(e, t, n) {
|
|
|
2146
2260
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2147
2261
|
}), r;
|
|
2148
2262
|
}
|
|
2149
|
-
function
|
|
2263
|
+
function Qr(e, t, n) {
|
|
2150
2264
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
2151
|
-
let i =
|
|
2265
|
+
let i = Zr(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
2152
2266
|
return {
|
|
2153
2267
|
id: e,
|
|
2154
2268
|
ids: r,
|
|
@@ -2157,36 +2271,36 @@ function Rr(e, t, n) {
|
|
|
2157
2271
|
};
|
|
2158
2272
|
}) };
|
|
2159
2273
|
}
|
|
2160
|
-
var
|
|
2161
|
-
let t = e(
|
|
2162
|
-
return
|
|
2163
|
-
}),
|
|
2164
|
-
function
|
|
2274
|
+
var $r = w((e) => {
|
|
2275
|
+
let t = e(Ma);
|
|
2276
|
+
return Qr(e(Xr), (e) => t[e] ?? null, e(Wr));
|
|
2277
|
+
}), ei = () => C($r), ti = w((e) => e($r).columns.length);
|
|
2278
|
+
function ni(e, t) {
|
|
2165
2279
|
return e.columns.find((e) => e.id === t);
|
|
2166
2280
|
}
|
|
2167
|
-
function
|
|
2281
|
+
function ri(e, t) {
|
|
2168
2282
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2169
2283
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
2170
2284
|
return n;
|
|
2171
2285
|
}
|
|
2172
|
-
function
|
|
2286
|
+
function ii(e, t) {
|
|
2173
2287
|
for (let n of e.columns) {
|
|
2174
2288
|
let e = n.folds.get(t);
|
|
2175
2289
|
if (e !== void 0) return e;
|
|
2176
2290
|
}
|
|
2177
2291
|
}
|
|
2178
|
-
function
|
|
2292
|
+
function ai(e, t) {
|
|
2179
2293
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2180
2294
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
2181
2295
|
}
|
|
2182
|
-
function
|
|
2183
|
-
let n =
|
|
2184
|
-
return
|
|
2296
|
+
function oi(e, t) {
|
|
2297
|
+
let n = ai(e, t);
|
|
2298
|
+
return ii(e, t) === void 0 ? n : [...n, t];
|
|
2185
2299
|
}
|
|
2186
2300
|
//#endregion
|
|
2187
2301
|
//#region src/core/cells/document.ts
|
|
2188
|
-
function
|
|
2189
|
-
let n = t.code ?? e.code, r =
|
|
2302
|
+
function si(e, t) {
|
|
2303
|
+
let n = t.code ?? e.code, r = x(e.config, t.config) ? e.config : Ir(t.config);
|
|
2190
2304
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
2191
2305
|
...e,
|
|
2192
2306
|
name: t.name,
|
|
@@ -2198,30 +2312,30 @@ function qr(e, t) {
|
|
|
2198
2312
|
config: r
|
|
2199
2313
|
};
|
|
2200
2314
|
}
|
|
2201
|
-
function
|
|
2202
|
-
let n =
|
|
2315
|
+
function ci(e, t) {
|
|
2316
|
+
let n = x(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
2203
2317
|
for (let o of n) {
|
|
2204
2318
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
2205
2319
|
if (n === void 0) continue;
|
|
2206
2320
|
if (s === void 0) {
|
|
2207
2321
|
r = {
|
|
2208
2322
|
...r,
|
|
2209
|
-
[o]:
|
|
2323
|
+
[o]: Fr({
|
|
2210
2324
|
id: o,
|
|
2211
2325
|
code: n.code ?? "",
|
|
2212
2326
|
name: n.name,
|
|
2213
|
-
config:
|
|
2327
|
+
config: Ir(n.config)
|
|
2214
2328
|
})
|
|
2215
2329
|
}, i = {
|
|
2216
2330
|
...i,
|
|
2217
|
-
[o]: i[o] ??
|
|
2331
|
+
[o]: i[o] ?? Lr()
|
|
2218
2332
|
}, a = {
|
|
2219
2333
|
...a,
|
|
2220
|
-
[o]: (0,
|
|
2334
|
+
[o]: (0, E.createRef)()
|
|
2221
2335
|
};
|
|
2222
2336
|
continue;
|
|
2223
2337
|
}
|
|
2224
|
-
let c =
|
|
2338
|
+
let c = si(s, n);
|
|
2225
2339
|
c !== s && (r = {
|
|
2226
2340
|
...r,
|
|
2227
2341
|
[o]: c
|
|
@@ -2240,39 +2354,39 @@ function Jr(e, t) {
|
|
|
2240
2354
|
cellHandles: a
|
|
2241
2355
|
};
|
|
2242
2356
|
}
|
|
2243
|
-
function
|
|
2357
|
+
function li({ store: e, model: t, reconcile: n, signal: r }) {
|
|
2244
2358
|
let i = () => {
|
|
2245
2359
|
let r = e.get(t.documentAtom);
|
|
2246
|
-
r !== null && (n(r), e.set(
|
|
2360
|
+
r !== null && (n(r), e.set(Jr, r));
|
|
2247
2361
|
}, a = e.sub(t.documentAtom, i);
|
|
2248
2362
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
2249
2363
|
}
|
|
2250
|
-
async function
|
|
2251
|
-
let e =
|
|
2252
|
-
e !== null &&
|
|
2364
|
+
async function ui() {
|
|
2365
|
+
let e = p.get(h);
|
|
2366
|
+
e !== null && p.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
2253
2367
|
}
|
|
2254
2368
|
//#endregion
|
|
2255
2369
|
//#region src/core/cells/editor.ts
|
|
2256
|
-
var
|
|
2257
|
-
function
|
|
2370
|
+
var W = w(/* @__PURE__ */ new Set());
|
|
2371
|
+
function di(e, t, n) {
|
|
2258
2372
|
return !!e && !t.has(n);
|
|
2259
2373
|
}
|
|
2260
|
-
|
|
2261
|
-
t(
|
|
2262
|
-
}),
|
|
2374
|
+
w(null, (e, t, { cellId: n }) => {
|
|
2375
|
+
t(W, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2376
|
+
}), w(null, (e, t, { cellId: n }) => e(W).has(n) ? (t(W, (e) => {
|
|
2263
2377
|
let t = new Set(e);
|
|
2264
2378
|
return t.delete(n), t;
|
|
2265
2379
|
}), !0) : !1);
|
|
2266
|
-
var
|
|
2267
|
-
|
|
2268
|
-
t(
|
|
2380
|
+
var fi = w(/* @__PURE__ */ new Map());
|
|
2381
|
+
w(null, (e, t, { cellId: n }) => {
|
|
2382
|
+
t(fi, (e) => {
|
|
2269
2383
|
let t = new Map(e);
|
|
2270
2384
|
return t.delete(n), t;
|
|
2271
2385
|
});
|
|
2272
2386
|
});
|
|
2273
2387
|
//#endregion
|
|
2274
2388
|
//#region src/utils/timeout.ts
|
|
2275
|
-
function
|
|
2389
|
+
function pi(e, n) {
|
|
2276
2390
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
2277
2391
|
if (o < r) {
|
|
2278
2392
|
try {
|
|
@@ -2287,20 +2401,20 @@ function $r(e, n) {
|
|
|
2287
2401
|
}
|
|
2288
2402
|
//#endregion
|
|
2289
2403
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2290
|
-
function
|
|
2291
|
-
|
|
2404
|
+
function mi(e) {
|
|
2405
|
+
pi(() => (e.focus(), e.hasFocus), {
|
|
2292
2406
|
retries: 5,
|
|
2293
2407
|
delay: 20
|
|
2294
2408
|
});
|
|
2295
2409
|
}
|
|
2296
|
-
function
|
|
2297
|
-
let r = document.getElementById(
|
|
2298
|
-
r ?
|
|
2410
|
+
function hi(e, n) {
|
|
2411
|
+
let r = document.getElementById(B.create(e));
|
|
2412
|
+
r ? _i(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2299
2413
|
}
|
|
2300
|
-
function
|
|
2414
|
+
function gi() {
|
|
2301
2415
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2302
2416
|
}
|
|
2303
|
-
function
|
|
2417
|
+
function _i(e, n) {
|
|
2304
2418
|
try {
|
|
2305
2419
|
e.focus(n);
|
|
2306
2420
|
} catch {
|
|
@@ -2309,18 +2423,18 @@ function ri(e, n) {
|
|
|
2309
2423
|
}
|
|
2310
2424
|
//#endregion
|
|
2311
2425
|
//#region src/core/network/requests.ts
|
|
2312
|
-
var
|
|
2313
|
-
function
|
|
2314
|
-
let e =
|
|
2315
|
-
return
|
|
2426
|
+
var vi = w(null);
|
|
2427
|
+
function yi() {
|
|
2428
|
+
let e = C(vi);
|
|
2429
|
+
return T(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2316
2430
|
}
|
|
2317
|
-
function
|
|
2318
|
-
let e =
|
|
2319
|
-
return
|
|
2431
|
+
function bi() {
|
|
2432
|
+
let e = p.get(vi);
|
|
2433
|
+
return T(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2320
2434
|
}
|
|
2321
2435
|
//#endregion
|
|
2322
2436
|
//#region src/utils/storage/storage.ts
|
|
2323
|
-
var
|
|
2437
|
+
var xi = class {
|
|
2324
2438
|
store = /* @__PURE__ */ new Map();
|
|
2325
2439
|
get length() {
|
|
2326
2440
|
return this.store.size;
|
|
@@ -2341,16 +2455,16 @@ var si = class {
|
|
|
2341
2455
|
this.store.set(e, t);
|
|
2342
2456
|
}
|
|
2343
2457
|
};
|
|
2344
|
-
function
|
|
2458
|
+
function Si() {
|
|
2345
2459
|
let { hasLocalStorage: e, hasSessionStorage: t } = xe();
|
|
2346
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2460
|
+
return e ? window.localStorage : t ? window.sessionStorage : new xi();
|
|
2347
2461
|
}
|
|
2348
|
-
var
|
|
2349
|
-
function
|
|
2350
|
-
return
|
|
2462
|
+
var Ci = Si(), wi = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Ti = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Ei = /^data:image\//i, Di = ["avatars.githubusercontent.com"];
|
|
2463
|
+
function Oi(e) {
|
|
2464
|
+
return Ei.test(e) ? [{
|
|
2351
2465
|
type: "image",
|
|
2352
2466
|
url: e
|
|
2353
|
-
}] : e.split(
|
|
2467
|
+
}] : e.split(wi).filter((e) => e !== "").map((e) => wi.test(e) ? Ti.test(e) || Ei.test(e) || Di.some((t) => e.includes(t)) ? {
|
|
2354
2468
|
type: "image",
|
|
2355
2469
|
url: e
|
|
2356
2470
|
} : {
|
|
@@ -2363,48 +2477,48 @@ function mi(e) {
|
|
|
2363
2477
|
}
|
|
2364
2478
|
//#endregion
|
|
2365
2479
|
//#region src/utils/json/json-parser.ts
|
|
2366
|
-
var
|
|
2480
|
+
var ki = new RegExp(wi.source, "g");
|
|
2367
2481
|
BigInt.prototype.toJSON = function() {
|
|
2368
2482
|
return JSON.rawJSON(this.toString());
|
|
2369
2483
|
};
|
|
2370
|
-
function
|
|
2484
|
+
function Ai(e) {
|
|
2371
2485
|
try {
|
|
2372
|
-
return JSON.parse(e, (e, t) =>
|
|
2486
|
+
return JSON.parse(e, (e, t) => Pi(t));
|
|
2373
2487
|
} catch {}
|
|
2374
2488
|
if (e == null || e === "") return {};
|
|
2375
2489
|
try {
|
|
2376
|
-
return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity :
|
|
2490
|
+
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 : Pi(t) : Pi(t));
|
|
2377
2491
|
} catch {
|
|
2378
2492
|
return {};
|
|
2379
2493
|
}
|
|
2380
2494
|
}
|
|
2381
|
-
function
|
|
2495
|
+
function ji(e) {
|
|
2382
2496
|
if (e.length === 0) return "";
|
|
2383
2497
|
let t = Object.keys(e[0]);
|
|
2384
2498
|
return [
|
|
2385
2499
|
`| ${t.join(" | ")} |`,
|
|
2386
2500
|
`|${t.map(() => "---").join("|")}|`,
|
|
2387
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2501
|
+
...e.map((e) => `| ${t.map((t) => Mi(e[t])).join(" | ")} |`)
|
|
2388
2502
|
].join("\n");
|
|
2389
2503
|
}
|
|
2390
|
-
function
|
|
2504
|
+
function Mi(e) {
|
|
2391
2505
|
if (e == null) return "";
|
|
2392
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2506
|
+
if (Array.isArray(e) || typeof e == "object") return Ni(JSON.stringify(e));
|
|
2393
2507
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2394
2508
|
t = t.replaceAll(n, (e) => {
|
|
2395
2509
|
let t = `__MDLINK_${i++}__`;
|
|
2396
2510
|
return r.set(t, e), t;
|
|
2397
|
-
}), t = t.replaceAll(
|
|
2511
|
+
}), t = t.replaceAll(ki, "[$1]($1)");
|
|
2398
2512
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2399
|
-
return
|
|
2513
|
+
return Ni(t);
|
|
2400
2514
|
}
|
|
2401
|
-
function
|
|
2515
|
+
function Ni(e) {
|
|
2402
2516
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2403
2517
|
}
|
|
2404
|
-
function
|
|
2518
|
+
function Pi(e) {
|
|
2405
2519
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2406
2520
|
}
|
|
2407
|
-
var
|
|
2521
|
+
var Fi = new class {
|
|
2408
2522
|
getFilename() {
|
|
2409
2523
|
return this.getSearchParam("filename");
|
|
2410
2524
|
}
|
|
@@ -2431,20 +2545,20 @@ var xi = new class {
|
|
|
2431
2545
|
}();
|
|
2432
2546
|
//#endregion
|
|
2433
2547
|
//#region src/core/dom/htmlUtils.ts
|
|
2434
|
-
function
|
|
2435
|
-
return
|
|
2548
|
+
function Ii(e) {
|
|
2549
|
+
return Ai(e ?? "");
|
|
2436
2550
|
}
|
|
2437
|
-
function
|
|
2438
|
-
return
|
|
2551
|
+
function Li(e) {
|
|
2552
|
+
return ce.mapValues(e.dataset, (e) => typeof e == "string" ? Ii(e) : e);
|
|
2439
2553
|
}
|
|
2440
|
-
function
|
|
2441
|
-
let n = e.parentElement ?
|
|
2442
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2554
|
+
function Ri(e, t) {
|
|
2555
|
+
let n = e.parentElement ? Xn.parse(e.parentElement) : void 0;
|
|
2556
|
+
return n && t.has(n) ? t.lookupValue(n) : Ii(e.dataset.initialValue);
|
|
2443
2557
|
}
|
|
2444
|
-
function
|
|
2445
|
-
if (
|
|
2558
|
+
function zi() {
|
|
2559
|
+
if (re()) return document.title || null;
|
|
2446
2560
|
if (ye()) {
|
|
2447
|
-
let e =
|
|
2561
|
+
let e = Fi.getFilename();
|
|
2448
2562
|
if (e) return e;
|
|
2449
2563
|
}
|
|
2450
2564
|
let e = document.querySelector("marimo-filename");
|
|
@@ -2454,16 +2568,16 @@ function Ti() {
|
|
|
2454
2568
|
}
|
|
2455
2569
|
//#endregion
|
|
2456
2570
|
//#region src/core/saving/file-state.ts
|
|
2457
|
-
var
|
|
2458
|
-
|
|
2459
|
-
var
|
|
2460
|
-
|
|
2571
|
+
var G = w(zi());
|
|
2572
|
+
w(null);
|
|
2573
|
+
var Bi = w(null);
|
|
2574
|
+
w(void 0);
|
|
2461
2575
|
//#endregion
|
|
2462
2576
|
//#region src/utils/storage/typed.ts
|
|
2463
|
-
var
|
|
2577
|
+
var Vi = class {
|
|
2464
2578
|
defaultValue;
|
|
2465
2579
|
storage;
|
|
2466
|
-
constructor(e, t =
|
|
2580
|
+
constructor(e, t = Ci) {
|
|
2467
2581
|
this.defaultValue = e, this.storage = t;
|
|
2468
2582
|
}
|
|
2469
2583
|
get(e) {
|
|
@@ -2480,11 +2594,11 @@ var Oi = class {
|
|
|
2480
2594
|
remove(e) {
|
|
2481
2595
|
this.storage.removeItem(e);
|
|
2482
2596
|
}
|
|
2483
|
-
},
|
|
2597
|
+
}, Hi = class {
|
|
2484
2598
|
schema;
|
|
2485
2599
|
getDefaultValue;
|
|
2486
2600
|
storage;
|
|
2487
|
-
constructor(e, t, n =
|
|
2601
|
+
constructor(e, t, n = Ci) {
|
|
2488
2602
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2489
2603
|
}
|
|
2490
2604
|
get(e) {
|
|
@@ -2503,15 +2617,15 @@ var Oi = class {
|
|
|
2503
2617
|
remove(e) {
|
|
2504
2618
|
this.storage.removeItem(e);
|
|
2505
2619
|
}
|
|
2506
|
-
},
|
|
2620
|
+
}, Ui = class extends Hi {
|
|
2507
2621
|
filename;
|
|
2508
2622
|
unsubscribeFromFilename;
|
|
2509
2623
|
constructor(e, t, n) {
|
|
2510
|
-
let r =
|
|
2624
|
+
let r = p.get(G);
|
|
2511
2625
|
super(t, n), this.filename = r;
|
|
2512
2626
|
try {
|
|
2513
|
-
this.unsubscribeFromFilename =
|
|
2514
|
-
let t =
|
|
2627
|
+
this.unsubscribeFromFilename = p.sub(G, () => {
|
|
2628
|
+
let t = p.get(G);
|
|
2515
2629
|
this.handleFilenameChange(e, t);
|
|
2516
2630
|
});
|
|
2517
2631
|
} catch {
|
|
@@ -2539,7 +2653,7 @@ var Oi = class {
|
|
|
2539
2653
|
dispose() {
|
|
2540
2654
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2541
2655
|
}
|
|
2542
|
-
},
|
|
2656
|
+
}, K = {
|
|
2543
2657
|
VariableName: "VariableName",
|
|
2544
2658
|
FunctionDefinition: "FunctionDefinition",
|
|
2545
2659
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2564,30 +2678,30 @@ var Oi = class {
|
|
|
2564
2678
|
Comment: "Comment",
|
|
2565
2679
|
String: "String",
|
|
2566
2680
|
FormatString: "FormatString"
|
|
2567
|
-
},
|
|
2681
|
+
}, q = {
|
|
2568
2682
|
For: "for",
|
|
2569
2683
|
In: "in",
|
|
2570
2684
|
As: "as",
|
|
2571
2685
|
Import: "import"
|
|
2572
|
-
},
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2686
|
+
}, Wi = /* @__PURE__ */ new Set([
|
|
2687
|
+
K.FunctionDefinition,
|
|
2688
|
+
K.LambdaExpression,
|
|
2689
|
+
K.ArrayComprehensionExpression,
|
|
2690
|
+
K.SetComprehensionExpression,
|
|
2691
|
+
K.DictionaryComprehensionExpression,
|
|
2692
|
+
K.ComprehensionExpression,
|
|
2693
|
+
K.ClassDefinition
|
|
2580
2694
|
]);
|
|
2581
|
-
|
|
2695
|
+
K.Comment, K.String, K.FormatString;
|
|
2582
2696
|
//#endregion
|
|
2583
2697
|
//#region src/core/codemirror/utils.ts
|
|
2584
|
-
function
|
|
2698
|
+
function Gi(e) {
|
|
2585
2699
|
e && e.dispatch({ selection: {
|
|
2586
2700
|
anchor: e.state.doc.length,
|
|
2587
2701
|
head: e.state.doc.length
|
|
2588
2702
|
} });
|
|
2589
2703
|
}
|
|
2590
|
-
function
|
|
2704
|
+
function Ki(e) {
|
|
2591
2705
|
requestAnimationFrame(() => {
|
|
2592
2706
|
e.dom.closest(".marimo-cell")?.scrollIntoView({
|
|
2593
2707
|
behavior: "instant",
|
|
@@ -2598,8 +2712,8 @@ function Ni(e) {
|
|
|
2598
2712
|
}
|
|
2599
2713
|
//#endregion
|
|
2600
2714
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2601
|
-
var
|
|
2602
|
-
function
|
|
2715
|
+
var qi = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
2716
|
+
function Ji(e, t) {
|
|
2603
2717
|
requestAnimationFrame(() => {
|
|
2604
2718
|
e.focus(), e.dispatch({
|
|
2605
2719
|
selection: {
|
|
@@ -2608,19 +2722,19 @@ function Fi(e, t) {
|
|
|
2608
2722
|
},
|
|
2609
2723
|
effects: fe.scrollIntoView(t, { y: "center" })
|
|
2610
2724
|
});
|
|
2611
|
-
}),
|
|
2725
|
+
}), Ki(e);
|
|
2612
2726
|
}
|
|
2613
|
-
function
|
|
2727
|
+
function Yi(e, t) {
|
|
2614
2728
|
let n = pe(e), r = null;
|
|
2615
2729
|
return n.iterate({ enter: (n) => {
|
|
2616
2730
|
if (r !== null) return !1;
|
|
2617
|
-
if (n.name ===
|
|
2618
|
-
if (n.name ===
|
|
2731
|
+
if (n.name === K.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2732
|
+
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
2619
2733
|
} }), r;
|
|
2620
2734
|
}
|
|
2621
|
-
function
|
|
2735
|
+
function Xi(e, t) {
|
|
2622
2736
|
let n = [], r = e.resolveInner(t, 0);
|
|
2623
|
-
for (; r;)
|
|
2737
|
+
for (; r;) Wi.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
2624
2738
|
id: r.from,
|
|
2625
2739
|
type: r.name
|
|
2626
2740
|
})), r = r.parent;
|
|
@@ -2629,70 +2743,70 @@ function Li(e, t) {
|
|
|
2629
2743
|
type: "global"
|
|
2630
2744
|
}), n;
|
|
2631
2745
|
}
|
|
2632
|
-
function
|
|
2746
|
+
function J(e, t, n) {
|
|
2633
2747
|
e.push({
|
|
2634
2748
|
scopeId: t,
|
|
2635
2749
|
from: n
|
|
2636
2750
|
});
|
|
2637
2751
|
}
|
|
2638
|
-
function
|
|
2752
|
+
function Zi(e, t) {
|
|
2639
2753
|
if (e.firstChild()) do
|
|
2640
2754
|
t(e.node);
|
|
2641
2755
|
while (e.nextSibling());
|
|
2642
2756
|
}
|
|
2643
|
-
function
|
|
2757
|
+
function Qi(e, t) {
|
|
2644
2758
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2645
2759
|
switch (e.name) {
|
|
2646
|
-
case
|
|
2647
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2760
|
+
case K.VariableName:
|
|
2761
|
+
n.doc.sliceString(e.from, e.to) === r && J(a, i, e.from);
|
|
2648
2762
|
break;
|
|
2649
|
-
case
|
|
2650
|
-
case
|
|
2763
|
+
case K.TupleExpression:
|
|
2764
|
+
case K.ArrayExpression: {
|
|
2651
2765
|
let n = e.node.cursor();
|
|
2652
2766
|
n.firstChild();
|
|
2653
2767
|
do
|
|
2654
|
-
|
|
2768
|
+
Qi(n, t);
|
|
2655
2769
|
while (n.nextSibling());
|
|
2656
2770
|
break;
|
|
2657
2771
|
}
|
|
2658
2772
|
}
|
|
2659
2773
|
}
|
|
2660
|
-
function
|
|
2774
|
+
function $i(e, t) {
|
|
2661
2775
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2662
2776
|
o.firstChild();
|
|
2663
2777
|
do {
|
|
2664
|
-
if (o.name !==
|
|
2778
|
+
if (o.name !== K.ParamList) continue;
|
|
2665
2779
|
let e = o.node.cursor();
|
|
2666
2780
|
e.firstChild();
|
|
2667
2781
|
do
|
|
2668
|
-
e.name ===
|
|
2782
|
+
e.name === K.VariableName && n.doc.sliceString(e.from, e.to) === r && J(a, i, e.from);
|
|
2669
2783
|
while (e.nextSibling());
|
|
2670
2784
|
} while (o.nextSibling());
|
|
2671
2785
|
}
|
|
2672
|
-
function
|
|
2786
|
+
function ea(e, t) {
|
|
2673
2787
|
let n = e.cursor();
|
|
2674
2788
|
n.firstChild();
|
|
2675
2789
|
let r = !1;
|
|
2676
2790
|
do
|
|
2677
|
-
if (n.name ===
|
|
2678
|
-
else if (r && n.name ===
|
|
2679
|
-
else r &&
|
|
2791
|
+
if (n.name === q.For) r = !0;
|
|
2792
|
+
else if (r && n.name === q.In) break;
|
|
2793
|
+
else r && Qi(n, t);
|
|
2680
2794
|
while (n.nextSibling());
|
|
2681
2795
|
}
|
|
2682
|
-
function
|
|
2683
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2796
|
+
function ta(e, t) {
|
|
2797
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Wi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2684
2798
|
switch (s) {
|
|
2685
|
-
case
|
|
2686
|
-
case
|
|
2799
|
+
case K.FunctionDefinition:
|
|
2800
|
+
case K.ClassDefinition: {
|
|
2687
2801
|
let t = e.cursor();
|
|
2688
2802
|
t.firstChild();
|
|
2689
2803
|
do
|
|
2690
|
-
if (t.name ===
|
|
2691
|
-
|
|
2804
|
+
if (t.name === K.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2805
|
+
J(a, i[i.length - 1] ?? -1, t.from);
|
|
2692
2806
|
break;
|
|
2693
2807
|
}
|
|
2694
2808
|
while (t.nextSibling());
|
|
2695
|
-
s ===
|
|
2809
|
+
s === K.FunctionDefinition && $i(e, {
|
|
2696
2810
|
state: n,
|
|
2697
2811
|
variableName: r,
|
|
2698
2812
|
scopeId: c,
|
|
@@ -2700,38 +2814,38 @@ function Hi(e, t) {
|
|
|
2700
2814
|
});
|
|
2701
2815
|
break;
|
|
2702
2816
|
}
|
|
2703
|
-
case
|
|
2704
|
-
|
|
2817
|
+
case K.LambdaExpression:
|
|
2818
|
+
$i(e, {
|
|
2705
2819
|
state: n,
|
|
2706
2820
|
variableName: r,
|
|
2707
2821
|
scopeId: c,
|
|
2708
2822
|
declarations: a
|
|
2709
2823
|
});
|
|
2710
2824
|
break;
|
|
2711
|
-
case
|
|
2712
|
-
case
|
|
2713
|
-
case
|
|
2714
|
-
case
|
|
2715
|
-
case
|
|
2716
|
-
|
|
2825
|
+
case K.ArrayComprehensionExpression:
|
|
2826
|
+
case K.DictionaryComprehensionExpression:
|
|
2827
|
+
case K.SetComprehensionExpression:
|
|
2828
|
+
case K.ComprehensionExpression:
|
|
2829
|
+
case K.ForStatement:
|
|
2830
|
+
ea(e, {
|
|
2717
2831
|
state: n,
|
|
2718
2832
|
variableName: r,
|
|
2719
2833
|
scopeId: u,
|
|
2720
2834
|
declarations: a
|
|
2721
2835
|
});
|
|
2722
2836
|
break;
|
|
2723
|
-
case
|
|
2837
|
+
case K.AssignStatement: {
|
|
2724
2838
|
let t = [], i = e.cursor();
|
|
2725
2839
|
i.firstChild();
|
|
2726
2840
|
do
|
|
2727
|
-
i.name ===
|
|
2841
|
+
i.name === K.AssignOp && t.push(i.from);
|
|
2728
2842
|
while (i.nextSibling());
|
|
2729
2843
|
let o = t[t.length - 1];
|
|
2730
2844
|
if (o === void 0) break;
|
|
2731
2845
|
let s = e.cursor();
|
|
2732
2846
|
s.firstChild();
|
|
2733
2847
|
do
|
|
2734
|
-
s.from < o &&
|
|
2848
|
+
s.from < o && Qi(s, {
|
|
2735
2849
|
state: n,
|
|
2736
2850
|
variableName: r,
|
|
2737
2851
|
scopeId: u,
|
|
@@ -2740,14 +2854,14 @@ function Hi(e, t) {
|
|
|
2740
2854
|
while (s.nextSibling());
|
|
2741
2855
|
break;
|
|
2742
2856
|
}
|
|
2743
|
-
case
|
|
2857
|
+
case K.ImportStatement: {
|
|
2744
2858
|
let t = e.cursor();
|
|
2745
2859
|
t.firstChild();
|
|
2746
2860
|
let i = !1, o = null, s = () => {
|
|
2747
|
-
o?.matches &&
|
|
2861
|
+
o?.matches && J(a, u, o.from), o = null;
|
|
2748
2862
|
};
|
|
2749
2863
|
do
|
|
2750
|
-
t.name ===
|
|
2864
|
+
t.name === q.Import ? i = !0 : i && (t.name === q.As ? o = null : t.name === K.VariableName ? (s(), o = {
|
|
2751
2865
|
from: t.from,
|
|
2752
2866
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2753
2867
|
}) : t.name === "," && s());
|
|
@@ -2755,19 +2869,19 @@ function Hi(e, t) {
|
|
|
2755
2869
|
s();
|
|
2756
2870
|
break;
|
|
2757
2871
|
}
|
|
2758
|
-
case
|
|
2759
|
-
case
|
|
2872
|
+
case K.TryStatement:
|
|
2873
|
+
case K.WithStatement: {
|
|
2760
2874
|
let t = e.cursor();
|
|
2761
2875
|
t.firstChild();
|
|
2762
2876
|
let i = !1;
|
|
2763
2877
|
do
|
|
2764
|
-
t.name ===
|
|
2878
|
+
t.name === q.As ? i = !0 : i && t.name === K.VariableName && n.doc.sliceString(t.from, t.to) === r && (J(a, u, t.from), i = !1);
|
|
2765
2879
|
while (t.nextSibling());
|
|
2766
2880
|
break;
|
|
2767
2881
|
}
|
|
2768
2882
|
}
|
|
2769
|
-
|
|
2770
|
-
|
|
2883
|
+
Zi(o, (e) => {
|
|
2884
|
+
ta(e, {
|
|
2771
2885
|
state: n,
|
|
2772
2886
|
variableName: r,
|
|
2773
2887
|
scopeStack: l,
|
|
@@ -2775,86 +2889,86 @@ function Hi(e, t) {
|
|
|
2775
2889
|
});
|
|
2776
2890
|
});
|
|
2777
2891
|
}
|
|
2778
|
-
function
|
|
2892
|
+
function na(e, t, n) {
|
|
2779
2893
|
let r = pe(e), i = [];
|
|
2780
|
-
|
|
2894
|
+
ta(r, {
|
|
2781
2895
|
state: e,
|
|
2782
2896
|
variableName: t,
|
|
2783
2897
|
scopeStack: [],
|
|
2784
2898
|
declarations: i
|
|
2785
2899
|
});
|
|
2786
2900
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2787
|
-
for (let e of
|
|
2788
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2901
|
+
for (let e of Xi(r, a)) {
|
|
2902
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !qi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2789
2903
|
if (t) return t.from;
|
|
2790
2904
|
}
|
|
2791
2905
|
return null;
|
|
2792
2906
|
}
|
|
2793
|
-
function
|
|
2794
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2795
|
-
return i !== null && (
|
|
2907
|
+
function ra(e, t, n) {
|
|
2908
|
+
let { state: r } = e, i = n === void 0 ? Yi(r, t) : na(r, t, n);
|
|
2909
|
+
return i !== null && (Ji(e, i), !0);
|
|
2796
2910
|
}
|
|
2797
|
-
function
|
|
2798
|
-
return
|
|
2911
|
+
function ia(e, t) {
|
|
2912
|
+
return Ji(e, e.state.doc.line(t).from), !0;
|
|
2799
2913
|
}
|
|
2800
2914
|
//#endregion
|
|
2801
2915
|
//#region src/core/network/connection.ts
|
|
2802
|
-
var
|
|
2916
|
+
var Y = w({ state: A.NOT_STARTED });
|
|
2803
2917
|
y(null, (e, t) => t === null ? null : {
|
|
2804
2918
|
phase: t.phase,
|
|
2805
2919
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2806
2920
|
});
|
|
2807
|
-
function
|
|
2808
|
-
return
|
|
2921
|
+
function aa() {
|
|
2922
|
+
return ee(Y, (e) => e.state === A.OPEN);
|
|
2809
2923
|
}
|
|
2810
|
-
function
|
|
2811
|
-
return ge() ?
|
|
2924
|
+
function oa() {
|
|
2925
|
+
return ge() ? aa() : Promise.resolve();
|
|
2812
2926
|
}
|
|
2813
|
-
|
|
2814
|
-
let t = e(
|
|
2815
|
-
return t.state ===
|
|
2816
|
-
}),
|
|
2927
|
+
w((e) => e(Y).state === A.CONNECTING), w((e) => e(Y).state === A.OPEN), w((e) => {
|
|
2928
|
+
let t = e(Y);
|
|
2929
|
+
return t.state === A.OPEN || t.state === A.NOT_STARTED;
|
|
2930
|
+
}), w((e) => e(Y).state === A.CLOSED);
|
|
2817
2931
|
//#endregion
|
|
2818
2932
|
//#region src/components/ui/checkbox.tsx
|
|
2819
|
-
var
|
|
2820
|
-
let r = (0,
|
|
2933
|
+
var sa = E.forwardRef((e, t) => {
|
|
2934
|
+
let r = (0, kn.c)(13), i, a;
|
|
2821
2935
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2822
2936
|
let o;
|
|
2823
2937
|
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);
|
|
2824
2938
|
let s;
|
|
2825
2939
|
r[5] === Symbol.for("react.memo_cache_sentinel") ? (s = n("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), r[5] = s) : s = r[5];
|
|
2826
2940
|
let c;
|
|
2827
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0,
|
|
2941
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, D.jsx)(Fe, {
|
|
2828
2942
|
className: s,
|
|
2829
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
2943
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, D.jsx)(Ce, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, D.jsx)(l, { className: "h-4 w-4" })
|
|
2830
2944
|
}), r[6] = a.checked, r[7] = c);
|
|
2831
2945
|
let u;
|
|
2832
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0,
|
|
2946
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, D.jsx)(Ne, {
|
|
2833
2947
|
ref: t,
|
|
2834
2948
|
className: o,
|
|
2835
2949
|
...a,
|
|
2836
2950
|
children: c
|
|
2837
2951
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2838
2952
|
});
|
|
2839
|
-
|
|
2953
|
+
sa.displayName = Ne.displayName;
|
|
2840
2954
|
//#endregion
|
|
2841
2955
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2842
|
-
function
|
|
2956
|
+
function ca({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2843
2957
|
if (!n) return;
|
|
2844
|
-
let o = document.getElementById(
|
|
2958
|
+
let o = document.getElementById(B.create(e));
|
|
2845
2959
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2846
|
-
else if (
|
|
2960
|
+
else if (gi()) _i(o);
|
|
2847
2961
|
else {
|
|
2848
|
-
if (r)
|
|
2962
|
+
if (r) _i(o);
|
|
2849
2963
|
else {
|
|
2850
|
-
|
|
2964
|
+
Ln.promote(e);
|
|
2851
2965
|
let r = n.current?.editorView;
|
|
2852
2966
|
if (!r) {
|
|
2853
2967
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2854
2968
|
return;
|
|
2855
2969
|
}
|
|
2856
2970
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2857
|
-
if (
|
|
2971
|
+
if (mi(r), i === "top") r.dispatch({ selection: {
|
|
2858
2972
|
anchor: 0,
|
|
2859
2973
|
head: 0
|
|
2860
2974
|
} });
|
|
@@ -2864,7 +2978,7 @@ function Yi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2864
2978
|
anchor: e.from,
|
|
2865
2979
|
head: e.from
|
|
2866
2980
|
} });
|
|
2867
|
-
} else a &&
|
|
2981
|
+
} else a && ra(r, a);
|
|
2868
2982
|
}
|
|
2869
2983
|
o.scrollIntoView({
|
|
2870
2984
|
behavior: "smooth",
|
|
@@ -2872,21 +2986,21 @@ function Yi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2872
2986
|
});
|
|
2873
2987
|
}
|
|
2874
2988
|
}
|
|
2875
|
-
function
|
|
2989
|
+
function la() {
|
|
2876
2990
|
let e = document.getElementById("App");
|
|
2877
2991
|
e?.scrollTo({
|
|
2878
2992
|
top: e.scrollHeight,
|
|
2879
2993
|
behavior: "smooth"
|
|
2880
2994
|
});
|
|
2881
2995
|
}
|
|
2882
|
-
function
|
|
2996
|
+
function ua() {
|
|
2883
2997
|
document.getElementById("App")?.scrollTo({
|
|
2884
2998
|
top: 0,
|
|
2885
2999
|
behavior: "smooth"
|
|
2886
3000
|
});
|
|
2887
3001
|
}
|
|
2888
|
-
function
|
|
2889
|
-
let t = document.getElementById(
|
|
3002
|
+
function da(e) {
|
|
3003
|
+
let t = document.getElementById(B.create(e));
|
|
2890
3004
|
return t?.scrollIntoView({
|
|
2891
3005
|
behavior: "smooth",
|
|
2892
3006
|
block: "center"
|
|
@@ -2894,64 +3008,64 @@ function Qi(e) {
|
|
|
2894
3008
|
}
|
|
2895
3009
|
//#endregion
|
|
2896
3010
|
//#region src/core/cells/utils.ts
|
|
2897
|
-
function
|
|
3011
|
+
function fa(e) {
|
|
2898
3012
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
2899
3013
|
}
|
|
2900
|
-
function
|
|
3014
|
+
function pa(e) {
|
|
2901
3015
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2902
3016
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
2903
3017
|
return r;
|
|
2904
3018
|
}
|
|
2905
|
-
function
|
|
3019
|
+
function ma(e) {
|
|
2906
3020
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2907
3021
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
2908
3022
|
return r;
|
|
2909
3023
|
}
|
|
2910
|
-
function
|
|
3024
|
+
function ha(e) {
|
|
2911
3025
|
return e.history.length > 0;
|
|
2912
3026
|
}
|
|
2913
|
-
function
|
|
3027
|
+
function ga(e) {
|
|
2914
3028
|
let t = e.history[e.history.length - 1];
|
|
2915
3029
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2916
3030
|
}
|
|
2917
|
-
function
|
|
2918
|
-
return e.status === "idle" ?
|
|
3031
|
+
function _a(e, t, n) {
|
|
3032
|
+
return e.status === "idle" ? xa(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
2919
3033
|
}
|
|
2920
|
-
function*
|
|
3034
|
+
function* va(e, t, n) {
|
|
2921
3035
|
for (let r of e.cellIds) {
|
|
2922
|
-
let i =
|
|
2923
|
-
o === null ? a.sourceChanged &&
|
|
3036
|
+
let i = Wt(t, r), a = n(r), o = _a(i, a, e.cellData[r]);
|
|
3037
|
+
o === null ? a.sourceChanged && ba(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2924
3038
|
}
|
|
2925
3039
|
}
|
|
2926
|
-
function
|
|
3040
|
+
function ya(e, t, n) {
|
|
2927
3041
|
let r = null;
|
|
2928
|
-
for (let [, i] of
|
|
3042
|
+
for (let [, i] of va(e, t, n)) {
|
|
2929
3043
|
if (i !== "inputs") return i;
|
|
2930
3044
|
r = i;
|
|
2931
3045
|
}
|
|
2932
3046
|
return r;
|
|
2933
3047
|
}
|
|
2934
|
-
function
|
|
3048
|
+
function ba(e, t) {
|
|
2935
3049
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
2936
3050
|
return r !== void 0 && r.state.status !== "completed";
|
|
2937
3051
|
}
|
|
2938
|
-
function
|
|
3052
|
+
function xa({ status: e, outcome: t, live: n }) {
|
|
2939
3053
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
2940
3054
|
}
|
|
2941
|
-
function
|
|
3055
|
+
function Sa({ errored: e, stopped: t }) {
|
|
2942
3056
|
return {
|
|
2943
3057
|
published: !0,
|
|
2944
3058
|
"has-error": e,
|
|
2945
3059
|
stopped: t
|
|
2946
3060
|
};
|
|
2947
3061
|
}
|
|
2948
|
-
function
|
|
2949
|
-
let a =
|
|
3062
|
+
function Ca({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
3063
|
+
let a = Bn(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
2950
3064
|
return (e || t || n || a) && !o;
|
|
2951
3065
|
}
|
|
2952
3066
|
//#endregion
|
|
2953
3067
|
//#region src/core/cells/cells.ts
|
|
2954
|
-
function
|
|
3068
|
+
function wa(e) {
|
|
2955
3069
|
let t = {
|
|
2956
3070
|
column: 0,
|
|
2957
3071
|
hide_code: !1,
|
|
@@ -2961,24 +3075,24 @@ function da(e) {
|
|
|
2961
3075
|
return {
|
|
2962
3076
|
...e,
|
|
2963
3077
|
cellData: {
|
|
2964
|
-
[
|
|
2965
|
-
id:
|
|
3078
|
+
[z]: Fr({
|
|
3079
|
+
id: z,
|
|
2966
3080
|
config: t
|
|
2967
3081
|
}),
|
|
2968
3082
|
...e.cellData
|
|
2969
3083
|
},
|
|
2970
3084
|
cellRuntime: {
|
|
2971
|
-
[
|
|
3085
|
+
[z]: Lr(),
|
|
2972
3086
|
...e.cellRuntime
|
|
2973
3087
|
},
|
|
2974
3088
|
cellHandles: {
|
|
2975
|
-
[
|
|
3089
|
+
[z]: (0, E.createRef)(),
|
|
2976
3090
|
...e.cellHandles
|
|
2977
3091
|
}
|
|
2978
3092
|
};
|
|
2979
3093
|
}
|
|
2980
|
-
function
|
|
2981
|
-
return
|
|
3094
|
+
function Ta() {
|
|
3095
|
+
return wa({
|
|
2982
3096
|
cellIds: [],
|
|
2983
3097
|
cellData: {},
|
|
2984
3098
|
cellRuntime: {},
|
|
@@ -2988,8 +3102,8 @@ function fa() {
|
|
|
2988
3102
|
cellLogs: []
|
|
2989
3103
|
});
|
|
2990
3104
|
}
|
|
2991
|
-
var { reducer:
|
|
2992
|
-
startCellConsole: (e, { cellId: t }) =>
|
|
3105
|
+
var { reducer: Ea, createActions: Da, useActions: Oa, valueAtom: X } = de(Ta, {
|
|
3106
|
+
startCellConsole: (e, { cellId: t }) => Z({
|
|
2993
3107
|
state: e,
|
|
2994
3108
|
cellId: t,
|
|
2995
3109
|
cellReducer: (e) => ({
|
|
@@ -3001,17 +3115,17 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3001
3115
|
})
|
|
3002
3116
|
}),
|
|
3003
3117
|
showCommandOutput: (e, t) => {
|
|
3004
|
-
let { cell_id: n, entries: r, replace: i } = t, a =
|
|
3118
|
+
let { cell_id: n, entries: r, replace: i } = t, a = Z({
|
|
3005
3119
|
state: e,
|
|
3006
3120
|
cellId: n,
|
|
3007
3121
|
cellReducer: (e) => ({
|
|
3008
3122
|
...e,
|
|
3009
|
-
commandConsole:
|
|
3123
|
+
commandConsole: Vn(e.commandConsole, t, e.clearedCommandIds?.[t.op])
|
|
3010
3124
|
})
|
|
3011
3125
|
});
|
|
3012
3126
|
return i || t.op === "pdb-output" ? a : {
|
|
3013
3127
|
...a,
|
|
3014
|
-
cellLogs: [...a.cellLogs, ...
|
|
3128
|
+
cellLogs: [...a.cellLogs, ...Dr({
|
|
3015
3129
|
cell_id: n,
|
|
3016
3130
|
console: r
|
|
3017
3131
|
})]
|
|
@@ -3019,7 +3133,7 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3019
3133
|
},
|
|
3020
3134
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
3021
3135
|
let i = new Set(r);
|
|
3022
|
-
return
|
|
3136
|
+
return Z({
|
|
3023
3137
|
state: e,
|
|
3024
3138
|
cellId: t,
|
|
3025
3139
|
cellReducer: (e) => ({
|
|
@@ -3037,7 +3151,7 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3037
3151
|
let n = t[e];
|
|
3038
3152
|
n.commandConsole?.entries.some((e) => e.source === "pdb-output") && (t[e] = {
|
|
3039
3153
|
...n,
|
|
3040
|
-
commandConsole:
|
|
3154
|
+
commandConsole: Vn(n.commandConsole, {
|
|
3041
3155
|
op: "pdb-output",
|
|
3042
3156
|
cell_id: e,
|
|
3043
3157
|
entries: [],
|
|
@@ -3055,13 +3169,13 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3055
3169
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
3056
3170
|
}),
|
|
3057
3171
|
reconcileDocument: (e, t) => {
|
|
3058
|
-
let n =
|
|
3059
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3172
|
+
let n = ci(e, t);
|
|
3173
|
+
for (let t of e.cellIds) t in n.cellData || Ua(t);
|
|
3060
3174
|
return n;
|
|
3061
3175
|
},
|
|
3062
3176
|
setStdinResponse: (e, t) => {
|
|
3063
3177
|
let { cellId: n, response: r, inputId: i } = t;
|
|
3064
|
-
return
|
|
3178
|
+
return Z({
|
|
3065
3179
|
state: e,
|
|
3066
3180
|
cellId: n,
|
|
3067
3181
|
cellReducer: (e) => ({
|
|
@@ -3072,9 +3186,9 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3072
3186
|
},
|
|
3073
3187
|
resetCellRuntimes: (e, t) => {
|
|
3074
3188
|
let n = ye(), r = { ...e.cellRuntime };
|
|
3075
|
-
for (let i of [...e.cellIds,
|
|
3189
|
+
for (let i of [...e.cellIds, z]) {
|
|
3076
3190
|
let a = e.cellRuntime[i];
|
|
3077
|
-
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a :
|
|
3191
|
+
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : Lr({
|
|
3078
3192
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
3079
3193
|
clearedCommandIds: t ? a?.clearedCommandIds : void 0
|
|
3080
3194
|
});
|
|
@@ -3088,10 +3202,10 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3088
3202
|
let t = e.scrollKey;
|
|
3089
3203
|
if (t === null) return e;
|
|
3090
3204
|
let n = t;
|
|
3091
|
-
return
|
|
3205
|
+
return ca({
|
|
3092
3206
|
cellId: n,
|
|
3093
3207
|
cell: e.cellHandles[n],
|
|
3094
|
-
isCodeHidden:
|
|
3208
|
+
isCodeHidden: di(e.cellData[n]?.config.hide_code, p.get(W), n),
|
|
3095
3209
|
codeFocus: void 0,
|
|
3096
3210
|
variableName: void 0
|
|
3097
3211
|
}), {
|
|
@@ -3099,13 +3213,13 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3099
3213
|
scrollKey: null
|
|
3100
3214
|
};
|
|
3101
3215
|
},
|
|
3102
|
-
foldAll: (e) => (
|
|
3103
|
-
unfoldAll: (e) => (
|
|
3216
|
+
foldAll: (e) => (Mn(Object.keys(e.cellHandles).map((e) => Ga(e))), e),
|
|
3217
|
+
unfoldAll: (e) => (Nn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3104
3218
|
clearLogs: (e) => ({
|
|
3105
3219
|
...e,
|
|
3106
3220
|
cellLogs: []
|
|
3107
3221
|
}),
|
|
3108
|
-
clearCellConsole: (e, t) =>
|
|
3222
|
+
clearCellConsole: (e, t) => Z({
|
|
3109
3223
|
state: e,
|
|
3110
3224
|
cellId: t.cellId,
|
|
3111
3225
|
cellReducer: (e) => {
|
|
@@ -3121,7 +3235,7 @@ var { reducer: pa, createActions: ma, useActions: ha, valueAtom: Z } = de(fa, {
|
|
|
3121
3235
|
}
|
|
3122
3236
|
})
|
|
3123
3237
|
});
|
|
3124
|
-
function
|
|
3238
|
+
function Z({ state: e, cellId: n, cellReducer: r }) {
|
|
3125
3239
|
return n in e.cellRuntime ? {
|
|
3126
3240
|
...e,
|
|
3127
3241
|
cellRuntime: {
|
|
@@ -3130,18 +3244,18 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3130
3244
|
}
|
|
3131
3245
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3132
3246
|
}
|
|
3133
|
-
var
|
|
3134
|
-
|
|
3135
|
-
}).addLogs,
|
|
3136
|
-
|
|
3137
|
-
var
|
|
3138
|
-
|
|
3139
|
-
var
|
|
3140
|
-
let { cellIds: t, cellData: n } = e(
|
|
3247
|
+
var ka = Da((e) => {
|
|
3248
|
+
p.set(X, (t) => Ea(t, e));
|
|
3249
|
+
}).addLogs, Q = w((e) => e(X).cellIds);
|
|
3250
|
+
w((e) => e(Q).length === 1), w((e) => pa(e(X)).length > 0), w((e) => ma(e(X)).length > 0), w((e) => ha(e(X))), w((e) => ga(e(X)));
|
|
3251
|
+
var Aa = w((e) => ya(e(X), e(un), e(pn)));
|
|
3252
|
+
w((e) => e(Aa) !== null);
|
|
3253
|
+
var ja = w((e) => {
|
|
3254
|
+
let { cellIds: t, cellData: n } = e(X);
|
|
3141
3255
|
return t.map((t) => {
|
|
3142
3256
|
let r = e(R(t)), { name: i } = n[t];
|
|
3143
|
-
if (r !== null &&
|
|
3144
|
-
|
|
3257
|
+
if (r !== null && Bn(r.mimetype)) {
|
|
3258
|
+
T(Array.isArray(r.data), "Expected array data");
|
|
3145
3259
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
3146
3260
|
if (e.length > 0) return {
|
|
3147
3261
|
output: {
|
|
@@ -3154,103 +3268,103 @@ var va = S((e) => {
|
|
|
3154
3268
|
}
|
|
3155
3269
|
return null;
|
|
3156
3270
|
}).filter(Boolean);
|
|
3157
|
-
}),
|
|
3271
|
+
}), Ma = S(w((e) => {
|
|
3158
3272
|
let t = {};
|
|
3159
|
-
for (let n of e(
|
|
3160
|
-
let r = e(
|
|
3273
|
+
for (let n of e(Q)) {
|
|
3274
|
+
let r = e(bn(n));
|
|
3161
3275
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3162
3276
|
}
|
|
3163
3277
|
return t;
|
|
3164
|
-
})),
|
|
3165
|
-
|
|
3166
|
-
var
|
|
3167
|
-
let { cellIds: t, cellData: n } = e(
|
|
3168
|
-
return
|
|
3278
|
+
})), Na = w((e) => qe(e(Q).map((t) => e(bn(t)))));
|
|
3279
|
+
w((e) => e(ja).length);
|
|
3280
|
+
var Pa = S(w((e) => {
|
|
3281
|
+
let { cellIds: t, cellData: n } = e(X);
|
|
3282
|
+
return ce.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3169
3283
|
}));
|
|
3170
|
-
|
|
3171
|
-
var
|
|
3172
|
-
let { cellIds: e, cellData: t } =
|
|
3284
|
+
w((e) => e(X).scrollKey);
|
|
3285
|
+
var Fa = () => C(Q), Ia = () => C(Pa), La = () => p.get(X), Ra = () => p.get(X).cellIds, za = () => {
|
|
3286
|
+
let { cellIds: e, cellData: t } = p.get(X);
|
|
3173
3287
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3174
3288
|
};
|
|
3175
|
-
|
|
3176
|
-
var
|
|
3177
|
-
let t =
|
|
3178
|
-
let
|
|
3289
|
+
_(g(X, (e) => e.cellIds.map((t) => e.cellData[t]))), w((e) => e(X).cellIds.length > 0);
|
|
3290
|
+
var Ba = v((e) => w((t) => t(X).cellData[e])), Va = Lr(), $ = v((e) => {
|
|
3291
|
+
let t = w((t) => Br(t, e, t(m))), n = w((t) => t(X).cellRuntime[e] ?? Va), r = w((e) => {
|
|
3292
|
+
let r = e(t), i = e(m), a = i && e(i.shownDocumentAtom)?.cells;
|
|
3179
3293
|
return {
|
|
3180
|
-
local:
|
|
3181
|
-
execution:
|
|
3182
|
-
code:
|
|
3294
|
+
local: e(n),
|
|
3295
|
+
execution: r,
|
|
3296
|
+
code: r && Dt(r.record, a ?? void 0)
|
|
3183
3297
|
};
|
|
3184
|
-
}),
|
|
3185
|
-
return
|
|
3186
|
-
}),
|
|
3187
|
-
function
|
|
3188
|
-
|
|
3189
|
-
}
|
|
3190
|
-
var
|
|
3191
|
-
let { cellHandles: t } =
|
|
3298
|
+
}), i = g(r, Vr);
|
|
3299
|
+
return w((e) => e(i).rendered);
|
|
3300
|
+
}), Ha = v((e) => w((t) => t(X).cellHandles[e]));
|
|
3301
|
+
function Ua(e) {
|
|
3302
|
+
Ba.remove(e), $.remove(e), Ha.remove(e), xn(e);
|
|
3303
|
+
}
|
|
3304
|
+
var Wa = (e) => {
|
|
3305
|
+
let { cellHandles: t } = p.get(X);
|
|
3192
3306
|
return t[e]?.current?.editorView ?? void 0;
|
|
3193
|
-
},
|
|
3194
|
-
|
|
3195
|
-
...e(
|
|
3196
|
-
...e(
|
|
3307
|
+
}, Ga = (e) => (Ln.promote(e), Wa(e));
|
|
3308
|
+
w((e) => e(Q).map((t) => ({
|
|
3309
|
+
...e(Ba(t)),
|
|
3310
|
+
...e($(t)),
|
|
3197
3311
|
output: e(R(t))
|
|
3198
3312
|
})));
|
|
3199
|
-
function
|
|
3200
|
-
return
|
|
3313
|
+
function Ka() {
|
|
3314
|
+
return Oa();
|
|
3201
3315
|
}
|
|
3202
3316
|
//#endregion
|
|
3203
3317
|
//#region src/core/errors/error-entries.ts
|
|
3204
|
-
function
|
|
3205
|
-
if (
|
|
3318
|
+
function qa(e) {
|
|
3319
|
+
if (Rn(e.mimetype)) {
|
|
3206
3320
|
if (!Array.isArray(e.data)) return null;
|
|
3207
3321
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
3208
3322
|
return t.length === 0 ? null : { errorData: t };
|
|
3209
3323
|
}
|
|
3210
|
-
return
|
|
3324
|
+
return zn(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
3211
3325
|
errorData: [],
|
|
3212
3326
|
tracebackHtml: e.data
|
|
3213
3327
|
} : null;
|
|
3214
3328
|
}
|
|
3215
|
-
function
|
|
3329
|
+
function Ja(e) {
|
|
3216
3330
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3217
3331
|
}
|
|
3218
|
-
function
|
|
3219
|
-
let t = e?.find((e) =>
|
|
3332
|
+
function Ya(e) {
|
|
3333
|
+
let t = e?.find((e) => zn(e.mimetype));
|
|
3220
3334
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3221
3335
|
}
|
|
3222
|
-
function
|
|
3336
|
+
function Xa(e, t) {
|
|
3223
3337
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3224
|
-
if (!
|
|
3338
|
+
if (!Ja(e.errorData)) return Ya(t);
|
|
3225
3339
|
}
|
|
3226
|
-
function
|
|
3227
|
-
let { cellIds: t, cellData: n } = e.get(
|
|
3340
|
+
function Za(e) {
|
|
3341
|
+
let { cellIds: t, cellData: n } = e.get(X), r = [];
|
|
3228
3342
|
for (let [i, a] of t.entries()) {
|
|
3229
3343
|
let t = e.get(R(a));
|
|
3230
|
-
if (t === null || !
|
|
3231
|
-
let o =
|
|
3344
|
+
if (t === null || !Bn(t.mimetype)) continue;
|
|
3345
|
+
let o = qa(t);
|
|
3232
3346
|
if (!o) continue;
|
|
3233
|
-
let s =
|
|
3347
|
+
let s = Nr(n[a].name, i), c = t.code ?? n[a].code;
|
|
3234
3348
|
r.push({
|
|
3235
3349
|
cellId: a,
|
|
3236
3350
|
cellName: s,
|
|
3237
3351
|
cellCode: c,
|
|
3238
3352
|
errorData: o.errorData,
|
|
3239
|
-
tracebackHtml:
|
|
3353
|
+
tracebackHtml: Xa(o, e.get($(a)).consoleOutputs)
|
|
3240
3354
|
});
|
|
3241
3355
|
}
|
|
3242
3356
|
return r;
|
|
3243
3357
|
}
|
|
3244
|
-
function
|
|
3358
|
+
function Qa(e) {
|
|
3245
3359
|
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");
|
|
3246
3360
|
}
|
|
3247
|
-
function
|
|
3248
|
-
let t =
|
|
3249
|
-
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${
|
|
3361
|
+
function $a(e) {
|
|
3362
|
+
let t = Qa(e);
|
|
3363
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${U(e.traceback)}`), t;
|
|
3250
3364
|
}
|
|
3251
|
-
function
|
|
3365
|
+
function eo(e) {
|
|
3252
3366
|
let t = [e.cellName];
|
|
3253
|
-
return e.tracebackHtml && t.push(
|
|
3367
|
+
return e.tracebackHtml && t.push(U(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map($a).join("\n\n")), t.join("\n\n");
|
|
3254
3368
|
}
|
|
3255
3369
|
//#endregion
|
|
3256
|
-
export {
|
|
3370
|
+
export { di as $, ft as $t, sa as A, B as At, Bi as B, ln as Bt, fa as C, Dr as Ct, la as D, $n as Dt, ca as E, gr as Et, Gi as F, Hn as Ft, ji as G, Sn as Gt, Li as H, bn as Ht, Ui as I, Un as It, bi as J, Cn as Jt, Oi as K, sn as Kt, Vi as L, An as Lt, aa as M, qn as Mt, oa as N, Xn as Nt, da as O, Jn as Ot, ia as P, Yn as Pt, mi as Q, pt as Qt, Hi as R, On as Rt, xa as S, jr as St, Ca as T, U as Tt, Ri as U, R as Ut, Ii as V, yn as Vt, Ai as W, L as Wt, yi as X, Dn as Xt, vi as Y, Tn as Yt, hi as Z, Wt as Zt, Ea as _, Br as _t, ka as a, Ce as an, Gr as at, Ia as b, Mr as bt, $ as c, ni as ct, za as d, ai as dt, Ze as en, fi as et, Ra as f, $r as ft, Na as g, Hr as gt, X as h, ei as ht, Za as i, Ve as in, Wr as it, Y as j, z as jt, ua as k, Zn as kt, Da as l, ii as lt, Ta as m, ti as mt, eo as n, Ye as nn, ui as nt, Ba as o, Se as on, ri as ot, La as p, qr as pt, Ci as q, En as qt, $a as r, Ke as rn, li as rt, Q as s, Kr as st, Qa as t, A as tn, W as tt, Ga as u, oi as ut, Ua as v, zr as vt, Sa as w, Cr as wt, Ka as x, Pr as xt, Fa as y, Nr as yt, G as z, vn as zt };
|