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