@marimo-team/islands 0.25.3-dev48 → 0.25.3-dev51

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.
Files changed (89) hide show
  1. package/dist/{ConnectedDataExplorerComponent-COS3f8io.js → ConnectedDataExplorerComponent-Da5OoEUL.js} +9 -9
  2. package/dist/{ErrorBoundary-DHfwqB0K.js → ErrorBoundary-CbxCC2kk.js} +8 -8
  3. package/dist/{abnfDiagram-VCTEODGH-DQ4bKxYa.js → abnfDiagram-VCTEODGH-Bz3mrprX.js} +2 -2
  4. package/dist/{any-language-editor-DQItQSua.js → any-language-editor-k2B8YI3Y.js} +2 -2
  5. package/dist/{architectureDiagram-5GKGNRK7-BA7-SI7Q.js → architectureDiagram-5GKGNRK7-Cs5ujb9K.js} +1 -1
  6. package/dist/{chat-ui-DlUp75HS.js → chat-ui-C1Gjgokv.js} +44 -44
  7. package/dist/{check-C209OH-W.js → check-P35dc2dH.js} +1 -1
  8. package/dist/{chunk-IMKFNOWR-DPY3kqOV.js → chunk-IMKFNOWR-CcTSaxZt.js} +1 -1
  9. package/dist/{chunk-SHT3W25Y-C14Ikodf.js → chunk-SHT3W25Y-DcJcjOaO.js} +1 -1
  10. package/dist/{chunk-SVP7TREG-BKu0HO4I.js → chunk-SVP7TREG-BVtDTjaF.js} +1 -1
  11. package/dist/{chunk-TICWLB2K-iJDDWGtE.js → chunk-TICWLB2K-BkDFkh8q.js} +1 -1
  12. package/dist/{classDiagram-ZZMXUADV-HuJXQI0F.js → classDiagram-ZZMXUADV-CfAt7HT5.js} +2 -2
  13. package/dist/{classDiagram-v2-VYDZK3BY-CpmmpTbC.js → classDiagram-v2-VYDZK3BY-CGEjNYa2.js} +2 -2
  14. package/dist/{code-visibility-5llx6KCK.js → code-visibility-DoZ9lxzx.js} +5 -5
  15. package/dist/{common-DBC1NAar.js → common-D1PacyXO.js} +75 -75
  16. package/dist/{copy-icon-L-mFk59e.js → copy-icon-CPoxUG7G.js} +2 -2
  17. package/dist/{cynefinDiagram-5FMLGOSQ-uh0puAW2.js → cynefinDiagram-5FMLGOSQ-BW6NmfJi.js} +1 -1
  18. package/dist/{dagre-GXQ25YYZ-4LBeAAMz.js → dagre-GXQ25YYZ-CWg3CTuF.js} +1 -1
  19. package/dist/{data-grid-overlay-editor-D01HzlXg.js → data-grid-overlay-editor-B50UpkXd.js} +1 -1
  20. package/dist/{diagram-S7CK7UJ4-BXPmZ2sX.js → diagram-S7CK7UJ4-BPxtoS-z.js} +1 -1
  21. package/dist/{diagram-UQ7AKVKN--Xz9UNpC.js → diagram-UQ7AKVKN-DA-vJdFL.js} +1 -1
  22. package/dist/{diagram-VX7I27RA-rt8VIRNT.js → diagram-VX7I27RA-D6bkR84S.js} +1 -1
  23. package/dist/{diagram-Z3DM3KII-Cs1GqfDD.js → diagram-Z3DM3KII-m60g4cAT.js} +1 -1
  24. package/dist/{dialog-CDbPtWUD.js → dialog-C1PcpCqX.js} +24 -24
  25. package/dist/{dropdown-menu-ugNoZmKx.js → dropdown-menu-MG5hiCIa.js} +793 -793
  26. package/dist/{ebnfDiagram-PWID7BFC-CgTsgbmZ.js → ebnfDiagram-PWID7BFC-CK99sho2.js} +2 -2
  27. package/dist/{erDiagram-RLTQ6QDP-CFoADGzT.js → erDiagram-RLTQ6QDP-Bryq0tdE.js} +1 -1
  28. package/dist/{error-banner-DMIrHA-R.js → error-banner-Sl2FlSJ4.js} +16 -16
  29. package/dist/{error-entries-D3ouOLDe.js → error-entries-CMNtA8NK.js} +25 -25
  30. package/dist/{feedback-button-gTC25Y-p.js → feedback-button-DqPqwryB.js} +8 -8
  31. package/dist/{flowDiagram-HODETNUW-BM2lvKuH.js → flowDiagram-HODETNUW-D-3aRpfS.js} +2 -2
  32. package/dist/{formats-C24TvExI.js → formats-6pLWWrY2.js} +1 -1
  33. package/dist/{glide-data-editor-BXXphavz.js → glide-data-editor-BxMhUd3K.js} +10 -10
  34. package/dist/{glide-utils-Q2ZsuA3h.js → glide-utils-Bt8_pBa2.js} +2 -2
  35. package/dist/{globals-BcxqBRmX.js → globals-DTJa_doJ.js} +3 -3
  36. package/dist/{html-to-image-VZvb968z.js → html-to-image-By72ALyI.js} +44 -44
  37. package/dist/{infoDiagram-27XIBGKW-Crwjiywp.js → infoDiagram-27XIBGKW-s1C1kgfU.js} +1 -1
  38. package/dist/{ishikawaDiagram-5VMMS53U-D4US2ShV.js → ishikawaDiagram-5VMMS53U-CCsRgolY.js} +1 -1
  39. package/dist/{kanban-definition-UXKFOSKX-Bk097CUX.js → kanban-definition-UXKFOSKX-BrmxDlcc.js} +1 -1
  40. package/dist/{label-CuEjBqYP.js → label-BRnUC0NX.js} +1 -1
  41. package/dist/main.js +614 -614
  42. package/dist/{mermaid-6EkeBlhr.js → mermaid-DKI0869I.js} +35 -35
  43. package/dist/{mindmap-definition-YA3MSWOX-DmORzfXQ.js → mindmap-definition-YA3MSWOX-641xJysF.js} +1 -1
  44. package/dist/{number-overlay-editor-CaspWg5p.js → number-overlay-editor-Z_H6x5b-.js} +1 -1
  45. package/dist/{pegDiagram-XKGWAZYB-DT5TL02S.js → pegDiagram-XKGWAZYB-keVUAUeS.js} +2 -2
  46. package/dist/{pieDiagram-E7YTZNPT-B1NwGcuH.js → pieDiagram-E7YTZNPT-DHktXPO_.js} +1 -1
  47. package/dist/{process-output-CCPgTShO.js → process-output-D-OMW5sV.js} +4 -4
  48. package/dist/{railroadDiagram-O6MQD6OU-BxoycdEu.js → railroadDiagram-O6MQD6OU-BVEF4OV_.js} +2 -2
  49. package/dist/{requirementDiagram-BXWQKSXE-DHq_eRrm.js → requirementDiagram-BXWQKSXE-CWo-UAKV.js} +1 -1
  50. package/dist/{reveal-component-CWk_paD2.js → reveal-component-tAB5K3QE.js} +9 -9
  51. package/dist/{select-D2iqeJYk.js → select-B0LRDH0g.js} +199 -199
  52. package/dist/{sequenceDiagram-WJ2MYXX4-Ba11BAOu.js → sequenceDiagram-WJ2MYXX4-CHQvLnq4.js} +1 -1
  53. package/dist/{spec-BCCcvWPS.js → spec-C-LRKGtT.js} +4 -4
  54. package/dist/{stateDiagram-D77RDMKH-OHQbvkbP.js → stateDiagram-D77RDMKH-BOJZgbUJ.js} +2 -2
  55. package/dist/{stateDiagram-v2-MP3YSRHH-BlIquvFJ.js → stateDiagram-v2-MP3YSRHH-C53XXdYH.js} +2 -2
  56. package/dist/{swimlanes-42K2YHIH-DSlitS4s.js → swimlanes-42K2YHIH-D2o1gOtw.js} +1 -1
  57. package/dist/{swimlanesDiagram-VR7AAH4N-ClwuzFNO.js → swimlanesDiagram-VR7AAH4N-BHFzN1Wk.js} +2 -2
  58. package/dist/{timeline-definition-24CTP7MA-hAzc5VkT.js → timeline-definition-24CTP7MA-rv7QUa46.js} +1 -1
  59. package/dist/toDate-CjPuEPou.js +705 -0
  60. package/dist/{toast-DxVfYlCp.js → toast-CFWpihJU.js} +221 -221
  61. package/dist/{tooltip-BCntm-jf.js → tooltip-CKO1pHJo.js} +51 -51
  62. package/dist/{use-restore-focus-BhXhsNLV.js → use-restore-focus-DBCITLeF.js} +1 -1
  63. package/dist/{useAsyncData-BbuzBAUp.js → useAsyncData-ChgNtdmE.js} +1 -1
  64. package/dist/{useDateFormatter-6AHbIR-J.js → useDateFormatter-c_yJtkAe.js} +2 -2
  65. package/dist/{useDeepCompareMemoize-da5A3c-Y.js → useDeepCompareMemoize-Bet7kSsI.js} +1 -1
  66. package/dist/{useLifecycle-C3nT1kwI.js → useLifecycle-VVmz_24o.js} +2 -2
  67. package/dist/{useTheme-BC8Lof0B.js → useTheme-DympCsQg.js} +83 -83
  68. package/dist/{vega-component-CF9IzE2r.js → vega-component-DnfQeoyt.js} +7 -7
  69. package/dist/{vennDiagram-4TSXK5OY-CINKaJgr.js → vennDiagram-4TSXK5OY-D36Zk7t-.js} +1 -1
  70. package/dist/{wardleyDiagram-VM6X3IG4-KG2tlXg_.js → wardleyDiagram-VM6X3IG4-BLBolvyQ.js} +1 -1
  71. package/dist/{xychartDiagram-S5SC5T6Z-XIH5cwgI.js → xychartDiagram-S5SC5T6Z-CfH57l0v.js} +1 -1
  72. package/package.json +1 -1
  73. package/src/__tests__/mount.test.ts +0 -20
  74. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +2 -2
  75. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +2 -2
  76. package/src/core/host/__tests__/notebook-client.test.ts +66 -3
  77. package/src/core/host/events.ts +1 -10
  78. package/src/core/host/notebook-client.ts +11 -18
  79. package/src/core/runtime/__tests__/runtime.test.ts +2 -53
  80. package/src/core/runtime/runtime.ts +1 -14
  81. package/src/core/runtime/types.ts +0 -2
  82. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +2 -23
  83. package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +17 -25
  84. package/src/core/websocket/transports/__tests__/sse.test.ts +17 -0
  85. package/src/core/websocket/transports/sse.ts +14 -2
  86. package/src/core/websocket/useNotebookClient.ts +1 -11
  87. package/src/core/websocket/useNotebookSession.tsx +1 -6
  88. package/src/mount.tsx +0 -4
  89. package/dist/toDate-C0jaysq2.js +0 -1184
