@flowdular/sandbox 0.4.0 → 0.4.3

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 (46) hide show
  1. package/bin/register-types.mjs +5 -2
  2. package/dist/client/assets/App-ClMOrpyg.js +11 -0
  3. package/dist/client/assets/PreviewHost-BHiHrfbQ.js +1 -0
  4. package/dist/client/assets/auto-buGEq6de.js +3 -0
  5. package/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  6. package/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  7. package/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  8. package/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  9. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  10. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  11. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  12. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  13. package/dist/client/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  14. package/dist/client/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  15. package/dist/client/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  16. package/dist/client/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  17. package/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  18. package/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  19. package/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  20. package/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  21. package/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  22. package/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  23. package/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  24. package/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  25. package/dist/client/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  26. package/dist/client/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  27. package/dist/client/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  28. package/dist/client/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  29. package/dist/client/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  30. package/dist/client/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  31. package/dist/client/assets/index-CvwhlQ87.js +4 -0
  32. package/dist/client/assets/styles-BPWaGf55.js +3 -0
  33. package/dist/client/assets/styles-Dx1_KOag.css +1 -0
  34. package/dist/client/favicon.svg +1 -0
  35. package/dist/server/assets/auto-CVGNYyb3.js +12785 -0
  36. package/dist/server/assets/chunk-DDJLRBDX-3OUNo51g.js +4125 -0
  37. package/dist/server/assets/nodefs-DVSI7kG0.js +24 -0
  38. package/dist/server/assets/opfs-ahp-D56iokt1.js +388 -0
  39. package/dist/server/assets/token-Bvaq7Anz.js +55 -0
  40. package/dist/server/assets/token-util-BqSvdIPQ.js +3 -0
  41. package/dist/server/assets/token-util-CktFFT4z.js +494 -0
  42. package/dist/server/entry.js +91671 -0
  43. package/dist/server/favicon.svg +1 -0
  44. package/dist/server/index.html +161 -0
  45. package/package.json +2 -2
  46. package/src/server/preview-worker-manager.ts +7 -2
