@marimo-team/islands 0.25.3-dev460 → 0.25.3-dev461
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ErrorBoundary-D2YXxE_x.js → ErrorBoundary-CgQcF2Y8.js} +1 -1
- package/dist/assets/__vite-browser-external-DxDOnHRB.js +1 -0
- package/dist/assets/{worker-DLJ9P24O.js → worker-D70Lo75A.js} +2 -2
- package/dist/{chat-ui-wWHUzOrx.js → chat-ui-Ci-OmyBN.js} +3 -3
- package/dist/{code-visibility-BPWgfZVa.js → code-visibility-Bfy5Xs7h.js} +2 -2
- package/dist/{common-_2RH91nQ.js → common-B1BHI8OU.js} +3 -3
- package/dist/{data-grid-overlay-editor-yh1wqygW.js → data-grid-overlay-editor-D1ZL_HM6.js} +1 -1
- package/dist/{error-entries-3nytC8-z.js → error-entries-DMWlemUn.js} +471 -447
- package/dist/{feedback-button-Ctc_u2JY.js → feedback-button-Dk6liQGD.js} +3 -3
- package/dist/{glide-data-editor-DJikF-sp.js → glide-data-editor-BITFrcq_.js} +3 -3
- package/dist/{globals-D8_0qvIC.js → globals-BT6bOWG8.js} +1 -1
- package/dist/{html-to-image-C3Nb90uM.js → html-to-image-CDlYnllr.js} +1 -1
- package/dist/main.js +8527 -8499
- package/dist/{number-overlay-editor-BUXorcPD.js → number-overlay-editor-BoH3EMeN.js} +1 -1
- package/dist/{process-output-BiLaCBoX.js → process-output-89n_C_pU.js} +2 -2
- package/dist/{reveal-component-B54ZJYk8.js → reveal-component-DTAvChaV.js} +2 -2
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +61 -30
- package/src/components/editor/__tests__/output-persistence.test.tsx +1 -1
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +5 -1
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +1 -1
- package/src/core/cells/__tests__/clear-outputs.test.ts +18 -19
- package/src/core/cells/__tests__/harness.ts +4 -1
- package/src/core/cells/__tests__/layout.test.ts +4 -1
- package/src/core/cells/__tests__/runs.test.ts +2 -2
- package/src/core/cells/__tests__/session.test.ts +52 -45
- package/src/core/cells/__tests__/utils.test.ts +3 -3
- package/src/core/cells/execution-console.ts +7 -2
- package/src/core/cells/runs.ts +1 -1
- package/src/core/cells/session.ts +28 -18
- package/src/core/executions/__tests__/freshness.test.ts +11 -9
- package/src/core/executions/__tests__/hooks.test.tsx +8 -9
- package/src/core/executions/__tests__/output-lifecycle.test.ts +34 -35
- package/src/core/executions/__tests__/output.test.ts +28 -53
- package/src/core/executions/__tests__/select.test.ts +7 -7
- package/src/core/executions/atoms.ts +5 -5
- package/src/core/executions/output.ts +25 -28
- package/src/core/executions/select.ts +3 -11
- package/src/core/export/__tests__/hooks.test.ts +7 -9
- package/src/core/notebook/replica/__tests__/replica.test.ts +3 -3
- package/src/core/notebook/replica/__tests__/results.test.ts +2 -2
- package/src/core/notebook/replica/execution-state.ts +20 -12
- package/src/core/notebook/replica/index.ts +2 -1
- package/src/core/notebook/replica/replica.ts +25 -5
- package/src/core/notebook/replica/resources/executions.ts +41 -17
- package/src/core/notebook/replica/resources/results.ts +11 -9
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +5 -9
- package/src/core/static/virtual-file-tracker.ts +5 -8
- package/src/core/transports/__tests__/server.test.ts +1 -1
- package/src/core/transports/__tests__/static.test.ts +17 -10
- package/src/core/transports/static.ts +14 -6
- package/src/stories/cell.stories.tsx +14 -14
- package/src/stories/layout/vertical/one-column.stories.tsx +2 -1
- package/dist/assets/__vite-browser-external-D2z_TiUO.js +0 -1
|
@@ -295,12 +295,14 @@ var O = {
|
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/core/notebook/replica/execution-state.ts
|
|
297
297
|
function k(e) {
|
|
298
|
-
let t = e.
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
298
|
+
let { state: t } = e.record;
|
|
299
|
+
return t.status === "completed" && t.outcome.kind !== "succeeded" ? t.outcome : e.output === null ? t.status === "completed" ? {
|
|
300
|
+
kind: "output",
|
|
301
|
+
media: null
|
|
302
|
+
} : null : {
|
|
303
|
+
kind: "output",
|
|
304
|
+
media: e.output.media
|
|
305
|
+
};
|
|
304
306
|
}
|
|
305
307
|
function A(e) {
|
|
306
308
|
return e.state.status === "queued" ? null : e.state.started_at;
|
|
@@ -314,19 +316,21 @@ function $e(e) {
|
|
|
314
316
|
//#endregion
|
|
315
317
|
//#region src/core/notebook/replica/resources/results.ts
|
|
316
318
|
function et(e, t) {
|
|
317
|
-
let { record: n,
|
|
318
|
-
return
|
|
319
|
+
let { record: n, output: r, outputVersion: i } = t, a = n.cell_id;
|
|
320
|
+
return a === null || n.state.status !== "completed" || !e.has(a) || n.state.outcome.kind === "skipped" && n.state.outcome.reason === "superseded" ? e : new Map(e).set(a, {
|
|
319
321
|
record: n,
|
|
320
|
-
|
|
322
|
+
output: r,
|
|
323
|
+
outputVersion: i
|
|
321
324
|
});
|
|
322
325
|
}
|
|
323
326
|
function tt(e, t) {
|
|
324
|
-
let { record: n,
|
|
325
|
-
if (n.cell_id !== null || k(
|
|
326
|
-
let
|
|
327
|
-
return e !== null &&
|
|
327
|
+
let { record: n, output: r, outputVersion: i } = t;
|
|
328
|
+
if (n.cell_id !== null || k(t) === null) return e;
|
|
329
|
+
let a = (e) => Date.parse(j(e) ?? A(e) ?? "1970-01-01T00:00:00Z");
|
|
330
|
+
return e !== null && a(e.record) > a(n) ? e : {
|
|
328
331
|
record: n,
|
|
329
|
-
|
|
332
|
+
output: r,
|
|
333
|
+
outputVersion: i
|
|
330
334
|
};
|
|
331
335
|
}
|
|
332
336
|
//#endregion
|
|
@@ -406,16 +410,22 @@ function ct(e, t) {
|
|
|
406
410
|
return e;
|
|
407
411
|
}
|
|
408
412
|
function lt(e, t) {
|
|
409
|
-
|
|
410
|
-
|
|
413
|
+
return JSON.stringify(k(e)) === JSON.stringify(k(t));
|
|
414
|
+
}
|
|
415
|
+
function ut(e, t) {
|
|
416
|
+
return {
|
|
417
|
+
...N(e, t),
|
|
418
|
+
results: et(e.results, t),
|
|
419
|
+
scratch: tt(e.scratch, t)
|
|
420
|
+
};
|
|
411
421
|
}
|
|
412
|
-
function
|
|
422
|
+
function dt(e, t, n) {
|
|
413
423
|
let r = new Map(e.executions);
|
|
414
424
|
for (let [e, n] of r) {
|
|
415
425
|
let i = n.record.cell_id === null ? t.scratch : t.results.get(n.record.cell_id), a = t.executions.get(e) ?? (i?.record.id === e ? i : void 0);
|
|
416
426
|
a !== void 0 && r.set(e, {
|
|
417
427
|
...n,
|
|
418
|
-
outputVersion: a.outputVersion + +!lt(a
|
|
428
|
+
outputVersion: a.outputVersion + +!lt(a, n)
|
|
419
429
|
});
|
|
420
430
|
}
|
|
421
431
|
let i = new Map(e.results);
|
|
@@ -423,6 +433,7 @@ function ut(e, t, n) {
|
|
|
423
433
|
let a = n === null ? void 0 : r.get(n.record.id);
|
|
424
434
|
i.set(e, a === void 0 ? t.results.get(e) ?? null : {
|
|
425
435
|
record: a.record,
|
|
436
|
+
output: a.output,
|
|
426
437
|
outputVersion: a.outputVersion
|
|
427
438
|
});
|
|
428
439
|
}
|
|
@@ -435,7 +446,7 @@ function ut(e, t, n) {
|
|
|
435
446
|
scratch: a == null ? t.scratch : tt(t.scratch, a)
|
|
436
447
|
};
|
|
437
448
|
}
|
|
438
|
-
var
|
|
449
|
+
var ft = {
|
|
439
450
|
initial: {
|
|
440
451
|
runs: /* @__PURE__ */ new Map(),
|
|
441
452
|
executions: /* @__PURE__ */ new Map(),
|
|
@@ -463,19 +474,31 @@ var dt = {
|
|
|
463
474
|
execution: (e, { data: { execution: t } }) => {
|
|
464
475
|
let n = e.executions.get(t.id), r = {
|
|
465
476
|
record: t,
|
|
466
|
-
|
|
477
|
+
output: n?.output ?? null
|
|
478
|
+
};
|
|
479
|
+
return ut(e, {
|
|
480
|
+
...r,
|
|
481
|
+
outputVersion: n === void 0 ? 0 : n.outputVersion + +!lt(n, r),
|
|
467
482
|
append: n?.append,
|
|
468
483
|
lastSeq: n?.lastSeq,
|
|
469
484
|
items: n?.items ?? /* @__PURE__ */ new Map(),
|
|
470
485
|
variables: n?.variables ?? /* @__PURE__ */ new Map()
|
|
471
|
-
};
|
|
472
|
-
return {
|
|
473
|
-
...N(e, r),
|
|
474
|
-
results: et(e.results, r),
|
|
475
|
-
scratch: tt(e.scratch, r)
|
|
476
|
-
};
|
|
486
|
+
});
|
|
477
487
|
},
|
|
478
488
|
"execution.removed": (e, { data: t }) => it(e, t.id),
|
|
489
|
+
output: (e, { data: { output: t } }) => {
|
|
490
|
+
let n = e.executions.get(t.execution_id);
|
|
491
|
+
if (n === void 0) return e;
|
|
492
|
+
let r = {
|
|
493
|
+
...n,
|
|
494
|
+
output: t
|
|
495
|
+
};
|
|
496
|
+
return ut(e, {
|
|
497
|
+
...r,
|
|
498
|
+
outputVersion: n.outputVersion + +!lt(n, r)
|
|
499
|
+
});
|
|
500
|
+
},
|
|
501
|
+
"output.removed": (e) => e,
|
|
479
502
|
console: (e, { data: t }) => at(e, {
|
|
480
503
|
...t.console,
|
|
481
504
|
kind: "console",
|
|
@@ -496,11 +519,11 @@ var dt = {
|
|
|
496
519
|
variable: (e, { data: t }) => st(e, t.variable),
|
|
497
520
|
"variable.removed": (e, { data: t }) => ct(e, t.id)
|
|
498
521
|
}
|
|
499
|
-
},
|
|
522
|
+
}, pt = {
|
|
500
523
|
sourceChanged: !1,
|
|
501
524
|
inputsChanged: !1
|
|
502
525
|
};
|
|
503
|
-
function
|
|
526
|
+
function mt(e) {
|
|
504
527
|
let t = /* @__PURE__ */ new Map();
|
|
505
528
|
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
506
529
|
let n = t.get(e.name);
|
|
@@ -508,8 +531,8 @@ function pt(e) {
|
|
|
508
531
|
}
|
|
509
532
|
return t;
|
|
510
533
|
}
|
|
511
|
-
function
|
|
512
|
-
let t =
|
|
534
|
+
function ht(e) {
|
|
535
|
+
let t = mt(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
513
536
|
function i(e, n) {
|
|
514
537
|
let i = new Set(n).add(e.id);
|
|
515
538
|
for (let [n, a] of Object.entries($e(e))) {
|
|
@@ -546,54 +569,54 @@ function mt(e) {
|
|
|
546
569
|
}
|
|
547
570
|
return (t) => {
|
|
548
571
|
let n = e.results.get(t)?.record;
|
|
549
|
-
return n == null ?
|
|
572
|
+
return n == null ? pt : o(n, /* @__PURE__ */ new Set());
|
|
550
573
|
};
|
|
551
574
|
}
|
|
552
575
|
//#endregion
|
|
553
576
|
//#region src/core/executions/output.ts
|
|
554
|
-
var
|
|
577
|
+
var gt = /* @__PURE__ */ new Map(), _t = "application/vnd.marimo+error";
|
|
555
578
|
function P(e) {
|
|
556
579
|
return e;
|
|
557
580
|
}
|
|
558
|
-
function
|
|
581
|
+
function vt(e) {
|
|
559
582
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
560
583
|
cell_id: P(e),
|
|
561
584
|
message: t
|
|
562
585
|
}));
|
|
563
586
|
}
|
|
564
|
-
function
|
|
587
|
+
function yt(e) {
|
|
565
588
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
566
589
|
}
|
|
567
|
-
function
|
|
568
|
-
return
|
|
590
|
+
function bt(e) {
|
|
591
|
+
return yt(j(e) ?? A(e));
|
|
569
592
|
}
|
|
570
|
-
function
|
|
593
|
+
function xt(e, t) {
|
|
571
594
|
return {
|
|
572
595
|
channel: "output",
|
|
573
596
|
mimetype: t.mimetype,
|
|
574
597
|
data: t.data,
|
|
575
|
-
timestamp:
|
|
598
|
+
timestamp: bt(e)
|
|
576
599
|
};
|
|
577
600
|
}
|
|
578
601
|
function F(e, t) {
|
|
579
602
|
return {
|
|
580
603
|
channel: "marimo-error",
|
|
581
|
-
mimetype:
|
|
604
|
+
mimetype: _t,
|
|
582
605
|
data: t,
|
|
583
|
-
timestamp:
|
|
606
|
+
timestamp: bt(e)
|
|
584
607
|
};
|
|
585
608
|
}
|
|
586
|
-
function
|
|
609
|
+
function St(e) {
|
|
587
610
|
let t = e.related.at(0);
|
|
588
611
|
return t === void 0 ? null : P(t.cell_id);
|
|
589
612
|
}
|
|
590
|
-
function
|
|
613
|
+
function Ct(e) {
|
|
591
614
|
switch (e.kind) {
|
|
592
615
|
case "exception": return {
|
|
593
616
|
type: "exception",
|
|
594
617
|
exception_type: e.name ?? "Exception",
|
|
595
618
|
msg: e.message,
|
|
596
|
-
raising_cell:
|
|
619
|
+
raising_cell: St(e),
|
|
597
620
|
traceback: e.traceback?.data ?? null
|
|
598
621
|
};
|
|
599
622
|
case "invalid-syntax": return {
|
|
@@ -611,11 +634,11 @@ function St(e) {
|
|
|
611
634
|
type: "diagnostic",
|
|
612
635
|
kind: e.kind,
|
|
613
636
|
msg: e.message,
|
|
614
|
-
related:
|
|
637
|
+
related: vt(e.related)
|
|
615
638
|
};
|
|
616
639
|
}
|
|
617
640
|
}
|
|
618
|
-
function
|
|
641
|
+
function wt(e, t) {
|
|
619
642
|
let n = t.related[0];
|
|
620
643
|
if (n !== void 0 && t.reason === "upstream-stopped") return F(e, [{
|
|
621
644
|
type: "ancestor-stopped",
|
|
@@ -635,54 +658,54 @@ function Ct(e, t) {
|
|
|
635
658
|
type: "diagnostic",
|
|
636
659
|
kind: t.reason,
|
|
637
660
|
msg: t.message,
|
|
638
|
-
related:
|
|
661
|
+
related: vt(t.related)
|
|
639
662
|
}]);
|
|
640
663
|
}
|
|
641
|
-
function
|
|
664
|
+
function Tt(e, t = gt) {
|
|
642
665
|
let n = e.cell_id === null ? void 0 : t.get(e.cell_id);
|
|
643
666
|
return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
|
|
644
667
|
}
|
|
645
|
-
function
|
|
646
|
-
let n =
|
|
668
|
+
function Et(e, t = gt) {
|
|
669
|
+
let n = Dt(e), r = Tt(e.record, t);
|
|
647
670
|
return n === null || r === void 0 ? n : {
|
|
648
671
|
...n,
|
|
649
672
|
code: r
|
|
650
673
|
};
|
|
651
674
|
}
|
|
652
|
-
function
|
|
653
|
-
let t = k(e);
|
|
654
|
-
if (
|
|
655
|
-
switch (
|
|
656
|
-
case "
|
|
657
|
-
case "error": return F(
|
|
658
|
-
case "interrupted": return F(
|
|
659
|
-
case "skipped": return
|
|
675
|
+
function Dt(e) {
|
|
676
|
+
let { record: t } = e, n = k(e);
|
|
677
|
+
if (n === null) return null;
|
|
678
|
+
switch (n.kind) {
|
|
679
|
+
case "output": return n.media === null ? null : xt(t, n.media);
|
|
680
|
+
case "error": return F(t, [Ct(n.error)]);
|
|
681
|
+
case "interrupted": return F(t, [{ type: "interruption" }]);
|
|
682
|
+
case "skipped": return wt(t, n);
|
|
660
683
|
}
|
|
661
684
|
}
|
|
662
|
-
function
|
|
685
|
+
function Ot(e, t) {
|
|
663
686
|
let n = e.executions.latest.get(t), r = n === void 0 ? void 0 : e.executions.executions.get(n);
|
|
664
|
-
if (r !== void 0 && k(r
|
|
687
|
+
if (r !== void 0 && k(r) !== null && r.record.state.status !== "completed") return r;
|
|
665
688
|
let i = e.results.get(t) ?? null;
|
|
666
|
-
return r?.record.state.status === "running" && i !== null && k(i
|
|
689
|
+
return r?.record.state.status === "running" && i !== null && k(i)?.kind === "skipped" ? null : i;
|
|
667
690
|
}
|
|
668
|
-
function
|
|
691
|
+
function kt(e, t) {
|
|
669
692
|
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
670
693
|
}
|
|
671
|
-
function
|
|
672
|
-
let n =
|
|
673
|
-
return n === null ||
|
|
694
|
+
function At(e, t) {
|
|
695
|
+
let n = Ot(e, t);
|
|
696
|
+
return n === null || kt(e.cleared.get(t), n) ? null : Et(n, e.cells);
|
|
674
697
|
}
|
|
675
|
-
function
|
|
698
|
+
function jt(e) {
|
|
676
699
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
|
|
677
700
|
for (let r of n) {
|
|
678
|
-
let n =
|
|
701
|
+
let n = At(e, r);
|
|
679
702
|
n !== null && t.set(P(r), n);
|
|
680
703
|
}
|
|
681
704
|
return t;
|
|
682
705
|
}
|
|
683
706
|
//#endregion
|
|
684
707
|
//#region src/utils/time.ts
|
|
685
|
-
var
|
|
708
|
+
var Mt = class e {
|
|
686
709
|
ms;
|
|
687
710
|
static fromMilliseconds(t) {
|
|
688
711
|
return t == null ? null : new e(t);
|
|
@@ -711,68 +734,67 @@ var jt = class e {
|
|
|
711
734
|
};
|
|
712
735
|
//#endregion
|
|
713
736
|
//#region src/core/executions/select.ts
|
|
714
|
-
function Mt(e) {
|
|
715
|
-
let t = k(e);
|
|
716
|
-
return t === null ? null : t.kind;
|
|
717
|
-
}
|
|
718
737
|
function Nt(e) {
|
|
719
|
-
return e ===
|
|
738
|
+
return e.state.status === "completed" ? e.state.outcome.kind : null;
|
|
720
739
|
}
|
|
721
|
-
function Pt(e
|
|
740
|
+
function Pt(e) {
|
|
741
|
+
return e === null ? null : Mt.parse(e).toMilliseconds();
|
|
742
|
+
}
|
|
743
|
+
function Ft(e, t) {
|
|
722
744
|
let n = e.latest.get(t);
|
|
723
745
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
724
746
|
}
|
|
725
|
-
function
|
|
747
|
+
function It(e, t) {
|
|
726
748
|
let n = e.cells.get(t);
|
|
727
749
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
728
750
|
}
|
|
729
|
-
function
|
|
730
|
-
if (!
|
|
751
|
+
function Lt(e, t) {
|
|
752
|
+
if (!It(e, t)) return !1;
|
|
731
753
|
if (e.requested.has(t)) return !0;
|
|
732
|
-
let n =
|
|
754
|
+
let n = Ft(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id;
|
|
733
755
|
for (let r of e.executions.runs.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" && r.origin.cell_ids.includes(t)) return !0;
|
|
734
756
|
return !1;
|
|
735
757
|
}
|
|
736
|
-
function
|
|
737
|
-
let n =
|
|
738
|
-
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s =
|
|
739
|
-
let c = i === "idle", l = c && a !== null && o !== null ?
|
|
758
|
+
function Rt(e, t) {
|
|
759
|
+
let n = Ft(e.executions, t), r = e.results.get(t)?.record ?? null, i = "idle", a = r === null ? null : A(r), o = r === null ? null : j(r), s = Pt(a);
|
|
760
|
+
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s = Pt(A(n.record)) ?? s) : Lt(e, t) && (i = "queued");
|
|
761
|
+
let c = i === "idle", l = c && a !== null && o !== null ? Mt.parse(o).since(Mt.parse(a)) : null;
|
|
740
762
|
return {
|
|
741
763
|
status: i,
|
|
742
764
|
blocked: e.blocked.has(t),
|
|
743
|
-
outcome: c && r !== null ?
|
|
765
|
+
outcome: c && r !== null ? Nt(r) : null,
|
|
744
766
|
live: r === null || e.runtimeId === null || r.runtime_id === e.runtimeId,
|
|
745
767
|
startedAt: s,
|
|
746
768
|
duration: l
|
|
747
769
|
};
|
|
748
770
|
}
|
|
749
|
-
function Rt(e) {
|
|
750
|
-
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
751
|
-
}
|
|
752
771
|
function zt(e) {
|
|
753
|
-
return
|
|
772
|
+
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
754
773
|
}
|
|
755
774
|
function Bt(e) {
|
|
756
|
-
|
|
775
|
+
return zt(e).some((e) => e.record.state.status === "running");
|
|
776
|
+
}
|
|
777
|
+
function Vt(e) {
|
|
778
|
+
let t = zt(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
757
779
|
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);
|
|
758
780
|
let i = 0;
|
|
759
|
-
for (let t of r) !n.has(t) &&
|
|
781
|
+
for (let t of r) !n.has(t) && Lt(e, t) && (i += 1);
|
|
760
782
|
return t.length + i;
|
|
761
783
|
}
|
|
762
784
|
//#endregion
|
|
763
785
|
//#region src/core/executions/atoms.ts
|
|
764
|
-
var
|
|
786
|
+
var Ht = {
|
|
765
787
|
runs: /* @__PURE__ */ new Map(),
|
|
766
788
|
executions: /* @__PURE__ */ new Map(),
|
|
767
789
|
latest: /* @__PURE__ */ new Map(),
|
|
768
790
|
results: /* @__PURE__ */ new Map(),
|
|
769
791
|
scratch: null
|
|
770
|
-
},
|
|
771
|
-
function
|
|
792
|
+
}, Ut = /* @__PURE__ */ new Map(), Wt = /* @__PURE__ */ new Map(), Gt = /* @__PURE__ */ new Set(), Kt = /* @__PURE__ */ new Set(), qt = /* @__PURE__ */ new Set(), Jt = /* @__PURE__ */ new Map(), I = x(null), Yt = x(null);
|
|
793
|
+
function Xt(e, t) {
|
|
772
794
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
773
795
|
}
|
|
774
|
-
function
|
|
775
|
-
return e !== null &&
|
|
796
|
+
function Zt(e, t, n) {
|
|
797
|
+
return e !== null && Xt(e.notebook, t) ? e.value : n;
|
|
776
798
|
}
|
|
777
799
|
var L = x((e) => {
|
|
778
800
|
let t = e(h), n = t === null ? null : e(t.notebookAtom);
|
|
@@ -782,73 +804,73 @@ var L = x((e) => {
|
|
|
782
804
|
generation: e(t.generationAtom)
|
|
783
805
|
};
|
|
784
806
|
});
|
|
785
|
-
function
|
|
786
|
-
return
|
|
807
|
+
function Qt(e, t) {
|
|
808
|
+
return Xt(t.notebook, e.get(L));
|
|
787
809
|
}
|
|
788
|
-
var
|
|
789
|
-
let t =
|
|
790
|
-
return t.size === 0 ?
|
|
810
|
+
var $t = x((e) => {
|
|
811
|
+
let t = Zt(e(I), e(L), Gt);
|
|
812
|
+
return t.size === 0 ? Kt : new Set([...t].flatMap((e) => e.cells));
|
|
791
813
|
}), R = x((e) => {
|
|
792
814
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
793
815
|
return {
|
|
794
|
-
executions: t === null ?
|
|
795
|
-
results: t === null ?
|
|
796
|
-
cells: n?.cells ??
|
|
797
|
-
requested: e(
|
|
798
|
-
blocked:
|
|
816
|
+
executions: t === null ? Ht : e(t.executionsAtom),
|
|
817
|
+
results: t === null ? Ut : e(t.resultsAtom),
|
|
818
|
+
cells: n?.cells ?? Wt,
|
|
819
|
+
requested: e($t),
|
|
820
|
+
blocked: Zt(e(Yt), e(L), qt),
|
|
799
821
|
runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
|
|
800
822
|
};
|
|
801
|
-
}),
|
|
823
|
+
}), en = x((e) => {
|
|
802
824
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
803
825
|
return t === null || n === null ? {
|
|
804
|
-
cells:
|
|
805
|
-
executions:
|
|
806
|
-
results:
|
|
826
|
+
cells: Wt,
|
|
827
|
+
executions: Ht,
|
|
828
|
+
results: Ut
|
|
807
829
|
} : {
|
|
808
830
|
cells: n.cells,
|
|
809
831
|
executions: e(t.executionsAtom),
|
|
810
832
|
results: e(t.resultsAtom)
|
|
811
833
|
};
|
|
812
|
-
}),
|
|
834
|
+
}), tn = x((e) => ht(e(en))), nn = x(null), rn = x((e) => {
|
|
813
835
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
814
836
|
return t === null || n === null ? null : {
|
|
815
837
|
replica: t,
|
|
816
838
|
id: n.revision.notebook_id,
|
|
817
839
|
generation: e(t.generationAtom)
|
|
818
840
|
};
|
|
819
|
-
}),
|
|
841
|
+
}), an = x((e) => {
|
|
820
842
|
let t = e(h);
|
|
821
843
|
return {
|
|
822
|
-
executions: t === null ?
|
|
823
|
-
results: t === null ?
|
|
824
|
-
cleared:
|
|
825
|
-
cells: t === null ?
|
|
844
|
+
executions: t === null ? Ht : e(t.executionsAtom),
|
|
845
|
+
results: t === null ? Ut : e(t.resultsAtom),
|
|
846
|
+
cleared: Zt(e(nn), e(rn), Jt),
|
|
847
|
+
cells: t === null ? Wt : e(t.documentAtom)?.cells ?? Wt
|
|
826
848
|
};
|
|
827
|
-
}),
|
|
828
|
-
function
|
|
829
|
-
z.remove(e),
|
|
849
|
+
}), on = x((e) => jt(e(an))), z = S((e) => _(on, (t) => t.get(e) ?? null, g)), sn = S((e) => x((t) => Ye(t(z(e)))));
|
|
850
|
+
function cn(e) {
|
|
851
|
+
z.remove(e), sn.remove(e);
|
|
830
852
|
}
|
|
831
|
-
function
|
|
832
|
-
let n = e.get(
|
|
853
|
+
function ln(e, t) {
|
|
854
|
+
let n = e.get(an), r = new Map(n.cleared);
|
|
833
855
|
for (let e of t) {
|
|
834
|
-
let t =
|
|
835
|
-
t != null && k(t
|
|
856
|
+
let t = Ot(n, e);
|
|
857
|
+
t != null && k(t) !== null && r.set(e, {
|
|
836
858
|
execution: t.record.id,
|
|
837
859
|
version: t.outputVersion
|
|
838
860
|
});
|
|
839
861
|
}
|
|
840
|
-
let i = e.get(
|
|
841
|
-
e.set(
|
|
862
|
+
let i = e.get(rn);
|
|
863
|
+
e.set(nn, i === null ? null : {
|
|
842
864
|
notebook: i,
|
|
843
865
|
value: r
|
|
844
866
|
});
|
|
845
867
|
}
|
|
846
|
-
var
|
|
868
|
+
var un = x((e) => {
|
|
847
869
|
let t = e(h);
|
|
848
870
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
849
871
|
});
|
|
850
|
-
x((e) =>
|
|
851
|
-
var
|
|
872
|
+
x((e) => Bt(e(R).executions)), x((e) => Vt(e(R)));
|
|
873
|
+
var dn = x((e) => {
|
|
852
874
|
let t = e(h);
|
|
853
875
|
if (t === null) return { refused: "No notebook is connected" };
|
|
854
876
|
if (e(t.connectionAtom).state === O.CLOSED) return { refused: "The notebook is disconnected" };
|
|
@@ -861,29 +883,29 @@ var un = x((e) => {
|
|
|
861
883
|
default: return "waiting";
|
|
862
884
|
}
|
|
863
885
|
});
|
|
864
|
-
function
|
|
886
|
+
function fn(e) {
|
|
865
887
|
return new Promise((t, n) => {
|
|
866
|
-
let r = e.sub(
|
|
888
|
+
let r = e.sub(dn, i);
|
|
867
889
|
function i() {
|
|
868
|
-
let i = e.get(
|
|
890
|
+
let i = e.get(dn);
|
|
869
891
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
870
892
|
}
|
|
871
893
|
i();
|
|
872
894
|
});
|
|
873
895
|
}
|
|
874
|
-
function
|
|
896
|
+
function pn(e, t) {
|
|
875
897
|
let n = e.get(L);
|
|
876
898
|
if (n === null) return null;
|
|
877
899
|
let r = {
|
|
878
900
|
notebook: n,
|
|
879
901
|
cells: [...t]
|
|
880
|
-
}, i =
|
|
902
|
+
}, i = Zt(e.get(I), n, Gt);
|
|
881
903
|
return e.set(I, {
|
|
882
904
|
notebook: n,
|
|
883
905
|
value: new Set(i).add(r)
|
|
884
906
|
}), r;
|
|
885
907
|
}
|
|
886
|
-
function
|
|
908
|
+
function mn(e, t) {
|
|
887
909
|
let n = e.get(I);
|
|
888
910
|
if (n === null || !n.value.has(t)) return;
|
|
889
911
|
let r = new Set(n.value);
|
|
@@ -892,38 +914,38 @@ function pn(e, t) {
|
|
|
892
914
|
value: r
|
|
893
915
|
});
|
|
894
916
|
}
|
|
895
|
-
function
|
|
896
|
-
let r = x((e) =>
|
|
917
|
+
function hn(e, t, n) {
|
|
918
|
+
let r = x((e) => Xt(t.notebook, e(L)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
897
919
|
function a() {
|
|
898
|
-
e.get(r) || (i(),
|
|
920
|
+
e.get(r) || (i(), mn(e, t));
|
|
899
921
|
}
|
|
900
922
|
a();
|
|
901
923
|
}
|
|
902
|
-
function
|
|
924
|
+
function gn(e, t, n) {
|
|
903
925
|
let r = e.get(R).blocked;
|
|
904
926
|
if (r.has(t) === n) return;
|
|
905
927
|
let i = new Set(r);
|
|
906
928
|
n ? i.add(t) : i.delete(t);
|
|
907
929
|
let a = e.get(L);
|
|
908
|
-
a !== null && e.set(
|
|
930
|
+
a !== null && e.set(Yt, {
|
|
909
931
|
notebook: a,
|
|
910
932
|
value: i
|
|
911
933
|
});
|
|
912
934
|
}
|
|
913
935
|
//#endregion
|
|
914
936
|
//#region src/core/codemirror/editing/commands.ts
|
|
915
|
-
var
|
|
916
|
-
function
|
|
937
|
+
var _n = a();
|
|
938
|
+
function vn(e) {
|
|
917
939
|
return (t) => {
|
|
918
940
|
let n = !1;
|
|
919
941
|
for (let r of t) r && (n = e(r) || n);
|
|
920
942
|
return n;
|
|
921
943
|
};
|
|
922
944
|
}
|
|
923
|
-
var
|
|
945
|
+
var yn = vn(ge), bn = vn(he);
|
|
924
946
|
//#endregion
|
|
925
947
|
//#region src/utils/schedule-task.ts
|
|
926
|
-
function
|
|
948
|
+
function xn() {
|
|
927
949
|
let e = globalThis.scheduler;
|
|
928
950
|
if (typeof e?.postTask == "function") return (t) => {
|
|
929
951
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -944,10 +966,10 @@ function bn() {
|
|
|
944
966
|
setTimeout(e, 0);
|
|
945
967
|
};
|
|
946
968
|
}
|
|
947
|
-
var
|
|
969
|
+
var Sn = xn();
|
|
948
970
|
//#endregion
|
|
949
971
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
950
|
-
function
|
|
972
|
+
function Cn(e = Sn) {
|
|
951
973
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
952
974
|
function i() {
|
|
953
975
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -990,21 +1012,21 @@ function Sn(e = xn) {
|
|
|
990
1012
|
}
|
|
991
1013
|
};
|
|
992
1014
|
}
|
|
993
|
-
var
|
|
1015
|
+
var wn = Cn();
|
|
994
1016
|
//#endregion
|
|
995
1017
|
//#region src/core/mime.ts
|
|
996
|
-
function
|
|
1018
|
+
function Tn(e) {
|
|
997
1019
|
return e === "application/vnd.marimo+error";
|
|
998
1020
|
}
|
|
999
|
-
function
|
|
1021
|
+
function En(e) {
|
|
1000
1022
|
return e === "application/vnd.marimo+traceback";
|
|
1001
1023
|
}
|
|
1002
|
-
function
|
|
1003
|
-
return
|
|
1024
|
+
function Dn(e) {
|
|
1025
|
+
return Tn(e) || En(e);
|
|
1004
1026
|
}
|
|
1005
1027
|
//#endregion
|
|
1006
1028
|
//#region src/core/cells/command-console.ts
|
|
1007
|
-
function
|
|
1029
|
+
function On(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
1008
1030
|
if (t === "callback-output" && !r && n.length === 0) return { entries: [] };
|
|
1009
1031
|
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) => ({
|
|
1010
1032
|
...e,
|
|
@@ -1015,15 +1037,15 @@ function Dn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1015
1037
|
}
|
|
1016
1038
|
//#endregion
|
|
1017
1039
|
//#region src/core/dom/ui-element-constants.ts
|
|
1018
|
-
var
|
|
1040
|
+
var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn = jn + jn.toUpperCase(), Nn = /* @__PURE__ */ new Set(), B = "__scratch__", Pn = "setup", Fn = { create() {
|
|
1019
1041
|
let e = 0, t;
|
|
1020
1042
|
do {
|
|
1021
1043
|
let n = "";
|
|
1022
|
-
for (let e = 0; e < 4; e++) n +=
|
|
1044
|
+
for (let e = 0; e < 4; e++) n += Mn[Math.floor(Math.random() * 52)];
|
|
1023
1045
|
t = n, e++;
|
|
1024
|
-
} while (
|
|
1046
|
+
} while (Nn.has(t) && e < 100);
|
|
1025
1047
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1026
|
-
return
|
|
1048
|
+
return Nn.add(t), t;
|
|
1027
1049
|
} }, V = {
|
|
1028
1050
|
create(e) {
|
|
1029
1051
|
return C(e != null, "cellId is required"), `cell-${e}`;
|
|
@@ -1045,21 +1067,21 @@ var On = "object-id", kn = "random-id", An = "abcdefghijklmnopqrstuvwxyz", jn =
|
|
|
1045
1067
|
return null;
|
|
1046
1068
|
}
|
|
1047
1069
|
};
|
|
1048
|
-
function
|
|
1070
|
+
function In(e) {
|
|
1049
1071
|
let t = null, n = V.findElementThroughShadowDOMs(e);
|
|
1050
1072
|
return n && (t = V.parse(n.id)), t;
|
|
1051
1073
|
}
|
|
1052
|
-
var
|
|
1074
|
+
var Ln = {
|
|
1053
1075
|
parse(e) {
|
|
1054
|
-
return e.getAttribute(
|
|
1076
|
+
return e.getAttribute(kn);
|
|
1055
1077
|
},
|
|
1056
1078
|
parseOrThrow(e) {
|
|
1057
|
-
let t =
|
|
1079
|
+
let t = Ln.parse(e);
|
|
1058
1080
|
return C(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1059
1081
|
}
|
|
1060
|
-
},
|
|
1082
|
+
}, Rn = { create(e) {
|
|
1061
1083
|
return `output-${e}`;
|
|
1062
|
-
} },
|
|
1084
|
+
} }, zn = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, Bn = class e {
|
|
1063
1085
|
static get INSTANCE() {
|
|
1064
1086
|
let t = "_marimo_private_VirtualFileTracker";
|
|
1065
1087
|
return window[t] || (window[t] = new e()), window[t];
|
|
@@ -1070,9 +1092,8 @@ var In = {
|
|
|
1070
1092
|
track(e) {
|
|
1071
1093
|
this.trackValue(e.cell_id, e.output);
|
|
1072
1094
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
n && this.trackValue(e.cell_id ?? "__scratch__", n);
|
|
1095
|
+
trackOutput(e, t) {
|
|
1096
|
+
e.media && this.trackValue(t.cell_id ?? "__scratch__", e.media);
|
|
1076
1097
|
}
|
|
1077
1098
|
trackCallbackOutput(e) {
|
|
1078
1099
|
(e.replace || e.entries.length === 0) && this.callbackFiles.delete(e.cell_id);
|
|
@@ -1082,7 +1103,7 @@ var In = {
|
|
|
1082
1103
|
switch (t.mimetype) {
|
|
1083
1104
|
case "application/json":
|
|
1084
1105
|
case "text/html": {
|
|
1085
|
-
let r = n.get(e), i =
|
|
1106
|
+
let r = n.get(e), i = Vn(t.data);
|
|
1086
1107
|
r?.forEach((e) => i.add(e)), n.set(e, i);
|
|
1087
1108
|
return;
|
|
1088
1109
|
}
|
|
@@ -1098,15 +1119,15 @@ var In = {
|
|
|
1098
1119
|
this.virtualFiles.delete(e), this.callbackFiles.delete(e);
|
|
1099
1120
|
}
|
|
1100
1121
|
};
|
|
1101
|
-
function
|
|
1122
|
+
function Vn(e) {
|
|
1102
1123
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1103
|
-
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(
|
|
1124
|
+
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(zn);
|
|
1104
1125
|
if (n) for (let e of n) t.add(e);
|
|
1105
1126
|
return t;
|
|
1106
1127
|
}
|
|
1107
1128
|
//#endregion
|
|
1108
1129
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
1109
|
-
var
|
|
1130
|
+
var Hn = class e {
|
|
1110
1131
|
lines = [""];
|
|
1111
1132
|
cursor = {
|
|
1112
1133
|
row: 0,
|
|
@@ -1208,7 +1229,7 @@ var Vn = class e {
|
|
|
1208
1229
|
render() {
|
|
1209
1230
|
return this.lines.join("\n");
|
|
1210
1231
|
}
|
|
1211
|
-
},
|
|
1232
|
+
}, Un = class {
|
|
1212
1233
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
1213
1234
|
parse(e) {
|
|
1214
1235
|
let t = [], n = 0;
|
|
@@ -1227,13 +1248,13 @@ var Vn = class e {
|
|
|
1227
1248
|
value: e.slice(n)
|
|
1228
1249
|
}), t;
|
|
1229
1250
|
}
|
|
1230
|
-
},
|
|
1231
|
-
parser = new
|
|
1251
|
+
}, Wn = class e {
|
|
1252
|
+
parser = new Un();
|
|
1232
1253
|
buffer;
|
|
1233
1254
|
incompleteEscape = "";
|
|
1234
1255
|
static INCOMPLETE_ESCAPE = new RegExp(String.raw`\u001B(?:\[[0-9;]*|\()?$`, "u");
|
|
1235
1256
|
constructor(e = 0) {
|
|
1236
|
-
this.buffer = new
|
|
1257
|
+
this.buffer = new Hn(e);
|
|
1237
1258
|
}
|
|
1238
1259
|
copy(t = 0) {
|
|
1239
1260
|
let n = new e();
|
|
@@ -1257,7 +1278,7 @@ var Vn = class e {
|
|
|
1257
1278
|
for (let e of r) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
1258
1279
|
}
|
|
1259
1280
|
reset() {
|
|
1260
|
-
this.buffer = new
|
|
1281
|
+
this.buffer = new Hn(), this.incompleteEscape = "";
|
|
1261
1282
|
}
|
|
1262
1283
|
render() {
|
|
1263
1284
|
return this.buffer.render();
|
|
@@ -1301,7 +1322,7 @@ var Vn = class e {
|
|
|
1301
1322
|
return n;
|
|
1302
1323
|
}
|
|
1303
1324
|
};
|
|
1304
|
-
function
|
|
1325
|
+
function Gn(e) {
|
|
1305
1326
|
let t = 1;
|
|
1306
1327
|
for (let n = 0; n < e.length; n++) {
|
|
1307
1328
|
let r = e.charCodeAt(n);
|
|
@@ -1332,14 +1353,14 @@ var H = class e {
|
|
|
1332
1353
|
}
|
|
1333
1354
|
appendData(t) {
|
|
1334
1355
|
if (!this.terminal) {
|
|
1335
|
-
let n =
|
|
1356
|
+
let n = Gn(t);
|
|
1336
1357
|
if (n !== void 0) return new e(this, {
|
|
1337
1358
|
data: this.data + t,
|
|
1338
1359
|
lineCount: this.lineCount + n - 1,
|
|
1339
1360
|
firstPlainRow: this.firstPlainRow
|
|
1340
1361
|
});
|
|
1341
1362
|
}
|
|
1342
|
-
let n = this.terminal?.copy() ?? new
|
|
1363
|
+
let n = this.terminal?.copy() ?? new Wn(this.firstPlainRow);
|
|
1343
1364
|
this.terminal || n.append(this.data), n.append(t);
|
|
1344
1365
|
let r = n.render();
|
|
1345
1366
|
return new e(this, {
|
|
@@ -1367,19 +1388,19 @@ var H = class e {
|
|
|
1367
1388
|
...this.code === void 0 ? {} : { code: this.code }
|
|
1368
1389
|
};
|
|
1369
1390
|
}
|
|
1370
|
-
},
|
|
1371
|
-
function
|
|
1391
|
+
}, Kn = 5e3;
|
|
1392
|
+
function qn(e, t = Kn) {
|
|
1372
1393
|
let n = e.slice(0, -1), r = e.at(-1);
|
|
1373
|
-
return r &&
|
|
1394
|
+
return r && Yn(n, r), er(n, t);
|
|
1374
1395
|
}
|
|
1375
|
-
function
|
|
1396
|
+
function Jn(e) {
|
|
1376
1397
|
let t = [];
|
|
1377
1398
|
for (let n = 0; n < e.length;) {
|
|
1378
1399
|
let r = e[n], i = n + 1;
|
|
1379
|
-
for (; i < e.length &&
|
|
1380
|
-
if (i === n + 1)
|
|
1400
|
+
for (; i < e.length && Xn(r, e[i]);) i++;
|
|
1401
|
+
if (i === n + 1) Yn(t, r);
|
|
1381
1402
|
else {
|
|
1382
|
-
let a = e.slice(n, i).map((e) => (
|
|
1403
|
+
let a = e.slice(n, i).map((e) => ($n(e), e.data));
|
|
1383
1404
|
t.push(H.create({
|
|
1384
1405
|
...r,
|
|
1385
1406
|
data: a.join("")
|
|
@@ -1387,28 +1408,28 @@ function qn(e) {
|
|
|
1387
1408
|
}
|
|
1388
1409
|
n = i;
|
|
1389
1410
|
}
|
|
1390
|
-
return
|
|
1411
|
+
return er(t, Kn);
|
|
1391
1412
|
}
|
|
1392
|
-
function
|
|
1413
|
+
function Yn(e, t) {
|
|
1393
1414
|
let n = e.at(-1);
|
|
1394
|
-
n &&
|
|
1415
|
+
n && Xn(n, t) ? ($n(n), $n(t), e[e.length - 1] = Qn(n, t)) : e.push(Zn(t));
|
|
1395
1416
|
}
|
|
1396
|
-
function
|
|
1417
|
+
function Xn(e, t) {
|
|
1397
1418
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
1398
1419
|
if (!n) return !1;
|
|
1399
1420
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
1400
1421
|
return n && r && i;
|
|
1401
1422
|
}
|
|
1402
|
-
function
|
|
1423
|
+
function Zn(e) {
|
|
1403
1424
|
return e instanceof H ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? H.create(e) : e;
|
|
1404
1425
|
}
|
|
1405
|
-
function
|
|
1426
|
+
function Qn(e, t) {
|
|
1406
1427
|
return e instanceof H ? e.appendData(t.data) : H.create(e).appendData(t.data);
|
|
1407
1428
|
}
|
|
1408
|
-
function
|
|
1429
|
+
function $n(e) {
|
|
1409
1430
|
C(typeof e.data == "string", "expected string output");
|
|
1410
1431
|
}
|
|
1411
|
-
function
|
|
1432
|
+
function er(e, t) {
|
|
1412
1433
|
let n = 0, r;
|
|
1413
1434
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1414
1435
|
let t = e[r];
|
|
@@ -1438,18 +1459,18 @@ function $n(e, t) {
|
|
|
1438
1459
|
}
|
|
1439
1460
|
//#endregion
|
|
1440
1461
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1441
|
-
function
|
|
1462
|
+
function tr(e, t) {
|
|
1442
1463
|
return xe(e * 1e3, t?.in);
|
|
1443
1464
|
}
|
|
1444
1465
|
//#endregion
|
|
1445
1466
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1446
|
-
var
|
|
1467
|
+
var nr = function(e, t) {
|
|
1447
1468
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1448
1469
|
}, U;
|
|
1449
1470
|
(function(e) {
|
|
1450
1471
|
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";
|
|
1451
1472
|
})(U ||= {});
|
|
1452
|
-
var
|
|
1473
|
+
var rr = class {
|
|
1453
1474
|
constructor() {
|
|
1454
1475
|
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 = {
|
|
1455
1476
|
http: 1,
|
|
@@ -1694,7 +1715,7 @@ var nr = class {
|
|
|
1694
1715
|
var r = this._buffer.charAt(1);
|
|
1695
1716
|
if (r != "[" && r != "]" && r != "(") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1696
1717
|
if (r == "[") {
|
|
1697
|
-
this._csi_regex ||=
|
|
1718
|
+
this._csi_regex ||= ir(or ||= nr(["\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 "]));
|
|
1698
1719
|
let t = this._buffer.match(this._csi_regex);
|
|
1699
1720
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1700
1721
|
if (t[4]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
@@ -1705,7 +1726,7 @@ var nr = class {
|
|
|
1705
1726
|
if (r == "]") {
|
|
1706
1727
|
if (t < 4) return e.kind = U.Incomplete, e;
|
|
1707
1728
|
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1708
|
-
this._osc_st ||=
|
|
1729
|
+
this._osc_st ||= ar(sr ||= nr(["\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;
|
|
1709
1730
|
{
|
|
1710
1731
|
let t = this._osc_st.exec(this._buffer);
|
|
1711
1732
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
@@ -1716,7 +1737,7 @@ var nr = class {
|
|
|
1716
1737
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1717
1738
|
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1718
1739
|
}
|
|
1719
|
-
this._osc_regex ||=
|
|
1740
|
+
this._osc_regex ||= ir(cr ||= nr(["\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 "]));
|
|
1720
1741
|
let n = this._buffer.match(this._osc_regex);
|
|
1721
1742
|
if (n === null) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1722
1743
|
e.kind = U.OSCURL, e.url = n[1], e.text = n[2];
|
|
@@ -1801,15 +1822,15 @@ var nr = class {
|
|
|
1801
1822
|
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>`;
|
|
1802
1823
|
}
|
|
1803
1824
|
};
|
|
1804
|
-
function
|
|
1825
|
+
function ir(e, ...t) {
|
|
1805
1826
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1806
1827
|
return new RegExp(n);
|
|
1807
1828
|
}
|
|
1808
|
-
function
|
|
1829
|
+
function ar(e, ...t) {
|
|
1809
1830
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1810
1831
|
return new RegExp(n, "g");
|
|
1811
1832
|
}
|
|
1812
|
-
var
|
|
1833
|
+
var or, sr, cr, lr = new rr();
|
|
1813
1834
|
function W(e) {
|
|
1814
1835
|
try {
|
|
1815
1836
|
let t = document.createElement("div");
|
|
@@ -1818,24 +1839,24 @@ function W(e) {
|
|
|
1818
1839
|
return t.error("Error parsing HTML content:", n), e;
|
|
1819
1840
|
}
|
|
1820
1841
|
}
|
|
1821
|
-
function
|
|
1842
|
+
function ur(e) {
|
|
1822
1843
|
if (!e) return "";
|
|
1823
1844
|
try {
|
|
1824
|
-
return W(
|
|
1845
|
+
return W(lr.ansi_to_html(e));
|
|
1825
1846
|
} catch (n) {
|
|
1826
1847
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1827
1848
|
}
|
|
1828
1849
|
}
|
|
1829
1850
|
//#endregion
|
|
1830
1851
|
//#region src/core/errors/traceback-atom.ts
|
|
1831
|
-
var
|
|
1852
|
+
var dr = x(null);
|
|
1832
1853
|
//#endregion
|
|
1833
1854
|
//#region src/core/cells/logs.ts
|
|
1834
|
-
function
|
|
1855
|
+
function fr(e) {
|
|
1835
1856
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1836
1857
|
}
|
|
1837
|
-
var
|
|
1838
|
-
function
|
|
1858
|
+
var pr = !1;
|
|
1859
|
+
function mr(e) {
|
|
1839
1860
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1840
1861
|
for (let r of n) {
|
|
1841
1862
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1860,9 +1881,9 @@ function pr(e) {
|
|
|
1860
1881
|
}
|
|
1861
1882
|
}
|
|
1862
1883
|
}
|
|
1863
|
-
if (t.forEach(
|
|
1884
|
+
if (t.forEach(hr.log), n.length === 0 && Dn(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1864
1885
|
e.output.data.forEach((t) => {
|
|
1865
|
-
|
|
1886
|
+
hr.log({
|
|
1866
1887
|
level: "stderr",
|
|
1867
1888
|
source: {
|
|
1868
1889
|
type: "cell",
|
|
@@ -1873,8 +1894,8 @@ function pr(e) {
|
|
|
1873
1894
|
});
|
|
1874
1895
|
});
|
|
1875
1896
|
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = y.get(ve) === "read";
|
|
1876
|
-
if (t.length > 0 && !
|
|
1877
|
-
|
|
1897
|
+
if (t.length > 0 && !pr && n) {
|
|
1898
|
+
pr = !0;
|
|
1878
1899
|
let e = t.find((e) => e.traceback);
|
|
1879
1900
|
o(e ? {
|
|
1880
1901
|
title: "An internal error occurred",
|
|
@@ -1883,7 +1904,7 @@ function pr(e) {
|
|
|
1883
1904
|
action: w.createElement(le, {
|
|
1884
1905
|
altText: "View traceback",
|
|
1885
1906
|
onClick: () => {
|
|
1886
|
-
y.set(
|
|
1907
|
+
y.set(dr, {
|
|
1887
1908
|
traceback: e.traceback,
|
|
1888
1909
|
errorMessage: e.msg || "An internal error occurred"
|
|
1889
1910
|
});
|
|
@@ -1898,13 +1919,13 @@ function pr(e) {
|
|
|
1898
1919
|
}
|
|
1899
1920
|
return t;
|
|
1900
1921
|
}
|
|
1901
|
-
var
|
|
1922
|
+
var hr = { log: (e) => {
|
|
1902
1923
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1903
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1924
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${gr(e.timestamp)}]`, `(${fr(e.source)}) ${e.message}`);
|
|
1904
1925
|
} };
|
|
1905
|
-
function
|
|
1926
|
+
function gr(e) {
|
|
1906
1927
|
try {
|
|
1907
|
-
return
|
|
1928
|
+
return tr(e).toLocaleTimeString(void 0, {
|
|
1908
1929
|
hour12: !0,
|
|
1909
1930
|
hour: "numeric",
|
|
1910
1931
|
minute: "numeric",
|
|
@@ -1914,26 +1935,26 @@ function hr(e) {
|
|
|
1914
1935
|
return "";
|
|
1915
1936
|
}
|
|
1916
1937
|
}
|
|
1917
|
-
var
|
|
1918
|
-
function
|
|
1938
|
+
var _r = /* @__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("."));
|
|
1939
|
+
function vr(e, t = !0) {
|
|
1919
1940
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
1920
1941
|
}
|
|
1921
|
-
function
|
|
1922
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
1942
|
+
function yr(e, t) {
|
|
1943
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !_r.has(e);
|
|
1923
1944
|
if (i(e)) return e;
|
|
1924
1945
|
let a = 1;
|
|
1925
1946
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
1926
1947
|
return r;
|
|
1927
1948
|
}
|
|
1928
|
-
function
|
|
1929
|
-
return
|
|
1949
|
+
function br(e, t) {
|
|
1950
|
+
return xr(e) ? `cell-${t}` : e;
|
|
1930
1951
|
}
|
|
1931
|
-
function
|
|
1952
|
+
function xr(e) {
|
|
1932
1953
|
return !e || e === "_" || e === "__";
|
|
1933
1954
|
}
|
|
1934
1955
|
//#endregion
|
|
1935
1956
|
//#region src/core/cells/types.ts
|
|
1936
|
-
function
|
|
1957
|
+
function Sr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
1937
1958
|
return {
|
|
1938
1959
|
id: e,
|
|
1939
1960
|
config: r || {
|
|
@@ -1946,7 +1967,7 @@ function xr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
1946
1967
|
code: n
|
|
1947
1968
|
};
|
|
1948
1969
|
}
|
|
1949
|
-
function
|
|
1970
|
+
function Cr(e) {
|
|
1950
1971
|
return {
|
|
1951
1972
|
hide_code: !1,
|
|
1952
1973
|
disabled: !1,
|
|
@@ -1955,7 +1976,7 @@ function Sr(e) {
|
|
|
1955
1976
|
...e
|
|
1956
1977
|
};
|
|
1957
1978
|
}
|
|
1958
|
-
function
|
|
1979
|
+
function wr(e) {
|
|
1959
1980
|
return {
|
|
1960
1981
|
embeddedConsole: [],
|
|
1961
1982
|
...e
|
|
@@ -1963,7 +1984,7 @@ function Cr(e) {
|
|
|
1963
1984
|
}
|
|
1964
1985
|
//#endregion
|
|
1965
1986
|
//#region src/core/cells/execution-console.ts
|
|
1966
|
-
function
|
|
1987
|
+
function Tr(e, t, n) {
|
|
1967
1988
|
let r = e.time === void 0 ? t : Date.parse(e.time) / 1e3, i = e.seq + 1;
|
|
1968
1989
|
switch (e.kind) {
|
|
1969
1990
|
case "console": return {
|
|
@@ -1992,24 +2013,27 @@ function wr(e, t, n) {
|
|
|
1992
2013
|
};
|
|
1993
2014
|
}
|
|
1994
2015
|
}
|
|
1995
|
-
function
|
|
2016
|
+
function Er(e, t) {
|
|
1996
2017
|
return {
|
|
2018
|
+
onOutput(e, t) {
|
|
2019
|
+
Bn.INSTANCE.trackOutput(e, t);
|
|
2020
|
+
},
|
|
1997
2021
|
onExecution(n, r) {
|
|
1998
|
-
|
|
2022
|
+
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
1999
2023
|
},
|
|
2000
2024
|
onItem(t, n, r) {
|
|
2001
|
-
let i = t.cell_id ?? "__scratch__", a = A(t), o =
|
|
2002
|
-
o.channel === "media" &&
|
|
2025
|
+
let i = t.cell_id ?? "__scratch__", a = A(t), o = Tr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2026
|
+
o.channel === "media" && Bn.INSTANCE.track({
|
|
2003
2027
|
cell_id: i,
|
|
2004
2028
|
output: o
|
|
2005
|
-
}), r && (n.kind === "console" || o.channel === "stderr") && e.addLogs({ logs:
|
|
2029
|
+
}), r && (n.kind === "console" || o.channel === "stderr") && e.addLogs({ logs: mr({
|
|
2006
2030
|
cell_id: i,
|
|
2007
2031
|
console: o
|
|
2008
2032
|
}) });
|
|
2009
2033
|
}
|
|
2010
2034
|
};
|
|
2011
2035
|
}
|
|
2012
|
-
function
|
|
2036
|
+
function Dr(e, t) {
|
|
2013
2037
|
let n = e(h);
|
|
2014
2038
|
if (!n) return;
|
|
2015
2039
|
let r = e(n.executionsAtom);
|
|
@@ -2017,12 +2041,12 @@ function Er(e, t) {
|
|
|
2017
2041
|
let i = r.latest.get(t);
|
|
2018
2042
|
return i === void 0 ? void 0 : r.executions.get(i);
|
|
2019
2043
|
}
|
|
2020
|
-
function
|
|
2044
|
+
function Or(e, t) {
|
|
2021
2045
|
let { local: n, execution: r, code: i } = e;
|
|
2022
2046
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2023
2047
|
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && A(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2024
2048
|
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;
|
|
2025
|
-
let t =
|
|
2049
|
+
let t = Tr(e, l, i);
|
|
2026
2050
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
2027
2051
|
}, d = n.commandConsole?.entries, f = r?.append;
|
|
2028
2052
|
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))) {
|
|
@@ -2031,7 +2055,7 @@ function Dr(e, t) {
|
|
|
2031
2055
|
...e,
|
|
2032
2056
|
rendered: {
|
|
2033
2057
|
serialization: n.serialization,
|
|
2034
|
-
consoleOutputs: r ?
|
|
2058
|
+
consoleOutputs: r ? qn([...i, r]) : i
|
|
2035
2059
|
}
|
|
2036
2060
|
};
|
|
2037
2061
|
}
|
|
@@ -2047,13 +2071,13 @@ function Dr(e, t) {
|
|
|
2047
2071
|
...e,
|
|
2048
2072
|
rendered: {
|
|
2049
2073
|
serialization: n.serialization,
|
|
2050
|
-
consoleOutputs:
|
|
2074
|
+
consoleOutputs: Jn(p)
|
|
2051
2075
|
}
|
|
2052
2076
|
};
|
|
2053
2077
|
}
|
|
2054
2078
|
//#endregion
|
|
2055
2079
|
//#region src/core/cells/columns.ts
|
|
2056
|
-
function
|
|
2080
|
+
function kr(e) {
|
|
2057
2081
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
2058
2082
|
for (let r of e.order) {
|
|
2059
2083
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -2061,9 +2085,9 @@ function Or(e) {
|
|
|
2061
2085
|
}
|
|
2062
2086
|
return t;
|
|
2063
2087
|
}
|
|
2064
|
-
function
|
|
2088
|
+
function Ar(e) {
|
|
2065
2089
|
let t = [[]];
|
|
2066
|
-
for (let [n, r] of
|
|
2090
|
+
for (let [n, r] of kr(e)) {
|
|
2067
2091
|
for (; t.length <= r;) t.push([]);
|
|
2068
2092
|
t[r].push(n);
|
|
2069
2093
|
}
|
|
@@ -2071,19 +2095,19 @@ function kr(e) {
|
|
|
2071
2095
|
}
|
|
2072
2096
|
//#endregion
|
|
2073
2097
|
//#region src/core/cells/layout.ts
|
|
2074
|
-
var
|
|
2075
|
-
function
|
|
2076
|
-
return `column-${
|
|
2098
|
+
var jr = x(/* @__PURE__ */ new Set()), Mr = x([]), Nr = x([]);
|
|
2099
|
+
function Pr() {
|
|
2100
|
+
return `column-${Fn.create()}`;
|
|
2077
2101
|
}
|
|
2078
|
-
var
|
|
2079
|
-
let r =
|
|
2102
|
+
var Fr = x(null, (e, t, n) => {
|
|
2103
|
+
let r = Ar(n).length, i = e(Mr);
|
|
2080
2104
|
if (i.length === r) return;
|
|
2081
|
-
let a = e(
|
|
2082
|
-
for (; o.length < r;) o.push(
|
|
2083
|
-
t(
|
|
2105
|
+
let a = e(Nr), o = [...i, ...a].slice(0, r);
|
|
2106
|
+
for (; o.length < r;) o.push(Pr());
|
|
2107
|
+
t(Mr, o), t(Nr, a.slice(Math.max(0, r - i.length)));
|
|
2084
2108
|
});
|
|
2085
|
-
function
|
|
2086
|
-
return [...(e === null ? [[]] :
|
|
2109
|
+
function Ir(e, t, n) {
|
|
2110
|
+
return [...(e === null ? [[]] : Ar(e)).map((e, n) => ({
|
|
2087
2111
|
id: t[n] ?? `column-${n}`,
|
|
2088
2112
|
ids: e
|
|
2089
2113
|
})), ...n.map((e) => ({
|
|
@@ -2091,7 +2115,7 @@ function Fr(e, t, n) {
|
|
|
2091
2115
|
ids: []
|
|
2092
2116
|
}))];
|
|
2093
2117
|
}
|
|
2094
|
-
function
|
|
2118
|
+
function Lr(e, t, n) {
|
|
2095
2119
|
let r = /* @__PURE__ */ new Map();
|
|
2096
2120
|
return e.forEach((i, a) => {
|
|
2097
2121
|
let o = t[a];
|
|
@@ -2100,9 +2124,9 @@ function Ir(e, t, n) {
|
|
|
2100
2124
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2101
2125
|
}), r;
|
|
2102
2126
|
}
|
|
2103
|
-
function
|
|
2127
|
+
function Rr(e, t, n) {
|
|
2104
2128
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
2105
|
-
let i =
|
|
2129
|
+
let i = Lr(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
2106
2130
|
return {
|
|
2107
2131
|
id: e,
|
|
2108
2132
|
ids: r,
|
|
@@ -2111,36 +2135,36 @@ function Lr(e, t, n) {
|
|
|
2111
2135
|
};
|
|
2112
2136
|
}) };
|
|
2113
2137
|
}
|
|
2114
|
-
var
|
|
2115
|
-
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(
|
|
2116
|
-
return
|
|
2117
|
-
}),
|
|
2118
|
-
function
|
|
2138
|
+
var zr = x((e) => {
|
|
2139
|
+
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(va);
|
|
2140
|
+
return Rr(Ir(n, e(Mr), e(Nr)), (e) => r[e] ?? null, e(jr));
|
|
2141
|
+
}), Br = () => v(zr), Vr = x((e) => e(zr).columns.length);
|
|
2142
|
+
function Hr(e, t) {
|
|
2119
2143
|
return e.columns.find((e) => e.id === t);
|
|
2120
2144
|
}
|
|
2121
|
-
function
|
|
2145
|
+
function Ur(e, t) {
|
|
2122
2146
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2123
2147
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
2124
2148
|
return n;
|
|
2125
2149
|
}
|
|
2126
|
-
function
|
|
2150
|
+
function Wr(e, t) {
|
|
2127
2151
|
for (let n of e.columns) {
|
|
2128
2152
|
let e = n.folds.get(t);
|
|
2129
2153
|
if (e !== void 0) return e;
|
|
2130
2154
|
}
|
|
2131
2155
|
}
|
|
2132
|
-
function
|
|
2156
|
+
function Gr(e, t) {
|
|
2133
2157
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2134
2158
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
2135
2159
|
}
|
|
2136
|
-
function
|
|
2137
|
-
let n =
|
|
2138
|
-
return
|
|
2160
|
+
function Kr(e, t) {
|
|
2161
|
+
let n = Gr(e, t);
|
|
2162
|
+
return Wr(e, t) === void 0 ? n : [...n, t];
|
|
2139
2163
|
}
|
|
2140
2164
|
//#endregion
|
|
2141
2165
|
//#region src/core/cells/document.ts
|
|
2142
|
-
function
|
|
2143
|
-
let n = t.code ?? e.code, r = g(e.config, t.config) ? e.config :
|
|
2166
|
+
function qr(e, t) {
|
|
2167
|
+
let n = t.code ?? e.code, r = g(e.config, t.config) ? e.config : Cr(t.config);
|
|
2144
2168
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
2145
2169
|
...e,
|
|
2146
2170
|
name: t.name,
|
|
@@ -2152,7 +2176,7 @@ function Kr(e, t) {
|
|
|
2152
2176
|
config: r
|
|
2153
2177
|
};
|
|
2154
2178
|
}
|
|
2155
|
-
function
|
|
2179
|
+
function Jr(e, t) {
|
|
2156
2180
|
let n = g(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
2157
2181
|
for (let o of n) {
|
|
2158
2182
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
@@ -2160,22 +2184,22 @@ function qr(e, t) {
|
|
|
2160
2184
|
if (s === void 0) {
|
|
2161
2185
|
r = {
|
|
2162
2186
|
...r,
|
|
2163
|
-
[o]:
|
|
2187
|
+
[o]: Sr({
|
|
2164
2188
|
id: o,
|
|
2165
2189
|
code: n.code ?? "",
|
|
2166
2190
|
name: n.name,
|
|
2167
|
-
config:
|
|
2191
|
+
config: Cr(n.config)
|
|
2168
2192
|
})
|
|
2169
2193
|
}, i = {
|
|
2170
2194
|
...i,
|
|
2171
|
-
[o]: i[o] ??
|
|
2195
|
+
[o]: i[o] ?? wr()
|
|
2172
2196
|
}, a = {
|
|
2173
2197
|
...a,
|
|
2174
2198
|
[o]: (0, w.createRef)()
|
|
2175
2199
|
};
|
|
2176
2200
|
continue;
|
|
2177
2201
|
}
|
|
2178
|
-
let c =
|
|
2202
|
+
let c = qr(s, n);
|
|
2179
2203
|
c !== s && (r = {
|
|
2180
2204
|
...r,
|
|
2181
2205
|
[o]: c
|
|
@@ -2194,21 +2218,21 @@ function qr(e, t) {
|
|
|
2194
2218
|
cellHandles: a
|
|
2195
2219
|
};
|
|
2196
2220
|
}
|
|
2197
|
-
function
|
|
2221
|
+
function Yr({ store: e, model: t, reconcile: n, signal: r }) {
|
|
2198
2222
|
let i = () => {
|
|
2199
2223
|
let r = e.get(t.documentAtom);
|
|
2200
|
-
r !== null && (n(r), e.set(
|
|
2224
|
+
r !== null && (n(r), e.set(Fr, r));
|
|
2201
2225
|
}, a = e.sub(t.documentAtom, i);
|
|
2202
2226
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
2203
2227
|
}
|
|
2204
|
-
async function
|
|
2228
|
+
async function Xr() {
|
|
2205
2229
|
let e = y.get(b);
|
|
2206
2230
|
e !== null && y.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
2207
2231
|
}
|
|
2208
2232
|
//#endregion
|
|
2209
2233
|
//#region src/core/cells/editor.ts
|
|
2210
2234
|
var G = x(/* @__PURE__ */ new Set());
|
|
2211
|
-
function
|
|
2235
|
+
function Zr(e, t, n) {
|
|
2212
2236
|
return !!e && !t.has(n);
|
|
2213
2237
|
}
|
|
2214
2238
|
x(null, (e, t, { cellId: n }) => {
|
|
@@ -2217,23 +2241,23 @@ x(null, (e, t, { cellId: n }) => {
|
|
|
2217
2241
|
let t = new Set(e);
|
|
2218
2242
|
return t.delete(n), t;
|
|
2219
2243
|
}), !0) : !1);
|
|
2220
|
-
var
|
|
2244
|
+
var Qr = x(/* @__PURE__ */ new Map());
|
|
2221
2245
|
x(null, (e, t, { cellId: n }) => {
|
|
2222
|
-
t(
|
|
2246
|
+
t(Qr, (e) => {
|
|
2223
2247
|
let t = new Map(e);
|
|
2224
2248
|
return t.delete(n), t;
|
|
2225
2249
|
});
|
|
2226
2250
|
});
|
|
2227
2251
|
//#endregion
|
|
2228
2252
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2229
|
-
function
|
|
2253
|
+
function $r(e, n) {
|
|
2230
2254
|
let r = document.getElementById(V.create(e));
|
|
2231
|
-
r ?
|
|
2255
|
+
r ? ti(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2232
2256
|
}
|
|
2233
|
-
function
|
|
2257
|
+
function ei() {
|
|
2234
2258
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2235
2259
|
}
|
|
2236
|
-
function
|
|
2260
|
+
function ti(e, n) {
|
|
2237
2261
|
try {
|
|
2238
2262
|
e.focus(n);
|
|
2239
2263
|
} catch {
|
|
@@ -2242,7 +2266,7 @@ function ei(e, n) {
|
|
|
2242
2266
|
}
|
|
2243
2267
|
//#endregion
|
|
2244
2268
|
//#region src/utils/timeout.ts
|
|
2245
|
-
function
|
|
2269
|
+
function ni(e, n) {
|
|
2246
2270
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
2247
2271
|
if (o < r) {
|
|
2248
2272
|
try {
|
|
@@ -2257,75 +2281,75 @@ function ti(e, n) {
|
|
|
2257
2281
|
}
|
|
2258
2282
|
//#endregion
|
|
2259
2283
|
//#region src/core/cells/utils.ts
|
|
2260
|
-
function
|
|
2284
|
+
function ri(e) {
|
|
2261
2285
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
2262
2286
|
}
|
|
2263
|
-
function
|
|
2287
|
+
function ii(e) {
|
|
2264
2288
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2265
2289
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
2266
2290
|
return r;
|
|
2267
2291
|
}
|
|
2268
|
-
function
|
|
2292
|
+
function ai(e) {
|
|
2269
2293
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2270
2294
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
2271
2295
|
return r;
|
|
2272
2296
|
}
|
|
2273
|
-
function
|
|
2297
|
+
function oi(e) {
|
|
2274
2298
|
return e.history.length > 0;
|
|
2275
2299
|
}
|
|
2276
|
-
function
|
|
2300
|
+
function si(e) {
|
|
2277
2301
|
let t = e.history[e.history.length - 1];
|
|
2278
2302
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2279
2303
|
}
|
|
2280
|
-
function
|
|
2281
|
-
return e.status === "idle" ?
|
|
2304
|
+
function ci(e, t, n) {
|
|
2305
|
+
return e.status === "idle" ? fi(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "interrupted" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
2282
2306
|
}
|
|
2283
|
-
function*
|
|
2307
|
+
function* li(e, t, n) {
|
|
2284
2308
|
for (let r of e.cellIds) {
|
|
2285
|
-
let i =
|
|
2286
|
-
o === null ? a.sourceChanged &&
|
|
2309
|
+
let i = Rt(t, r), a = n(r), o = ci(i, a, e.cellData[r]);
|
|
2310
|
+
o === null ? a.sourceChanged && di(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2287
2311
|
}
|
|
2288
2312
|
}
|
|
2289
|
-
function
|
|
2313
|
+
function ui(e, t, n) {
|
|
2290
2314
|
let r = null;
|
|
2291
|
-
for (let [, i] of
|
|
2315
|
+
for (let [, i] of li(e, t, n)) {
|
|
2292
2316
|
if (i !== "inputs") return i;
|
|
2293
2317
|
r = i;
|
|
2294
2318
|
}
|
|
2295
2319
|
return r;
|
|
2296
2320
|
}
|
|
2297
|
-
function
|
|
2321
|
+
function di(e, t) {
|
|
2298
2322
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
2299
2323
|
return r !== void 0 && r.state.status !== "completed";
|
|
2300
2324
|
}
|
|
2301
|
-
function
|
|
2325
|
+
function fi({ status: e, outcome: t, live: n }) {
|
|
2302
2326
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
2303
2327
|
}
|
|
2304
|
-
function
|
|
2328
|
+
function pi({ errored: e, stopped: t }) {
|
|
2305
2329
|
return {
|
|
2306
2330
|
published: !0,
|
|
2307
2331
|
"has-error": e,
|
|
2308
2332
|
stopped: t
|
|
2309
2333
|
};
|
|
2310
2334
|
}
|
|
2311
|
-
function
|
|
2312
|
-
let a =
|
|
2335
|
+
function mi({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
2336
|
+
let a = Dn(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
2313
2337
|
return (e || t || n || a) && !o;
|
|
2314
2338
|
}
|
|
2315
2339
|
//#endregion
|
|
2316
2340
|
//#region src/core/network/requests.ts
|
|
2317
|
-
var
|
|
2318
|
-
function
|
|
2319
|
-
let e = v(
|
|
2341
|
+
var hi = x(null);
|
|
2342
|
+
function gi() {
|
|
2343
|
+
let e = v(hi);
|
|
2320
2344
|
return C(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2321
2345
|
}
|
|
2322
|
-
function
|
|
2323
|
-
let e = y.get(
|
|
2346
|
+
function _i() {
|
|
2347
|
+
let e = y.get(hi);
|
|
2324
2348
|
return C(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2325
2349
|
}
|
|
2326
2350
|
//#endregion
|
|
2327
2351
|
//#region src/utils/storage/storage.ts
|
|
2328
|
-
var
|
|
2352
|
+
var vi = class {
|
|
2329
2353
|
store = /* @__PURE__ */ new Map();
|
|
2330
2354
|
get length() {
|
|
2331
2355
|
return this.store.size;
|
|
@@ -2346,16 +2370,16 @@ var _i = class {
|
|
|
2346
2370
|
this.store.set(e, t);
|
|
2347
2371
|
}
|
|
2348
2372
|
};
|
|
2349
|
-
function
|
|
2373
|
+
function yi() {
|
|
2350
2374
|
let { hasLocalStorage: e, hasSessionStorage: t } = Se();
|
|
2351
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2375
|
+
return e ? window.localStorage : t ? window.sessionStorage : new vi();
|
|
2352
2376
|
}
|
|
2353
|
-
var
|
|
2354
|
-
function
|
|
2355
|
-
return
|
|
2377
|
+
var bi = yi(), xi = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Si = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Ci = /^data:image\//i, wi = ["avatars.githubusercontent.com"];
|
|
2378
|
+
function Ti(e) {
|
|
2379
|
+
return Ci.test(e) ? [{
|
|
2356
2380
|
type: "image",
|
|
2357
2381
|
url: e
|
|
2358
|
-
}] : e.split(
|
|
2382
|
+
}] : e.split(xi).filter((e) => e !== "").map((e) => xi.test(e) ? Si.test(e) || Ci.test(e) || wi.some((t) => e.includes(t)) ? {
|
|
2359
2383
|
type: "image",
|
|
2360
2384
|
url: e
|
|
2361
2385
|
} : {
|
|
@@ -2368,48 +2392,48 @@ function wi(e) {
|
|
|
2368
2392
|
}
|
|
2369
2393
|
//#endregion
|
|
2370
2394
|
//#region src/utils/json/json-parser.ts
|
|
2371
|
-
var
|
|
2395
|
+
var Ei = new RegExp(xi.source, "g");
|
|
2372
2396
|
BigInt.prototype.toJSON = function() {
|
|
2373
2397
|
return JSON.rawJSON(this.toString());
|
|
2374
2398
|
};
|
|
2375
|
-
function
|
|
2399
|
+
function Di(e) {
|
|
2376
2400
|
try {
|
|
2377
|
-
return JSON.parse(e, (e, t) =>
|
|
2401
|
+
return JSON.parse(e, (e, t) => ji(t));
|
|
2378
2402
|
} catch {}
|
|
2379
2403
|
if (e == null || e === "") return {};
|
|
2380
2404
|
try {
|
|
2381
|
-
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 :
|
|
2405
|
+
return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : ji(t) : ji(t));
|
|
2382
2406
|
} catch {
|
|
2383
2407
|
return {};
|
|
2384
2408
|
}
|
|
2385
2409
|
}
|
|
2386
|
-
function
|
|
2410
|
+
function Oi(e) {
|
|
2387
2411
|
if (e.length === 0) return "";
|
|
2388
2412
|
let t = Object.keys(e[0]);
|
|
2389
2413
|
return [
|
|
2390
2414
|
`| ${t.join(" | ")} |`,
|
|
2391
2415
|
`|${t.map(() => "---").join("|")}|`,
|
|
2392
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2416
|
+
...e.map((e) => `| ${t.map((t) => ki(e[t])).join(" | ")} |`)
|
|
2393
2417
|
].join("\n");
|
|
2394
2418
|
}
|
|
2395
|
-
function
|
|
2419
|
+
function ki(e) {
|
|
2396
2420
|
if (e == null) return "";
|
|
2397
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2421
|
+
if (Array.isArray(e) || typeof e == "object") return Ai(JSON.stringify(e));
|
|
2398
2422
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2399
2423
|
t = t.replaceAll(n, (e) => {
|
|
2400
2424
|
let t = `__MDLINK_${i++}__`;
|
|
2401
2425
|
return r.set(t, e), t;
|
|
2402
|
-
}), t = t.replaceAll(
|
|
2426
|
+
}), t = t.replaceAll(Ei, "[$1]($1)");
|
|
2403
2427
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2404
|
-
return
|
|
2428
|
+
return Ai(t);
|
|
2405
2429
|
}
|
|
2406
|
-
function
|
|
2430
|
+
function Ai(e) {
|
|
2407
2431
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2408
2432
|
}
|
|
2409
|
-
function
|
|
2433
|
+
function ji(e) {
|
|
2410
2434
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2411
2435
|
}
|
|
2412
|
-
var
|
|
2436
|
+
var Mi = new class {
|
|
2413
2437
|
getFilename() {
|
|
2414
2438
|
return this.getSearchParam("filename");
|
|
2415
2439
|
}
|
|
@@ -2436,20 +2460,20 @@ var ji = new class {
|
|
|
2436
2460
|
}();
|
|
2437
2461
|
//#endregion
|
|
2438
2462
|
//#region src/core/dom/htmlUtils.ts
|
|
2439
|
-
function Mi(e) {
|
|
2440
|
-
return Ei(e ?? "");
|
|
2441
|
-
}
|
|
2442
2463
|
function Ni(e) {
|
|
2443
|
-
return
|
|
2464
|
+
return Di(e ?? "");
|
|
2444
2465
|
}
|
|
2445
|
-
function Pi(e
|
|
2446
|
-
|
|
2447
|
-
return n && t.has(n) ? t.lookupValue(n) : Mi(e.dataset.initialValue);
|
|
2466
|
+
function Pi(e) {
|
|
2467
|
+
return ue.mapValues(e.dataset, (e) => typeof e == "string" ? Ni(e) : e);
|
|
2448
2468
|
}
|
|
2449
|
-
function Fi() {
|
|
2469
|
+
function Fi(e, t) {
|
|
2470
|
+
let n = e.parentElement ? Ln.parse(e.parentElement) : void 0;
|
|
2471
|
+
return n && t.has(n) ? t.lookupValue(n) : Ni(e.dataset.initialValue);
|
|
2472
|
+
}
|
|
2473
|
+
function Ii() {
|
|
2450
2474
|
if (ne()) return document.title || null;
|
|
2451
2475
|
if (be()) {
|
|
2452
|
-
let e =
|
|
2476
|
+
let e = Mi.getFilename();
|
|
2453
2477
|
if (e) return e;
|
|
2454
2478
|
}
|
|
2455
2479
|
let e = document.querySelector("marimo-filename");
|
|
@@ -2459,16 +2483,16 @@ function Fi() {
|
|
|
2459
2483
|
}
|
|
2460
2484
|
//#endregion
|
|
2461
2485
|
//#region src/core/saving/file-state.ts
|
|
2462
|
-
var
|
|
2486
|
+
var Li = x(Ii());
|
|
2463
2487
|
x(null);
|
|
2464
|
-
var
|
|
2488
|
+
var Ri = x(null);
|
|
2465
2489
|
x(void 0);
|
|
2466
2490
|
//#endregion
|
|
2467
2491
|
//#region src/utils/storage/typed.ts
|
|
2468
|
-
var
|
|
2492
|
+
var zi = class {
|
|
2469
2493
|
defaultValue;
|
|
2470
2494
|
storage;
|
|
2471
|
-
constructor(e, t =
|
|
2495
|
+
constructor(e, t = bi) {
|
|
2472
2496
|
this.defaultValue = e, this.storage = t;
|
|
2473
2497
|
}
|
|
2474
2498
|
get(e) {
|
|
@@ -2485,11 +2509,11 @@ var Ri = class {
|
|
|
2485
2509
|
remove(e) {
|
|
2486
2510
|
this.storage.removeItem(e);
|
|
2487
2511
|
}
|
|
2488
|
-
},
|
|
2512
|
+
}, Bi = class {
|
|
2489
2513
|
schema;
|
|
2490
2514
|
getDefaultValue;
|
|
2491
2515
|
storage;
|
|
2492
|
-
constructor(e, t, n =
|
|
2516
|
+
constructor(e, t, n = bi) {
|
|
2493
2517
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2494
2518
|
}
|
|
2495
2519
|
get(e) {
|
|
@@ -2508,15 +2532,15 @@ var Ri = class {
|
|
|
2508
2532
|
remove(e) {
|
|
2509
2533
|
this.storage.removeItem(e);
|
|
2510
2534
|
}
|
|
2511
|
-
},
|
|
2535
|
+
}, Vi = class extends Bi {
|
|
2512
2536
|
filename;
|
|
2513
2537
|
unsubscribeFromFilename;
|
|
2514
2538
|
constructor(e, t, n) {
|
|
2515
|
-
let r = y.get(
|
|
2539
|
+
let r = y.get(Li);
|
|
2516
2540
|
super(t, n), this.filename = r;
|
|
2517
2541
|
try {
|
|
2518
|
-
this.unsubscribeFromFilename = y.sub(
|
|
2519
|
-
let t = y.get(
|
|
2542
|
+
this.unsubscribeFromFilename = y.sub(Li, () => {
|
|
2543
|
+
let t = y.get(Li);
|
|
2520
2544
|
this.handleFilenameChange(e, t);
|
|
2521
2545
|
});
|
|
2522
2546
|
} catch {
|
|
@@ -2574,7 +2598,7 @@ var Ri = class {
|
|
|
2574
2598
|
In: "in",
|
|
2575
2599
|
As: "as",
|
|
2576
2600
|
Import: "import"
|
|
2577
|
-
},
|
|
2601
|
+
}, Hi = /* @__PURE__ */ new Set([
|
|
2578
2602
|
K.FunctionDefinition,
|
|
2579
2603
|
K.LambdaExpression,
|
|
2580
2604
|
K.ArrayComprehensionExpression,
|
|
@@ -2586,13 +2610,13 @@ var Ri = class {
|
|
|
2586
2610
|
K.Comment, K.String, K.FormatString;
|
|
2587
2611
|
//#endregion
|
|
2588
2612
|
//#region src/core/codemirror/utils.ts
|
|
2589
|
-
function
|
|
2613
|
+
function Ui(e) {
|
|
2590
2614
|
e && e.dispatch({ selection: {
|
|
2591
2615
|
anchor: e.state.doc.length,
|
|
2592
2616
|
head: e.state.doc.length
|
|
2593
2617
|
} });
|
|
2594
2618
|
}
|
|
2595
|
-
function
|
|
2619
|
+
function Wi(e) {
|
|
2596
2620
|
let t = e.dom.closest(".marimo-cell");
|
|
2597
2621
|
t && requestAnimationFrame(() => {
|
|
2598
2622
|
t.scrollIntoView({
|
|
@@ -2604,8 +2628,8 @@ function Ui(e) {
|
|
|
2604
2628
|
}
|
|
2605
2629
|
//#endregion
|
|
2606
2630
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2607
|
-
var
|
|
2608
|
-
function
|
|
2631
|
+
var Gi = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
2632
|
+
function Ki(e, t) {
|
|
2609
2633
|
requestAnimationFrame(() => {
|
|
2610
2634
|
e.focus(), e.dispatch({
|
|
2611
2635
|
selection: {
|
|
@@ -2614,9 +2638,9 @@ function Gi(e, t) {
|
|
|
2614
2638
|
},
|
|
2615
2639
|
effects: pe.scrollIntoView(t, { y: "center" })
|
|
2616
2640
|
});
|
|
2617
|
-
}),
|
|
2641
|
+
}), Wi(e);
|
|
2618
2642
|
}
|
|
2619
|
-
function
|
|
2643
|
+
function qi(e, t) {
|
|
2620
2644
|
let n = me(e), r = null;
|
|
2621
2645
|
return n.iterate({ enter: (n) => {
|
|
2622
2646
|
if (r !== null) return !1;
|
|
@@ -2624,9 +2648,9 @@ function Ki(e, t) {
|
|
|
2624
2648
|
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
2625
2649
|
} }), r;
|
|
2626
2650
|
}
|
|
2627
|
-
function
|
|
2651
|
+
function Ji(e, t) {
|
|
2628
2652
|
let n = [], r = e.resolveInner(t, 0);
|
|
2629
|
-
for (; r;)
|
|
2653
|
+
for (; r;) Hi.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
2630
2654
|
id: r.from,
|
|
2631
2655
|
type: r.name
|
|
2632
2656
|
})), r = r.parent;
|
|
@@ -2641,12 +2665,12 @@ function J(e, t, n) {
|
|
|
2641
2665
|
from: n
|
|
2642
2666
|
});
|
|
2643
2667
|
}
|
|
2644
|
-
function
|
|
2668
|
+
function Yi(e, t) {
|
|
2645
2669
|
if (e.firstChild()) do
|
|
2646
2670
|
t(e.node);
|
|
2647
2671
|
while (e.nextSibling());
|
|
2648
2672
|
}
|
|
2649
|
-
function
|
|
2673
|
+
function Xi(e, t) {
|
|
2650
2674
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2651
2675
|
switch (e.name) {
|
|
2652
2676
|
case K.VariableName:
|
|
@@ -2657,13 +2681,13 @@ function Yi(e, t) {
|
|
|
2657
2681
|
let n = e.node.cursor();
|
|
2658
2682
|
n.firstChild();
|
|
2659
2683
|
do
|
|
2660
|
-
|
|
2684
|
+
Xi(n, t);
|
|
2661
2685
|
while (n.nextSibling());
|
|
2662
2686
|
break;
|
|
2663
2687
|
}
|
|
2664
2688
|
}
|
|
2665
2689
|
}
|
|
2666
|
-
function
|
|
2690
|
+
function Zi(e, t) {
|
|
2667
2691
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2668
2692
|
o.firstChild();
|
|
2669
2693
|
do {
|
|
@@ -2675,18 +2699,18 @@ function Xi(e, t) {
|
|
|
2675
2699
|
while (e.nextSibling());
|
|
2676
2700
|
} while (o.nextSibling());
|
|
2677
2701
|
}
|
|
2678
|
-
function
|
|
2702
|
+
function Qi(e, t) {
|
|
2679
2703
|
let n = e.cursor();
|
|
2680
2704
|
n.firstChild();
|
|
2681
2705
|
let r = !1;
|
|
2682
2706
|
do
|
|
2683
2707
|
if (n.name === q.For) r = !0;
|
|
2684
2708
|
else if (r && n.name === q.In) break;
|
|
2685
|
-
else r &&
|
|
2709
|
+
else r && Xi(n, t);
|
|
2686
2710
|
while (n.nextSibling());
|
|
2687
2711
|
}
|
|
2688
|
-
function
|
|
2689
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2712
|
+
function $i(e, t) {
|
|
2713
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Hi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2690
2714
|
switch (s) {
|
|
2691
2715
|
case K.FunctionDefinition:
|
|
2692
2716
|
case K.ClassDefinition: {
|
|
@@ -2698,7 +2722,7 @@ function Qi(e, t) {
|
|
|
2698
2722
|
break;
|
|
2699
2723
|
}
|
|
2700
2724
|
while (t.nextSibling());
|
|
2701
|
-
s === K.FunctionDefinition &&
|
|
2725
|
+
s === K.FunctionDefinition && Zi(e, {
|
|
2702
2726
|
state: n,
|
|
2703
2727
|
variableName: r,
|
|
2704
2728
|
scopeId: c,
|
|
@@ -2707,7 +2731,7 @@ function Qi(e, t) {
|
|
|
2707
2731
|
break;
|
|
2708
2732
|
}
|
|
2709
2733
|
case K.LambdaExpression:
|
|
2710
|
-
|
|
2734
|
+
Zi(e, {
|
|
2711
2735
|
state: n,
|
|
2712
2736
|
variableName: r,
|
|
2713
2737
|
scopeId: c,
|
|
@@ -2719,7 +2743,7 @@ function Qi(e, t) {
|
|
|
2719
2743
|
case K.SetComprehensionExpression:
|
|
2720
2744
|
case K.ComprehensionExpression:
|
|
2721
2745
|
case K.ForStatement:
|
|
2722
|
-
|
|
2746
|
+
Qi(e, {
|
|
2723
2747
|
state: n,
|
|
2724
2748
|
variableName: r,
|
|
2725
2749
|
scopeId: u,
|
|
@@ -2737,7 +2761,7 @@ function Qi(e, t) {
|
|
|
2737
2761
|
let s = e.cursor();
|
|
2738
2762
|
s.firstChild();
|
|
2739
2763
|
do
|
|
2740
|
-
s.from < o &&
|
|
2764
|
+
s.from < o && Xi(s, {
|
|
2741
2765
|
state: n,
|
|
2742
2766
|
variableName: r,
|
|
2743
2767
|
scopeId: u,
|
|
@@ -2772,8 +2796,8 @@ function Qi(e, t) {
|
|
|
2772
2796
|
break;
|
|
2773
2797
|
}
|
|
2774
2798
|
}
|
|
2775
|
-
|
|
2776
|
-
|
|
2799
|
+
Yi(o, (e) => {
|
|
2800
|
+
$i(e, {
|
|
2777
2801
|
state: n,
|
|
2778
2802
|
variableName: r,
|
|
2779
2803
|
scopeStack: l,
|
|
@@ -2781,27 +2805,27 @@ function Qi(e, t) {
|
|
|
2781
2805
|
});
|
|
2782
2806
|
});
|
|
2783
2807
|
}
|
|
2784
|
-
function
|
|
2808
|
+
function ea(e, t, n) {
|
|
2785
2809
|
let r = me(e), i = [];
|
|
2786
|
-
|
|
2810
|
+
$i(r, {
|
|
2787
2811
|
state: e,
|
|
2788
2812
|
variableName: t,
|
|
2789
2813
|
scopeStack: [],
|
|
2790
2814
|
declarations: i
|
|
2791
2815
|
});
|
|
2792
2816
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2793
|
-
for (let e of
|
|
2794
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2817
|
+
for (let e of Ji(r, a)) {
|
|
2818
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Gi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2795
2819
|
if (t) return t.from;
|
|
2796
2820
|
}
|
|
2797
2821
|
return null;
|
|
2798
2822
|
}
|
|
2799
|
-
function
|
|
2800
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2801
|
-
return i !== null && (
|
|
2823
|
+
function ta(e, t, n) {
|
|
2824
|
+
let { state: r } = e, i = n === void 0 ? qi(r, t) : ea(r, t, n);
|
|
2825
|
+
return i !== null && (Ki(e, i), !0);
|
|
2802
2826
|
}
|
|
2803
|
-
function
|
|
2804
|
-
return
|
|
2827
|
+
function na(e, t) {
|
|
2828
|
+
return Ki(e, e.state.doc.line(t).from), !0;
|
|
2805
2829
|
}
|
|
2806
2830
|
//#endregion
|
|
2807
2831
|
//#region src/core/network/connection.ts
|
|
@@ -2810,11 +2834,11 @@ p(null, (e, t) => t === null ? null : {
|
|
|
2810
2834
|
phase: t.phase,
|
|
2811
2835
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2812
2836
|
});
|
|
2813
|
-
function
|
|
2837
|
+
function ra() {
|
|
2814
2838
|
return se(Y, (e) => e.state === O.OPEN);
|
|
2815
2839
|
}
|
|
2816
|
-
function
|
|
2817
|
-
return _e() ?
|
|
2840
|
+
function ia() {
|
|
2841
|
+
return _e() ? ra() : Promise.resolve();
|
|
2818
2842
|
}
|
|
2819
2843
|
x((e) => e(Y).state === O.CONNECTING), x((e) => e(Y).state === O.OPEN), x((e) => {
|
|
2820
2844
|
let t = e(Y);
|
|
@@ -2822,8 +2846,8 @@ x((e) => e(Y).state === O.CONNECTING), x((e) => e(Y).state === O.OPEN), x((e) =>
|
|
|
2822
2846
|
}), x((e) => e(Y).state === O.CLOSED);
|
|
2823
2847
|
//#endregion
|
|
2824
2848
|
//#region src/components/ui/checkbox.tsx
|
|
2825
|
-
var
|
|
2826
|
-
let r = (0,
|
|
2849
|
+
var aa = w.forwardRef((e, t) => {
|
|
2850
|
+
let r = (0, _n.c)(13), i, a;
|
|
2827
2851
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2828
2852
|
let o;
|
|
2829
2853
|
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);
|
|
@@ -2842,25 +2866,25 @@ var ia = w.forwardRef((e, t) => {
|
|
|
2842
2866
|
children: c
|
|
2843
2867
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2844
2868
|
});
|
|
2845
|
-
|
|
2869
|
+
aa.displayName = Pe.displayName;
|
|
2846
2870
|
//#endregion
|
|
2847
2871
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2848
|
-
function
|
|
2872
|
+
function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2849
2873
|
if (!n) return;
|
|
2850
2874
|
let o = document.getElementById(V.create(e));
|
|
2851
2875
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2852
|
-
else if (
|
|
2876
|
+
else if (ei()) ti(o);
|
|
2853
2877
|
else {
|
|
2854
|
-
if (r)
|
|
2878
|
+
if (r) ti(o);
|
|
2855
2879
|
else {
|
|
2856
|
-
|
|
2880
|
+
wn.promote(e);
|
|
2857
2881
|
let r = n.current?.editorView;
|
|
2858
2882
|
if (!r) {
|
|
2859
2883
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2860
2884
|
return;
|
|
2861
2885
|
}
|
|
2862
2886
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2863
|
-
if (
|
|
2887
|
+
if (ni(() => (r.focus(), r.hasFocus), {
|
|
2864
2888
|
retries: 5,
|
|
2865
2889
|
delay: 20
|
|
2866
2890
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2873,7 +2897,7 @@ function aa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2873
2897
|
anchor: e.from,
|
|
2874
2898
|
head: e.from
|
|
2875
2899
|
} });
|
|
2876
|
-
} else a &&
|
|
2900
|
+
} else a && ta(r, a);
|
|
2877
2901
|
}
|
|
2878
2902
|
o.scrollIntoView({
|
|
2879
2903
|
behavior: "smooth",
|
|
@@ -2881,20 +2905,20 @@ function aa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2881
2905
|
});
|
|
2882
2906
|
}
|
|
2883
2907
|
}
|
|
2884
|
-
function
|
|
2908
|
+
function sa() {
|
|
2885
2909
|
let e = document.getElementById("App");
|
|
2886
2910
|
e?.scrollTo({
|
|
2887
2911
|
top: e.scrollHeight,
|
|
2888
2912
|
behavior: "smooth"
|
|
2889
2913
|
});
|
|
2890
2914
|
}
|
|
2891
|
-
function
|
|
2915
|
+
function ca() {
|
|
2892
2916
|
document.getElementById("App")?.scrollTo({
|
|
2893
2917
|
top: 0,
|
|
2894
2918
|
behavior: "smooth"
|
|
2895
2919
|
});
|
|
2896
2920
|
}
|
|
2897
|
-
function
|
|
2921
|
+
function la(e) {
|
|
2898
2922
|
let t = document.getElementById(V.create(e));
|
|
2899
2923
|
return t?.scrollIntoView({
|
|
2900
2924
|
behavior: "smooth",
|
|
@@ -2903,7 +2927,7 @@ function ca(e) {
|
|
|
2903
2927
|
}
|
|
2904
2928
|
//#endregion
|
|
2905
2929
|
//#region src/core/cells/cells.ts
|
|
2906
|
-
function
|
|
2930
|
+
function ua(e) {
|
|
2907
2931
|
let t = {
|
|
2908
2932
|
column: 0,
|
|
2909
2933
|
hide_code: !1,
|
|
@@ -2913,14 +2937,14 @@ function la(e) {
|
|
|
2913
2937
|
return {
|
|
2914
2938
|
...e,
|
|
2915
2939
|
cellData: {
|
|
2916
|
-
[B]:
|
|
2940
|
+
[B]: Sr({
|
|
2917
2941
|
id: B,
|
|
2918
2942
|
config: t
|
|
2919
2943
|
}),
|
|
2920
2944
|
...e.cellData
|
|
2921
2945
|
},
|
|
2922
2946
|
cellRuntime: {
|
|
2923
|
-
[B]:
|
|
2947
|
+
[B]: wr(),
|
|
2924
2948
|
...e.cellRuntime
|
|
2925
2949
|
},
|
|
2926
2950
|
cellHandles: {
|
|
@@ -2929,8 +2953,8 @@ function la(e) {
|
|
|
2929
2953
|
}
|
|
2930
2954
|
};
|
|
2931
2955
|
}
|
|
2932
|
-
function
|
|
2933
|
-
return
|
|
2956
|
+
function da() {
|
|
2957
|
+
return ua({
|
|
2934
2958
|
cellIds: [],
|
|
2935
2959
|
cellData: {},
|
|
2936
2960
|
cellRuntime: {},
|
|
@@ -2940,7 +2964,7 @@ function ua() {
|
|
|
2940
2964
|
cellLogs: []
|
|
2941
2965
|
});
|
|
2942
2966
|
}
|
|
2943
|
-
var { reducer:
|
|
2967
|
+
var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
2944
2968
|
setCellReusability: (e, t) => Z({
|
|
2945
2969
|
state: e,
|
|
2946
2970
|
cellId: t.cell_id,
|
|
@@ -2966,12 +2990,12 @@ var { reducer: da, createActions: fa, useActions: pa, valueAtom: X } = fe(ua, {
|
|
|
2966
2990
|
cellId: n,
|
|
2967
2991
|
cellReducer: (e) => ({
|
|
2968
2992
|
...e,
|
|
2969
|
-
commandConsole:
|
|
2993
|
+
commandConsole: On(e.commandConsole, t, e.clearedCommandIds?.[t.op])
|
|
2970
2994
|
})
|
|
2971
2995
|
});
|
|
2972
2996
|
return i || t.op === "pdb-output" ? a : {
|
|
2973
2997
|
...a,
|
|
2974
|
-
cellLogs: [...a.cellLogs, ...
|
|
2998
|
+
cellLogs: [...a.cellLogs, ...mr({
|
|
2975
2999
|
cell_id: n,
|
|
2976
3000
|
console: r
|
|
2977
3001
|
})]
|
|
@@ -2997,7 +3021,7 @@ var { reducer: da, createActions: fa, useActions: pa, valueAtom: X } = fe(ua, {
|
|
|
2997
3021
|
let n = t[e];
|
|
2998
3022
|
n.commandConsole?.entries.some((e) => e.source === "pdb-output") && (t[e] = {
|
|
2999
3023
|
...n,
|
|
3000
|
-
commandConsole:
|
|
3024
|
+
commandConsole: On(n.commandConsole, {
|
|
3001
3025
|
op: "pdb-output",
|
|
3002
3026
|
cell_id: e,
|
|
3003
3027
|
entries: [],
|
|
@@ -3015,8 +3039,8 @@ var { reducer: da, createActions: fa, useActions: pa, valueAtom: X } = fe(ua, {
|
|
|
3015
3039
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
3016
3040
|
}),
|
|
3017
3041
|
reconcileDocument: (e, t) => {
|
|
3018
|
-
let n =
|
|
3019
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3042
|
+
let n = Jr(e, t);
|
|
3043
|
+
for (let t of e.cellIds) t in n.cellData || ka(t);
|
|
3020
3044
|
return n;
|
|
3021
3045
|
},
|
|
3022
3046
|
setStdinResponse: (e, t) => {
|
|
@@ -3034,7 +3058,7 @@ var { reducer: da, createActions: fa, useActions: pa, valueAtom: X } = fe(ua, {
|
|
|
3034
3058
|
let n = be(), r = { ...e.cellRuntime };
|
|
3035
3059
|
for (let i of [...e.cellIds, B]) {
|
|
3036
3060
|
let a = e.cellRuntime[i];
|
|
3037
|
-
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a :
|
|
3061
|
+
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : wr({
|
|
3038
3062
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
3039
3063
|
clearedCommandIds: t ? a?.clearedCommandIds : void 0
|
|
3040
3064
|
});
|
|
@@ -3048,10 +3072,10 @@ var { reducer: da, createActions: fa, useActions: pa, valueAtom: X } = fe(ua, {
|
|
|
3048
3072
|
let t = e.scrollKey;
|
|
3049
3073
|
if (t === null) return e;
|
|
3050
3074
|
let n = t;
|
|
3051
|
-
return
|
|
3075
|
+
return oa({
|
|
3052
3076
|
cellId: n,
|
|
3053
3077
|
cell: e.cellHandles[n],
|
|
3054
|
-
isCodeHidden:
|
|
3078
|
+
isCodeHidden: Zr(e.cellData[n]?.config.hide_code, y.get(G), n),
|
|
3055
3079
|
codeFocus: void 0,
|
|
3056
3080
|
variableName: void 0
|
|
3057
3081
|
}), {
|
|
@@ -3059,8 +3083,8 @@ var { reducer: da, createActions: fa, useActions: pa, valueAtom: X } = fe(ua, {
|
|
|
3059
3083
|
scrollKey: null
|
|
3060
3084
|
};
|
|
3061
3085
|
},
|
|
3062
|
-
foldAll: (e) => (
|
|
3063
|
-
unfoldAll: (e) => (
|
|
3086
|
+
foldAll: (e) => (yn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3087
|
+
unfoldAll: (e) => (bn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3064
3088
|
clearLogs: (e) => ({
|
|
3065
3089
|
...e,
|
|
3066
3090
|
cellLogs: []
|
|
@@ -3090,17 +3114,17 @@ function Z({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3090
3114
|
}
|
|
3091
3115
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3092
3116
|
}
|
|
3093
|
-
var
|
|
3094
|
-
y.set(X, (t) =>
|
|
3117
|
+
var ha = pa((e) => {
|
|
3118
|
+
y.set(X, (t) => fa(t, e));
|
|
3095
3119
|
}).addLogs, Q = x((e) => e(X).cellIds);
|
|
3096
|
-
x((e) => e(Q).length === 1), x((e) =>
|
|
3097
|
-
var
|
|
3098
|
-
x((e) => e(
|
|
3099
|
-
var
|
|
3120
|
+
x((e) => e(Q).length === 1), x((e) => ii(e(X)).length > 0), x((e) => ai(e(X)).length > 0), x((e) => oi(e(X))), x((e) => si(e(X)));
|
|
3121
|
+
var ga = x((e) => ui(e(X), e(R), e(tn)));
|
|
3122
|
+
x((e) => e(ga) !== null);
|
|
3123
|
+
var _a = x((e) => {
|
|
3100
3124
|
let { cellIds: t, cellData: n } = e(X);
|
|
3101
3125
|
return t.map((t) => {
|
|
3102
3126
|
let r = e(z(t)), { name: i } = n[t];
|
|
3103
|
-
if (r !== null &&
|
|
3127
|
+
if (r !== null && Dn(r.mimetype)) {
|
|
3104
3128
|
C(Array.isArray(r.data), "Expected array data");
|
|
3105
3129
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
3106
3130
|
if (e.length > 0) return {
|
|
@@ -3114,103 +3138,103 @@ var ga = x((e) => {
|
|
|
3114
3138
|
}
|
|
3115
3139
|
return null;
|
|
3116
3140
|
}).filter(Boolean);
|
|
3117
|
-
}),
|
|
3141
|
+
}), va = ce(x((e) => {
|
|
3118
3142
|
let t = {};
|
|
3119
3143
|
for (let n of e(Q)) {
|
|
3120
|
-
let r = e(
|
|
3144
|
+
let r = e(sn(n));
|
|
3121
3145
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3122
3146
|
}
|
|
3123
3147
|
return t;
|
|
3124
|
-
})),
|
|
3125
|
-
x((e) => e(
|
|
3126
|
-
var
|
|
3148
|
+
})), ya = x((e) => Je(e(Q).map((t) => e(sn(t)))));
|
|
3149
|
+
x((e) => e(_a).length);
|
|
3150
|
+
var ba = ce(x((e) => {
|
|
3127
3151
|
let { cellIds: t, cellData: n } = e(X);
|
|
3128
3152
|
return ue.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3129
3153
|
}));
|
|
3130
3154
|
x((e) => e(X).scrollKey);
|
|
3131
|
-
var
|
|
3155
|
+
var xa = () => v(Q), Sa = () => v(ba), Ca = () => y.get(X), wa = () => y.get(X).cellIds, Ta = () => {
|
|
3132
3156
|
let { cellIds: e, cellData: t } = y.get(X);
|
|
3133
3157
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3134
3158
|
};
|
|
3135
3159
|
ee(_(X, (e) => e.cellIds.map((t) => e.cellData[t]))), x((e) => e(X).cellIds.length > 0);
|
|
3136
|
-
var
|
|
3160
|
+
var Ea = S((e) => x((t) => t(X).cellData[e])), Da = wr(), $ = S((e) => {
|
|
3137
3161
|
let t = x((t) => {
|
|
3138
|
-
let n =
|
|
3162
|
+
let n = Dr(t, e), r = t(m)?.cells;
|
|
3139
3163
|
return {
|
|
3140
|
-
local: t(X).cellRuntime[e] ??
|
|
3164
|
+
local: t(X).cellRuntime[e] ?? Da,
|
|
3141
3165
|
execution: n,
|
|
3142
|
-
code: n &&
|
|
3166
|
+
code: n && Tt(n.record, r)
|
|
3143
3167
|
};
|
|
3144
|
-
}), n = _(t,
|
|
3168
|
+
}), n = _(t, Or);
|
|
3145
3169
|
return x((e) => e(n).rendered);
|
|
3146
|
-
}),
|
|
3147
|
-
function
|
|
3148
|
-
|
|
3170
|
+
}), Oa = S((e) => x((t) => t(X).cellHandles[e]));
|
|
3171
|
+
function ka(e) {
|
|
3172
|
+
Ea.remove(e), $.remove(e), Oa.remove(e), cn(e);
|
|
3149
3173
|
}
|
|
3150
|
-
var
|
|
3174
|
+
var Aa = (e) => {
|
|
3151
3175
|
let { cellHandles: t } = y.get(X);
|
|
3152
3176
|
return t[e].current?.editorView;
|
|
3153
|
-
},
|
|
3177
|
+
}, ja = (e) => (wn.promote(e), Aa(e));
|
|
3154
3178
|
x((e) => e(Q).map((t) => ({
|
|
3155
|
-
...e(
|
|
3179
|
+
...e(Ea(t)),
|
|
3156
3180
|
...e($(t)),
|
|
3157
3181
|
output: e(z(t))
|
|
3158
3182
|
})));
|
|
3159
|
-
function
|
|
3160
|
-
return
|
|
3183
|
+
function Ma() {
|
|
3184
|
+
return ma();
|
|
3161
3185
|
}
|
|
3162
3186
|
//#endregion
|
|
3163
3187
|
//#region src/core/errors/error-entries.ts
|
|
3164
|
-
function
|
|
3165
|
-
if (
|
|
3188
|
+
function Na(e) {
|
|
3189
|
+
if (Tn(e.mimetype)) {
|
|
3166
3190
|
if (!Array.isArray(e.data)) return null;
|
|
3167
3191
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
3168
3192
|
return t.length === 0 ? null : { errorData: t };
|
|
3169
3193
|
}
|
|
3170
|
-
return
|
|
3194
|
+
return En(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
3171
3195
|
errorData: [],
|
|
3172
3196
|
tracebackHtml: e.data
|
|
3173
3197
|
} : null;
|
|
3174
3198
|
}
|
|
3175
|
-
function
|
|
3199
|
+
function Pa(e) {
|
|
3176
3200
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3177
3201
|
}
|
|
3178
|
-
function
|
|
3179
|
-
let t = e?.find((e) =>
|
|
3202
|
+
function Fa(e) {
|
|
3203
|
+
let t = e?.find((e) => En(e.mimetype));
|
|
3180
3204
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3181
3205
|
}
|
|
3182
|
-
function
|
|
3206
|
+
function Ia(e, t) {
|
|
3183
3207
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3184
|
-
if (!
|
|
3208
|
+
if (!Pa(e.errorData)) return Fa(t);
|
|
3185
3209
|
}
|
|
3186
|
-
function
|
|
3210
|
+
function La(e) {
|
|
3187
3211
|
let { cellIds: t, cellData: n } = e.get(X), r = [];
|
|
3188
3212
|
for (let [i, a] of t.entries()) {
|
|
3189
3213
|
let t = e.get(z(a));
|
|
3190
|
-
if (t === null || !
|
|
3191
|
-
let o =
|
|
3214
|
+
if (t === null || !Dn(t.mimetype)) continue;
|
|
3215
|
+
let o = Na(t);
|
|
3192
3216
|
if (!o) continue;
|
|
3193
|
-
let s =
|
|
3217
|
+
let s = br(n[a].name, i), c = t.code ?? n[a].code;
|
|
3194
3218
|
r.push({
|
|
3195
3219
|
cellId: a,
|
|
3196
3220
|
cellName: s,
|
|
3197
3221
|
cellCode: c,
|
|
3198
3222
|
errorData: o.errorData,
|
|
3199
|
-
tracebackHtml:
|
|
3223
|
+
tracebackHtml: Ia(o, e.get($(a)).consoleOutputs)
|
|
3200
3224
|
});
|
|
3201
3225
|
}
|
|
3202
3226
|
return r;
|
|
3203
3227
|
}
|
|
3204
|
-
function
|
|
3228
|
+
function Ra(e) {
|
|
3205
3229
|
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");
|
|
3206
3230
|
}
|
|
3207
|
-
function
|
|
3208
|
-
let t =
|
|
3231
|
+
function za(e) {
|
|
3232
|
+
let t = Ra(e);
|
|
3209
3233
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
3210
3234
|
}
|
|
3211
|
-
function
|
|
3235
|
+
function Ba(e) {
|
|
3212
3236
|
let t = [e.cellName];
|
|
3213
|
-
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
3237
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(za).join("\n\n")), t.join("\n\n");
|
|
3214
3238
|
}
|
|
3215
3239
|
//#endregion
|
|
3216
|
-
export {
|
|
3240
|
+
export { Zr as $, Qe as $t, ia as A, V as At, Fi as B, sn as Bt, oa as C, mr as Ct, aa as D, Bn as Dt, ca as E, rr as Et, Bi as F, kn as Ft, _i as G, pn as Gt, Oi as H, an as Ht, Li as I, An as It, fi as J, fn as Jt, hi as K, un as Kt, Ri as L, hn as Lt, Ui as M, Pn as Mt, Vi as N, Ln as Nt, Y as O, Fn as Ot, zi as P, In as Pt, $r as Q, dt as Qt, Ni as R, R as Rt, Ma as S, vr as St, la as T, W as Tt, Ti as U, ln as Ut, Di as V, z as Vt, bi as W, Qt as Wt, pi as X, Rt as Xt, ri as Y, mn as Yt, mi as Z, ft as Zt, ya as _, Dr as _t, ha as a, Ce as an, Mr as at, xa as b, yr as bt, $ as c, Hr as ct, Aa as d, Gr as dt, O as en, Qr as et, Ta as f, zr as ft, X as g, kr as gt, da as h, Br as ht, La as i, we as in, jr as it, na as j, B as jt, ra as k, Rn as kt, pa as l, Wr as lt, Ca as m, Vr as mt, Ba as n, qe as nn, Xr as nt, Ea as o, Ur as ot, wa as p, Pr as pt, gi as q, gn as qt, za as r, He as rn, Yr as rt, Q as s, Nr as st, Ra as t, Xe as tn, G as tt, ja as u, Kr as ut, fa as v, Er as vt, sa as w, ur as wt, Sa as x, xr as xt, ka as y, br as yt, Pi as z, tn as zt };
|