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