@expofp/loader 1.0.44 → 1.0.45

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 U(e) {
2
+ return i("assetResolver resolveRef:", e), l(e);
3
3
  }
4
- const D = {
4
+ const J = {
5
5
  schema: "asset",
6
- resolveRef: async (e) => T(e),
6
+ resolveRef: async (e) => U(e),
7
7
  offlineMethod: "localizeRef"
8
- }, B = {
8
+ };
9
+ let d;
10
+ const B = /* @__PURE__ */ new WeakSet(), E = new Function("url", 'return import(url, { with: { type: "json" } });');
11
+ async function f(e, t) {
12
+ if (d === void 0)
13
+ try {
14
+ await E(e), d = !1;
15
+ } catch {
16
+ i("importJson: dynamic import not available, falling back to fetch"), d = !0;
17
+ }
18
+ let n;
19
+ return d ? (i("importJson: fetch", e), n = await N(e), t == null || t(e, "fetch")) : (n = (await E(e)).default, t == null || t(e, "module")), B.has(n) || u(n), n;
20
+ }
21
+ const p = /* @__PURE__ */ new Map();
22
+ async function N(e) {
23
+ if (p.has(e))
24
+ return p.get(e);
25
+ const t = (async function() {
26
+ const o = await fetch(e);
27
+ if (!o.ok)
28
+ throw new Error(`Failed to fetch JSON from ${e}`);
29
+ return await o.json();
30
+ })();
31
+ return p.set(e, t), t;
32
+ }
33
+ const v = /* @__PURE__ */ new Map();
34
+ async function h(e, t) {
35
+ if (v.has(e))
36
+ return v.get(e);
37
+ const n = t().then((o) => (u(o), o));
38
+ return v.set(e, n), n;
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, async () => {
46
+ const o = await f(n, t.importCallback), r = n.substring(0, n.lastIndexOf("/") + 1);
47
+ return o.map((a) => ({
48
+ $ref: `asset+${r}${a}`
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
+ }, S = "https://efp-runtime.expofp.com/", D = {
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), o = `${S}branches/${n}.json`;
58
+ return h(e, async () => ({
59
+ $ref: `expo-runtime+https://efp-runtime.expofp.com/releases/${await f(o, t.importCallback)}/`
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
+ }, W = {
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 o = `https://${l(e)}.expofp.com/get-branch`;
68
+ return f(o, t.importCallback);
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
+ }, P = {
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
+ }, I = {
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.importCallback);
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: o = 1e4, pollIntervalMs: r = 10 } = t;
114
+ z() ? (await L(e), n && await O(() => window[n], n, o, r)) : (await G(e), n && await O(
115
+ () => globalThis[n],
210
116
  n,
211
- o
117
+ o,
118
+ r
212
119
  ));
213
120
  }
214
- function I() {
121
+ function z() {
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;
221
- const o = () => {
222
- n.onload = null, n.onerror = null;
124
+ function L(e) {
125
+ return new Promise((t, n) => {
126
+ const o = document.createElement("script");
127
+ o.src = e, o.async = !0;
128
+ const r = () => {
129
+ o.onload = null, o.onerror = null;
223
130
  };
224
- n.onload = () => {
225
- o(), t();
226
- }, n.onerror = () => {
227
- o(), r(new Error(`Failed to load script: ${e}`));
228
- }, document.head.appendChild(n);
131
+ o.onload = () => {
132
+ r(), t();
133
+ }, o.onerror = () => {
134
+ r(), n(new Error(`Failed to load script: ${e}`));
135
+ }, document.head.appendChild(o);
229
136
  });
230
137
  }
231
- async function z(e) {
138
+ async function G(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,84 @@ 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) {
243
- return new Promise((o, a) => {
244
- const s = Date.now(), i = () => {
149
+ function O(e, t, n, o) {
150
+ return new Promise((r, s) => {
151
+ const a = Date.now(), c = () => {
245
152
  try {
246
153
  if (e() !== void 0)
247
- return l(`loadAndWaitGlobal: global "${t}" is now available`), o();
154
+ return r();
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() - a >= n)
158
+ return s(new Error(`Timed out after ${n} ms waiting for global "${t}"`));
159
+ setTimeout(c, o);
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 V = {
165
+ schema: "legacy-asset-urls",
166
+ resolveRef(e, t) {
167
+ return i("legacyAssetUrlsResolver resolveRef:", e), h(e, async () => {
168
+ var R, g;
169
+ const n = l(e), o = `${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 _(o, { globalVar: "__fpDataVersion", timeoutMs: 3e4 }), (R = t.importCallback) == null || R.call(t, o, "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 ${o}, 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 r = globalThis.__fpDataVersion || (+/* @__PURE__ */ new Date()).toString(), s = `${n}files.json?v=${r}`, a = `${n}data.js?v=${r}`, c = f(s, t.importCallback), k = _(a, { globalVar: "__data" });
176
+ (g = t.importCallback) == null || g.call(t, a, "script"), await Promise.all([c, k]);
177
+ const x = await c, C = globalThis.__data || {};
178
+ return { ...[...x, "data.js"].reduce((b, $) => (b[$] = { $ref: `asset+${n}${$}?v=${r}` }, b), {}), ...Z(n, C) };
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 Z(e, t) {
184
+ const n = /* @__PURE__ */ new Set();
185
+ function o(r) {
186
+ typeof r == "string" && r.length > 0 && n.add(r);
305
187
  }
306
- return n(t.logo), t.exhibitors.forEach((o) => {
307
- var a;
308
- n(o.logo), (a = o.gallery) == null || a.forEach((s) => n(s));
309
- }), t.events.forEach((o) => {
310
- var a;
311
- n(o.logoFile), (a = o.speakers) == null || a.forEach((s) => {
312
- n(s.photoFile);
188
+ return o(t.logo), t.exhibitors.forEach((r) => {
189
+ var s;
190
+ o(r.logo), (s = r.gallery) == null || s.forEach((a) => o(a));
191
+ }), t.events.forEach((r) => {
192
+ var s;
193
+ o(r.logoFile), (s = r.speakers) == null || s.forEach((a) => {
194
+ o(a.photoFile);
313
195
  });
314
- }), Array.from(r).reduce((o, a) => (o[a] = { $ref: `asset+${e}${a}` }, o), {});
196
+ }), Array.from(n).reduce((r, s) => (r[s] = { $ref: `asset+${e}${s}` }, r), {});
315
197
  }
316
- const L = [
317
- S,
318
- B,
198
+ const H = {
199
+ schema: "legacy-data",
200
+ resolveRef(e) {
201
+ return i("legacyDataResolver resolveRef:", e), h(e, async () => {
202
+ const t = l(e);
203
+ return {
204
+ _to_remove_for_offline_to_work_dataUrlBase: t,
205
+ legacyAssetUrls: { $ref: `legacy-asset-urls+${t}` }
206
+ };
207
+ });
208
+ },
209
+ offlineMethod: "resolveRef"
210
+ }, K = [
211
+ I,
212
+ T,
213
+ J,
214
+ P,
319
215
  D,
320
- N,
321
216
  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;
217
+ H,
218
+ V
219
+ ];
220
+ async function m(e, t, n) {
221
+ i("Resolving:", t), typeof window < "u" && (window.__lastResolveObject = e);
330
222
  const o = {
331
- refCache: n,
332
- fetchCallback: r == null ? void 0 : r.fetchCallback
223
+ importCallback: n == null ? void 0 : n.importCallback
333
224
  };
334
225
  if (typeof t != "string")
335
226
  throw new Error(`Invalid JSON Pointer (not a string): ${t}`);
@@ -337,145 +228,145 @@ async function $(e, t, r) {
337
228
  throw new Error(`Invalid JSON Pointer: ${t}`);
338
229
  if (t.length > 1 && t.endsWith("/"))
339
230
  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))
231
+ let r;
232
+ if (t === "/" ? r = [] : r = t.substring(1).split("/"), r.some((s) => s.length === 0))
342
233
  throw new Error(`Invalid JSON Pointer (empty part): ${t}`);
343
- if (r != null && r.mutate) {
344
- a.unshift("root");
234
+ if (n != null && n.mutate) {
235
+ r.unshift("root");
345
236
  const s = { root: e };
346
- await F(s, a, 0, o), Y(e, s.root);
237
+ await A(s, r, 0, o), te(e, s.root);
347
238
  } else
348
- return await M(e, a, 0, o);
239
+ return await F(e, r, 0, o);
349
240
  }
350
- async function F(e, t, r, n) {
351
- const o = t[r];
352
- if (await Z(e, o, n), r != t.length - 1) {
353
- if (e[o] === null || typeof e[o] != "object")
241
+ async function A(e, t, n, o) {
242
+ const r = t[n];
243
+ if (await q(e, r, o), n != t.length - 1) {
244
+ if (e[r] === null || typeof e[r] != "object")
354
245
  throw new Error(
355
- `Cannot resolve path, encountered non-object at part '${t.slice(1).join("/")}', index ${r - 1}'`
246
+ `Cannot resolve path, encountered non-object at part '${t.slice(1).join("/")}', index ${n - 1}'`
356
247
  );
357
- return await F(e[o], t, r + 1, n);
248
+ return await A(e[r], t, n + 1, o);
358
249
  }
359
250
  }
360
- async function Z(e, t, r) {
361
- l("resolveObjectMutate:", e, t);
362
- let n = e[t];
363
- const o = await g(n, r);
364
- o !== void 0 && (e[t] = o);
251
+ async function q(e, t, n) {
252
+ i("resolveObjectMutate:", e, t);
253
+ let o = e[t];
254
+ const r = await y(o, n);
255
+ r !== void 0 && (e[t] = r);
365
256
  }
366
- async function M(e, t, r, n) {
367
- if (r === t.length)
368
- return await g(e, n);
257
+ async function F(e, t, n, o) {
258
+ if (n === t.length)
259
+ return await y(e, o);
369
260
  if (e === null || typeof e != "object")
370
261
  throw new Error(
371
- `Cannot resolve path, encountered non-object at part '${t.join("/")}', index ${r}'`
262
+ `Cannot resolve path, encountered non-object at part '${t.join("/")}', index ${n}'`
372
263
  );
373
- const o = t[r];
374
- let a = e[o];
375
- return a === void 0 && (a = (await g(e, n))[o]), await M(a, t, r + 1, n);
264
+ const r = t[n];
265
+ let s = e[r];
266
+ return s === void 0 && (s = (await y(e, o))[r]), await F(s, t, n + 1, o);
376
267
  }
377
- async function g(e, t) {
378
- l("resolveObject:", e);
379
- let r = e;
268
+ async function y(e, t) {
269
+ i("resolveObject:", e);
270
+ let n = e;
380
271
  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;
272
+ if (typeof n != "object" || n === null || !("$ref" in n))
273
+ return n;
274
+ const o = K.filter((s) => j(s, n.$ref));
275
+ if (o.length === 0) {
276
+ if (n.$ref)
277
+ throw new Error(`No resolver found for ref: ${n.$ref}`);
278
+ return u(n), n;
388
279
  }
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);
280
+ if (o.length > 1)
281
+ throw new Error(`Multiple resolvers can resolve ref: ${n.$ref}`);
282
+ const r = await Q(o[0], n.$ref, t);
283
+ n = ee(r, n);
393
284
  } while (!0);
394
285
  }
395
- async function K(e, t, r) {
396
- if (!A(e, t))
286
+ async function Q(e, t, n) {
287
+ if (!j(e, t))
397
288
  throw new Error(`Unexpected ref: ${t}`);
398
- return e.resolveRef(t, r);
289
+ return e.resolveRef(t, n);
399
290
  }
400
- function A(e, t) {
291
+ function j(e, t) {
401
292
  if (e.canResolve)
402
293
  return e.canResolve(t);
403
294
  if (e.schema)
404
- return q(t, e.schema);
295
+ return X(t, e.schema);
405
296
  throw new Error("Resolver is missing canResolve method and schema property");
406
297
  }
407
- function q(e, t) {
408
- const r = [`${t}+`, `${t}:`];
409
- for (const n of r)
410
- if (e.startsWith(n))
298
+ function X(e, t) {
299
+ const n = [`${t}+`, `${t}:`];
300
+ for (const o of n)
301
+ if (e.startsWith(o))
411
302
  return !0;
412
303
  return !1;
413
304
  }
414
- function w(e) {
305
+ function l(e) {
415
306
  if (e.startsWith("http://") || e.startsWith("https://"))
416
307
  return e;
417
- const t = e.indexOf("+http://"), r = e.indexOf("+https://");
308
+ const t = e.indexOf("+http://"), n = e.indexOf("+https://");
418
309
  if (t !== -1)
419
310
  return e.substring(t + 1);
420
- if (r !== -1)
421
- return e.substring(r + 1);
422
- const n = e.indexOf(":");
423
311
  if (n !== -1)
424
312
  return e.substring(n + 1);
313
+ const o = e.indexOf(":");
314
+ if (o !== -1)
315
+ return e.substring(o + 1);
425
316
  throw new Error(`Error getting URL from: ${e}, no valid prefix found`);
426
317
  }
427
- typeof window < "u" && (window.__debugResolve = async function(t, r, n) {
428
- 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);
318
+ typeof window < "u" && (window.__debugResolve = async function(t, n, o) {
319
+ let r, s, a;
320
+ return typeof t == "string" ? (r = window.__lastResolveObject, s = t, a = n) : (r = t, s = n, a = o), await m(r, s, a);
430
321
  });
431
- function y(e) {
432
- return async (t, ...r) => {
322
+ function w(e) {
323
+ return async (t, ...n) => {
433
324
  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;
325
+ const s = (await import(await m(t, "/runtime/entry")))[e];
326
+ return s(t, ...n);
327
+ } catch (o) {
328
+ throw console.error("efp-loader", `Error when trying to import and call "${e}":`, o), o;
438
329
  }
439
330
  };
440
331
  }
441
- function l(...e) {
332
+ function i(...e) {
442
333
  globalThis.__EFP_LOADER_DEBUG__ && console.debug("efp-loader", ...e);
443
334
  }
444
- function d(e) {
335
+ function u(e) {
445
336
  if (e === null || typeof e != "object") return e;
446
337
  Object.freeze(e);
447
338
  for (const t of Object.keys(e)) {
448
- const r = e[t];
449
- typeof r == "object" && r !== null && !Object.isFrozen(r) && d(r);
339
+ const n = e[t];
340
+ typeof n == "object" && n !== null && !Object.isFrozen(n) && u(n);
450
341
  }
451
342
  return e;
452
343
  }
453
- function j(e) {
344
+ function M(e) {
454
345
  return "structuredClone" in globalThis ? globalThis.structuredClone(e) : JSON.parse(JSON.stringify(e));
455
346
  }
456
- function Q(e) {
347
+ function Y(e) {
457
348
  if (typeof document > "u") return;
458
349
  const t = document.createElement("link");
459
350
  t.rel = "preconnect", t.href = e, t.crossOrigin = "anonymous", document.head.appendChild(t);
460
351
  }
461
- function X(e, t) {
352
+ function ee(e, t) {
462
353
  if (e === t) return;
463
354
  if (t === null || typeof t != "object")
464
355
  throw new Error("Cannot merge non-object source");
465
356
  if (Array.isArray(t))
466
357
  throw new Error("Cannot merge arrays");
467
- const r = Object.keys(t).filter((o) => o !== "$ref");
468
- if (r.length === 0) return j(e);
358
+ const n = Object.keys(t).filter((r) => r !== "$ref");
359
+ if (n.length === 0) return M(e);
469
360
  if (Array.isArray(e))
470
361
  throw new Error("Cannot merge into arrays");
471
362
  if (e === null || typeof e != "object")
472
363
  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;
364
+ const o = M({ ...e });
365
+ for (const r of n)
366
+ o[r] = t[r];
367
+ return o;
477
368
  }
478
- function Y(e, t) {
369
+ function te(e, t) {
479
370
  if (e !== t) {
480
371
  if (t === null || typeof t != "object")
481
372
  throw new Error("Cannot replace with non-object source");
@@ -485,58 +376,57 @@ function Y(e, t) {
485
376
  if (!Array.isArray(t))
486
377
  throw new Error("replaceObjectFields does not support mixing arrays and objects");
487
378
  e.length = 0;
488
- for (const r of t)
489
- e.push(r);
379
+ for (const n of t)
380
+ e.push(n);
490
381
  return;
491
382
  }
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];
383
+ for (const n of Object.keys(e))
384
+ n in t || delete e[n];
385
+ for (const n of Object.keys(t))
386
+ e[n] = t[n];
496
387
  }
497
388
  }
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);
389
+ async function ne(e, t, n) {
390
+ n = n || {};
391
+ for (const o of t)
392
+ await m(e, o, { ...n, mutate: !0 });
503
393
  }
504
- typeof window < "u" && (window.__debugMutateManifest = x);
505
- async function ee(e) {
506
- const { makeOfflineBundle: t } = await import("./makeOfflineBundle-BXfViegK.js");
394
+ typeof window < "u" && (window.__debugMutateManifest = ne);
395
+ async function oe(e) {
396
+ const { makeOfflineBundle: t } = await import("./makeOfflineBundle-C2JTPRo2.js");
507
397
  return await t(e);
508
398
  }
509
- async function te(e) {
510
- const { downloadZip: t } = await import("./downloadZip-CKCMYGtc.js");
399
+ async function re(e) {
400
+ const { downloadZip: t } = await import("./downloadZip-B3vadhXZ.js");
511
401
  return await t(e);
512
402
  }
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);
403
+ async function se(e) {
404
+ const { makeOffline: t } = await import("./makeOffline-DJO3H5Pc.js"), n = await t(e);
405
+ for await (const o of (await n).files)
406
+ "data" in o ? console.info(`🗳️ Put ${o.targetFilePath} <=`, o.data) : "url" in o && console.info(`🗳️ Download ${o.targetFilePath} <= ${o.url}`);
407
+ console.info("Offline data: ", n.manifest);
518
408
  }
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);
409
+ typeof window < "u" && (window.__debugDownloadZip = re, window.__debugMakeOfflineBundle = oe, window.__debugLogOfflineManifestFiles = se);
410
+ const le = w("mount"), ce = w("load"), fe = w("initialize");
411
+ async function ue(e, t, ...n) {
412
+ return await w(e)(t, ...n);
523
413
  }
524
- Q("https://efp-runtime.expofp.com/");
414
+ Y("https://efp-runtime.expofp.com/");
525
415
  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
416
+ ee as a,
417
+ Q as b,
418
+ j as c,
419
+ ue as callFunction_Experimental,
420
+ M as d,
421
+ re as downloadZip,
422
+ fe as initialize,
423
+ i as l,
424
+ ce as load,
425
+ oe as makeOfflineBundle,
426
+ le as mount,
427
+ ne as mutateManifest,
428
+ l as p,
429
+ K as r,
430
+ m as resolve
541
431
  };
542
432
  //# sourceMappingURL=index.js.map