@singlebase/elements 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/authui-display-C2o9gApg.cjs +961 -0
  2. package/dist/authui-display-C2o9gApg.cjs.map +1 -0
  3. package/dist/{authui-display-BM_F3-5e.js → authui-display-CRUABt43.js} +1009 -862
  4. package/dist/authui-display-CRUABt43.js.map +1 -0
  5. package/dist/authui.cjs +1 -1
  6. package/dist/authui.js +2 -2
  7. package/dist/{chat-ezUmd9II.cjs → chat-Bj6DrOaW.cjs} +237 -168
  8. package/dist/chat-Bj6DrOaW.cjs.map +1 -0
  9. package/dist/{chat-BH_3e1jT.js → chat-DNiqYF6F.js} +1098 -825
  10. package/dist/chat-DNiqYF6F.js.map +1 -0
  11. package/dist/chat-messages.d.ts +5 -0
  12. package/dist/chat.cjs +1 -1
  13. package/dist/chat.js +1 -1
  14. package/dist/elements/authui-account.d.ts +0 -1
  15. package/dist/elements/authui-buttons.d.ts +1 -1
  16. package/dist/elements/authui.d.ts +25 -1
  17. package/dist/elements/chat.d.ts +76 -4
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.js +3 -3
  20. package/dist/messages.d.ts +34 -3
  21. package/dist/singlebase-elements.min.js +3113 -2664
  22. package/dist/singlebase-elements.min.js.map +1 -1
  23. package/dist/{uploader-COP8PkJ6.cjs → uploader-C57vgFME.cjs} +27 -1
  24. package/dist/uploader-C57vgFME.cjs.map +1 -0
  25. package/dist/{uploader-tdMU9Gxv.js → uploader-Cz9yfzfV.js} +27 -1
  26. package/dist/uploader-Cz9yfzfV.js.map +1 -0
  27. package/dist/uploader.cjs +1 -1
  28. package/dist/uploader.js +1 -1
  29. package/dist/utils/auth-errors.d.ts +7 -0
  30. package/dist/utils/oauth.d.ts +24 -0
  31. package/dist/utils/password.d.ts +16 -0
  32. package/package.json +3 -3
  33. package/dist/authui-display-BM_F3-5e.js.map +0 -1
  34. package/dist/authui-display-CMVHTNFz.cjs +0 -956
  35. package/dist/authui-display-CMVHTNFz.cjs.map +0 -1
  36. package/dist/chat-BH_3e1jT.js.map +0 -1
  37. package/dist/chat-ezUmd9II.cjs.map +0 -1
  38. package/dist/uploader-COP8PkJ6.cjs.map +0 -1
  39. package/dist/uploader-tdMU9Gxv.js.map +0 -1
