@machinemetrics/mm-react-embeddable 2.0.3-0 → 2.0.3-2

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.
@@ -1,7 +1,7 @@
1
- import W, { createContext as fe, useContext as J, useState as O, useRef as h, useCallback as p, useEffect as R, useMemo as be } from "react";
1
+ import F, { createContext as ye, useContext as ne, useState as D, useRef as l, useCallback as h, useEffect as g, useMemo as Ce } from "react";
2
2
  import w from "prop-types";
3
- import ce from "styled-components";
4
- const se = fe(null), te = fe({
3
+ import Re from "styled-components";
4
+ const le = ye(null), ue = ye({
5
5
  pending: [],
6
6
  authorize: () => {
7
7
  },
@@ -16,314 +16,314 @@ const se = fe(null), te = fe({
16
16
  unsupported: {},
17
17
  setDelivered: () => {
18
18
  }
19
- }), ge = "access_token", ie = (t) => t ? t.kind ? t : t.accessToken ? {
20
- kind: ge,
21
- accessToken: t.accessToken,
22
- expiresAt: t.expiresAt || null
23
- } : null : null, Ee = 60, Re = 120, we = 3e4, ke = /* @__PURE__ */ new Set([
19
+ }), Ue = "access_token", Ee = (e) => e ? e.kind ? e : e.accessToken ? {
20
+ kind: Ue,
21
+ accessToken: e.accessToken,
22
+ expiresAt: e.expiresAt || null
23
+ } : null : null, Se = 60, xe = 120, Oe = 3e4, $e = /* @__PURE__ */ new Set([
24
24
  "host_not_allowed",
25
25
  "unbound_host_bound_guest",
26
26
  "invalid_token",
27
27
  "provider_unavailable"
28
- ]), ee = (t) => {
28
+ ]), oe = (e) => {
29
29
  try {
30
- return new URL(t).origin;
30
+ return new URL(e).origin;
31
31
  } catch {
32
32
  return null;
33
33
  }
34
- }, ue = (t, s) => {
34
+ }, we = (e, s) => {
35
35
  const u = s == null ? void 0 : s.origin;
36
- return !u || ee(t == null ? void 0 : t.authUrl) !== u ? null : u;
37
- }, ae = (t) => {
38
- if (!t || /^\d{1,3}(?:\.\d{1,3}){3}$/.test(t) || t.includes(":"))
39
- return t;
40
- const s = t.split(".");
41
- return s.length <= 2 ? t : s.slice(-2).join(".");
42
- }, le = (t, s) => {
36
+ return !u || oe(e == null ? void 0 : e.authUrl) !== u ? null : u;
37
+ }, Te = (e) => {
38
+ if (!e || /^\d{1,3}(?:\.\d{1,3}){3}$/.test(e) || e.includes(":"))
39
+ return e;
40
+ const s = e.split(".");
41
+ return s.length <= 2 ? e : s.slice(-2).join(".");
42
+ }, ke = (e, s) => {
43
43
  try {
44
- const u = new URL(t), m = new URL(s);
45
- return u.protocol !== m.protocol ? !0 : ae(u.hostname) !== ae(m.hostname);
44
+ const u = new URL(e), m = new URL(s);
45
+ return u.protocol !== m.protocol ? !0 : Te(u.hostname) !== Te(m.hostname);
46
46
  } catch {
47
47
  return !0;
48
48
  }
49
- }, Te = (t, { onBlocked: s, onClosed: u }) => {
49
+ }, ze = (e, { onBlocked: s, onClosed: u }) => {
50
50
  const m = window.open(
51
- t.authUrl,
51
+ e.authUrl,
52
52
  "mm-embed-auth",
53
53
  "popup,width=600,height=700"
54
54
  );
55
55
  if (!m)
56
56
  return s(), () => {
57
57
  };
58
- const E = setInterval(() => {
59
- m.closed && (clearInterval(E), u());
58
+ const R = setInterval(() => {
59
+ m.closed && (clearInterval(R), u());
60
60
  }, 1e3);
61
- return () => clearInterval(E);
62
- }, pe = ({ children: t, launcher: s, broker: u, ready: m }) => {
63
- const E = J(se), [k, C] = O({}), [j, V] = O({}), [Z, T] = O({}), [b, A] = O({}), F = h(Z);
64
- F.current = Z;
65
- const y = h(k);
66
- y.current = k;
67
- const z = h(null), _ = h({}), H = h({}), K = h(u);
68
- K.current = u;
69
- const L = h({}), P = h({}), D = p((e, n, r) => {
70
- !e || !n || (L.current[e] || (L.current[e] = /* @__PURE__ */ new Set()), r ? L.current[e].add(n) : L.current[e].delete(n));
71
- }, []), v = p((e) => {
72
- const n = _.current[e];
61
+ return () => clearInterval(R);
62
+ }, Ae = ({ children: e, launcher: s, broker: u, ready: m }) => {
63
+ const R = ne(le), [y, A] = D({}), [q, J] = D({}), [H, L] = D({}), [U, M] = D({}), E = l(H);
64
+ E.current = H;
65
+ const j = l(y);
66
+ j.current = y;
67
+ const P = l(null), b = l({}), G = l({}), V = l(u);
68
+ V.current = u;
69
+ const C = l({}), Z = l({}), N = h((r, n, t) => {
70
+ !r || !n || (C.current[r] || (C.current[r] = /* @__PURE__ */ new Set()), t ? C.current[r].add(n) : C.current[r].delete(n));
71
+ }, []), S = h((r) => {
72
+ const n = b.current[r];
73
73
  if (!n)
74
74
  return;
75
- const r = (i) => !i[e] || i[e].clientId ? i : { ...i, [e]: { ...i[e], clientId: n } };
76
- C(r), A(r);
77
- }, []), c = p(
78
- (e, n) => {
79
- e && (A((r) => r[e] ? r : {
80
- ...r,
81
- [e]: {
82
- origin: e,
75
+ const t = (o) => !o[r] || o[r].clientId ? o : { ...o, [r]: { ...o[r], clientId: n } };
76
+ A(t), M(t);
77
+ }, []), i = h(
78
+ (r, n) => {
79
+ r && (M((t) => t[r] ? t : {
80
+ ...t,
81
+ [r]: {
82
+ origin: r,
83
83
  reason: n,
84
- clientId: _.current[e] || null
84
+ clientId: b.current[r] || null
85
85
  }
86
- }), v(e));
86
+ }), S(r));
87
87
  },
88
- [v]
89
- ), a = p(
90
- (e, { v2: n = !1, origin: r = null } = {}) => {
91
- var i;
92
- if (r) {
93
- if (n && F.current[r]) {
94
- if (!((i = L.current[r]) != null && i.has(e.instanceId)))
88
+ [S]
89
+ ), a = h(
90
+ (r, { v2: n = !1, origin: t = null } = {}) => {
91
+ var o;
92
+ if (t) {
93
+ if (n && E.current[t]) {
94
+ if (!((o = C.current[t]) != null && o.has(r.instanceId)))
95
95
  return;
96
- const l = Date.now();
97
- if (l - (P.current[r] || 0) < we)
96
+ const p = Date.now();
97
+ if (p - (Z.current[t] || 0) < Oe)
98
98
  return;
99
- P.current[r] = l, L.current[r].clear();
100
- const x = { ...F.current };
101
- delete x[r], F.current = x, T(x);
99
+ Z.current[t] = p, C.current[t].clear();
100
+ const I = { ...E.current };
101
+ delete I[t], E.current = I, L(I);
102
102
  }
103
- C((l) => l[r] ? l : {
104
- ...l,
105
- [r]: {
106
- origin: r,
107
- authUrl: e.authUrl,
108
- status: n && K.current ? "broker" : "interactive",
103
+ A((p) => p[t] ? p : {
104
+ ...p,
105
+ [t]: {
106
+ origin: t,
107
+ authUrl: r.authUrl,
108
+ status: n && V.current ? "broker" : "interactive",
109
109
  v2: n,
110
- scope: e.scope || null,
111
- acceptsCredentials: H.current[r] || null,
110
+ scope: r.scope || null,
111
+ acceptsCredentials: G.current[t] || null,
112
112
  consent: null,
113
113
  error: null,
114
- clientId: e.clientId || _.current[r] || null,
114
+ clientId: r.clientId || b.current[t] || null,
115
115
  popupBlocked: !1
116
116
  }
117
- }), v(r);
117
+ }), S(t);
118
118
  }
119
119
  },
120
- [v]
121
- ), o = h({}), f = p((e) => {
122
- o.current[e] && (clearTimeout(o.current[e]), delete o.current[e]);
123
- }, []), d = p(
124
- (e) => {
125
- f(e), C((n) => {
126
- if (!n[e])
120
+ [S]
121
+ ), c = l({}), f = h((r) => {
122
+ c.current[r] && (clearTimeout(c.current[r]), delete c.current[r]);
123
+ }, []), d = h(
124
+ (r) => {
125
+ f(r), A((n) => {
126
+ if (!n[r])
127
127
  return n;
128
- const r = { ...n };
129
- return delete r[e], r;
128
+ const t = { ...n };
129
+ return delete t[r], t;
130
130
  });
131
131
  },
132
132
  [f]
133
- ), g = p(
134
- (e) => {
135
- e && (d(e), V((n) => ({
133
+ ), T = h(
134
+ (r) => {
135
+ r && (d(r), J((n) => ({
136
136
  ...n,
137
- [e]: (n[e] || 0) + 1
137
+ [r]: (n[r] || 0) + 1
138
138
  })));
139
139
  },
140
140
  [d]
141
- ), $ = p(
142
- (e) => {
143
- d(e.origin);
141
+ ), B = h(
142
+ (r) => {
143
+ d(r.origin);
144
144
  },
145
145
  [d]
146
- ), S = p(
147
- (e, n) => {
148
- const r = ue(e, n);
149
- if (r) {
150
- if (le(r, window.location.origin)) {
151
- c(r, "cross-site-legacy");
146
+ ), x = h(
147
+ (r, n) => {
148
+ const t = we(r, n);
149
+ if (t) {
150
+ if (ke(t, window.location.origin)) {
151
+ i(t, "cross-site-legacy");
152
152
  return;
153
153
  }
154
- a(e, { origin: r });
154
+ a(r, { origin: t });
155
155
  }
156
156
  },
157
- [a, c]
157
+ [a, i]
158
158
  );
159
- R(() => {
160
- if (!E)
159
+ g(() => {
160
+ if (!R)
161
161
  return;
162
- const e = [
163
- E.addListener("*", "init", (n, r) => {
164
- r != null && r.origin && (n != null && n.clientId) && (_.current[r.origin] = n.clientId, v(r.origin)), r != null && r.origin && Array.isArray(n == null ? void 0 : n.acceptsCredentials) ? H.current[r.origin] = n.acceptsCredentials : r != null && r.origin && le(r.origin, window.location.origin) && c(r.origin, "cross-site-legacy");
162
+ const r = [
163
+ R.addListener("*", "init", (n, t) => {
164
+ t != null && t.origin && (n != null && n.clientId) && (b.current[t.origin] = n.clientId, S(t.origin)), t != null && t.origin && Array.isArray(n == null ? void 0 : n.acceptsCredentials) ? G.current[t.origin] = n.acceptsCredentials : t != null && t.origin && ke(t.origin, window.location.origin) && i(t.origin, "cross-site-legacy");
165
165
  }),
166
- E.addListener("*", "authorize", S),
167
- E.addListener("*", "login", S),
168
- E.addListener(
166
+ R.addListener("*", "authorize", x),
167
+ R.addListener("*", "login", x),
168
+ R.addListener(
169
169
  "*",
170
170
  "credential-request",
171
- (n, r) => a(n, { v2: !0, origin: ue(n, r) })
171
+ (n, t) => a(n, { v2: !0, origin: we(n, t) })
172
172
  )
173
173
  ];
174
- return () => e.forEach((n) => n());
175
- }, [E, S, a, v, c]), R(() => {
176
- const e = (n) => {
177
- const r = n == null ? void 0 : n.data;
178
- if (!r || r.type !== "authorized")
174
+ return () => r.forEach((n) => n());
175
+ }, [R, x, a, S, i]), g(() => {
176
+ const r = (n) => {
177
+ const t = n == null ? void 0 : n.data;
178
+ if (!t || t.type !== "authorized")
179
179
  return;
180
- const i = ee(r.authUrl);
181
- if (!i || n.origin !== i)
180
+ const o = oe(t.authUrl);
181
+ if (!o || n.origin !== o)
182
182
  return;
183
- const l = y.current[i];
184
- if (!(!l || l.status !== "interactive")) {
185
- if (r.accessToken) {
186
- T((x) => ({
187
- ...x,
188
- [i]: ie({ accessToken: r.accessToken })
189
- })), d(i);
183
+ const p = j.current[o];
184
+ if (!(!p || p.status !== "interactive")) {
185
+ if (t.accessToken) {
186
+ L((I) => ({
187
+ ...I,
188
+ [o]: Ee({ accessToken: t.accessToken })
189
+ })), d(o);
190
190
  return;
191
191
  }
192
- g(i);
192
+ T(o);
193
193
  }
194
194
  };
195
- return window.addEventListener("message", e), () => window.removeEventListener("message", e);
196
- }, [d, g]);
197
- const I = p(
198
- (e, n) => {
199
- const r = e == null ? void 0 : e.origin, i = ie(n);
200
- !r || !i || (T((l) => ({ ...l, [r]: i })), d(r));
195
+ return window.addEventListener("message", r), () => window.removeEventListener("message", r);
196
+ }, [d, T]);
197
+ const O = h(
198
+ (r, n) => {
199
+ const t = r == null ? void 0 : r.origin, o = Ee(n);
200
+ !t || !o || (L((p) => ({ ...p, [t]: o })), d(t));
201
201
  },
202
202
  [d]
203
- ), U = p((e, n) => {
204
- C((r) => r[e] ? { ...r, [e]: { ...r[e], ...n } } : r);
205
- }, []), M = h({}), q = p(
206
- async (e, { approve: n } = {}) => {
207
- const r = K.current, { origin: i } = e;
208
- let l;
203
+ ), k = h((r, n) => {
204
+ A((t) => t[r] ? { ...t, [r]: { ...t[r], ...n } } : t);
205
+ }, []), v = l({}), $ = h(
206
+ async (r, { approve: n } = {}) => {
207
+ const t = V.current, { origin: o } = r;
208
+ let p;
209
209
  try {
210
- l = await r(
210
+ p = await t(
211
211
  {
212
- origin: i,
213
- clientId: e.clientId,
214
- scope: e.scope,
215
- authUrl: e.authUrl
212
+ origin: o,
213
+ clientId: r.clientId,
214
+ scope: r.scope,
215
+ authUrl: r.authUrl
216
216
  },
217
217
  { approve: n }
218
218
  );
219
219
  } catch {
220
- n ? U(i, { error: { reason: "broker_unavailable" } }) : U(i, { status: "interactive" });
220
+ n ? k(o, { error: { reason: "broker_unavailable" } }) : k(o, { status: "interactive" });
221
221
  return;
222
222
  }
223
- const x = l == null ? void 0 : l.status, G = (l == null ? void 0 : l.body) || {};
224
- if (x === 200 && G.credential) {
225
- I(e, G.credential);
223
+ const I = p == null ? void 0 : p.status, z = (p == null ? void 0 : p.body) || {};
224
+ if (I === 200 && z.credential) {
225
+ O(r, z.credential);
226
226
  return;
227
227
  }
228
- if (x === 409 && G.consentRequired) {
229
- U(i, {
228
+ if (I === 409 && z.consentRequired) {
229
+ k(o, {
230
230
  status: "interactive",
231
231
  consent: {
232
- client: G.client || null,
233
- stepUp: !!G.stepUp,
234
- scope: G.scope || e.scope
232
+ client: z.client || null,
233
+ stepUp: !!z.stepUp,
234
+ scope: z.scope || r.scope
235
235
  },
236
236
  error: null
237
237
  });
238
238
  return;
239
239
  }
240
- const re = G.error || "broker_error";
241
- if (!n && ke.has(re)) {
242
- U(i, { status: "interactive" });
240
+ const K = z.error || "broker_error";
241
+ if (!n && $e.has(K)) {
242
+ k(o, { status: "interactive" });
243
243
  return;
244
244
  }
245
- if (n && re === "consent_denied") {
246
- U(i, { error: null });
245
+ if (n && K === "consent_denied") {
246
+ k(o, { error: null });
247
247
  return;
248
248
  }
249
- if (re === "rate_limited" && !e.rateLimitRetried) {
250
- const ne = Math.min(
251
- Number(G.retryAfter) > 0 ? Number(G.retryAfter) : Ee,
252
- Re
253
- ), me = { ...e, rateLimitRetried: !0 };
254
- f(i), o.current[i] = setTimeout(() => {
255
- delete o.current[i], M.current[i] = !0, B.current(me, { approve: n }).finally(() => {
256
- delete M.current[i];
249
+ if (K === "rate_limited" && !r.rateLimitRetried) {
250
+ const X = Math.min(
251
+ Number(z.retryAfter) > 0 ? Number(z.retryAfter) : Se,
252
+ xe
253
+ ), te = { ...r, rateLimitRetried: !0 };
254
+ f(o), c.current[o] = setTimeout(() => {
255
+ delete c.current[o], v.current[o] = !0, ee.current(te, { approve: n }).finally(() => {
256
+ delete v.current[o];
257
257
  });
258
- }, ne * 1e3), U(i, { rateLimitRetried: !0 });
258
+ }, X * 1e3), k(o, { rateLimitRetried: !0 });
259
259
  return;
260
260
  }
261
- d(i), A((ne) => ({
262
- ...ne,
263
- [i]: {
264
- origin: i,
265
- reason: `broker:${re}`,
266
- detail: { status: x != null ? x : null, reason: re },
267
- clientId: e.clientId || _.current[i] || null
261
+ d(o), M((X) => ({
262
+ ...X,
263
+ [o]: {
264
+ origin: o,
265
+ reason: `broker:${K}`,
266
+ detail: { status: I != null ? I : null, reason: K },
267
+ clientId: r.clientId || b.current[o] || null
268
268
  }
269
269
  }));
270
270
  },
271
- [I, U, d, f]
272
- ), B = h(q);
273
- B.current = q, R(() => {
274
- Object.values(k).forEach((e) => {
275
- e.status !== "broker" || M.current[e.origin] || o.current[e.origin] || (M.current[e.origin] = !0, q(e).finally(() => {
276
- delete M.current[e.origin];
271
+ [O, k, d, f]
272
+ ), ee = l($);
273
+ ee.current = $, g(() => {
274
+ Object.values(y).forEach((r) => {
275
+ r.status !== "broker" || v.current[r.origin] || c.current[r.origin] || (v.current[r.origin] = !0, $(r).finally(() => {
276
+ delete v.current[r.origin];
277
277
  }));
278
278
  });
279
- }, [k, q]);
280
- const Y = p(
281
- (e) => !K.current || !(e != null && e.consent) || M.current[e.origin] ? Promise.resolve() : (M.current[e.origin] = !0, q(e, { approve: !0 }).finally(() => {
282
- delete M.current[e.origin];
279
+ }, [y, $]);
280
+ const W = h(
281
+ (r) => !V.current || !(r != null && r.consent) || v.current[r.origin] ? Promise.resolve() : (v.current[r.origin] = !0, $(r, { approve: !0 }).finally(() => {
282
+ delete v.current[r.origin];
283
283
  })),
284
- [q]
284
+ [$]
285
285
  );
286
- R(() => () => {
287
- z.current && z.current(), Object.values(o.current).forEach(clearTimeout);
288
- }, []), R(() => {
289
- m === !1 && (Object.values(o.current).forEach(clearTimeout), o.current = {}, M.current = {}, _.current = {}, H.current = {}, L.current = {}, P.current = {}, F.current = {}, T({}), C({}), A({}));
286
+ g(() => () => {
287
+ P.current && P.current(), Object.values(c.current).forEach(clearTimeout);
288
+ }, []), g(() => {
289
+ m === !1 && (Object.values(c.current).forEach(clearTimeout), c.current = {}, v.current = {}, b.current = {}, G.current = {}, C.current = {}, Z.current = {}, E.current = {}, L({}), A({}), M({}));
290
290
  }, [m]);
291
- const X = p(
292
- (e) => {
293
- z.current && (z.current(), z.current = null);
294
- const n = s || Te;
295
- z.current = n(e, {
291
+ const Q = h(
292
+ (r) => {
293
+ P.current && (P.current(), P.current = null);
294
+ const n = s || ze;
295
+ P.current = n(r, {
296
296
  onBlocked: () => {
297
- C((r) => r[e.origin] ? {
298
- ...r,
299
- [e.origin]: { ...r[e.origin], popupBlocked: !0 }
300
- } : r);
297
+ A((t) => t[r.origin] ? {
298
+ ...t,
299
+ [r.origin]: { ...t[r.origin], popupBlocked: !0 }
300
+ } : t);
301
301
  },
302
302
  // A completed login already removed the entry. A v2 entry stays pending so the prompt remains;
303
303
  // a legacy guest is remounted because it only learns of a login by reloading.
304
304
  onClosed: () => {
305
- const r = y.current[e.origin];
306
- !r || r.v2 || g(e.origin);
305
+ const t = j.current[r.origin];
306
+ !t || t.v2 || T(r.origin);
307
307
  }
308
308
  });
309
309
  },
310
- [s, g]
311
- ), Q = {
312
- pending: Object.values(k).filter(
313
- (e) => e.status === "interactive"
310
+ [s, T]
311
+ ), re = {
312
+ pending: Object.values(y).filter(
313
+ (r) => r.status === "interactive"
314
314
  ),
315
- authorize: X,
316
- approve: Y,
317
- complete: I,
318
- dismiss: $,
319
- originEpochs: j,
320
- credentials: Z,
321
- unsupported: b,
322
- setDelivered: D
315
+ authorize: Q,
316
+ approve: W,
317
+ complete: O,
318
+ dismiss: B,
319
+ originEpochs: q,
320
+ credentials: H,
321
+ unsupported: U,
322
+ setDelivered: N
323
323
  };
324
- return /* @__PURE__ */ W.createElement(te.Provider, { value: Q }, t);
324
+ return /* @__PURE__ */ F.createElement(ue.Provider, { value: re }, e);
325
325
  };
326
- pe.propTypes = {
326
+ Ae.propTypes = {
327
327
  children: w.node,
328
328
  launcher: w.func,
329
329
  ready: w.bool,
@@ -337,166 +337,166 @@ pe.propTypes = {
337
337
  */
338
338
  broker: w.func
339
339
  };
340
- const Ie = () => J(te), _e = (t) => {
341
- const { originEpochs: s } = J(te), u = ee(t);
340
+ const De = () => ne(ue), Fe = (e) => {
341
+ const { originEpochs: s } = ne(ue), u = oe(e);
342
342
  return u && s[u] || 0;
343
- }, Me = (t) => {
344
- const { credentials: s } = J(te), u = ee(t);
343
+ }, Pe = (e) => {
344
+ const { credentials: s } = ne(ue), u = oe(e);
345
345
  return u && s[u] || null;
346
- }, Ce = (t) => {
347
- const { unsupported: s } = J(te), u = ee(t);
346
+ }, Be = (e) => {
347
+ const { unsupported: s } = ne(ue), u = oe(e);
348
348
  return u && s[u] || null;
349
- }, de = "MMEmbeddableZoneProvider requires a boolean `ready` prop (true once the host holds the bearer its credentialBroker needs). Embedded apps will not load until it is provided.", ye = ({
350
- children: t,
349
+ }, Ie = "MMEmbeddableZoneProvider requires a boolean `ready` prop (true once the host holds the bearer its credentialBroker needs). Embedded apps will not load until it is provided.", We = ({
350
+ children: e,
351
351
  authorizationLauncher: s,
352
352
  credentialBroker: u,
353
353
  ready: m
354
354
  }) => {
355
- const E = m === !0, k = h(!1);
356
- R(() => {
357
- m !== void 0 || k.current || (k.current = !0, console.error(de), typeof window != "undefined" && typeof window.alert == "function" && window.alert(de));
355
+ const R = m === !0, y = l(!1);
356
+ g(() => {
357
+ m !== void 0 || y.current || (y.current = !0, console.error(Ie), typeof window != "undefined" && typeof window.alert == "function" && window.alert(Ie));
358
358
  }, [m]);
359
- const [C, j] = O({}), [V, Z] = O({}), T = h({}), b = h({}), A = h({}), F = p((c, a) => {
360
- var o;
361
- return !!((o = A.current[c]) != null && o.has(a));
362
- }, []), y = p((c, a, o) => {
363
- j((f) => ({ ...f, [c]: { origin: a, frameRef: o } }));
364
- }, []), z = p((c) => {
365
- j((a) => {
366
- const o = { ...a };
367
- return delete o[c], o;
368
- }), Z((a) => {
369
- const o = { ...a };
370
- return delete o[c], o;
371
- }), delete A.current[c], Object.keys(b.current).forEach((a) => {
372
- b.current[a].instanceId === c && delete b.current[a];
359
+ const [A, q] = D({}), [J, H] = D({}), L = l({}), U = l({}), M = l({}), E = h((i, a) => {
360
+ var c;
361
+ return !!((c = M.current[i]) != null && c.has(a));
362
+ }, []), j = h((i, a, c) => {
363
+ q((f) => ({ ...f, [i]: { origin: a, frameRef: c } }));
364
+ }, []), P = h((i) => {
365
+ q((a) => {
366
+ const c = { ...a };
367
+ return delete c[i], c;
368
+ }), H((a) => {
369
+ const c = { ...a };
370
+ return delete c[i], c;
371
+ }), delete M.current[i], Object.keys(U.current).forEach((a) => {
372
+ U.current[a].instanceId === i && delete U.current[a];
373
373
  });
374
374
  }, []);
375
- R(() => () => {
376
- b.current = {};
377
- }, []), R(() => {
378
- const c = (o = [], f, d) => {
379
- o.forEach((g) => g(f, d));
380
- }, a = (o) => {
381
- var U, M, q, B, Y, X, Q;
382
- if (!((U = o == null ? void 0 : o.data) != null && U.instanceId))
375
+ g(() => () => {
376
+ U.current = {};
377
+ }, []), g(() => {
378
+ const i = (c = [], f, d) => {
379
+ c.forEach((T) => T(f, d));
380
+ }, a = (c) => {
381
+ var k, v, $, ee, W, Q, re;
382
+ if (!((k = c == null ? void 0 : c.data) != null && k.instanceId))
383
383
  return;
384
- const { instanceId: f, type: d } = o.data, g = C[f], $ = (q = (M = g == null ? void 0 : g.frameRef) == null ? void 0 : M.current) == null ? void 0 : q.contentWindow;
385
- if (!$ || o.source !== $ || o.origin !== g.origin)
384
+ const { instanceId: f, type: d } = c.data, T = A[f], B = ($ = (v = T == null ? void 0 : T.frameRef) == null ? void 0 : v.current) == null ? void 0 : $.contentWindow;
385
+ if (!B || c.source !== B || c.origin !== T.origin)
386
386
  return;
387
- const S = { origin: o.origin }, I = T.current;
387
+ const x = { origin: c.origin }, O = L.current;
388
388
  if (d === "response") {
389
- const { callbackId: e, response: n, error: r } = o.data, i = b.current[e];
390
- i && i.instanceId === f && (i.callback(n, r), delete b.current[e]);
389
+ const { callbackId: r, response: n, error: t } = c.data, o = U.current[r];
390
+ o && o.instanceId === f && (o.callback(n, t), delete U.current[r]);
391
391
  return;
392
392
  }
393
393
  if (d === "mark-registered") {
394
- const { requestType: e } = o.data;
395
- A.current[f] || (A.current[f] = /* @__PURE__ */ new Set()), A.current[f].add(e);
394
+ const { requestType: r } = c.data;
395
+ M.current[f] || (M.current[f] = /* @__PURE__ */ new Set()), M.current[f].add(r);
396
396
  return;
397
397
  }
398
- d === "ready" && Z((e) => ({ ...e, [f]: !0 })), c((B = I[f]) == null ? void 0 : B[d], o.data, S), c((Y = I["*"]) == null ? void 0 : Y[d], o.data, S), c((X = I[f]) == null ? void 0 : X["*"], o.data, S), c((Q = I["*"]) == null ? void 0 : Q["*"], o.data, S);
398
+ d === "ready" && H((r) => ({ ...r, [f]: !0 })), i((ee = O[f]) == null ? void 0 : ee[d], c.data, x), i((W = O["*"]) == null ? void 0 : W[d], c.data, x), i((Q = O[f]) == null ? void 0 : Q["*"], c.data, x), i((re = O["*"]) == null ? void 0 : re["*"], c.data, x);
399
399
  };
400
400
  return window.addEventListener("message", a), () => {
401
401
  window.removeEventListener("message", a);
402
402
  };
403
- }, [C]);
404
- const _ = p(
405
- (c, a, o, f) => {
406
- var g, $;
407
- const d = C[c];
403
+ }, [A]);
404
+ const b = h(
405
+ (i, a, c, f) => {
406
+ var T, B;
407
+ const d = A[i];
408
408
  if (!d) {
409
- console.warn(`Origin not set for id: ${c}. Unable to send message.`);
409
+ console.warn(`Origin not set for id: ${i}. Unable to send message.`);
410
410
  return;
411
411
  }
412
- ($ = (g = d == null ? void 0 : d.frameRef) == null ? void 0 : g.current) != null && $.contentWindow && d.frameRef.current.contentWindow.postMessage(
413
- { type: a, ...o, instanceId: c },
412
+ (B = (T = d == null ? void 0 : d.frameRef) == null ? void 0 : T.current) != null && B.contentWindow && d.frameRef.current.contentWindow.postMessage(
413
+ { type: a, ...c, instanceId: i },
414
414
  f || d.origin
415
415
  );
416
416
  },
417
- [C]
418
- ), H = h(0), K = p(() => `${Date.now()}-${++H.current}`, []), L = p(
419
- async (c, a, o = {}) => new Promise((f, d) => {
420
- const g = K(), $ = (S, I) => {
421
- delete b.current[g], I ? d(I) : f(S);
417
+ [A]
418
+ ), G = l(0), V = h(() => `${Date.now()}-${++G.current}`, []), C = h(
419
+ async (i, a, c = {}) => new Promise((f, d) => {
420
+ const T = V(), B = (x, O) => {
421
+ delete U.current[T], O ? d(O) : f(x);
422
422
  };
423
- b.current[g] = { instanceId: c, callback: $ }, _(c, "request", { callbackId: g, requestType: a, data: o });
423
+ U.current[T] = { instanceId: i, callback: B }, b(i, "request", { callbackId: T, requestType: a, data: c });
424
424
  }),
425
- [_]
426
- ), P = p(
427
- (c, a) => {
428
- _(c, "load-options", a);
425
+ [b]
426
+ ), Z = h(
427
+ (i, a) => {
428
+ b(i, "load-options", a);
429
429
  },
430
- [_]
431
- ), D = p(
432
- (c, a) => {
433
- _(c, "validate", a);
430
+ [b]
431
+ ), N = h(
432
+ (i, a) => {
433
+ b(i, "validate", a);
434
434
  },
435
- [_]
436
- ), v = be(
435
+ [b]
436
+ ), S = Ce(
437
437
  () => ({
438
- registerFrame: y,
439
- unregisterFrame: z,
440
- sendMessage: _,
441
- sendRequest: L,
442
- loadOptions: P,
443
- validate: D,
444
- hasHandler: F,
445
- readyFrames: V,
446
- ready: E,
447
- addListener: (c, a, o) => (T.current[c] || (T.current[c] = {}), T.current[c][a] || (T.current[c][a] = []), T.current[c][a].push(o), () => {
448
- T.current[c][a] = T.current[c][a].filter((f) => f !== o);
438
+ registerFrame: j,
439
+ unregisterFrame: P,
440
+ sendMessage: b,
441
+ sendRequest: C,
442
+ loadOptions: Z,
443
+ validate: N,
444
+ hasHandler: E,
445
+ readyFrames: J,
446
+ ready: R,
447
+ addListener: (i, a, c) => (L.current[i] || (L.current[i] = {}), L.current[i][a] || (L.current[i][a] = []), L.current[i][a].push(c), () => {
448
+ L.current[i][a] = L.current[i][a].filter((f) => f !== c);
449
449
  })
450
450
  }),
451
451
  [
452
- y,
453
- z,
454
- _,
455
- L,
452
+ j,
456
453
  P,
457
- D,
458
- F,
459
- V,
460
- E
454
+ b,
455
+ C,
456
+ Z,
457
+ N,
458
+ E,
459
+ J,
460
+ R
461
461
  ]
462
462
  );
463
- return /* @__PURE__ */ W.createElement(se.Provider, { value: v }, /* @__PURE__ */ W.createElement(
464
- pe,
463
+ return /* @__PURE__ */ F.createElement(le.Provider, { value: S }, /* @__PURE__ */ F.createElement(
464
+ Ae,
465
465
  {
466
466
  launcher: s,
467
467
  broker: u,
468
- ready: E
468
+ ready: R
469
469
  },
470
- t
470
+ e
471
471
  ));
472
- }, N = (t, s, u) => {
473
- const m = J(se);
472
+ }, se = (e, s, u) => {
473
+ const m = ne(le);
474
474
  if (m === null)
475
475
  throw new Error(
476
476
  "useEmbeddedEffect must be used within a MMEmbeddableZoneProvider"
477
477
  );
478
- const E = h(u);
479
- R(() => {
480
- E.current = u;
481
- }, [u]), R(() => {
482
- if (!(!t || !s)) {
478
+ const R = l(u);
479
+ g(() => {
480
+ R.current = u;
481
+ }, [u]), g(() => {
482
+ if (!(!e || !s)) {
483
483
  if (s.startsWith("key:")) {
484
- const k = s.substring(4);
485
- return m.readyFrames[t] && m.sendMessage(t, "subscribe-key", { keyChord: k }), m.addListener(
486
- t,
487
- `key-pressed:${k}`,
488
- (...j) => E.current(...j)
484
+ const y = s.substring(4);
485
+ return m.readyFrames[e] && m.sendMessage(e, "subscribe-key", { keyChord: y }), m.addListener(
486
+ e,
487
+ `key-pressed:${y}`,
488
+ (...q) => R.current(...q)
489
489
  );
490
490
  }
491
491
  return m.addListener(
492
- t,
492
+ e,
493
493
  s,
494
- (...k) => E.current(...k)
494
+ (...y) => R.current(...y)
495
495
  );
496
496
  }
497
- }, [m, t, s]);
497
+ }, [m, e, s]);
498
498
  };
499
- ye.propTypes = {
499
+ We.propTypes = {
500
500
  children: w.node.isRequired,
501
501
  /**
502
502
  * Required. True once the host holds its bearer; zones mount no iframe until then. Missing =
@@ -519,14 +519,34 @@ ye.propTypes = {
519
519
  */
520
520
  credentialBroker: w.func
521
521
  };
522
- const oe = ce.default || ce, Ae = 1e4, Le = "credentials", Ue = (t, s) => `${t}/mm-embedded-interop?id=${encodeURIComponent(s)}&origin=${encodeURIComponent(
522
+ const he = Re.default || Re, qe = 1e4, je = 6e3, _e = 15e3, He = 2e3, Ze = 3e3, Le = () => typeof document != "undefined" && document.visibilityState === "hidden", ce = (e, s, u) => {
523
+ if (e.current && clearTimeout(e.current.handle), Le()) {
524
+ e.current = { ms: s, fn: u, suspended: !0 };
525
+ return;
526
+ }
527
+ const m = Date.now(), R = setTimeout(() => {
528
+ if (Date.now() - m - s > Ze) {
529
+ ce(e, s, u);
530
+ return;
531
+ }
532
+ e.current = void 0, u();
533
+ }, s);
534
+ e.current = { handle: R, ms: s, fn: u };
535
+ }, Y = (e) => {
536
+ e.current && clearTimeout(e.current.handle), e.current = void 0;
537
+ }, fe = (e) => {
538
+ e.current && !e.current.suspended && (clearTimeout(e.current.handle), e.current = { ms: e.current.ms, fn: e.current.fn, suspended: !0 });
539
+ }, pe = (e) => {
540
+ e.current && e.current.suspended && ce(e, e.current.ms, e.current.fn);
541
+ }, Ke = "credentials", Ye = (e, s) => `${e}/mm-embedded-interop?id=${encodeURIComponent(s)}&origin=${encodeURIComponent(
523
542
  window.location.origin
524
- )}&caps=${Le}`, xe = oe.iframe`
543
+ )}&caps=${Ke}`, Ge = he.iframe`
525
544
  width: 100%;
526
545
  height: 100%;
527
546
  border: none;
528
- visibility: ${(t) => t.$isReady ? "visible" : "hidden"};
529
- `, Oe = oe.div`
547
+ visibility: ${(e) => e.$isReady ? "visible" : "hidden"};
548
+ ${(e) => e.$collapsed ? "position: absolute; width: 1px; height: 1px; overflow: hidden;" : ""}
549
+ `, Ve = he.div`
530
550
  width: 100%;
531
551
  height: 100%;
532
552
  display: flex;
@@ -539,8 +559,8 @@ const oe = ce.default || ce, Ae = 1e4, Le = "credentials", Ue = (t, s) => `${t}/
539
559
  text-align: center;
540
560
  color: #555;
541
561
  font-size: 14px;
542
- `, ze = (t) => {
543
- const s = t && t.origin || "This app", u = t && t.reason || "";
562
+ `, Qe = (e) => {
563
+ const s = e && e.origin || "This app", u = e && e.reason || "";
544
564
  switch (u) {
545
565
  case "broker:scope_above_ceiling":
546
566
  return {
@@ -567,11 +587,11 @@ const oe = ce.default || ce, Ae = 1e4, Le = "credentials", Ue = (t, s) => `${t}/
567
587
  detail: "It needs an update to support embedding from a different domain."
568
588
  };
569
589
  }
570
- }, he = ({ entry: t }) => {
571
- const s = ze(t);
572
- return /* @__PURE__ */ W.createElement(Oe, { "data-reason": t && t.reason || void 0 }, /* @__PURE__ */ W.createElement("div", { style: { fontWeight: 600 } }, s.title), /* @__PURE__ */ W.createElement("div", { style: { fontSize: 12, color: "#888" } }, s.detail));
590
+ }, Me = ({ entry: e }) => {
591
+ const s = Qe(e);
592
+ return /* @__PURE__ */ F.createElement(Ve, { "data-reason": e && e.reason || void 0 }, /* @__PURE__ */ F.createElement("div", { style: { fontWeight: 600 } }, s.title), /* @__PURE__ */ F.createElement("div", { style: { fontSize: 12, color: "#888" } }, s.detail));
573
593
  };
574
- he.propTypes = {
594
+ Me.propTypes = {
575
595
  entry: w.shape({
576
596
  origin: w.string,
577
597
  name: w.string,
@@ -579,136 +599,170 @@ he.propTypes = {
579
599
  detail: w.object
580
600
  })
581
601
  };
582
- const ve = oe.div`
602
+ const Xe = he.div`
583
603
  height: 100%;
584
604
  display: flex;
585
605
  flex: 1;
586
606
  align-items: center;
587
607
  justify-content: center;
588
- `, $e = () => /* @__PURE__ */ W.createElement(ve, null, /* @__PURE__ */ W.createElement("div", { style: { textAlign: "center" } }, "This app couldn’t be loaded as an embeddable widget.")), Se = ({
589
- id: t,
608
+ `, Je = () => /* @__PURE__ */ F.createElement(Xe, null, /* @__PURE__ */ F.createElement("div", { style: { textAlign: "center" } }, "This app couldn’t be loaded as an embeddable widget.")), Ne = ({
609
+ id: e,
590
610
  src: s,
591
611
  path: u,
592
612
  onInit: m = () => {
593
613
  },
594
- onTimeout: E,
595
- context: k = {},
596
- params: C = {},
597
- renderUnsupported: j,
598
- renderTimeout: V,
599
- ...Z
614
+ onTimeout: R,
615
+ onRemount: y,
616
+ onStall: A,
617
+ context: q = {},
618
+ params: J = {},
619
+ renderUnsupported: H,
620
+ renderTimeout: L,
621
+ ...U
600
622
  }) => {
601
- if ("isConfiguring" in Z)
623
+ if ("isConfiguring" in U)
602
624
  return console.error(
603
625
  "isConfiguring must be passed via the params prop to MMEmbeddableZone"
604
626
  ), null;
605
- if ("colorMode" in k)
627
+ if ("colorMode" in q)
606
628
  return console.error(
607
629
  "colorMode must be passed via the params prop to MMEmbeddableZone"
608
630
  ), null;
609
- if ("isFullScreen" in k)
631
+ if ("isFullScreen" in q)
610
632
  return console.error(
611
633
  "isFullScreen must be passed via the params prop to MMEmbeddableZone"
612
634
  ), null;
613
- const T = h(), b = ee(s), [A, F] = O(), [y, z] = O(0), [_, H] = O(!1), [K, L] = O(!1), P = _e(s), D = Me(s), v = Ce(s), { setDelivered: c } = Ie(), [a, o] = O(0), [f, d] = O(null), g = h(!0), { registerFrame: $, unregisterFrame: S, sendMessage: I, ready: U } = J(
614
- se
615
- ), [M, q] = O(), B = h(), Y = h(E), X = h(m), Q = h(!1), e = h(), n = p(() => {
616
- Q.current = !1, clearTimeout(B.current), clearTimeout(e.current), z(0), H(!1), L(!1), d(null), g.current = !0, c(b, t, !1);
617
- }, [c, b, t]);
618
- R(() => {
619
- (P > 0 || a > 0) && n();
620
- }, [P, a, n]), R(() => {
621
- Y.current = E;
622
- }, [E]), R(() => {
623
- X.current = m;
624
- }, [m]), R(() => {
625
- y && I(
626
- t,
635
+ const M = l(), E = oe(s), [j, P] = D(), [b, G] = D(0), [V, C] = D(!1), [Z, N] = D(!1), S = Fe(s), i = Pe(s), a = Be(s), { setDelivered: c } = De(), [f, d] = D(0), [T, B] = D(null), { registerFrame: x, unregisterFrame: O, sendMessage: k, ready: v } = ne(
636
+ le
637
+ ), [$, ee] = D(), W = l(), Q = l(R), re = l(m), r = l(y), n = l(A), t = l(!1), o = l(), p = l(), I = l(), z = l(!1), K = l(!1), X = l(null), te = h(() => {
638
+ t.current = !1, z.current = !1, K.current = !1, X.current = null, Y(W), Y(o), Y(p), clearTimeout(I.current), G(0), C(!1), N(!1), B(null), c(E, e, !1);
639
+ }, [c, E, e]);
640
+ g(() => {
641
+ (S > 0 || f > 0) && te();
642
+ }, [S, f, te]), g(() => {
643
+ Q.current = R;
644
+ }, [R]), g(() => {
645
+ re.current = m;
646
+ }, [m]), g(() => {
647
+ r.current = y;
648
+ }, [y]), g(() => {
649
+ n.current = A;
650
+ }, [A]), g(() => {
651
+ const _ = () => {
652
+ if (Le()) {
653
+ fe(W), fe(o), fe(p);
654
+ return;
655
+ }
656
+ pe(W), pe(p), z.current && pe(o);
657
+ };
658
+ return document.addEventListener("visibilitychange", _), () => document.removeEventListener("visibilitychange", _);
659
+ }, []), g(() => {
660
+ b && k(
661
+ e,
627
662
  "set-context",
628
663
  {
629
664
  context: {
630
- ...k
665
+ ...q
631
666
  }
632
667
  },
633
- b
668
+ E
634
669
  );
635
- }, [k, t, y, b]), R(() => {
636
- y && I(t, "set-params", { params: C }, b);
637
- }, [C, t, y, b]), R(() => {
638
- u !== void 0 && q((u == null ? void 0 : u.indexOf("/")) === 0 ? u : `/${u}`);
639
- }, [u]), R(() => {
640
- M === void 0 || !y || I(t, "navigate", { path: M }, b);
641
- }, [M, y, t, I, b]), R(() => {
642
- if (!s || !t || !T)
670
+ }, [q, e, b, E]), g(() => {
671
+ b && k(e, "set-params", { params: J }, E);
672
+ }, [J, e, b, E]), g(() => {
673
+ u !== void 0 && ee((u == null ? void 0 : u.indexOf("/")) === 0 ? u : `/${u}`);
674
+ }, [u]), g(() => {
675
+ $ === void 0 || !b || k(e, "navigate", { path: $ }, E);
676
+ }, [$, b, e, k, E]), g(() => {
677
+ if (!s || !e || !M)
643
678
  return;
644
- if (!U) {
645
- n(), F(void 0);
679
+ if (!v) {
680
+ te(), P(void 0);
646
681
  return;
647
682
  }
648
- n();
649
- const l = new URL(s);
650
- return $(t, l.origin, T), X.current(), F(Ue(l.origin, t)), () => {
651
- S(t);
683
+ te();
684
+ const _ = new URL(s);
685
+ return x(e, _.origin, M), re.current(), P(Ye(_.origin, e)), () => {
686
+ O(e);
652
687
  };
653
- }, [s, t, U, $, T, n]), R(() => {
654
- if (!(!A || Q.current))
655
- return B.current = setTimeout(() => {
656
- H(!0), Y.current && Y.current();
657
- }, Ae), () => clearTimeout(B.current);
658
- }, [A, s, P, a]);
659
- const r = p(() => {
660
- Q.current = !0, clearTimeout(B.current), H(!1);
688
+ }, [s, e, v, x, M, te]);
689
+ const ae = h(() => {
690
+ C(!0), Q.current && Q.current();
661
691
  }, []);
662
- if (N(t, "init", (l) => {
663
- r(), Array.isArray(l == null ? void 0 : l.acceptsCredentials) && (d(l.acceptsCredentials), g.current = !1, clearTimeout(e.current), e.current = void 0);
664
- }), N(t, "authorize", r), N(t, "login", r), N(t, "credential-request", () => {
665
- r(), L(!0);
666
- }), R(() => {
667
- if (!K || !D)
692
+ g(() => {
693
+ if (!(!j || t.current))
694
+ return ce(W, qe, ae), () => Y(W);
695
+ }, [j, s, S, f, ae]);
696
+ const ie = h(() => {
697
+ t.current = !0, Y(W), C(!1);
698
+ }, []), me = h(() => {
699
+ const _ = X.current;
700
+ if (_ && !K.current) {
701
+ K.current = !0, k(e, "credential", _, E), n.current && n.current("redelivered"), ce(p, _e, me);
668
702
  return;
669
- const l = f;
670
- if (Array.isArray(l) && !l.includes(D.kind))
703
+ }
704
+ n.current && n.current("ready"), ae();
705
+ }, [e, k, E, ae]);
706
+ se(e, "init", (_) => {
707
+ ie(), ce(p, _e, me), Array.isArray(_ == null ? void 0 : _.acceptsCredentials) && B(_.acceptsCredentials);
708
+ }), se(e, "authorize", ie), se(e, "login", ie), se(e, "credential-request", () => {
709
+ ie(), N(!0);
710
+ }), g(() => {
711
+ if (!Z || !i)
712
+ return;
713
+ const _ = T;
714
+ if (Array.isArray(_) && !_.includes(i.kind))
671
715
  return;
672
- const x = D.kind === "access_token" ? { accessToken: D.accessToken } : {};
673
- I(t, "credential", { ...x, credential: D }, b), c(b, t, !0);
716
+ const de = { ...i.kind === "access_token" ? { accessToken: i.accessToken } : {}, credential: i };
717
+ return X.current = de, k(e, "credential", de, E), c(E, e, !0), clearTimeout(I.current), I.current = setTimeout(() => {
718
+ I.current = void 0, k(e, "credential", de, E);
719
+ }, He), () => clearTimeout(I.current);
674
720
  }, [
675
- K,
676
- D,
677
- f,
678
- t,
679
- I,
680
- b,
721
+ Z,
722
+ i,
723
+ T,
724
+ e,
725
+ k,
726
+ E,
681
727
  c
682
- ]), N(t, "ready", () => {
683
- r(), z((l) => l + 1);
684
- }), N(t, "heartbeat", () => {
685
- g.current && (e.current && clearTimeout(e.current), e.current = setTimeout(() => {
686
- o((l) => l + 1);
687
- }, 6e3));
688
- }), R(() => () => {
689
- e.current && clearTimeout(e.current);
690
- }, []), v)
691
- return j ? j(v) : /* @__PURE__ */ W.createElement(he, { entry: v });
692
- if (_ && !y)
693
- return V ? V() : /* @__PURE__ */ W.createElement($e, null);
694
- const i = { ...Z };
695
- return delete i.skipManifestCheck, /* @__PURE__ */ W.createElement(
696
- xe,
728
+ ]), se(e, "ready", () => {
729
+ ie(), Y(p), clearTimeout(I.current), I.current = void 0, G((_) => _ + 1);
730
+ });
731
+ const ve = h(() => {
732
+ r.current && r.current("heartbeat"), d((_) => _ + 1);
733
+ }, []);
734
+ if (se(e, "heartbeat", () => {
735
+ z.current = !0, ce(o, je, ve);
736
+ }), g(() => () => {
737
+ Y(o), Y(p), Y(W), clearTimeout(I.current);
738
+ }, []), a)
739
+ return H ? H(a) : /* @__PURE__ */ F.createElement(Me, { entry: a });
740
+ const be = !!(V && !b), ge = { ...U };
741
+ return delete ge.skipManifestCheck, /* @__PURE__ */ F.createElement(F.Fragment, null, be && (L ? L() : /* @__PURE__ */ F.createElement(Je, null)), /* @__PURE__ */ F.createElement(
742
+ Ge,
697
743
  {
698
- key: `auth-epoch-${P}-frame-${a}`,
699
- $isReady: y,
700
- ref: T,
701
- src: A,
702
- ...i
744
+ key: `auth-epoch-${S}-frame-${f}`,
745
+ $isReady: b,
746
+ $collapsed: be,
747
+ ref: M,
748
+ src: j,
749
+ ...ge
703
750
  }
704
- );
751
+ ));
705
752
  };
706
- Se.propTypes = {
753
+ Ne.propTypes = {
707
754
  id: w.string,
708
755
  src: w.string.isRequired,
709
756
  path: w.string,
710
757
  onInit: w.func,
711
758
  onTimeout: w.func,
759
+ /** Called with the reason ('heartbeat') just before the frame is re-keyed. */
760
+ onRemount: w.func,
761
+ /**
762
+ * Called when a frame that said init has not said ready: 'redelivered' when the held credential is
763
+ * sent once more, 'ready' when the failure message is shown instead.
764
+ */
765
+ onStall: w.func,
712
766
  /**
713
767
  * Optional host-styled renderer for the structurally-unsupported embed
714
768
  * state (legacy app on a cross-site origin), `(entry) => ReactNode`. Falls
@@ -723,18 +777,18 @@ Se.propTypes = {
723
777
  renderTimeout: w.func
724
778
  };
725
779
  export {
726
- ge as CREDENTIAL_KIND_ACCESS_TOKEN,
727
- te as EmbeddedAuthorizationContext,
728
- Se as MMEmbeddableZone,
729
- se as MMEmbeddableZoneContext,
730
- ye as MMEmbeddableZoneProvider,
731
- le as isCrossSite,
732
- ie as normalizeCredential,
733
- Te as popupAuthorizationLauncher,
734
- ze as unsupportedCopy,
735
- Ie as useEmbeddedAuthorizations,
736
- Me as useEmbeddedCredential,
737
- N as useEmbeddedEffect,
738
- _e as useEmbeddedOriginEpoch,
739
- Ce as useEmbeddedUnsupported
780
+ Ue as CREDENTIAL_KIND_ACCESS_TOKEN,
781
+ ue as EmbeddedAuthorizationContext,
782
+ Ne as MMEmbeddableZone,
783
+ le as MMEmbeddableZoneContext,
784
+ We as MMEmbeddableZoneProvider,
785
+ ke as isCrossSite,
786
+ Ee as normalizeCredential,
787
+ ze as popupAuthorizationLauncher,
788
+ Qe as unsupportedCopy,
789
+ De as useEmbeddedAuthorizations,
790
+ Pe as useEmbeddedCredential,
791
+ se as useEmbeddedEffect,
792
+ Fe as useEmbeddedOriginEpoch,
793
+ Be as useEmbeddedUnsupported
740
794
  };