@expofp/loader 1.0.32 → 1.0.33

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/index.js CHANGED
@@ -1,27 +1,30 @@
1
- function F(e) {
2
- return i("assetResolver resolveRef:", e), u(e);
1
+ function k(e) {
2
+ return l("assetResolver resolveRef:", e), m(e);
3
3
  }
4
4
  const _ = {
5
5
  schema: "asset",
6
- resolveRef: async (e) => F(e),
6
+ resolveRef: async (e) => k(e),
7
7
  offlineMethod: "localizeRef"
8
- }, p = /* @__PURE__ */ new Map(), k = {
8
+ }, j = {
9
9
  schema: "bundle-assets",
10
10
  // canResolve(ref: string) {
11
11
  // return canResolveRefSchema(ref, SCHEMA_PREFIX_BASE);
12
12
  // },
13
- async resolveRef(e) {
14
- if (i("bundleAssetsResolver resolveRef:", e), p.has(e))
15
- return p.get(e);
16
- const t = u(e), n = fetch(t).then(async (o) => {
17
- if (!o.ok)
13
+ async resolveRef(e, t) {
14
+ var o, a;
15
+ if (l("bundleAssetsResolver resolveRef:", e), (o = t.refCache) != null && o.has(e))
16
+ return t.refCache.get(e);
17
+ const r = m(e), n = fetch(r).then(async (s) => {
18
+ var f;
19
+ if (!s.ok)
18
20
  throw new Error(`Failed to fetch ref from ${e}`);
19
- const r = await o.json(), s = t.substring(0, t.lastIndexOf("/") + 1), a = r.map((c) => ({
20
- $ref: `asset+${s}${c}`
21
+ (f = t.fetchCallback) == null || f.call(t, r);
22
+ const i = await s.json(), w = r.substring(0, r.lastIndexOf("/") + 1), c = i.map((u) => ({
23
+ $ref: `asset+${w}${u}`
21
24
  }));
22
- return l(a), a;
25
+ return d(c), c;
23
26
  });
24
- return p.set(e, n), n;
27
+ return (a = t.refCache) == null || a.set(e, n), n;
25
28
  },
26
29
  // async *makeOfflineRef(ref: string) {
27
30
  // log('bundleAssetsResolver makeOfflineRef:', ref);
@@ -52,37 +55,39 @@ const _ = {
52
55
  // yield { data, targetFilePath };
53
56
  // return { $ref: targetFilePath, [STOP_RESOLVING]: true };
54
57
  // },
55
- }, M = "https://efp-runtime.expofp.com/", m = /* @__PURE__ */ new Map(), T = {
58
+ }, F = "https://efp-runtime.expofp.com/", M = {
56
59
  schema: "expo-runtime-branch",
57
60
  // canResolve(ref: string) {
58
61
  // return canResolveRefSchema(ref, SCHEMA);
59
62
  // },
60
- async resolveRef(e) {
61
- if (i("expoRuntimeBranchResolver resolveRef:", e), m.has(e))
62
- return m.get(e);
63
- const t = u(e), n = new Promise(async (o, r) => {
63
+ async resolveRef(e, t) {
64
+ var o, a;
65
+ if (l("expoRuntimeBranchResolver resolveRef:", e), (o = t.refCache) != null && o.has(e))
66
+ return t.refCache.get(e);
67
+ const r = m(e), n = new Promise(async (s, i) => {
68
+ var w;
64
69
  try {
65
- const s = [`${M}branches/${t}.json`];
66
- let a;
67
- for (const d of s) {
68
- i("Fetching HTTP:", d);
69
- const f = await fetch(d);
70
- if (f.ok) {
71
- a = await f.json();
70
+ const c = [`${F}branches/${r}.json`];
71
+ let f;
72
+ for (const p of c) {
73
+ l("Fetching HTTP:", p);
74
+ const h = await fetch(p);
75
+ if (h.ok) {
76
+ (w = t.fetchCallback) == null || w.call(t, p), f = await h.json();
72
77
  break;
73
78
  }
74
79
  }
75
- if (!a)
80
+ if (!f)
76
81
  throw new Error(`Failed to fetch release from ${e}`);
77
- const c = {
78
- $ref: `expo-runtime+https://efp-runtime.expofp.com/releases/${a}/`
82
+ const u = {
83
+ $ref: `expo-runtime+https://efp-runtime.expofp.com/releases/${f}/`
79
84
  };
80
- l(c), o(c);
81
- } catch (s) {
82
- r(s);
85
+ d(u), s(u);
86
+ } catch (c) {
87
+ i(c);
83
88
  }
84
89
  });
85
- return m.set(e, n), n;
90
+ return (a = t.refCache) == null || a.set(e, n), n;
86
91
  },
87
92
  // async *makeOfflineRef(ref: string) {
88
93
  // log('expoRuntimeBranchResolver makeOfflineRef:', ref);
@@ -102,26 +107,29 @@ const _ = {
102
107
  // return targetFilePath;
103
108
  // },
104
109
  offlineMethod: "resolveRef"
105
- }, v = /* @__PURE__ */ new Map(), j = {
110
+ }, A = {
106
111
  schema: "expo-runtime-get-branch",
107
112
  // canResolve(ref: string) {
108
113
  // return canResolveRefSchema(ref, SCHEMA);
109
114
  // },
110
- async resolveRef(e) {
111
- if (i("expoRuntimeGetBranchResolver resolveRef:", e), v.has(e))
112
- return v.get(e);
113
- const t = u(e), n = `https://${t}.expofp.com/get-branch`;
114
- i("Fetching HTTP:", n);
115
- const o = fetch(n).then(async (r) => {
116
- if (!r.ok)
115
+ async resolveRef(e, t) {
116
+ var a, s;
117
+ if (l("expoRuntimeGetBranchResolver resolveRef:", e), (a = t.refCache) != null && a.has(e))
118
+ return t.refCache.get(e);
119
+ const r = m(e), n = `https://${r}.expofp.com/get-branch`;
120
+ l("Fetching HTTP:", n);
121
+ const o = fetch(n).then(async (i) => {
122
+ var u;
123
+ if (!i.ok)
117
124
  throw new Error(`Failed to fetch ref from ${e}`);
118
- const a = (await r.json()).branch;
119
- if (!a)
120
- throw new Error(`Invalid response when fetching branch for expo ${t}`);
121
- const c = { $ref: `expo-runtime-branch:${a}` };
122
- return l(c), c;
125
+ (u = t.fetchCallback) == null || u.call(t, n);
126
+ const c = (await i.json()).branch;
127
+ if (!c)
128
+ throw new Error(`Invalid response when fetching branch for expo ${r}`);
129
+ const f = { $ref: `expo-runtime-branch:${c}` };
130
+ return d(f), f;
123
131
  });
124
- return v.set(e, o), o;
132
+ return (s = t.refCache) == null || s.set(e, o), o;
125
133
  },
126
134
  // async *makeOfflineRef(ref: string) {
127
135
  // log('expoRuntimeBranchResolver makeOfflineRef:', ref);
@@ -141,18 +149,18 @@ const _ = {
141
149
  // return targetFilePath;
142
150
  // },
143
151
  offlineMethod: "resolveRef"
144
- }, A = {
152
+ }, T = {
145
153
  schema: "expo-runtime",
146
154
  // canResolve(ref: string) {
147
155
  // return canResolveRefSchema(ref, SCHEMA);
148
156
  // },
149
157
  async resolveRef(e) {
150
- i("expoRuntimeResolver resolveRef:", e);
151
- const t = u(e), n = {
158
+ l("expoRuntimeResolver resolveRef:", e);
159
+ const t = m(e), r = {
152
160
  entry: { $ref: `asset+${t}expofp.js` },
153
161
  assets: { $ref: `bundle-assets+${t}bundle.json` }
154
162
  };
155
- return l(n), n;
163
+ return d(r), r;
156
164
  },
157
165
  // async *makeOfflineRef(ref: string) {
158
166
  // log('expoRuntimeResolver makeOfflineRef:', ref);
@@ -172,22 +180,25 @@ const _ = {
172
180
  // return targetFilePath;
173
181
  // },
174
182
  offlineMethod: "resolveRef"
175
- }, y = /* @__PURE__ */ new Map(), C = {
183
+ }, B = {
176
184
  canResolve(e) {
177
185
  return e.startsWith("http://") || e.startsWith("https://") || e.startsWith("./");
178
186
  },
179
- async resolveRef(e) {
180
- if (i("httpResolver resolveRef:", e), !this.canResolve(e)) throw new Error(`Unexpected ref in httpResolver: ${e}`);
181
- if (y.has(e))
182
- return y.get(e);
183
- i("Fetching HTTP ref:", e);
184
- const t = fetch(e).then(async (n) => {
185
- if (!n.ok)
187
+ async resolveRef(e, t) {
188
+ var n, o;
189
+ if (l("httpResolver resolveRef:", e), !this.canResolve(e)) throw new Error(`Unexpected ref in httpResolver: ${e}`);
190
+ if ((n = t.refCache) != null && n.has(e))
191
+ return t.refCache.get(e);
192
+ l("Fetching HTTP ref:", e);
193
+ const r = fetch(e).then(async (a) => {
194
+ var i;
195
+ if (!a.ok)
186
196
  throw new Error(`Failed to fetch ref from ${e}`);
187
- const o = await n.json();
188
- return l(o), o;
197
+ (i = t.fetchCallback) == null || i.call(t, e);
198
+ const s = await a.json();
199
+ return d(s), s;
189
200
  });
190
- return y.set(e, t), t;
201
+ return (o = t.refCache) == null || o.set(e, r), r;
191
202
  },
192
203
  // async *makeOfflineRef(ref) {
193
204
  // log('httpResolver makeOfflineRef:', ref);
@@ -208,33 +219,33 @@ const _ = {
208
219
  // },
209
220
  offlineMethod: "resolveRef"
210
221
  };
211
- async function R(e, t = {}) {
212
- const { globalVar: n, timeoutMs: o = 1e4, pollIntervalMs: r = 10 } = t;
213
- I() ? (await B(e), n && await b(() => window[n], n, o, r)) : (await N(e), n && await b(
214
- () => globalThis[n],
222
+ async function g(e, t = {}) {
223
+ const { globalVar: r, timeoutMs: n = 1e4, pollIntervalMs: o = 10 } = t;
224
+ N() ? (await P(e), r && await R(() => window[r], r, n, o)) : (await S(e), r && await R(
225
+ () => globalThis[r],
226
+ r,
215
227
  n,
216
- o,
217
- r
228
+ o
218
229
  ));
219
230
  }
220
- function I() {
231
+ function N() {
221
232
  return typeof window < "u" && typeof document < "u";
222
233
  }
223
- function B(e) {
224
- return new Promise((t, n) => {
225
- const o = document.createElement("script");
226
- o.src = e, o.async = !0;
227
- const r = () => {
228
- o.onload = null, o.onerror = null;
234
+ function P(e) {
235
+ return new Promise((t, r) => {
236
+ const n = document.createElement("script");
237
+ n.src = e, n.async = !0;
238
+ const o = () => {
239
+ n.onload = null, n.onerror = null;
229
240
  };
230
- o.onload = () => {
231
- r(), t();
232
- }, o.onerror = () => {
233
- r(), n(new Error(`Failed to load script: ${e}`));
234
- }, document.head.appendChild(o);
241
+ n.onload = () => {
242
+ o(), t();
243
+ }, n.onerror = () => {
244
+ o(), r(new Error(`Failed to load script: ${e}`));
245
+ }, document.head.appendChild(n);
235
246
  });
236
247
  }
237
- async function N(e) {
248
+ async function S(e) {
238
249
  if (typeof fetch != "function")
239
250
  throw new Error(
240
251
  "loadAndWaitGlobal: fetch is not available. Use Node 18+ or provide a global fetch."
@@ -242,251 +253,312 @@ async function N(e) {
242
253
  const t = await fetch(e);
243
254
  if (!t.ok)
244
255
  throw new Error(`Failed to load script in Node (HTTP ${t.status}): ${e}`);
245
- const n = await t.text();
246
- (0, eval)(n);
256
+ const r = await t.text();
257
+ (0, eval)(r);
247
258
  }
248
- function b(e, t, n, o) {
249
- return new Promise((r, s) => {
250
- const a = performance.now(), c = () => {
259
+ function R(e, t, r, n) {
260
+ return new Promise((o, a) => {
261
+ const s = performance.now(), i = () => {
251
262
  try {
252
263
  if (e() !== void 0)
253
- return r();
264
+ return o();
254
265
  } catch {
255
266
  }
256
- if (performance.now() - a >= n)
257
- return s(new Error(`Timed out after ${n} ms waiting for global "${t}"`));
258
- setTimeout(c, o);
267
+ if (performance.now() - s >= r)
268
+ return a(new Error(`Timed out after ${r} ms waiting for global "${t}"`));
269
+ setTimeout(i, n);
259
270
  };
260
- c();
271
+ i();
261
272
  });
262
273
  }
263
- const $ = /* @__PURE__ */ new Map(), S = {
274
+ const W = {
264
275
  schema: "legacy-data",
265
276
  // canResolve: (ref: string) => canResolveRefSchema(ref, 'legacy-data-js'),
266
- async resolveRef(e) {
267
- if (i("legacyDataResolver resolveRef:", e), $.has(e))
268
- return $.get(e);
269
- const t = (async () => {
270
- const n = u(e);
277
+ async resolveRef(e, t) {
278
+ var n, o;
279
+ if (l("legacyDataResolver resolveRef:", e), (n = t.refCache) != null && n.has(e))
280
+ return t.refCache.get(e);
281
+ const r = (async () => {
282
+ const a = m(e);
271
283
  try {
272
- await R(`${n}version.js`);
284
+ await g(`${a}version.js`);
273
285
  } catch {
274
286
  console.warn("Could not load version.js, proceeding without it");
275
287
  }
276
- const o = globalThis.__fpDataVersion || (+/* @__PURE__ */ new Date()).toString();
277
- let r = [];
288
+ const s = globalThis.__fpDataVersion || (+/* @__PURE__ */ new Date()).toString();
289
+ let i = [];
278
290
  await Promise.all([
279
291
  (async function() {
280
- const h = await fetch(`${n}files.json?v=${o}`);
281
- if (h.ok) r = await h.json();
292
+ const h = await fetch(`${a}files.json?v=${s}`);
293
+ if (h.ok) i = await h.json();
282
294
  else
283
- throw new Error(`Could not load files.json from ${n}files.json?v=${o}`);
295
+ throw new Error(`Could not load files.json from ${a}files.json?v=${s}`);
284
296
  })(),
285
- R(`${n}data.js?v=${o}`, { globalVar: "__data" })
297
+ g(`${a}data.js?v=${s}`, { globalVar: "__data" })
286
298
  // injectAndWaitForGlobal(`${dataUrlBase}data.js?v=${version}`, '__data'),
287
299
  // injectAndWaitForGlobal(`${dataUrlBase}fp.svg.js?v=${version}`, '__fp'),
288
300
  ]);
289
- const s = globalThis.__data || {}, c = [...r, "data.js"].reduce((f, h) => (f[h] = { $ref: `asset+${n}${h}?v=${o}` }, f), {}), d = {
290
- _to_remove_for_offline_to_work_dataUrlBase: n,
301
+ const w = globalThis.__data || {}, f = [...i, "data.js"].reduce((p, h) => (p[h] = { $ref: `asset+${a}${h}?v=${s}` }, p), {}), u = {
302
+ _to_remove_for_offline_to_work_dataUrlBase: a,
291
303
  // dataFiles: dataFiles.reduce((map, file) => {
292
304
  // map[file] = { $ref: `asset+${dataUrlBase}${file}?v=${version}` };
293
305
  // return map;
294
306
  // }, {} as Record<string, { $ref: string }>),
295
- legacyAssetUrls: { ...c, ...W(n, s) }
307
+ legacyAssetUrls: { ...f, ...D(a, w) }
296
308
  };
297
- return l(d), d;
309
+ return d(u), u;
298
310
  })();
299
- return $.set(e, t), t;
311
+ return (o = t.refCache) == null || o.set(e, r), r;
300
312
  },
301
313
  offlineMethod: "resolveRef"
302
314
  };
303
- function W(e, t) {
304
- const n = /* @__PURE__ */ new Set();
305
- function o(r) {
306
- typeof r == "string" && r.length > 0 && n.add(r);
315
+ function D(e, t) {
316
+ const r = /* @__PURE__ */ new Set();
317
+ function n(o) {
318
+ typeof o == "string" && o.length > 0 && r.add(o);
307
319
  }
308
- return o(t.logo), t.exhibitors.forEach((r) => {
309
- var s;
310
- o(r.logo), (s = r.gallery) == null || s.forEach((a) => o(a));
311
- }), t.events.forEach((r) => {
312
- var s;
313
- o(r.logoFile), (s = r.speakers) == null || s.forEach((a) => {
314
- o(a.photoFile);
320
+ return n(t.logo), t.exhibitors.forEach((o) => {
321
+ var a;
322
+ n(o.logo), (a = o.gallery) == null || a.forEach((s) => n(s));
323
+ }), t.events.forEach((o) => {
324
+ var a;
325
+ n(o.logoFile), (a = o.speakers) == null || a.forEach((s) => {
326
+ n(s.photoFile);
315
327
  });
316
- }), Array.from(n).reduce((r, s) => (r[s] = { $ref: `asset+${e}${s}` }, r), {});
328
+ }), Array.from(r).reduce((o, a) => (o[a] = { $ref: `asset+${e}${a}` }, o), {});
317
329
  }
318
- const D = [
319
- C,
320
- k,
330
+ const I = [
331
+ B,
332
+ j,
321
333
  _,
322
- A,
323
334
  T,
324
- j,
335
+ M,
336
+ A,
325
337
  // expoResolver,
326
- S
327
- ];
328
- async function x(e, t) {
329
- if (i("Resolving:", t), typeof t != "string")
338
+ W
339
+ ], U = /* @__PURE__ */ new Map();
340
+ async function b(e, t, r) {
341
+ l("Resolving:", t), typeof window < "u" && (window.__lastResolveObject = e);
342
+ let n;
343
+ !r || r.refCache === "global" ? n = U : (r == null ? void 0 : r.refCache) === "temp" ? n = /* @__PURE__ */ new Map() : (r == null ? void 0 : r.refCache) === "disable" ? n = void 0 : n = r == null ? void 0 : r.refCache;
344
+ const o = {
345
+ refCache: n,
346
+ fetchCallback: r == null ? void 0 : r.fetchCallback
347
+ };
348
+ if (typeof t != "string")
330
349
  throw new Error(`Invalid JSON Pointer (not a string): ${t}`);
331
350
  if (!t.startsWith("/"))
332
351
  throw new Error(`Invalid JSON Pointer: ${t}`);
333
352
  if (t.length > 1 && t.endsWith("/"))
334
353
  throw new Error(`Invalid JSON Pointer: ${t}`);
335
- if (t === "/")
336
- return await g(e);
337
- const n = t.substring(1).split("/");
338
- if (n.some((r) => r.length === 0))
354
+ let a;
355
+ if (t === "/" ? a = [] : a = t.substring(1).split("/"), a.some((s) => s.length === 0))
339
356
  throw new Error(`Invalid JSON Pointer (empty part): ${t}`);
340
- const o = await P(e, n);
341
- return i(`Resolved ${t}:`, o), o;
357
+ if (r != null && r.mutate) {
358
+ a.unshift("root");
359
+ const s = { root: e };
360
+ await E(
361
+ s,
362
+ // 'root',
363
+ a,
364
+ 0,
365
+ o
366
+ ), V(e, s.root);
367
+ } else
368
+ return await C(e, a, 0, o);
342
369
  }
343
- typeof window < "u" && (window.__debugResolve = x);
344
- async function P(e, t) {
345
- let n = 0, o = await g(e);
346
- for (; n < t.length; ) {
347
- const r = t[n];
348
- if (typeof o != "object" || o === null)
370
+ async function E(e, t, r, n) {
371
+ const o = t[r];
372
+ if (await z(e, o, n), r != t.length - 1) {
373
+ if (e[o] === null || typeof e[o] != "object")
349
374
  throw new Error(
350
375
  `Cannot resolve path, encountered non-object at part '${t.join(
351
376
  "/"
352
- )}, index ${n}'`
377
+ )}', index ${r}'`
353
378
  );
354
- const s = o[r];
355
- o = await g(s), n++;
379
+ return await E(e[o], t, r + 1, n);
356
380
  }
357
- return o;
358
381
  }
359
- async function g(e) {
360
- i("resolveObject:", e);
361
- let t = e;
382
+ async function z(e, t, r) {
383
+ l("resolveObjectMutate:", e, t);
384
+ let n = e[t];
385
+ const o = await y(n, r);
386
+ o !== void 0 && (e[t] = o);
387
+ }
388
+ async function C(e, t, r, n) {
389
+ if (r === t.length)
390
+ return await y(e, n);
391
+ if (e === null || typeof e != "object")
392
+ throw new Error(
393
+ `Cannot resolve path, encountered non-object at part '${t.join("/")}', index ${r}'`
394
+ );
395
+ const o = t[r];
396
+ let a = e[o];
397
+ return a === void 0 && (a = (await y(e, n))[o]), await C(a, t, r + 1, n);
398
+ }
399
+ async function y(e, t) {
400
+ l("resolveObject:", e);
401
+ let r = e;
362
402
  do {
363
- if (typeof t != "object" || t === null || !("$ref" in t))
364
- return t;
365
- const n = D.filter((r) => O(r, t.$ref));
403
+ if (typeof r != "object" || r === null || !("$ref" in r))
404
+ return r;
405
+ const n = I.filter((a) => O(a, r.$ref));
366
406
  if (n.length === 0) {
367
- if (t.$ref)
368
- throw new Error(`No resolver found for ref: ${t.$ref}`);
369
- return l(t), t;
407
+ if (r.$ref)
408
+ throw new Error(`No resolver found for ref: ${r.$ref}`);
409
+ return d(r), r;
370
410
  }
371
411
  if (n.length > 1)
372
- throw new Error(`Multiple resolvers can resolve ref: ${t.$ref}`);
373
- const o = await U(n[0], t.$ref);
374
- t = H(o, t);
412
+ throw new Error(`Multiple resolvers can resolve ref: ${r.$ref}`);
413
+ const o = await J(n[0], r.$ref, t);
414
+ r = L(o, r);
375
415
  } while (!0);
376
416
  }
377
- async function U(e, t) {
417
+ async function J(e, t, r) {
378
418
  if (!O(e, t))
379
419
  throw new Error(`Unexpected ref: ${t}`);
380
- return e.resolveRef(t);
420
+ return e.resolveRef(t, r);
381
421
  }
382
422
  function O(e, t) {
383
423
  if (e.canResolve)
384
424
  return e.canResolve(t);
385
425
  if (e.schema)
386
- return z(t, e.schema);
426
+ return H(t, e.schema);
387
427
  throw new Error("Resolver is missing canResolve method and schema property");
388
428
  }
389
- function z(e, t) {
390
- const n = [`${t}+`, `${t}:`];
391
- for (const o of n)
392
- if (e.startsWith(o))
429
+ function H(e, t) {
430
+ const r = [`${t}+`, `${t}:`];
431
+ for (const n of r)
432
+ if (e.startsWith(n))
393
433
  return !0;
394
434
  return !1;
395
435
  }
396
- function u(e) {
436
+ function m(e) {
397
437
  if (e.startsWith("http://") || e.startsWith("https://"))
398
438
  return e;
399
- const t = e.indexOf("+http://"), n = e.indexOf("+https://");
439
+ const t = e.indexOf("+http://"), r = e.indexOf("+https://");
400
440
  if (t !== -1)
401
441
  return e.substring(t + 1);
442
+ if (r !== -1)
443
+ return e.substring(r + 1);
444
+ const n = e.indexOf(":");
402
445
  if (n !== -1)
403
446
  return e.substring(n + 1);
404
- const o = e.indexOf(":");
405
- if (o !== -1)
406
- return e.substring(o + 1);
407
447
  throw new Error(`Error getting URL from: ${e}, no valid prefix found`);
408
448
  }
409
- function w(e) {
410
- return async (t, ...n) => {
449
+ typeof window < "u" && (window.__debugResolve = async function(t, r, n) {
450
+ let o, a, s;
451
+ return typeof t == "string" ? (o = window.__lastResolveObject, a = t, s = r) : (o = t, a = r, s = n), await b(o, a, s);
452
+ });
453
+ function v(e) {
454
+ return async (t, ...r) => {
411
455
  try {
412
- const s = (await import(await x(t, "/runtime/entry")))[e];
413
- return s(t, ...n);
414
- } catch (o) {
415
- throw console.error("efp-loader", `Error when trying to import and call "${e}":`, o), o;
456
+ const a = (await import(await b(t, "/runtime/entry")))[e];
457
+ return a(t, ...r);
458
+ } catch (n) {
459
+ throw console.error("efp-loader", `Error when trying to import and call "${e}":`, n), n;
416
460
  }
417
461
  };
418
462
  }
419
- function i(...e) {
463
+ function l(...e) {
420
464
  console.debug("efp-loader", ...e);
421
465
  }
422
- function l(e) {
466
+ function d(e) {
423
467
  if (e === null || typeof e != "object") return e;
424
468
  Object.freeze(e);
425
469
  for (const t of Object.keys(e)) {
426
- const n = e[t];
427
- typeof n == "object" && n !== null && !Object.isFrozen(n) && l(n);
470
+ const r = e[t];
471
+ typeof r == "object" && r !== null && !Object.isFrozen(r) && d(r);
428
472
  }
429
473
  return e;
430
474
  }
431
- function E(e) {
475
+ function $(e) {
432
476
  return "structuredClone" in globalThis ? globalThis.structuredClone(e) : JSON.parse(JSON.stringify(e));
433
477
  }
434
- function J(e) {
478
+ function G(e) {
435
479
  if (typeof document > "u") return;
436
480
  const t = document.createElement("link");
437
481
  t.rel = "preconnect", t.href = e, t.crossOrigin = "anonymous", document.head.appendChild(t);
438
482
  }
439
- function H(e, t) {
483
+ function L(e, t) {
440
484
  if (e === t) return;
441
485
  if (t === null || typeof t != "object")
442
486
  throw new Error("Cannot merge non-object source");
443
487
  if (Array.isArray(t))
444
488
  throw new Error("Cannot merge arrays");
445
- const n = Object.keys(t).filter((r) => r !== "$ref");
446
- if (n.length === 0) return E(e);
489
+ const r = Object.keys(t).filter((o) => o !== "$ref");
490
+ if (r.length === 0) return $(e);
447
491
  if (Array.isArray(e))
448
492
  throw new Error("Cannot merge into arrays");
449
493
  if (e === null || typeof e != "object")
450
494
  throw new Error("Cannot merge into non-object target");
451
- const o = E({ ...e });
452
- for (const r of n)
453
- o[r] = t[r];
454
- return o;
495
+ const n = $({ ...e });
496
+ for (const o of r)
497
+ n[o] = t[o];
498
+ return n;
499
+ }
500
+ function V(e, t) {
501
+ if (e !== t) {
502
+ if (t === null || typeof t != "object")
503
+ throw new Error("Cannot replace with non-object source");
504
+ if (e === null || typeof e != "object")
505
+ throw new Error("Cannot replace non-object target");
506
+ if (Array.isArray(e)) {
507
+ if (!Array.isArray(t))
508
+ throw new Error("replaceObjectFields does not support mixing arrays and objects");
509
+ e.length = 0;
510
+ for (const r of t)
511
+ e.push(r);
512
+ return;
513
+ }
514
+ for (const r of Object.keys(e))
515
+ r in t || delete e[r];
516
+ for (const r of Object.keys(t))
517
+ e[r] = t[r];
518
+ }
519
+ }
520
+ async function Z(e, t, r) {
521
+ if (r || (r = { refCache: /* @__PURE__ */ new Map(), mutate: !0 }), !r.mutate)
522
+ throw new Error("resolveContext.mutate must be true for mutateManifest");
523
+ for (const n of t)
524
+ await b(e, n, r);
455
525
  }
456
- async function G(e) {
457
- const { makeOfflineBundle: t } = await import("./makeOfflineBundle-CDWAdTIW.js");
526
+ typeof window < "u" && (window.__debugMutateManifest = Z);
527
+ async function K(e) {
528
+ const { makeOfflineBundle: t } = await import("./makeOfflineBundle-BXfViegK.js");
458
529
  return await t(e);
459
530
  }
460
- async function L(e) {
461
- const { downloadZip: t } = await import("./downloadZip-DwDnK9eb.js");
531
+ async function q(e) {
532
+ const { downloadZip: t } = await import("./downloadZip-CKCMYGtc.js");
462
533
  return await t(e);
463
534
  }
464
- async function V(e) {
465
- const { makeOffline: t } = await import("./makeOffline-bamiAsgC.js"), n = await t(e);
466
- for await (const o of (await n).files)
467
- "data" in o ? console.info(`🗳️ Put ${o.targetFilePath} <=`, o.data) : "url" in o && console.info(`🗳️ Download ${o.targetFilePath} <= ${o.url}`);
468
- console.info("Offline data: ", n.manifest);
535
+ async function Q(e) {
536
+ const { makeOffline: t } = await import("./makeOffline-CttQujH7.js"), r = await t(e);
537
+ for await (const n of (await r).files)
538
+ "data" in n ? console.info(`🗳️ Put ${n.targetFilePath} <=`, n.data) : "url" in n && console.info(`🗳️ Download ${n.targetFilePath} <= ${n.url}`);
539
+ console.info("Offline data: ", r.manifest);
469
540
  }
470
- typeof window < "u" && (window.__debugDownloadZip = L, window.__debugMakeOfflineBundle = G, window.__debugLogOfflineManifestFiles = V);
471
- const Z = w("mount"), K = w("load"), q = w("initialize");
472
- async function Q(e, t, ...n) {
473
- return await w(e)(t, ...n);
541
+ typeof window < "u" && (window.__debugDownloadZip = q, window.__debugMakeOfflineBundle = K, window.__debugLogOfflineManifestFiles = Q);
542
+ const X = v("mount"), Y = v("load"), x = v("initialize");
543
+ async function ee(e, t, ...r) {
544
+ return await v(e)(t, ...r);
474
545
  }
475
- J("https://efp-runtime.expofp.com/");
546
+ G("https://efp-runtime.expofp.com/");
476
547
  export {
477
- H as a,
478
- U as b,
548
+ L as a,
549
+ J as b,
479
550
  O as c,
480
- Q as callFunction_Experimental,
481
- E as d,
482
- L as downloadZip,
483
- q as initialize,
484
- i as l,
485
- K as load,
486
- G as makeOfflineBundle,
487
- Z as mount,
488
- u as p,
489
- D as r,
490
- x as resolve
551
+ ee as callFunction_Experimental,
552
+ $ as d,
553
+ q as downloadZip,
554
+ x as initialize,
555
+ l,
556
+ Y as load,
557
+ K as makeOfflineBundle,
558
+ X as mount,
559
+ Z as mutateManifest,
560
+ m as p,
561
+ I as r,
562
+ b as resolve
491
563
  };
492
564
  //# sourceMappingURL=index.js.map