@nice2dev/auth 1.1.9 → 1.2.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.
package/dist/index.mjs CHANGED
@@ -1,136 +1,136 @@
1
- import { useState as _, useCallback as w, forwardRef as B, useMemo as X, useRef as U, useImperativeHandle as ae, useEffect as W } from "react";
2
- import { jsxs as a, jsx as e, Fragment as ie } from "react/jsx-runtime";
3
- function ye(c = {}) {
4
- const { onLogin: t, onRefresh: i, onLogout: n, storageKey: r = "nice_auth", persistAuth: l = !1 } = c, [o, p] = _(() => {
5
- if (l && typeof window < "u")
1
+ import { useState as g, useCallback as $, forwardRef as j, useMemo as ne, useRef as H, useEffect as Q, useImperativeHandle as oe } from "react";
2
+ import { jsxs as a, jsx as e, Fragment as ae } from "react/jsx-runtime";
3
+ function Re(r = {}) {
4
+ const { onLogin: t, onRefresh: c, onLogout: n, storageKey: i = "nice_auth", persistAuth: h = !1 } = r, [l, s] = g(() => {
5
+ if (h && typeof window < "u")
6
6
  try {
7
- const h = localStorage.getItem(r);
8
- if (h)
9
- return { ...JSON.parse(h), loading: !1, error: null };
7
+ const o = localStorage.getItem(i);
8
+ if (o)
9
+ return { ...JSON.parse(o), loading: !1, error: null };
10
10
  } catch {
11
11
  }
12
12
  return { isAuthenticated: !1, user: null, tokens: null, loading: !1, error: null };
13
- }), d = w(
14
- (h) => {
15
- p((m) => {
16
- const f = { ...m, ...h };
17
- return l && typeof window < "u" && (f.isAuthenticated ? localStorage.setItem(
18
- r,
13
+ }), u = $(
14
+ (o) => {
15
+ s((p) => {
16
+ const f = { ...p, ...o };
17
+ return h && typeof window < "u" && (f.isAuthenticated ? localStorage.setItem(
18
+ i,
19
19
  JSON.stringify({ isAuthenticated: !0, user: f.user })
20
- ) : localStorage.removeItem(r)), f;
20
+ ) : localStorage.removeItem(i)), f;
21
21
  });
22
22
  },
23
- [l, r]
24
- ), $ = w(
25
- async (h, m) => {
26
- d({ loading: !0, error: null });
23
+ [h, i]
24
+ ), S = $(
25
+ async (o, p) => {
26
+ u({ loading: !0, error: null });
27
27
  try {
28
28
  if (t) {
29
- const f = await t(h, m);
30
- return d({
29
+ const f = await t(o, p);
30
+ return u({
31
31
  isAuthenticated: !0,
32
32
  user: f.user,
33
33
  tokens: f.tokens,
34
34
  loading: !1
35
35
  }), !0;
36
36
  }
37
- return d({ loading: !1, error: "No login handler configured" }), !1;
37
+ return u({ loading: !1, error: "No login handler configured" }), !1;
38
38
  } catch (f) {
39
- return d({
39
+ return u({
40
40
  loading: !1,
41
41
  error: (f == null ? void 0 : f.message) ?? "Login failed"
42
42
  }), !1;
43
43
  }
44
44
  },
45
- [t, d]
46
- ), s = w(() => {
47
- n == null || n(), d({ isAuthenticated: !1, user: null, tokens: null, loading: !1, error: null });
48
- }, [n, d]), C = w(async () => {
49
- var h;
50
- if (!((h = o.tokens) != null && h.refreshToken) || !i)
45
+ [t, u]
46
+ ), d = $(() => {
47
+ n == null || n(), u({ isAuthenticated: !1, user: null, tokens: null, loading: !1, error: null });
48
+ }, [n, u]), A = $(async () => {
49
+ var o;
50
+ if (!((o = l.tokens) != null && o.refreshToken) || !c)
51
51
  return !1;
52
52
  try {
53
- const m = await i(o.tokens.refreshToken);
54
- return d({ tokens: m }), !0;
53
+ const p = await c(l.tokens.refreshToken);
54
+ return u({ tokens: p }), !0;
55
55
  } catch {
56
- return s(), !1;
56
+ return d(), !1;
57
57
  }
58
- }, [o.tokens, i, d, s]), b = w(
59
- (h, m) => {
60
- d({ isAuthenticated: !0, user: h, tokens: m, loading: !1, error: null });
58
+ }, [l.tokens, c, u, d]), b = $(
59
+ (o, p) => {
60
+ u({ isAuthenticated: !0, user: o, tokens: p, loading: !1, error: null });
61
61
  },
62
- [d]
63
- ), x = w(
64
- (...h) => o.user ? h.every((m) => o.user.roles.includes(m)) : !1,
65
- [o.user]
66
- ), g = w(
67
- (...h) => o.user ? h.every((m) => o.user.permissions.includes(m)) : !1,
68
- [o.user]
69
- ), F = w(() => {
70
- d({ error: null });
71
- }, [d]);
62
+ [u]
63
+ ), k = $(
64
+ (...o) => l.user ? o.every((p) => l.user.roles.includes(p)) : !1,
65
+ [l.user]
66
+ ), _ = $(
67
+ (...o) => l.user ? o.every((p) => l.user.permissions.includes(p)) : !1,
68
+ [l.user]
69
+ ), F = $(() => {
70
+ u({ error: null });
71
+ }, [u]);
72
72
  return {
73
- ...o,
74
- login: $,
75
- logout: s,
76
- refreshToken: C,
73
+ ...l,
74
+ login: S,
75
+ logout: d,
76
+ refreshToken: A,
77
77
  setAuth: b,
78
- hasRoles: x,
79
- hasPermissions: g,
78
+ hasRoles: k,
79
+ hasPermissions: _,
80
80
  clearError: F
81
81
  };
82
82
  }
83
- const ce = B(
83
+ const de = j(
84
84
  ({
85
- onSubmit: c,
85
+ onSubmit: r,
86
86
  loading: t = !1,
87
- error: i,
87
+ error: c,
88
88
  showRememberMe: n = !0,
89
- showForgotPassword: r = !0,
90
- onForgotPassword: l,
91
- showRegisterLink: o = !0,
92
- onRegisterClick: p,
93
- title: d = "Sign In",
94
- submitLabel: $ = "Sign In",
95
- logo: s,
96
- footer: C,
89
+ showForgotPassword: i = !0,
90
+ onForgotPassword: h,
91
+ showRegisterLink: l = !0,
92
+ onRegisterClick: s,
93
+ title: u = "Sign In",
94
+ submitLabel: S = "Sign In",
95
+ logo: d,
96
+ footer: A,
97
97
  className: b,
98
- style: x,
99
- emailLabel: g = "Email",
98
+ style: k,
99
+ emailLabel: _ = "Email",
100
100
  passwordLabel: F = "Password",
101
- tracelessPolicy: h,
102
- privacyMessage: m
101
+ tracelessPolicy: o,
102
+ privacyMessage: p
103
103
  }, f) => {
104
- const [T, N] = _(""), [P, S] = _(""), [E, k] = _(!1), D = X(() => !(!n || h && !h.cookiesAllowed), [n, h]), O = w(
105
- (A) => {
106
- A.preventDefault();
107
- const M = (h == null ? void 0 : h.cookiesAllowed) === !1 ? !1 : E;
108
- c == null || c({ email: T, password: P, rememberMe: M });
104
+ const [M, w] = g(""), [C, T] = g(""), [E, N] = g(!1), I = ne(() => !(!n || o && !o.cookiesAllowed), [n, o]), L = $(
105
+ (x) => {
106
+ x.preventDefault();
107
+ const D = (o == null ? void 0 : o.cookiesAllowed) === !1 ? !1 : E;
108
+ r == null || r({ email: M, password: C, rememberMe: D });
109
109
  },
110
- [T, P, E, c, h]
110
+ [M, C, E, r, o]
111
111
  );
112
112
  return /* @__PURE__ */ a(
113
113
  "form",
114
114
  {
115
115
  ref: f,
116
116
  className: `nice-login-form${b ? ` ${b}` : ""}`,
117
- style: x,
118
- onSubmit: O,
117
+ style: k,
118
+ onSubmit: L,
119
119
  noValidate: !0,
120
120
  children: [
121
- s && /* @__PURE__ */ e("div", { className: "nice-login-form__logo", children: s }),
122
- /* @__PURE__ */ e("h2", { className: "nice-login-form__title", children: d }),
123
- i && /* @__PURE__ */ e("div", { className: "nice-login-form__error", role: "alert", children: i }),
121
+ d && /* @__PURE__ */ e("div", { className: "nice-login-form__logo", children: d }),
122
+ /* @__PURE__ */ e("h2", { className: "nice-login-form__title", children: u }),
123
+ c && /* @__PURE__ */ e("div", { className: "nice-login-form__error", role: "alert", children: c }),
124
124
  /* @__PURE__ */ a("div", { className: "nice-login-form__field", children: [
125
- /* @__PURE__ */ e("label", { htmlFor: "nice-login-email", children: g }),
125
+ /* @__PURE__ */ e("label", { htmlFor: "nice-login-email", children: _ }),
126
126
  /* @__PURE__ */ e(
127
127
  "input",
128
128
  {
129
129
  id: "nice-login-email",
130
130
  className: "nice-input",
131
131
  type: "email",
132
- value: T,
133
- onChange: (A) => N(A.target.value),
132
+ value: M,
133
+ onChange: (x) => w(x.target.value),
134
134
  autoComplete: "email",
135
135
  required: !0,
136
136
  disabled: t
@@ -145,8 +145,8 @@ const ce = B(
145
145
  id: "nice-login-password",
146
146
  className: "nice-input",
147
147
  type: "password",
148
- value: P,
149
- onChange: (A) => S(A.target.value),
148
+ value: C,
149
+ onChange: (x) => T(x.target.value),
150
150
  autoComplete: "current-password",
151
151
  required: !0,
152
152
  disabled: t
@@ -154,25 +154,25 @@ const ce = B(
154
154
  )
155
155
  ] }),
156
156
  /* @__PURE__ */ a("div", { className: "nice-login-form__options", children: [
157
- D && /* @__PURE__ */ a("label", { className: "nice-login-form__remember", children: [
157
+ I && /* @__PURE__ */ a("label", { className: "nice-login-form__remember", children: [
158
158
  /* @__PURE__ */ e(
159
159
  "input",
160
160
  {
161
161
  type: "checkbox",
162
162
  checked: E,
163
- onChange: (A) => k(A.target.checked),
163
+ onChange: (x) => N(x.target.checked),
164
164
  disabled: t
165
165
  }
166
166
  ),
167
167
  /* @__PURE__ */ e("span", { children: "Remember me" })
168
168
  ] }),
169
- !D && n && m && /* @__PURE__ */ e("span", { className: "nice-login-form__privacy-notice", children: m }),
170
- r && /* @__PURE__ */ e(
169
+ !I && n && p && /* @__PURE__ */ e("span", { className: "nice-login-form__privacy-notice", children: p }),
170
+ i && /* @__PURE__ */ e(
171
171
  "button",
172
172
  {
173
173
  type: "button",
174
174
  className: "nice-login-form__forgot",
175
- onClick: l,
175
+ onClick: h,
176
176
  disabled: t,
177
177
  children: "Forgot password?"
178
178
  }
@@ -183,90 +183,90 @@ const ce = B(
183
183
  {
184
184
  type: "submit",
185
185
  className: "nice-btn nice-btn--primary nice-login-form__submit",
186
- disabled: t || !T || !P,
187
- children: t ? "…" : $
186
+ disabled: t || !M || !C,
187
+ children: t ? "…" : S
188
188
  }
189
189
  ),
190
- o && /* @__PURE__ */ a("div", { className: "nice-login-form__register", children: [
190
+ l && /* @__PURE__ */ a("div", { className: "nice-login-form__register", children: [
191
191
  /* @__PURE__ */ e("span", { children: "Don't have an account? " }),
192
- /* @__PURE__ */ e("button", { type: "button", onClick: p, disabled: t, children: "Register" })
192
+ /* @__PURE__ */ e("button", { type: "button", onClick: s, disabled: t, children: "Register" })
193
193
  ] }),
194
- C && /* @__PURE__ */ e("div", { className: "nice-login-form__footer", children: C })
194
+ A && /* @__PURE__ */ e("div", { className: "nice-login-form__footer", children: A })
195
195
  ]
196
196
  }
197
197
  );
198
198
  }
199
199
  );
200
- ce.displayName = "NiceLoginForm";
201
- const re = {
200
+ de.displayName = "NiceLoginForm";
201
+ const he = {
202
202
  0: "Very weak",
203
203
  1: "Weak",
204
204
  2: "Fair",
205
205
  3: "Strong",
206
206
  4: "Very strong"
207
- }, se = {
207
+ }, ue = {
208
208
  0: "#d9534f",
209
209
  1: "#f0ad4e",
210
210
  2: "#5bc0de",
211
211
  3: "#5cb85c",
212
212
  4: "#2e7d32"
213
213
  };
214
- function J(c) {
215
- if (!c)
214
+ function Y(r) {
215
+ if (!r)
216
216
  return 0;
217
217
  let t = 0;
218
- return c.length >= 8 && t++, c.length >= 12 && t++, /[a-z]/.test(c) && /[A-Z]/.test(c) && t++, /\d/.test(c) && t++, /[^a-zA-Z0-9]/.test(c) && t++, Math.min(4, t);
218
+ return r.length >= 8 && t++, r.length >= 12 && t++, /[a-z]/.test(r) && /[A-Z]/.test(r) && t++, /\d/.test(r) && t++, /[^a-zA-Z0-9]/.test(r) && t++, Math.min(4, t);
219
219
  }
220
- const Z = B(
221
- ({ password: c, strength: t, showLabel: i = !0, labels: n = re, className: r }, l) => {
222
- const o = t ?? J(c), p = se[o], d = (o + 1) / 5 * 100;
223
- return /* @__PURE__ */ a("div", { ref: l, className: `nice-password-strength${r ? ` ${r}` : ""}`, children: [
220
+ const Z = j(
221
+ ({ password: r, strength: t, showLabel: c = !0, labels: n = he, className: i }, h) => {
222
+ const l = t ?? Y(r), s = ue[l], u = (l + 1) / 5 * 100;
223
+ return /* @__PURE__ */ a("div", { ref: h, className: `nice-password-strength${i ? ` ${i}` : ""}`, children: [
224
224
  /* @__PURE__ */ e("div", { className: "nice-password-strength__bar", children: /* @__PURE__ */ e(
225
225
  "div",
226
226
  {
227
227
  className: "nice-password-strength__fill",
228
- style: { width: `${d}%`, backgroundColor: p }
228
+ style: { width: `${u}%`, backgroundColor: s }
229
229
  }
230
230
  ) }),
231
- i && /* @__PURE__ */ e("span", { className: "nice-password-strength__label", style: { color: p }, children: n[o] })
231
+ c && /* @__PURE__ */ e("span", { className: "nice-password-strength__label", style: { color: s }, children: n[l] })
232
232
  ] });
233
233
  }
234
234
  );
235
235
  Z.displayName = "NicePasswordStrength";
236
- const le = B(
236
+ const me = j(
237
237
  ({
238
- onSubmit: c,
238
+ onSubmit: r,
239
239
  loading: t = !1,
240
- error: i,
240
+ error: c,
241
241
  onLoginClick: n,
242
- showPasswordStrength: r = !0,
243
- minPasswordStrength: l = 2,
244
- termsUrl: o,
245
- privacyUrl: p,
246
- title: d = "Create Account",
247
- logo: $,
248
- footer: s,
249
- className: C,
242
+ showPasswordStrength: i = !0,
243
+ minPasswordStrength: h = 2,
244
+ termsUrl: l,
245
+ privacyUrl: s,
246
+ title: u = "Create Account",
247
+ logo: S,
248
+ footer: d,
249
+ className: A,
250
250
  style: b
251
- }, x) => {
252
- const [g, F] = _(""), [h, m] = _(""), [f, T] = _(""), [N, P] = _(""), [S, E] = _(""), [k, D] = _(!1), O = J(N), A = N === S, M = g && f && N && A && k && O >= l && !t, u = w(
251
+ }, k) => {
252
+ const [_, F] = g(""), [o, p] = g(""), [f, M] = g(""), [w, C] = g(""), [T, E] = g(""), [N, I] = g(!1), L = Y(w), x = w === T, D = _ && f && w && x && N && L >= h && !t, m = $(
253
253
  (v) => {
254
- v.preventDefault(), M && (c == null || c({ firstName: g, lastName: h, email: f, password: N, acceptTerms: k }));
254
+ v.preventDefault(), D && (r == null || r({ firstName: _, lastName: o, email: f, password: w, acceptTerms: N }));
255
255
  },
256
- [M, g, h, f, N, k, c]
256
+ [D, _, o, f, w, N, r]
257
257
  );
258
258
  return /* @__PURE__ */ a(
259
259
  "form",
260
260
  {
261
- ref: x,
262
- className: `nice-register-form${C ? ` ${C}` : ""}`,
261
+ ref: k,
262
+ className: `nice-register-form${A ? ` ${A}` : ""}`,
263
263
  style: b,
264
- onSubmit: u,
264
+ onSubmit: m,
265
265
  noValidate: !0,
266
266
  children: [
267
- $ && /* @__PURE__ */ e("div", { className: "nice-register-form__logo", children: $ }),
268
- /* @__PURE__ */ e("h2", { className: "nice-register-form__title", children: d }),
269
- i && /* @__PURE__ */ e("div", { className: "nice-register-form__error", role: "alert", children: i }),
267
+ S && /* @__PURE__ */ e("div", { className: "nice-register-form__logo", children: S }),
268
+ /* @__PURE__ */ e("h2", { className: "nice-register-form__title", children: u }),
269
+ c && /* @__PURE__ */ e("div", { className: "nice-register-form__error", role: "alert", children: c }),
270
270
  /* @__PURE__ */ a("div", { className: "nice-register-form__row", children: [
271
271
  /* @__PURE__ */ a("div", { className: "nice-register-form__field", children: [
272
272
  /* @__PURE__ */ e("label", { htmlFor: "nice-reg-first", children: "First name *" }),
@@ -276,7 +276,7 @@ const le = B(
276
276
  id: "nice-reg-first",
277
277
  className: "nice-input",
278
278
  type: "text",
279
- value: g,
279
+ value: _,
280
280
  onChange: (v) => F(v.target.value),
281
281
  required: !0,
282
282
  disabled: t,
@@ -292,8 +292,8 @@ const le = B(
292
292
  id: "nice-reg-last",
293
293
  className: "nice-input",
294
294
  type: "text",
295
- value: h,
296
- onChange: (v) => m(v.target.value),
295
+ value: o,
296
+ onChange: (v) => p(v.target.value),
297
297
  disabled: t,
298
298
  autoComplete: "family-name"
299
299
  }
@@ -309,7 +309,7 @@ const le = B(
309
309
  className: "nice-input",
310
310
  type: "email",
311
311
  value: f,
312
- onChange: (v) => T(v.target.value),
312
+ onChange: (v) => M(v.target.value),
313
313
  required: !0,
314
314
  disabled: t,
315
315
  autoComplete: "email"
@@ -324,14 +324,14 @@ const le = B(
324
324
  id: "nice-reg-pass",
325
325
  className: "nice-input",
326
326
  type: "password",
327
- value: N,
328
- onChange: (v) => P(v.target.value),
327
+ value: w,
328
+ onChange: (v) => C(v.target.value),
329
329
  required: !0,
330
330
  disabled: t,
331
331
  autoComplete: "new-password"
332
332
  }
333
333
  ),
334
- r && N.length > 0 && /* @__PURE__ */ e(Z, { password: N })
334
+ i && w.length > 0 && /* @__PURE__ */ e(Z, { password: w })
335
335
  ] }),
336
336
  /* @__PURE__ */ a("div", { className: "nice-register-form__field", children: [
337
337
  /* @__PURE__ */ e("label", { htmlFor: "nice-reg-confirm", children: "Confirm password *" }),
@@ -341,34 +341,34 @@ const le = B(
341
341
  id: "nice-reg-confirm",
342
342
  className: "nice-input",
343
343
  type: "password",
344
- value: S,
344
+ value: T,
345
345
  onChange: (v) => E(v.target.value),
346
346
  required: !0,
347
347
  disabled: t,
348
348
  autoComplete: "new-password"
349
349
  }
350
350
  ),
351
- S && !A && /* @__PURE__ */ e("span", { className: "nice-error-text", children: "Passwords do not match" })
351
+ T && !x && /* @__PURE__ */ e("span", { className: "nice-error-text", children: "Passwords do not match" })
352
352
  ] }),
353
353
  /* @__PURE__ */ a("label", { className: "nice-register-form__terms", children: [
354
354
  /* @__PURE__ */ e(
355
355
  "input",
356
356
  {
357
357
  type: "checkbox",
358
- checked: k,
359
- onChange: (v) => D(v.target.checked),
358
+ checked: N,
359
+ onChange: (v) => I(v.target.checked),
360
360
  disabled: t
361
361
  }
362
362
  ),
363
363
  /* @__PURE__ */ a("span", { children: [
364
364
  "I accept the",
365
365
  " ",
366
- o ? /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", children: "Terms" }) : "Terms",
367
- p && /* @__PURE__ */ a(ie, { children: [
366
+ l ? /* @__PURE__ */ e("a", { href: l, target: "_blank", rel: "noopener noreferrer", children: "Terms" }) : "Terms",
367
+ s && /* @__PURE__ */ a(ae, { children: [
368
368
  " ",
369
369
  "and",
370
370
  " ",
371
- /* @__PURE__ */ e("a", { href: p, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })
371
+ /* @__PURE__ */ e("a", { href: s, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })
372
372
  ] }),
373
373
  " *"
374
374
  ] })
@@ -378,7 +378,7 @@ const le = B(
378
378
  {
379
379
  type: "submit",
380
380
  className: "nice-btn nice-btn--primary nice-register-form__submit",
381
- disabled: !M,
381
+ disabled: !D,
382
382
  children: t ? "…" : "Register"
383
383
  }
384
384
  ),
@@ -386,47 +386,252 @@ const le = B(
386
386
  /* @__PURE__ */ e("span", { children: "Already have an account? " }),
387
387
  /* @__PURE__ */ e("button", { type: "button", onClick: n, children: "Sign in" })
388
388
  ] }),
389
- s && /* @__PURE__ */ e("div", { className: "nice-register-form__footer", children: s })
389
+ d && /* @__PURE__ */ e("div", { className: "nice-register-form__footer", children: d })
390
390
  ]
391
391
  }
392
392
  );
393
393
  }
394
394
  );
395
- le.displayName = "NiceRegistrationForm";
396
- const oe = B(
395
+ me.displayName = "NiceRegistrationForm";
396
+ const pe = ({ style: r }) => /* @__PURE__ */ e(
397
+ "span",
398
+ {
399
+ "aria-hidden": "true",
400
+ style: {
401
+ display: "inline-block",
402
+ width: "0.3em",
403
+ height: "0.6em",
404
+ margin: "0 0.35em 0.15em 0.1em",
405
+ borderRight: "0.12em solid currentColor",
406
+ borderBottom: "0.12em solid currentColor",
407
+ transform: "rotate(45deg)",
408
+ ...r
409
+ }
410
+ }
411
+ ), re = ({ style: r }) => /* @__PURE__ */ e(
412
+ "span",
413
+ {
414
+ "aria-hidden": "true",
415
+ style: {
416
+ display: "inline-block",
417
+ width: "0.85em",
418
+ height: "0.85em",
419
+ borderRadius: "50%",
420
+ border: "0.12em solid currentColor",
421
+ borderTopColor: "transparent",
422
+ transform: "rotate(-45deg)",
423
+ ...r
424
+ }
425
+ }
426
+ ), ee = {
427
+ lowercase: "abcdefghijklmnopqrstuvwxyz",
428
+ uppercase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
429
+ digits: "0123456789",
430
+ symbols: "!@#$%^&*()-_=+[]{};:,.?/~"
431
+ }, fe = /[0Oo1lI|]/g, W = {
432
+ length: 16,
433
+ lowercase: !0,
434
+ uppercase: !0,
435
+ digits: !0,
436
+ symbols: !0,
437
+ excludeAmbiguous: !1
438
+ }, ge = {
439
+ password: "Generated password",
440
+ length: "Length",
441
+ lowercase: "Lowercase (a–z)",
442
+ uppercase: "Uppercase (A–Z)",
443
+ digits: "Digits (0–9)",
444
+ symbols: "Symbols (!@#…)",
445
+ excludeAmbiguous: "Avoid look-alikes (0 O 1 l I)",
446
+ generate: "Generate",
447
+ copy: "Copy",
448
+ copied: "Copied",
449
+ noCharacterSets: "Pick at least one kind of character."
450
+ }, be = (r) => {
451
+ const t = globalThis.crypto;
452
+ if (!t || typeof t.getRandomValues != "function")
453
+ throw new Error("generatePassword: crypto.getRandomValues is not available");
454
+ return t.getRandomValues(r);
455
+ };
456
+ let _e = 0;
457
+ function X(r, t) {
458
+ const c = Math.floor(4294967296 / r) * r, n = new Uint32Array(1);
459
+ for (; ; ) {
460
+ const i = t(n)[0];
461
+ if (i < c)
462
+ return i % r;
463
+ }
464
+ }
465
+ function te(r = {}, t = be) {
466
+ const c = { ...W, ...r }, n = ["lowercase", "uppercase", "digits", "symbols"].filter((s) => c[s]).map((s) => c.excludeAmbiguous ? ee[s].replace(fe, "") : ee[s]).filter((s) => s.length > 0);
467
+ if (n.length === 0)
468
+ return "";
469
+ const i = Math.max(n.length, Math.min(1024, Math.floor(c.length))), h = n.join(""), l = n.map((s) => s[X(s.length, t)]);
470
+ for (; l.length < i; )
471
+ l.push(h[X(h.length, t)]);
472
+ for (let s = l.length - 1; s > 0; s--) {
473
+ const u = X(s + 1, t);
474
+ [l[s], l[u]] = [l[u], l[s]];
475
+ }
476
+ return l.join("");
477
+ }
478
+ const Fe = ({
479
+ value: r,
480
+ defaultValue: t = "",
481
+ onChange: c,
482
+ options: n,
483
+ defaultOptions: i,
484
+ onOptionsChange: h,
485
+ minLength: l = 8,
486
+ maxLength: s = 64,
487
+ showStrength: u = !0,
488
+ showCopy: S = !0,
489
+ onCopy: d,
490
+ labels: A,
491
+ disabled: b = !1,
492
+ className: k,
493
+ style: _,
494
+ id: F
495
+ }) => {
496
+ const o = { ...ge, ...A }, [p] = g(() => `nice-password-generator-${++_e}`), f = F ?? p, [M, w] = g(() => ({
497
+ ...W,
498
+ ...i
499
+ })), C = n ? { ...W, ...n } : M, [T, E] = g(
500
+ () => r === void 0 && !t ? te({ ...W, ...i, ...n }) : t
501
+ ), N = r ?? T, [I, L] = g(!1), x = H(void 0);
502
+ Q(() => () => clearTimeout(x.current), []);
503
+ const D = $(
504
+ (P) => {
505
+ r === void 0 && E(P), L(!1), c == null || c(P);
506
+ },
507
+ [r, c]
508
+ ), m = $(
509
+ (P) => D(te(P)),
510
+ [D]
511
+ ), v = (P, O) => {
512
+ const q = { ...C, [P]: O };
513
+ n || w(q), h == null || h(q), m(q);
514
+ }, z = async () => {
515
+ !N || !navigator.clipboard || (await navigator.clipboard.writeText(N), L(!0), clearTimeout(x.current), x.current = setTimeout(() => L(!1), 1500), d == null || d(N));
516
+ }, R = !C.lowercase && !C.uppercase && !C.digits && !C.symbols, U = Math.min(s, Math.max(l, C.length));
517
+ return /* @__PURE__ */ a(
518
+ "div",
519
+ {
520
+ id: F,
521
+ className: `nice-password-generator${k ? ` ${k}` : ""}`,
522
+ style: _,
523
+ children: [
524
+ /* @__PURE__ */ a("div", { className: "nice-password-generator__output", children: [
525
+ /* @__PURE__ */ e(
526
+ "input",
527
+ {
528
+ id: `${f}-value`,
529
+ className: "nice-password-generator__value",
530
+ type: "text",
531
+ readOnly: !0,
532
+ spellCheck: !1,
533
+ autoComplete: "off",
534
+ value: N,
535
+ "aria-label": o.password
536
+ }
537
+ ),
538
+ /* @__PURE__ */ e(
539
+ "button",
540
+ {
541
+ type: "button",
542
+ className: "nice-password-generator__button",
543
+ onClick: () => m(C),
544
+ disabled: b || R,
545
+ "aria-label": o.generate,
546
+ title: o.generate,
547
+ children: /* @__PURE__ */ e(re, {})
548
+ }
549
+ ),
550
+ S && /* @__PURE__ */ e(
551
+ "button",
552
+ {
553
+ type: "button",
554
+ className: "nice-password-generator__button nice-password-generator__button--copy",
555
+ onClick: z,
556
+ disabled: b || !N,
557
+ "aria-live": "polite",
558
+ children: I ? /* @__PURE__ */ a(ae, { children: [
559
+ /* @__PURE__ */ e(pe, {}),
560
+ " ",
561
+ o.copied
562
+ ] }) : o.copy
563
+ }
564
+ )
565
+ ] }),
566
+ u && /* @__PURE__ */ e(Z, { password: N }),
567
+ /* @__PURE__ */ a("div", { className: "nice-password-generator__length", children: [
568
+ /* @__PURE__ */ e("label", { htmlFor: `${f}-length`, children: o.length }),
569
+ /* @__PURE__ */ e(
570
+ "input",
571
+ {
572
+ id: `${f}-length`,
573
+ type: "range",
574
+ min: l,
575
+ max: s,
576
+ value: U,
577
+ disabled: b,
578
+ onChange: (P) => v("length", Number(P.target.value))
579
+ }
580
+ ),
581
+ /* @__PURE__ */ e("output", { htmlFor: `${f}-length`, className: "nice-password-generator__length-value", children: U })
582
+ ] }),
583
+ /* @__PURE__ */ e("div", { className: "nice-password-generator__sets", children: ["lowercase", "uppercase", "digits", "symbols", "excludeAmbiguous"].map(
584
+ (P) => /* @__PURE__ */ a("label", { className: "nice-password-generator__option", children: [
585
+ /* @__PURE__ */ e(
586
+ "input",
587
+ {
588
+ type: "checkbox",
589
+ checked: C[P],
590
+ disabled: b,
591
+ onChange: (O) => v(P, O.target.checked)
592
+ }
593
+ ),
594
+ o[P]
595
+ ] }, P)
596
+ ) }),
597
+ R && /* @__PURE__ */ e("p", { className: "nice-password-generator__error", role: "alert", children: o.noCharacterSets })
598
+ ]
599
+ }
600
+ );
601
+ }, Ne = j(
397
602
  ({
398
- requireCurrentPassword: c = !0,
603
+ requireCurrentPassword: r = !0,
399
604
  onSubmit: t,
400
- loading: i = !1,
605
+ loading: c = !1,
401
606
  error: n,
402
- success: r,
403
- minPasswordStrength: l = 2,
404
- title: o = "Change Password",
405
- className: p,
406
- style: d
407
- }, $) => {
408
- const [s, C] = _(""), [b, x] = _(""), [g, F] = _(""), h = J(b), m = b === g, f = (!c || s.length > 0) && b.length > 0 && m && h >= l && !i, T = w(
409
- (N) => {
410
- N.preventDefault(), f && (t == null || t({
411
- currentPassword: c ? s : void 0,
607
+ success: i,
608
+ minPasswordStrength: h = 2,
609
+ title: l = "Change Password",
610
+ className: s,
611
+ style: u
612
+ }, S) => {
613
+ const [d, A] = g(""), [b, k] = g(""), [_, F] = g(""), o = Y(b), p = b === _, f = (!r || d.length > 0) && b.length > 0 && p && o >= h && !c, M = $(
614
+ (w) => {
615
+ w.preventDefault(), f && (t == null || t({
616
+ currentPassword: r ? d : void 0,
412
617
  newPassword: b
413
618
  }));
414
619
  },
415
- [f, s, b, c, t]
620
+ [f, d, b, r, t]
416
621
  );
417
622
  return /* @__PURE__ */ a(
418
623
  "form",
419
624
  {
420
- ref: $,
421
- className: `nice-change-password${p ? ` ${p}` : ""}`,
422
- style: d,
423
- onSubmit: T,
625
+ ref: S,
626
+ className: `nice-change-password${s ? ` ${s}` : ""}`,
627
+ style: u,
628
+ onSubmit: M,
424
629
  noValidate: !0,
425
630
  children: [
426
- /* @__PURE__ */ e("h3", { className: "nice-change-password__title", children: o }),
631
+ /* @__PURE__ */ e("h3", { className: "nice-change-password__title", children: l }),
427
632
  n && /* @__PURE__ */ e("div", { className: "nice-change-password__error", role: "alert", children: n }),
428
- r && /* @__PURE__ */ e("div", { className: "nice-change-password__success", role: "status", children: r }),
429
- c && /* @__PURE__ */ a("div", { className: "nice-change-password__field", children: [
633
+ i && /* @__PURE__ */ e("div", { className: "nice-change-password__success", role: "status", children: i }),
634
+ r && /* @__PURE__ */ a("div", { className: "nice-change-password__field", children: [
430
635
  /* @__PURE__ */ e("label", { htmlFor: "nice-cp-current", children: "Current password" }),
431
636
  /* @__PURE__ */ e(
432
637
  "input",
@@ -434,10 +639,10 @@ const oe = B(
434
639
  id: "nice-cp-current",
435
640
  className: "nice-input",
436
641
  type: "password",
437
- value: s,
438
- onChange: (N) => C(N.target.value),
642
+ value: d,
643
+ onChange: (w) => A(w.target.value),
439
644
  autoComplete: "current-password",
440
- disabled: i,
645
+ disabled: c,
441
646
  required: !0
442
647
  }
443
648
  )
@@ -451,9 +656,9 @@ const oe = B(
451
656
  className: "nice-input",
452
657
  type: "password",
453
658
  value: b,
454
- onChange: (N) => x(N.target.value),
659
+ onChange: (w) => k(w.target.value),
455
660
  autoComplete: "new-password",
456
- disabled: i,
661
+ disabled: c,
457
662
  required: !0
458
663
  }
459
664
  ),
@@ -467,69 +672,69 @@ const oe = B(
467
672
  id: "nice-cp-confirm",
468
673
  className: "nice-input",
469
674
  type: "password",
470
- value: g,
471
- onChange: (N) => F(N.target.value),
675
+ value: _,
676
+ onChange: (w) => F(w.target.value),
472
677
  autoComplete: "new-password",
473
- disabled: i,
678
+ disabled: c,
474
679
  required: !0
475
680
  }
476
681
  ),
477
- g && !m && /* @__PURE__ */ e("span", { className: "nice-error-text", children: "Passwords do not match" })
682
+ _ && !p && /* @__PURE__ */ e("span", { className: "nice-error-text", children: "Passwords do not match" })
478
683
  ] }),
479
- /* @__PURE__ */ e("button", { type: "submit", className: "nice-btn nice-btn--primary", disabled: !f, children: i ? "…" : "Change Password" })
684
+ /* @__PURE__ */ e("button", { type: "submit", className: "nice-btn nice-btn--primary", disabled: !f, children: c ? "…" : "Change Password" })
480
685
  ]
481
686
  }
482
687
  );
483
688
  }
484
689
  );
485
- oe.displayName = "NiceChangePassword";
486
- const de = B(
690
+ Ne.displayName = "NiceChangePassword";
691
+ const we = j(
487
692
  ({
488
- secret: c,
693
+ secret: r,
489
694
  qrCodeUrl: t,
490
- issuer: i,
695
+ issuer: c,
491
696
  accountName: n,
492
- onVerify: r,
493
- loading: l = !1,
494
- error: o,
495
- onCancel: p,
496
- recoveryCodes: d,
497
- step: $ = "setup",
498
- onStepChange: s,
499
- className: C,
697
+ onVerify: i,
698
+ loading: h = !1,
699
+ error: l,
700
+ onCancel: s,
701
+ recoveryCodes: u,
702
+ step: S = "setup",
703
+ onStepChange: d,
704
+ className: A,
500
705
  style: b
501
- }, x) => {
502
- const [g, F] = _(""), [h, m] = _(!1), [f, T] = _(!1), N = w(
503
- (S) => {
504
- S.preventDefault(), g.length >= 6 && (r == null || r(g));
706
+ }, k) => {
707
+ const [_, F] = g(""), [o, p] = g(!1), [f, M] = g(!1), w = $(
708
+ (T) => {
709
+ T.preventDefault(), _.length >= 6 && (i == null || i(_));
505
710
  },
506
- [g, r]
507
- ), P = `otpauth://totp/${i ? `${i}:` : ""}${n ?? "user"}?secret=${c}${i ? `&issuer=${i}` : ""}&digits=6&period=30`;
508
- return /* @__PURE__ */ a("div", { ref: x, className: `nice-2fa-setup${C ? ` ${C}` : ""}`, style: b, children: [
711
+ [_, i]
712
+ ), C = `otpauth://totp/${c ? `${c}:` : ""}${n ?? "user"}?secret=${r}${c ? `&issuer=${c}` : ""}&digits=6&period=30`;
713
+ return /* @__PURE__ */ a("div", { ref: k, className: `nice-2fa-setup${A ? ` ${A}` : ""}`, style: b, children: [
509
714
  /* @__PURE__ */ e("h3", { className: "nice-2fa-setup__title", children: "Two-Factor Authentication" }),
510
- $ === "setup" && /* @__PURE__ */ a("div", { className: "nice-2fa-setup__step", children: [
715
+ S === "setup" && /* @__PURE__ */ a("div", { className: "nice-2fa-setup__step", children: [
511
716
  /* @__PURE__ */ e("p", { className: "nice-2fa-setup__instruction", children: "Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.):" }),
512
717
  t ? /* @__PURE__ */ e("img", { src: t, alt: "2FA QR Code", className: "nice-2fa-setup__qr" }) : /* @__PURE__ */ a("div", { className: "nice-2fa-setup__qr-placeholder", children: [
513
718
  /* @__PURE__ */ e("span", { children: "QR Code" }),
514
- /* @__PURE__ */ e("code", { className: "nice-2fa-setup__uri", children: P })
719
+ /* @__PURE__ */ e("code", { className: "nice-2fa-setup__uri", children: C })
515
720
  ] }),
516
721
  /* @__PURE__ */ a("div", { className: "nice-2fa-setup__secret", children: [
517
722
  /* @__PURE__ */ e("span", { children: "Or enter manually: " }),
518
- h ? /* @__PURE__ */ e("code", { className: "nice-2fa-setup__secret-key", children: c }) : /* @__PURE__ */ e("button", { type: "button", onClick: () => m(!0), children: "Show secret key" })
723
+ o ? /* @__PURE__ */ e("code", { className: "nice-2fa-setup__secret-key", children: r }) : /* @__PURE__ */ e("button", { type: "button", onClick: () => p(!0), children: "Show secret key" })
519
724
  ] }),
520
725
  /* @__PURE__ */ e(
521
726
  "button",
522
727
  {
523
728
  type: "button",
524
729
  className: "nice-btn nice-btn--primary",
525
- onClick: () => s == null ? void 0 : s("verify"),
730
+ onClick: () => d == null ? void 0 : d("verify"),
526
731
  children: "Next — Verify"
527
732
  }
528
733
  )
529
734
  ] }),
530
- $ === "verify" && /* @__PURE__ */ a("form", { className: "nice-2fa-setup__step", onSubmit: N, children: [
735
+ S === "verify" && /* @__PURE__ */ a("form", { className: "nice-2fa-setup__step", onSubmit: w, children: [
531
736
  /* @__PURE__ */ e("p", { className: "nice-2fa-setup__instruction", children: "Enter the 6-digit code from your authenticator app:" }),
532
- o && /* @__PURE__ */ e("div", { className: "nice-2fa-setup__error", role: "alert", children: o }),
737
+ l && /* @__PURE__ */ e("div", { className: "nice-2fa-setup__error", role: "alert", children: l }),
533
738
  /* @__PURE__ */ e(
534
739
  "input",
535
740
  {
@@ -537,228 +742,213 @@ const de = B(
537
742
  type: "text",
538
743
  inputMode: "numeric",
539
744
  maxLength: 6,
540
- value: g,
541
- onChange: (S) => F(S.target.value.replace(/\D/g, "").slice(0, 6)),
745
+ value: _,
746
+ onChange: (T) => F(T.target.value.replace(/\D/g, "").slice(0, 6)),
542
747
  placeholder: "000000",
543
748
  autoFocus: !0,
544
- disabled: l,
749
+ disabled: h,
545
750
  autoComplete: "one-time-code"
546
751
  }
547
752
  ),
548
753
  /* @__PURE__ */ a("div", { className: "nice-2fa-setup__actions", children: [
549
- /* @__PURE__ */ e("button", { type: "button", className: "nice-btn", onClick: () => s == null ? void 0 : s("setup"), children: "Back" }),
754
+ /* @__PURE__ */ e("button", { type: "button", className: "nice-btn", onClick: () => d == null ? void 0 : d("setup"), children: "Back" }),
550
755
  /* @__PURE__ */ e(
551
756
  "button",
552
757
  {
553
758
  type: "submit",
554
759
  className: "nice-btn nice-btn--primary",
555
- disabled: l || g.length < 6,
556
- children: l ? "…" : "Verify"
760
+ disabled: h || _.length < 6,
761
+ children: h ? "…" : "Verify"
557
762
  }
558
763
  )
559
764
  ] })
560
765
  ] }),
561
- $ === "recovery" && d && /* @__PURE__ */ a("div", { className: "nice-2fa-setup__step", children: [
766
+ S === "recovery" && u && /* @__PURE__ */ a("div", { className: "nice-2fa-setup__step", children: [
562
767
  /* @__PURE__ */ e("p", { className: "nice-2fa-setup__instruction", children: "Save these recovery codes in a safe place. Each code can only be used once:" }),
563
- /* @__PURE__ */ e("div", { className: "nice-2fa-setup__recovery-codes", children: d.map((S, E) => /* @__PURE__ */ e("code", { className: "nice-2fa-setup__recovery-code", children: S }, E)) }),
768
+ /* @__PURE__ */ e("div", { className: "nice-2fa-setup__recovery-codes", children: u.map((T, E) => /* @__PURE__ */ e("code", { className: "nice-2fa-setup__recovery-code", children: T }, E)) }),
564
769
  /* @__PURE__ */ e(
565
770
  "button",
566
771
  {
567
772
  type: "button",
568
773
  className: "nice-btn",
569
774
  onClick: () => {
570
- var S;
571
- (S = navigator.clipboard) == null || S.writeText(d.join(`
572
- `)), T(!0);
775
+ var T;
776
+ (T = navigator.clipboard) == null || T.writeText(u.join(`
777
+ `)), M(!0);
573
778
  },
574
779
  children: f ? "Copied!" : "Copy all codes"
575
780
  }
576
781
  ),
577
- p && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: p, children: "Done" })
782
+ s && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: s, children: "Done" })
578
783
  ] }),
579
- p && $ !== "recovery" && /* @__PURE__ */ e("button", { type: "button", className: "nice-2fa-setup__cancel", onClick: p, children: "Cancel" })
784
+ s && S !== "recovery" && /* @__PURE__ */ e("button", { type: "button", className: "nice-2fa-setup__cancel", onClick: s, children: "Cancel" })
580
785
  ] });
581
786
  }
582
787
  );
583
- de.displayName = "NiceTwoFaSetup";
584
- const he = ({ style: c }) => /* @__PURE__ */ e(
585
- "span",
586
- {
587
- "aria-hidden": "true",
588
- style: {
589
- display: "inline-block",
590
- width: "0.85em",
591
- height: "0.85em",
592
- borderRadius: "50%",
593
- border: "0.12em solid currentColor",
594
- borderTopColor: "transparent",
595
- transform: "rotate(-45deg)",
596
- ...c
597
- }
598
- }
599
- ), ue = 500;
600
- function I(c, t) {
601
- return Math.floor(Math.random() * (t - c + 1)) + c;
788
+ we.displayName = "NiceTwoFaSetup";
789
+ const ve = 500;
790
+ function V(r, t) {
791
+ return Math.floor(Math.random() * (t - r + 1)) + r;
602
792
  }
603
- function me() {
793
+ function ye() {
604
794
  return `${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
605
795
  }
606
- function pe(c, t) {
607
- switch (c) {
796
+ function ke(r, t) {
797
+ switch (r) {
608
798
  case "math": {
609
- const i = t === "easy" ? 5 : t === "hard" ? 20 : 10, n = I(1, i), r = I(1, i), l = t !== "easy" && n >= r && Math.random() < 0.5, o = l ? n - r : n + r;
610
- return { kind: "math", prompt: `${n} ${l ? "−" : "+"} ${r}`, answer: o };
799
+ const c = t === "easy" ? 5 : t === "hard" ? 20 : 10, n = V(1, c), i = V(1, c), h = t !== "easy" && n >= i && Math.random() < 0.5, l = h ? n - i : n + i;
800
+ return { kind: "math", prompt: `${n} ${h ? "−" : "+"} ${i}`, answer: l };
611
801
  }
612
802
  case "text": {
613
- const i = t === "easy" ? 4 : t === "hard" ? 7 : 5, n = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
614
- let r = "";
615
- for (let l = 0; l < i; l++)
616
- r += n[I(0, n.length - 1)];
617
- return { kind: "text", text: r };
803
+ const c = t === "easy" ? 4 : t === "hard" ? 7 : 5, n = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
804
+ let i = "";
805
+ for (let h = 0; h < c; h++)
806
+ i += n[V(0, n.length - 1)];
807
+ return { kind: "text", text: i };
618
808
  }
619
809
  case "slider":
620
- return { kind: "slider", target: I(70, 92), tolerance: t === "easy" ? 8 : t === "hard" ? 2 : 4 };
810
+ return { kind: "slider", target: V(70, 92), tolerance: t === "easy" ? 8 : t === "hard" ? 2 : 4 };
621
811
  case "checkbox":
622
812
  default:
623
813
  return { kind: "checkbox" };
624
814
  }
625
815
  }
626
- function fe(c, t, i) {
627
- if (!c)
816
+ function Ce(r, t, c) {
817
+ if (!r)
628
818
  return;
629
- const n = c.getContext("2d");
819
+ const n = r.getContext("2d");
630
820
  if (!n)
631
821
  return;
632
- const r = c.width, l = c.height;
633
- n.clearRect(0, 0, r, l), n.fillStyle = i ? "#1a1a1a" : "#f3f4f6", n.fillRect(0, 0, r, l), n.strokeStyle = i ? "rgba(255,255,255,0.18)" : "rgba(0,0,0,0.18)", n.lineWidth = 1;
634
- for (let p = 0; p < 6; p++)
635
- n.beginPath(), n.moveTo(I(0, r), I(0, l)), n.lineTo(I(0, r), I(0, l)), n.stroke();
636
- n.fillStyle = i ? "#e5e7eb" : "#111827", n.textBaseline = "middle";
637
- const o = r / (t.length + 1);
638
- for (let p = 0; p < t.length; p++) {
639
- const d = I(22, 30);
640
- n.save(), n.translate(o * (p + 1), l / 2 + I(-4, 4)), n.rotate(I(-22, 22) * Math.PI / 180), n.font = `bold ${d}px monospace`, n.fillText(t[p], -d / 3, 0), n.restore();
822
+ const i = r.width, h = r.height;
823
+ n.clearRect(0, 0, i, h), n.fillStyle = c ? "#1a1a1a" : "#f3f4f6", n.fillRect(0, 0, i, h), n.strokeStyle = c ? "rgba(255,255,255,0.18)" : "rgba(0,0,0,0.18)", n.lineWidth = 1;
824
+ for (let s = 0; s < 6; s++)
825
+ n.beginPath(), n.moveTo(V(0, i), V(0, h)), n.lineTo(V(0, i), V(0, h)), n.stroke();
826
+ n.fillStyle = c ? "#e5e7eb" : "#111827", n.textBaseline = "middle";
827
+ const l = i / (t.length + 1);
828
+ for (let s = 0; s < t.length; s++) {
829
+ const u = V(22, 30);
830
+ n.save(), n.translate(l * (s + 1), h / 2 + V(-4, 4)), n.rotate(V(-22, 22) * Math.PI / 180), n.font = `bold ${u}px monospace`, n.fillText(t[s], -u / 3, 0), n.restore();
641
831
  }
642
832
  }
643
- const ge = B((c, t) => {
833
+ const xe = j((r, t) => {
644
834
  const {
645
- variant: i,
835
+ variant: c,
646
836
  difficulty: n = "medium",
647
- refreshable: r = !0,
648
- verifyToken: l,
649
- expiresMs: o,
650
- label: p = "I'm not a robot",
651
- provider: d = "custom",
652
- siteKey: $,
653
- onVerify: s,
654
- onExpire: C,
837
+ refreshable: i = !0,
838
+ verifyToken: h,
839
+ expiresMs: l,
840
+ label: s = "I'm not a robot",
841
+ provider: u = "custom",
842
+ siteKey: S,
843
+ onVerify: d,
844
+ onExpire: A,
655
845
  onError: b,
656
- onRefresh: x,
657
- theme: g = "light",
846
+ onRefresh: k,
847
+ theme: _ = "light",
658
848
  size: F = "normal",
659
- customRender: h,
660
- className: m,
849
+ customRender: o,
850
+ className: p,
661
851
  style: f
662
- } = c, T = U(null), N = U(null), P = U(void 0), [S, E] = _(0), [k, D] = _("idle"), [O, A] = _(""), [M, u] = _(""), [v, z] = _(0), R = X(
663
- () => pe(i ?? "checkbox", n),
664
- [i, n, S]
665
- ), K = w(() => {
666
- D("idle"), A(""), u(""), z(0), E((y) => y + 1);
667
- }, []), G = w(() => {
668
- K(), x == null || x();
669
- }, [K, x]);
670
- ae(
852
+ } = r, M = H(null), w = H(null), C = H(void 0), [T, E] = g(0), [N, I] = g("idle"), [L, x] = g(""), [D, m] = g(""), [v, z] = g(0), R = ne(
853
+ () => ke(c ?? "checkbox", n),
854
+ [c, n, T]
855
+ ), U = $(() => {
856
+ I("idle"), x(""), m(""), z(0), E((y) => y + 1);
857
+ }, []), P = $(() => {
858
+ U(), k == null || k();
859
+ }, [U, k]);
860
+ oe(
671
861
  t,
672
- () => ({ reset: K, refresh: G, container: T.current }),
673
- [K, G]
674
- ), W(() => {
675
- i === "text" && R.kind === "text" && fe(N.current, R.text, g === "dark");
676
- }, [i, R, g]), W(() => {
677
- if (k !== "verified" || !o)
862
+ () => ({ reset: U, refresh: P, container: M.current }),
863
+ [U, P]
864
+ ), Q(() => {
865
+ c === "text" && R.kind === "text" && Ce(w.current, R.text, _ === "dark");
866
+ }, [c, R, _]), Q(() => {
867
+ if (N !== "verified" || !l)
678
868
  return;
679
869
  const y = setTimeout(() => {
680
- C == null || C(), K();
681
- }, o);
870
+ A == null || A(), U();
871
+ }, l);
682
872
  return () => clearTimeout(y);
683
- }, [k, o, C, K]);
684
- const q = w(() => {
685
- const y = `ntd-cap:${i}:${me()}`;
686
- l ? (D("verifying"), A(""), Promise.resolve().then(() => l(y)).then((Q) => {
687
- Q ? (D("verified"), s == null || s(y)) : (D("error"), A("Verification failed. Please try again."), E((ne) => ne + 1), u(""));
688
- }).catch((Q) => {
689
- D("error"), A("Verification error. Please try again."), b == null || b(Q);
690
- })) : (D("verified"), s == null || s(y));
691
- }, [i, l, s, b]), H = w(() => {
692
- D("error"), A("Incorrect, please try again."), E((y) => y + 1), u("");
693
- }, []), Y = w(() => {
694
- k === "verifying" || k === "verified" || (D("verifying"), A(""), P.current = setTimeout(q, ue));
695
- }, [k, q]);
696
- W(() => () => clearTimeout(P.current), []);
697
- const j = w(() => {
698
- R.kind === "math" ? M.trim() !== "" && Number(M) === R.answer ? q() : H() : R.kind === "text" && (M.trim().toUpperCase() === R.text ? q() : H());
699
- }, [R, M, q, H]), ee = w(
873
+ }, [N, l, A, U]);
874
+ const O = $(() => {
875
+ const y = `ntd-cap:${c}:${ye()}`;
876
+ h ? (I("verifying"), x(""), Promise.resolve().then(() => h(y)).then((J) => {
877
+ J ? (I("verified"), d == null || d(y)) : (I("error"), x("Verification failed. Please try again."), E((le) => le + 1), m(""));
878
+ }).catch((J) => {
879
+ I("error"), x("Verification error. Please try again."), b == null || b(J);
880
+ })) : (I("verified"), d == null || d(y));
881
+ }, [c, h, d, b]), q = $(() => {
882
+ I("error"), x("Incorrect, please try again."), E((y) => y + 1), m("");
883
+ }, []), ce = $(() => {
884
+ N === "verifying" || N === "verified" || (I("verifying"), x(""), C.current = setTimeout(O, ve));
885
+ }, [N, O]);
886
+ Q(() => () => clearTimeout(C.current), []);
887
+ const K = $(() => {
888
+ R.kind === "math" ? D.trim() !== "" && Number(D) === R.answer ? O() : q() : R.kind === "text" && (D.trim().toUpperCase() === R.text ? O() : q());
889
+ }, [R, D, O, q]), se = $(
700
890
  (y) => {
701
- z(y), !(R.kind !== "slider" || k === "verified" || k === "verifying") && Math.abs(y - R.target) <= R.tolerance && q();
891
+ z(y), !(R.kind !== "slider" || N === "verified" || N === "verifying") && Math.abs(y - R.target) <= R.tolerance && O();
702
892
  },
703
- [R, k, q]
893
+ [R, N, O]
704
894
  );
705
- if (!i)
706
- return d === "custom" && h ? /* @__PURE__ */ e(
895
+ if (!c)
896
+ return u === "custom" && o ? /* @__PURE__ */ e(
707
897
  "div",
708
898
  {
709
- ref: T,
710
- className: `nice-captcha nice-captcha--custom${m ? ` ${m}` : ""}`,
899
+ ref: M,
900
+ className: `nice-captcha nice-captcha--custom${p ? ` ${p}` : ""}`,
711
901
  style: f,
712
- children: h
902
+ children: o
713
903
  }
714
904
  ) : /* @__PURE__ */ e(
715
905
  "div",
716
906
  {
717
- ref: T,
718
- className: `nice-captcha nice-captcha--${d} nice-captcha--${g}${F === "compact" ? " nice-captcha--compact" : ""}${m ? ` ${m}` : ""}`,
907
+ ref: M,
908
+ className: `nice-captcha nice-captcha--${u} nice-captcha--${_}${F === "compact" ? " nice-captcha--compact" : ""}${p ? ` ${p}` : ""}`,
719
909
  style: f,
720
- "data-sitekey": $,
721
- "data-theme": g,
910
+ "data-sitekey": S,
911
+ "data-theme": _,
722
912
  "data-size": F,
723
913
  children: /* @__PURE__ */ a("div", { className: "nice-captcha__placeholder", children: [
724
914
  /* @__PURE__ */ a("span", { children: [
725
915
  "Captcha (",
726
- d,
916
+ u,
727
917
  ")"
728
918
  ] }),
729
919
  /* @__PURE__ */ a("p", { children: [
730
920
  "Load the ",
731
- d,
921
+ u,
732
922
  " SDK to activate verification."
733
923
  ] })
734
924
  ] })
735
925
  }
736
926
  );
737
- const L = k === "verifying", V = k === "verified", te = `nice-captcha nice-captcha--${i} nice-captcha--${g} nice-captcha--${k}${F === "compact" ? " nice-captcha--compact" : ""}${m ? ` ${m}` : ""}`;
927
+ const B = N === "verifying", G = N === "verified", ie = `nice-captcha nice-captcha--${c} nice-captcha--${_} nice-captcha--${N}${F === "compact" ? " nice-captcha--compact" : ""}${p ? ` ${p}` : ""}`;
738
928
  return /* @__PURE__ */ a(
739
929
  "div",
740
930
  {
741
- ref: T,
742
- className: te,
931
+ ref: M,
932
+ className: ie,
743
933
  style: f,
744
934
  role: "group",
745
935
  "aria-label": "Captcha challenge",
746
- "data-variant": i,
747
- "data-status": k,
748
- "data-theme": g,
936
+ "data-variant": c,
937
+ "data-status": N,
938
+ "data-theme": _,
749
939
  children: [
750
- i === "checkbox" && /* @__PURE__ */ a(
940
+ c === "checkbox" && /* @__PURE__ */ a(
751
941
  "button",
752
942
  {
753
943
  type: "button",
754
944
  className: "nice-captcha__checkbox",
755
945
  role: "checkbox",
756
- "aria-checked": V,
757
- "aria-busy": L,
758
- disabled: L || V,
759
- onClick: Y,
946
+ "aria-checked": G,
947
+ "aria-busy": B,
948
+ disabled: B || G,
949
+ onClick: ce,
760
950
  children: [
761
- /* @__PURE__ */ e("span", { className: "nice-captcha__box", "aria-hidden": "true", children: L ? "…" : V ? /* @__PURE__ */ e(
951
+ /* @__PURE__ */ e("span", { className: "nice-captcha__box", "aria-hidden": "true", children: B ? "…" : G ? /* @__PURE__ */ e(
762
952
  "span",
763
953
  {
764
954
  style: {
@@ -772,11 +962,11 @@ const ge = B((c, t) => {
772
962
  }
773
963
  }
774
964
  ) : "" }),
775
- /* @__PURE__ */ e("span", { className: "nice-captcha__label", children: p })
965
+ /* @__PURE__ */ e("span", { className: "nice-captcha__label", children: s })
776
966
  ]
777
967
  }
778
968
  ),
779
- i === "math" && R.kind === "math" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge", children: [
969
+ c === "math" && R.kind === "math" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge", children: [
780
970
  /* @__PURE__ */ a("span", { className: "nice-captcha__prompt", "aria-hidden": "true", children: [
781
971
  R.prompt,
782
972
  " ="
@@ -787,12 +977,12 @@ const ge = B((c, t) => {
787
977
  className: "nice-input nice-captcha__answer",
788
978
  type: "number",
789
979
  inputMode: "numeric",
790
- value: M,
980
+ value: D,
791
981
  "aria-label": `What is ${R.prompt}?`,
792
- disabled: L || V,
793
- onChange: (y) => u(y.target.value),
982
+ disabled: B || G,
983
+ onChange: (y) => m(y.target.value),
794
984
  onKeyDown: (y) => {
795
- y.key === "Enter" && (y.preventDefault(), j());
985
+ y.key === "Enter" && (y.preventDefault(), K());
796
986
  }
797
987
  }
798
988
  ),
@@ -801,17 +991,17 @@ const ge = B((c, t) => {
801
991
  {
802
992
  type: "button",
803
993
  className: "nice-btn nice-btn--primary nice-captcha__verify",
804
- disabled: L || V || M.trim() === "",
805
- onClick: j,
806
- children: L ? "…" : "Verify"
994
+ disabled: B || G || D.trim() === "",
995
+ onClick: K,
996
+ children: B ? "…" : "Verify"
807
997
  }
808
998
  )
809
999
  ] }),
810
- i === "text" && R.kind === "text" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge", children: [
1000
+ c === "text" && R.kind === "text" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge", children: [
811
1001
  /* @__PURE__ */ e(
812
1002
  "canvas",
813
1003
  {
814
- ref: N,
1004
+ ref: w,
815
1005
  className: "nice-captcha__canvas",
816
1006
  width: 160,
817
1007
  height: 56,
@@ -825,12 +1015,12 @@ const ge = B((c, t) => {
825
1015
  type: "text",
826
1016
  autoCapitalize: "characters",
827
1017
  autoComplete: "off",
828
- value: M,
1018
+ value: D,
829
1019
  "aria-label": "Type the characters shown in the image",
830
- disabled: L || V,
831
- onChange: (y) => u(y.target.value),
1020
+ disabled: B || G,
1021
+ onChange: (y) => m(y.target.value),
832
1022
  onKeyDown: (y) => {
833
- y.key === "Enter" && (y.preventDefault(), j());
1023
+ y.key === "Enter" && (y.preventDefault(), K());
834
1024
  }
835
1025
  }
836
1026
  ),
@@ -839,14 +1029,14 @@ const ge = B((c, t) => {
839
1029
  {
840
1030
  type: "button",
841
1031
  className: "nice-btn nice-btn--primary nice-captcha__verify",
842
- disabled: L || V || M.trim() === "",
843
- onClick: j,
844
- children: L ? "…" : "Verify"
1032
+ disabled: B || G || D.trim() === "",
1033
+ onClick: K,
1034
+ children: B ? "…" : "Verify"
845
1035
  }
846
1036
  )
847
1037
  ] }),
848
- i === "slider" && R.kind === "slider" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge nice-captcha__challenge--slider", children: [
849
- /* @__PURE__ */ e("span", { className: "nice-captcha__slider-hint", "aria-hidden": "true", children: V ? "Verified" : "Slide to the marker" }),
1038
+ c === "slider" && R.kind === "slider" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge nice-captcha__challenge--slider", children: [
1039
+ /* @__PURE__ */ e("span", { className: "nice-captcha__slider-hint", "aria-hidden": "true", children: G ? "Verified" : "Slide to the marker" }),
850
1040
  /* @__PURE__ */ a("div", { className: "nice-captcha__track", children: [
851
1041
  /* @__PURE__ */ e(
852
1042
  "span",
@@ -866,23 +1056,23 @@ const ge = B((c, t) => {
866
1056
  value: v,
867
1057
  "aria-label": "Slide the handle to the marker to verify",
868
1058
  "aria-valuetext": `${v}%`,
869
- disabled: V || L,
870
- onChange: (y) => ee(Number(y.target.value))
1059
+ disabled: G || B,
1060
+ onChange: (y) => se(Number(y.target.value))
871
1061
  }
872
1062
  )
873
1063
  ] })
874
1064
  ] }),
875
1065
  /* @__PURE__ */ a("div", { className: "nice-captcha__footer", children: [
876
- /* @__PURE__ */ e("div", { className: "nice-captcha__message", role: "status", "aria-live": "polite", children: O }),
877
- r && /* @__PURE__ */ e(
1066
+ /* @__PURE__ */ e("div", { className: "nice-captcha__message", role: "status", "aria-live": "polite", children: L }),
1067
+ i && /* @__PURE__ */ e(
878
1068
  "button",
879
1069
  {
880
1070
  type: "button",
881
1071
  className: "nice-captcha__refresh",
882
1072
  "aria-label": "Refresh challenge",
883
1073
  title: "Refresh challenge",
884
- onClick: G,
885
- children: /* @__PURE__ */ e(he, {})
1074
+ onClick: P,
1075
+ children: /* @__PURE__ */ e(re, {})
886
1076
  }
887
1077
  )
888
1078
  ] })
@@ -890,142 +1080,142 @@ const ge = B((c, t) => {
890
1080
  }
891
1081
  );
892
1082
  });
893
- ge.displayName = "NiceCaptcha";
894
- const _e = [
1083
+ xe.displayName = "NiceCaptcha";
1084
+ const $e = [
895
1085
  { id: "google", label: "Google", color: "#4285f4", textColor: "#fff" },
896
1086
  { id: "microsoft", label: "Microsoft", color: "#00a4ef", textColor: "#fff" },
897
1087
  { id: "discord", label: "Discord", color: "#5865f2", textColor: "#fff" },
898
1088
  { id: "spotify", label: "Spotify", color: "#1db954", textColor: "#fff" },
899
1089
  { id: "github", label: "GitHub", color: "#24292e", textColor: "#fff" }
900
- ], be = B(
1090
+ ], Ae = j(
901
1091
  ({
902
- providers: c = _e,
1092
+ providers: r = $e,
903
1093
  onProviderClick: t,
904
- disabled: i = !1,
1094
+ disabled: c = !1,
905
1095
  loadingProvider: n,
906
- direction: r = "vertical",
907
- separatorText: l = "or continue with",
908
- showSeparator: o = !0,
909
- className: p,
910
- style: d
911
- }, $) => /* @__PURE__ */ a(
1096
+ direction: i = "vertical",
1097
+ separatorText: h = "or continue with",
1098
+ showSeparator: l = !0,
1099
+ className: s,
1100
+ style: u
1101
+ }, S) => /* @__PURE__ */ a(
912
1102
  "div",
913
1103
  {
914
- ref: $,
915
- className: `nice-oauth nice-oauth--${r}${p ? ` ${p}` : ""}`,
916
- style: d,
1104
+ ref: S,
1105
+ className: `nice-oauth nice-oauth--${i}${s ? ` ${s}` : ""}`,
1106
+ style: u,
917
1107
  children: [
918
- o && /* @__PURE__ */ a("div", { className: "nice-oauth__separator", children: [
1108
+ l && /* @__PURE__ */ a("div", { className: "nice-oauth__separator", children: [
919
1109
  /* @__PURE__ */ e("hr", {}),
920
- /* @__PURE__ */ e("span", { children: l }),
1110
+ /* @__PURE__ */ e("span", { children: h }),
921
1111
  /* @__PURE__ */ e("hr", {})
922
1112
  ] }),
923
- /* @__PURE__ */ e("div", { className: "nice-oauth__buttons", children: c.map((s) => /* @__PURE__ */ a(
1113
+ /* @__PURE__ */ e("div", { className: "nice-oauth__buttons", children: r.map((d) => /* @__PURE__ */ a(
924
1114
  "button",
925
1115
  {
926
1116
  type: "button",
927
- className: `nice-oauth__btn${n === s.id ? " nice-oauth__btn--loading" : ""}`,
928
- style: { backgroundColor: s.color, color: s.textColor },
929
- onClick: () => t == null ? void 0 : t(s.id),
930
- disabled: i || !!n,
1117
+ className: `nice-oauth__btn${n === d.id ? " nice-oauth__btn--loading" : ""}`,
1118
+ style: { backgroundColor: d.color, color: d.textColor },
1119
+ onClick: () => t == null ? void 0 : t(d.id),
1120
+ disabled: c || !!n,
931
1121
  children: [
932
- s.icon && /* @__PURE__ */ e("span", { className: "nice-oauth__btn-icon", children: s.icon }),
933
- /* @__PURE__ */ e("span", { className: "nice-oauth__btn-label", children: n === s.id ? "…" : s.label })
1122
+ d.icon && /* @__PURE__ */ e("span", { className: "nice-oauth__btn-icon", children: d.icon }),
1123
+ /* @__PURE__ */ e("span", { className: "nice-oauth__btn-label", children: n === d.id ? "…" : d.label })
934
1124
  ]
935
1125
  },
936
- s.id
1126
+ d.id
937
1127
  )) })
938
1128
  ]
939
1129
  }
940
1130
  )
941
1131
  );
942
- be.displayName = "NiceOAuthButtons";
943
- const ke = B(
944
- function(t, i) {
1132
+ Ae.displayName = "NiceOAuthButtons";
1133
+ const Me = j(
1134
+ function(t, c) {
945
1135
  const {
946
1136
  tokens: n,
947
- onCreate: r,
948
- onRevoke: l,
949
- availableScopes: o = [],
950
- maxTokens: p = 10,
951
- title: d = "API Tokens",
952
- className: $,
953
- style: s
954
- } = t, [C, b] = _(!1), [x, g] = _(""), [F, h] = _([]), [m, f] = _("90"), [T, N] = _(null), [P, S] = _(!1), [E, k] = _(null), D = w(async () => {
955
- if (!(!r || !x.trim())) {
956
- S(!0);
1137
+ onCreate: i,
1138
+ onRevoke: h,
1139
+ availableScopes: l = [],
1140
+ maxTokens: s = 10,
1141
+ title: u = "API Tokens",
1142
+ className: S,
1143
+ style: d
1144
+ } = t, [A, b] = g(!1), [k, _] = g(""), [F, o] = g([]), [p, f] = g("90"), [M, w] = g(null), [C, T] = g(!1), [E, N] = g(null), I = $(async () => {
1145
+ if (!(!i || !k.trim())) {
1146
+ T(!0);
957
1147
  try {
958
- const u = m ? parseInt(m, 10) : void 0, v = await r(x.trim(), F, u);
959
- N(v), g(""), h([]), b(!1);
1148
+ const m = p ? parseInt(p, 10) : void 0, v = await i(k.trim(), F, m);
1149
+ w(v), _(""), o([]), b(!1);
960
1150
  } finally {
961
- S(!1);
1151
+ T(!1);
962
1152
  }
963
1153
  }
964
- }, [r, x, F, m]), O = w(
965
- async (u) => {
966
- if (l) {
967
- k(u);
1154
+ }, [i, k, F, p]), L = $(
1155
+ async (m) => {
1156
+ if (h) {
1157
+ N(m);
968
1158
  try {
969
- await l(u);
1159
+ await h(m);
970
1160
  } finally {
971
- k(null);
1161
+ N(null);
972
1162
  }
973
1163
  }
974
1164
  },
975
- [l]
976
- ), A = (u) => {
977
- h(
978
- (v) => v.includes(u) ? v.filter((z) => z !== u) : [...v, u]
1165
+ [h]
1166
+ ), x = (m) => {
1167
+ o(
1168
+ (v) => v.includes(m) ? v.filter((z) => z !== m) : [...v, m]
979
1169
  );
980
- }, M = n.length < p;
981
- return /* @__PURE__ */ a("div", { ref: i, className: `nice-token-management ${$ ?? ""}`, style: s, children: [
1170
+ }, D = n.length < s;
1171
+ return /* @__PURE__ */ a("div", { ref: c, className: `nice-token-management ${S ?? ""}`, style: d, children: [
982
1172
  /* @__PURE__ */ a("div", { className: "nice-token-management__header", children: [
983
- /* @__PURE__ */ e("h3", { children: d }),
984
- M && /* @__PURE__ */ e(
1173
+ /* @__PURE__ */ e("h3", { children: u }),
1174
+ D && /* @__PURE__ */ e(
985
1175
  "button",
986
1176
  {
987
1177
  className: "nice-token-management__new-btn",
988
1178
  onClick: () => b(!0),
989
- disabled: C,
1179
+ disabled: A,
990
1180
  children: "+ New Token"
991
1181
  }
992
1182
  )
993
1183
  ] }),
994
- T && /* @__PURE__ */ a("div", { className: "nice-token-management__reveal", children: [
1184
+ M && /* @__PURE__ */ a("div", { className: "nice-token-management__reveal", children: [
995
1185
  /* @__PURE__ */ a("p", { children: [
996
1186
  /* @__PURE__ */ e("strong", { children: "New token created!" }),
997
1187
  " Copy it now — it won't be shown again."
998
1188
  ] }),
999
- /* @__PURE__ */ e("code", { className: "nice-token-management__token-value", children: T }),
1000
- /* @__PURE__ */ e("button", { onClick: () => N(null), children: "Dismiss" })
1189
+ /* @__PURE__ */ e("code", { className: "nice-token-management__token-value", children: M }),
1190
+ /* @__PURE__ */ e("button", { onClick: () => w(null), children: "Dismiss" })
1001
1191
  ] }),
1002
- C && /* @__PURE__ */ a("div", { className: "nice-token-management__create-form", children: [
1192
+ A && /* @__PURE__ */ a("div", { className: "nice-token-management__create-form", children: [
1003
1193
  /* @__PURE__ */ a("label", { children: [
1004
1194
  "Name",
1005
1195
  /* @__PURE__ */ e(
1006
1196
  "input",
1007
1197
  {
1008
1198
  type: "text",
1009
- value: x,
1010
- onChange: (u) => g(u.target.value),
1199
+ value: k,
1200
+ onChange: (m) => _(m.target.value),
1011
1201
  placeholder: "My API token",
1012
1202
  maxLength: 64
1013
1203
  }
1014
1204
  )
1015
1205
  ] }),
1016
- o.length > 0 && /* @__PURE__ */ a("fieldset", { children: [
1206
+ l.length > 0 && /* @__PURE__ */ a("fieldset", { children: [
1017
1207
  /* @__PURE__ */ e("legend", { children: "Scopes" }),
1018
- o.map((u) => /* @__PURE__ */ a("label", { className: "nice-token-management__scope", children: [
1208
+ l.map((m) => /* @__PURE__ */ a("label", { className: "nice-token-management__scope", children: [
1019
1209
  /* @__PURE__ */ e(
1020
1210
  "input",
1021
1211
  {
1022
1212
  type: "checkbox",
1023
- checked: F.includes(u),
1024
- onChange: () => A(u)
1213
+ checked: F.includes(m),
1214
+ onChange: () => x(m)
1025
1215
  }
1026
1216
  ),
1027
- u
1028
- ] }, u))
1217
+ m
1218
+ ] }, m))
1029
1219
  ] }),
1030
1220
  /* @__PURE__ */ a("label", { children: [
1031
1221
  "Expires in (days)",
@@ -1033,15 +1223,15 @@ const ke = B(
1033
1223
  "input",
1034
1224
  {
1035
1225
  type: "number",
1036
- value: m,
1037
- onChange: (u) => f(u.target.value),
1226
+ value: p,
1227
+ onChange: (m) => f(m.target.value),
1038
1228
  min: 1,
1039
1229
  max: 365
1040
1230
  }
1041
1231
  )
1042
1232
  ] }),
1043
1233
  /* @__PURE__ */ a("div", { className: "nice-token-management__create-actions", children: [
1044
- /* @__PURE__ */ e("button", { onClick: D, disabled: P || !x.trim(), children: P ? "Creating…" : "Create Token" }),
1234
+ /* @__PURE__ */ e("button", { onClick: I, disabled: C || !k.trim(), children: C ? "Creating…" : "Create Token" }),
1045
1235
  /* @__PURE__ */ e("button", { onClick: () => b(!1), children: "Cancel" })
1046
1236
  ] })
1047
1237
  ] }),
@@ -1055,42 +1245,44 @@ const ke = B(
1055
1245
  /* @__PURE__ */ e("th", { children: "Scopes" }),
1056
1246
  /* @__PURE__ */ e("th", {})
1057
1247
  ] }) }),
1058
- /* @__PURE__ */ e("tbody", { children: n.map((u) => {
1248
+ /* @__PURE__ */ e("tbody", { children: n.map((m) => {
1059
1249
  var v;
1060
1250
  return /* @__PURE__ */ a("tr", { children: [
1061
- /* @__PURE__ */ e("td", { children: u.name }),
1251
+ /* @__PURE__ */ e("td", { children: m.name }),
1062
1252
  /* @__PURE__ */ e("td", { children: /* @__PURE__ */ a("code", { children: [
1063
- u.prefix,
1253
+ m.prefix,
1064
1254
  "…"
1065
1255
  ] }) }),
1066
- /* @__PURE__ */ e("td", { children: u.createdAt }),
1067
- /* @__PURE__ */ e("td", { children: u.expiresAt ?? "—" }),
1068
- /* @__PURE__ */ e("td", { children: u.lastUsedAt ?? "Never" }),
1069
- /* @__PURE__ */ e("td", { children: ((v = u.scopes) == null ? void 0 : v.join(", ")) || "—" }),
1256
+ /* @__PURE__ */ e("td", { children: m.createdAt }),
1257
+ /* @__PURE__ */ e("td", { children: m.expiresAt ?? "—" }),
1258
+ /* @__PURE__ */ e("td", { children: m.lastUsedAt ?? "Never" }),
1259
+ /* @__PURE__ */ e("td", { children: ((v = m.scopes) == null ? void 0 : v.join(", ")) || "—" }),
1070
1260
  /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
1071
1261
  "button",
1072
1262
  {
1073
1263
  className: "nice-token-management__revoke-btn",
1074
- onClick: () => O(u.id),
1075
- disabled: E === u.id,
1076
- children: E === u.id ? "Revoking…" : "Revoke"
1264
+ onClick: () => L(m.id),
1265
+ disabled: E === m.id,
1266
+ children: E === m.id ? "Revoking…" : "Revoke"
1077
1267
  }
1078
1268
  ) })
1079
- ] }, u.id);
1269
+ ] }, m.id);
1080
1270
  }) })
1081
1271
  ] })
1082
1272
  ] });
1083
1273
  }
1084
1274
  );
1085
1275
  export {
1086
- ge as NiceCaptcha,
1087
- oe as NiceChangePassword,
1088
- ce as NiceLoginForm,
1089
- be as NiceOAuthButtons,
1276
+ xe as NiceCaptcha,
1277
+ Ne as NiceChangePassword,
1278
+ de as NiceLoginForm,
1279
+ Ae as NiceOAuthButtons,
1280
+ Fe as NicePasswordGenerator,
1090
1281
  Z as NicePasswordStrength,
1091
- le as NiceRegistrationForm,
1092
- ke as NiceTokenManagement,
1093
- de as NiceTwoFaSetup,
1094
- J as calcPasswordStrength,
1095
- ye as useAuth
1282
+ me as NiceRegistrationForm,
1283
+ Me as NiceTokenManagement,
1284
+ we as NiceTwoFaSetup,
1285
+ Y as calcPasswordStrength,
1286
+ te as generatePassword,
1287
+ Re as useAuth
1096
1288
  };