@expofp/loader 1.0.44 → 1.0.46

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