@@ -0,0 +1,705 @@
1
+ import { t as e } from "./rolldown-runtime-Cb76FRpK.js";
2
+ import { g as t } from "./button-BxB3RDjN.js";
3
+ import { t as n } from "./compiler-runtime-CldRdSsv.js";
4
+ import { h as r } from "./tooltip-CKO1pHJo.js";
5
+ import { C as i, E as a, _ as o, a as s, b as c } from "./useTheme-DympCsQg.js";
6
+ import { t as l } from "./invariant-DLmrl-hA.js";
7
+ var u = r("circle-question-mark", [
8
+ ["circle", {
9
+ cx: "12",
10
+ cy: "12",
11
+ r: "10",
12
+ key: "1mglay"
13
+ }],
14
+ ["path", {
15
+ d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",
16
+ key: "1u773s"
17
+ }],
18
+ ["path", {
19
+ d: "M12 17h.01",
20
+ key: "p32p05"
21
+ }]
22
+ ]), d = n();
23
+ function f(e, t) {
24
+ if (e == null) throw Error(t || `Expected value but got ${e}`);
25
+ }
26
+ //#endregion
27
+ //#region src/core/wasm/utils.ts
28
+ function p() {
29
+ return typeof document < "u" && document.querySelector("marimo-wasm") !== null;
30
+ }
31
+ //#endregion
32
+ //#region src/utils/Deferred.ts
33
+ var m = class {
34
+ promise;
35
+ resolve;
36
+ reject;
37
+ status = "pending";
38
+ value = void 0;
39
+ constructor() {
40
+ this.promise = new Promise((e, t) => {
41
+ this.reject = (e) => {
42
+ this.status = "rejected", t(e);
43
+ }, this.resolve = (t) => {
44
+ this.status = "resolved", h(t) || (this.value = t), e(t);
45
+ };
46
+ });
47
+ }
48
+ };
49
+ function h(e) {
50
+ return typeof e == "object" && !!e && "then" in e && typeof e.then == "function";
51
+ }
52
+ //#endregion
53
+ //#region src/core/mode.ts
54
+ function g() {
55
+ let e = o.get(v);
56
+ return f(e, "internal-error: initial mode not found"), l(e !== "present", "internal-error: initial mode cannot be 'present'"), e;
57
+ }
58
+ var _ = a({
59
+ mode: c() ? "read" : "not-set",
60
+ cellAnchor: null
61
+ }), v = a(void 0);
62
+ function y() {
63
+ let e = o.get(v);
64
+ return e !== "home" && e !== "gallery";
65
+ }
66
+ var b = a(!1);
67
+ function x() {
68
+ let e = (0, d.c)(1), { mode: t } = i(_), n = i(b), r;
69
+ return e[0] === Symbol.for("react.memo_cache_sentinel") ? (r = new URLSearchParams(window.location.search).get(s.kiosk), e[0] = r) : r = e[0], t !== "read" && !n && r !== "true";
70
+ }
71
+ //#endregion
72
+ //#region ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/_u64.js
73
+ var S = /* @__PURE__ */ e(((e) => {
74
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.toBig = e.shrSL = e.shrSH = e.rotrSL = e.rotrSH = e.rotrBL = e.rotrBH = e.rotr32L = e.rotr32H = e.rotlSL = e.rotlSH = e.rotlBL = e.rotlBH = e.add5L = e.add5H = e.add4L = e.add4H = e.add3L = e.add3H = void 0, e.add = v, e.fromBig = r, e.split = i;
75
+ var t = /* @__PURE__ */ BigInt(2 ** 32 - 1), n = /* @__PURE__ */ BigInt(32);
76
+ function r(e, r = !1) {
77
+ return r ? {
78
+ h: Number(e & t),
79
+ l: Number(e >> n & t)
80
+ } : {
81
+ h: Number(e >> n & t) | 0,
82
+ l: Number(e & t) | 0
83
+ };
84
+ }
85
+ function i(e, t = !1) {
86
+ let n = e.length, i = new Uint32Array(n), a = new Uint32Array(n);
87
+ for (let o = 0; o < n; o++) {
88
+ let { h: n, l: s } = r(e[o], t);
89
+ [i[o], a[o]] = [n, s];
90
+ }
91
+ return [i, a];
92
+ }
93
+ var a = (e, t) => BigInt(e >>> 0) << n | BigInt(t >>> 0);
94
+ e.toBig = a;
95
+ var o = (e, t, n) => e >>> n;
96
+ e.shrSH = o;
97
+ var s = (e, t, n) => e << 32 - n | t >>> n;
98
+ e.shrSL = s;
99
+ var c = (e, t, n) => e >>> n | t << 32 - n;
100
+ e.rotrSH = c;
101
+ var l = (e, t, n) => e << 32 - n | t >>> n;
102
+ e.rotrSL = l;
103
+ var u = (e, t, n) => e << 64 - n | t >>> n - 32;
104
+ e.rotrBH = u;
105
+ var d = (e, t, n) => e >>> n - 32 | t << 64 - n;
106
+ e.rotrBL = d;
107
+ var f = (e, t) => t;
108
+ e.rotr32H = f;
109
+ var p = (e, t) => e;
110
+ e.rotr32L = p;
111
+ var m = (e, t, n) => e << n | t >>> 32 - n;
112
+ e.rotlSH = m;
113
+ var h = (e, t, n) => t << n | e >>> 32 - n;
114
+ e.rotlSL = h;
115
+ var g = (e, t, n) => t << n - 32 | e >>> 64 - n;
116
+ e.rotlBH = g;
117
+ var _ = (e, t, n) => e << n - 32 | t >>> 64 - n;
118
+ e.rotlBL = _;
119
+ function v(e, t, n, r) {
120
+ let i = (t >>> 0) + (r >>> 0);
121
+ return {
122
+ h: e + n + (i / 2 ** 32 | 0) | 0,
123
+ l: i | 0
124
+ };
125
+ }
126
+ var y = (e, t, n) => (e >>> 0) + (t >>> 0) + (n >>> 0);
127
+ e.add3L = y;
128
+ var b = (e, t, n, r) => t + n + r + (e / 2 ** 32 | 0) | 0;
129
+ e.add3H = b;
130
+ var x = (e, t, n, r) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (r >>> 0);
131
+ e.add4L = x;
132
+ var S = (e, t, n, r, i) => t + n + r + i + (e / 2 ** 32 | 0) | 0;
133
+ e.add4H = S;
134
+ var C = (e, t, n, r, i) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (r >>> 0) + (i >>> 0);
135
+ e.add5L = C;
136
+ var w = (e, t, n, r, i, a) => t + n + r + i + a + (e / 2 ** 32 | 0) | 0;
137
+ e.add5H = w, e.default = {
138
+ fromBig: r,
139
+ split: i,
140
+ toBig: a,
141
+ shrSH: o,
142
+ shrSL: s,
143
+ rotrSH: c,
144
+ rotrSL: l,
145
+ rotrBH: u,
146
+ rotrBL: d,
147
+ rotr32H: f,
148
+ rotr32L: p,
149
+ rotlSH: m,
150
+ rotlSL: h,
151
+ rotlBH: g,
152
+ rotlBL: _,
153
+ add: v,
154
+ add3L: y,
155
+ add3H: b,
156
+ add4L: x,
157
+ add4H: S,
158
+ add5H: w,
159
+ add5L: C
160
+ };
161
+ })), C = /* @__PURE__ */ e(((e) => {
162
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.crypto = void 0, e.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
163
+ })), w = /* @__PURE__ */ e(((e) => {
164
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.wrapXOFConstructorWithOpts = e.wrapConstructorWithOpts = e.wrapConstructor = e.Hash = e.nextTick = e.swap32IfBE = e.byteSwapIfBE = e.swap8IfBE = e.isLE = void 0, e.isBytes = n, e.anumber = r, e.abytes = i, e.ahash = a, e.aexists = o, e.aoutput = s, e.u8 = c, e.u32 = l, e.clean = u, e.createView = d, e.rotr = f, e.rotl = p, e.byteSwap = m, e.byteSwap32 = h, e.bytesToHex = v, e.hexToBytes = x, e.asyncLoop = S, e.utf8ToBytes = w, e.bytesToUtf8 = T, e.toBytes = E, e.kdfInputToBytes = D, e.concatBytes = O, e.checkOpts = k, e.createHasher = A, e.createOptHasher = j, e.createXOFer = M, e.randomBytes = N;
165
+ var t = C();
166
+ function n(e) {
167
+ return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
168
+ }
169
+ function r(e) {
170
+ if (!Number.isSafeInteger(e) || e < 0) throw Error("positive integer expected, got " + e);
171
+ }
172
+ function i(e, ...t) {
173
+ if (!n(e)) throw Error("Uint8Array expected");
174
+ if (t.length > 0 && !t.includes(e.length)) throw Error("Uint8Array expected of length " + t + ", got length=" + e.length);
175
+ }
176
+ function a(e) {
177
+ if (typeof e != "function" || typeof e.create != "function") throw Error("Hash should be wrapped by utils.createHasher");
178
+ r(e.outputLen), r(e.blockLen);
179
+ }
180
+ function o(e, t = !0) {
181
+ if (e.destroyed) throw Error("Hash instance has been destroyed");
182
+ if (t && e.finished) throw Error("Hash#digest() has already been called");
183
+ }
184
+ function s(e, t) {
185
+ i(e);
186
+ let n = t.outputLen;
187
+ if (e.length < n) throw Error("digestInto() expects output buffer of length at least " + n);
188
+ }
189
+ function c(e) {
190
+ return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
191
+ }
192
+ function l(e) {
193
+ return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
194
+ }
195
+ function u(...e) {
196
+ for (let t = 0; t < e.length; t++) e[t].fill(0);
197
+ }
198
+ function d(e) {
199
+ return new DataView(e.buffer, e.byteOffset, e.byteLength);
200
+ }
201
+ function f(e, t) {
202
+ return e << 32 - t | e >>> t;
203
+ }
204
+ function p(e, t) {
205
+ return e << t | e >>> 32 - t >>> 0;
206
+ }
207
+ e.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
208
+ function m(e) {
209
+ return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
210
+ }
211
+ e.swap8IfBE = e.isLE ? (e) => e : (e) => m(e), e.byteSwapIfBE = e.swap8IfBE;
212
+ function h(e) {
213
+ for (let t = 0; t < e.length; t++) e[t] = m(e[t]);
214
+ return e;
215
+ }
216
+ e.swap32IfBE = e.isLE ? (e) => e : h;
217
+ var g = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", _ = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
218
+ function v(e) {
219
+ if (i(e), g) return e.toHex();
220
+ let t = "";
221
+ for (let n = 0; n < e.length; n++) t += _[e[n]];
222
+ return t;
223
+ }
224
+ var y = {
225
+ _0: 48,
226
+ _9: 57,
227
+ A: 65,
228
+ F: 70,
229
+ a: 97,
230
+ f: 102
231
+ };
232
+ function b(e) {
233
+ if (e >= y._0 && e <= y._9) return e - y._0;
234
+ if (e >= y.A && e <= y.F) return e - (y.A - 10);
235
+ if (e >= y.a && e <= y.f) return e - (y.a - 10);
236
+ }
237
+ function x(e) {
238
+ if (typeof e != "string") throw Error("hex string expected, got " + typeof e);
239
+ if (g) return Uint8Array.fromHex(e);
240
+ let t = e.length, n = t / 2;
241
+ if (t % 2) throw Error("hex string expected, got unpadded hex of length " + t);
242
+ let r = new Uint8Array(n);
243
+ for (let t = 0, i = 0; t < n; t++, i += 2) {
244
+ let n = b(e.charCodeAt(i)), a = b(e.charCodeAt(i + 1));
245
+ if (n === void 0 || a === void 0) {
246
+ let t = e[i] + e[i + 1];
247
+ throw Error("hex string expected, got non-hex character \"" + t + "\" at index " + i);
248
+ }
249
+ r[t] = n * 16 + a;
250
+ }
251
+ return r;
252
+ }
253
+ e.nextTick = async () => {};
254
+ async function S(t, n, r) {
255
+ let i = Date.now();
256
+ for (let a = 0; a < t; a++) {
257
+ r(a);
258
+ let t = Date.now() - i;
259
+ t >= 0 && t < n || (await (0, e.nextTick)(), i += t);
260
+ }
261
+ }
262
+ function w(e) {
263
+ if (typeof e != "string") throw Error("string expected");
264
+ return new Uint8Array(new TextEncoder().encode(e));
265
+ }
266
+ function T(e) {
267
+ return new TextDecoder().decode(e);
268
+ }
269
+ function E(e) {
270
+ return typeof e == "string" && (e = w(e)), i(e), e;
271
+ }
272
+ function D(e) {
273
+ return typeof e == "string" && (e = w(e)), i(e), e;
274
+ }
275
+ function O(...e) {
276
+ let t = 0;
277
+ for (let n = 0; n < e.length; n++) {
278
+ let r = e[n];
279
+ i(r), t += r.length;
280
+ }
281
+ let n = new Uint8Array(t);
282
+ for (let t = 0, r = 0; t < e.length; t++) {
283
+ let i = e[t];
284
+ n.set(i, r), r += i.length;
285
+ }
286
+ return n;
287
+ }
288
+ function k(e, t) {
289
+ if (t !== void 0 && {}.toString.call(t) !== "[object Object]") throw Error("options should be object or undefined");
290
+ return Object.assign(e, t);
291
+ }
292
+ e.Hash = class {};
293
+ function A(e) {
294
+ let t = (t) => e().update(E(t)).digest(), n = e();
295
+ return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
296
+ }
297
+ function j(e) {
298
+ let t = (t, n) => e(n).update(E(t)).digest(), n = e({});
299
+ return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = (t) => e(t), t;
300
+ }
301
+ function M(e) {
302
+ let t = (t, n) => e(n).update(E(t)).digest(), n = e({});
303
+ return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = (t) => e(t), t;
304
+ }
305
+ e.wrapConstructor = A, e.wrapConstructorWithOpts = j, e.wrapXOFConstructorWithOpts = M;
306
+ function N(e = 32) {
307
+ if (t.crypto && typeof t.crypto.getRandomValues == "function") return t.crypto.getRandomValues(new Uint8Array(e));
308
+ if (t.crypto && typeof t.crypto.randomBytes == "function") return Uint8Array.from(t.crypto.randomBytes(e));
309
+ throw Error("crypto.getRandomValues must be defined");
310
+ }
311
+ })), T = /* @__PURE__ */ e(((e) => {
312
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.shake256 = e.shake128 = e.keccak_512 = e.keccak_384 = e.keccak_256 = e.keccak_224 = e.sha3_512 = e.sha3_384 = e.sha3_256 = e.sha3_224 = e.Keccak = void 0, e.keccakP = _;
313
+ var t = S(), n = w(), r = BigInt(0), i = BigInt(1), a = BigInt(2), o = BigInt(7), s = BigInt(256), c = BigInt(113), l = [], u = [], d = [];
314
+ for (let e = 0, t = i, n = 1, f = 0; e < 24; e++) {
315
+ [n, f] = [f, (2 * n + 3 * f) % 5], l.push(2 * (5 * f + n)), u.push((e + 1) * (e + 2) / 2 % 64);
316
+ let p = r;
317
+ for (let e = 0; e < 7; e++) t = (t << i ^ (t >> o) * c) % s, t & a && (p ^= i << (i << /* @__PURE__ */ BigInt(e)) - i);
318
+ d.push(p);
319
+ }
320
+ var f = (0, t.split)(d, !0), p = f[0], m = f[1], h = (e, n, r) => r > 32 ? (0, t.rotlBH)(e, n, r) : (0, t.rotlSH)(e, n, r), g = (e, n, r) => r > 32 ? (0, t.rotlBL)(e, n, r) : (0, t.rotlSL)(e, n, r);
321
+ function _(e, t = 24) {
322
+ let r = /* @__PURE__ */ new Uint32Array(10);
323
+ for (let n = 24 - t; n < 24; n++) {
324
+ for (let t = 0; t < 10; t++) r[t] = e[t] ^ e[t + 10] ^ e[t + 20] ^ e[t + 30] ^ e[t + 40];
325
+ for (let t = 0; t < 10; t += 2) {
326
+ let n = (t + 8) % 10, i = (t + 2) % 10, a = r[i], o = r[i + 1], s = h(a, o, 1) ^ r[n], c = g(a, o, 1) ^ r[n + 1];
327
+ for (let n = 0; n < 50; n += 10) e[t + n] ^= s, e[t + n + 1] ^= c;
328
+ }
329
+ let t = e[2], i = e[3];
330
+ for (let n = 0; n < 24; n++) {
331
+ let r = u[n], a = h(t, i, r), o = g(t, i, r), s = l[n];
332
+ t = e[s], i = e[s + 1], e[s] = a, e[s + 1] = o;
333
+ }
334
+ for (let t = 0; t < 50; t += 10) {
335
+ for (let n = 0; n < 10; n++) r[n] = e[t + n];
336
+ for (let n = 0; n < 10; n++) e[t + n] ^= ~r[(n + 2) % 10] & r[(n + 4) % 10];
337
+ }
338
+ e[0] ^= p[n], e[1] ^= m[n];
339
+ }
340
+ (0, n.clean)(r);
341
+ }
342
+ var v = class e extends n.Hash {
343
+ constructor(e, t, r, i = !1, a = 24) {
344
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = t, this.outputLen = r, this.enableXOF = i, this.rounds = a, (0, n.anumber)(r), !(0 < e && e < 200)) throw Error("only keccak-f1600 function is supported");
345
+ this.state = /* @__PURE__ */ new Uint8Array(200), this.state32 = (0, n.u32)(this.state);
346
+ }
347
+ clone() {
348
+ return this._cloneInto();
349
+ }
350
+ keccak() {
351
+ (0, n.swap32IfBE)(this.state32), _(this.state32, this.rounds), (0, n.swap32IfBE)(this.state32), this.posOut = 0, this.pos = 0;
352
+ }
353
+ update(e) {
354
+ (0, n.aexists)(this), e = (0, n.toBytes)(e), (0, n.abytes)(e);
355
+ let { blockLen: t, state: r } = this, i = e.length;
356
+ for (let n = 0; n < i;) {
357
+ let a = Math.min(t - this.pos, i - n);
358
+ for (let t = 0; t < a; t++) r[this.pos++] ^= e[n++];
359
+ this.pos === t && this.keccak();
360
+ }
361
+ return this;
362
+ }
363
+ finish() {
364
+ if (this.finished) return;
365
+ this.finished = !0;
366
+ let { state: e, suffix: t, pos: n, blockLen: r } = this;
367
+ e[n] ^= t, t & 128 && n === r - 1 && this.keccak(), e[r - 1] ^= 128, this.keccak();
368
+ }
369
+ writeInto(e) {
370
+ (0, n.aexists)(this, !1), (0, n.abytes)(e), this.finish();
371
+ let t = this.state, { blockLen: r } = this;
372
+ for (let n = 0, i = e.length; n < i;) {
373
+ this.posOut >= r && this.keccak();
374
+ let a = Math.min(r - this.posOut, i - n);
375
+ e.set(t.subarray(this.posOut, this.posOut + a), n), this.posOut += a, n += a;
376
+ }
377
+ return e;
378
+ }
379
+ xofInto(e) {
380
+ if (!this.enableXOF) throw Error("XOF is not possible for this instance");
381
+ return this.writeInto(e);
382
+ }
383
+ xof(e) {
384
+ return (0, n.anumber)(e), this.xofInto(new Uint8Array(e));
385
+ }
386
+ digestInto(e) {
387
+ if ((0, n.aoutput)(e, this), this.finished) throw Error("digest() was already called");
388
+ return this.writeInto(e), this.destroy(), e;
389
+ }
390
+ digest() {
391
+ return this.digestInto(new Uint8Array(this.outputLen));
392
+ }
393
+ destroy() {
394
+ this.destroyed = !0, (0, n.clean)(this.state);
395
+ }
396
+ _cloneInto(t) {
397
+ let { blockLen: n, suffix: r, outputLen: i, rounds: a, enableXOF: o } = this;
398
+ return t ||= new e(n, r, i, o, a), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = a, t.suffix = r, t.outputLen = i, t.enableXOF = o, t.destroyed = this.destroyed, t;
399
+ }
400
+ };
401
+ e.Keccak = v;
402
+ var y = (e, t, r) => (0, n.createHasher)(() => new v(t, e, r));
403
+ e.sha3_224 = y(6, 144, 28), e.sha3_256 = y(6, 136, 32), e.sha3_384 = y(6, 104, 48), e.sha3_512 = y(6, 72, 64), e.keccak_224 = y(1, 144, 28), e.keccak_256 = y(1, 136, 32), e.keccak_384 = y(1, 104, 48), e.keccak_512 = y(1, 72, 64);
404
+ var b = (e, t, r) => (0, n.createXOFer)((n = {}) => new v(t, e, n.dkLen === void 0 ? r : n.dkLen, !0));
405
+ e.shake128 = b(31, 168, 16), e.shake256 = b(31, 136, 32);
406
+ })), E = /* @__PURE__ */ e(((e, t) => {
407
+ var { sha3_512: n } = T(), r = 24, i = 32, a = (e = 4, t = Math.random) => {
408
+ let n = "";
409
+ for (; n.length < e;) n += Math.floor(t() * 36).toString(36);
410
+ return n;
411
+ };
412
+ function o(e) {
413
+ let t = 0n;
414
+ for (let n of e.values()) {
415
+ let e = BigInt(n);
416
+ t = (t << 8n) + e;
417
+ }
418
+ return t;
419
+ }
420
+ var s = (e = "") => o(n(e)).toString(36).slice(1), c = Array.from({ length: 26 }, (e, t) => String.fromCharCode(t + 97)), l = (e) => c[Math.floor(e() * c.length)], u = ({ globalObj: e = typeof global < "u" ? global : typeof window < "u" ? window : {}, random: t = Math.random } = {}) => {
421
+ let n = Object.keys(e).toString();
422
+ return s(n.length ? n + a(i, t) : a(i, t)).substring(0, i);
423
+ }, d = (e) => () => e++, f = 476782367, p = ({ random: e = Math.random, counter: t = d(Math.floor(e() * f)), length: n = r, fingerprint: i = u({ random: e }) } = {}) => function() {
424
+ let r = l(e), o = Date.now().toString(36), c = t().toString(36);
425
+ return `${r + s(`${o + a(n, e) + c + i}`).substring(1, n)}`;
426
+ }, m = p(), h = (e, { minLength: t = 2, maxLength: n = i } = {}) => {
427
+ let r = e.length, a = /^[0-9a-z]+$/;
428
+ try {
429
+ if (typeof e == "string" && r >= t && r <= n && a.test(e)) return !0;
430
+ } finally {}
431
+ return !1;
432
+ };
433
+ t.exports.getConstants = () => ({
434
+ defaultLength: r,
435
+ bigLength: i
436
+ }), t.exports.init = p, t.exports.createId = m, t.exports.bufToBigInt = o, t.exports.createCounter = d, t.exports.createFingerprint = u, t.exports.isCuid = h;
437
+ })), D = /* @__PURE__ */ e(((e, t) => {
438
+ var { createId: n, init: r, getConstants: i, isCuid: a } = E();
439
+ t.exports.createId = n, t.exports.init = r, t.exports.getConstants = i, t.exports.isCuid = a;
440
+ })), O = D();
441
+ function k(e) {
442
+ let t = new URL(window.location.href);
443
+ e(t.searchParams), window.history.replaceState({}, "", t.toString());
444
+ }
445
+ var A = /^(https?:\/\/\S+)$/;
446
+ function j(e) {
447
+ return typeof e == "string" && A.test(e);
448
+ }
449
+ function M({ href: e, queryParams: t, keys: n }) {
450
+ let r = typeof t == "string" ? new URLSearchParams(t) : t;
451
+ if (r.size === 0 || e.startsWith("http://") || e.startsWith("https://")) return e;
452
+ let i = e.startsWith("#"), a = i && e.includes("?");
453
+ if (i && !a) {
454
+ let t = n ? [...r.entries()].filter(([e]) => n.includes(e)) : [...r.entries()], i = new URLSearchParams();
455
+ for (let [e, n] of t) i.set(e, n);
456
+ let a = i.toString();
457
+ return a ? `/?${a}${e}` : e;
458
+ }
459
+ let o = e, s = "", c = new URLSearchParams(), l = +!!i, u = e.indexOf("#", l);
460
+ u !== -1 && (s = e.slice(u), o = e.slice(0, u));
461
+ let d = o.indexOf("?");
462
+ d !== -1 && (c = new URLSearchParams(o.slice(d + 1)), o = o.slice(0, d));
463
+ let f = new URLSearchParams(c), p = n ? [...r.entries()].filter(([e]) => n.includes(e)) : [...r.entries()];
464
+ for (let [e, t] of p) f.set(e, t);
465
+ let m = f.toString();
466
+ return m ? `${o}?${m}${s}` : e;
467
+ }
468
+ //#endregion
469
+ //#region src/core/kernel/session.ts
470
+ var N = a(null), P = (0, O.init)({ length: 6 });
471
+ function F() {
472
+ return `s_${P()}`;
473
+ }
474
+ function I(e) {
475
+ return e ? /^s_[\da-z]{6}$/.test(e) : !1;
476
+ }
477
+ var L = null;
478
+ function R() {
479
+ let e = o.get(v) === "edit", n = new URL(window.location.href).searchParams.get(s.sessionId), r = I(n) ? n : null;
480
+ return k((t) => {
481
+ if (!e) {
482
+ t.delete(s.sessionId), t.delete(s.kiosk);
483
+ return;
484
+ }
485
+ t.has(s.kiosk) || t.delete(s.sessionId);
486
+ }), r === null ? (t.debug("Starting a new session", { sessionId: n }), F()) : e ? (t.debug("Connecting to existing session", { sessionId: r }), r) : (t.debug("Ignoring session_id from URL outside the editor", { sessionId: r }), F());
487
+ }
488
+ function z() {
489
+ return L === null && (L = R()), L;
490
+ }
491
+ //#endregion
492
+ //#region src/core/static/static-state.ts
493
+ function B(e) {
494
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
495
+ for (let t of Object.values(e)) if (typeof t != "string") return !1;
496
+ return !0;
497
+ }
498
+ function V(e) {
499
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
500
+ let t = e;
501
+ return !(!B(t.files) || t.modelNotifications !== void 0 && !Array.isArray(t.modelNotifications));
502
+ }
503
+ function H() {
504
+ let e = typeof window > "u" ? void 0 : window.__MARIMO_STATIC__;
505
+ return V(e) ? e : void 0;
506
+ }
507
+ function U() {
508
+ return H() !== void 0;
509
+ }
510
+ function W() {
511
+ let e = H();
512
+ return l(e !== void 0, "Not a static notebook"), e.files;
513
+ }
514
+ //#endregion
515
+ //#region src/core/runtime/runtime.ts
516
+ var G = new Set(Object.values(s)), K = class {
517
+ initialHealthyCheck = new m();
518
+ config;
519
+ lazy;
520
+ constructor(e, t = !1) {
521
+ this.config = e, this.lazy = t;
522
+ try {
523
+ new URL(this.config.url);
524
+ } catch (e) {
525
+ throw Error(`Invalid runtime URL: ${this.config.url}. ${e instanceof Error ? e.message : "Unknown error"}`, { cause: e });
526
+ }
527
+ this.lazy || this.init();
528
+ }
529
+ get isLazy() {
530
+ return this.lazy;
531
+ }
532
+ get httpURL() {
533
+ return new URL(this.config.url);
534
+ }
535
+ get isSameOrigin() {
536
+ return this.httpURL.origin === window.location.origin;
537
+ }
538
+ get isServerless() {
539
+ return p() || c() || U();
540
+ }
541
+ formatHttpURL({ path: e = "", searchParams: t, restrictToKnownQueryParams: n = !0 }) {
542
+ let r = this.httpURL, i = new URLSearchParams(window.location.search);
543
+ if (t) for (let [e, n] of t.entries()) r.searchParams.set(e, n);
544
+ for (let [e, t] of i.entries()) n && !G.has(e) || r.searchParams.set(e, t);
545
+ return r.pathname = `${r.pathname.replace(/\/$/, "")}/${e.replace(/^\//, "")}`, r.hash = "", r;
546
+ }
547
+ appendCrossOriginAuth(e) {
548
+ return !this.isSameOrigin && this.config.authToken && e.searchParams.set(s.accessToken, this.config.authToken), e;
549
+ }
550
+ formatNavigableHttpURL(e, t) {
551
+ let n = this.formatHttpURL({
552
+ path: e,
553
+ searchParams: t
554
+ });
555
+ return n.searchParams.delete(s.accessToken), this.appendCrossOriginAuth(n);
556
+ }
557
+ formatWsURL(e, t) {
558
+ let n = this.formatHttpURL({
559
+ path: e,
560
+ searchParams: t,
561
+ restrictToKnownQueryParams: !1
562
+ });
563
+ return q(this.appendCrossOriginAuth(n).toString());
564
+ }
565
+ getSessionSearchParams(e) {
566
+ let t = new URL(this.config.url), n = new URLSearchParams(t.search);
567
+ return new URLSearchParams(window.location.search).forEach((e, t) => {
568
+ n.has(t) || n.set(t, e);
569
+ }), n.set(s.sessionId, e), n;
570
+ }
571
+ getWsURL(e) {
572
+ let t = this.getSessionSearchParams(e);
573
+ return this.formatWsURL("/ws", t);
574
+ }
575
+ getSseURL(e) {
576
+ let t = this.formatHttpURL({
577
+ path: "/sse",
578
+ searchParams: this.getSessionSearchParams(e),
579
+ restrictToKnownQueryParams: !1
580
+ });
581
+ return t.searchParams.delete(s.accessToken), t;
582
+ }
583
+ getWsSyncURL(e) {
584
+ return this.formatWsURL("/ws_sync", this.getSessionSearchParams(e));
585
+ }
586
+ getTerminalWsURL(e) {
587
+ let t = this.formatWsURL("/terminal/ws");
588
+ return e && (t.searchParams.set("rows", String(e.rows)), t.searchParams.set("cols", String(e.cols))), t;
589
+ }
590
+ getLSPURL(e) {
591
+ if (e === "copilot") {
592
+ let t = this.formatWsURL(`/lsp/${e}`), n = t.searchParams.get(s.accessToken);
593
+ return t.search = "", n && t.searchParams.set(s.accessToken, n), t;
594
+ }
595
+ return this.formatWsURL(`/lsp/${e}`);
596
+ }
597
+ getAiURL(e) {
598
+ return this.formatHttpURL({ path: `/api/ai/${e}` });
599
+ }
600
+ healthURL() {
601
+ return this.formatHttpURL({ path: "/health" });
602
+ }
603
+ async fetchHealth() {
604
+ try {
605
+ return await fetch(this.healthURL().toString());
606
+ } catch (e) {
607
+ return t.error(`Failed to check health: ${e instanceof Error ? e.message : "Unknown error"}`, { cause: e }), null;
608
+ }
609
+ }
610
+ async reconcileFromHealth() {
611
+ if (this.isServerless) return !0;
612
+ let e = await this.fetchHealth();
613
+ if (!e) return !1;
614
+ if (e.redirected) {
615
+ t.debug(`Runtime redirected to ${e.url}`);
616
+ let n = new URL(e.url);
617
+ n.pathname = n.pathname.replace(/\/health$/, ""), this.config.url = n.toString();
618
+ }
619
+ return e.ok && this.setDOMBaseUri(this.config.url), e.ok;
620
+ }
621
+ async probeHealth() {
622
+ return this.isServerless ? !0 : (await this.fetchHealth())?.ok ?? !1;
623
+ }
624
+ setDOMBaseUri(e) {
625
+ e = e.split("?", 1)[0], e.endsWith("/") || (e += "/");
626
+ let t = document.querySelector("base");
627
+ t ? t.setAttribute("href", e) : (t = document.createElement("base"), t.setAttribute("href", e), document.head.append(t));
628
+ }
629
+ async init(e) {
630
+ t.debug("Initializing runtime...");
631
+ let n = 0;
632
+ for (; !await this.reconcileFromHealth();) {
633
+ if (n >= 25) {
634
+ t.error("Failed to connect after 25 retries"), this.initialHealthyCheck.reject(/* @__PURE__ */ Error("Failed to connect after 25 retries"));
635
+ return;
636
+ }
637
+ if (!e?.disableRetryDelay) {
638
+ let e = Math.min(100 * 1.2 ** n, 2e3);
639
+ await new Promise((t) => setTimeout(t, e));
640
+ }
641
+ n++;
642
+ }
643
+ t.debug("Runtime is healthy"), this.initialHealthyCheck.resolve();
644
+ }
645
+ async waitForHealthy() {
646
+ return this.initialHealthyCheck.promise;
647
+ }
648
+ headers() {
649
+ let e = {
650
+ "Marimo-Session-Id": z(),
651
+ "Marimo-Server-Token": this.config.serverToken ?? "",
652
+ "x-runtime-url": this.httpURL.toString()
653
+ };
654
+ return this.config.authToken && (e.Authorization = `Bearer ${this.config.authToken}`), e;
655
+ }
656
+ sessionHeaders() {
657
+ return { "Marimo-Session-Id": z() };
658
+ }
659
+ };
660
+ function q(e) {
661
+ if (!e.startsWith("http")) {
662
+ t.warn(`URL must start with http: ${e}`);
663
+ let n = new URL(e);
664
+ return n.protocol = "ws", n;
665
+ }
666
+ return new URL(e.replace(/^http/, "ws"));
667
+ }
668
+ //#endregion
669
+ //#region src/core/runtime/config.ts
670
+ function J() {
671
+ let e = new URL(document.baseURI);
672
+ return e.search = "", e.hash = "", e.toString();
673
+ }
674
+ var Y = {
675
+ lazy: !0,
676
+ url: J()
677
+ }, ee = a(Y), te = a((e) => {
678
+ let t = e(ee);
679
+ return new K(t, t.lazy);
680
+ });
681
+ function X() {
682
+ return o.get(te);
683
+ }
684
+ function ne(e) {
685
+ if (e.startsWith("http")) return new URL(e);
686
+ let t = X().httpURL.toString();
687
+ return t.startsWith("blob:") && (t = t.replace("blob:", "")), new URL(e, t);
688
+ }
689
+ //#endregion
690
+ //#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constants.js
691
+ var re = 365.2425, ie = 6048e5, ae = 864e5, Z = 86400;
692
+ Z * 7, Z * re / 12 * 3;
693
+ var Q = Symbol.for("constructDateFrom");
694
+ //#endregion
695
+ //#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constructFrom.js
696
+ function $(e, t) {
697
+ return typeof e == "function" ? e(t) : e && typeof e == "object" && Q in e ? e[Q](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
698
+ }
699
+ //#endregion
700
+ //#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/toDate.js
701
+ function oe(e, t) {
702
+ return $(t || e, e);
703
+ }
704
+ //#endregion
705
+ export { u as C, f as S, b as _, ne as a, m as b, U as c, j as d, k as f, y as g, v as h, ie as i, N as l, g as m, $ as n, X as o, D as p, ae as r, W as s, oe as t, M as u, x as v, p as x, _ as y };