@@ -1,18 +1,18 @@
1
- var es = Object.defineProperty;
2
- var Ue = (r) => {
3
- throw TypeError(r);
1
+ var us = Object.defineProperty;
2
+ var qe = (a) => {
3
+ throw TypeError(a);
4
4
  };
5
- var ss = (r, t, e) => t in r ? es(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
6
- var b = (r, t, e) => ss(r, typeof t != "symbol" ? t + "" : t, e), Le = (r, t, e) => t.has(r) || Ue("Cannot " + e);
7
- var n = (r, t, e) => (Le(r, t, "read from private field"), e ? e.call(r) : t.get(r)), o = (r, t, e) => t.has(r) ? Ue("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), l = (r, t, e, s) => (Le(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e);
8
- import { LitElement as is, html as a, nothing as d, css as qe } from "lit";
9
- import { property as p, state as m, customElement as we } from "lit/decorators.js";
10
- import { ifDefined as k } from "lit/directives/if-defined.js";
11
- import { SinglebaseAuthError as Ee, mapErrorToHint as as, createFilesUploadApi as rs, resolveScreen as ns } from "@singlebase/singlebase-sdk";
12
- import { s as os, r as ls } from "./uploader-tdMU9Gxv.js";
13
- import { t as hs, b as ds, j as cs } from "./files-DS-H-3yN.js";
14
- import { getDefaultClient as us, AUTHUI_PROP_KEYS as ps, authUIAttributeFor as gs, matchesPredicate as ms, validatePredicate as bs, getPath as Ae } from "@singlebase/core";
15
- class fs {
5
+ var ps = (a, t, e) => t in a ? us(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
6
+ var b = (a, t, e) => ps(a, typeof t != "symbol" ? t + "" : t, e), je = (a, t, e) => t.has(a) || qe("Cannot " + e);
7
+ var n = (a, t, e) => (je(a, t, "read from private field"), e ? e.call(a) : t.get(a)), o = (a, t, e) => t.has(a) ? qe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e), l = (a, t, e, s) => (je(a, t, "write to private field"), s ? s.call(a, e) : t.set(a, e), e);
8
+ import { LitElement as gs, nothing as d, html as r, css as ts } from "lit";
9
+ import { property as p, state as m, customElement as Te } from "lit/decorators.js";
10
+ import { ifDefined as A } from "lit/directives/if-defined.js";
11
+ import { SinglebaseAuthError as Ne, mapErrorToHint as ms, createFilesUploadApi as bs, resolveScreen as fs } from "@singlebase/singlebase-sdk";
12
+ import { s as vs, r as ws } from "./uploader-Cz9yfzfV.js";
13
+ import { t as $s, b as ys, j as Es } from "./files-DS-H-3yN.js";
14
+ import { getDefaultClient as Ss, AUTHUI_PROP_KEYS as Cs, authUIAttributeFor as Ps, matchesPredicate as _s, validatePredicate as ks, getPath as Ke } from "@singlebase/core";
15
+ class Ts {
16
16
  constructor(t) {
17
17
  b(this, "host");
18
18
  b(this, "client", null);
@@ -31,7 +31,7 @@ class fs {
31
31
  (t = this.unsubscribe) == null || t.call(this), this.unsubscribe = null;
32
32
  }
33
33
  }
34
- const Me = {
34
+ const Ve = {
35
35
  signInTitle: "Sign in",
36
36
  signUpTitle: "Create your account",
37
37
  forgotTitle: "Reset your password",
@@ -61,7 +61,7 @@ const Me = {
61
61
  emailMethodMetaSignUp: "Create with an address",
62
62
  emailMethodMetaOtp: "One-time code",
63
63
  oauthMethodTitle: "Single sign-on",
64
- oauthMethodMeta: "Google, GitHub, and more",
64
+ oauthMethodMeta: "Use an account you already have",
65
65
  fullNameLabel: "Full name",
66
66
  fullNamePlaceholder: "Ada Lovelace",
67
67
  emailLabel: "Email",
@@ -69,10 +69,17 @@ const Me = {
69
69
  passwordLabel: "Password",
70
70
  passwordPlaceholder: "••••••••",
71
71
  newPasswordLabel: "New password",
72
- newPasswordPlaceholder: "At least 10 characters",
72
+ newPasswordPlaceholder: "At least {min} characters",
73
+ newPasswordPlaceholderPlain: "Choose a password",
74
+ passwordRulesLabel: "Password requirements",
75
+ passwordRuleLength: "{min}–{max} characters",
76
+ passwordRuleMinLength: "At least {min} characters",
77
+ passwordRuleLowercase: "A lowercase letter",
78
+ passwordRuleUppercase: "An uppercase letter",
79
+ passwordRuleNumber: "A number",
80
+ passwordRuleSymbol: "A symbol",
73
81
  confirmPasswordLabel: "Confirm password",
74
82
  confirmPasswordPlaceholder: "Repeat it",
75
- currentPasswordLabel: "Current password",
76
83
  firstNameLabel: "First name",
77
84
  firstNamePlaceholder: "Ada",
78
85
  lastNameLabel: "Last name",
@@ -88,7 +95,6 @@ const Me = {
88
95
  footActionSignUp: "Sign in",
89
96
  resendQuestion: "Did not get it?",
90
97
  resendCta: "Resend code",
91
- oauthPrimaryLabel: "Continue with Google",
92
98
  oauthContinueWith: "Continue with",
93
99
  blockedTitleDisabled: "Sign-in is turned off",
94
100
  blockedTitleUnavailable: "Sign-in unavailable",
@@ -136,14 +142,32 @@ const Me = {
136
142
  newUsernameLabel: "New username",
137
143
  changeUsernameCta: "Send verification code",
138
144
  genericErrorMessage: "Something went wrong. Please try again.",
139
- rateLimitedMessage: "Too many attempts. Try again in 5 minutes or reset your password.",
145
+ rateLimitedMessage: "Too many attempts. Wait a few minutes, then try again.",
140
146
  codeSentNeutral: "If an eligible account exists, a code has been sent.",
141
147
  invalidEmailError: "Enter a valid email address.",
142
148
  requiredError: "This cannot be empty.",
143
- passwordMinError: "Use at least 10 characters.",
149
+ passwordTooShortError: "Use at least {min} characters.",
150
+ passwordTooLongError: "Use at most {max} characters.",
151
+ passwordNeedsLowercaseError: "Include a lowercase letter.",
152
+ passwordNeedsUppercaseError: "Include an uppercase letter.",
153
+ passwordNeedsNumberError: "Include a number.",
154
+ passwordNeedsSymbolError: "Include a symbol.",
155
+ invalidPasswordMessage: "That password doesn't meet the requirements.",
144
156
  passwordMatchError: "Both passwords must match.",
157
+ invalidCodeError: "That code is not valid. Check it and try again.",
158
+ invalidCredentialsError: "That email and password do not match.",
159
+ codeResentNotice: "New code sent.",
160
+ confirmNewPasswordLabel: "Confirm new password",
161
+ notSignedInNote: "Not signed in.",
162
+ connectProviderLabel: "Connect {name}",
163
+ digitLabel: "Digit {n}",
164
+ accountCreatedNotice: "Account created. Sign in to continue.",
165
+ inviteCodeLabel: "Invite code",
166
+ submittingStatus: "Submitting…",
167
+ doneStatus: "Done.",
145
168
  codeIncompleteError: "Enter all six digits.",
146
169
  invalidPhoneError: "Enter a valid phone number.",
170
+ firstNameRequiredError: "Enter your first name.",
147
171
  notYetSupported: "Not yet supported",
148
172
  alreadySignedInTitle: "You are already signed in",
149
173
  alreadySignedInSub: "Continue where you left off, or sign out to use another account.",
@@ -164,64 +188,71 @@ const Me = {
164
188
  linkRequiresSignIn: "Sign in first, then link a provider.",
165
189
  oauthCallbackTitle: "Finishing sign-in",
166
190
  oauthCallbackSub: "One moment while we complete your sign-in.",
167
- oauthDenied: "Sign-in was cancelled or denied."
191
+ oauthDenied: "Sign-in was cancelled or denied.",
192
+ oauthRetryMessage: "We couldn't finish signing you in with that provider. Please try again.",
193
+ oauthUnavailableMessage: "This sign-in option isn't available right now.",
194
+ oauthVerifiedEmailMessage: "Your provider account needs a verified email address. Verify it with the provider, then try again.",
195
+ providerConnectedNotice: "{name} is now connected to your account.",
196
+ signInToLinkMessage: "An account with this email already exists. Sign in first, then connect the provider from your account.",
197
+ providerAlreadyLinkedMessage: "That provider account is already connected to another account.",
198
+ oauthNoAccountMessage: "There's no account for that provider yet. Create an account first, or sign in another way."
168
199
  };
169
- function vs(r) {
170
- return r ? { ...Me, ...r } : Me;
200
+ function Os(a) {
201
+ return a ? { ...Ve, ...a } : Ve;
171
202
  }
172
- var ws = Object.defineProperty, $s = Object.getOwnPropertyDescriptor, _ = (r, t, e, s) => {
173
- for (var i = $s(t, e), h = r.length - 1, c; h >= 0; h--)
174
- (c = r[h]) && (i = c(t, e, i) || i);
175
- return i && ws(t, e, i), i;
176
- }, x, U, L, A, M, N;
177
- class $ extends is {
203
+ var Ns = Object.defineProperty, As = Object.getOwnPropertyDescriptor, L = (a, t, e, s) => {
204
+ for (var i = As(t, e), h = a.length - 1, c; h >= 0; h--)
205
+ (c = a[h]) && (i = c(t, e, i) || i);
206
+ return i && Ns(t, e, i), i;
207
+ }, D, B, H, q, j, K;
208
+ class y extends gs {
178
209
  constructor() {
179
210
  super(...arguments);
180
- o(this, x, null);
181
- o(this, U, {});
182
- o(this, L);
183
- o(this, A);
184
- o(this, M);
185
- o(this, N);
186
- b(this, "auth", new fs(this));
211
+ o(this, D, null);
212
+ o(this, B, {});
213
+ o(this, H);
214
+ o(this, q);
215
+ o(this, j);
216
+ o(this, K);
217
+ b(this, "auth", new Ts(this));
187
218
  /** Config keys already applied, so a later render does not fight the host. */
188
219
  b(this, "appliedConfig", /* @__PURE__ */ new Set());
189
220
  }
190
221
  get client() {
191
- return n(this, x);
222
+ return n(this, D);
192
223
  }
193
224
  set client(e) {
194
- l(this, x, e);
225
+ l(this, D, e);
195
226
  }
196
227
  get messages() {
197
- return n(this, U);
228
+ return n(this, B);
198
229
  }
199
230
  set messages(e) {
200
- l(this, U, e);
231
+ l(this, B, e);
201
232
  }
202
233
  get theme() {
203
- return n(this, L);
234
+ return n(this, H);
204
235
  }
205
236
  set theme(e) {
206
- l(this, L, e);
237
+ l(this, H, e);
207
238
  }
208
239
  get density() {
209
- return n(this, A);
240
+ return n(this, q);
210
241
  }
211
242
  set density(e) {
212
- l(this, A, e);
243
+ l(this, q, e);
213
244
  }
214
245
  get fieldStyle() {
215
- return n(this, M);
246
+ return n(this, j);
216
247
  }
217
248
  set fieldStyle(e) {
218
- l(this, M, e);
249
+ l(this, j, e);
219
250
  }
220
251
  get radius() {
221
- return n(this, N);
252
+ return n(this, K);
222
253
  }
223
254
  set radius(e) {
224
- l(this, N, e);
255
+ l(this, K, e);
225
256
  }
226
257
  /**
227
258
  * Resolution order: an explicit `.client`, then the page's default
@@ -237,7 +268,7 @@ class $ extends is {
237
268
  */
238
269
  get resolvedClient() {
239
270
  var e;
240
- return this.client ? this.client : ((e = us()) == null ? void 0 : e.auth) ?? null;
271
+ return this.client ? this.client : ((e = Ss()) == null ? void 0 : e.auth) ?? null;
241
272
  }
242
273
  /** Page-wide UI config from SinglebaseClient({ authui }), if there is one. */
243
274
  get uiConfig() {
@@ -251,7 +282,7 @@ class $ extends is {
251
282
  get msg() {
252
283
  var s;
253
284
  const e = (s = this.uiConfig) == null ? void 0 : s.messages;
254
- return vs(e ? { ...e, ...this.messages } : this.messages);
285
+ return Os(e ? { ...e, ...this.messages } : this.messages);
255
286
  }
256
287
  /**
257
288
  * Copies the page-wide config onto this element.
@@ -265,9 +296,9 @@ class $ extends is {
265
296
  applyUIConfig() {
266
297
  const e = this.uiConfig;
267
298
  if (e) {
268
- for (const s of ps) {
299
+ for (const s of Cs) {
269
300
  const i = e[s];
270
- i !== void 0 && s in this && (this.hasAttribute(gs(s)) || this.appliedConfig.has(s) || (this.appliedConfig.add(s), this[s] = i));
301
+ i !== void 0 && s in this && (this.hasAttribute(Ps(s)) || this.appliedConfig.has(s) || (this.appliedConfig.add(s), this[s] = i));
271
302
  }
272
303
  for (const [s, i] of Object.entries(e.tokens ?? {}))
273
304
  s.startsWith("--") && (this.style.getPropertyValue(s) || this.style.setProperty(s, i));
@@ -294,26 +325,26 @@ class $ extends is {
294
325
  super.willUpdate(e), this.auth.bind(this.resolvedClient), this.applyUIConfig();
295
326
  }
296
327
  }
297
- x = new WeakMap(), U = new WeakMap(), L = new WeakMap(), A = new WeakMap(), M = new WeakMap(), N = new WeakMap(), b($, "styles", [hs, os]);
298
- _([
328
+ D = new WeakMap(), B = new WeakMap(), H = new WeakMap(), q = new WeakMap(), j = new WeakMap(), K = new WeakMap(), b(y, "styles", [$s, vs]);
329
+ L([
299
330
  p({ attribute: !1 })
300
- ], $.prototype, "client");
301
- _([
331
+ ], y.prototype, "client");
332
+ L([
302
333
  p({ attribute: !1 })
303
- ], $.prototype, "messages");
304
- _([
334
+ ], y.prototype, "messages");
335
+ L([
305
336
  p({ reflect: !0 })
306
- ], $.prototype, "theme");
307
- _([
337
+ ], y.prototype, "theme");
338
+ L([
308
339
  p({ reflect: !0 })
309
- ], $.prototype, "density");
310
- _([
340
+ ], y.prototype, "density");
341
+ L([
311
342
  p({ reflect: !0, attribute: "field-style" })
312
- ], $.prototype, "fieldStyle");
313
- _([
343
+ ], y.prototype, "fieldStyle");
344
+ L([
314
345
  p({ reflect: !0 })
315
- ], $.prototype, "radius");
316
- class Ce {
346
+ ], y.prototype, "radius");
347
+ class De {
317
348
  constructor(t) {
318
349
  b(this, "host");
319
350
  b(this, "client", null);
@@ -339,7 +370,7 @@ class Ce {
339
370
  });
340
371
  }
341
372
  }
342
- const ys = [
373
+ const Ls = [
343
374
  "load",
344
375
  "success",
345
376
  "error",
@@ -354,7 +385,7 @@ const ys = [
354
385
  "expired",
355
386
  "navigate",
356
387
  "goto"
357
- ], Es = {
388
+ ], xs = {
358
389
  load: "auth:ready",
359
390
  signin: "auth:signin",
360
391
  signup: "auth:signup",
@@ -364,31 +395,31 @@ const ys = [
364
395
  error: "auth:error",
365
396
  navigate: "auth:navigate"
366
397
  };
367
- function Ne(r) {
368
- return "on" + r.replace(/(^|-)([a-z])/g, (t, e, s) => s.toUpperCase());
398
+ function Ge(a) {
399
+ return "on" + a.replace(/(^|-)([a-z])/g, (t, e, s) => s.toUpperCase());
369
400
  }
370
- class Ss {
401
+ class Us {
371
402
  constructor(t) {
372
403
  b(this, "unsubscribes", []);
373
404
  b(this, "client", null);
374
405
  this.host = t, t.addController(this);
375
406
  }
376
407
  bind(t) {
377
- t !== this.client && (this.release(), this.client = t, t && (this.unsubscribes = ys.map(
408
+ t !== this.client && (this.release(), this.client = t, t && (this.unsubscribes = Ls.map(
378
409
  (e) => t.on(e, (s) => this.publish(e, s))
379
410
  )));
380
411
  }
381
412
  publish(t, e) {
382
- const s = this.host[Ne(t)];
413
+ const s = this.host[Ge(t)];
383
414
  if (typeof s == "function")
384
415
  try {
385
416
  s.call(this.host, e);
386
417
  } catch (c) {
387
- console.error(`[singlebase] ${Ne(t)} threw:`, c);
418
+ console.error(`[singlebase] ${Ge(t)} threw:`, c);
388
419
  }
389
420
  const i = { detail: e, bubbles: !0, composed: !0 };
390
421
  this.host.dispatchEvent(new CustomEvent(`singlebase-${t}`, i));
391
- const h = Es[t];
422
+ const h = xs[t];
392
423
  h && this.host.dispatchEvent(new CustomEvent(h, i));
393
424
  }
394
425
  release() {
@@ -398,36 +429,112 @@ class Ss {
398
429
  this.release(), this.client = null;
399
430
  }
400
431
  }
401
- var Cs = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, Pe = (r, t, e, s) => {
402
- for (var i = Ps(t, e), h = r.length - 1, c; h >= 0; h--)
403
- (c = r[h]) && (i = c(t, e, i) || i);
404
- return i && Cs(t, e, i), i;
405
- }, I, F, D;
406
- class $e extends $ {
432
+ const Ae = (a) => `${a}:link`, Ms = { google: "G", github: "GH", linkedin: "in", facebook: "f" };
433
+ function es(a) {
434
+ var e;
435
+ const t = a == null ? void 0 : a.oauth_settings;
436
+ return !!(t != null && t.enabled) && !!((e = t.redirect_url) != null && e.trim());
437
+ }
438
+ function Is(a, t) {
439
+ return t === "signin" && (a != null && a.oauth_settings.allow_signup) ? "signup" : t;
440
+ }
441
+ function R(a, t) {
442
+ if (!a || !es(a)) return [];
443
+ const e = a.oauth_settings;
444
+ return t === "signin" && !e.allow_signin ? [] : t === "signup" && !e.allow_signup ? [] : Object.entries(a.oauth_providers ?? {}).filter(([, s]) => s.enabled).map(([s, i]) => ({
445
+ id: s,
446
+ name: i.provider_name,
447
+ mark: Ms[s] ?? i.provider_name.slice(0, 2)
448
+ }));
449
+ }
450
+ function Fe(a, t) {
451
+ if (!(a instanceof Ne)) return t.genericErrorMessage;
452
+ switch (ms(a.code)) {
453
+ case "disable_retry_show_rate_limited":
454
+ return t.rateLimitedMessage;
455
+ case "show_password_requirements":
456
+ return t.invalidPasswordMessage;
457
+ case "expired_or_invalid_code_message":
458
+ return t.invalidCodeError;
459
+ case "explain_verified_email_required":
460
+ return t.oauthVerifiedEmailMessage;
461
+ case "restart_oauth":
462
+ case "restart_oauth_new_nonce":
463
+ return t.oauthRetryMessage;
464
+ case "ask_signin_then_link":
465
+ return t.signInToLinkMessage;
466
+ case "provider_already_linked":
467
+ return t.providerAlreadyLinkedMessage;
468
+ case "hide_oauth":
469
+ case "remove_oauth_from_signin":
470
+ case "remove_oauth_from_signup":
471
+ case "refresh_settings_hide_provider":
472
+ return t.oauthUnavailableMessage;
473
+ case "show_integrator_config_error":
474
+ return console.warn(`[singlebase] Auth is misconfigured for this project (${a.code}).`), a.code === "MISSING_OAUTH_CREDENTIALS" ? t.oauthUnavailableMessage : t.genericErrorMessage;
475
+ default:
476
+ return t.genericErrorMessage;
477
+ }
478
+ }
479
+ function ss(a, t) {
480
+ var s;
481
+ const e = (s = a == null ? void 0 : a.LENGTH) == null ? void 0 : s[0];
482
+ return e ? t.newPasswordPlaceholder.replace("{min}", String(e)) : t.newPasswordPlaceholderPlain;
483
+ }
484
+ function is(a, t, e) {
485
+ if (!a) return e.requiredError;
486
+ if (!t) return "";
487
+ const [s, i] = t.LENGTH ?? [0, 0];
488
+ return s && a.length < s ? e.passwordTooShortError.replace("{min}", String(s)) : i && a.length > i ? e.passwordTooLongError.replace("{max}", String(i)) : t.LOWERCASE && !/[a-z]/.test(a) ? e.passwordNeedsLowercaseError : t.UPPERCASE && !/[A-Z]/.test(a) ? e.passwordNeedsUppercaseError : t.NUMBERS && !/\d/.test(a) ? e.passwordNeedsNumberError : t.SYMBOLS && !/[^A-Za-z0-9\s]/.test(a) ? e.passwordNeedsSymbolError : "";
489
+ }
490
+ function Rs(a, t) {
491
+ if (!a) return [];
492
+ const [e, s] = a.LENGTH ?? [0, 0], i = [];
493
+ if (e || s) {
494
+ const h = s ? t.passwordRuleLength.replace("{min}", String(e || 1)).replace("{max}", String(s)) : t.passwordRuleMinLength.replace("{min}", String(e));
495
+ i.push({ label: h });
496
+ }
497
+ return a.LOWERCASE && i.push({ label: t.passwordRuleLowercase }), a.UPPERCASE && i.push({ label: t.passwordRuleUppercase }), a.NUMBERS && i.push({ label: t.passwordRuleNumber }), a.SYMBOLS && i.push({ label: t.passwordRuleSymbol }), i;
498
+ }
499
+ function as(a, t) {
500
+ const e = Rs(a, t);
501
+ return e.length === 0 ? d : r`<details class="pw-rules" part="password-rules">
502
+ <summary>${t.passwordRulesLabel}</summary>
503
+ <ul>
504
+ ${e.map((s) => r`<li>${s.label}</li>`)}
505
+ </ul>
506
+ </details>`;
507
+ }
508
+ var Fs = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, Be = (a, t, e, s) => {
509
+ for (var i = Ds(t, e), h = a.length - 1, c; h >= 0; h--)
510
+ (c = a[h]) && (i = c(t, e, i) || i);
511
+ return i && Fs(t, e, i), i;
512
+ }, V, G, W;
513
+ class Oe extends y {
407
514
  constructor() {
408
515
  super(...arguments);
409
- o(this, I, "idle");
410
- o(this, F, "");
411
- o(this, D, "");
516
+ o(this, V, "idle");
517
+ o(this, G, "");
518
+ o(this, W, "");
412
519
  b(this, "abortController", null);
413
520
  }
414
521
  get phase() {
415
- return n(this, I);
522
+ return n(this, V);
416
523
  }
417
524
  set phase(e) {
418
- l(this, I, e);
525
+ l(this, V, e);
419
526
  }
420
527
  get formError() {
421
- return n(this, F);
528
+ return n(this, G);
422
529
  }
423
530
  set formError(e) {
424
- l(this, F, e);
531
+ l(this, G, e);
425
532
  }
426
533
  get noticeMessage() {
427
- return n(this, D);
534
+ return n(this, W);
428
535
  }
429
536
  set noticeMessage(e) {
430
- l(this, D, e);
537
+ l(this, W, e);
431
538
  }
432
539
  disconnectedCallback() {
433
540
  var e;
@@ -451,88 +558,83 @@ class $e extends $ {
451
558
  return e instanceof DOMException && e.name === "AbortError";
452
559
  }
453
560
  describeError(e) {
454
- if (e instanceof Ee) {
455
- const s = as(e.code);
456
- return s === "disable_retry_show_rate_limited" ? this.msg.rateLimitedMessage : s === "generic_credentials_message" ? this.msg.genericErrorMessage : this.msg.genericErrorMessage;
457
- }
458
- return this.msg.genericErrorMessage;
561
+ return Fe(e, this.msg);
459
562
  }
460
563
  get submitting() {
461
564
  return this.phase === "submitting";
462
565
  }
463
566
  /** aria-live region for async status — spec requires one per form. */
464
567
  renderStatus() {
465
- return a`
568
+ return r`
466
569
  <div
467
570
  role="status"
468
571
  aria-live="polite"
469
572
  style="position:absolute;width:1px;height:1px;overflow:hidden;"
470
573
  >
471
- ${this.phase === "submitting" ? "Submitting…" : ""}
472
- ${this.phase === "success" ? "Done." : ""}
574
+ ${this.phase === "submitting" ? this.msg.submittingStatus : ""}
575
+ ${this.phase === "success" ? this.msg.doneStatus : ""}
473
576
  </div>
474
- ${this.formError ? a`<p class="banner" role="alert">${this.formError}</p>` : null}
475
- ${this.noticeMessage ? a`<p class="notice" role="status">${this.noticeMessage}</p>` : null}
577
+ ${this.formError ? r`<p class="banner" role="alert">${this.formError}</p>` : null}
578
+ ${this.noticeMessage ? r`<p class="notice" role="status">${this.noticeMessage}</p>` : null}
476
579
  `;
477
580
  }
478
581
  }
479
- I = new WeakMap(), F = new WeakMap(), D = new WeakMap();
480
- Pe([
582
+ V = new WeakMap(), G = new WeakMap(), W = new WeakMap();
583
+ Be([
481
584
  m()
482
- ], $e.prototype, "phase");
483
- Pe([
585
+ ], Oe.prototype, "phase");
586
+ Be([
484
587
  m()
485
- ], $e.prototype, "formError");
486
- Pe([
588
+ ], Oe.prototype, "formError");
589
+ Be([
487
590
  m()
488
- ], $e.prototype, "noticeMessage");
489
- function Ve(r) {
490
- return [r == null ? void 0 : r.first_name, r == null ? void 0 : r.last_name].filter(Boolean).join(" ").trim();
591
+ ], Oe.prototype, "noticeMessage");
592
+ function rs(a) {
593
+ return [a == null ? void 0 : a.first_name, a == null ? void 0 : a.last_name].filter(Boolean).join(" ").trim();
491
594
  }
492
- function Ge(r) {
493
- const t = Ve(r);
595
+ function ns(a) {
596
+ const t = rs(a);
494
597
  if (t)
495
598
  return t.split(/\s+/).map((s) => s[0]).join("").slice(0, 2).toUpperCase();
496
- const e = (r == null ? void 0 : r.email) ?? "";
599
+ const e = (a == null ? void 0 : a.email) ?? "";
497
600
  return e ? e[0].toUpperCase() : "·";
498
601
  }
499
- var ks = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, v = (r, t, e, s) => {
500
- for (var i = s > 1 ? void 0 : s ? _s(t, e) : t, h = r.length - 1, c; h >= 0; h--)
501
- (c = r[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
502
- return s && i && ks(t, e, i), i;
602
+ var Bs = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, w = (a, t, e, s) => {
603
+ for (var i = s > 1 ? void 0 : s ? Hs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
604
+ (c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
605
+ return s && i && Bs(t, e, i), i;
503
606
  };
504
- const Os = { profile_photo: !0 }, Ts = ".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp";
505
- var B, R, j, H, q, V, G, K, Y, W, z, J, Q, X, Z, tt, et, st, it, at, rt, nt, ot, lt, ht, dt, De;
506
- let f = (De = class extends $e {
607
+ const qs = { profile_photo: !0 }, js = ".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp";
608
+ var Y, z, J, Z, Q, X, tt, et, st, it, at, rt, nt, ot, lt, ht, dt, ct, ut, pt, gt, mt, bt, ft, vt, ze;
609
+ let v = (ze = class extends Oe {
507
610
  constructor() {
508
611
  super(...arguments);
509
- o(this, B, "");
510
- o(this, R, "");
511
- o(this, j, null);
512
- o(this, H, "singlebase-oauth-nonce");
513
- o(this, q, "");
514
- o(this, V, "");
515
- o(this, G, !1);
516
- o(this, K, "");
517
612
  o(this, Y, "");
518
- o(this, W, "");
519
613
  o(this, z, "");
520
- o(this, J, "");
521
- o(this, Q, 0);
614
+ o(this, J, null);
615
+ o(this, Z, "singlebase-oauth-nonce");
616
+ o(this, Q, "");
522
617
  o(this, X, "");
523
- o(this, Z, "");
524
- o(this, tt, "");
618
+ o(this, tt, !1);
525
619
  o(this, et, "");
526
620
  o(this, st, "");
527
- o(this, it, "request");
621
+ o(this, it, "");
528
622
  o(this, at, "");
529
623
  o(this, rt, "");
530
- o(this, nt, "");
624
+ o(this, nt, 0);
531
625
  o(this, ot, "");
532
626
  o(this, lt, "");
533
627
  o(this, ht, "");
534
628
  o(this, dt, "");
535
- b(this, "settingsCtl", new Ce(this));
629
+ o(this, ct, "");
630
+ o(this, ut, "request");
631
+ o(this, pt, "");
632
+ o(this, gt, "");
633
+ o(this, mt, "");
634
+ o(this, bt, "");
635
+ o(this, ft, "");
636
+ o(this, vt, "");
637
+ b(this, "settingsCtl", new De(this));
536
638
  b(this, "flashTimer");
537
639
  b(this, "uidBase", `sb-acct-${Math.random().toString(36).slice(2, 8)}`);
538
640
  // ── profile photo ─────────────────────────────────────────
@@ -562,160 +664,154 @@ let f = (De = class extends $e {
562
664
  });
563
665
  }
564
666
  get logoText() {
565
- return n(this, B);
667
+ return n(this, Y);
566
668
  }
567
669
  set logoText(t) {
568
- l(this, B, t);
670
+ l(this, Y, t);
569
671
  }
570
672
  get logoUrl() {
571
- return n(this, R);
673
+ return n(this, z);
572
674
  }
573
675
  set logoUrl(t) {
574
- l(this, R, t);
676
+ l(this, z, t);
575
677
  }
576
678
  get settings() {
577
- return n(this, j);
679
+ return n(this, J);
578
680
  }
579
681
  set settings(t) {
580
- l(this, j, t);
682
+ l(this, J, t);
581
683
  }
582
684
  get nonceStorageKey() {
583
- return n(this, H);
685
+ return n(this, Z);
584
686
  }
585
687
  set nonceStorageKey(t) {
586
- l(this, H, t);
688
+ l(this, Z, t);
587
689
  }
588
690
  get editMode() {
589
- return n(this, q);
691
+ return n(this, Q);
590
692
  }
591
693
  set editMode(t) {
592
- l(this, q, t);
694
+ l(this, Q, t);
593
695
  }
594
696
  get toast() {
595
- return n(this, V);
697
+ return n(this, X);
596
698
  }
597
699
  set toast(t) {
598
- l(this, V, t);
700
+ l(this, X, t);
599
701
  }
600
702
  get photoBusy() {
601
- return n(this, G);
703
+ return n(this, tt);
602
704
  }
603
705
  set photoBusy(t) {
604
- l(this, G, t);
706
+ l(this, tt, t);
605
707
  }
606
708
  get photoFailed() {
607
- return n(this, K);
709
+ return n(this, et);
608
710
  }
609
711
  set photoFailed(t) {
610
- l(this, K, t);
712
+ l(this, et, t);
611
713
  }
612
714
  get profileSaved() {
613
- return n(this, Y);
715
+ return n(this, st);
614
716
  }
615
717
  set profileSaved(t) {
616
- l(this, Y, t);
718
+ l(this, st, t);
617
719
  }
618
720
  get passSaved() {
619
- return n(this, W);
721
+ return n(this, it);
620
722
  }
621
723
  set passSaved(t) {
622
- l(this, W, t);
724
+ l(this, it, t);
623
725
  }
624
726
  get profileError() {
625
- return n(this, z);
727
+ return n(this, at);
626
728
  }
627
729
  set profileError(t) {
628
- l(this, z, t);
730
+ l(this, at, t);
629
731
  }
630
732
  get newPassError() {
631
- return n(this, J);
733
+ return n(this, rt);
632
734
  }
633
735
  set newPassError(t) {
634
- l(this, J, t);
736
+ l(this, rt, t);
635
737
  }
636
738
  get deleteStage() {
637
- return n(this, Q);
739
+ return n(this, nt);
638
740
  }
639
741
  set deleteStage(t) {
640
- l(this, Q, t);
742
+ l(this, nt, t);
641
743
  }
642
744
  get confirmText() {
643
- return n(this, X);
745
+ return n(this, ot);
644
746
  }
645
747
  set confirmText(t) {
646
- l(this, X, t);
748
+ l(this, ot, t);
647
749
  }
648
750
  get dFirst() {
649
- return n(this, Z);
751
+ return n(this, lt);
650
752
  }
651
753
  set dFirst(t) {
652
- l(this, Z, t);
754
+ l(this, lt, t);
653
755
  }
654
756
  get dLast() {
655
- return n(this, tt);
757
+ return n(this, ht);
656
758
  }
657
759
  set dLast(t) {
658
- l(this, tt, t);
760
+ l(this, ht, t);
659
761
  }
660
762
  get dPhone() {
661
- return n(this, et);
763
+ return n(this, dt);
662
764
  }
663
765
  set dPhone(t) {
664
- l(this, et, t);
766
+ l(this, dt, t);
665
767
  }
666
768
  get dEmail() {
667
- return n(this, st);
769
+ return n(this, ct);
668
770
  }
669
771
  set dEmail(t) {
670
- l(this, st, t);
772
+ l(this, ct, t);
671
773
  }
672
774
  get emailStep() {
673
- return n(this, it);
775
+ return n(this, ut);
674
776
  }
675
777
  set emailStep(t) {
676
- l(this, it, t);
778
+ l(this, ut, t);
677
779
  }
678
780
  get dNewEmail() {
679
- return n(this, at);
781
+ return n(this, pt);
680
782
  }
681
783
  set dNewEmail(t) {
682
- l(this, at, t);
784
+ l(this, pt, t);
683
785
  }
684
786
  get emailCode() {
685
- return n(this, rt);
787
+ return n(this, gt);
686
788
  }
687
789
  set emailCode(t) {
688
- l(this, rt, t);
790
+ l(this, gt, t);
689
791
  }
690
792
  get emailError() {
691
- return n(this, nt);
793
+ return n(this, mt);
692
794
  }
693
795
  set emailError(t) {
694
- l(this, nt, t);
796
+ l(this, mt, t);
695
797
  }
696
798
  get emailSaved() {
697
- return n(this, ot);
799
+ return n(this, bt);
698
800
  }
699
801
  set emailSaved(t) {
700
- l(this, ot, t);
701
- }
702
- get curPass() {
703
- return n(this, lt);
704
- }
705
- set curPass(t) {
706
- l(this, lt, t);
802
+ l(this, bt, t);
707
803
  }
708
804
  get newPass() {
709
- return n(this, ht);
805
+ return n(this, ft);
710
806
  }
711
807
  set newPass(t) {
712
- l(this, ht, t);
808
+ l(this, ft, t);
713
809
  }
714
810
  get confirmPass() {
715
- return n(this, dt);
811
+ return n(this, vt);
716
812
  }
717
813
  set confirmPass(t) {
718
- l(this, dt, t);
814
+ l(this, vt, t);
719
815
  }
720
816
  uid(t) {
721
817
  return `${this.uidBase}-${t}`;
@@ -733,22 +829,22 @@ let f = (De = class extends $e {
733
829
  }
734
830
  /** Matches the guest screens: image when given one, else the text label. */
735
831
  renderLogo() {
736
- return this.logoUrl ? a`<img
832
+ return this.logoUrl ? r`<img
737
833
  part="logo"
738
834
  src=${this.logoUrl}
739
835
  alt=${this.logoText}
740
836
  style="display:block;align-self:flex-start;height:var(--sb-logo-height,20px);width:auto;max-width:100%"
741
- />` : this.logoText ? a`<div class="logo-dot" part="logo">${this.logoText}</div>` : d;
837
+ />` : this.logoText ? r`<div class="logo-dot" part="logo">${this.logoText}</div>` : d;
742
838
  }
743
839
  get user() {
744
840
  const t = this.auth.state;
745
841
  return t.status === "authenticated" ? t.user : null;
746
842
  }
747
843
  get fullName() {
748
- return Ve(this.user);
844
+ return rs(this.user);
749
845
  }
750
846
  get initials() {
751
- return Ge(this.user);
847
+ return ns(this.user);
752
848
  }
753
849
  /**
754
850
  * The upload API bound to the same dispatcher as this widget's auth client,
@@ -757,7 +853,7 @@ let f = (De = class extends $e {
757
853
  */
758
854
  get uploadClient() {
759
855
  const t = this.resolvedClient;
760
- return t ? (this.uploadClientFor !== t && (this.uploadClientFor = t, this.uploadClientCache = { files: rs(t.dispatcher) }), this.uploadClientCache) : null;
856
+ return t ? (this.uploadClientFor !== t && (this.uploadClientFor = t, this.uploadClientCache = { files: bs(t.dispatcher) }), this.uploadClientCache) : null;
761
857
  }
762
858
  startProfileEdit() {
763
859
  const t = this.user;
@@ -765,45 +861,43 @@ let f = (De = class extends $e {
765
861
  }
766
862
  async onSaveProfile() {
767
863
  const t = this.resolvedClient;
768
- if (t) {
769
- if (!this.dFirst.trim() || !this.dLast.trim()) {
770
- this.profileError = "First and last name cannot be empty.";
771
- return;
772
- }
773
- if (this.dPhone.replace(/\D/g, "").length < 7) {
774
- this.profileError = this.msg.invalidPhoneError;
775
- return;
776
- }
777
- await this.run(async () => {
778
- await t.updateAccount(
779
- { first_name: this.dFirst, last_name: this.dLast, phone: this.dPhone },
780
- this.signal
781
- ), this.editMode = "", this.flash("profileSaved", this.msg.savedNote);
782
- });
864
+ if (!t) return;
865
+ const e = this.dFirst.trim(), s = this.dLast.trim(), i = this.dPhone.trim();
866
+ if (!e) {
867
+ this.profileError = this.msg.firstNameRequiredError;
868
+ return;
869
+ }
870
+ if (i && i.replace(/\D/g, "").length < 7) {
871
+ this.profileError = this.msg.invalidPhoneError;
872
+ return;
873
+ }
874
+ const h = this.user, c = {};
875
+ if (e !== ((h == null ? void 0 : h.first_name) ?? "") && (c.first_name = e), s !== ((h == null ? void 0 : h.last_name) ?? "") && (c.last_name = s), i !== ((h == null ? void 0 : h.phone) ?? "") && (c.phone = i), Object.keys(c).length === 0) {
876
+ this.editMode = "";
877
+ return;
783
878
  }
879
+ await this.run(async () => {
880
+ await t.updateAccount(c, this.signal), this.editMode = "", this.flash("profileSaved", this.msg.savedNote);
881
+ });
784
882
  }
785
883
  startPassEdit() {
786
- this.curPass = "", this.newPass = "", this.confirmPass = "", this.newPassError = "", this.passSaved = "", this.profileSaved = "", this.toast = "", this.editMode = "password";
884
+ this.newPass = "", this.confirmPass = "", this.newPassError = "", this.passSaved = "", this.profileSaved = "", this.toast = "", this.editMode = "password";
787
885
  }
788
886
  async onChangePass() {
789
887
  const t = this.resolvedClient;
790
- if (t) {
791
- if (!this.curPass) {
792
- this.newPassError = "Enter your current password.";
793
- return;
794
- }
795
- if (this.newPass.length < 10) {
796
- this.newPassError = this.msg.passwordMinError;
797
- return;
798
- }
799
- if (this.newPass !== this.confirmPass) {
800
- this.newPassError = this.msg.passwordMatchError;
801
- return;
802
- }
803
- await this.run(async () => {
804
- await t.changePassword({ password: this.newPass }, this.signal), this.editMode = "", this.curPass = "", this.newPass = "", this.confirmPass = "", this.flash("passSaved", this.msg.passwordUpdatedNote);
805
- });
888
+ if (!t) return;
889
+ const e = this.settings ?? this.settingsCtl.settings, s = is(this.newPass, e == null ? void 0 : e.auth_settings.password_policy, this.msg);
890
+ if (s) {
891
+ this.newPassError = s;
892
+ return;
893
+ }
894
+ if (this.newPass !== this.confirmPass) {
895
+ this.newPassError = this.msg.passwordMatchError;
896
+ return;
806
897
  }
898
+ await this.run(async () => {
899
+ await t.changePassword({ password: this.newPass }, this.signal), this.editMode = "", this.newPass = "", this.confirmPass = "", this.flash("passSaved", this.msg.passwordUpdatedNote);
900
+ });
807
901
  }
808
902
  // ── email change ─────────────────────────────────────────
809
903
  startEmailEdit() {
@@ -849,15 +943,15 @@ let f = (De = class extends $e {
849
943
  renderEmailSection() {
850
944
  var s;
851
945
  const t = this.editMode !== "email", e = this.editMode !== "" && this.editMode !== "email";
852
- return a`
946
+ return r`
853
947
  <div class="rule"></div>
854
948
  <div class="section">
855
949
  <h3 class="sec-title">${this.msg.changeEmailTitle}</h3>
856
- ${t ? a`
950
+ ${t ? r`
857
951
  <div class="between">
858
952
  <p class="hint">${((s = this.user) == null ? void 0 : s.email) ?? ""}</p>
859
953
  <div class="btn-row-end">
860
- ${this.emailSaved ? a`<span role="status" class="saved-note">${this.emailSaved}</span>` : d}
954
+ ${this.emailSaved ? r`<span role="status" class="saved-note">${this.emailSaved}</span>` : d}
861
955
  <button
862
956
  type="button"
863
957
  class="edit-link"
@@ -868,7 +962,7 @@ let f = (De = class extends $e {
868
962
  </button>
869
963
  </div>
870
964
  </div>
871
- ` : this.emailStep === "request" ? a`
965
+ ` : this.emailStep === "request" ? r`
872
966
  <div class="edit-card">
873
967
  <div class="field">
874
968
  <label for=${this.uid("newemail")}>${this.msg.newEmailLabel}</label>
@@ -886,7 +980,7 @@ let f = (De = class extends $e {
886
980
  />
887
981
  <p class="hint">${this.msg.changeEmailHint}</p>
888
982
  </div>
889
- ${this.emailError ? a`<p class="err">${this.emailError}</p>` : d}
983
+ ${this.emailError ? r`<p class="err">${this.emailError}</p>` : d}
890
984
  <div class="edit-actions">
891
985
  <button
892
986
  type="button"
@@ -894,7 +988,7 @@ let f = (De = class extends $e {
894
988
  ?disabled=${this.submitting}
895
989
  @click=${this.onRequestEmailCode}
896
990
  >
897
- ${this.submitting ? a`<span class="spinner"></span>` : d}
991
+ ${this.submitting ? r`<span class="spinner"></span>` : d}
898
992
  <span>${this.msg.changeEmailCta}</span>
899
993
  </button>
900
994
  <button
@@ -908,7 +1002,7 @@ let f = (De = class extends $e {
908
1002
  </button>
909
1003
  </div>
910
1004
  </div>
911
- ` : a`
1005
+ ` : r`
912
1006
  <div class="edit-card">
913
1007
  <p class="hint">${this.msg.codeSentNeutral}</p>
914
1008
  <div class="field">
@@ -929,7 +1023,7 @@ let f = (De = class extends $e {
929
1023
  />
930
1024
  <p class="hint">${this.msg.changeEmailConfirmHint} ${this.dNewEmail}</p>
931
1025
  </div>
932
- ${this.emailError ? a`<p class="err">${this.emailError}</p>` : d}
1026
+ ${this.emailError ? r`<p class="err">${this.emailError}</p>` : d}
933
1027
  <div class="edit-actions">
934
1028
  <button
935
1029
  type="button"
@@ -937,7 +1031,7 @@ let f = (De = class extends $e {
937
1031
  ?disabled=${this.submitting}
938
1032
  @click=${this.onConfirmEmailChange}
939
1033
  >
940
- ${this.submitting ? a`<span class="spinner"></span>` : d}
1034
+ ${this.submitting ? r`<span class="spinner"></span>` : d}
941
1035
  <span>${this.msg.confirmChangeCta}</span>
942
1036
  </button>
943
1037
  <button
@@ -964,9 +1058,9 @@ let f = (De = class extends $e {
964
1058
  async onConnectProvider(t) {
965
1059
  const e = this.resolvedClient, s = this.auth.state;
966
1060
  !e || s.status !== "authenticated" || await this.run(async () => {
967
- var c;
1061
+ var c, f;
968
1062
  const i = await e.createOAuthNonce(this.signal);
969
- (c = globalThis.sessionStorage) == null || c.setItem(this.nonceStorageKey, i);
1063
+ (c = globalThis.sessionStorage) == null || c.setItem(this.nonceStorageKey, i), (f = globalThis.sessionStorage) == null || f.setItem(Ae(this.nonceStorageKey), t);
970
1064
  const { oauth_redirect_url: h } = await e.startOAuth(
971
1065
  {
972
1066
  provider: t,
@@ -981,29 +1075,17 @@ let f = (De = class extends $e {
981
1075
  });
982
1076
  }
983
1077
  get availableProviders() {
984
- const t = this.settings ?? this.settingsCtl.settings;
985
- if (!t || !t.oauth_settings.enabled) return [];
986
- const e = {
987
- google: "G",
988
- github: "GH",
989
- linkedin: "in",
990
- facebook: "f"
991
- };
992
- return Object.entries(t.oauth_providers).filter(([, s]) => s.enabled).map(([s, i]) => ({
993
- id: s,
994
- name: i.provider_name,
995
- mark: e[s] ?? i.provider_name.slice(0, 2)
996
- }));
1078
+ return R(this.settings ?? this.settingsCtl.settings, "link");
997
1079
  }
998
1080
  // ── sections ──────────────────────────────────────────────
999
1081
  renderIdentity() {
1000
1082
  const t = this.user, e = this.editMode !== "" && this.editMode !== "avatar", s = t != null && t.profile_photo && t.profile_photo !== this.photoFailed ? t.profile_photo : "";
1001
- return a`
1083
+ return r`
1002
1084
  <div class="acct-nav">
1003
1085
  <div class="acct-who">
1004
1086
  <div class="avatar-col">
1005
1087
  <div class="avatar ${s ? "has-photo" : ""}" part="avatar">
1006
- ${s ? a`<img
1088
+ ${s ? r`<img
1007
1089
  src=${s}
1008
1090
  alt=""
1009
1091
  part="avatar-image"
@@ -1024,9 +1106,9 @@ let f = (De = class extends $e {
1024
1106
  view="button"
1025
1107
  max-files="1"
1026
1108
  branding="false"
1027
- accept=${Ts}
1109
+ accept=${js}
1028
1110
  .client=${this.uploadClient}
1029
- .options=${Os}
1111
+ .options=${qs}
1030
1112
  @singlebase-upload-selected=${this.onPhotoSelected}
1031
1113
  @singlebase-upload-complete=${this.onPhotoUploaded}
1032
1114
  @singlebase-upload-error=${this.onPhotoProblem}
@@ -1053,12 +1135,12 @@ let f = (De = class extends $e {
1053
1135
  [this.msg.phoneLabel, t.phone || "—"],
1054
1136
  [this.msg.emailLabel, t.email || "—"]
1055
1137
  ];
1056
- return a`
1138
+ return r`
1057
1139
  <div class="section">
1058
- ${e ? a`
1140
+ ${e ? r`
1059
1141
  <div class="sum-list">
1060
1142
  ${i.map(
1061
- ([h, c]) => a`
1143
+ ([h, c]) => r`
1062
1144
  <div class="sum-row">
1063
1145
  <span class="sum-label">${h}</span>
1064
1146
  <span class="sum-value">${c}</span>
@@ -1067,7 +1149,7 @@ let f = (De = class extends $e {
1067
1149
  )}
1068
1150
  </div>
1069
1151
  <div class="btn-row-end">
1070
- ${this.profileSaved ? a`<span role="status" class="saved-note">${this.profileSaved}</span>` : d}
1152
+ ${this.profileSaved ? r`<span role="status" class="saved-note">${this.profileSaved}</span>` : d}
1071
1153
  <button
1072
1154
  type="button"
1073
1155
  class="edit-link"
@@ -1077,7 +1159,7 @@ let f = (De = class extends $e {
1077
1159
  ${this.msg.editAccountCta}
1078
1160
  </button>
1079
1161
  </div>
1080
- ` : a`
1162
+ ` : r`
1081
1163
  <div class="edit-card">
1082
1164
  <div class="two-up">
1083
1165
  <div class="field">
@@ -1135,7 +1217,7 @@ let f = (De = class extends $e {
1135
1217
  />
1136
1218
  <p class="hint">${this.msg.changeEmailElsewhereHint}</p>
1137
1219
  </div>
1138
- ${this.profileError ? a`<p class="err">${this.profileError}</p>` : d}
1220
+ ${this.profileError ? r`<p class="err">${this.profileError}</p>` : d}
1139
1221
  <div class="edit-actions">
1140
1222
  <button
1141
1223
  type="button"
@@ -1143,7 +1225,7 @@ let f = (De = class extends $e {
1143
1225
  ?disabled=${this.submitting}
1144
1226
  @click=${this.onSaveProfile}
1145
1227
  >
1146
- ${this.submitting ? a`<span class="spinner"></span>` : d}
1228
+ ${this.submitting ? r`<span class="spinner"></span>` : d}
1147
1229
  <span>${this.msg.saveChangesCta}</span>
1148
1230
  </button>
1149
1231
  <button
@@ -1162,16 +1244,17 @@ let f = (De = class extends $e {
1162
1244
  `;
1163
1245
  }
1164
1246
  renderPasswordSection() {
1247
+ var s, i;
1165
1248
  const t = this.editMode !== "password", e = this.editMode !== "" && this.editMode !== "password";
1166
- return a`
1249
+ return r`
1167
1250
  <div class="rule"></div>
1168
1251
  <div class="section">
1169
1252
  <h3 class="sec-title">${this.msg.passwordSectionTitle}</h3>
1170
- ${t ? a`
1253
+ ${t ? r`
1171
1254
  <div class="between">
1172
1255
  <p class="hint">${this.msg.passwordChangedHint}</p>
1173
1256
  <div class="btn-row-end">
1174
- ${this.passSaved ? a`<span role="status" class="saved-note">${this.passSaved}</span>` : d}
1257
+ ${this.passSaved ? r`<span role="status" class="saved-note">${this.passSaved}</span>` : d}
1175
1258
  <button
1176
1259
  type="button"
1177
1260
  class="edit-link"
@@ -1182,22 +1265,8 @@ let f = (De = class extends $e {
1182
1265
  </button>
1183
1266
  </div>
1184
1267
  </div>
1185
- ` : a`
1268
+ ` : r`
1186
1269
  <div class="edit-card">
1187
- <div class="field">
1188
- <label for=${this.uid("curpass")}>${this.msg.currentPasswordLabel}</label>
1189
- <input
1190
- id=${this.uid("curpass")}
1191
- type="password"
1192
- part="input"
1193
- .value=${this.curPass}
1194
- placeholder=${this.msg.passwordPlaceholder}
1195
- ?disabled=${this.submitting}
1196
- @input=${(s) => {
1197
- this.curPass = s.target.value, this.newPassError = "";
1198
- }}
1199
- />
1200
- </div>
1201
1270
  <div class="field">
1202
1271
  <label for=${this.uid("newpass")}>${this.msg.newPasswordLabel}</label>
1203
1272
  <input
@@ -1205,16 +1274,21 @@ let f = (De = class extends $e {
1205
1274
  type="password"
1206
1275
  part="input"
1207
1276
  .value=${this.newPass}
1208
- placeholder=${this.msg.newPasswordPlaceholder}
1277
+ placeholder=${ss(
1278
+ (s = this.settings ?? this.settingsCtl.settings) == null ? void 0 : s.auth_settings.password_policy,
1279
+ this.msg
1280
+ )}
1209
1281
  aria-invalid=${this.newPassError ? "true" : "false"}
1210
1282
  ?disabled=${this.submitting}
1211
- @input=${(s) => {
1212
- this.newPass = s.target.value, this.newPassError = "";
1283
+ @input=${(h) => {
1284
+ this.newPass = h.target.value, this.newPassError = "";
1213
1285
  }}
1214
1286
  />
1215
1287
  </div>
1216
1288
  <div class="field">
1217
- <label for=${this.uid("confirmpass")}>Confirm new password</label>
1289
+ <label for=${this.uid("confirmpass")}
1290
+ >${this.msg.confirmNewPasswordLabel}</label
1291
+ >
1218
1292
  <input
1219
1293
  id=${this.uid("confirmpass")}
1220
1294
  type="password"
@@ -1223,11 +1297,12 @@ let f = (De = class extends $e {
1223
1297
  placeholder=${this.msg.confirmPasswordPlaceholder}
1224
1298
  aria-invalid=${this.newPassError ? "true" : "false"}
1225
1299
  ?disabled=${this.submitting}
1226
- @input=${(s) => {
1227
- this.confirmPass = s.target.value, this.newPassError = "";
1300
+ @input=${(h) => {
1301
+ this.confirmPass = h.target.value, this.newPassError = "";
1228
1302
  }}
1229
1303
  />
1230
- ${this.newPassError ? a`<p class="err">${this.newPassError}</p>` : d}
1304
+ ${as((i = this.settings ?? this.settingsCtl.settings) == null ? void 0 : i.auth_settings.password_policy, this.msg)}
1305
+ ${this.newPassError ? r`<p class="err">${this.newPassError}</p>` : d}
1231
1306
  </div>
1232
1307
  <div class="edit-actions">
1233
1308
  <button
@@ -1236,7 +1311,7 @@ let f = (De = class extends $e {
1236
1311
  ?disabled=${this.submitting}
1237
1312
  @click=${this.onChangePass}
1238
1313
  >
1239
- ${this.submitting ? a`<span class="spinner"></span>` : d}
1314
+ ${this.submitting ? r`<span class="spinner"></span>` : d}
1240
1315
  <span>${this.msg.updatePasswordCta}</span>
1241
1316
  </button>
1242
1317
  <button type="button" class="ghost-sm" @click=${() => this.editMode = ""}>
@@ -1250,7 +1325,7 @@ let f = (De = class extends $e {
1250
1325
  }
1251
1326
  /** Layout preserved from the mock; no enrolment operation exists yet. */
1252
1327
  renderTwoFactorSection() {
1253
- return a`
1328
+ return r`
1254
1329
  <div class="rule"></div>
1255
1330
  <div class="section">
1256
1331
  <div class="between">
@@ -1277,7 +1352,7 @@ let f = (De = class extends $e {
1277
1352
  }
1278
1353
  renderConnectedSection() {
1279
1354
  const t = this.availableProviders;
1280
- return t.length === 0 ? d : a`
1355
+ return t.length === 0 ? d : r`
1281
1356
  <div class="rule"></div>
1282
1357
  <div class="section">
1283
1358
  <h3 class="sec-title">${this.msg.connectedTitle}</h3>
@@ -1285,11 +1360,11 @@ let f = (De = class extends $e {
1285
1360
  <span class="sub-label">${this.msg.addAnotherLabel}</span>
1286
1361
  <div class="tile-grid">
1287
1362
  ${t.map(
1288
- (e) => a`
1363
+ (e) => r`
1289
1364
  <button
1290
1365
  type="button"
1291
1366
  class="tile"
1292
- aria-label=${`Connect ${e.name}`}
1367
+ aria-label=${this.msg.connectProviderLabel.replace("{name}", e.name)}
1293
1368
  ?disabled=${this.submitting}
1294
1369
  @click=${() => this.onConnectProvider(e.id)}
1295
1370
  >
@@ -1300,18 +1375,14 @@ let f = (De = class extends $e {
1300
1375
  `
1301
1376
  )}
1302
1377
  </div>
1303
- <p class="disabled-note">
1304
- ${this.msg.notYetSupported} — listing or disconnecting linked providers is not part of the
1305
- current API.
1306
- </p>
1307
1378
  </div>
1308
1379
  `;
1309
1380
  }
1310
1381
  renderDangerSection() {
1311
- return a`
1382
+ return r`
1312
1383
  <div class="rule"></div>
1313
1384
  <div class="section">
1314
- ${this.deleteStage === 0 ? a`<button
1385
+ ${this.deleteStage === 0 ? r`<button
1315
1386
  type="button"
1316
1387
  class="danger-link"
1317
1388
  disabled
@@ -1326,12 +1397,12 @@ let f = (De = class extends $e {
1326
1397
  `;
1327
1398
  }
1328
1399
  render() {
1329
- return this.user ? a`
1400
+ return this.user ? r`
1330
1401
  <div class="acct-root">
1331
1402
  ${this.renderLogo()} ${this.renderIdentity()}
1332
1403
  <div class="acct-body">
1333
- ${this.toast ? a`<div class="notice" role="status">${this.toast}</div>` : d}
1334
- ${this.formError ? a`<div class="banner" role="alert">${this.formError}</div>` : d}
1404
+ ${this.toast ? r`<div class="notice" role="status">${this.toast}</div>` : d}
1405
+ ${this.formError ? r`<div class="banner" role="alert">${this.formError}</div>` : d}
1335
1406
  ${this.renderProfileSection()} ${this.renderEmailSection()}
1336
1407
  ${this.renderPasswordSection()}
1337
1408
  ${d}
@@ -1339,171 +1410,155 @@ let f = (De = class extends $e {
1339
1410
  ${d}
1340
1411
  </div>
1341
1412
  </div>
1342
- ` : a`<p class="disabled-note">Not signed in.</p>`;
1413
+ ` : r`<p class="disabled-note">${this.msg.notSignedInNote}</p>`;
1343
1414
  }
1344
- }, B = new WeakMap(), R = new WeakMap(), j = new WeakMap(), H = new WeakMap(), q = new WeakMap(), V = new WeakMap(), G = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), W = new WeakMap(), z = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), it = new WeakMap(), at = new WeakMap(), rt = new WeakMap(), nt = new WeakMap(), ot = new WeakMap(), lt = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), De);
1345
- v([
1415
+ }, Y = new WeakMap(), z = new WeakMap(), J = new WeakMap(), Z = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), it = new WeakMap(), at = new WeakMap(), rt = new WeakMap(), nt = new WeakMap(), ot = new WeakMap(), lt = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), ft = new WeakMap(), vt = new WeakMap(), ze);
1416
+ w([
1346
1417
  p({ attribute: "logo-text" })
1347
- ], f.prototype, "logoText", 1);
1348
- v([
1418
+ ], v.prototype, "logoText", 1);
1419
+ w([
1349
1420
  p({ attribute: "logo-url" })
1350
- ], f.prototype, "logoUrl", 1);
1351
- v([
1421
+ ], v.prototype, "logoUrl", 1);
1422
+ w([
1352
1423
  p({ attribute: !1 })
1353
- ], f.prototype, "settings", 1);
1354
- v([
1424
+ ], v.prototype, "settings", 1);
1425
+ w([
1355
1426
  p({ attribute: "nonce-storage-key" })
1356
- ], f.prototype, "nonceStorageKey", 1);
1357
- v([
1427
+ ], v.prototype, "nonceStorageKey", 1);
1428
+ w([
1358
1429
  m()
1359
- ], f.prototype, "editMode", 1);
1360
- v([
1430
+ ], v.prototype, "editMode", 1);
1431
+ w([
1361
1432
  m()
1362
- ], f.prototype, "toast", 1);
1363
- v([
1433
+ ], v.prototype, "toast", 1);
1434
+ w([
1364
1435
  m()
1365
- ], f.prototype, "photoBusy", 1);
1366
- v([
1436
+ ], v.prototype, "photoBusy", 1);
1437
+ w([
1367
1438
  m()
1368
- ], f.prototype, "photoFailed", 1);
1369
- v([
1439
+ ], v.prototype, "photoFailed", 1);
1440
+ w([
1370
1441
  m()
1371
- ], f.prototype, "profileSaved", 1);
1372
- v([
1442
+ ], v.prototype, "profileSaved", 1);
1443
+ w([
1373
1444
  m()
1374
- ], f.prototype, "passSaved", 1);
1375
- v([
1445
+ ], v.prototype, "passSaved", 1);
1446
+ w([
1376
1447
  m()
1377
- ], f.prototype, "profileError", 1);
1378
- v([
1448
+ ], v.prototype, "profileError", 1);
1449
+ w([
1379
1450
  m()
1380
- ], f.prototype, "newPassError", 1);
1381
- v([
1451
+ ], v.prototype, "newPassError", 1);
1452
+ w([
1382
1453
  m()
1383
- ], f.prototype, "deleteStage", 1);
1384
- v([
1454
+ ], v.prototype, "deleteStage", 1);
1455
+ w([
1385
1456
  m()
1386
- ], f.prototype, "confirmText", 1);
1387
- v([
1457
+ ], v.prototype, "confirmText", 1);
1458
+ w([
1388
1459
  m()
1389
- ], f.prototype, "dFirst", 1);
1390
- v([
1460
+ ], v.prototype, "dFirst", 1);
1461
+ w([
1391
1462
  m()
1392
- ], f.prototype, "dLast", 1);
1393
- v([
1463
+ ], v.prototype, "dLast", 1);
1464
+ w([
1394
1465
  m()
1395
- ], f.prototype, "dPhone", 1);
1396
- v([
1466
+ ], v.prototype, "dPhone", 1);
1467
+ w([
1397
1468
  m()
1398
- ], f.prototype, "dEmail", 1);
1399
- v([
1469
+ ], v.prototype, "dEmail", 1);
1470
+ w([
1400
1471
  m()
1401
- ], f.prototype, "emailStep", 1);
1402
- v([
1472
+ ], v.prototype, "emailStep", 1);
1473
+ w([
1403
1474
  m()
1404
- ], f.prototype, "dNewEmail", 1);
1405
- v([
1475
+ ], v.prototype, "dNewEmail", 1);
1476
+ w([
1406
1477
  m()
1407
- ], f.prototype, "emailCode", 1);
1408
- v([
1478
+ ], v.prototype, "emailCode", 1);
1479
+ w([
1409
1480
  m()
1410
- ], f.prototype, "emailError", 1);
1411
- v([
1481
+ ], v.prototype, "emailError", 1);
1482
+ w([
1412
1483
  m()
1413
- ], f.prototype, "emailSaved", 1);
1414
- v([
1484
+ ], v.prototype, "emailSaved", 1);
1485
+ w([
1415
1486
  m()
1416
- ], f.prototype, "curPass", 1);
1417
- v([
1487
+ ], v.prototype, "newPass", 1);
1488
+ w([
1418
1489
  m()
1419
- ], f.prototype, "newPass", 1);
1420
- v([
1421
- m()
1422
- ], f.prototype, "confirmPass", 1);
1423
- f = v([
1424
- we("singlebase-authui-account")
1425
- ], f);
1426
- var xs = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, C = (r, t, e, s) => {
1427
- for (var i = s > 1 ? void 0 : s ? Us(t, e) : t, h = r.length - 1, c; h >= 0; h--)
1428
- (c = r[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
1429
- return s && i && xs(t, e, i), i;
1430
- }, ct, ut, pt, gt, mt, bt, ft, Be;
1431
- let E = (Be = class extends $e {
1490
+ ], v.prototype, "confirmPass", 1);
1491
+ v = w([
1492
+ Te("singlebase-authui-account")
1493
+ ], v);
1494
+ var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, _ = (a, t, e, s) => {
1495
+ for (var i = s > 1 ? void 0 : s ? Vs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
1496
+ (c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
1497
+ return s && i && Ks(t, e, i), i;
1498
+ }, wt, $t, yt, Et, St, Ct, Pt, Je;
1499
+ let S = (Je = class extends Oe {
1432
1500
  constructor() {
1433
1501
  super(...arguments);
1434
- o(this, ct, "signout");
1435
- o(this, ut, "signin");
1436
- o(this, pt, "");
1437
- o(this, gt, "");
1438
- o(this, mt, !1);
1439
- o(this, bt, null);
1440
- o(this, ft, "singlebase-oauth-nonce");
1441
- b(this, "settingsCtl", new Ce(this));
1502
+ o(this, wt, "signout");
1503
+ o(this, $t, "signin");
1504
+ o(this, yt, "");
1505
+ o(this, Et, "");
1506
+ o(this, St, !1);
1507
+ o(this, Ct, null);
1508
+ o(this, Pt, "singlebase-oauth-nonce");
1509
+ b(this, "settingsCtl", new De(this));
1442
1510
  }
1443
1511
  get type() {
1444
- return n(this, ct);
1512
+ return n(this, wt);
1445
1513
  }
1446
1514
  set type(t) {
1447
- l(this, ct, t);
1515
+ l(this, wt, t);
1448
1516
  }
1449
1517
  get intent() {
1450
- return n(this, ut);
1518
+ return n(this, $t);
1451
1519
  }
1452
1520
  set intent(t) {
1453
- l(this, ut, t);
1521
+ l(this, $t, t);
1454
1522
  }
1455
1523
  get provider() {
1456
- return n(this, pt);
1524
+ return n(this, yt);
1457
1525
  }
1458
1526
  set provider(t) {
1459
- l(this, pt, t);
1527
+ l(this, yt, t);
1460
1528
  }
1461
1529
  get providerName() {
1462
- return n(this, gt);
1530
+ return n(this, Et);
1463
1531
  }
1464
1532
  set providerName(t) {
1465
- l(this, gt, t);
1533
+ l(this, Et, t);
1466
1534
  }
1467
1535
  get embedded() {
1468
- return n(this, mt);
1536
+ return n(this, St);
1469
1537
  }
1470
1538
  set embedded(t) {
1471
- l(this, mt, t);
1539
+ l(this, St, t);
1472
1540
  }
1473
1541
  get settings() {
1474
- return n(this, bt);
1542
+ return n(this, Ct);
1475
1543
  }
1476
1544
  set settings(t) {
1477
- l(this, bt, t);
1545
+ l(this, Ct, t);
1478
1546
  }
1479
1547
  get nonceStorageKey() {
1480
- return n(this, ft);
1548
+ return n(this, Pt);
1481
1549
  }
1482
1550
  set nonceStorageKey(t) {
1483
- l(this, ft, t);
1551
+ l(this, Pt, t);
1484
1552
  }
1485
1553
  willUpdate(t) {
1486
- super.willUpdate(t), this.type === "oauth" && this.settingsCtl.load(this.resolvedClient, this.settings);
1554
+ super.willUpdate(t), this.type !== "signout" && this.settingsCtl.load(this.resolvedClient, this.settings);
1487
1555
  }
1488
1556
  get effectiveSettings() {
1489
1557
  return this.settings ?? this.settingsCtl.settings;
1490
1558
  }
1491
1559
  // ── oauth ────────────────────────────────────────────────
1492
1560
  get providers() {
1493
- const t = this.effectiveSettings;
1494
- if (!t || !t.oauth_settings.enabled) return [];
1495
- if (!(this.intent === "signup" ? t.oauth_settings.allow_signup : t.oauth_settings.allow_signin) && this.intent !== "link") return [];
1496
- const s = {
1497
- google: "G",
1498
- github: "GH",
1499
- linkedin: "in",
1500
- facebook: "f"
1501
- };
1502
- return Object.entries(t.oauth_providers).filter(([, i]) => i.enabled).map(([i, h]) => ({
1503
- id: i,
1504
- name: h.provider_name,
1505
- mark: s[i] ?? h.provider_name.slice(0, 2)
1506
- }));
1561
+ return R(this.effectiveSettings, this.intent);
1507
1562
  }
1508
1563
  /** Shared by the oauth and link flows: nonce, start, redirect. */
1509
1564
  async startOAuth(t, e, s = !1) {
@@ -1511,36 +1566,38 @@ let E = (Be = class extends $e {
1511
1566
  if (!i) return;
1512
1567
  let h, c;
1513
1568
  if (s) {
1514
- const w = this.auth.state;
1515
- if (w.status !== "authenticated") {
1569
+ const f = this.auth.state;
1570
+ if (f.status !== "authenticated") {
1516
1571
  this.formError = this.msg.linkRequiresSignIn, this.phase = "error";
1517
1572
  return;
1518
1573
  }
1519
- h = w.session.id_token, c = w.session.refresh_token;
1574
+ h = f.session.id_token, c = f.session.refresh_token;
1520
1575
  }
1521
1576
  await this.run(async () => {
1522
- var ye;
1523
- const w = await i.createOAuthNonce(this.signal);
1524
- (ye = globalThis.sessionStorage) == null || ye.setItem(this.nonceStorageKey, w);
1525
- const { oauth_redirect_url: y } = await i.startOAuth(
1577
+ var C, k, T;
1578
+ const f = await i.createOAuthNonce(this.signal);
1579
+ (C = globalThis.sessionStorage) == null || C.setItem(this.nonceStorageKey, f);
1580
+ const $ = Ae(this.nonceStorageKey);
1581
+ s ? (k = globalThis.sessionStorage) == null || k.setItem($, t) : (T = globalThis.sessionStorage) == null || T.removeItem($);
1582
+ const { oauth_redirect_url: E } = await i.startOAuth(
1526
1583
  {
1527
1584
  provider: t,
1528
- nonce: w,
1529
- intent: e,
1585
+ nonce: f,
1586
+ intent: Is(this.effectiveSettings, e),
1530
1587
  ...s ? { id_token: h, refresh_token: c } : {}
1531
1588
  },
1532
1589
  this.signal
1533
1590
  );
1534
- globalThis.location.assign(y);
1591
+ globalThis.location.assign(E);
1535
1592
  });
1536
1593
  }
1537
1594
  renderOAuth() {
1538
1595
  const t = this.providers;
1539
1596
  if (t.length === 0) return d;
1540
1597
  const [e, ...s] = t;
1541
- return a`
1598
+ return r`
1542
1599
  <div class="stack">
1543
- ${this.formError ? a`<div class="banner" part="banner" role="alert">${this.formError}</div>` : d}
1600
+ ${this.formError ? r`<div class="banner" part="banner" role="alert">${this.formError}</div>` : d}
1544
1601
 
1545
1602
  <button
1546
1603
  type="button"
@@ -1553,10 +1610,10 @@ let E = (Be = class extends $e {
1553
1610
  <span>${this.msg.oauthContinueWith} ${e.name}</span>
1554
1611
  </button>
1555
1612
 
1556
- ${s.length ? a`
1613
+ ${s.length ? r`
1557
1614
  <div class="icon-row">
1558
1615
  ${s.map(
1559
- (i) => a`
1616
+ (i) => r`
1560
1617
  <button
1561
1618
  type="button"
1562
1619
  class="icon-btn"
@@ -1577,7 +1634,10 @@ let E = (Be = class extends $e {
1577
1634
  }
1578
1635
  // ── link ─────────────────────────────────────────────────
1579
1636
  renderLink() {
1580
- return a`
1637
+ const t = this.effectiveSettings, e = R(t, "link").find((i) => i.id === this.provider);
1638
+ if (t && !e) return d;
1639
+ const s = this.providerName || (e == null ? void 0 : e.name) || this.provider;
1640
+ return r`
1581
1641
  <div class="stack">
1582
1642
  ${this.renderStatus()}
1583
1643
  <button
@@ -1587,8 +1647,8 @@ let E = (Be = class extends $e {
1587
1647
  ?disabled=${this.submitting}
1588
1648
  @click=${() => this.startOAuth(this.provider, "link", !0)}
1589
1649
  >
1590
- ${this.submitting ? a`<span class="spinner"></span>` : d}
1591
- <span>${this.msg.oauthContinueWith} ${this.providerName || this.provider}</span>
1650
+ ${this.submitting ? r`<span class="spinner"></span>` : d}
1651
+ <span>${this.msg.oauthContinueWith} ${s}</span>
1592
1652
  </button>
1593
1653
  </div>
1594
1654
  `;
@@ -1601,7 +1661,7 @@ let E = (Be = class extends $e {
1601
1661
  });
1602
1662
  }
1603
1663
  renderSignOut() {
1604
- return this.embedded ? a`<button
1664
+ return this.embedded ? r`<button
1605
1665
  type="button"
1606
1666
  class="link-sm"
1607
1667
  part="button-signout"
@@ -1609,9 +1669,9 @@ let E = (Be = class extends $e {
1609
1669
  @click=${this.onSignOut}
1610
1670
  >
1611
1671
  ${this.msg.signOutCta}
1612
- </button>` : a`
1672
+ </button>` : r`
1613
1673
  <div class="stack">
1614
- ${this.formError ? a`<p class="banner" role="alert">${this.formError}</p>` : d}
1674
+ ${this.formError ? r`<p class="banner" role="alert">${this.formError}</p>` : d}
1615
1675
  <button
1616
1676
  type="button"
1617
1677
  class="link-sm"
@@ -1627,37 +1687,37 @@ let E = (Be = class extends $e {
1627
1687
  render() {
1628
1688
  return this.type === "oauth" ? this.renderOAuth() : this.type === "link" ? this.renderLink() : this.renderSignOut();
1629
1689
  }
1630
- }, ct = new WeakMap(), ut = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), ft = new WeakMap(), Be);
1631
- C([
1690
+ }, wt = new WeakMap(), $t = new WeakMap(), yt = new WeakMap(), Et = new WeakMap(), St = new WeakMap(), Ct = new WeakMap(), Pt = new WeakMap(), Je);
1691
+ _([
1632
1692
  p()
1633
- ], E.prototype, "type", 1);
1634
- C([
1693
+ ], S.prototype, "type", 1);
1694
+ _([
1635
1695
  p()
1636
- ], E.prototype, "intent", 1);
1637
- C([
1696
+ ], S.prototype, "intent", 1);
1697
+ _([
1638
1698
  p()
1639
- ], E.prototype, "provider", 1);
1640
- C([
1699
+ ], S.prototype, "provider", 1);
1700
+ _([
1641
1701
  p({ attribute: "provider-name" })
1642
- ], E.prototype, "providerName", 1);
1643
- C([
1702
+ ], S.prototype, "providerName", 1);
1703
+ _([
1644
1704
  p({ type: Boolean })
1645
- ], E.prototype, "embedded", 1);
1646
- C([
1705
+ ], S.prototype, "embedded", 1);
1706
+ _([
1647
1707
  p({ attribute: !1 })
1648
- ], E.prototype, "settings", 1);
1649
- C([
1708
+ ], S.prototype, "settings", 1);
1709
+ _([
1650
1710
  p({ attribute: "nonce-storage-key" })
1651
- ], E.prototype, "nonceStorageKey", 1);
1652
- E = C([
1653
- we("singlebase-authui-buttons")
1654
- ], E);
1655
- var Ke = Object.defineProperty, Ls = Object.getOwnPropertyDescriptor, As = (r, t, e) => t in r ? Ke(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, g = (r, t, e, s) => {
1656
- for (var i = s > 1 ? void 0 : s ? Ls(t, e) : t, h = r.length - 1, c; h >= 0; h--)
1657
- (c = r[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
1658
- return s && i && Ke(t, e, i), i;
1659
- }, Ms = (r, t, e) => As(r, t + "", e);
1660
- const Ye = [
1711
+ ], S.prototype, "nonceStorageKey", 1);
1712
+ S = _([
1713
+ Te("singlebase-authui-buttons")
1714
+ ], S);
1715
+ var os = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, Ws = (a, t, e) => t in a ? os(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, g = (a, t, e, s) => {
1716
+ for (var i = s > 1 ? void 0 : s ? Gs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
1717
+ (c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
1718
+ return s && i && os(t, e, i), i;
1719
+ }, Ys = (a, t, e) => Ws(a, t + "", e);
1720
+ const Ie = "oauth_denied", Re = "oauth_error", zs = /^[A-Z][A-Z0-9_]{0,63}$/, ls = [
1661
1721
  "signin",
1662
1722
  "signup",
1663
1723
  "forgot",
@@ -1665,80 +1725,81 @@ const Ye = [
1665
1725
  "otp",
1666
1726
  "newpass",
1667
1727
  "invite"
1668
- ], We = ["account"], Ns = [...Ye, ...We, "oauth-callback"];
1669
- function Ie(r) {
1670
- return Ye.includes(r);
1728
+ ], hs = ["account"], Js = [...ls, ...hs, "oauth-callback"];
1729
+ function We(a) {
1730
+ return ls.includes(a);
1671
1731
  }
1672
- function Is(r) {
1673
- return We.includes(r);
1732
+ function Zs(a) {
1733
+ return hs.includes(a);
1674
1734
  }
1675
- function Fe(r) {
1676
- return Ns.includes(r);
1735
+ function Ye(a) {
1736
+ return Js.includes(a);
1677
1737
  }
1678
- const P = {
1738
+ const N = {
1679
1739
  // An absent attribute must mean "default" (true), not false. Lit calls
1680
1740
  // fromAttribute(null) when an attribute is *removed*, so returning false
1681
1741
  // there would make removing `allow-oauth="false"` leave the flag off
1682
1742
  // forever instead of restoring the default.
1683
- fromAttribute: (r) => r === null ? !0 : r !== "false",
1684
- toAttribute: (r) => r ? null : "false"
1743
+ fromAttribute: (a) => a === null ? !0 : a !== "false",
1744
+ toAttribute: (a) => a ? null : "false"
1685
1745
  };
1686
- var vt, wt, $t, yt, Et, St, Ct, Pt, kt, _t, Ot, Tt, xt, Ut, Lt, At, Mt, Nt, It, Ft, Dt, Bt, Rt, jt, Ht, qt, Vt, Gt, Kt, Yt, Wt, zt, Jt, Qt, Xt, Zt, te, ee, se, ie, ae, re, ne, oe, le, he, de, Re;
1687
- let u = (Re = class extends $ {
1746
+ var _t, kt, Tt, Ot, Nt, At, Lt, xt, Ut, Mt, It, Rt, Ft, Dt, Bt, Ht, qt, jt, Kt, Vt, Gt, Wt, Yt, zt, Jt, Zt, Qt, Xt, te, ee, se, ie, ae, re, ne, oe, le, he, de, ce, ue, pe, ge, me, be, fe, ve, we, Ze;
1747
+ let u = (Ze = class extends y {
1688
1748
  constructor() {
1689
1749
  super(...arguments);
1690
- o(this, vt, "signin");
1691
- o(this, wt, "");
1692
- o(this, $t, !1);
1693
- o(this, yt, null);
1694
- o(this, Et, !0);
1695
- o(this, St, !0);
1696
- o(this, Ct, !0);
1697
- o(this, Pt, !0);
1698
- o(this, kt, !0);
1699
- o(this, _t, !0);
1700
- o(this, Ot, "card");
1701
- o(this, Tt, "bottom");
1702
- o(this, xt, !1);
1703
- o(this, Ut, "");
1704
- o(this, Lt, "");
1705
- o(this, At, "");
1706
- o(this, Mt, "");
1707
- o(this, Nt, "");
1708
- o(this, It, !0);
1709
- o(this, Ft, "");
1750
+ o(this, _t, "signin");
1751
+ o(this, kt, "");
1752
+ o(this, Tt, !1);
1753
+ o(this, Ot, null);
1754
+ o(this, Nt, !0);
1755
+ o(this, At, !0);
1756
+ o(this, Lt, !0);
1757
+ o(this, xt, !0);
1758
+ o(this, Ut, !0);
1759
+ o(this, Mt, !0);
1760
+ o(this, It, "card");
1761
+ o(this, Rt, "bottom");
1762
+ o(this, Ft, !1);
1710
1763
  o(this, Dt, "");
1711
1764
  o(this, Bt, "");
1712
- o(this, Rt, "singlebase-oauth-nonce");
1713
- o(this, jt, "");
1714
1765
  o(this, Ht, "");
1715
1766
  o(this, qt, "");
1716
- o(this, Vt, 0);
1767
+ o(this, jt, "");
1768
+ o(this, Kt, !0);
1769
+ o(this, Vt, "");
1717
1770
  o(this, Gt, "");
1718
- o(this, Kt, "");
1719
- o(this, Yt, "");
1720
1771
  o(this, Wt, "");
1772
+ o(this, Yt, "singlebase-oauth-nonce");
1721
1773
  o(this, zt, "");
1722
1774
  o(this, Jt, "");
1723
- o(this, Qt, "");
1724
- o(this, Xt, "");
1725
1775
  o(this, Zt, "");
1726
- o(this, te, ["", "", "", "", "", ""]);
1727
- o(this, ee, "signin_code");
1728
- o(this, se, !1);
1776
+ o(this, Qt, 0);
1777
+ o(this, Xt, "");
1778
+ o(this, te, "");
1779
+ o(this, ee, "");
1780
+ o(this, se, "");
1729
1781
  o(this, ie, "");
1730
1782
  o(this, ae, "");
1731
1783
  o(this, re, "");
1732
1784
  o(this, ne, "");
1733
1785
  o(this, oe, "");
1734
- o(this, le, 0);
1735
- o(this, he, !1);
1736
- b(this, "settingsCtl", new Ce(this));
1737
- b(this, "bridge", new Ss(this));
1786
+ o(this, le, ["", "", "", "", "", ""]);
1787
+ o(this, he, "signin_code");
1788
+ o(this, de, !1);
1789
+ o(this, ce, "");
1790
+ o(this, ue, "");
1791
+ o(this, pe, "");
1792
+ o(this, ge, "");
1793
+ o(this, me, "");
1794
+ o(this, be, !1);
1795
+ b(this, "settingsCtl", new De(this));
1796
+ b(this, "bridge", new Us(this));
1738
1797
  b(this, "uidBase", `sb-${Math.random().toString(36).slice(2, 8)}`);
1739
1798
  b(this, "gotoUnsubscribe");
1740
1799
  b(this, "gotoClient", null);
1741
- o(this, de, !1);
1800
+ o(this, fe, !1);
1801
+ o(this, ve, "");
1802
+ o(this, we, "");
1742
1803
  b(this, "abortController", null);
1743
1804
  b(this, "onContinue", () => {
1744
1805
  this.followRedirect() || (this.dispatchEvent(
@@ -1755,280 +1816,274 @@ let u = (Re = class extends $ {
1755
1816
  });
1756
1817
  }
1757
1818
  get initialScreen() {
1758
- return n(this, vt);
1819
+ return n(this, _t);
1759
1820
  }
1760
1821
  set initialScreen(t) {
1761
- l(this, vt, t);
1822
+ l(this, _t, t);
1762
1823
  }
1763
1824
  get screen() {
1764
- return n(this, wt);
1825
+ return n(this, kt);
1765
1826
  }
1766
1827
  set screen(t) {
1767
- l(this, wt, t);
1828
+ l(this, kt, t);
1768
1829
  }
1769
1830
  get noAccountView() {
1770
- return n(this, $t);
1831
+ return n(this, Tt);
1771
1832
  }
1772
1833
  set noAccountView(t) {
1773
- l(this, $t, t);
1834
+ l(this, Tt, t);
1774
1835
  }
1775
1836
  get settings() {
1776
- return n(this, yt);
1837
+ return n(this, Ot);
1777
1838
  }
1778
1839
  set settings(t) {
1779
- l(this, yt, t);
1840
+ l(this, Ot, t);
1780
1841
  }
1781
1842
  get authEnabled() {
1782
- return n(this, Et);
1843
+ return n(this, Nt);
1783
1844
  }
1784
1845
  set authEnabled(t) {
1785
- l(this, Et, t);
1846
+ l(this, Nt, t);
1786
1847
  }
1787
1848
  get allowEmailSignin() {
1788
- return n(this, St);
1849
+ return n(this, At);
1789
1850
  }
1790
1851
  set allowEmailSignin(t) {
1791
- l(this, St, t);
1852
+ l(this, At, t);
1792
1853
  }
1793
1854
  get allowEmailSignup() {
1794
- return n(this, Ct);
1855
+ return n(this, Lt);
1795
1856
  }
1796
1857
  set allowEmailSignup(t) {
1797
- l(this, Ct, t);
1858
+ l(this, Lt, t);
1798
1859
  }
1799
1860
  get allowEmailOtp() {
1800
- return n(this, Pt);
1861
+ return n(this, xt);
1801
1862
  }
1802
1863
  set allowEmailOtp(t) {
1803
- l(this, Pt, t);
1864
+ l(this, xt, t);
1804
1865
  }
1805
1866
  get allowOauth() {
1806
- return n(this, kt);
1867
+ return n(this, Ut);
1807
1868
  }
1808
1869
  set allowOauth(t) {
1809
- l(this, kt, t);
1870
+ l(this, Ut, t);
1810
1871
  }
1811
1872
  get allowAccountCreation() {
1812
- return n(this, _t);
1873
+ return n(this, Mt);
1813
1874
  }
1814
1875
  set allowAccountCreation(t) {
1815
- l(this, _t, t);
1876
+ l(this, Mt, t);
1816
1877
  }
1817
1878
  get layout() {
1818
- return n(this, Ot);
1879
+ return n(this, It);
1819
1880
  }
1820
1881
  set layout(t) {
1821
- l(this, Ot, t);
1882
+ l(this, It, t);
1822
1883
  }
1823
1884
  get oauthPlacement() {
1824
- return n(this, Tt);
1885
+ return n(this, Rt);
1825
1886
  }
1826
1887
  set oauthPlacement(t) {
1827
- l(this, Tt, t);
1888
+ l(this, Rt, t);
1828
1889
  }
1829
1890
  get stepped() {
1830
- return n(this, xt);
1891
+ return n(this, Ft);
1831
1892
  }
1832
1893
  set stepped(t) {
1833
- l(this, xt, t);
1894
+ l(this, Ft, t);
1834
1895
  }
1835
1896
  get logoText() {
1836
- return n(this, Ut);
1897
+ return n(this, Dt);
1837
1898
  }
1838
1899
  set logoText(t) {
1839
- l(this, Ut, t);
1900
+ l(this, Dt, t);
1840
1901
  }
1841
1902
  get logoUrl() {
1842
- return n(this, Lt);
1903
+ return n(this, Bt);
1843
1904
  }
1844
1905
  set logoUrl(t) {
1845
- l(this, Lt, t);
1906
+ l(this, Bt, t);
1846
1907
  }
1847
1908
  get brandLine() {
1848
- return n(this, At);
1909
+ return n(this, Ht);
1849
1910
  }
1850
1911
  set brandLine(t) {
1851
- l(this, At, t);
1912
+ l(this, Ht, t);
1852
1913
  }
1853
1914
  get brandFoot() {
1854
- return n(this, Mt);
1915
+ return n(this, qt);
1855
1916
  }
1856
1917
  set brandFoot(t) {
1857
- l(this, Mt, t);
1918
+ l(this, qt, t);
1858
1919
  }
1859
1920
  get signInTitle() {
1860
- return n(this, Nt);
1921
+ return n(this, jt);
1861
1922
  }
1862
1923
  set signInTitle(t) {
1863
- l(this, Nt, t);
1924
+ l(this, jt, t);
1864
1925
  }
1865
1926
  get branding() {
1866
- return n(this, It);
1927
+ return n(this, Kt);
1867
1928
  }
1868
1929
  set branding(t) {
1869
- l(this, It, t);
1930
+ l(this, Kt, t);
1870
1931
  }
1871
1932
  get redirectUrl() {
1872
- return n(this, Ft);
1933
+ return n(this, Vt);
1873
1934
  }
1874
1935
  set redirectUrl(t) {
1875
- l(this, Ft, t);
1936
+ l(this, Vt, t);
1876
1937
  }
1877
1938
  get tosUrl() {
1878
- return n(this, Dt);
1939
+ return n(this, Gt);
1879
1940
  }
1880
1941
  set tosUrl(t) {
1881
- l(this, Dt, t);
1942
+ l(this, Gt, t);
1882
1943
  }
1883
1944
  get privacyUrl() {
1884
- return n(this, Bt);
1945
+ return n(this, Wt);
1885
1946
  }
1886
1947
  set privacyUrl(t) {
1887
- l(this, Bt, t);
1948
+ l(this, Wt, t);
1888
1949
  }
1889
1950
  get nonceStorageKey() {
1890
- return n(this, Rt);
1951
+ return n(this, Yt);
1891
1952
  }
1892
1953
  set nonceStorageKey(t) {
1893
- l(this, Rt, t);
1954
+ l(this, Yt, t);
1894
1955
  }
1895
1956
  get inviteEmail() {
1896
- return n(this, jt);
1957
+ return n(this, zt);
1897
1958
  }
1898
1959
  set inviteEmail(t) {
1899
- l(this, jt, t);
1960
+ l(this, zt, t);
1900
1961
  }
1901
1962
  get inviteOrg() {
1902
- return n(this, Ht);
1963
+ return n(this, Jt);
1903
1964
  }
1904
1965
  set inviteOrg(t) {
1905
- l(this, Ht, t);
1966
+ l(this, Jt, t);
1906
1967
  }
1907
1968
  get inviteCode() {
1908
- return n(this, qt);
1969
+ return n(this, Zt);
1909
1970
  }
1910
1971
  set inviteCode(t) {
1911
- l(this, qt, t);
1972
+ l(this, Zt, t);
1912
1973
  }
1913
1974
  get step() {
1914
- return n(this, Vt);
1975
+ return n(this, Qt);
1915
1976
  }
1916
1977
  set step(t) {
1917
- l(this, Vt, t);
1978
+ l(this, Qt, t);
1918
1979
  }
1919
1980
  get method() {
1920
- return n(this, Gt);
1981
+ return n(this, Xt);
1921
1982
  }
1922
1983
  set method(t) {
1923
- l(this, Gt, t);
1984
+ l(this, Xt, t);
1924
1985
  }
1925
1986
  get email() {
1926
- return n(this, Kt);
1987
+ return n(this, te);
1927
1988
  }
1928
1989
  set email(t) {
1929
- l(this, Kt, t);
1990
+ l(this, te, t);
1930
1991
  }
1931
1992
  get password() {
1932
- return n(this, Yt);
1993
+ return n(this, ee);
1933
1994
  }
1934
1995
  set password(t) {
1935
- l(this, Yt, t);
1996
+ l(this, ee, t);
1936
1997
  }
1937
1998
  get name() {
1938
- return n(this, Wt);
1999
+ return n(this, se);
1939
2000
  }
1940
2001
  set name(t) {
1941
- l(this, Wt, t);
2002
+ l(this, se, t);
1942
2003
  }
1943
2004
  get firstName() {
1944
- return n(this, zt);
2005
+ return n(this, ie);
1945
2006
  }
1946
2007
  set firstName(t) {
1947
- l(this, zt, t);
2008
+ l(this, ie, t);
1948
2009
  }
1949
2010
  get lastName() {
1950
- return n(this, Jt);
2011
+ return n(this, ae);
1951
2012
  }
1952
2013
  set lastName(t) {
1953
- l(this, Jt, t);
2014
+ l(this, ae, t);
1954
2015
  }
1955
2016
  get phone() {
1956
- return n(this, Qt);
2017
+ return n(this, re);
1957
2018
  }
1958
2019
  set phone(t) {
1959
- l(this, Qt, t);
2020
+ l(this, re, t);
1960
2021
  }
1961
2022
  get newPass() {
1962
- return n(this, Xt);
2023
+ return n(this, ne);
1963
2024
  }
1964
2025
  set newPass(t) {
1965
- l(this, Xt, t);
2026
+ l(this, ne, t);
1966
2027
  }
1967
2028
  get confirmPass() {
1968
- return n(this, Zt);
2029
+ return n(this, oe);
1969
2030
  }
1970
2031
  set confirmPass(t) {
1971
- l(this, Zt, t);
2032
+ l(this, oe, t);
1972
2033
  }
1973
2034
  get code() {
1974
- return n(this, te);
2035
+ return n(this, le);
1975
2036
  }
1976
2037
  set code(t) {
1977
- l(this, te, t);
2038
+ l(this, le, t);
1978
2039
  }
1979
2040
  get verifyNext() {
1980
- return n(this, ee);
2041
+ return n(this, he);
1981
2042
  }
1982
2043
  set verifyNext(t) {
1983
- l(this, ee, t);
2044
+ l(this, he, t);
1984
2045
  }
1985
2046
  get loading() {
1986
- return n(this, se);
2047
+ return n(this, de);
1987
2048
  }
1988
2049
  set loading(t) {
1989
- l(this, se, t);
2050
+ l(this, de, t);
1990
2051
  }
1991
2052
  get banner() {
1992
- return n(this, ie);
2053
+ return n(this, ce);
1993
2054
  }
1994
2055
  set banner(t) {
1995
- l(this, ie, t);
2056
+ l(this, ce, t);
1996
2057
  }
1997
2058
  get notice() {
1998
- return n(this, ae);
2059
+ return n(this, ue);
1999
2060
  }
2000
2061
  set notice(t) {
2001
- l(this, ae, t);
2062
+ l(this, ue, t);
2002
2063
  }
2003
2064
  get emailError() {
2004
- return n(this, re);
2065
+ return n(this, pe);
2005
2066
  }
2006
2067
  set emailError(t) {
2007
- l(this, re, t);
2068
+ l(this, pe, t);
2008
2069
  }
2009
2070
  get passError() {
2010
- return n(this, ne);
2071
+ return n(this, ge);
2011
2072
  }
2012
2073
  set passError(t) {
2013
- l(this, ne, t);
2074
+ l(this, ge, t);
2014
2075
  }
2015
2076
  get newPassError() {
2016
- return n(this, oe);
2077
+ return n(this, me);
2017
2078
  }
2018
2079
  set newPassError(t) {
2019
- l(this, oe, t);
2020
- }
2021
- get attempts() {
2022
- return n(this, le);
2023
- }
2024
- set attempts(t) {
2025
- l(this, le, t);
2080
+ l(this, me, t);
2026
2081
  }
2027
2082
  get needsMfaCode() {
2028
- return n(this, he);
2083
+ return n(this, be);
2029
2084
  }
2030
2085
  set needsMfaCode(t) {
2031
- l(this, he, t);
2086
+ l(this, be, t);
2032
2087
  }
2033
2088
  uid(t) {
2034
2089
  return `${this.uidBase}-${t}`;
@@ -2050,7 +2105,7 @@ let u = (Re = class extends $ {
2050
2105
  var i;
2051
2106
  if (t === this.gotoClient || ((i = this.gotoUnsubscribe) == null || i.call(this), this.gotoUnsubscribe = void 0, this.gotoClient = t, !t)) return;
2052
2107
  const e = t.on("goto", ({ screen: h }) => {
2053
- Fe(h) && this.goto(h);
2108
+ Ye(h) && this.goto(h);
2054
2109
  }), s = t.on("signin", () => {
2055
2110
  this.followRedirect();
2056
2111
  });
@@ -2078,6 +2133,7 @@ let u = (Re = class extends $ {
2078
2133
  allowEmailSignup: this.allowEmailSignup && this.allowAccountCreation,
2079
2134
  allowEmailOtp: this.allowEmailOtp,
2080
2135
  allowOauth: this.allowOauth,
2136
+ allowRecovery: this.allowEmailSignin,
2081
2137
  mfa: !1
2082
2138
  };
2083
2139
  const e = t.auth_settings, s = e.second_factor === "email_otp";
@@ -2086,14 +2142,16 @@ let u = (Re = class extends $ {
2086
2142
  allowEmailSignin: e.allow_signin && this.allowEmailSignin,
2087
2143
  allowEmailSignup: e.allow_signup && this.allowEmailSignup && this.allowAccountCreation,
2088
2144
  allowEmailOtp: this.allowEmailOtp && e.allow_signin && !s,
2089
- allowOauth: t.oauth_settings.enabled && this.allowOauth,
2145
+ allowOauth: es(t) && this.allowOauth,
2146
+ // Email recovery is offered only when the project verifies it by code.
2147
+ allowRecovery: e.allow_signin && this.allowEmailSignin && e.password_recovery_verification === "email_otp",
2090
2148
  mfa: s
2091
2149
  };
2092
2150
  }
2093
2151
  /** The screen the host asked for, before any guarding is applied. */
2094
2152
  get requestedScreen() {
2095
2153
  const t = this.screen || this.initialScreen || "signin";
2096
- return Fe(t) ? t : "signin";
2154
+ return Ye(t) ? t : "signin";
2097
2155
  }
2098
2156
  /**
2099
2157
  * Resolves the screen actually rendered.
@@ -2104,19 +2162,20 @@ let u = (Re = class extends $ {
2104
2162
  * fallbacks below additionally reflect what the project has enabled.
2105
2163
  */
2106
2164
  get activeScreen() {
2107
- if (this.isOAuthCallback) return "oauth-callback";
2108
- const t = this.auth.state.status === "authenticated", e = this.requestedScreen;
2109
- if (Is(e))
2165
+ const t = this.auth.state.status === "authenticated";
2166
+ if (this.isOAuthCallback || this.callbackPhase === "working" || this.callbackPhase === "failed" && !t) return "oauth-callback";
2167
+ const e = this.requestedScreen;
2168
+ if (Zs(e))
2110
2169
  return t ? e : "signin";
2111
2170
  if (t)
2112
2171
  return this.screen !== "" || this.initialScreen !== "signin" ? e : "account";
2113
2172
  const s = this.cfg;
2114
2173
  let i = e;
2115
- return i === "signup" && !s.allowEmailSignup && (i = "signin"), (i === "forgot" || i === "newpass") && !s.allowEmailSignin && (i = "signin"), i === "otp" && !s.allowEmailOtp && (i = "signin"), i === "signin" && !s.allowEmailSignin && s.allowEmailOtp && (i = "otp"), i;
2174
+ return i === "signup" && !s.allowEmailSignup && (i = "signin"), (i === "forgot" || i === "newpass") && !s.allowRecovery && (i = "signin"), i === "otp" && !s.allowEmailOtp && (i = "signin"), i === "signin" && !s.allowEmailSignin && s.allowEmailOtp && (i = "otp"), i;
2116
2175
  }
2117
2176
  /** True when a signed-in user is sitting on a guest screen (spec: offer continue/sign out). */
2118
2177
  get showsSignedInInterstitial() {
2119
- return this.auth.state.status === "authenticated" && Ie(this.activeScreen);
2178
+ return this.auth.state.status === "authenticated" && We(this.activeScreen);
2120
2179
  }
2121
2180
  // ── redirect ──────────────────────────────────────────────
2122
2181
  /**
@@ -2129,7 +2188,7 @@ let u = (Re = class extends $ {
2129
2188
  */
2130
2189
  get redirectTarget() {
2131
2190
  var t;
2132
- return ls(
2191
+ return ws(
2133
2192
  this.redirectUrl || this.redirectParam,
2134
2193
  (t = globalThis.location) == null ? void 0 : t.href,
2135
2194
  (e) => console.warn(`[singlebase] ${e}`)
@@ -2146,16 +2205,32 @@ let u = (Re = class extends $ {
2146
2205
  const t = this.redirectTarget;
2147
2206
  return t ? ((e = globalThis.location) == null || e.assign(t), !0) : !1;
2148
2207
  }
2208
+ /**
2209
+ * Only the OAuth return counts: `?access_code=`, `?error=oauth_denied` or
2210
+ * `?oauth_error=<CODE>`. Any other `?error=` belongs to the host page.
2211
+ */
2149
2212
  get isOAuthCallback() {
2150
2213
  var e;
2151
2214
  const t = new URLSearchParams(((e = globalThis.location) == null ? void 0 : e.search) ?? "");
2152
- return t.has("access_code") || t.has("error");
2215
+ return t.has("access_code") || t.get("error") === Ie || t.has(Re);
2153
2216
  }
2154
2217
  get callbackDone() {
2155
- return n(this, de);
2218
+ return n(this, fe);
2156
2219
  }
2157
2220
  set callbackDone(t) {
2158
- l(this, de, t);
2221
+ l(this, fe, t);
2222
+ }
2223
+ get callbackPhase() {
2224
+ return n(this, ve);
2225
+ }
2226
+ set callbackPhase(t) {
2227
+ l(this, ve, t);
2228
+ }
2229
+ get linkNotice() {
2230
+ return n(this, we);
2231
+ }
2232
+ set linkNotice(t) {
2233
+ l(this, we, t);
2159
2234
  }
2160
2235
  /** Strips the provider's parameters so a reload cannot replay the exchange. */
2161
2236
  cleanCallbackUrl() {
@@ -2163,59 +2238,67 @@ let u = (Re = class extends $ {
2163
2238
  const t = (s = globalThis.location) == null ? void 0 : s.href;
2164
2239
  if (!t || !globalThis.history) return;
2165
2240
  const e = new URL(t);
2166
- e.searchParams.delete("access_code"), e.searchParams.delete("error"), globalThis.history.replaceState({}, "", e.toString());
2241
+ e.searchParams.delete("access_code"), e.searchParams.delete(Re), e.searchParams.get("error") === Ie && e.searchParams.delete("error"), globalThis.history.replaceState({}, "", e.toString());
2167
2242
  }
2168
2243
  /**
2169
2244
  * Completes the provider round trip. Runs once per landing: the URL is
2170
2245
  * cleaned immediately so a refresh cannot resend a single-use access code.
2171
2246
  */
2172
2247
  async handleOAuthCallback() {
2173
- var c, w;
2248
+ var E, C, k, T, U, M;
2174
2249
  if (this.callbackDone) return;
2175
- this.callbackDone = !0;
2176
- const t = new URLSearchParams(((c = globalThis.location) == null ? void 0 : c.search) ?? ""), e = t.get("access_code"), s = t.get("error"), i = this.resolvedClient;
2177
- if (s) {
2178
- this.cleanCallbackUrl(), this.banner = this.msg.oauthDenied;
2250
+ const t = new URLSearchParams(((E = globalThis.location) == null ? void 0 : E.search) ?? ""), e = t.get("access_code"), s = t.get("error") === Ie, i = t.get(Re), h = this.resolvedClient;
2251
+ if (e && !h) return;
2252
+ if (this.callbackDone = !0, s || i || !e || !h) {
2253
+ (C = globalThis.sessionStorage) == null || C.removeItem(this.nonceStorageKey), (k = globalThis.sessionStorage) == null || k.removeItem(Ae(this.nonceStorageKey)), this.cleanCallbackUrl(), this.banner = s ? this.msg.oauthDenied : this.describeOAuthError(i ?? ""), this.callbackPhase = "failed";
2179
2254
  return;
2180
2255
  }
2181
- if (!e || !i) return;
2182
- const h = (w = globalThis.sessionStorage) == null ? void 0 : w.getItem(this.nonceStorageKey);
2183
- if (this.cleanCallbackUrl(), !h) {
2184
- this.banner = this.msg.genericErrorMessage;
2256
+ const c = (T = globalThis.sessionStorage) == null ? void 0 : T.getItem(this.nonceStorageKey), f = Ae(this.nonceStorageKey), $ = (U = globalThis.sessionStorage) == null ? void 0 : U.getItem(f);
2257
+ if ((M = globalThis.sessionStorage) == null || M.removeItem(f), this.cleanCallbackUrl(), !c) {
2258
+ this.banner = this.msg.genericErrorMessage, this.callbackPhase = "failed";
2185
2259
  return;
2186
2260
  }
2187
- await this.withLoading(async () => {
2188
- var y;
2189
- await i.completeOAuth({ access_code: e, nonce: h }, this.signal()), (y = globalThis.sessionStorage) == null || y.removeItem(this.nonceStorageKey);
2190
- });
2261
+ this.callbackPhase = "working", await this.withLoading(async () => {
2262
+ var I, O;
2263
+ if (await h.completeOAuth({ access_code: e, nonce: c }, this.signal()), (I = globalThis.sessionStorage) == null || I.removeItem(this.nonceStorageKey), $) {
2264
+ const xe = this.settings ?? this.settingsCtl.settings, Ue = ((O = R(xe, "link").find((Me) => Me.id === $)) == null ? void 0 : O.name) ?? $;
2265
+ this.linkNotice = this.msg.providerConnectedNotice.replace("{name}", Ue);
2266
+ }
2267
+ }), this.callbackPhase = this.banner ? "failed" : "";
2191
2268
  }
2192
2269
  /** The small logo above a screen title: image when given one, else text. */
2193
2270
  renderLogo() {
2194
- return this.logoUrl ? a`<img class="logo-img" part="logo" src=${this.logoUrl} alt=${this.logoText} />` : this.logoText ? a`<div class="logo-dot" part="logo">${this.logoText}</div>` : d;
2271
+ return this.logoUrl ? r`<img class="logo-img" part="logo" src=${this.logoUrl} alt=${this.logoText} />` : this.logoText ? r`<div class="logo-dot" part="logo">${this.logoText}</div>` : d;
2195
2272
  }
2196
2273
  /** The larger logo in the split layout's brand panel. */
2197
2274
  renderBrandMark() {
2198
- return this.logoUrl ? a`<img class="brand-img" part="logo" src=${this.logoUrl} alt=${this.logoText} />` : this.logoText ? a`<div class="brand-mark" part="logo">${this.logoText}</div>` : d;
2275
+ return this.logoUrl ? r`<img class="brand-img" part="logo" src=${this.logoUrl} alt=${this.logoText} />` : this.logoText ? r`<div class="brand-mark" part="logo">${this.logoText}</div>` : d;
2199
2276
  }
2200
2277
  renderBranding() {
2201
- return cs(this.branding, "Auth");
2278
+ return Es(this.branding, "Auth");
2202
2279
  }
2203
2280
  /** Every screen renders inside this, so the credit appears once and only once. */
2204
2281
  panel(t) {
2205
- return a`<div class="panel">${t}${this.renderBranding()}</div>`;
2282
+ return r`<div class="panel">${t}${this.renderBranding()}</div>`;
2206
2283
  }
2207
2284
  renderOAuthCallback() {
2208
- return a`
2285
+ return r`
2209
2286
  <div class="stack">
2210
2287
  <div class="head">
2211
2288
  ${this.renderLogo()}
2212
2289
  <h2 class="title" part="title">${this.msg.oauthCallbackTitle}</h2>
2213
2290
  <p class="sub">${this.msg.oauthCallbackSub}</p>
2214
2291
  </div>
2215
- ${this.banner ? a`<div class="banner" part="banner" role="alert">${this.banner}</div>` : a`<div class="stack" style="align-items:center;">
2292
+ ${this.banner ? r`<div class="banner" part="banner" role="alert">${this.banner}</div>` : r`<div class="stack" style="align-items:center;">
2216
2293
  <span class="spinner" part="spinner"></span>
2217
2294
  </div>`}
2218
- ${this.banner ? a`<button type="button" class="ghost" @click=${() => this.goto("signin")}>
2295
+ ${this.banner ? r`<button
2296
+ type="button"
2297
+ class="ghost"
2298
+ @click=${() => {
2299
+ this.callbackPhase = "", this.goto("signin");
2300
+ }}
2301
+ >
2219
2302
  <span>${this.msg.backCta}</span>
2220
2303
  </button>` : d}
2221
2304
  </div>
@@ -2243,11 +2326,32 @@ let u = (Re = class extends $ {
2243
2326
  }
2244
2327
  }
2245
2328
  describeError(t) {
2246
- if (t instanceof Ee) {
2247
- if (t.code === "AUTH_RATE_LIMITED") return this.msg.rateLimitedMessage;
2248
- if (t.code === "INVALID_TOKEN") return "That code is not valid. Check it and try again.";
2249
- }
2250
- return this.msg.genericErrorMessage;
2329
+ return Fe(t, this.msg);
2330
+ }
2331
+ /**
2332
+ * The message for a code the backend sent back on the redirect. The code is
2333
+ * only ever looked up, never shown, so a crafted URL can't put text on the page.
2334
+ */
2335
+ describeOAuthError(t) {
2336
+ return zs.test(t) ? t === "INVALID_CREDENTIALS" ? this.msg.oauthNoAccountMessage : Fe(
2337
+ new Ne({ type: "AUTH_ERROR", status: 400, message: t }),
2338
+ this.msg
2339
+ ) : this.msg.genericErrorMessage;
2340
+ }
2341
+ /** The requirements hint under a field that creates a password. */
2342
+ get passwordHint() {
2343
+ const t = this.settings ?? this.settingsCtl.settings;
2344
+ return as(t == null ? void 0 : t.auth_settings.password_policy, this.msg);
2345
+ }
2346
+ /** The placeholder for a field that creates a password. */
2347
+ get newPasswordHint() {
2348
+ const t = this.settings ?? this.settingsCtl.settings;
2349
+ return ss(t == null ? void 0 : t.auth_settings.password_policy, this.msg);
2350
+ }
2351
+ /** The project's password rules, checked wherever a password is created. */
2352
+ checkNewPassword(t) {
2353
+ const e = this.settings ?? this.settingsCtl.settings;
2354
+ return is(t, e == null ? void 0 : e.auth_settings.password_policy, this.msg);
2251
2355
  }
2252
2356
  get codeValue() {
2253
2357
  return this.code.join("");
@@ -2286,8 +2390,9 @@ let u = (Re = class extends $ {
2286
2390
  return;
2287
2391
  }
2288
2392
  if (s === "newpass") {
2289
- if (this.newPass.length < 10) {
2290
- this.newPassError = this.msg.passwordMinError;
2393
+ const i = this.checkNewPassword(this.newPass);
2394
+ if (i) {
2395
+ this.newPassError = i;
2291
2396
  return;
2292
2397
  }
2293
2398
  if (this.newPass !== this.confirmPass) {
@@ -2303,20 +2408,18 @@ let u = (Re = class extends $ {
2303
2408
  return;
2304
2409
  }
2305
2410
  if (s === "invite") {
2306
- if (!this.firstName.trim() || !this.lastName.trim()) {
2307
- this.banner = "Enter your first and last name.";
2308
- return;
2309
- }
2310
- if (this.phone.replace(/\D/g, "").length < 7) {
2411
+ const i = this.phone.trim();
2412
+ if (i && i.replace(/\D/g, "").length < 7) {
2311
2413
  this.banner = this.msg.invalidPhoneError;
2312
2414
  return;
2313
2415
  }
2314
- if (this.password.length < 10) {
2315
- this.passError = this.msg.passwordMinError;
2416
+ const h = this.checkNewPassword(this.password);
2417
+ if (h) {
2418
+ this.passError = h;
2316
2419
  return;
2317
2420
  }
2318
- const i = this.inviteCode || this.codeValue;
2319
- if (i.length < 6) {
2421
+ const c = this.inviteCode || this.codeValue;
2422
+ if (c.length < 6) {
2320
2423
  this.banner = this.msg.codeIncompleteError;
2321
2424
  return;
2322
2425
  }
@@ -2326,21 +2429,32 @@ let u = (Re = class extends $ {
2326
2429
  email: this.inviteEmail,
2327
2430
  grant_type: "code",
2328
2431
  purpose: "invite",
2329
- code: i,
2432
+ code: c,
2330
2433
  password: this.password,
2331
- phone: this.phone
2434
+ ...i ? { phone: i } : {}
2332
2435
  },
2333
2436
  this.signal()
2334
2437
  );
2438
+ const f = this.firstName.trim(), $ = this.lastName.trim();
2439
+ (f || $) && await e.updateAccount(
2440
+ { ...f ? { first_name: f } : {}, ...$ ? { last_name: $ } : {} },
2441
+ this.signal()
2442
+ ).catch(() => {
2443
+ });
2335
2444
  });
2336
2445
  return;
2337
2446
  }
2338
2447
  if (this.stepped && (s === "signup" && this.step < 2 || s === "signin" && this.step < 1)) {
2339
- if (!this.email.includes("@")) {
2448
+ if (s === "signup" && this.step === 0) {
2449
+ if (!this.name.trim()) {
2450
+ this.banner = this.msg.firstNameRequiredError;
2451
+ return;
2452
+ }
2453
+ } else if (!this.email.includes("@")) {
2340
2454
  this.emailError = this.msg.invalidEmailError;
2341
2455
  return;
2342
2456
  }
2343
- this.step += 1;
2457
+ this.banner = "", this.step += 1;
2344
2458
  return;
2345
2459
  }
2346
2460
  if (!this.email.includes("@")) {
@@ -2348,35 +2462,41 @@ let u = (Re = class extends $ {
2348
2462
  return;
2349
2463
  }
2350
2464
  if (s === "signup") {
2351
- if (this.password.length < 8) {
2352
- this.passError = "Password must be at least 8 characters.";
2465
+ const [i = "", ...h] = this.name.trim().split(/\s+/);
2466
+ if (!i) {
2467
+ this.banner = this.msg.firstNameRequiredError;
2468
+ return;
2469
+ }
2470
+ const c = this.checkNewPassword(this.password);
2471
+ if (c) {
2472
+ this.passError = c;
2353
2473
  return;
2354
2474
  }
2355
- const [i, ...h] = this.name.trim().split(/\s+/);
2475
+ const f = h.join(" ");
2356
2476
  await this.withLoading(async () => {
2357
- const c = await e.signUp(
2477
+ const $ = await e.signUp(
2358
2478
  {
2359
2479
  email: this.email,
2360
2480
  password: this.password,
2361
- first_name: i || this.name,
2362
- last_name: h.join(" ") || "—"
2481
+ first_name: i,
2482
+ ...f ? { last_name: f } : {}
2363
2483
  },
2364
2484
  this.signal()
2365
- ), w = ns({
2366
- next_action: c.next_action,
2367
- next_operation: c.next_operation
2485
+ ), E = fs({
2486
+ next_action: $.next_action,
2487
+ next_operation: $.next_operation
2368
2488
  });
2369
2489
  this.setScreen("signin", {
2370
- notice: "Account created. Sign in to continue.",
2490
+ notice: this.msg.accountCreatedNotice,
2371
2491
  step: 0,
2372
2492
  password: "",
2373
- needsMfaCode: w === "signin_with_code"
2493
+ needsMfaCode: E === "signin_with_code"
2374
2494
  });
2375
2495
  });
2376
2496
  return;
2377
2497
  }
2378
- if (this.password.length < 8) {
2379
- this.attempts += 1, this.passError = "Password must be at least 8 characters.", this.banner = this.attempts >= 3 ? this.msg.rateLimitedMessage : "";
2498
+ if (!this.password) {
2499
+ this.passError = this.msg.requiredError;
2380
2500
  return;
2381
2501
  }
2382
2502
  await this.withLoading(async () => {
@@ -2390,12 +2510,12 @@ let u = (Re = class extends $ {
2390
2510
  this.signal()
2391
2511
  ), this.step = 0;
2392
2512
  } catch (i) {
2393
- if (i instanceof Ee && i.code === "CODE_REQUIRED") {
2513
+ if (i instanceof Ne && i.code === "CODE_REQUIRED") {
2394
2514
  this.needsMfaCode = !0, await e.requestCode({ email: this.email, purpose: "signin" }, this.signal()), this.notice = this.msg.codeSentNeutral;
2395
2515
  return;
2396
2516
  }
2397
- if (i instanceof Ee && i.code === "INVALID_CREDENTIALS") {
2398
- this.attempts += 1, this.banner = this.attempts >= 3 ? this.msg.rateLimitedMessage : "That email and password do not match.";
2517
+ if (i instanceof Ne && i.code === "INVALID_CREDENTIALS") {
2518
+ this.banner = this.msg.invalidCredentialsError;
2399
2519
  return;
2400
2520
  }
2401
2521
  throw i;
@@ -2407,16 +2527,16 @@ let u = (Re = class extends $ {
2407
2527
  return (t = this.abortController) == null || t.abort(), this.abortController = new AbortController(), this.abortController.signal;
2408
2528
  }
2409
2529
  onCodeInput(t, e) {
2410
- var w;
2530
+ var f;
2411
2531
  const i = e.target.value.replace(/\D/g, "");
2412
2532
  if (i.length > 1) {
2413
2533
  this.fillCode(t, i);
2414
2534
  return;
2415
2535
  }
2416
2536
  const h = i.slice(-1), c = this.code.slice();
2417
- c[t] = h, this.code = c, this.banner = "", h && ((w = this.renderRoot.querySelectorAll(
2537
+ c[t] = h, this.code = c, this.banner = "", h && ((f = this.renderRoot.querySelectorAll(
2418
2538
  ".code-row input, .code-row-sm input"
2419
- )[t + 1]) == null || w.focus());
2539
+ )[t + 1]) == null || f.focus());
2420
2540
  }
2421
2541
  onCodePaste(t, e) {
2422
2542
  var i;
@@ -2441,7 +2561,7 @@ let u = (Re = class extends $ {
2441
2561
  if (!t || this.loading) return;
2442
2562
  const e = this.verifyNext === "newpass" ? "password_reset" : "signin";
2443
2563
  await this.withLoading(async () => {
2444
- await t.requestCode({ email: this.email, purpose: e }, this.signal()), this.notice = "New code sent.", this.code = ["", "", "", "", "", ""];
2564
+ await t.requestCode({ email: this.email, purpose: e }, this.signal()), this.notice = this.msg.codeResentNotice, this.code = ["", "", "", "", "", ""];
2445
2565
  });
2446
2566
  }
2447
2567
  goBack() {
@@ -2518,15 +2638,15 @@ let u = (Re = class extends $ {
2518
2638
  }
2519
2639
  // ── render pieces ─────────────────────────────────────────
2520
2640
  renderPrimary(t) {
2521
- return a`
2641
+ return r`
2522
2642
  <button type="submit" class="primary" part="button-primary" ?disabled=${this.loading}>
2523
- ${this.loading ? a`<span class="spinner" part="spinner"></span>` : d}
2643
+ ${this.loading ? r`<span class="spinner" part="spinner"></span>` : d}
2524
2644
  <span>${t}</span>
2525
2645
  </button>
2526
2646
  `;
2527
2647
  }
2528
2648
  renderEmailField(t) {
2529
- return a`
2649
+ return r`
2530
2650
  <div class="field">
2531
2651
  <label for=${t}>${this.msg.emailLabel}</label>
2532
2652
  <input
@@ -2541,16 +2661,16 @@ let u = (Re = class extends $ {
2541
2661
  this.email = e.target.value, this.emailError = "", this.banner = "";
2542
2662
  }}
2543
2663
  />
2544
- ${this.emailError ? a`<p class="err">${this.emailError}</p>` : d}
2664
+ ${this.emailError ? r`<p class="err">${this.emailError}</p>` : d}
2545
2665
  </div>
2546
2666
  `;
2547
2667
  }
2548
- renderPasswordField(t, e) {
2549
- return a`
2668
+ renderPasswordField(t, e, s = !1) {
2669
+ return r`
2550
2670
  <div class="field">
2551
2671
  <div class="label-row">
2552
2672
  <label for=${t}>${this.msg.passwordLabel}</label>
2553
- ${e ? a`<button
2673
+ ${e ? r`<button
2554
2674
  type="button"
2555
2675
  class="link-sm"
2556
2676
  @click=${() => this.setScreen("forgot", { step: 0 })}
@@ -2563,28 +2683,33 @@ let u = (Re = class extends $ {
2563
2683
  type="password"
2564
2684
  part="input"
2565
2685
  .value=${this.password}
2566
- placeholder=${this.msg.passwordPlaceholder}
2686
+ placeholder=${s ? this.newPasswordHint : this.msg.passwordPlaceholder}
2567
2687
  aria-invalid=${this.passError ? "true" : "false"}
2568
2688
  ?disabled=${this.loading}
2569
- @input=${(s) => {
2570
- this.password = s.target.value, this.passError = "", this.banner = "";
2689
+ @input=${(i) => {
2690
+ this.password = i.target.value, this.passError = "", this.banner = "";
2571
2691
  }}
2572
2692
  />
2573
- ${this.passError ? a`<p class="err">${this.passError}</p>` : d}
2693
+ ${s ? this.passwordHint : d}
2694
+ ${this.passError ? r`<p class="err">${this.passError}</p>` : d}
2574
2695
  </div>
2575
2696
  `;
2576
2697
  }
2577
2698
  renderCodeRow(t = !1) {
2578
- return a`
2579
- <div class=${t ? "code-row-sm" : "code-row"} role="group" aria-label="Verification code">
2699
+ return r`
2700
+ <div
2701
+ class=${t ? "code-row-sm" : "code-row"}
2702
+ role="group"
2703
+ aria-label=${this.msg.codeLabel}
2704
+ >
2580
2705
  ${this.code.map(
2581
- (e, s) => a`
2706
+ (e, s) => r`
2582
2707
  <input
2583
2708
  type="text"
2584
2709
  inputmode="numeric"
2585
2710
  maxlength="1"
2586
2711
  part="code-box"
2587
- aria-label=${`Digit ${s + 1}`}
2712
+ aria-label=${this.msg.digitLabel.replace("{n}", String(s + 1))}
2588
2713
  autocomplete=${s === 0 ? "one-time-code" : "off"}
2589
2714
  .value=${e}
2590
2715
  ?disabled=${this.loading}
@@ -2598,9 +2723,9 @@ let u = (Re = class extends $ {
2598
2723
  }
2599
2724
  /** The email/password method accordion body for signin, signup and otp. */
2600
2725
  renderEmailMethodBody(t) {
2601
- const e = this.cfg, s = this.stepped, i = t === "signup" && (!s || this.step === 0), h = t === "signup" && (!s || this.step === 1) || t === "signin" && (!s || this.step === 0) || t === "otp", c = t === "signup" && (!s || this.step === 2) || t === "signin" && (!s || this.step === 1), w = t === "signin" && e.allowEmailSignin && e.allowEmailOtp && (!s || this.step === 0);
2602
- return a`
2603
- ${i ? a`
2726
+ const e = this.cfg, s = this.stepped, i = t === "signup" && (!s || this.step === 0), h = t === "signup" && (!s || this.step === 1) || t === "signin" && (!s || this.step === 0) || t === "otp", c = t === "signup" && (!s || this.step === 2) || t === "signin" && (!s || this.step === 1), f = t === "signin" && e.allowEmailSignin && e.allowEmailOtp && (!s || this.step === 0);
2727
+ return r`
2728
+ ${i ? r`
2604
2729
  <div class="field">
2605
2730
  <label for=${this.uid("name")}>${this.msg.fullNameLabel}</label>
2606
2731
  <input
@@ -2610,20 +2735,24 @@ let u = (Re = class extends $ {
2610
2735
  .value=${this.name}
2611
2736
  placeholder=${this.msg.fullNamePlaceholder}
2612
2737
  ?disabled=${this.loading}
2613
- @input=${(y) => this.name = y.target.value}
2738
+ @input=${($) => this.name = $.target.value}
2614
2739
  />
2615
2740
  </div>
2616
2741
  ` : d}
2617
2742
  ${h ? this.renderEmailField(this.uid("email")) : d}
2618
- ${c ? this.renderPasswordField(this.uid("pass"), e.allowEmailSignin && t === "signin") : d}
2619
- ${this.needsMfaCode && t === "signin" ? a`
2743
+ ${c ? this.renderPasswordField(
2744
+ this.uid("pass"),
2745
+ e.allowRecovery && t === "signin",
2746
+ t === "signup"
2747
+ ) : d}
2748
+ ${this.needsMfaCode && t === "signin" ? r`
2620
2749
  <div class="field">
2621
- <span class="label">Verification code</span>
2750
+ <span class="label">${this.msg.codeLabel}</span>
2622
2751
  ${this.renderCodeRow(!0)}
2623
2752
  </div>
2624
2753
  ` : d}
2625
2754
  ${this.renderPrimary(this.ctaFor(t))}
2626
- ${w ? a`<button
2755
+ ${f ? r`<button
2627
2756
  type="button"
2628
2757
  class="edit-link"
2629
2758
  @click=${() => this.setScreen("otp", { step: 0 })}
@@ -2633,62 +2762,62 @@ let u = (Re = class extends $ {
2633
2762
  `;
2634
2763
  }
2635
2764
  renderAccordion(t) {
2636
- const e = this.cfg, s = t === "signin" && e.allowEmailSignin || t === "signup" && e.allowEmailSignup || t === "otp" && e.allowEmailOtp, i = e.allowOauth;
2637
- if (!s && !i) return d;
2638
- const h = s && i, c = s ? i && this.method || "email" : "oauth", w = c === "email", y = c === "oauth", ye = t === "signup" ? this.msg.emailMethodTitleSignUp : this.msg.emailMethodTitle, Je = t === "otp" ? this.msg.emailMethodMetaOtp : t === "signup" ? this.msg.emailMethodMetaSignUp : this.msg.emailMethodMeta, ke = (Te, Qe, Xe, Ze, ts, xe) => a`
2639
- <div class="acc-item ${Te ? "open" : ""} ${h ? "" : "bare"}" part="acc-item">
2640
- ${h ? a`
2765
+ const e = this.cfg, s = t === "signin" && e.allowEmailSignin || t === "signup" && e.allowEmailSignup || t === "otp" && e.allowEmailOtp, i = this.settings ?? this.settingsCtl.settings, h = R(i, t === "signup" ? "signup" : "signin"), c = e.allowOauth && (!i || h.length > 0);
2766
+ if (!s && !c) return d;
2767
+ const f = s && c, $ = s ? c && this.method || "email" : "oauth", E = $ === "email", C = $ === "oauth", k = t === "signup" ? this.msg.emailMethodTitleSignUp : this.msg.emailMethodTitle, T = t === "otp" ? this.msg.emailMethodMetaOtp : t === "signup" ? this.msg.emailMethodMetaSignUp : this.msg.emailMethodMeta, U = (O, xe, Ue, Me, cs, He) => r`
2768
+ <div class="acc-item ${O ? "open" : ""} ${f ? "" : "bare"}" part="acc-item">
2769
+ ${f ? r`
2641
2770
  <button
2642
2771
  type="button"
2643
2772
  class="acc-head"
2644
- aria-expanded=${Te ? "true" : "false"}
2645
- aria-controls=${this.uid(`acc-${xe}`)}
2646
- @click=${ts}
2773
+ aria-expanded=${O ? "true" : "false"}
2774
+ aria-controls=${this.uid(`acc-${He}`)}
2775
+ @click=${cs}
2647
2776
  >
2648
2777
  <span class="chev" aria-hidden="true">›</span>
2649
- <span class="acc-title">${Qe}</span>
2650
- <span class="acc-meta">${Xe}</span>
2778
+ <span class="acc-title">${xe}</span>
2779
+ <span class="acc-meta">${Ue}</span>
2651
2780
  </button>
2652
2781
  ` : d}
2653
- <div class="acc-body" id=${this.uid(`acc-${xe}`)}>
2782
+ <div class="acc-body" id=${this.uid(`acc-${He}`)}>
2654
2783
  <div class="acc-clip">
2655
- <div class="acc-inner">${Ze}</div>
2784
+ <div class="acc-inner">${Me}</div>
2656
2785
  </div>
2657
2786
  </div>
2658
2787
  </div>
2659
- `, _e = s ? ke(
2660
- w,
2661
- ye,
2662
- Je,
2788
+ `, M = s ? U(
2789
+ E,
2790
+ k,
2791
+ T,
2663
2792
  this.renderEmailMethodBody(t),
2664
- () => this.method = w ? "" : "email",
2793
+ () => this.method = E ? "" : "email",
2665
2794
  "email"
2666
- ) : d, Oe = i ? ke(
2667
- y,
2795
+ ) : d, I = c ? U(
2796
+ C,
2668
2797
  this.msg.oauthMethodTitle,
2669
- this.msg.oauthMethodMeta,
2670
- a`<singlebase-authui-buttons
2798
+ h.length ? h.map((O) => O.name).join(", ") : this.msg.oauthMethodMeta,
2799
+ r`<singlebase-authui-buttons
2671
2800
  type="oauth"
2672
2801
  embedded
2673
- theme=${k(this.theme)}
2674
- density=${k(this.density)}
2675
- field-style=${k(this.fieldStyle)}
2802
+ theme=${A(this.theme)}
2803
+ density=${A(this.density)}
2804
+ field-style=${A(this.fieldStyle)}
2676
2805
  .client=${this.resolvedClient}
2677
2806
  .messages=${this.messages}
2678
2807
  .settings=${this.settings ?? this.settingsCtl.settings}
2679
2808
  intent=${t === "signup" ? "signup" : "signin"}
2680
2809
  ></singlebase-authui-buttons>`,
2681
- () => this.method = y ? "" : "oauth",
2810
+ () => this.method = C ? "" : "oauth",
2682
2811
  "oauth"
2683
2812
  ) : d;
2684
- return a`
2813
+ return r`
2685
2814
  <div class="acc-wrap">
2686
- ${this.oauthPlacement === "top" ? a`${Oe}${_e}` : a`${_e}${Oe}`}
2815
+ ${this.oauthPlacement === "top" ? r`${I}${M}` : r`${M}${I}`}
2687
2816
  </div>
2688
2817
  `;
2689
2818
  }
2690
2819
  renderScreenBody(t) {
2691
- return this.cfg, ["signin", "signup", "otp"].indexOf(t) >= 0 ? this.renderAccordion(t) : t === "forgot" ? a`<div class="fields">${this.renderEmailField(this.uid("reset"))}</div>` : t === "verify" ? a`
2820
+ return this.cfg, ["signin", "signup", "otp"].indexOf(t) >= 0 ? this.renderAccordion(t) : t === "forgot" ? r`<div class="fields">${this.renderEmailField(this.uid("reset"))}</div>` : t === "verify" ? r`
2692
2821
  ${this.renderCodeRow()}
2693
2822
  <div class="resend-row">
2694
2823
  <span class="hint">${this.msg.resendQuestion}</span>
@@ -2696,7 +2825,7 @@ let u = (Re = class extends $ {
2696
2825
  ${this.msg.resendCta}
2697
2826
  </button>
2698
2827
  </div>
2699
- ` : t === "newpass" ? a`
2828
+ ` : t === "newpass" ? r`
2700
2829
  <div class="fields">
2701
2830
  <div class="field">
2702
2831
  <label for=${this.uid("newpass")}>${this.msg.newPasswordLabel}</label>
@@ -2705,7 +2834,7 @@ let u = (Re = class extends $ {
2705
2834
  type="password"
2706
2835
  part="input"
2707
2836
  .value=${this.newPass}
2708
- placeholder=${this.msg.newPasswordPlaceholder}
2837
+ placeholder=${this.newPasswordHint}
2709
2838
  aria-invalid=${this.newPassError ? "true" : "false"}
2710
2839
  ?disabled=${this.loading}
2711
2840
  @input=${(s) => {
@@ -2727,17 +2856,18 @@ let u = (Re = class extends $ {
2727
2856
  this.confirmPass = s.target.value, this.newPassError = "";
2728
2857
  }}
2729
2858
  />
2730
- ${this.newPassError ? a`<p class="err">${this.newPassError}</p>` : d}
2859
+ ${this.passwordHint}
2860
+ ${this.newPassError ? r`<p class="err">${this.newPassError}</p>` : d}
2731
2861
  </div>
2732
2862
  </div>
2733
- ` : t === "invite" ? a`
2863
+ ` : t === "invite" ? r`
2734
2864
  <div class="fields">
2735
2865
  <div class="invite-box">
2736
2866
  <span class="invite-label">${this.msg.invitedEmailLabel}</span>
2737
2867
  <span class="invite-email">${this.inviteEmail}</span>
2738
2868
  </div>
2739
- ${this.inviteCode ? d : a`<div class="field">
2740
- <span class="label">Invite code</span>
2869
+ ${this.inviteCode ? d : r`<div class="field">
2870
+ <span class="label">${this.msg.inviteCodeLabel}</span>
2741
2871
  ${this.renderCodeRow(!0)}
2742
2872
  </div>`}
2743
2873
  <div class="two-up">
@@ -2785,21 +2915,22 @@ let u = (Re = class extends $ {
2785
2915
  type="password"
2786
2916
  part="input"
2787
2917
  .value=${this.password}
2788
- placeholder=${this.msg.newPasswordPlaceholder}
2918
+ placeholder=${this.newPasswordHint}
2789
2919
  aria-invalid=${this.passError ? "true" : "false"}
2790
2920
  ?disabled=${this.loading}
2791
2921
  @input=${(s) => {
2792
2922
  this.password = s.target.value, this.passError = "";
2793
2923
  }}
2794
2924
  />
2795
- ${this.passError ? a`<p class="err">${this.passError}</p>` : d}
2925
+ ${this.passwordHint}
2926
+ ${this.passError ? r`<p class="err">${this.passError}</p>` : d}
2796
2927
  </div>
2797
2928
  </div>
2798
2929
  ` : d;
2799
2930
  }
2800
2931
  renderGuest(t) {
2801
2932
  const e = this.cfg, s = ["forgot", "verify", "newpass", "invite"].indexOf(t) >= 0, i = this.stepped && this.step > 0 || ["forgot", "verify", "otp", "newpass"].indexOf(t) >= 0, h = t === "signin" && e.allowEmailSignup || t === "signup" && e.allowEmailSignin, c = this.stepped && (t === "signin" || t === "signup");
2802
- return a`
2933
+ return r`
2803
2934
  <form class="stack" @submit=${this.onSubmit} novalidate>
2804
2935
  <div class="head">
2805
2936
  ${this.layout !== "split" ? this.renderLogo() : d}
@@ -2807,21 +2938,21 @@ let u = (Re = class extends $ {
2807
2938
  <p class="sub">${this.subFor(t)}</p>
2808
2939
  </div>
2809
2940
 
2810
- ${c ? a`<div class="step-bar">
2941
+ ${c ? r`<div class="step-bar">
2811
2942
  <div class="step-fill" style="width:${this.stepPct()}%"></div>
2812
2943
  </div>` : d}
2813
- ${this.banner ? a`<div class="banner" part="banner" role="alert">${this.banner}</div>` : d}
2814
- ${this.notice ? a`<div class="notice" part="notice" role="status">${this.notice}</div>` : d}
2944
+ ${this.banner ? r`<div class="banner" part="banner" role="alert">${this.banner}</div>` : d}
2945
+ ${this.notice ? r`<div class="notice" part="notice" role="status">${this.notice}</div>` : d}
2815
2946
  ${this.renderScreenBody(t)}
2816
- ${s || i ? a`
2947
+ ${s || i ? r`
2817
2948
  <div class="actions">
2818
2949
  ${s ? this.renderPrimary(this.ctaFor(t)) : d}
2819
- ${i ? a`<button type="button" class="ghost" @click=${this.goBack}>
2950
+ ${i ? r`<button type="button" class="ghost" @click=${this.goBack}>
2820
2951
  ${this.msg.backCta}
2821
2952
  </button>` : d}
2822
2953
  </div>
2823
2954
  ` : d}
2824
- ${h ? a`
2955
+ ${h ? r`
2825
2956
  <p class="foot">
2826
2957
  <span
2827
2958
  >${t === "signup" ? this.msg.footTextSignUp : this.msg.footTextSignIn}</span
@@ -2841,14 +2972,14 @@ let u = (Re = class extends $ {
2841
2972
  ${this.renderConsent()}
2842
2973
 
2843
2974
  <span class="sr-only" role="status" aria-live="polite">
2844
- ${this.loading ? "Submitting…" : ""}
2975
+ ${this.loading ? this.msg.submittingStatus : ""}
2845
2976
  </span>
2846
2977
  </form>
2847
2978
  `;
2848
2979
  }
2849
2980
  renderBlocked() {
2850
2981
  const e = !this.cfg.authEnabled;
2851
- return a`
2982
+ return r`
2852
2983
  <div class="stack">
2853
2984
  <div class="head">
2854
2985
  ${this.layout !== "split" ? this.renderLogo() : d}
@@ -2870,7 +3001,7 @@ let u = (Re = class extends $ {
2870
3001
  */
2871
3002
  renderSignedIn() {
2872
3003
  const t = this.auth.state.status === "authenticated" ? this.auth.state.user : null, e = this.redirectTarget;
2873
- return a`
3004
+ return r`
2874
3005
  <div class="stack">
2875
3006
  <div class="head">
2876
3007
  ${this.renderLogo()}
@@ -2889,60 +3020,73 @@ let u = (Re = class extends $ {
2889
3020
  </button>
2890
3021
  </div>
2891
3022
 
2892
- ${e ? d : a`<p class="hint">${this.msg.continueHint}</p>`}
3023
+ ${e ? d : r`<p class="hint">${this.msg.continueHint}</p>`}
2893
3024
  </div>
2894
3025
  `;
2895
3026
  }
2896
3027
  /** The Terms/Privacy consent line, rendered only when the host supplies a link. */
2897
3028
  renderConsent() {
2898
3029
  if (!this.tosUrl && !this.privacyUrl) return d;
2899
- const t = this.tosUrl ? a`<a class="link-sm" href=${this.tosUrl} target="_blank" rel="noopener noreferrer"
3030
+ const t = this.tosUrl ? r`<a class="link-sm" href=${this.tosUrl} target="_blank" rel="noopener noreferrer"
2900
3031
  >${this.msg.termsLabel}</a
2901
- >` : d, e = this.privacyUrl ? a`<a class="link-sm" href=${this.privacyUrl} target="_blank" rel="noopener noreferrer"
3032
+ >` : d, e = this.privacyUrl ? r`<a class="link-sm" href=${this.privacyUrl} target="_blank" rel="noopener noreferrer"
2902
3033
  >${this.msg.privacyLabel}</a
2903
3034
  >` : d;
2904
- return a`
2905
- <p class="hint" part="consent">
3035
+ return r`
3036
+ <p class="hint consent" part="consent">
2906
3037
  ${this.msg.consentPrefix}
2907
- ${t}${this.tosUrl && this.privacyUrl ? a` ${this.msg.consentJoin} ` : d}${e}.
3038
+ ${t}${this.tosUrl && this.privacyUrl ? r` ${this.msg.consentJoin} ` : d}${e}.
2908
3039
  </p>
2909
3040
  `;
2910
3041
  }
3042
+ /**
3043
+ * The OAuth return is handled after the first render, not during it: state
3044
+ * set while rendering is dropped, so the widget wouldn't leave the callback
3045
+ * screen once the URL is cleaned.
3046
+ */
3047
+ updated(t) {
3048
+ super.updated(t), this.activeScreen === "oauth-callback" && this.handleOAuthCallback();
3049
+ }
2911
3050
  render() {
2912
3051
  const t = this.activeScreen;
2913
3052
  if (t === "oauth-callback")
2914
- return this.handleOAuthCallback(), this.panel(this.renderOAuthCallback());
2915
- if (t === "account")
2916
- return this.noAccountView ? d : this.panel(a`
3053
+ return this.panel(this.renderOAuthCallback());
3054
+ if (t === "account") {
3055
+ if (this.noAccountView) return d;
3056
+ const h = this.callbackPhase === "failed" && this.banner;
3057
+ return this.panel(r`
3058
+ ${h ? r`<div class="banner" part="banner" role="alert">${this.banner}</div>` : d}
3059
+ ${this.linkNotice ? r`<div class="notice" part="notice" role="status">${this.linkNotice}</div>` : d}
2917
3060
  <singlebase-authui-account
2918
- theme=${k(this.theme)}
2919
- density=${k(this.density)}
2920
- field-style=${k(this.fieldStyle)}
3061
+ theme=${A(this.theme)}
3062
+ density=${A(this.density)}
3063
+ field-style=${A(this.fieldStyle)}
2921
3064
  .client=${this.resolvedClient}
2922
3065
  .messages=${this.messages}
2923
3066
  logo-text=${this.logoText}
2924
3067
  logo-url=${this.logoUrl}
2925
3068
  ></singlebase-authui-account>
2926
3069
  `);
3070
+ }
2927
3071
  if (this.showsSignedInInterstitial)
2928
3072
  return this.noAccountView ? d : this.panel(this.renderSignedIn());
2929
- const e = this.cfg, s = !e.allowEmailSignin && !e.allowEmailOtp && !e.allowOauth, i = !e.authEnabled || s && Ie(t);
2930
- return a`
2931
- ${this.layout === "split" ? a`
3073
+ const e = this.cfg, s = !e.allowEmailSignin && !e.allowEmailOtp && !e.allowOauth, i = !e.authEnabled || s && We(t);
3074
+ return r`
3075
+ ${this.layout === "split" ? r`
2932
3076
  <div class="brand-panel">
2933
3077
  ${this.renderBrandMark()}
2934
- ${this.brandLine ? a`<div class="brand-copy">${this.brandLine}</div>` : d}
2935
- ${this.brandFoot ? a`<div class="brand-foot">${this.brandFoot}</div>` : d}
3078
+ ${this.brandLine ? r`<div class="brand-copy">${this.brandLine}</div>` : d}
3079
+ ${this.brandFoot ? r`<div class="brand-foot">${this.brandFoot}</div>` : d}
2936
3080
  </div>
2937
3081
  ` : d}
2938
3082
  ${this.panel(i ? this.renderBlocked() : this.renderGuest(t))}
2939
3083
  `;
2940
3084
  }
2941
- }, vt = new WeakMap(), wt = new WeakMap(), $t = new WeakMap(), yt = new WeakMap(), Et = new WeakMap(), St = new WeakMap(), Ct = new WeakMap(), Pt = new WeakMap(), kt = new WeakMap(), _t = new WeakMap(), Ot = new WeakMap(), Tt = new WeakMap(), xt = new WeakMap(), Ut = new WeakMap(), Lt = new WeakMap(), At = new WeakMap(), Mt = new WeakMap(), Nt = new WeakMap(), It = new WeakMap(), Ft = new WeakMap(), Dt = new WeakMap(), Bt = new WeakMap(), Rt = new WeakMap(), jt = new WeakMap(), Ht = new WeakMap(), qt = new WeakMap(), Vt = new WeakMap(), Gt = new WeakMap(), Kt = new WeakMap(), Yt = new WeakMap(), Wt = new WeakMap(), zt = new WeakMap(), Jt = new WeakMap(), Qt = new WeakMap(), Xt = new WeakMap(), Zt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), re = new WeakMap(), ne = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), he = new WeakMap(), de = new WeakMap(), Re);
2942
- Ms(u, "styles", [
2943
- ...$.styles,
2944
- ds,
2945
- qe`
3085
+ }, _t = new WeakMap(), kt = new WeakMap(), Tt = new WeakMap(), Ot = new WeakMap(), Nt = new WeakMap(), At = new WeakMap(), Lt = new WeakMap(), xt = new WeakMap(), Ut = new WeakMap(), Mt = new WeakMap(), It = new WeakMap(), Rt = new WeakMap(), Ft = new WeakMap(), Dt = new WeakMap(), Bt = new WeakMap(), Ht = new WeakMap(), qt = new WeakMap(), jt = new WeakMap(), Kt = new WeakMap(), Vt = new WeakMap(), Gt = new WeakMap(), Wt = new WeakMap(), Yt = new WeakMap(), zt = new WeakMap(), Jt = new WeakMap(), Zt = new WeakMap(), Qt = new WeakMap(), Xt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), re = new WeakMap(), ne = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), he = new WeakMap(), de = new WeakMap(), ce = new WeakMap(), ue = new WeakMap(), pe = new WeakMap(), ge = new WeakMap(), me = new WeakMap(), be = new WeakMap(), fe = new WeakMap(), ve = new WeakMap(), we = new WeakMap(), Ze);
3086
+ Ys(u, "styles", [
3087
+ ...y.styles,
3088
+ ys,
3089
+ ts`
2946
3090
  /* the mock's root */
2947
3091
  :host {
2948
3092
  display: flex;
@@ -3043,22 +3187,22 @@ g([
3043
3187
  p({ attribute: !1 })
3044
3188
  ], u.prototype, "settings", 1);
3045
3189
  g([
3046
- p({ converter: P, attribute: "auth-enabled" })
3190
+ p({ converter: N, attribute: "auth-enabled" })
3047
3191
  ], u.prototype, "authEnabled", 1);
3048
3192
  g([
3049
- p({ converter: P, attribute: "allow-email-signin" })
3193
+ p({ converter: N, attribute: "allow-email-signin" })
3050
3194
  ], u.prototype, "allowEmailSignin", 1);
3051
3195
  g([
3052
- p({ converter: P, attribute: "allow-email-signup" })
3196
+ p({ converter: N, attribute: "allow-email-signup" })
3053
3197
  ], u.prototype, "allowEmailSignup", 1);
3054
3198
  g([
3055
- p({ converter: P, attribute: "allow-email-otp" })
3199
+ p({ converter: N, attribute: "allow-email-otp" })
3056
3200
  ], u.prototype, "allowEmailOtp", 1);
3057
3201
  g([
3058
- p({ converter: P, attribute: "allow-oauth" })
3202
+ p({ converter: N, attribute: "allow-oauth" })
3059
3203
  ], u.prototype, "allowOauth", 1);
3060
3204
  g([
3061
- p({ converter: P, attribute: "allow-account-creation" })
3205
+ p({ converter: N, attribute: "allow-account-creation" })
3062
3206
  ], u.prototype, "allowAccountCreation", 1);
3063
3207
  g([
3064
3208
  p()
@@ -3085,7 +3229,7 @@ g([
3085
3229
  p({ attribute: "sign-in-title" })
3086
3230
  ], u.prototype, "signInTitle", 1);
3087
3231
  g([
3088
- p({ converter: P, attribute: "branding" })
3232
+ p({ converter: N, attribute: "branding" })
3089
3233
  ], u.prototype, "branding", 1);
3090
3234
  g([
3091
3235
  p({ attribute: "redirect-url" })
@@ -3162,50 +3306,53 @@ g([
3162
3306
  g([
3163
3307
  m()
3164
3308
  ], u.prototype, "newPassError", 1);
3165
- g([
3166
- m()
3167
- ], u.prototype, "attempts", 1);
3168
3309
  g([
3169
3310
  m()
3170
3311
  ], u.prototype, "needsMfaCode", 1);
3171
3312
  g([
3172
3313
  m()
3173
3314
  ], u.prototype, "callbackDone", 1);
3315
+ g([
3316
+ m()
3317
+ ], u.prototype, "callbackPhase", 1);
3318
+ g([
3319
+ m()
3320
+ ], u.prototype, "linkNotice", 1);
3174
3321
  u = g([
3175
- we("singlebase-authui")
3322
+ Te("singlebase-authui")
3176
3323
  ], u);
3177
- var Fs = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, Se = (r, t, e, s) => {
3178
- for (var i = s > 1 ? void 0 : s ? Ds(t, e) : t, h = r.length - 1, c; h >= 0; h--)
3179
- (c = r[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
3180
- return s && i && Fs(t, e, i), i;
3324
+ var Qs = Object.defineProperty, Xs = Object.getOwnPropertyDescriptor, Le = (a, t, e, s) => {
3325
+ for (var i = s > 1 ? void 0 : s ? Xs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
3326
+ (c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
3327
+ return s && i && Qs(t, e, i), i;
3181
3328
  };
3182
- const Bs = ["loading", "authenticated", "unauthenticated"];
3183
- var ce, ue, pe, je;
3184
- let T = (je = class extends $ {
3329
+ const ti = ["loading", "authenticated", "unauthenticated"];
3330
+ var $e, ye, Ee, Qe;
3331
+ let F = (Qe = class extends y {
3185
3332
  constructor() {
3186
3333
  super(...arguments);
3187
- o(this, ce, "");
3188
- o(this, ue, null);
3189
- o(this, pe, "unauthenticated");
3334
+ o(this, $e, "");
3335
+ o(this, ye, null);
3336
+ o(this, Ee, "unauthenticated");
3190
3337
  b(this, "warnedFor", null);
3191
3338
  }
3192
3339
  get slot() {
3193
- return n(this, ce);
3340
+ return n(this, $e);
3194
3341
  }
3195
3342
  set slot(t) {
3196
- l(this, ce, t);
3343
+ l(this, $e, t);
3197
3344
  }
3198
3345
  get predicate() {
3199
- return n(this, ue);
3346
+ return n(this, ye);
3200
3347
  }
3201
3348
  set predicate(t) {
3202
- l(this, ue, t);
3349
+ l(this, ye, t);
3203
3350
  }
3204
3351
  get onMismatch() {
3205
- return n(this, pe);
3352
+ return n(this, Ee);
3206
3353
  }
3207
3354
  set onMismatch(t) {
3208
- l(this, pe, t);
3355
+ l(this, Ee, t);
3209
3356
  }
3210
3357
  createRenderRoot() {
3211
3358
  return this;
@@ -3218,100 +3365,100 @@ let T = (je = class extends $ {
3218
3365
  if (!this.predicate) return "authenticated";
3219
3366
  this.warnOnce(this.predicate);
3220
3367
  const e = this.auth.state.user;
3221
- return ms(e, this.predicate) ? "authenticated" : this.onMismatch === "hidden" ? "hidden" : "unauthenticated";
3368
+ return _s(e, this.predicate) ? "authenticated" : this.onMismatch === "hidden" ? "hidden" : "unauthenticated";
3222
3369
  }
3223
3370
  /** Surfaces a malformed predicate once, rather than silently never matching. */
3224
3371
  warnOnce(t) {
3225
3372
  const e = JSON.stringify(t);
3226
3373
  if (this.warnedFor !== e) {
3227
3374
  this.warnedFor = e;
3228
- for (const s of bs(t))
3375
+ for (const s of ks(t))
3229
3376
  console.warn(`[singlebase] <singlebase-authui-guard> predicate: ${s}`);
3230
3377
  }
3231
3378
  }
3232
3379
  render() {
3233
3380
  const t = this.activeState;
3234
3381
  if (this.slot) {
3235
- const e = Bs.includes(this.slot) && this.slot === t;
3236
- return this.toggleAttribute("hidden", !e), a`<slot></slot>`;
3382
+ const e = ti.includes(this.slot) && this.slot === t;
3383
+ return this.toggleAttribute("hidden", !e), r`<slot></slot>`;
3237
3384
  }
3238
3385
  this.toggleAttribute("hidden", !1);
3239
3386
  for (const e of Array.from(this.children)) {
3240
3387
  const s = e.getAttribute("slot");
3241
3388
  e.toggleAttribute("hidden", s !== t);
3242
3389
  }
3243
- return a`<slot></slot>`;
3390
+ return r`<slot></slot>`;
3244
3391
  }
3245
- }, ce = new WeakMap(), ue = new WeakMap(), pe = new WeakMap(), je);
3246
- Se([
3392
+ }, $e = new WeakMap(), ye = new WeakMap(), Ee = new WeakMap(), Qe);
3393
+ Le([
3247
3394
  p({ reflect: !0 })
3248
- ], T.prototype, "slot", 1);
3249
- Se([
3395
+ ], F.prototype, "slot", 1);
3396
+ Le([
3250
3397
  p({
3251
3398
  converter: {
3252
- fromAttribute: (r) => {
3253
- if (!r) return null;
3399
+ fromAttribute: (a) => {
3400
+ if (!a) return null;
3254
3401
  try {
3255
- return JSON.parse(r);
3402
+ return JSON.parse(a);
3256
3403
  } catch {
3257
- return console.error("[singlebase] guard predicate is not valid JSON:", r), null;
3404
+ return console.error("[singlebase] guard predicate is not valid JSON:", a), null;
3258
3405
  }
3259
3406
  },
3260
- toAttribute: (r) => r ? JSON.stringify(r) : null
3407
+ toAttribute: (a) => a ? JSON.stringify(a) : null
3261
3408
  }
3262
3409
  })
3263
- ], T.prototype, "predicate", 1);
3264
- Se([
3410
+ ], F.prototype, "predicate", 1);
3411
+ Le([
3265
3412
  p({ attribute: "on-mismatch" })
3266
- ], T.prototype, "onMismatch", 1);
3267
- T = Se([
3268
- we("singlebase-authui-guard")
3269
- ], T);
3270
- var ze = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, js = (r, t, e) => t in r ? ze(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, O = (r, t, e, s) => {
3271
- for (var i = s > 1 ? void 0 : s ? Rs(t, e) : t, h = r.length - 1, c; h >= 0; h--)
3272
- (c = r[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
3273
- return s && i && ze(t, e, i), i;
3274
- }, Hs = (r, t, e) => js(r, t + "", e);
3275
- const qs = "profile_photo";
3276
- var ge, me, be, fe, ve, He;
3277
- let S = (He = class extends $ {
3413
+ ], F.prototype, "onMismatch", 1);
3414
+ F = Le([
3415
+ Te("singlebase-authui-guard")
3416
+ ], F);
3417
+ var ds = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, si = (a, t, e) => t in a ? ds(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, x = (a, t, e, s) => {
3418
+ for (var i = s > 1 ? void 0 : s ? ei(t, e) : t, h = a.length - 1, c; h >= 0; h--)
3419
+ (c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
3420
+ return s && i && ds(t, e, i), i;
3421
+ }, ii = (a, t, e) => si(a, t + "", e);
3422
+ const ai = "profile_photo";
3423
+ var Se, Ce, Pe, _e, ke, Xe;
3424
+ let P = (Xe = class extends y {
3278
3425
  constructor() {
3279
3426
  super(...arguments);
3280
- o(this, ge, "");
3281
- o(this, me, "");
3282
- o(this, be, !1);
3283
- o(this, fe, "");
3284
- o(this, ve, !1);
3427
+ o(this, Se, "");
3428
+ o(this, Ce, "");
3429
+ o(this, Pe, !1);
3430
+ o(this, _e, "");
3431
+ o(this, ke, !1);
3285
3432
  }
3286
3433
  get path() {
3287
- return n(this, ge);
3434
+ return n(this, Se);
3288
3435
  }
3289
3436
  set path(t) {
3290
- l(this, ge, t);
3437
+ l(this, Se, t);
3291
3438
  }
3292
3439
  get fallback() {
3293
- return n(this, me);
3440
+ return n(this, Ce);
3294
3441
  }
3295
3442
  set fallback(t) {
3296
- l(this, me, t);
3443
+ l(this, Ce, t);
3297
3444
  }
3298
3445
  get avatar() {
3299
- return n(this, be);
3446
+ return n(this, Pe);
3300
3447
  }
3301
3448
  set avatar(t) {
3302
- l(this, be, t);
3449
+ l(this, Pe, t);
3303
3450
  }
3304
3451
  get alt() {
3305
- return n(this, fe);
3452
+ return n(this, _e);
3306
3453
  }
3307
3454
  set alt(t) {
3308
- l(this, fe, t);
3455
+ l(this, _e, t);
3309
3456
  }
3310
3457
  get imageFailed() {
3311
- return n(this, ve);
3458
+ return n(this, ke);
3312
3459
  }
3313
3460
  set imageFailed(t) {
3314
- l(this, ve, t);
3461
+ l(this, ke, t);
3315
3462
  }
3316
3463
  willUpdate(t) {
3317
3464
  super.willUpdate(t), (t.has("path") || t.has("avatar")) && (this.imageFailed = !1);
@@ -3324,41 +3471,41 @@ let S = (He = class extends $ {
3324
3471
  get textValue() {
3325
3472
  const t = this.profile;
3326
3473
  if (!t || !this.path) return "";
3327
- const e = Ae(t, this.path);
3474
+ const e = Ke(t, this.path);
3328
3475
  return e == null || e === "" ? "" : Array.isArray(e) ? e.filter((s) => s != null).join(", ") : typeof e == "object" ? "" : String(e);
3329
3476
  }
3330
3477
  get avatarSrc() {
3331
3478
  const t = this.profile;
3332
3479
  if (!t) return "";
3333
- const e = Ae(t, this.path || qs);
3480
+ const e = Ke(t, this.path || ai);
3334
3481
  return typeof e == "string" ? e : "";
3335
3482
  }
3336
3483
  render() {
3337
3484
  if (this.auth.state.status === "loading") return d;
3338
3485
  if (this.avatar) return this.renderAvatar();
3339
3486
  const t = this.textValue;
3340
- return t ? a`<span part="text">${t}</span>` : this.fallback ? a`<span part="text">${this.fallback}</span>` : d;
3487
+ return t ? r`<span part="text">${t}</span>` : this.fallback ? r`<span part="text">${this.fallback}</span>` : d;
3341
3488
  }
3342
3489
  renderAvatar() {
3343
3490
  const t = this.profile;
3344
3491
  if (!t) return d;
3345
3492
  const e = this.avatarSrc;
3346
- return e && !this.imageFailed ? a`<img
3493
+ return e && !this.imageFailed ? r`<img
3347
3494
  part="avatar-image"
3348
3495
  src=${e}
3349
3496
  alt=${this.alt}
3350
3497
  @error=${() => this.imageFailed = !0}
3351
- />` : a`<span
3498
+ />` : r`<span
3352
3499
  part="avatar-initials"
3353
3500
  class="initials"
3354
3501
  aria-hidden=${this.alt ? "false" : "true"}
3355
- >${Ge(t)}</span
3502
+ >${ns(t)}</span
3356
3503
  >`;
3357
3504
  }
3358
- }, ge = new WeakMap(), me = new WeakMap(), be = new WeakMap(), fe = new WeakMap(), ve = new WeakMap(), He);
3359
- Hs(S, "styles", [
3360
- ...$.styles,
3361
- qe`
3505
+ }, Se = new WeakMap(), Ce = new WeakMap(), Pe = new WeakMap(), _e = new WeakMap(), ke = new WeakMap(), Xe);
3506
+ ii(P, "styles", [
3507
+ ...y.styles,
3508
+ ts`
3362
3509
  /* Text sits in a sentence; an avatar is a box the host sizes. */
3363
3510
  :host {
3364
3511
  display: inline;
@@ -3398,38 +3545,38 @@ Hs(S, "styles", [
3398
3545
  }
3399
3546
  `
3400
3547
  ]);
3401
- O([
3548
+ x([
3402
3549
  p()
3403
- ], S.prototype, "path", 1);
3404
- O([
3550
+ ], P.prototype, "path", 1);
3551
+ x([
3405
3552
  p()
3406
- ], S.prototype, "fallback", 1);
3407
- O([
3553
+ ], P.prototype, "fallback", 1);
3554
+ x([
3408
3555
  p({ type: Boolean, reflect: !0 })
3409
- ], S.prototype, "avatar", 1);
3410
- O([
3556
+ ], P.prototype, "avatar", 1);
3557
+ x([
3411
3558
  p()
3412
- ], S.prototype, "alt", 1);
3413
- O([
3559
+ ], P.prototype, "alt", 1);
3560
+ x([
3414
3561
  m()
3415
- ], S.prototype, "imageFailed", 1);
3416
- S = O([
3417
- we("singlebase-authui-display")
3418
- ], S);
3562
+ ], P.prototype, "imageFailed", 1);
3563
+ P = x([
3564
+ Te("singlebase-authui-display")
3565
+ ], P);
3419
3566
  export {
3420
- fs as A,
3421
- Ce as S,
3422
- f as a,
3423
- E as b,
3424
- S as c,
3425
- T as d,
3567
+ Ts as A,
3568
+ De as S,
3569
+ v as a,
3570
+ S as b,
3571
+ P as c,
3572
+ F as d,
3426
3573
  u as e,
3427
- Me as f,
3428
- Ve as g,
3429
- Ie as h,
3430
- Ge as i,
3431
- Is as j,
3432
- Fe as k,
3433
- vs as r
3574
+ Ve as f,
3575
+ rs as g,
3576
+ We as h,
3577
+ ns as i,
3578
+ Zs as j,
3579
+ Ye as k,
3580
+ Os as r
3434
3581
  };
3435
- //# sourceMappingURL=authui-display-BM_F3-5e.js.map
3582
+ //# sourceMappingURL=authui-display-CRUABt43.js.map