@@ -0,0 +1,24 @@
1
+ import { b as u, c as Ye, n as B } from "./chunk-DDJLRBDX-3OUNo51g.js";
2
+ import * as o from "path";
3
+ import * as s from "fs";
4
+ //#region ../../node_modules/.pnpm/@electric-sql+pglite@0.5.8/node_modules/@electric-sql/pglite/dist/fs/nodefs.js
5
+ u();
6
+ var m = class extends Ye {
7
+ constructor(t) {
8
+ super(t), this.rootDir = o.resolve(t), s.existsSync(o.join(this.rootDir)) || s.mkdirSync(this.rootDir);
9
+ }
10
+ async init(t, e) {
11
+ return this.pg = t, { emscriptenOpts: {
12
+ ...e,
13
+ preRun: [...e.preRun || [], (r) => {
14
+ let c = r.FS.filesystems.NODEFS;
15
+ r.FS.mkdir(B), r.FS.mount(c, { root: this.rootDir }, B);
16
+ }]
17
+ } };
18
+ }
19
+ async closeFs() {
20
+ this.pg.Module.FS.quit();
21
+ }
22
+ };
23
+ //#endregion
24
+ export { m as NodeFS };
@@ -0,0 +1,388 @@
1
+ import { _ as T$1, b as u, g as R, o as Ve, s as We, v as U, x as x$1, y as h } from "./chunk-DDJLRBDX-3OUNo51g.js";
2
+ //#region ../../node_modules/.pnpm/@electric-sql+pglite@0.5.8/node_modules/@electric-sql/pglite/dist/fs/opfs-ahp.js
3
+ u();
4
+ var $ = "state.txt";
5
+ var G = "data";
6
+ var T = {
7
+ DIR: 16384,
8
+ FILE: 32768
9
+ };
10
+ var H;
11
+ var v;
12
+ var F;
13
+ var M;
14
+ var y;
15
+ var b;
16
+ var m;
17
+ var x;
18
+ var P;
19
+ var D;
20
+ var S;
21
+ var n;
22
+ var C;
23
+ var O;
24
+ var k;
25
+ var w;
26
+ var f;
27
+ var I;
28
+ var W;
29
+ var j;
30
+ var L = class extends We {
31
+ constructor(e, { initialPoolSize: t = 1e3, maintainedPoolSize: o = 100, debug: i = !1 } = {}) {
32
+ super(e, { debug: i });
33
+ R(this, n);
34
+ R(this, H);
35
+ R(this, v);
36
+ R(this, F);
37
+ R(this, M);
38
+ R(this, y);
39
+ R(this, b, /* @__PURE__ */ new Map());
40
+ R(this, m, /* @__PURE__ */ new Map());
41
+ R(this, x, 0);
42
+ R(this, P, /* @__PURE__ */ new Map());
43
+ R(this, D, /* @__PURE__ */ new Map());
44
+ this.lastCheckpoint = 0;
45
+ this.checkpointInterval = 6e4;
46
+ this.poolCounter = 0;
47
+ R(this, S, /* @__PURE__ */ new Set());
48
+ this.initialPoolSize = t, this.maintainedPoolSize = o;
49
+ }
50
+ async init(e, t) {
51
+ return await T$1(this, n, C).call(this), super.init(e, t);
52
+ }
53
+ async syncToFs(e = !1) {
54
+ await this.maybeCheckpointState(), await this.maintainPool(), e || this.flush();
55
+ }
56
+ async closeFs() {
57
+ for (let e of h(this, m).values()) e.close();
58
+ h(this, y).flush(), h(this, y).close(), this.pg.Module.FS.quit();
59
+ }
60
+ async maintainPool(e) {
61
+ e = e || this.maintainedPoolSize;
62
+ let t = e - this.state.pool.length, o = [];
63
+ for (let i = 0; i < t; i++) o.push(new Promise(async (c) => {
64
+ ++this.poolCounter;
65
+ let a = `${(Date.now() - 1704063600).toString(16).padStart(8, "0")}-${this.poolCounter.toString(16).padStart(8, "0")}`, h$1 = await h(this, F).getFileHandle(a, { create: !0 }), d = await h$1.createSyncAccessHandle();
66
+ h(this, b).set(a, h$1), h(this, m).set(a, d), T$1(this, n, k).call(this, {
67
+ opp: "createPoolFile",
68
+ args: [a]
69
+ }), this.state.pool.push(a), c();
70
+ }));
71
+ for (let i = 0; i > t; i--) o.push(new Promise(async (c) => {
72
+ let a = this.state.pool.pop();
73
+ T$1(this, n, k).call(this, {
74
+ opp: "deletePoolFile",
75
+ args: [a]
76
+ });
77
+ let h$2 = h(this, b).get(a);
78
+ h(this, m).get(a)?.close(), await h(this, F).removeEntry(h$2.name), h(this, b).delete(a), h(this, m).delete(a), c();
79
+ }));
80
+ await Promise.all(o);
81
+ }
82
+ _createPoolFileState(e) {
83
+ this.state.pool.push(e);
84
+ }
85
+ _deletePoolFileState(e) {
86
+ let t = this.state.pool.indexOf(e);
87
+ t > -1 && this.state.pool.splice(t, 1);
88
+ }
89
+ async maybeCheckpointState() {
90
+ Date.now() - this.lastCheckpoint > this.checkpointInterval && await this.checkpointState();
91
+ }
92
+ async checkpointState() {
93
+ let e = new TextEncoder().encode(JSON.stringify(this.state));
94
+ h(this, y).truncate(0), h(this, y).write(e, { at: 0 }), h(this, y).flush(), this.lastCheckpoint = Date.now();
95
+ }
96
+ flush() {
97
+ for (let e of h(this, S)) try {
98
+ e.flush();
99
+ } catch {}
100
+ h(this, S).clear();
101
+ }
102
+ chmod(e, t) {
103
+ T$1(this, n, O).call(this, {
104
+ opp: "chmod",
105
+ args: [e, t]
106
+ }, () => {
107
+ this._chmodState(e, t);
108
+ });
109
+ }
110
+ _chmodState(e, t) {
111
+ let o = T$1(this, n, f).call(this, e);
112
+ o.mode = t;
113
+ }
114
+ close(e) {
115
+ let t = T$1(this, n, I).call(this, e);
116
+ h(this, P).delete(e), h(this, D).delete(t);
117
+ }
118
+ fstat(e) {
119
+ let t = T$1(this, n, I).call(this, e);
120
+ return this.lstat(t);
121
+ }
122
+ lstat(e) {
123
+ let t = T$1(this, n, f).call(this, e), o = t.type === "file" ? h(this, m).get(t.backingFilename).getSize() : 0, i = 4096;
124
+ return {
125
+ dev: 0,
126
+ ino: 0,
127
+ mode: t.mode,
128
+ nlink: 1,
129
+ uid: 0,
130
+ gid: 0,
131
+ rdev: 0,
132
+ size: o,
133
+ blksize: i,
134
+ blocks: Math.ceil(o / i),
135
+ atime: t.lastModified,
136
+ mtime: t.lastModified,
137
+ ctime: t.lastModified
138
+ };
139
+ }
140
+ mkdir(e, t) {
141
+ T$1(this, n, O).call(this, {
142
+ opp: "mkdir",
143
+ args: [e, t]
144
+ }, () => {
145
+ this._mkdirState(e, t);
146
+ });
147
+ }
148
+ _mkdirState(e, t) {
149
+ let o = T$1(this, n, w).call(this, e), i = o.pop(), c = [], a = this.state.root;
150
+ for (let d of o) {
151
+ if (c.push(e), !Object.prototype.hasOwnProperty.call(a.children, d)) if (t?.recursive) this.mkdir(c.join("/"));
152
+ else throw new p("ENOENT", "No such file or directory");
153
+ if (a.children[d].type !== "directory") throw new p("ENOTDIR", "Not a directory");
154
+ a = a.children[d];
155
+ }
156
+ if (Object.prototype.hasOwnProperty.call(a.children, i)) throw new p("EEXIST", "File exists");
157
+ let h = {
158
+ type: "directory",
159
+ lastModified: Date.now(),
160
+ mode: t?.mode || T.DIR,
161
+ children: {}
162
+ };
163
+ a.children[i] = h;
164
+ }
165
+ open(e, t, o) {
166
+ if (T$1(this, n, f).call(this, e).type !== "file") throw new p("EISDIR", "Is a directory");
167
+ let c = T$1(this, n, W).call(this);
168
+ return h(this, P).set(c, e), h(this, D).set(e, c), c;
169
+ }
170
+ readdir(e) {
171
+ let t = T$1(this, n, f).call(this, e);
172
+ if (t.type !== "directory") throw new p("ENOTDIR", "Not a directory");
173
+ return Object.keys(t.children);
174
+ }
175
+ read(e, t, o, i, c) {
176
+ let a = T$1(this, n, I).call(this, e), h$3 = T$1(this, n, f).call(this, a);
177
+ if (h$3.type !== "file") throw new p("EISDIR", "Is a directory");
178
+ return h(this, m).get(h$3.backingFilename).read(new Uint8Array(t.buffer, o, i), { at: c });
179
+ }
180
+ rename(e, t) {
181
+ T$1(this, n, O).call(this, {
182
+ opp: "rename",
183
+ args: [e, t]
184
+ }, () => {
185
+ this._renameState(e, t, !0);
186
+ });
187
+ }
188
+ _renameState(e, t, o = !1) {
189
+ let i = T$1(this, n, w).call(this, e), c = i.pop(), a = T$1(this, n, f).call(this, i.join("/"));
190
+ if (!Object.prototype.hasOwnProperty.call(a.children, c)) throw new p("ENOENT", "No such file or directory");
191
+ let h$4 = T$1(this, n, w).call(this, t), d = h$4.pop(), l = T$1(this, n, f).call(this, h$4.join("/"));
192
+ if (o && Object.prototype.hasOwnProperty.call(l.children, d)) {
193
+ let u = l.children[d];
194
+ h(this, m).get(u.backingFilename).truncate(0), this.state.pool.push(u.backingFilename);
195
+ }
196
+ l.children[d] = a.children[c], delete a.children[c];
197
+ }
198
+ rmdir(e) {
199
+ T$1(this, n, O).call(this, {
200
+ opp: "rmdir",
201
+ args: [e]
202
+ }, () => {
203
+ this._rmdirState(e);
204
+ });
205
+ }
206
+ _rmdirState(e) {
207
+ let t = T$1(this, n, w).call(this, e), o = t.pop(), i = T$1(this, n, f).call(this, t.join("/"));
208
+ if (!Object.prototype.hasOwnProperty.call(i.children, o)) throw new p("ENOENT", "No such file or directory");
209
+ let c = i.children[o];
210
+ if (c.type !== "directory") throw new p("ENOTDIR", "Not a directory");
211
+ if (Object.keys(c.children).length > 0) throw new p("ENOTEMPTY", "Directory not empty");
212
+ delete i.children[o];
213
+ }
214
+ truncate(e, t = 0) {
215
+ let o = T$1(this, n, f).call(this, e);
216
+ if (o.type !== "file") throw new p("EISDIR", "Is a directory");
217
+ let i = h(this, m).get(o.backingFilename);
218
+ if (!i) throw new p("ENOENT", "No such file or directory");
219
+ i.truncate(t), h(this, S).add(i);
220
+ }
221
+ unlink(e) {
222
+ T$1(this, n, O).call(this, {
223
+ opp: "unlink",
224
+ args: [e]
225
+ }, () => {
226
+ this._unlinkState(e, !0);
227
+ });
228
+ }
229
+ _unlinkState(e, t = !1) {
230
+ let o = T$1(this, n, w).call(this, e), i = o.pop(), c = T$1(this, n, f).call(this, o.join("/"));
231
+ if (!Object.prototype.hasOwnProperty.call(c.children, i)) throw new p("ENOENT", "No such file or directory");
232
+ let a = c.children[i];
233
+ if (a.type !== "file") throw new p("EISDIR", "Is a directory");
234
+ if (delete c.children[i], t) {
235
+ let h$5 = h(this, m).get(a.backingFilename);
236
+ h$5?.truncate(0), h(this, S).add(h$5), h(this, D).has(e) && (h(this, P).delete(h(this, D).get(e)), h(this, D).delete(e));
237
+ }
238
+ this.state.pool.push(a.backingFilename);
239
+ }
240
+ utimes(e, t, o) {
241
+ T$1(this, n, O).call(this, {
242
+ opp: "utimes",
243
+ args: [
244
+ e,
245
+ t,
246
+ o
247
+ ]
248
+ }, () => {
249
+ this._utimesState(e, t, o);
250
+ });
251
+ }
252
+ _utimesState(e, t, o) {
253
+ let i = T$1(this, n, f).call(this, e);
254
+ i.lastModified = o;
255
+ }
256
+ writeFile(e, t, o) {
257
+ let i = T$1(this, n, w).call(this, e), c = i.pop(), a = T$1(this, n, f).call(this, i.join("/"));
258
+ if (Object.prototype.hasOwnProperty.call(a.children, c)) {
259
+ let l = a.children[c];
260
+ l.lastModified = Date.now(), T$1(this, n, k).call(this, {
261
+ opp: "setLastModified",
262
+ args: [e, l.lastModified]
263
+ });
264
+ } else {
265
+ if (this.state.pool.length === 0) throw new Error("No more file handles available in the pool");
266
+ let l = {
267
+ type: "file",
268
+ lastModified: Date.now(),
269
+ mode: o?.mode || T.FILE,
270
+ backingFilename: this.state.pool.pop()
271
+ };
272
+ a.children[c] = l, T$1(this, n, k).call(this, {
273
+ opp: "createFileNode",
274
+ args: [e, l]
275
+ });
276
+ }
277
+ let h$6 = a.children[c], d = h(this, m).get(h$6.backingFilename);
278
+ t.length > 0 && (d.write(typeof t == "string" ? new TextEncoder().encode(t) : new Uint8Array(t), { at: 0 }), e.startsWith("/pg_wal") && h(this, S).add(d));
279
+ }
280
+ _createFileNodeState(e, t) {
281
+ let o = T$1(this, n, w).call(this, e), i = o.pop(), c = T$1(this, n, f).call(this, o.join("/"));
282
+ c.children[i] = t;
283
+ let a = this.state.pool.indexOf(t.backingFilename);
284
+ return a > -1 && this.state.pool.splice(a, 1), t;
285
+ }
286
+ _setLastModifiedState(e, t) {
287
+ let o = T$1(this, n, f).call(this, e);
288
+ o.lastModified = t;
289
+ }
290
+ write(e, t, o, i, c) {
291
+ let a = T$1(this, n, I).call(this, e), h$7 = T$1(this, n, f).call(this, a);
292
+ if (h$7.type !== "file") throw new p("EISDIR", "Is a directory");
293
+ let d = h(this, m).get(h$7.backingFilename);
294
+ if (!d) throw new p("EBADF", "Bad file descriptor");
295
+ let l = d.write(new Uint8Array(t, o, i), { at: c });
296
+ return a.startsWith("/pg_wal") && h(this, S).add(d), l;
297
+ }
298
+ };
299
+ H = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakSet(), C = async function() {
300
+ x$1(this, H, await navigator.storage.getDirectory()), x$1(this, v, await T$1(this, n, j).call(this, this.dataDir, { create: !0 })), x$1(this, F, await T$1(this, n, j).call(this, G, {
301
+ from: h(this, v),
302
+ create: !0
303
+ })), x$1(this, M, await h(this, v).getFileHandle($, { create: !0 })), x$1(this, y, await h(this, M).createSyncAccessHandle());
304
+ let e = new ArrayBuffer(h(this, y).getSize());
305
+ h(this, y).read(e, { at: 0 });
306
+ let t, o = new TextDecoder().decode(e).split(`
307
+ `), i = !1;
308
+ try {
309
+ t = JSON.parse(o[0]);
310
+ } catch {
311
+ t = {
312
+ root: {
313
+ type: "directory",
314
+ lastModified: Date.now(),
315
+ mode: T.DIR,
316
+ children: {}
317
+ },
318
+ pool: []
319
+ }, h(this, y).truncate(0), h(this, y).write(new TextEncoder().encode(JSON.stringify(t)), { at: 0 }), i = !0;
320
+ }
321
+ this.state = t;
322
+ let c = o.slice(1).filter(Boolean).map((l) => JSON.parse(l));
323
+ for (let l of c) {
324
+ let u = `_${l.opp}State`;
325
+ if (typeof this[u] == "function") try {
326
+ this[u].bind(this)(...l.args);
327
+ } catch (N) {
328
+ console.warn("Error applying OPFS AHP WAL entry", l, N);
329
+ }
330
+ }
331
+ let a = [], h$8 = async (l) => {
332
+ if (l.type === "file") try {
333
+ let u = await h(this, F).getFileHandle(l.backingFilename), N = await u.createSyncAccessHandle();
334
+ h(this, b).set(l.backingFilename, u), h(this, m).set(l.backingFilename, N);
335
+ } catch (u) {
336
+ console.error("Error opening file handle for node", l, u);
337
+ }
338
+ else for (let u of Object.values(l.children)) a.push(h$8(u));
339
+ };
340
+ await h$8(this.state.root);
341
+ let d = [];
342
+ for (let l of this.state.pool) d.push(new Promise(async (u) => {
343
+ h(this, b).has(l) && console.warn("File handle already exists for pool file", l);
344
+ let N = await h(this, F).getFileHandle(l), U = await N.createSyncAccessHandle();
345
+ h(this, b).set(l, N), h(this, m).set(l, U), u();
346
+ }));
347
+ await Promise.all([...a, ...d]), await this.maintainPool(i ? this.initialPoolSize : this.maintainedPoolSize);
348
+ }, O = function(e, t) {
349
+ let o = T$1(this, n, k).call(this, e);
350
+ try {
351
+ t();
352
+ } catch (i) {
353
+ throw h(this, y).truncate(o), i;
354
+ }
355
+ }, k = function(e) {
356
+ let t = JSON.stringify(e), o = new TextEncoder().encode(`
357
+ ${t}`), i = h(this, y).getSize();
358
+ return h(this, y).write(o, { at: i }), h(this, S).add(h(this, y)), i;
359
+ }, w = function(e) {
360
+ return e.split("/").filter(Boolean);
361
+ }, f = function(e, t) {
362
+ let o = T$1(this, n, w).call(this, e), i = t || this.state.root;
363
+ for (let c of o) {
364
+ if (i.type !== "directory") throw new p("ENOTDIR", "Not a directory");
365
+ if (!Object.prototype.hasOwnProperty.call(i.children, c)) throw new p("ENOENT", "No such file or directory");
366
+ i = i.children[c];
367
+ }
368
+ return i;
369
+ }, I = function(e) {
370
+ let t = h(this, P).get(e);
371
+ if (!t) throw new p("EBADF", "Bad file descriptor");
372
+ return t;
373
+ }, W = function() {
374
+ let e = ++U(this, x)._;
375
+ for (; h(this, P).has(e);) U(this, x)._++;
376
+ return e;
377
+ }, j = async function(e, t) {
378
+ let o = T$1(this, n, w).call(this, e), i = t?.from || h(this, H);
379
+ for (let c of o) i = await i.getDirectoryHandle(c, { create: t?.create });
380
+ return i;
381
+ };
382
+ var p = class extends Error {
383
+ constructor(A, e) {
384
+ super(e), typeof A == "number" ? this.code = A : typeof A == "string" && (this.code = Ve[A]);
385
+ }
386
+ };
387
+ //#endregion
388
+ export { L as OpfsAhpFS };
@@ -0,0 +1,55 @@
1
+ import { i as __commonJSMin, r as require_token_error, t as require_token_util } from "./token-util-CktFFT4z.js";
2
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token.js
3
+ var require_token = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var token_exports = {};
25
+ __export(token_exports, { refreshToken: () => refreshToken });
26
+ module.exports = __toCommonJS(token_exports);
27
+ var import_token_error = require_token_error();
28
+ var import_token_util = require_token_util();
29
+ async function refreshToken(options) {
30
+ let projectId = options?.project;
31
+ let teamId = options?.team;
32
+ if (!projectId && !teamId) {
33
+ const projectInfo = (0, import_token_util.findProjectInfo)();
34
+ projectId = projectInfo.projectId;
35
+ teamId = projectInfo.teamId;
36
+ } else if (!projectId || !teamId) {
37
+ const projectInfo = (0, import_token_util.findProjectInfo)();
38
+ projectId = projectId ?? projectInfo.projectId;
39
+ teamId = teamId ?? projectInfo.teamId;
40
+ }
41
+ if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");
42
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
43
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token), options?.expirationBufferMs)) {
44
+ const authToken = await (0, import_token_util.getVercelToken)({ expirationBufferMs: options?.expirationBufferMs });
45
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
46
+ if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
47
+ (0, import_token_util.saveToken)(maybeToken, projectId);
48
+ }
49
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
50
+ }
51
+ 0 && (module.exports = { refreshToken });
52
+ }));
53
+ //#endregion
54
+ export default require_token();
55
+ export {};
@@ -0,0 +1,3 @@
1
+ import { t as require_token_util } from "./token-util-CktFFT4z.js";
2
+ export default require_token_util();
3
+ export {};