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