@webx-ui/module-auth 0.13.0 → 0.14.1

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.
@@ -0,0 +1,3675 @@
1
+ import { inject as $e, defineComponent as ne, computed as R, ref as A, useTemplateRef as de, onBeforeUnmount as na, resolveComponent as le, openBlock as r, createBlock as h, withCtx as a, createVNode as t, withModifiers as De, createCommentVNode as O, createElementVNode as M, createTextVNode as v, toDisplayString as d, watch as me, unref as e, isRef as Se, normalizeClass as Ie, createElementBlock as G, resolveDynamicComponent as qe, createSlots as Me, Fragment as se, renderList as fe, onMounted as oa, h as Ke, defineAsyncComponent as ia } from "vue";
2
+ import { useModal as ge, WxDialog as _e, WxFormItem as j, WxInput as te, WxSelect as ie, WxSpace as ce, WxCheckbox as he, WxText as q, WxButton as X, toast as Q, useElementWidth as ke, WxTable as we, WxEntityCard as xe, WxBadge as ee, WxAvatar as ra, WxIcon as ye, confirm as Ve, WxAlert as Ae, WxRadioGroup as ua, WxLoading as da, createModal as be, WxResult as ca, WxTabs as ma, WxTab as Ce, WxThemeSwitch as Ye, WxSwitch as va } from "@webx-ui/core";
3
+ import { useTranslate as ae, HttpError as pa, useAdmin as oe, useI18n as Te, useErrorText as ve, rowMenuWidth as je, WxDate as ue, WxRowMenu as ze, WxFilterChips as He, WxListScreen as fa, useTheme as Ge } from "@webx-ui/module-admin";
4
+ import { useRouter as ya, useRoute as ha, routerKey as ba } from "vue-router";
5
+ const Je = /* @__PURE__ */ Symbol("webx-auth");
6
+ function Ue() {
7
+ const l = $e(Je, null);
8
+ if (l === null)
9
+ throw new Error("useAuth() was called outside a panel that installed the auth plugin.");
10
+ return l;
11
+ }
12
+ function ga(l) {
13
+ const o = `${l.apiPath}/auth`;
14
+ return {
15
+ async me() {
16
+ try {
17
+ return (await l.http.get(`${o}/me`)).data;
18
+ } catch (s) {
19
+ if (ka(s))
20
+ return null;
21
+ throw s;
22
+ }
23
+ },
24
+ async login(s) {
25
+ const n = await l.http.post(`${o}/login`, {
26
+ email: s.email,
27
+ password: s.password,
28
+ remember: s.remember ?? !1
29
+ });
30
+ return l.setUser(n.data), await l.reload(), n.data;
31
+ },
32
+ async setLocale(s) {
33
+ const n = await l.http.put(`${o}/locale`, { locale: s });
34
+ l.setUser(n.data), await l.setLocale(s);
35
+ },
36
+ async setTheme(s) {
37
+ const n = await l.http.put(`${o}/theme`, {
38
+ theme: s === "system" ? null : s
39
+ });
40
+ l.setUser(n.data);
41
+ },
42
+ async setSiteBar(s) {
43
+ const n = await l.http.put(`${o}/site-bar`, { enabled: s });
44
+ l.setUser(n.data);
45
+ },
46
+ async updateProfile(s) {
47
+ const n = await l.http.put(
48
+ `${o}/me`,
49
+ s
50
+ );
51
+ return l.setUser(n.data), n.data;
52
+ },
53
+ async requestEmailChange(s, n) {
54
+ return (await l.http.post(`${o}/me/email`, {
55
+ email: s,
56
+ current_password: n
57
+ })).data;
58
+ },
59
+ async logout() {
60
+ try {
61
+ await l.http.post(`${o}/logout`);
62
+ } finally {
63
+ l.setUser(null), l.state.status = "unauthenticated", l.state.manifest = null;
64
+ }
65
+ }
66
+ };
67
+ }
68
+ const Qe = /* @__PURE__ */ Symbol("webx-auth-avatar"), Xe = /* @__PURE__ */ Symbol("webx-auth-avatar-field");
69
+ function _a(l, o, s = null, n = null) {
70
+ l.provide(Je, o), l.provide(Qe, s), l.provide(Xe, n);
71
+ }
72
+ function ka(l) {
73
+ return typeof l == "object" && l !== null && "status" in l && l.status === 401;
74
+ }
75
+ const wa = ["title", "aria-label", "aria-pressed"], xa = /* @__PURE__ */ ne({
76
+ __name: "LoginCard",
77
+ props: {
78
+ emailLabel: { default: void 0 },
79
+ passwordLabel: { default: void 0 },
80
+ rememberLabel: { default: void 0 },
81
+ submitLabel: { default: void 0 },
82
+ capsLockWarning: { default: void 0 },
83
+ throttleMessage: { default: void 0 },
84
+ revealLabel: { default: void 0 },
85
+ hideLabel: { default: void 0 },
86
+ remember: { type: Boolean, default: !0 },
87
+ autofocus: { type: Boolean, default: !0 }
88
+ },
89
+ emits: ["success"],
90
+ setup(l, { expose: o, emit: s }) {
91
+ const n = l, x = s, f = Ue(), z = ae("webx-auth"), m = R(() => ({
92
+ email: n.emailLabel ?? z("card.email"),
93
+ password: n.passwordLabel ?? z("card.password"),
94
+ remember: n.rememberLabel ?? z("card.remember"),
95
+ submit: n.submitLabel ?? z("card.submit"),
96
+ capsLock: n.capsLockWarning ?? z("card.caps-lock"),
97
+ reveal: n.revealLabel ?? z("card.reveal"),
98
+ hide: n.hideLabel ?? z("card.hide")
99
+ })), u = A(""), N = A(""), c = A(!1), k = A(!1), $ = A(!1), W = A(!1), V = A(""), w = A({}), C = A(0), E = de("emailField");
100
+ let b = null;
101
+ na(U);
102
+ const L = R(() => C.value > 0), _ = R(
103
+ () => n.throttleMessage === void 0 ? z("card.throttled", { seconds: C.value }) : n.throttleMessage.replace(":seconds", String(C.value))
104
+ );
105
+ async function g() {
106
+ if (!(k.value || L.value)) {
107
+ k.value = !0, V.value = "", w.value = {};
108
+ try {
109
+ await f.login({
110
+ email: u.value,
111
+ password: N.value,
112
+ remember: c.value
113
+ }), N.value = "", x("success");
114
+ } catch (y) {
115
+ S(y);
116
+ } finally {
117
+ k.value = !1;
118
+ }
119
+ }
120
+ }
121
+ function S(y) {
122
+ if (!(y instanceof pa)) {
123
+ V.value = y instanceof Error ? y.message : String(y);
124
+ return;
125
+ }
126
+ if (y.isValidation) {
127
+ w.value = y.errors;
128
+ return;
129
+ }
130
+ if (y.isThrottled) {
131
+ F(y.retryAfter ?? 60);
132
+ return;
133
+ }
134
+ V.value = y.message;
135
+ }
136
+ function F(y) {
137
+ U(), C.value = y, b = setInterval(() => {
138
+ C.value -= 1, C.value <= 0 && U();
139
+ }, 1e3);
140
+ }
141
+ function U() {
142
+ b !== null && (clearInterval(b), b = null), C.value = 0;
143
+ }
144
+ function Y(y) {
145
+ W.value = y.getModifierState("CapsLock");
146
+ }
147
+ return o({ focus: () => E.value?.focus() }), (y, p) => {
148
+ const i = le("wx-alert"), T = le("wx-icon"), H = le("wx-input"), I = le("wx-form-item"), Z = le("wx-checkbox"), B = le("wx-button"), K = le("wx-form"), D = le("wx-card");
149
+ return r(), h(D, {
150
+ class: "wx-login",
151
+ padding: 24
152
+ }, {
153
+ default: a(() => [
154
+ t(K, {
155
+ errors: w.value,
156
+ disabled: k.value,
157
+ gap: "md",
158
+ onSubmit: De(g, ["prevent"])
159
+ }, {
160
+ default: a(() => [
161
+ V.value !== "" ? (r(), h(i, {
162
+ key: 0,
163
+ type: "danger",
164
+ variant: "soft",
165
+ live: "",
166
+ description: V.value,
167
+ class: "wx-login__message"
168
+ }, null, 8, ["description"])) : L.value ? (r(), h(i, {
169
+ key: 1,
170
+ type: "warning",
171
+ variant: "soft",
172
+ live: "",
173
+ description: _.value,
174
+ class: "wx-login__message"
175
+ }, null, 8, ["description"])) : O("", !0),
176
+ t(I, { name: "email" }, {
177
+ default: a(() => [
178
+ t(H, {
179
+ ref_key: "emailField",
180
+ ref: E,
181
+ modelValue: u.value,
182
+ "onUpdate:modelValue": p[0] || (p[0] = (P) => u.value = P),
183
+ type: "email",
184
+ placeholder: m.value.email,
185
+ "aria-label": m.value.email,
186
+ autocomplete: "username",
187
+ autofocus: l.autofocus,
188
+ inputmode: "email",
189
+ size: "lg"
190
+ }, {
191
+ prefix: a(() => [
192
+ t(T, { name: "mail" })
193
+ ]),
194
+ _: 1
195
+ }, 8, ["modelValue", "placeholder", "aria-label", "autofocus"])
196
+ ]),
197
+ _: 1
198
+ }),
199
+ t(I, {
200
+ name: "password",
201
+ help: W.value ? m.value.capsLock : void 0
202
+ }, {
203
+ default: a(() => [
204
+ t(H, {
205
+ modelValue: N.value,
206
+ "onUpdate:modelValue": p[2] || (p[2] = (P) => N.value = P),
207
+ type: $.value ? "text" : "password",
208
+ placeholder: m.value.password,
209
+ "aria-label": m.value.password,
210
+ autocomplete: "current-password",
211
+ size: "lg",
212
+ onKeydown: Y,
213
+ onKeyup: Y
214
+ }, {
215
+ prefix: a(() => [
216
+ t(T, { name: "lock" })
217
+ ]),
218
+ suffix: a(() => [
219
+ M("button", {
220
+ type: "button",
221
+ class: "wx-login__reveal",
222
+ title: $.value ? m.value.hide : m.value.reveal,
223
+ "aria-label": $.value ? m.value.hide : m.value.reveal,
224
+ "aria-pressed": $.value,
225
+ tabindex: "-1",
226
+ onClick: p[1] || (p[1] = (P) => $.value = !$.value)
227
+ }, [
228
+ t(T, {
229
+ name: $.value ? "eye-off" : "eye"
230
+ }, null, 8, ["name"])
231
+ ], 8, wa)
232
+ ]),
233
+ _: 1
234
+ }, 8, ["modelValue", "type", "placeholder", "aria-label"])
235
+ ]),
236
+ _: 1
237
+ }, 8, ["help"]),
238
+ l.remember ? (r(), h(Z, {
239
+ key: 2,
240
+ modelValue: c.value,
241
+ "onUpdate:modelValue": p[3] || (p[3] = (P) => c.value = P),
242
+ label: m.value.remember,
243
+ class: "wx-login__remember"
244
+ }, null, 8, ["modelValue", "label"])) : O("", !0),
245
+ t(B, {
246
+ type: "primary",
247
+ "native-type": "submit",
248
+ size: "lg",
249
+ block: "",
250
+ loading: k.value,
251
+ disabled: L.value
252
+ }, {
253
+ default: a(() => [
254
+ v(d(m.value.submit), 1)
255
+ ]),
256
+ _: 1
257
+ }, 8, ["loading", "disabled"])
258
+ ]),
259
+ _: 1
260
+ }, 8, ["errors", "disabled"])
261
+ ]),
262
+ _: 1
263
+ });
264
+ };
265
+ }
266
+ }), Le = (l, o) => {
267
+ const s = l.__vccOpts || l;
268
+ for (const [n, x] of o)
269
+ s[n] = x;
270
+ return s;
271
+ }, Ca = /* @__PURE__ */ Le(xa, [["__scopeId", "data-v-3c206e31"]]);
272
+ function Ze(l) {
273
+ return l.types["wx-media"]?.component ?? null;
274
+ }
275
+ function ea(l) {
276
+ const o = l.assetUrls;
277
+ return o ? async (s) => (await o([s]))[s] ?? null : null;
278
+ }
279
+ const aa = {
280
+ card: {
281
+ email: "Email",
282
+ password: "Password",
283
+ remember: "Stay signed in",
284
+ submit: "Sign in",
285
+ "caps-lock": "Caps Lock is on.",
286
+ reveal: "Show the password",
287
+ hide: "Hide the password",
288
+ throttled: "Too many attempts. Try again in :seconds s.",
289
+ failed: "Those details do not match an account."
290
+ },
291
+ admins: {
292
+ title: "Administrators",
293
+ "filter-role": "Role",
294
+ "filter-state": "State",
295
+ search: "Search administrators",
296
+ new: "New administrator",
297
+ edit: "Edit administrator",
298
+ // The same two, short enough for a button on a phone and for a dialog's heading.
299
+ "new-short": "Add",
300
+ "edit-short": "Edit",
301
+ name: "Name",
302
+ email: "Email",
303
+ password: "Password",
304
+ "password-hint": "At least 12 characters",
305
+ "password-keep": "Leave blank to keep the current one",
306
+ avatar: "Photo",
307
+ roles: "Roles",
308
+ "no-roles": "No roles",
309
+ active: "Active",
310
+ super: "Super administrator",
311
+ "super-hint": "Answers yes to everything, whatever the roles say",
312
+ locale: "Panel language",
313
+ "locale-auto": "Follow the browser",
314
+ "last-login": "Last signed in",
315
+ save: "Save",
316
+ cancel: "Cancel",
317
+ delete: "Delete",
318
+ "delete-title": "Delete :name?",
319
+ "delete-text": "They lose access at once. What they have written stays.",
320
+ "all-roles": "All roles",
321
+ "any-state": "Active and not",
322
+ "only-active": "Active only",
323
+ "only-inactive": "Switched off only",
324
+ empty: "Nobody matches that",
325
+ "select-one": "Choose an administrator",
326
+ "select-many": "Choose administrators",
327
+ chosen: "Chosen: :count",
328
+ created: "Administrator created",
329
+ updated: "Administrator saved",
330
+ deleted: "Administrator deleted"
331
+ },
332
+ // The roles: named sets of permissions, the view beside the administrators.
333
+ roles: {
334
+ title: "Roles",
335
+ "new-short": "Add",
336
+ new: "New role",
337
+ edit: "Edit role",
338
+ view: "Role",
339
+ name: "Name",
340
+ slug: "Code",
341
+ "slug-hint": "Latin letters, digits and hyphens. Made from the name when left blank.",
342
+ permissions: "Permissions",
343
+ "permission-count": "Permissions: :count",
344
+ users: "Administrators",
345
+ "users-count": "Administrators: :count",
346
+ all: "All",
347
+ unknown: "From modules not installed here",
348
+ "not-yours": "You do not hold this permission, so you cannot grant it",
349
+ held: "You hold this role, so somebody else edits it.",
350
+ empty: "No roles yet",
351
+ save: "Save",
352
+ cancel: "Cancel",
353
+ close: "Close",
354
+ delete: "Delete",
355
+ "delete-title": "Delete the role «:name»?",
356
+ "delete-text": "Nobody holds it.",
357
+ "delete-holders": "It is taken away from: :names.",
358
+ created: "Role created",
359
+ updated: "Role saved",
360
+ deleted: "Role deleted",
361
+ yours: "Yours"
362
+ },
363
+ // The trail of what agents did through the panel: the view next to the administrators.
364
+ calls: {
365
+ title: "Agent calls",
366
+ when: "When",
367
+ who: "Who",
368
+ client: "Client",
369
+ tool: "Tool",
370
+ outcome: "Outcome",
371
+ took: "Took",
372
+ ms: ":count ms",
373
+ answered: "Answered",
374
+ refused: "Refused",
375
+ "dry-run": "Dry run",
376
+ local: "Local server",
377
+ deleted: "Administrator #:id",
378
+ "filter-user": "Administrator",
379
+ "filter-tool": "Tool",
380
+ "filter-outcome": "Outcome",
381
+ everybody: "Everybody",
382
+ "all-tools": "All tools",
383
+ "any-outcome": "Any outcome",
384
+ "only-answered": "Answered only",
385
+ "only-refused": "Refused only",
386
+ "only-dry": "Dry runs only",
387
+ arguments: "Arguments",
388
+ "no-arguments": "Called with no arguments",
389
+ request: "The agent's request",
390
+ "request-hint": "What the agent passed to the tool. The answer is not kept.",
391
+ error: "Refused with",
392
+ empty: "No calls match"
393
+ },
394
+ // The connections tab and the page that tells somebody how to make one.
395
+ connections: {
396
+ title: "Connections",
397
+ client: "Client",
398
+ allowed: "What is allowed",
399
+ connected: "Connected",
400
+ "last-used": "Last used",
401
+ who: "Administrator",
402
+ full: "Everything :name can do",
403
+ "full-you": "Everything you can do",
404
+ "read-only": "Reading only",
405
+ "returns-to": "Answers go to :host",
406
+ disconnect: "Disconnect",
407
+ disconnected: "Disconnected",
408
+ "never-used": "Never",
409
+ empty: "No agents are connected",
410
+ "empty-all": "Nobody has connected an agent",
411
+ "confirm-title": "Disconnect :client?",
412
+ "confirm-text": "It loses access at once, including the month of refreshing it was given. Connecting it again takes three clicks.",
413
+ confirm: "Disconnect",
414
+ cancel: "Cancel",
415
+ done: ":client is disconnected",
416
+ deleted: "Administrator #:id"
417
+ },
418
+ // Keys for programs, issued and revoked under Administrators → Keys.
419
+ keys: {
420
+ title: "Keys",
421
+ issue: "Issue a key",
422
+ "issue-short": "Issue",
423
+ lead: "A key lets a program — a queue watcher, a nightly import — work in this panel without a browser. It acts as the administrator you choose and can never do more than they may. A key is a program, not a person: what a module keeps for a person, such as a stage checked by hand, it cannot do.",
424
+ name: "Name",
425
+ "name-hint": 'What the program is, so that the list says it: "queue watcher", "nightly import".',
426
+ who: "Acts as",
427
+ "who-hint": "Everything the key changes is done in this administrator's name, within their permissions.",
428
+ allowed: "What is allowed",
429
+ everything: "Everything the administrator may do",
430
+ chosen: "Only the scopes chosen below",
431
+ scopes: "Scopes",
432
+ "scopes-hint": "A module installed later is out of reach until a new key names it.",
433
+ "scopes-required": "Choose at least one scope.",
434
+ lifetime: "Lives for",
435
+ "lifetime-hint": "A key cannot be extended: issue a new one before this one runs out, then revoke the old one.",
436
+ "days-30": "30 days",
437
+ "days-90": "90 days",
438
+ "days-365": "1 year",
439
+ "days-1095": "3 years",
440
+ "days-3650": "10 years",
441
+ "issued-title": "Copy the key now",
442
+ "issued-text": "This is the only time the key is shown. Nobody can see it again — not here, not on the server. If it is lost, revoke it and issue a new one.",
443
+ secret: "Key",
444
+ copy: "Copy",
445
+ copied: "Copied",
446
+ "copy-failed": "Could not reach the clipboard. Select the key and copy it by hand.",
447
+ address: "Server address",
448
+ "header-hint": "The program sends the key in a header: Authorization: Bearer <key>.",
449
+ done: "Done",
450
+ cancel: "Cancel",
451
+ expires: "Expires",
452
+ until: "until",
453
+ "last-used": "Last used",
454
+ "never-used": "Never",
455
+ "issued-by": "Issued by :name",
456
+ "issued-console": "Issued in a terminal",
457
+ full: "Everything :name can do",
458
+ deleted: "Administrator #:id",
459
+ revoke: "Revoke",
460
+ revoked: "Revoked",
461
+ expired: "Expired",
462
+ "confirm-title": "Revoke :name?",
463
+ "confirm-text": "The program using it is refused from its next call. A revoked key cannot be switched back on.",
464
+ confirm: "Revoke",
465
+ "revoked-done": ":name is revoked",
466
+ empty: "No keys have been issued",
467
+ "lead-mine": "A key lets a program — a queue watcher, a nightly import — work in this panel as you, without a browser. It can never do more than you may, and only within the scopes you choose.",
468
+ "empty-mine": "You have no keys yet"
469
+ },
470
+ connect: {
471
+ lead: "An AI agent — Claude, ChatGPT, Cursor — can work in this panel as you. Give it the address below; it will ask you to sign in and then ask what it may do.",
472
+ title: "Connect an agent",
473
+ address: "The address of this panel for agents",
474
+ copy: "Copy the address",
475
+ copied: "Copied",
476
+ "copy-failed": "Could not reach the clipboard. Select the address and copy it by hand.",
477
+ "copy-line": "Copy",
478
+ how: "How to add it",
479
+ "claude-title": "Claude",
480
+ "claude-1": "Open Settings and go to Connectors.",
481
+ "claude-2": 'Press "Add custom connector".',
482
+ "claude-3": "Paste the address and press Add.",
483
+ "chatgpt-title": "ChatGPT",
484
+ "chatgpt-1": "Open Settings and go to Connectors.",
485
+ "chatgpt-2": 'Press "Add" and choose a custom MCP server.',
486
+ "chatgpt-3": "Paste the address, leave the authentication as OAuth, and confirm.",
487
+ "claude-code-title": "Claude Code",
488
+ "claude-code-hint": "One line in a terminal, from any project:",
489
+ "codex-title": "Codex",
490
+ "codex-hint": "These lines in ~/.codex/config.toml:",
491
+ "one-click": "One click",
492
+ "one-click-hint": "These two take the whole thing from a link: the editor opens, asks once, and the server is there.",
493
+ "install-in": "Add to :client",
494
+ "cursor-title": "Cursor",
495
+ "vscode-title": "VS Code",
496
+ next: "What happens next",
497
+ "next-1": "The client opens this site in a browser and asks you to sign in to the panel, with your usual password. It never sees the password.",
498
+ "next-2": 'The panel shows who is asking and where the answer goes. There is a "read only" switch on that screen, and turning it on is the safe way to begin.',
499
+ "next-3": "From then on the agent acts as you: it can do what you can do and nothing more, and every call it makes is written down.",
500
+ mine: "Your connections",
501
+ rules: "Rules for agents",
502
+ "rules-hint": "Every connected agent reads these before it writes anything a visitor will see.",
503
+ keys: "Your keys",
504
+ "keys-hint": "For a program that runs without a browser — a nightly import, a queue watcher. A key acts as you and can never do more than you may."
505
+ },
506
+ errors: {
507
+ unauthenticated: "Unauthenticated.",
508
+ inactive: "This account is no longer active.",
509
+ forbidden: "This account may not do that.",
510
+ "not-yourself": "You cannot do that to your own account.",
511
+ "last-super": "There has to be one super administrator left."
512
+ },
513
+ // Somebody editing themselves, which is a shorter list than an administrator editing them.
514
+ profile: {
515
+ title: "Your profile",
516
+ menu: "Edit your profile",
517
+ name: "Name",
518
+ avatar: "Photo",
519
+ password: "New password",
520
+ "password-hint": "At least 12 characters. Leave blank to keep the current one.",
521
+ "current-password": "Current password",
522
+ "current-password-hint": "Asked for before the password is changed.",
523
+ "wrong-password": "That is not the current password.",
524
+ saved: "Your profile is saved.",
525
+ save: "Save",
526
+ cancel: "Cancel",
527
+ "tab-main": "Profile",
528
+ "tab-interface": "Interface",
529
+ "tab-password": "Password",
530
+ "tab-email": "Email",
531
+ "not-yours": "The field «:field» is not part of your profile.",
532
+ "email-current": "Current address",
533
+ "email-new": "New address",
534
+ "email-hint": "A link goes to the new address. The address changes when you follow it.",
535
+ "email-password-hint": "Asked for before the address is changed.",
536
+ "email-send": "Send the link",
537
+ "email-sent": "A link is on its way to :email. It works for :minutes minutes.",
538
+ "email-unavailable": "This site does not send mail, so your address is changed by whoever manages administrators.",
539
+ "email-same": "That is already your address.",
540
+ "email-not-sent": "The letter could not be sent. Try again later.",
541
+ "email-done": "Your sign-in address is changed.",
542
+ "email-expired": "That link has run out or was already used. Ask for a new one in your profile.",
543
+ "email-taken": "That address now belongs to another administrator.",
544
+ "email-letter-subject": "Confirm your new address for :site",
545
+ "email-letter-hello": "Hello, :name.",
546
+ "email-letter-text": "You asked to sign in to the :site panel with this address. Follow the link to confirm it.",
547
+ "email-letter-button": "Confirm the address",
548
+ "email-letter-expires": "The link works for :minutes minutes.",
549
+ "email-letter-ignore": "If you did not ask for this, ignore this letter: nothing changes until the link is followed.",
550
+ language: "Panel language",
551
+ theme: "Theme",
552
+ "site-bar": "Panel on the site",
553
+ "site-bar-hint": "A bar on the site’s own pages while you are signed in.",
554
+ "interface-hint": "These take effect at once, on every device you sign in on.",
555
+ agents: "Agents and keys",
556
+ "agents-hint": "Your connected agents and your keys for programs.",
557
+ "agents-open": "Open"
558
+ },
559
+ menu: {
560
+ "sign-out": "Sign out",
561
+ language: "Interface language",
562
+ "site-bar": "Panel on the site"
563
+ }
564
+ };
565
+ function pe(l) {
566
+ const o = `${l.apiPath}/auth`, s = (n) => n.data;
567
+ return {
568
+ list: (n = {}) => l.http.get(`${o}/admins`, {
569
+ query: {
570
+ q: n.q || void 0,
571
+ role: n.role ?? void 0,
572
+ active: n.active ?? void 0,
573
+ sort: n.sort,
574
+ page: n.page,
575
+ per_page: n.per_page
576
+ }
577
+ }).then((x) => ({ ...x.meta, data: x.data })),
578
+ get: (n) => l.http.get(`${o}/admins/${n}`).then(s),
579
+ create: (n) => l.http.post(`${o}/admins`, n).then(s),
580
+ update: (n, x) => l.http.patch(`${o}/admins/${n}`, x).then(s),
581
+ remove: (n) => l.http.delete(`${o}/admins/${n}`),
582
+ roles: () => l.http.get(`${o}/roles`).then(s),
583
+ role: (n) => l.http.get(`${o}/roles/${n}`).then(s),
584
+ permissions: () => l.http.get(`${o}/roles/permissions`).then(s),
585
+ createRole: (n) => l.http.post(`${o}/roles`, n).then(s),
586
+ updateRole: (n, x) => l.http.put(`${o}/roles/${n}`, x).then(s),
587
+ removeRole: (n) => l.http.delete(`${o}/roles/${n}`),
588
+ calls: (n = {}) => l.http.get(`${o}/mcp-calls`, {
589
+ query: {
590
+ user: n.user ?? void 0,
591
+ tool: n.tool ?? void 0,
592
+ outcome: n.outcome ?? void 0,
593
+ page: n.page,
594
+ per_page: n.per_page
595
+ }
596
+ }).then((x) => ({ ...x.meta, data: x.data, filters: x.filters }))
597
+ };
598
+ }
599
+ const Re = /* @__PURE__ */ new WeakSet();
600
+ function re() {
601
+ try {
602
+ const { i18n: l } = oe();
603
+ Re.has(l) || (l.defaults("webx-auth", aa), Re.add(l));
604
+ } catch {
605
+ }
606
+ }
607
+ const $a = { class: "wx-admin-form" }, Va = {
608
+ key: 0,
609
+ class: "wx-admin-form__aside"
610
+ }, Aa = { class: "wx-admin-form__fields" }, za = /* @__PURE__ */ ne({
611
+ __name: "AdminDialog",
612
+ props: {
613
+ admin: { default: null },
614
+ avatarField: { default: void 0 }
615
+ },
616
+ setup(l) {
617
+ const o = l, { resolve: s, dismiss: n, open: x } = ge(), f = oe(), z = pe(f), m = Te();
618
+ re();
619
+ const u = ae("webx-auth"), N = ve(), c = A([]), k = f.can("roles.assign"), $ = f.state.user?.isSuper === !0, W = A(!1), V = A({}), w = A({
620
+ name: "",
621
+ email: "",
622
+ password: "",
623
+ avatar: null,
624
+ is_active: !0,
625
+ is_super: !1,
626
+ locale: null,
627
+ roles: []
628
+ }), C = R({
629
+ get: () => w.value.avatar ? { path: w.value.avatar } : null,
630
+ set: (S) => {
631
+ w.value.avatar = S?.path ?? null;
632
+ }
633
+ }), E = R(() => o.admin !== null), b = R(() => c.value.map((S) => ({ value: S.id, label: S.name }))), L = R(() => [
634
+ { value: "auto", label: u("admins.locale-auto") },
635
+ ...m.state.panelLocales.map((S) => ({ value: S.code, label: S.nativeName }))
636
+ ]);
637
+ k && z.roles().then((S) => c.value = S), me(
638
+ () => o.admin,
639
+ (S) => {
640
+ w.value = {
641
+ name: S?.name ?? "",
642
+ email: S?.email ?? "",
643
+ password: "",
644
+ avatar: S?.avatar ?? null,
645
+ is_active: S?.is_active ?? !0,
646
+ is_super: S?.is_super ?? !1,
647
+ locale: S?.locale ?? "auto",
648
+ roles: S?.roles.map((F) => F.id) ?? []
649
+ }, V.value = {};
650
+ },
651
+ { immediate: !0 }
652
+ );
653
+ function _(S) {
654
+ return V.value[S]?.[0];
655
+ }
656
+ async function g() {
657
+ W.value = !0, V.value = {};
658
+ const S = {
659
+ name: w.value.name,
660
+ email: w.value.email,
661
+ avatar: w.value.avatar,
662
+ is_active: w.value.is_active,
663
+ locale: w.value.locale === "auto" ? null : w.value.locale
664
+ };
665
+ k && (S.roles = w.value.roles ?? []), $ && (S.is_super = w.value.is_super), w.value.password && (S.password = w.value.password);
666
+ try {
667
+ const F = o.admin ? await z.update(o.admin.id, S) : await z.create(S);
668
+ Q.success(u(E.value ? "admins.updated" : "admins.created")), s(F);
669
+ } catch (F) {
670
+ const U = F.body;
671
+ U?.errors ? V.value = U.errors : Q.danger(N(F));
672
+ } finally {
673
+ W.value = !1;
674
+ }
675
+ }
676
+ return (S, F) => (r(), h(e(_e), {
677
+ open: e(x),
678
+ "onUpdate:open": F[9] || (F[9] = (U) => Se(x) ? x.value = U : null),
679
+ title: E.value ? e(u)("admins.edit-short") : e(u)("admins.new-short"),
680
+ width: 720
681
+ }, {
682
+ footer: a(() => [
683
+ t(e(ce), { size: "sm" }, {
684
+ default: a(() => [
685
+ t(e(X), {
686
+ variant: "outline",
687
+ onClick: F[8] || (F[8] = (U) => e(n)())
688
+ }, {
689
+ default: a(() => [
690
+ v(d(e(u)("admins.cancel")), 1)
691
+ ]),
692
+ _: 1
693
+ }),
694
+ t(e(X), {
695
+ type: "primary",
696
+ loading: W.value,
697
+ onClick: g
698
+ }, {
699
+ default: a(() => [
700
+ v(d(e(u)("admins.save")), 1)
701
+ ]),
702
+ _: 1
703
+ }, 8, ["loading"])
704
+ ]),
705
+ _: 1
706
+ })
707
+ ]),
708
+ default: a(() => [
709
+ M("div", $a, [
710
+ M("div", {
711
+ class: Ie(["wx-admin-form__grid", { "has-aside": l.avatarField }])
712
+ }, [
713
+ l.avatarField ? (r(), G("div", Va, [
714
+ (r(), h(qe(l.avatarField), {
715
+ modelValue: C.value,
716
+ "onUpdate:modelValue": F[0] || (F[0] = (U) => C.value = U),
717
+ label: e(u)("admins.avatar"),
718
+ aspect: "1/1",
719
+ captions: !1
720
+ }, null, 8, ["modelValue", "label"]))
721
+ ])) : O("", !0),
722
+ M("div", Aa, [
723
+ t(e(j), {
724
+ label: e(u)("admins.name"),
725
+ error: _("name")
726
+ }, {
727
+ default: a(() => [
728
+ t(e(te), {
729
+ modelValue: w.value.name,
730
+ "onUpdate:modelValue": F[1] || (F[1] = (U) => w.value.name = U),
731
+ name: "name"
732
+ }, null, 8, ["modelValue"])
733
+ ]),
734
+ _: 1
735
+ }, 8, ["label", "error"]),
736
+ t(e(j), {
737
+ label: e(u)("admins.email"),
738
+ error: _("email")
739
+ }, {
740
+ default: a(() => [
741
+ t(e(te), {
742
+ modelValue: w.value.email,
743
+ "onUpdate:modelValue": F[2] || (F[2] = (U) => w.value.email = U),
744
+ type: "email",
745
+ name: "email",
746
+ autocomplete: "off"
747
+ }, null, 8, ["modelValue"])
748
+ ]),
749
+ _: 1
750
+ }, 8, ["label", "error"]),
751
+ t(e(j), {
752
+ label: e(u)("admins.password"),
753
+ error: _("password"),
754
+ help: E.value ? e(u)("admins.password-keep") : e(u)("admins.password-hint")
755
+ }, {
756
+ default: a(() => [
757
+ t(e(te), {
758
+ modelValue: w.value.password,
759
+ "onUpdate:modelValue": F[3] || (F[3] = (U) => w.value.password = U),
760
+ type: "password",
761
+ name: "password",
762
+ autocomplete: "new-password"
763
+ }, null, 8, ["modelValue"])
764
+ ]),
765
+ _: 1
766
+ }, 8, ["label", "error", "help"]),
767
+ e(k) ? (r(), h(e(j), {
768
+ key: 0,
769
+ label: e(u)("admins.roles"),
770
+ error: _("roles")
771
+ }, {
772
+ default: a(() => [
773
+ t(e(ie), {
774
+ modelValue: w.value.roles,
775
+ "onUpdate:modelValue": F[4] || (F[4] = (U) => w.value.roles = U),
776
+ options: b.value,
777
+ multiple: ""
778
+ }, null, 8, ["modelValue", "options"])
779
+ ]),
780
+ _: 1
781
+ }, 8, ["label", "error"])) : O("", !0),
782
+ t(e(j), {
783
+ label: e(u)("admins.locale")
784
+ }, {
785
+ default: a(() => [
786
+ t(e(ie), {
787
+ modelValue: w.value.locale,
788
+ "onUpdate:modelValue": F[5] || (F[5] = (U) => w.value.locale = U),
789
+ options: L.value
790
+ }, null, 8, ["modelValue", "options"])
791
+ ]),
792
+ _: 1
793
+ }, 8, ["label"]),
794
+ t(e(ce), { size: "md" }, {
795
+ default: a(() => [
796
+ t(e(he), {
797
+ modelValue: w.value.is_active,
798
+ "onUpdate:modelValue": F[6] || (F[6] = (U) => w.value.is_active = U),
799
+ label: e(u)("admins.active")
800
+ }, null, 8, ["modelValue", "label"]),
801
+ $ ? (r(), h(e(he), {
802
+ key: 0,
803
+ modelValue: w.value.is_super,
804
+ "onUpdate:modelValue": F[7] || (F[7] = (U) => w.value.is_super = U),
805
+ label: e(u)("admins.super")
806
+ }, null, 8, ["modelValue", "label"])) : O("", !0)
807
+ ]),
808
+ _: 1
809
+ }),
810
+ $ ? (r(), h(e(q), {
811
+ key: 1,
812
+ size: "sm",
813
+ tone: "muted"
814
+ }, {
815
+ default: a(() => [
816
+ v(d(e(u)("admins.super-hint")), 1)
817
+ ]),
818
+ _: 1
819
+ })) : O("", !0)
820
+ ])
821
+ ], 2)
822
+ ])
823
+ ]),
824
+ _: 1
825
+ }, 8, ["open", "title"]));
826
+ }
827
+ }), We = 480, ta = /* @__PURE__ */ ne({
828
+ __name: "AdminList",
829
+ props: {
830
+ picking: { type: Boolean, default: !1 },
831
+ multiple: { type: Boolean, default: !1 },
832
+ removable: { type: Boolean, default: !1 },
833
+ filters: { type: Boolean, default: !1 },
834
+ resolveAvatar: { type: Function, default: void 0 }
835
+ },
836
+ emits: ["open", "chosen", "selection", "remove"],
837
+ setup(l, { expose: o, emit: s }) {
838
+ const n = l, x = s, f = oe(), z = pe(f);
839
+ re();
840
+ const m = de("root"), u = ke(m), N = R(() => u.value > 0 && u.value < We), c = ae("webx-auth"), k = ae("webx-admin"), $ = A(null), W = A([]), V = A(!1), w = A("all"), C = A("any"), E = A([]), b = A({});
841
+ let L = { page: 1, perPage: 20, sort: null, search: "" };
842
+ const _ = R(() => [
843
+ { value: "all", label: c("admins.all-roles") },
844
+ ...W.value.map((I) => ({ value: I.slug, label: I.name }))
845
+ ]), g = R(() => [
846
+ { value: "any", label: c("admins.any-state") },
847
+ { value: "yes", label: c("admins.only-active") },
848
+ { value: "no", label: c("admins.only-inactive") }
849
+ ]), S = R(() => {
850
+ const I = [], Z = W.value.find((B) => B.slug === w.value);
851
+ return Z && I.push({
852
+ key: "role",
853
+ label: `${c("admins.filter-role")}: ${Z.name}`,
854
+ clear: () => w.value = "all"
855
+ }), C.value !== "any" && I.push({
856
+ key: "state",
857
+ label: `${c("admins.filter-state")}: ${C.value === "yes" ? c("admins.only-active") : c("admins.only-inactive")}`,
858
+ clear: () => C.value = "any"
859
+ }), I;
860
+ });
861
+ function F() {
862
+ w.value = "all", C.value = "any";
863
+ }
864
+ const U = R(() => N.value ? [{ key: "card", label: "" }] : [
865
+ { key: "name", label: c("admins.name"), sortable: !0 },
866
+ { key: "email", label: c("admins.email"), sortable: !0, hideBelow: 560 },
867
+ { key: "roles", label: c("admins.roles"), hideBelow: 760 },
868
+ { key: "is_active", label: c("admins.active"), align: "center", hideBelow: 660 },
869
+ {
870
+ key: "last_login_at",
871
+ label: c("admins.last-login"),
872
+ sortable: !0,
873
+ hideBelow: 900,
874
+ // The first thing to go when a row becomes a card: it is a date somebody scans down a
875
+ // column, and a card has no column to scan.
876
+ hideOnCards: !0
877
+ },
878
+ {
879
+ key: "actions",
880
+ label: "",
881
+ width: je,
882
+ align: "right",
883
+ hidden: !n.removable,
884
+ // A card puts them along its top instead, through the `card-actions` slot.
885
+ hideOnCards: !0
886
+ }
887
+ ]);
888
+ z.roles().then((I) => W.value = I), me([w, C], () => Y(L));
889
+ async function Y(I) {
890
+ L = I, V.value = !0;
891
+ try {
892
+ $.value = await z.list({
893
+ q: I.search,
894
+ role: w.value === "all" ? null : w.value,
895
+ active: C.value === "any" ? null : C.value,
896
+ sort: I.sort ? `${I.sort.order === "desc" ? "-" : ""}${I.sort.key}` : "name",
897
+ page: I.page,
898
+ per_page: I.perPage
899
+ }), y();
900
+ } finally {
901
+ V.value = !1;
902
+ }
903
+ }
904
+ async function y() {
905
+ const I = n.resolveAvatar;
906
+ if (I)
907
+ for (const Z of $.value?.data ?? []) {
908
+ if (!Z.avatar || b.value[Z.avatar]) continue;
909
+ const B = await I(Z.avatar);
910
+ B && (b.value = { ...b.value, [Z.avatar]: B });
911
+ }
912
+ }
913
+ function p(I) {
914
+ return [
915
+ {
916
+ key: "delete",
917
+ icon: "trash",
918
+ label: c("admins.delete"),
919
+ danger: !0,
920
+ run: () => x("remove", I)
921
+ }
922
+ ];
923
+ }
924
+ function i(I) {
925
+ if (n.picking) {
926
+ x("chosen", [I]);
927
+ return;
928
+ }
929
+ x("open", I);
930
+ }
931
+ const T = R(() => !(n.picking && n.multiple));
932
+ function H(I, Z) {
933
+ E.value = Z, x("selection", Z);
934
+ }
935
+ return o({ reload: () => Y(L), chosen: () => E.value }), (I, Z) => (r(), G("div", {
936
+ ref_key: "root",
937
+ ref: m,
938
+ class: "wx-admin-list"
939
+ }, [
940
+ t(e(we), {
941
+ data: $.value,
942
+ columns: U.value,
943
+ "row-key": "id",
944
+ searchable: "",
945
+ clickable: T.value,
946
+ hover: T.value,
947
+ flush: "",
948
+ loading: V.value,
949
+ "search-placeholder": e(c)("admins.search"),
950
+ "empty-text": e(c)("admins.empty"),
951
+ selectable: l.picking && l.multiple,
952
+ "select-row-label": e(k)("filters.select-row"),
953
+ "select-all-label": e(k)("filters.select-all"),
954
+ "cards-below": We,
955
+ "filters-count": S.value.length,
956
+ "filters-label": e(k)("filters.title"),
957
+ onRowClick: i,
958
+ onStateChange: Y,
959
+ onSelectionChange: H
960
+ }, Me({
961
+ "cell-name": a(({ row: B }) => [
962
+ t(e(ce), {
963
+ size: "sm",
964
+ align: "center"
965
+ }, {
966
+ default: a(() => [
967
+ t(e(ra), {
968
+ name: B.name,
969
+ src: B.avatar ? b.value[B.avatar] : void 0,
970
+ size: "sm"
971
+ }, null, 8, ["name", "src"]),
972
+ M("span", null, d(B.name), 1),
973
+ B.is_super ? (r(), h(e(ee), {
974
+ key: 0,
975
+ type: "warning"
976
+ }, {
977
+ default: a(() => [
978
+ v(d(e(c)("admins.super")), 1)
979
+ ]),
980
+ _: 1
981
+ })) : O("", !0)
982
+ ]),
983
+ _: 2
984
+ }, 1024)
985
+ ]),
986
+ "cell-roles": a(({ row: B }) => [
987
+ B.roles.length > 0 ? (r(), h(e(ce), {
988
+ key: 0,
989
+ size: "xs",
990
+ wrap: ""
991
+ }, {
992
+ default: a(() => [
993
+ (r(!0), G(se, null, fe(B.roles, (K) => (r(), h(e(ee), {
994
+ key: K.id
995
+ }, {
996
+ default: a(() => [
997
+ v(d(K.name), 1)
998
+ ]),
999
+ _: 2
1000
+ }, 1024))), 128))
1001
+ ]),
1002
+ _: 2
1003
+ }, 1024)) : (r(), h(e(q), {
1004
+ key: 1,
1005
+ size: "sm",
1006
+ tone: "muted"
1007
+ }, {
1008
+ default: a(() => [
1009
+ v(d(e(c)("admins.no-roles")), 1)
1010
+ ]),
1011
+ _: 1
1012
+ }))
1013
+ ]),
1014
+ "cell-is_active": a(({ row: B }) => [
1015
+ t(e(ee), {
1016
+ type: B.is_active ? "success" : "default",
1017
+ dot: ""
1018
+ }, {
1019
+ default: a(() => [
1020
+ v(d(B.is_active ? e(c)("admins.active") : e(c)("admins.only-inactive")), 1)
1021
+ ]),
1022
+ _: 2
1023
+ }, 1032, ["type"])
1024
+ ]),
1025
+ "card-actions": a(({ row: B }) => [
1026
+ l.removable ? (r(), h(e(ze), {
1027
+ key: 0,
1028
+ actions: p(B),
1029
+ label: B.name
1030
+ }, null, 8, ["actions", "label"])) : O("", !0)
1031
+ ]),
1032
+ "cell-actions": a(({ row: B }) => [
1033
+ t(e(ze), {
1034
+ actions: p(B),
1035
+ label: B.name
1036
+ }, null, 8, ["actions", "label"])
1037
+ ]),
1038
+ "cell-last_login_at": a(({ row: B }) => [
1039
+ t(e(ue), {
1040
+ value: B.last_login_at,
1041
+ tone: B.last_login_at ? "default" : "muted",
1042
+ compact: ""
1043
+ }, null, 8, ["value", "tone"])
1044
+ ]),
1045
+ "cell-card": a(({ row: B }) => [
1046
+ t(e(xe), {
1047
+ variant: "plain",
1048
+ shape: "circle",
1049
+ title: B.name,
1050
+ image: B.avatar ? b.value[B.avatar] : void 0,
1051
+ subtitle: B.email
1052
+ }, {
1053
+ meta: a(() => [
1054
+ B.is_super ? (r(), h(e(ee), {
1055
+ key: 0,
1056
+ type: "warning",
1057
+ size: "sm"
1058
+ }, {
1059
+ default: a(() => [
1060
+ v(d(e(c)("admins.super")), 1)
1061
+ ]),
1062
+ _: 1
1063
+ })) : O("", !0),
1064
+ (r(!0), G(se, null, fe(B.roles, (K) => (r(), h(e(ee), {
1065
+ key: K.id,
1066
+ size: "sm"
1067
+ }, {
1068
+ default: a(() => [
1069
+ v(d(K.name), 1)
1070
+ ]),
1071
+ _: 2
1072
+ }, 1024))), 128)),
1073
+ t(e(ee), {
1074
+ type: B.is_active ? "success" : "default",
1075
+ dot: "",
1076
+ size: "sm"
1077
+ }, {
1078
+ default: a(() => [
1079
+ v(d(B.is_active ? e(c)("admins.active") : e(c)("admins.only-inactive")), 1)
1080
+ ]),
1081
+ _: 2
1082
+ }, 1032, ["type"])
1083
+ ]),
1084
+ _: 2
1085
+ }, 1032, ["title", "image", "subtitle"])
1086
+ ]),
1087
+ _: 2
1088
+ }, [
1089
+ l.filters ? {
1090
+ name: "filters",
1091
+ fn: a(() => [
1092
+ t(e(j), {
1093
+ label: e(c)("admins.filter-role")
1094
+ }, {
1095
+ default: a(() => [
1096
+ t(e(ie), {
1097
+ modelValue: w.value,
1098
+ "onUpdate:modelValue": Z[0] || (Z[0] = (B) => w.value = B),
1099
+ options: _.value,
1100
+ size: "sm"
1101
+ }, null, 8, ["modelValue", "options"])
1102
+ ]),
1103
+ _: 1
1104
+ }, 8, ["label"]),
1105
+ t(e(j), {
1106
+ label: e(c)("admins.filter-state")
1107
+ }, {
1108
+ default: a(() => [
1109
+ t(e(ie), {
1110
+ modelValue: C.value,
1111
+ "onUpdate:modelValue": Z[1] || (Z[1] = (B) => C.value = B),
1112
+ options: g.value,
1113
+ size: "sm"
1114
+ }, null, 8, ["modelValue", "options"])
1115
+ ]),
1116
+ _: 1
1117
+ }, 8, ["label"]),
1118
+ S.value.length > 0 ? (r(), h(e(X), {
1119
+ key: 0,
1120
+ variant: "text",
1121
+ size: "sm",
1122
+ block: "",
1123
+ onClick: F
1124
+ }, {
1125
+ icon: a(() => [
1126
+ t(e(ye), { name: "close" })
1127
+ ]),
1128
+ default: a(() => [
1129
+ v(" " + d(e(k)("filters.reset")), 1)
1130
+ ]),
1131
+ _: 1
1132
+ })) : O("", !0)
1133
+ ]),
1134
+ key: "0"
1135
+ } : void 0,
1136
+ l.filters ? {
1137
+ name: "applied",
1138
+ fn: a(() => [
1139
+ t(e(He), { filters: S.value }, null, 8, ["filters"])
1140
+ ]),
1141
+ key: "1"
1142
+ } : void 0
1143
+ ]), 1032, ["data", "columns", "clickable", "hover", "loading", "search-placeholder", "empty-text", "selectable", "select-row-label", "select-all-label", "filters-count", "filters-label"])
1144
+ ], 512));
1145
+ }
1146
+ }), Sa = { class: "wx-call-list__details" }, Ta = { class: "wx-call-list__label" }, Ua = {
1147
+ key: 1,
1148
+ class: "wx-call-list__arguments"
1149
+ }, La = {
1150
+ class: "wx-call-list__glyph",
1151
+ "aria-hidden": "true"
1152
+ }, Ra = {
1153
+ key: 2,
1154
+ class: "wx-call-list__arguments"
1155
+ }, Fe = 480, Wa = /* @__PURE__ */ ne({
1156
+ __name: "CallList",
1157
+ setup(l, { expose: o }) {
1158
+ const s = oe(), n = pe(s);
1159
+ re();
1160
+ const x = de("root"), f = ke(x), z = R(() => f.value > 0 && f.value < Fe), m = ae("webx-auth"), u = ae("webx-admin"), N = A(null), c = A({ users: [], tools: [] }), k = A(!1), $ = A("all"), W = A("all"), V = A("any");
1161
+ let w = { page: 1, perPage: 30, sort: null, search: "" };
1162
+ function C(y) {
1163
+ return y === null ? m("calls.local") : y.name ?? m("calls.deleted", { id: y.id });
1164
+ }
1165
+ const E = R(() => [
1166
+ { value: "all", label: m("calls.everybody") },
1167
+ ...c.value.users.map((y) => ({
1168
+ value: y.id === null ? "none" : String(y.id),
1169
+ label: C(y.id === null ? null : { id: y.id, name: y.name })
1170
+ }))
1171
+ ]), b = R(() => [
1172
+ { value: "all", label: m("calls.all-tools") },
1173
+ ...c.value.tools.map((y) => ({ value: y, label: y }))
1174
+ ]), L = R(() => [
1175
+ { value: "any", label: m("calls.any-outcome") },
1176
+ { value: "ok", label: m("calls.only-answered") },
1177
+ { value: "failed", label: m("calls.only-refused") },
1178
+ { value: "dry", label: m("calls.only-dry") }
1179
+ ]), _ = R(() => {
1180
+ const y = [], p = E.value.find((T) => T.value === $.value);
1181
+ $.value !== "all" && p && y.push({
1182
+ key: "user",
1183
+ label: `${m("calls.filter-user")}: ${p.label}`,
1184
+ clear: () => $.value = "all"
1185
+ }), W.value !== "all" && y.push({
1186
+ key: "tool",
1187
+ label: `${m("calls.filter-tool")}: ${W.value}`,
1188
+ clear: () => W.value = "all"
1189
+ });
1190
+ const i = L.value.find((T) => T.value === V.value);
1191
+ return V.value !== "any" && i && y.push({
1192
+ key: "outcome",
1193
+ label: `${m("calls.filter-outcome")}: ${i.label}`,
1194
+ clear: () => V.value = "any"
1195
+ }), y;
1196
+ });
1197
+ function g() {
1198
+ $.value = "all", W.value = "all", V.value = "any";
1199
+ }
1200
+ const S = R(() => z.value ? [{ key: "card", label: "" }] : [
1201
+ { key: "at", label: m("calls.when") },
1202
+ { key: "user", label: m("calls.who"), hideBelow: 640 },
1203
+ { key: "tool", label: m("calls.tool") },
1204
+ { key: "outcome", label: m("calls.outcome") },
1205
+ { key: "duration_ms", label: m("calls.took"), align: "right", hideBelow: 820 },
1206
+ { key: "client", label: m("calls.client"), hideBelow: 960 }
1207
+ ]);
1208
+ me([$, W, V], () => F({ ...w, page: 1 }));
1209
+ async function F(y) {
1210
+ w = y, k.value = !0;
1211
+ try {
1212
+ N.value = await n.calls({
1213
+ user: $.value === "all" ? null : $.value,
1214
+ tool: W.value === "all" ? null : W.value,
1215
+ outcome: V.value === "any" ? null : V.value,
1216
+ page: y.page,
1217
+ per_page: y.perPage
1218
+ }), c.value = N.value.filters;
1219
+ } finally {
1220
+ k.value = !1;
1221
+ }
1222
+ }
1223
+ function U(y) {
1224
+ return y.ok ? y.dry_run ? { type: "info", label: m("calls.dry-run") } : { type: "success", label: m("calls.answered") } : { type: "danger", label: m("calls.refused") };
1225
+ }
1226
+ function Y(y) {
1227
+ return y.arguments !== null || y.error !== null;
1228
+ }
1229
+ return o({ reload: () => F(w) }), (y, p) => (r(), G("div", {
1230
+ ref_key: "root",
1231
+ ref: x,
1232
+ class: "wx-call-list"
1233
+ }, [
1234
+ t(e(we), {
1235
+ data: N.value,
1236
+ columns: S.value,
1237
+ "row-key": "id",
1238
+ flush: "",
1239
+ loading: k.value,
1240
+ clickable: !1,
1241
+ expandable: !z.value,
1242
+ "expandable-if": Y,
1243
+ "empty-text": e(m)("calls.empty"),
1244
+ "cards-below": Fe,
1245
+ "filters-count": _.value.length,
1246
+ "filters-label": e(u)("filters.title"),
1247
+ onStateChange: F
1248
+ }, {
1249
+ filters: a(() => [
1250
+ t(e(j), {
1251
+ label: e(m)("calls.filter-user")
1252
+ }, {
1253
+ default: a(() => [
1254
+ t(e(ie), {
1255
+ modelValue: $.value,
1256
+ "onUpdate:modelValue": p[0] || (p[0] = (i) => $.value = i),
1257
+ options: E.value,
1258
+ size: "sm"
1259
+ }, null, 8, ["modelValue", "options"])
1260
+ ]),
1261
+ _: 1
1262
+ }, 8, ["label"]),
1263
+ t(e(j), {
1264
+ label: e(m)("calls.filter-tool")
1265
+ }, {
1266
+ default: a(() => [
1267
+ t(e(ie), {
1268
+ modelValue: W.value,
1269
+ "onUpdate:modelValue": p[1] || (p[1] = (i) => W.value = i),
1270
+ options: b.value,
1271
+ size: "sm"
1272
+ }, null, 8, ["modelValue", "options"])
1273
+ ]),
1274
+ _: 1
1275
+ }, 8, ["label"]),
1276
+ t(e(j), {
1277
+ label: e(m)("calls.filter-outcome")
1278
+ }, {
1279
+ default: a(() => [
1280
+ t(e(ie), {
1281
+ modelValue: V.value,
1282
+ "onUpdate:modelValue": p[2] || (p[2] = (i) => V.value = i),
1283
+ options: L.value,
1284
+ size: "sm"
1285
+ }, null, 8, ["modelValue", "options"])
1286
+ ]),
1287
+ _: 1
1288
+ }, 8, ["label"]),
1289
+ _.value.length > 0 ? (r(), h(e(X), {
1290
+ key: 0,
1291
+ variant: "text",
1292
+ size: "sm",
1293
+ block: "",
1294
+ onClick: g
1295
+ }, {
1296
+ icon: a(() => [
1297
+ t(e(ye), { name: "close" })
1298
+ ]),
1299
+ default: a(() => [
1300
+ v(" " + d(e(u)("filters.reset")), 1)
1301
+ ]),
1302
+ _: 1
1303
+ })) : O("", !0)
1304
+ ]),
1305
+ applied: a(() => [
1306
+ t(e(He), { filters: _.value }, null, 8, ["filters"])
1307
+ ]),
1308
+ "cell-at": a(({ row: i }) => [
1309
+ t(e(ue), {
1310
+ value: i.at,
1311
+ tone: "default",
1312
+ compact: ""
1313
+ }, null, 8, ["value"])
1314
+ ]),
1315
+ "cell-user": a(({ row: i }) => [
1316
+ t(e(q), {
1317
+ tone: i.user === null || i.user.name === null ? "muted" : "default"
1318
+ }, {
1319
+ default: a(() => [
1320
+ v(d(C(i.user)), 1)
1321
+ ]),
1322
+ _: 2
1323
+ }, 1032, ["tone"])
1324
+ ]),
1325
+ "cell-tool": a(({ row: i }) => [
1326
+ t(e(q), {
1327
+ mono: "",
1328
+ size: "sm"
1329
+ }, {
1330
+ default: a(() => [
1331
+ v(d(i.tool), 1)
1332
+ ]),
1333
+ _: 2
1334
+ }, 1024)
1335
+ ]),
1336
+ "cell-outcome": a(({ row: i }) => [
1337
+ t(e(ee), {
1338
+ type: U(i).type,
1339
+ dot: ""
1340
+ }, {
1341
+ default: a(() => [
1342
+ v(d(U(i).label), 1)
1343
+ ]),
1344
+ _: 2
1345
+ }, 1032, ["type"])
1346
+ ]),
1347
+ "cell-duration_ms": a(({ row: i }) => [
1348
+ t(e(q), {
1349
+ size: "sm",
1350
+ tone: "muted"
1351
+ }, {
1352
+ default: a(() => [
1353
+ v(d(e(m)("calls.ms", { count: i.duration_ms })), 1)
1354
+ ]),
1355
+ _: 2
1356
+ }, 1024)
1357
+ ]),
1358
+ "cell-client": a(({ row: i }) => [
1359
+ i.client ? (r(), h(e(q), {
1360
+ key: 0,
1361
+ size: "sm"
1362
+ }, {
1363
+ default: a(() => [
1364
+ v(d(i.client), 1)
1365
+ ]),
1366
+ _: 2
1367
+ }, 1024)) : (r(), h(e(q), {
1368
+ key: 1,
1369
+ size: "sm",
1370
+ tone: "muted"
1371
+ }, {
1372
+ default: a(() => [...p[3] || (p[3] = [
1373
+ v("—", -1)
1374
+ ])]),
1375
+ _: 1
1376
+ }))
1377
+ ]),
1378
+ expanded: a(({ row: i }) => [
1379
+ M("div", Sa, [
1380
+ i.error ? (r(), h(e(q), {
1381
+ key: 0,
1382
+ tone: "danger",
1383
+ size: "sm",
1384
+ class: "wx-call-list__error"
1385
+ }, {
1386
+ default: a(() => [
1387
+ M("strong", null, d(e(m)("calls.error")) + ":", 1),
1388
+ v(" " + d(i.error), 1)
1389
+ ]),
1390
+ _: 2
1391
+ }, 1024)) : O("", !0),
1392
+ M("div", Ta, [
1393
+ t(e(q), {
1394
+ size: "sm",
1395
+ weight: "semibold"
1396
+ }, {
1397
+ default: a(() => [
1398
+ v(d(e(m)("calls.request")), 1)
1399
+ ]),
1400
+ _: 1
1401
+ }),
1402
+ t(e(q), {
1403
+ size: "xs",
1404
+ tone: "muted"
1405
+ }, {
1406
+ default: a(() => [
1407
+ v(d(e(m)("calls.request-hint")), 1)
1408
+ ]),
1409
+ _: 1
1410
+ })
1411
+ ]),
1412
+ i.arguments ? (r(), G("pre", Ua, d(i.arguments), 1)) : (r(), h(e(q), {
1413
+ key: 2,
1414
+ size: "sm",
1415
+ tone: "muted"
1416
+ }, {
1417
+ default: a(() => [
1418
+ v(d(e(m)("calls.no-arguments")), 1)
1419
+ ]),
1420
+ _: 1
1421
+ }))
1422
+ ])
1423
+ ]),
1424
+ "cell-card": a(({ row: i }) => [
1425
+ t(e(xe), {
1426
+ variant: "plain",
1427
+ title: i.tool,
1428
+ subtitle: C(i.user)
1429
+ }, {
1430
+ media: a(() => [
1431
+ M("span", La, [
1432
+ t(e(ye), { name: "sliders" })
1433
+ ])
1434
+ ]),
1435
+ meta: a(() => [
1436
+ t(e(ee), {
1437
+ type: U(i).type,
1438
+ dot: "",
1439
+ size: "sm"
1440
+ }, {
1441
+ default: a(() => [
1442
+ v(d(U(i).label), 1)
1443
+ ]),
1444
+ _: 2
1445
+ }, 1032, ["type"]),
1446
+ t(e(ue), {
1447
+ value: i.at,
1448
+ compact: ""
1449
+ }, null, 8, ["value"]),
1450
+ i.client ? (r(), h(e(q), {
1451
+ key: 0,
1452
+ size: "xs",
1453
+ tone: "muted"
1454
+ }, {
1455
+ default: a(() => [
1456
+ v(d(i.client), 1)
1457
+ ]),
1458
+ _: 2
1459
+ }, 1024)) : O("", !0)
1460
+ ]),
1461
+ default: a(() => [
1462
+ Y(i) ? (r(), h(e(ce), {
1463
+ key: 0,
1464
+ direction: "vertical",
1465
+ size: "xs",
1466
+ class: "wx-call-list__card-details"
1467
+ }, {
1468
+ default: a(() => [
1469
+ i.error ? (r(), h(e(q), {
1470
+ key: 0,
1471
+ tone: "danger",
1472
+ size: "sm"
1473
+ }, {
1474
+ default: a(() => [
1475
+ v(d(i.error), 1)
1476
+ ]),
1477
+ _: 2
1478
+ }, 1024)) : O("", !0),
1479
+ i.arguments ? (r(), h(e(q), {
1480
+ key: 1,
1481
+ size: "xs",
1482
+ tone: "muted"
1483
+ }, {
1484
+ default: a(() => [
1485
+ v(d(e(m)("calls.request")), 1)
1486
+ ]),
1487
+ _: 1
1488
+ })) : O("", !0),
1489
+ i.arguments ? (r(), G("pre", Ra, d(i.arguments), 1)) : O("", !0)
1490
+ ]),
1491
+ _: 2
1492
+ }, 1024)) : O("", !0)
1493
+ ]),
1494
+ _: 2
1495
+ }, 1032, ["title", "subtitle"])
1496
+ ]),
1497
+ _: 1
1498
+ }, 8, ["data", "columns", "loading", "expandable", "empty-text", "filters-count", "filters-label"])
1499
+ ], 512));
1500
+ }
1501
+ });
1502
+ function Fa(l) {
1503
+ const o = `${l.apiPath}/auth/connections`;
1504
+ return {
1505
+ list: (s = "mine") => l.http.get(o, { query: { all: s === "all" ? 1 : void 0 } }).then((n) => ({
1506
+ data: n.data,
1507
+ scope: n.meta.scope,
1508
+ canSeeEverybody: n.meta.can_see_everybody
1509
+ })),
1510
+ disconnect: (s) => l.http.delete(`${o}/${s}`).then((n) => n.data)
1511
+ };
1512
+ }
1513
+ const Pa = {
1514
+ class: "wx-connection-list__glyph",
1515
+ "aria-hidden": "true"
1516
+ }, Pe = 560, Ba = /* @__PURE__ */ ne({
1517
+ __name: "ConnectionList",
1518
+ props: {
1519
+ scope: { default: "mine" }
1520
+ },
1521
+ setup(l, { expose: o }) {
1522
+ const s = l, n = oe(), x = Fa(n);
1523
+ re();
1524
+ const f = ae("webx-auth"), z = ve(), m = de("root"), u = ke(m), N = R(() => u.value > 0 && u.value < Pe), c = A([]), k = A(!1), $ = A(null), W = R(() => N.value ? [{ key: "card", label: "" }] : [
1525
+ { key: "client", label: f("connections.client"), minWidth: 210 },
1526
+ ...s.scope === "all" ? [{ key: "user", label: f("connections.who"), minWidth: 140 }] : [],
1527
+ { key: "read_only", label: f("connections.allowed"), minWidth: 160 },
1528
+ { key: "connected_at", label: f("connections.connected"), hideBelow: 860 },
1529
+ { key: "last_used_at", label: f("connections.last-used"), minWidth: 130 },
1530
+ { key: "end", label: "", align: "right", width: 140 }
1531
+ ]);
1532
+ function V(b) {
1533
+ return b.user.name ?? f("calls.deleted", { id: b.user.id });
1534
+ }
1535
+ function w(b) {
1536
+ if (b.read_only) return f("connections.read-only");
1537
+ if (s.scope !== "all") return f("connections.full-you");
1538
+ const L = b.user.name?.split(" ")[0];
1539
+ return f("connections.full", { name: L || V(b) });
1540
+ }
1541
+ async function C() {
1542
+ k.value = !0;
1543
+ try {
1544
+ c.value = (await x.list(s.scope)).data;
1545
+ } catch (b) {
1546
+ Q.danger(z(b));
1547
+ } finally {
1548
+ k.value = !1;
1549
+ }
1550
+ }
1551
+ async function E(b) {
1552
+ if (await Ve({
1553
+ title: f("connections.confirm-title", { client: b.client }),
1554
+ message: f("connections.confirm-text"),
1555
+ confirmText: f("connections.confirm"),
1556
+ cancelText: f("connections.cancel"),
1557
+ tone: "danger"
1558
+ })) {
1559
+ $.value = b.id;
1560
+ try {
1561
+ const _ = await x.disconnect(b.id);
1562
+ c.value = c.value.map((g) => g.id === _.id ? _ : g), Q.success(f("connections.done", { client: b.client }));
1563
+ } catch (_) {
1564
+ Q.danger(z(_));
1565
+ } finally {
1566
+ $.value = null;
1567
+ }
1568
+ }
1569
+ }
1570
+ return me(() => s.scope, C, { immediate: !0 }), o({ reload: C }), (b, L) => (r(), G("div", {
1571
+ ref_key: "root",
1572
+ ref: m,
1573
+ class: "wx-connection-list"
1574
+ }, [
1575
+ t(e(we), {
1576
+ data: c.value,
1577
+ columns: W.value,
1578
+ "row-key": "id",
1579
+ flush: "",
1580
+ loading: k.value,
1581
+ clickable: !1,
1582
+ "empty-text": l.scope === "all" ? e(f)("connections.empty-all") : e(f)("connections.empty"),
1583
+ "cards-below": Pe,
1584
+ "row-class": (_) => _.revoked_at ? "is-ended" : ""
1585
+ }, {
1586
+ "cell-client": a(({ row: _ }) => [
1587
+ t(e(ce), {
1588
+ direction: "vertical",
1589
+ size: "none"
1590
+ }, {
1591
+ default: a(() => [
1592
+ t(e(q), {
1593
+ tone: _.revoked_at ? "muted" : "default",
1594
+ weight: "medium"
1595
+ }, {
1596
+ default: a(() => [
1597
+ v(d(_.client), 1)
1598
+ ]),
1599
+ _: 2
1600
+ }, 1032, ["tone"]),
1601
+ t(e(q), {
1602
+ size: "xs",
1603
+ tone: "muted"
1604
+ }, {
1605
+ default: a(() => [
1606
+ v(d(e(f)("connections.returns-to", { host: _.host })), 1)
1607
+ ]),
1608
+ _: 2
1609
+ }, 1024)
1610
+ ]),
1611
+ _: 2
1612
+ }, 1024)
1613
+ ]),
1614
+ "cell-user": a(({ row: _ }) => [
1615
+ t(e(q), {
1616
+ tone: _.user.name === null ? "muted" : "default"
1617
+ }, {
1618
+ default: a(() => [
1619
+ v(d(V(_)), 1)
1620
+ ]),
1621
+ _: 2
1622
+ }, 1032, ["tone"])
1623
+ ]),
1624
+ "cell-read_only": a(({ row: _ }) => [
1625
+ _.revoked_at ? (r(), h(e(ee), {
1626
+ key: 0,
1627
+ type: "default",
1628
+ dot: ""
1629
+ }, {
1630
+ default: a(() => [
1631
+ v(d(e(f)("connections.disconnected")), 1)
1632
+ ]),
1633
+ _: 1
1634
+ })) : (r(), h(e(ee), {
1635
+ key: 1,
1636
+ type: _.read_only ? "info" : "success",
1637
+ dot: ""
1638
+ }, {
1639
+ default: a(() => [
1640
+ v(d(w(_)), 1)
1641
+ ]),
1642
+ _: 2
1643
+ }, 1032, ["type"]))
1644
+ ]),
1645
+ "cell-connected_at": a(({ row: _ }) => [
1646
+ t(e(ue), {
1647
+ value: _.connected_at,
1648
+ tone: "muted",
1649
+ compact: ""
1650
+ }, null, 8, ["value"])
1651
+ ]),
1652
+ "cell-last_used_at": a(({ row: _ }) => [
1653
+ _.last_used_at ? (r(), h(e(ue), {
1654
+ key: 0,
1655
+ value: _.last_used_at,
1656
+ tone: "default",
1657
+ compact: ""
1658
+ }, null, 8, ["value"])) : (r(), h(e(q), {
1659
+ key: 1,
1660
+ size: "sm",
1661
+ tone: "muted"
1662
+ }, {
1663
+ default: a(() => [
1664
+ v(d(e(f)("connections.never-used")), 1)
1665
+ ]),
1666
+ _: 1
1667
+ }))
1668
+ ]),
1669
+ "cell-end": a(({ row: _ }) => [
1670
+ _.revoked_at ? O("", !0) : (r(), h(e(X), {
1671
+ key: 0,
1672
+ type: "danger",
1673
+ variant: "text",
1674
+ size: "sm",
1675
+ loading: $.value === _.id,
1676
+ onClick: (g) => E(_)
1677
+ }, {
1678
+ default: a(() => [
1679
+ v(d(e(f)("connections.disconnect")), 1)
1680
+ ]),
1681
+ _: 1
1682
+ }, 8, ["loading", "onClick"]))
1683
+ ]),
1684
+ "cell-card": a(({ row: _ }) => [
1685
+ t(e(xe), {
1686
+ variant: "plain",
1687
+ title: _.client,
1688
+ subtitle: e(f)("connections.returns-to", { host: _.host })
1689
+ }, {
1690
+ media: a(() => [
1691
+ M("span", Pa, [
1692
+ t(e(ye), { name: "link" })
1693
+ ])
1694
+ ]),
1695
+ meta: a(() => [
1696
+ _.revoked_at ? (r(), h(e(ee), {
1697
+ key: 0,
1698
+ type: "default",
1699
+ dot: "",
1700
+ size: "sm"
1701
+ }, {
1702
+ default: a(() => [
1703
+ v(d(e(f)("connections.disconnected")), 1)
1704
+ ]),
1705
+ _: 1
1706
+ })) : (r(), h(e(ee), {
1707
+ key: 1,
1708
+ type: _.read_only ? "info" : "success",
1709
+ dot: "",
1710
+ size: "sm"
1711
+ }, {
1712
+ default: a(() => [
1713
+ v(d(w(_)), 1)
1714
+ ]),
1715
+ _: 2
1716
+ }, 1032, ["type"])),
1717
+ l.scope === "all" ? (r(), h(e(q), {
1718
+ key: 2,
1719
+ size: "xs",
1720
+ tone: "muted"
1721
+ }, {
1722
+ default: a(() => [
1723
+ v(d(V(_)), 1)
1724
+ ]),
1725
+ _: 2
1726
+ }, 1024)) : O("", !0),
1727
+ _.last_used_at ? (r(), h(e(ue), {
1728
+ key: 3,
1729
+ value: _.last_used_at,
1730
+ compact: ""
1731
+ }, null, 8, ["value"])) : (r(), h(e(q), {
1732
+ key: 4,
1733
+ size: "xs",
1734
+ tone: "muted"
1735
+ }, {
1736
+ default: a(() => [
1737
+ v(d(e(f)("connections.never-used")), 1)
1738
+ ]),
1739
+ _: 1
1740
+ }))
1741
+ ]),
1742
+ actions: a(() => [
1743
+ _.revoked_at ? O("", !0) : (r(), h(e(X), {
1744
+ key: 0,
1745
+ type: "danger",
1746
+ variant: "text",
1747
+ size: "sm",
1748
+ loading: $.value === _.id,
1749
+ onClick: (g) => E(_)
1750
+ }, {
1751
+ default: a(() => [
1752
+ v(d(e(f)("connections.disconnect")), 1)
1753
+ ]),
1754
+ _: 1
1755
+ }, 8, ["loading", "onClick"]))
1756
+ ]),
1757
+ _: 2
1758
+ }, 1032, ["title", "subtitle"])
1759
+ ]),
1760
+ _: 1
1761
+ }, 8, ["data", "columns", "loading", "empty-text", "row-class"])
1762
+ ], 512));
1763
+ }
1764
+ });
1765
+ async function Oa(l) {
1766
+ try {
1767
+ if (navigator.clipboard?.writeText)
1768
+ return await navigator.clipboard.writeText(l), !0;
1769
+ } catch {
1770
+ }
1771
+ return Ea(l);
1772
+ }
1773
+ function Ea(l) {
1774
+ const o = document.createElement("textarea");
1775
+ o.value = l, o.setAttribute("readonly", ""), o.style.position = "fixed", o.style.opacity = "0", document.body.append(o), o.select();
1776
+ try {
1777
+ return document.execCommand("copy");
1778
+ } catch {
1779
+ return !1;
1780
+ } finally {
1781
+ o.remove();
1782
+ }
1783
+ }
1784
+ function la(l) {
1785
+ const o = `${l.apiPath}/auth/keys`;
1786
+ return {
1787
+ list: (s) => l.http.get(
1788
+ o,
1789
+ ...s?.mine ? [{ query: { mine: 1 } }] : []
1790
+ ).then((n) => ({
1791
+ data: n.data,
1792
+ scopes: n.meta.scopes,
1793
+ maxDays: n.meta.max_days
1794
+ })),
1795
+ scopesFor: (s) => l.http.get(`${o}/scopes`, { query: { admin: s } }).then((n) => n.data),
1796
+ issue: (s) => l.http.post(o, s).then((n) => ({ key: n.data, token: n.token })),
1797
+ revoke: (s) => l.http.delete(`${o}/${s}`).then((n) => n.data)
1798
+ };
1799
+ }
1800
+ const Na = {
1801
+ key: 0,
1802
+ class: "wx-key-dialog"
1803
+ }, Da = { class: "wx-key-dialog__secret" }, Ia = {
1804
+ key: 1,
1805
+ class: "wx-key-dialog"
1806
+ }, qa = /* @__PURE__ */ ne({
1807
+ __name: "KeyDialog",
1808
+ props: {
1809
+ mine: { type: Boolean, default: !1 }
1810
+ },
1811
+ setup(l) {
1812
+ const o = l, { open: s, resolve: n, dismiss: x } = ge(), f = oe(), z = la(f), m = pe(f);
1813
+ re();
1814
+ const u = ae("webx-auth"), N = ve(), c = [30, 90, 365, 1095, 3650], k = A({
1815
+ name: "",
1816
+ admin: o.mine && Number(f.state.user?.id) || null,
1817
+ access: "everything",
1818
+ scopes: [],
1819
+ days: 365
1820
+ }), $ = A([]), W = A([]), V = A(!1), w = A({}), C = A(null), E = A(!1), b = R(
1821
+ () => $.value.filter((y) => y !== "mcp:use").map((y) => ({ value: y, label: y }))
1822
+ ), L = R(() => [
1823
+ { value: "everything", label: u("keys.everything") },
1824
+ { value: "chosen", label: u("keys.chosen") }
1825
+ ]), _ = R(
1826
+ () => c.map((y) => ({ value: y, label: u(`keys.days-${y}`) }))
1827
+ ), g = R(() => {
1828
+ const y = f.state.manifest?.modules.find((p) => p.id === "connect")?.meta;
1829
+ return typeof y?.url == "string" ? y.url : "";
1830
+ });
1831
+ me(
1832
+ () => k.value.admin,
1833
+ (y) => {
1834
+ if (o.mine) {
1835
+ z.scopesFor().then(
1836
+ (p) => $.value = p,
1837
+ (p) => Q.danger(N(p))
1838
+ );
1839
+ return;
1840
+ }
1841
+ if (y === null) {
1842
+ $.value = [];
1843
+ return;
1844
+ }
1845
+ z.scopesFor(y).then(
1846
+ (p) => {
1847
+ k.value.admin === y && ($.value = p, k.value.scopes = k.value.scopes.filter((i) => p.includes(i)));
1848
+ },
1849
+ (p) => Q.danger(N(p))
1850
+ );
1851
+ },
1852
+ { immediate: o.mine }
1853
+ ), o.mine || m.list({ active: "yes", per_page: 100, sort: "name" }).then(
1854
+ (y) => W.value = y.data.map((p) => ({
1855
+ value: p.id,
1856
+ label: `${p.name} · ${p.email}`
1857
+ })),
1858
+ (y) => Q.danger(N(y))
1859
+ );
1860
+ function S(y) {
1861
+ return w.value[y]?.[0] ?? w.value[`${y}.0`]?.[0];
1862
+ }
1863
+ async function F() {
1864
+ if (w.value = {}, k.value.access === "chosen" && k.value.scopes.length === 0) {
1865
+ w.value = { scopes: [u("keys.scopes-required")] };
1866
+ return;
1867
+ }
1868
+ V.value = !0;
1869
+ try {
1870
+ C.value = await z.issue({
1871
+ name: k.value.name,
1872
+ admin: k.value.admin ?? 0,
1873
+ scopes: k.value.access === "chosen" ? k.value.scopes : [],
1874
+ days: k.value.days
1875
+ });
1876
+ } catch (y) {
1877
+ const p = y.body;
1878
+ p?.errors ? w.value = p.errors : Q.danger(N(y));
1879
+ } finally {
1880
+ V.value = !1;
1881
+ }
1882
+ }
1883
+ async function U() {
1884
+ C.value !== null && (await Oa(C.value.token) ? E.value = !0 : Q.danger(u("keys.copy-failed")));
1885
+ }
1886
+ function Y() {
1887
+ C.value ? n(C.value.key) : x();
1888
+ }
1889
+ return (y, p) => (r(), h(e(_e), {
1890
+ open: e(s),
1891
+ title: C.value ? e(u)("keys.issued-title") : e(u)("keys.issue"),
1892
+ width: 640,
1893
+ "onUpdate:open": p[5] || (p[5] = (i) => i ? void 0 : Y())
1894
+ }, {
1895
+ footer: a(() => [
1896
+ t(e(ce), { size: "sm" }, {
1897
+ default: a(() => [
1898
+ C.value ? (r(), h(e(X), {
1899
+ key: 0,
1900
+ type: "primary",
1901
+ onClick: Y
1902
+ }, {
1903
+ default: a(() => [
1904
+ v(d(e(u)("keys.done")), 1)
1905
+ ]),
1906
+ _: 1
1907
+ })) : (r(), G(se, { key: 1 }, [
1908
+ t(e(X), {
1909
+ variant: "outline",
1910
+ onClick: Y
1911
+ }, {
1912
+ default: a(() => [
1913
+ v(d(e(u)("keys.cancel")), 1)
1914
+ ]),
1915
+ _: 1
1916
+ }),
1917
+ t(e(X), {
1918
+ type: "primary",
1919
+ loading: V.value,
1920
+ onClick: F
1921
+ }, {
1922
+ default: a(() => [
1923
+ v(d(e(u)("keys.issue-short")), 1)
1924
+ ]),
1925
+ _: 1
1926
+ }, 8, ["loading"])
1927
+ ], 64))
1928
+ ]),
1929
+ _: 1
1930
+ })
1931
+ ]),
1932
+ default: a(() => [
1933
+ C.value ? (r(), G("div", Na, [
1934
+ t(e(Ae), {
1935
+ type: "warning",
1936
+ closable: !1
1937
+ }, {
1938
+ default: a(() => [
1939
+ v(d(e(u)("keys.issued-text")), 1)
1940
+ ]),
1941
+ _: 1
1942
+ }),
1943
+ t(e(j), {
1944
+ label: e(u)("keys.secret")
1945
+ }, {
1946
+ default: a(() => [
1947
+ M("div", Da, [
1948
+ t(e(te), {
1949
+ "model-value": C.value.token,
1950
+ readonly: "",
1951
+ name: "token"
1952
+ }, null, 8, ["model-value"]),
1953
+ t(e(X), {
1954
+ type: "primary",
1955
+ onClick: U
1956
+ }, {
1957
+ icon: a(() => [
1958
+ t(e(ye), {
1959
+ name: E.value ? "check" : "copy"
1960
+ }, null, 8, ["name"])
1961
+ ]),
1962
+ default: a(() => [
1963
+ v(" " + d(E.value ? e(u)("keys.copied") : e(u)("keys.copy")), 1)
1964
+ ]),
1965
+ _: 1
1966
+ })
1967
+ ])
1968
+ ]),
1969
+ _: 1
1970
+ }, 8, ["label"]),
1971
+ g.value ? (r(), h(e(j), {
1972
+ key: 0,
1973
+ label: e(u)("keys.address")
1974
+ }, {
1975
+ default: a(() => [
1976
+ t(e(te), {
1977
+ "model-value": g.value,
1978
+ readonly: "",
1979
+ name: "address"
1980
+ }, null, 8, ["model-value"])
1981
+ ]),
1982
+ _: 1
1983
+ }, 8, ["label"])) : O("", !0),
1984
+ t(e(q), {
1985
+ size: "sm",
1986
+ tone: "muted"
1987
+ }, {
1988
+ default: a(() => [
1989
+ v(d(e(u)("keys.header-hint")), 1)
1990
+ ]),
1991
+ _: 1
1992
+ })
1993
+ ])) : (r(), G("div", Ia, [
1994
+ t(e(q), {
1995
+ size: "sm",
1996
+ tone: "muted"
1997
+ }, {
1998
+ default: a(() => [
1999
+ v(d(e(u)(o.mine ? "keys.lead-mine" : "keys.lead")), 1)
2000
+ ]),
2001
+ _: 1
2002
+ }),
2003
+ t(e(j), {
2004
+ label: e(u)("keys.name"),
2005
+ error: S("name"),
2006
+ help: e(u)("keys.name-hint")
2007
+ }, {
2008
+ default: a(() => [
2009
+ t(e(te), {
2010
+ modelValue: k.value.name,
2011
+ "onUpdate:modelValue": p[0] || (p[0] = (i) => k.value.name = i),
2012
+ name: "name",
2013
+ autocomplete: "off"
2014
+ }, null, 8, ["modelValue"])
2015
+ ]),
2016
+ _: 1
2017
+ }, 8, ["label", "error", "help"]),
2018
+ o.mine ? O("", !0) : (r(), h(e(j), {
2019
+ key: 0,
2020
+ label: e(u)("keys.who"),
2021
+ error: S("admin"),
2022
+ help: e(u)("keys.who-hint")
2023
+ }, {
2024
+ default: a(() => [
2025
+ t(e(ie), {
2026
+ modelValue: k.value.admin,
2027
+ "onUpdate:modelValue": p[1] || (p[1] = (i) => k.value.admin = i),
2028
+ options: W.value,
2029
+ filterable: "",
2030
+ name: "admin"
2031
+ }, null, 8, ["modelValue", "options"])
2032
+ ]),
2033
+ _: 1
2034
+ }, 8, ["label", "error", "help"])),
2035
+ t(e(j), {
2036
+ label: e(u)("keys.allowed")
2037
+ }, {
2038
+ default: a(() => [
2039
+ t(e(ua), {
2040
+ modelValue: k.value.access,
2041
+ "onUpdate:modelValue": p[2] || (p[2] = (i) => k.value.access = i),
2042
+ options: L.value,
2043
+ name: "access"
2044
+ }, null, 8, ["modelValue", "options"])
2045
+ ]),
2046
+ _: 1
2047
+ }, 8, ["label"]),
2048
+ k.value.access === "chosen" ? (r(), h(e(j), {
2049
+ key: 1,
2050
+ label: e(u)("keys.scopes"),
2051
+ error: S("scopes"),
2052
+ help: e(u)("keys.scopes-hint")
2053
+ }, {
2054
+ default: a(() => [
2055
+ t(e(ie), {
2056
+ modelValue: k.value.scopes,
2057
+ "onUpdate:modelValue": p[3] || (p[3] = (i) => k.value.scopes = i),
2058
+ options: b.value,
2059
+ multiple: "",
2060
+ filterable: "",
2061
+ name: "scopes"
2062
+ }, null, 8, ["modelValue", "options"])
2063
+ ]),
2064
+ _: 1
2065
+ }, 8, ["label", "error", "help"])) : O("", !0),
2066
+ t(e(j), {
2067
+ label: e(u)("keys.lifetime"),
2068
+ error: S("days"),
2069
+ help: e(u)("keys.lifetime-hint")
2070
+ }, {
2071
+ default: a(() => [
2072
+ t(e(ie), {
2073
+ modelValue: k.value.days,
2074
+ "onUpdate:modelValue": p[4] || (p[4] = (i) => k.value.days = i),
2075
+ options: _.value,
2076
+ name: "days"
2077
+ }, null, 8, ["modelValue", "options"])
2078
+ ]),
2079
+ _: 1
2080
+ }, 8, ["label", "error", "help"])
2081
+ ]))
2082
+ ]),
2083
+ _: 1
2084
+ }, 8, ["open", "title"]));
2085
+ }
2086
+ }), Ma = {
2087
+ class: "wx-key-list__glyph",
2088
+ "aria-hidden": "true"
2089
+ }, Be = 560, Ka = /* @__PURE__ */ ne({
2090
+ __name: "KeyList",
2091
+ props: {
2092
+ mine: { type: Boolean, default: !1 }
2093
+ },
2094
+ setup(l, { expose: o }) {
2095
+ const s = l, n = oe(), x = la(n);
2096
+ re();
2097
+ const f = ae("webx-auth"), z = ve(), m = de("root"), u = ke(m), N = R(() => u.value > 0 && u.value < Be), c = A([]), k = A(!1), $ = A(null), W = R(() => N.value ? [{ key: "card", label: "" }] : [
2098
+ { key: "name", label: f("keys.name"), minWidth: 200 },
2099
+ ...s.mine ? [] : [{ key: "user", label: f("keys.who"), minWidth: 140 }],
2100
+ { key: "scopes", label: f("keys.allowed"), minWidth: 180 },
2101
+ { key: "expires_at", label: f("keys.expires"), minWidth: 120 },
2102
+ { key: "last_used_at", label: f("keys.last-used"), minWidth: 120, hideBelow: 860 },
2103
+ { key: "end", label: "", align: "right", width: 120 }
2104
+ ]);
2105
+ function V(L) {
2106
+ return L.user.name ?? f("keys.deleted", { id: L.user.id });
2107
+ }
2108
+ function w(L) {
2109
+ return L.created_by?.name ? f("keys.issued-by", { name: L.created_by.name }) : f("keys.issued-console");
2110
+ }
2111
+ function C(L) {
2112
+ return L.everything ? f("keys.full", { name: L.user.name?.split(" ")[0] || V(L) }) : L.scopes.join(", ");
2113
+ }
2114
+ async function E() {
2115
+ k.value = !0;
2116
+ try {
2117
+ c.value = (await x.list({ mine: s.mine })).data;
2118
+ } catch (L) {
2119
+ Q.danger(z(L));
2120
+ } finally {
2121
+ k.value = !1;
2122
+ }
2123
+ }
2124
+ async function b(L) {
2125
+ if (await Ve({
2126
+ title: f("keys.confirm-title", { name: L.name }),
2127
+ message: f("keys.confirm-text"),
2128
+ confirmText: f("keys.confirm"),
2129
+ cancelText: f("keys.cancel"),
2130
+ tone: "danger"
2131
+ })) {
2132
+ $.value = L.id;
2133
+ try {
2134
+ const g = await x.revoke(L.id);
2135
+ c.value = c.value.map((S) => S.id === g.id ? g : S), Q.success(f("keys.revoked-done", { name: L.name }));
2136
+ } catch (g) {
2137
+ Q.danger(z(g));
2138
+ } finally {
2139
+ $.value = null;
2140
+ }
2141
+ }
2142
+ }
2143
+ return oa(E), o({ reload: E }), (L, _) => (r(), G("div", {
2144
+ ref_key: "root",
2145
+ ref: m,
2146
+ class: "wx-key-list"
2147
+ }, [
2148
+ t(e(we), {
2149
+ data: c.value,
2150
+ columns: W.value,
2151
+ "row-key": "id",
2152
+ flush: "",
2153
+ loading: k.value,
2154
+ clickable: !1,
2155
+ "empty-text": e(f)(s.mine ? "keys.empty-mine" : "keys.empty"),
2156
+ "cards-below": Be,
2157
+ "row-class": (g) => g.state === "live" ? "" : "is-ended"
2158
+ }, {
2159
+ "cell-name": a(({ row: g }) => [
2160
+ t(e(ce), {
2161
+ direction: "vertical",
2162
+ size: "none"
2163
+ }, {
2164
+ default: a(() => [
2165
+ t(e(q), {
2166
+ tone: g.state === "live" ? "default" : "muted",
2167
+ weight: "medium"
2168
+ }, {
2169
+ default: a(() => [
2170
+ v(d(g.name), 1)
2171
+ ]),
2172
+ _: 2
2173
+ }, 1032, ["tone"]),
2174
+ t(e(q), {
2175
+ size: "xs",
2176
+ tone: "muted"
2177
+ }, {
2178
+ default: a(() => [
2179
+ v(d(w(g)) + " · ", 1),
2180
+ t(e(ue), {
2181
+ value: g.created_at,
2182
+ tone: "muted",
2183
+ compact: ""
2184
+ }, null, 8, ["value"])
2185
+ ]),
2186
+ _: 2
2187
+ }, 1024)
2188
+ ]),
2189
+ _: 2
2190
+ }, 1024)
2191
+ ]),
2192
+ "cell-user": a(({ row: g }) => [
2193
+ t(e(q), {
2194
+ tone: g.user.name === null ? "muted" : "default"
2195
+ }, {
2196
+ default: a(() => [
2197
+ v(d(V(g)), 1)
2198
+ ]),
2199
+ _: 2
2200
+ }, 1032, ["tone"])
2201
+ ]),
2202
+ "cell-scopes": a(({ row: g }) => [
2203
+ g.state === "revoked" ? (r(), h(e(ee), {
2204
+ key: 0,
2205
+ type: "default",
2206
+ dot: ""
2207
+ }, {
2208
+ default: a(() => [
2209
+ v(d(e(f)("keys.revoked")), 1)
2210
+ ]),
2211
+ _: 1
2212
+ })) : g.state === "expired" ? (r(), h(e(ee), {
2213
+ key: 1,
2214
+ type: "default",
2215
+ dot: ""
2216
+ }, {
2217
+ default: a(() => [
2218
+ v(d(e(f)("keys.expired")), 1)
2219
+ ]),
2220
+ _: 1
2221
+ })) : (r(), h(e(ee), {
2222
+ key: 2,
2223
+ type: g.everything ? "success" : "info",
2224
+ dot: ""
2225
+ }, {
2226
+ default: a(() => [
2227
+ v(d(C(g)), 1)
2228
+ ]),
2229
+ _: 2
2230
+ }, 1032, ["type"]))
2231
+ ]),
2232
+ "cell-expires_at": a(({ row: g }) => [
2233
+ g.expires_at ? (r(), h(e(ue), {
2234
+ key: 0,
2235
+ value: g.expires_at,
2236
+ compact: ""
2237
+ }, null, 8, ["value"])) : O("", !0)
2238
+ ]),
2239
+ "cell-last_used_at": a(({ row: g }) => [
2240
+ g.last_used_at ? (r(), h(e(ue), {
2241
+ key: 0,
2242
+ value: g.last_used_at,
2243
+ compact: ""
2244
+ }, null, 8, ["value"])) : (r(), h(e(q), {
2245
+ key: 1,
2246
+ size: "sm",
2247
+ tone: "muted"
2248
+ }, {
2249
+ default: a(() => [
2250
+ v(d(e(f)("keys.never-used")), 1)
2251
+ ]),
2252
+ _: 1
2253
+ }))
2254
+ ]),
2255
+ "cell-end": a(({ row: g }) => [
2256
+ g.state === "live" ? (r(), h(e(X), {
2257
+ key: 0,
2258
+ type: "danger",
2259
+ variant: "text",
2260
+ size: "sm",
2261
+ loading: $.value === g.id,
2262
+ onClick: (S) => b(g)
2263
+ }, {
2264
+ default: a(() => [
2265
+ v(d(e(f)("keys.revoke")), 1)
2266
+ ]),
2267
+ _: 1
2268
+ }, 8, ["loading", "onClick"])) : O("", !0)
2269
+ ]),
2270
+ "cell-card": a(({ row: g }) => [
2271
+ t(e(xe), {
2272
+ variant: "plain",
2273
+ title: g.name,
2274
+ subtitle: s.mine ? w(g) : V(g)
2275
+ }, {
2276
+ media: a(() => [
2277
+ M("span", Ma, [
2278
+ t(e(ye), { name: "lock" })
2279
+ ])
2280
+ ]),
2281
+ meta: a(() => [
2282
+ g.state === "revoked" ? (r(), h(e(ee), {
2283
+ key: 0,
2284
+ type: "default",
2285
+ dot: "",
2286
+ size: "sm"
2287
+ }, {
2288
+ default: a(() => [
2289
+ v(d(e(f)("keys.revoked")), 1)
2290
+ ]),
2291
+ _: 1
2292
+ })) : g.state === "expired" ? (r(), h(e(ee), {
2293
+ key: 1,
2294
+ type: "default",
2295
+ dot: "",
2296
+ size: "sm"
2297
+ }, {
2298
+ default: a(() => [
2299
+ v(d(e(f)("keys.expired")), 1)
2300
+ ]),
2301
+ _: 1
2302
+ })) : (r(), h(e(ee), {
2303
+ key: 2,
2304
+ type: g.everything ? "success" : "info",
2305
+ dot: "",
2306
+ size: "sm"
2307
+ }, {
2308
+ default: a(() => [
2309
+ v(d(C(g)), 1)
2310
+ ]),
2311
+ _: 2
2312
+ }, 1032, ["type"])),
2313
+ g.expires_at ? (r(), h(e(q), {
2314
+ key: 3,
2315
+ size: "xs",
2316
+ tone: "muted"
2317
+ }, {
2318
+ default: a(() => [
2319
+ v(d(e(f)("keys.until")) + " ", 1),
2320
+ t(e(ue), {
2321
+ value: g.expires_at,
2322
+ compact: ""
2323
+ }, null, 8, ["value"])
2324
+ ]),
2325
+ _: 2
2326
+ }, 1024)) : O("", !0)
2327
+ ]),
2328
+ actions: a(() => [
2329
+ g.state === "live" ? (r(), h(e(X), {
2330
+ key: 0,
2331
+ type: "danger",
2332
+ variant: "text",
2333
+ size: "sm",
2334
+ loading: $.value === g.id,
2335
+ onClick: (S) => b(g)
2336
+ }, {
2337
+ default: a(() => [
2338
+ v(d(e(f)("keys.revoke")), 1)
2339
+ ]),
2340
+ _: 1
2341
+ }, 8, ["loading", "onClick"])) : O("", !0)
2342
+ ]),
2343
+ _: 2
2344
+ }, 1032, ["title", "subtitle"])
2345
+ ]),
2346
+ _: 1
2347
+ }, 8, ["data", "columns", "loading", "empty-text", "row-class"])
2348
+ ], 512));
2349
+ }
2350
+ }), Ya = { class: "wx-role-form" }, ja = { class: "wx-role-form__names" }, Ha = {
2351
+ key: 3,
2352
+ class: "wx-role-form__matrix"
2353
+ }, Ga = { class: "wx-role-form__module" }, Ja = { class: "wx-role-form__cells" }, Qa = { class: "wx-role-form__label" }, Xa = { class: "wx-role-form__code" }, Za = {
2354
+ key: 0,
2355
+ class: "wx-role-form__row"
2356
+ }, et = { class: "wx-role-form__module" }, at = { class: "wx-role-form__cells" }, tt = { class: "wx-role-form__code" }, lt = /* @__PURE__ */ ne({
2357
+ __name: "RoleDialog",
2358
+ props: {
2359
+ role: { default: null },
2360
+ readOnly: { type: Boolean, default: !1 }
2361
+ },
2362
+ setup(l) {
2363
+ const o = l, { resolve: s, dismiss: n, open: x } = ge(), f = oe(), z = pe(f);
2364
+ re();
2365
+ const m = ae("webx-auth"), u = ve(), N = A(null), c = A(!1), k = A({}), $ = A(o.role?.name ?? ""), W = A(o.role?.slug ?? ""), V = A(new Set(o.role?.permissions ?? [])), w = R(() => o.role !== null), C = R(() => o.readOnly || o.role?.held === !0), E = R(() => w.value ? C.value ? m("roles.view") : m("roles.edit") : m("roles.new")), b = R(() => {
2366
+ if (N.value === null) return [];
2367
+ const p = new Set(N.value.flatMap((i) => i.permissions.map((T) => T.name)));
2368
+ return [...V.value].filter((i) => !p.has(i)).sort();
2369
+ });
2370
+ z.permissions().then((p) => N.value = p);
2371
+ function L(p, i) {
2372
+ return C.value || !i && !V.value.has(p);
2373
+ }
2374
+ function _(p, i) {
2375
+ const T = new Set(V.value);
2376
+ i ? T.add(p) : T.delete(p), V.value = T;
2377
+ }
2378
+ function g(p) {
2379
+ return p.permissions.filter((i) => !L(i.name, i.held)).map((i) => i.name);
2380
+ }
2381
+ function S(p) {
2382
+ const i = p.permissions.filter((T) => V.value.has(T.name)).length;
2383
+ return {
2384
+ checked: i > 0 && i === p.permissions.length,
2385
+ indeterminate: i > 0 && i < p.permissions.length
2386
+ };
2387
+ }
2388
+ function F(p, i) {
2389
+ const T = new Set(V.value);
2390
+ for (const H of g(p))
2391
+ i ? T.add(H) : T.delete(H);
2392
+ V.value = T;
2393
+ }
2394
+ function U(p) {
2395
+ return k.value[p]?.[0];
2396
+ }
2397
+ const Y = R(() => {
2398
+ const p = Object.keys(k.value).find((i) => i.startsWith("permissions"));
2399
+ return p ? k.value[p]?.[0] : void 0;
2400
+ });
2401
+ async function y() {
2402
+ c.value = !0, k.value = {};
2403
+ const p = {
2404
+ name: $.value,
2405
+ slug: W.value.trim() === "" ? null : W.value.trim(),
2406
+ permissions: [...V.value]
2407
+ };
2408
+ try {
2409
+ const i = o.role ? await z.updateRole(o.role.id, p) : await z.createRole(p);
2410
+ Q.success(m(w.value ? "roles.updated" : "roles.created")), s(i);
2411
+ } catch (i) {
2412
+ const T = i.body;
2413
+ T?.errors ? k.value = T.errors : Q.danger(u(i));
2414
+ } finally {
2415
+ c.value = !1;
2416
+ }
2417
+ }
2418
+ return (p, i) => (r(), h(e(_e), {
2419
+ open: e(x),
2420
+ "onUpdate:open": i[3] || (i[3] = (T) => Se(x) ? x.value = T : null),
2421
+ title: E.value,
2422
+ width: 800
2423
+ }, {
2424
+ footer: a(() => [
2425
+ t(e(ce), { size: "sm" }, {
2426
+ default: a(() => [
2427
+ t(e(X), {
2428
+ variant: "outline",
2429
+ onClick: i[2] || (i[2] = (T) => e(n)())
2430
+ }, {
2431
+ default: a(() => [
2432
+ v(d(C.value ? e(m)("roles.close") : e(m)("roles.cancel")), 1)
2433
+ ]),
2434
+ _: 1
2435
+ }),
2436
+ C.value ? O("", !0) : (r(), h(e(X), {
2437
+ key: 0,
2438
+ type: "primary",
2439
+ loading: c.value,
2440
+ onClick: y
2441
+ }, {
2442
+ default: a(() => [
2443
+ v(d(e(m)("roles.save")), 1)
2444
+ ]),
2445
+ _: 1
2446
+ }, 8, ["loading"]))
2447
+ ]),
2448
+ _: 1
2449
+ })
2450
+ ]),
2451
+ default: a(() => [
2452
+ M("div", Ya, [
2453
+ l.role?.held ? (r(), h(e(Ae), {
2454
+ key: 0,
2455
+ type: "info",
2456
+ description: e(m)("roles.held")
2457
+ }, null, 8, ["description"])) : O("", !0),
2458
+ M("div", ja, [
2459
+ t(e(j), {
2460
+ label: e(m)("roles.name"),
2461
+ error: U("name")
2462
+ }, {
2463
+ default: a(() => [
2464
+ t(e(te), {
2465
+ modelValue: $.value,
2466
+ "onUpdate:modelValue": i[0] || (i[0] = (T) => $.value = T),
2467
+ name: "name",
2468
+ disabled: C.value
2469
+ }, null, 8, ["modelValue", "disabled"])
2470
+ ]),
2471
+ _: 1
2472
+ }, 8, ["label", "error"]),
2473
+ t(e(j), {
2474
+ label: e(m)("roles.slug"),
2475
+ error: U("slug"),
2476
+ help: C.value ? void 0 : e(m)("roles.slug-hint")
2477
+ }, {
2478
+ default: a(() => [
2479
+ t(e(te), {
2480
+ modelValue: W.value,
2481
+ "onUpdate:modelValue": i[1] || (i[1] = (T) => W.value = T),
2482
+ name: "slug",
2483
+ autocomplete: "off",
2484
+ disabled: C.value
2485
+ }, null, 8, ["modelValue", "disabled"])
2486
+ ]),
2487
+ _: 1
2488
+ }, 8, ["label", "error", "help"])
2489
+ ]),
2490
+ t(e(q), { weight: "semibold" }, {
2491
+ default: a(() => [
2492
+ v(d(e(m)("roles.permissions")), 1)
2493
+ ]),
2494
+ _: 1
2495
+ }),
2496
+ Y.value ? (r(), h(e(q), {
2497
+ key: 1,
2498
+ size: "sm",
2499
+ tone: "danger"
2500
+ }, {
2501
+ default: a(() => [
2502
+ v(d(Y.value), 1)
2503
+ ]),
2504
+ _: 1
2505
+ })) : O("", !0),
2506
+ N.value === null ? (r(), h(e(da), { key: 2 })) : (r(), G("div", Ha, [
2507
+ (r(!0), G(se, null, fe(N.value, (T) => (r(), G("section", {
2508
+ key: T.module,
2509
+ class: "wx-role-form__row"
2510
+ }, [
2511
+ M("div", Ga, [
2512
+ t(e(he), {
2513
+ "model-value": S(T).checked,
2514
+ indeterminate: S(T).indeterminate,
2515
+ disabled: g(T).length === 0,
2516
+ "aria-label": `${e(m)("roles.all")}: ${T.title}`,
2517
+ "onUpdate:modelValue": (H) => F(T, H)
2518
+ }, {
2519
+ default: a(() => [
2520
+ t(e(q), { weight: "semibold" }, {
2521
+ default: a(() => [
2522
+ v(d(T.title), 1)
2523
+ ]),
2524
+ _: 2
2525
+ }, 1024)
2526
+ ]),
2527
+ _: 2
2528
+ }, 1032, ["model-value", "indeterminate", "disabled", "aria-label", "onUpdate:modelValue"])
2529
+ ]),
2530
+ M("div", Ja, [
2531
+ (r(!0), G(se, null, fe(T.permissions, (H) => (r(), h(e(he), {
2532
+ key: H.name,
2533
+ class: "wx-role-form__cell",
2534
+ "model-value": V.value.has(H.name),
2535
+ disabled: L(H.name, H.held),
2536
+ title: H.held ? H.name : `${H.name} — ${e(m)("roles.not-yours")}`,
2537
+ "onUpdate:modelValue": (I) => _(H.name, I)
2538
+ }, {
2539
+ default: a(() => [
2540
+ M("span", Qa, [
2541
+ M("span", null, d(H.label), 1),
2542
+ M("span", Xa, d(H.name), 1)
2543
+ ])
2544
+ ]),
2545
+ _: 2
2546
+ }, 1032, ["model-value", "disabled", "title", "onUpdate:modelValue"]))), 128))
2547
+ ])
2548
+ ]))), 128)),
2549
+ b.value.length > 0 ? (r(), G("section", Za, [
2550
+ M("div", et, [
2551
+ t(e(q), { weight: "semibold" }, {
2552
+ default: a(() => [
2553
+ v(d(e(m)("roles.unknown")), 1)
2554
+ ]),
2555
+ _: 1
2556
+ })
2557
+ ]),
2558
+ M("div", at, [
2559
+ (r(!0), G(se, null, fe(b.value, (T) => (r(), h(e(he), {
2560
+ key: T,
2561
+ class: "wx-role-form__cell",
2562
+ "model-value": V.value.has(T),
2563
+ disabled: C.value,
2564
+ "onUpdate:modelValue": (H) => _(T, H)
2565
+ }, {
2566
+ default: a(() => [
2567
+ M("span", tt, d(T), 1)
2568
+ ]),
2569
+ _: 2
2570
+ }, 1032, ["model-value", "disabled", "onUpdate:modelValue"]))), 128))
2571
+ ])
2572
+ ])) : O("", !0)
2573
+ ]))
2574
+ ])
2575
+ ]),
2576
+ _: 1
2577
+ }, 8, ["open", "title"]));
2578
+ }
2579
+ }), st = { class: "wx-role-list__name" }, Oe = 480, nt = /* @__PURE__ */ ne({
2580
+ __name: "RoleList",
2581
+ props: {
2582
+ removable: { type: Boolean, default: !1 }
2583
+ },
2584
+ emits: ["open", "remove"],
2585
+ setup(l, { expose: o, emit: s }) {
2586
+ const n = l, x = s, f = oe(), z = pe(f);
2587
+ re();
2588
+ const m = ae("webx-auth"), u = de("root"), N = ke(u), c = R(() => N.value > 0 && N.value < Oe), k = A([]), $ = A(!1), W = R(() => c.value ? [{ key: "card", label: "" }] : [
2589
+ { key: "name", label: m("roles.name") },
2590
+ { key: "slug", label: m("roles.slug"), hideBelow: 620 },
2591
+ { key: "permissions", label: m("roles.permissions"), align: "right", hideBelow: 520 },
2592
+ { key: "users", label: m("roles.users"), align: "right" },
2593
+ {
2594
+ key: "actions",
2595
+ label: "",
2596
+ width: je,
2597
+ align: "right",
2598
+ hidden: !n.removable,
2599
+ hideOnCards: !0
2600
+ }
2601
+ ]);
2602
+ async function V() {
2603
+ $.value = !0;
2604
+ try {
2605
+ k.value = await z.roles();
2606
+ } finally {
2607
+ $.value = !1;
2608
+ }
2609
+ }
2610
+ function w(C) {
2611
+ return C.held ? [] : [
2612
+ {
2613
+ key: "delete",
2614
+ icon: "trash",
2615
+ label: m("roles.delete"),
2616
+ danger: !0,
2617
+ run: () => x("remove", C)
2618
+ }
2619
+ ];
2620
+ }
2621
+ return V(), o({ reload: V }), (C, E) => (r(), G("div", {
2622
+ ref_key: "root",
2623
+ ref: u,
2624
+ class: "wx-role-list"
2625
+ }, [
2626
+ t(e(we), {
2627
+ data: k.value,
2628
+ columns: W.value,
2629
+ "row-key": "id",
2630
+ clickable: "",
2631
+ hover: "",
2632
+ flush: "",
2633
+ loading: $.value,
2634
+ "empty-text": e(m)("roles.empty"),
2635
+ "cards-below": Oe,
2636
+ onRowClick: E[0] || (E[0] = (b) => x("open", b))
2637
+ }, {
2638
+ "cell-name": a(({ row: b }) => [
2639
+ M("span", st, [
2640
+ M("span", null, d(b.name), 1),
2641
+ b.held ? (r(), h(e(ee), {
2642
+ key: 0,
2643
+ type: "info",
2644
+ size: "sm"
2645
+ }, {
2646
+ default: a(() => [
2647
+ v(d(e(m)("roles.yours")), 1)
2648
+ ]),
2649
+ _: 1
2650
+ })) : O("", !0)
2651
+ ])
2652
+ ]),
2653
+ "cell-slug": a(({ row: b }) => [
2654
+ t(e(q), {
2655
+ size: "sm",
2656
+ tone: "muted",
2657
+ class: "wx-role-list__slug"
2658
+ }, {
2659
+ default: a(() => [
2660
+ v(d(b.slug), 1)
2661
+ ]),
2662
+ _: 2
2663
+ }, 1024)
2664
+ ]),
2665
+ "cell-permissions": a(({ row: b }) => [
2666
+ v(d(b.permissions.length), 1)
2667
+ ]),
2668
+ "cell-users": a(({ row: b }) => [
2669
+ v(d(b.users), 1)
2670
+ ]),
2671
+ "cell-actions": a(({ row: b }) => [
2672
+ b.held ? O("", !0) : (r(), h(e(ze), {
2673
+ key: 0,
2674
+ actions: w(b),
2675
+ label: b.name
2676
+ }, null, 8, ["actions", "label"]))
2677
+ ]),
2678
+ "card-actions": a(({ row: b }) => [
2679
+ l.removable && !b.held ? (r(), h(e(ze), {
2680
+ key: 0,
2681
+ actions: w(b),
2682
+ label: b.name
2683
+ }, null, 8, ["actions", "label"])) : O("", !0)
2684
+ ]),
2685
+ "cell-card": a(({ row: b }) => [
2686
+ t(e(xe), {
2687
+ variant: "plain",
2688
+ title: b.name,
2689
+ subtitle: b.slug
2690
+ }, {
2691
+ meta: a(() => [
2692
+ t(e(ee), { size: "sm" }, {
2693
+ default: a(() => [
2694
+ v(d(e(m)("roles.permission-count", { count: b.permissions.length })), 1)
2695
+ ]),
2696
+ _: 2
2697
+ }, 1024),
2698
+ t(e(ee), { size: "sm" }, {
2699
+ default: a(() => [
2700
+ v(d(e(m)("roles.users-count", { count: b.users })), 1)
2701
+ ]),
2702
+ _: 2
2703
+ }, 1024)
2704
+ ]),
2705
+ _: 2
2706
+ }, 1032, ["title", "subtitle"])
2707
+ ]),
2708
+ _: 1
2709
+ }, 8, ["data", "columns", "loading", "empty-text"])
2710
+ ], 512));
2711
+ }
2712
+ }), ot = /* @__PURE__ */ ne({
2713
+ __name: "AdminsPage",
2714
+ props: {
2715
+ base: { default: "/admins" },
2716
+ current: { default: "admins" },
2717
+ avatarField: { default: void 0 },
2718
+ resolveAvatar: { type: Function, default: void 0 }
2719
+ },
2720
+ setup(l) {
2721
+ const o = l, s = oe(), n = pe(s), x = o.avatarField ?? Ze(s) ?? void 0, f = o.resolveAvatar ?? ea(s) ?? void 0, z = ya(), m = ha();
2722
+ re();
2723
+ const u = ae("webx-auth"), N = ae("webx-admin"), c = ve(), k = de("list"), $ = de("keys"), W = de("roles"), V = A(null), w = be(za), C = be(qa), E = be(lt), b = s.can("admins.manage"), L = s.can("admins.audit"), _ = b || s.can("admins.view"), g = s.can("roles.manage"), S = _ || g || s.can("roles.assign"), F = R(() => {
2724
+ const K = [];
2725
+ return _ && K.push("admins"), S && K.push("roles"), L && K.push("calls"), b && K.push("connections", "keys"), K;
2726
+ }), U = R(
2727
+ () => F.value.includes(o.current) ? o.current : F.value[0] ?? null
2728
+ ), Y = R(
2729
+ () => s.state.manifest?.modules.find((K) => K.id === "admins")?.title ?? u("admins.title")
2730
+ ), y = R(() => {
2731
+ const K = {
2732
+ admins: Y.value,
2733
+ roles: u("roles.title"),
2734
+ calls: u("calls.title"),
2735
+ connections: u("connections.title"),
2736
+ keys: u("keys.title")
2737
+ }, D = F.value.map((P) => ({ value: P, label: K[P] }));
2738
+ return D.length > 1 ? D : void 0;
2739
+ }), p = R({
2740
+ get: () => U.value ?? o.current,
2741
+ set: (K) => {
2742
+ const D = K === "admins" ? o.base : `${o.base}/${String(K)}`;
2743
+ D !== m.path && z.push(D);
2744
+ }
2745
+ }), i = R(() => U.value === "roles" ? g ? [
2746
+ {
2747
+ key: "new-role",
2748
+ label: u("roles.new-short"),
2749
+ icon: "plus",
2750
+ primary: !0,
2751
+ run: () => {
2752
+ I(null);
2753
+ }
2754
+ }
2755
+ ] : [] : b ? U.value === "admins" ? [
2756
+ {
2757
+ key: "new",
2758
+ label: u("admins.new-short"),
2759
+ icon: "plus",
2760
+ primary: !0,
2761
+ run: () => {
2762
+ H(null);
2763
+ }
2764
+ }
2765
+ ] : U.value === "keys" ? [
2766
+ {
2767
+ key: "issue",
2768
+ label: u("keys.issue-short"),
2769
+ icon: "plus",
2770
+ primary: !0,
2771
+ run: () => {
2772
+ T();
2773
+ }
2774
+ }
2775
+ ] : [] : []);
2776
+ async function T() {
2777
+ await C() && $.value?.reload();
2778
+ }
2779
+ async function H(K) {
2780
+ V.value = K, await w({ admin: K, avatarField: x }) && k.value?.reload();
2781
+ }
2782
+ async function I(K) {
2783
+ await E({ role: K, readOnly: !g }) && W.value?.reload();
2784
+ }
2785
+ async function Z(K) {
2786
+ let D = [];
2787
+ try {
2788
+ D = (await n.role(K.id)).holders.map((J) => J.name);
2789
+ } catch (J) {
2790
+ Q.danger(c(J));
2791
+ return;
2792
+ }
2793
+ if (await Ve({
2794
+ title: u("roles.delete-title", { name: K.name }),
2795
+ message: D.length > 0 ? u("roles.delete-holders", { names: D.join(", ") }) : u("roles.delete-text"),
2796
+ confirmText: u("roles.delete"),
2797
+ cancelText: u("roles.cancel"),
2798
+ tone: "danger"
2799
+ }))
2800
+ try {
2801
+ await n.removeRole(K.id), Q.success(u("roles.deleted")), W.value?.reload();
2802
+ } catch (J) {
2803
+ Q.danger(c(J));
2804
+ }
2805
+ }
2806
+ async function B(K) {
2807
+ if (await Ve({
2808
+ title: u("admins.delete-title", { name: K.name }),
2809
+ message: u("admins.delete-text"),
2810
+ confirmText: u("admins.delete"),
2811
+ cancelText: u("admins.cancel"),
2812
+ tone: "danger"
2813
+ }))
2814
+ try {
2815
+ await n.remove(K.id), Q.success(u("admins.deleted")), k.value?.reload();
2816
+ } catch (P) {
2817
+ Q.danger(c(P));
2818
+ }
2819
+ }
2820
+ return (K, D) => (r(), h(e(fa), {
2821
+ view: p.value,
2822
+ "onUpdate:view": D[0] || (D[0] = (P) => p.value = P),
2823
+ title: Y.value,
2824
+ views: y.value,
2825
+ actions: i.value
2826
+ }, {
2827
+ default: a(() => [
2828
+ U.value === null ? (r(), h(e(ca), {
2829
+ key: 0,
2830
+ status: "403",
2831
+ title: e(N)("shell.forbidden-title"),
2832
+ subtitle: e(N)("shell.forbidden-description")
2833
+ }, null, 8, ["title", "subtitle"])) : U.value === "roles" ? (r(), h(nt, {
2834
+ key: 1,
2835
+ ref: "roles",
2836
+ removable: e(g),
2837
+ onOpen: I,
2838
+ onRemove: Z
2839
+ }, null, 8, ["removable"])) : U.value === "calls" ? (r(), h(Wa, { key: 2 })) : U.value === "connections" ? (r(), h(Ba, {
2840
+ key: 3,
2841
+ scope: "all"
2842
+ })) : U.value === "keys" ? (r(), h(Ka, {
2843
+ key: 4,
2844
+ ref: "keys"
2845
+ }, null, 512)) : (r(), h(ta, {
2846
+ key: 5,
2847
+ ref_key: "list",
2848
+ ref: k,
2849
+ removable: e(b),
2850
+ "resolve-avatar": e(f),
2851
+ onOpen: H,
2852
+ onRemove: B
2853
+ }, null, 8, ["removable", "resolve-avatar"]))
2854
+ ]),
2855
+ _: 1
2856
+ }, 8, ["view", "title", "views", "actions"]));
2857
+ }
2858
+ });
2859
+ function St(l = {}) {
2860
+ const o = l.path ?? "/admins", s = (n) => ({
2861
+ render: () => Ke(ot, {
2862
+ base: o,
2863
+ current: n,
2864
+ avatarField: l.avatarField,
2865
+ resolveAvatar: l.resolveAvatar
2866
+ })
2867
+ });
2868
+ return {
2869
+ id: "admins",
2870
+ path: o,
2871
+ routes: [
2872
+ { path: o, name: "webx.admins", component: s("admins") },
2873
+ // The roles: what the people above are allowed, as named sets of permissions.
2874
+ { path: `${o}/roles`, name: "webx.admins.roles", component: s("roles") },
2875
+ // What their agents did, which agents they let in, and their keys: more views of the same
2876
+ // section, each with an address of its own so that its filters survive a trip to the
2877
+ // people and back.
2878
+ { path: `${o}/calls`, name: "webx.admins.calls", component: s("calls") },
2879
+ {
2880
+ path: `${o}/connections`,
2881
+ name: "webx.admins.connections",
2882
+ component: s("connections")
2883
+ },
2884
+ // Keys for programs: a connection without a browser, issued by somebody who manages
2885
+ // the people it acts as.
2886
+ { path: `${o}/keys`, name: "webx.admins.keys", component: s("keys") }
2887
+ ]
2888
+ };
2889
+ }
2890
+ function Tt(l = {}) {
2891
+ const o = l.path ?? "/connect";
2892
+ return {
2893
+ id: "connect",
2894
+ path: o,
2895
+ routes: [{ path: o, name: "webx.connect", component: () => import("./ConnectPage-CMJlMsmn.js") }]
2896
+ };
2897
+ }
2898
+ const it = /* @__PURE__ */ ne({
2899
+ __name: "AdminPicker",
2900
+ props: {
2901
+ multiple: { type: Boolean, default: !1 },
2902
+ title: { default: void 0 },
2903
+ resolveAvatar: { type: Function, default: void 0 }
2904
+ },
2905
+ setup(l) {
2906
+ const o = l, { open: s, resolve: n, dismiss: x } = ge();
2907
+ re();
2908
+ const f = ae("webx-auth"), z = de("list"), m = A(0);
2909
+ function u(c) {
2910
+ n(c);
2911
+ }
2912
+ function N(c) {
2913
+ m.value = c.length;
2914
+ }
2915
+ return (c, k) => (r(), h(e(_e), {
2916
+ open: e(s),
2917
+ "onUpdate:open": k[2] || (k[2] = ($) => Se(s) ? s.value = $ : null),
2918
+ title: l.title ?? e(f)(l.multiple ? "admins.select-many" : "admins.select-one"),
2919
+ width: 880
2920
+ }, Me({
2921
+ default: a(() => [
2922
+ t(ta, {
2923
+ ref_key: "list",
2924
+ ref: z,
2925
+ picking: "",
2926
+ multiple: l.multiple,
2927
+ "resolve-avatar": o.resolveAvatar,
2928
+ onChosen: u,
2929
+ onSelection: N
2930
+ }, null, 8, ["multiple", "resolve-avatar"])
2931
+ ]),
2932
+ _: 2
2933
+ }, [
2934
+ l.multiple ? {
2935
+ name: "footer",
2936
+ fn: a(() => [
2937
+ t(e(ce), {
2938
+ size: "sm",
2939
+ align: "center"
2940
+ }, {
2941
+ default: a(() => [
2942
+ t(e(q), {
2943
+ size: "sm",
2944
+ tone: "muted"
2945
+ }, {
2946
+ default: a(() => [
2947
+ v(d(e(f)("admins.chosen", { count: m.value })), 1)
2948
+ ]),
2949
+ _: 1
2950
+ }),
2951
+ t(e(X), {
2952
+ variant: "outline",
2953
+ onClick: k[0] || (k[0] = ($) => e(x)())
2954
+ }, {
2955
+ default: a(() => [
2956
+ v(d(e(f)("admins.cancel")), 1)
2957
+ ]),
2958
+ _: 1
2959
+ }),
2960
+ t(e(X), {
2961
+ type: "primary",
2962
+ disabled: m.value === 0,
2963
+ onClick: k[1] || (k[1] = ($) => e(n)(z.value?.chosen() ?? []))
2964
+ }, {
2965
+ default: a(() => [
2966
+ v(d(e(f)("admins.save")), 1)
2967
+ ]),
2968
+ _: 1
2969
+ }, 8, ["disabled"])
2970
+ ]),
2971
+ _: 1
2972
+ })
2973
+ ]),
2974
+ key: "0"
2975
+ } : void 0
2976
+ ]), 1032, ["open", "title"]));
2977
+ }
2978
+ }), sa = be(it);
2979
+ async function Ut(l = {}) {
2980
+ return (await sa({ ...l, multiple: !1 }))?.[0];
2981
+ }
2982
+ function Lt(l = {}) {
2983
+ return sa({ ...l, multiple: !0 });
2984
+ }
2985
+ const rt = { class: "wx-profile-host" }, ut = { class: "wx-profile" }, dt = {
2986
+ key: 0,
2987
+ class: "wx-profile__aside"
2988
+ }, ct = { class: "wx-profile__fields" }, mt = {
2989
+ key: 0,
2990
+ class: "wx-profile__agents"
2991
+ }, vt = { class: "wx-profile__agents-text" }, pt = { class: "wx-profile__section" }, ft = { class: "wx-profile__section" }, yt = { class: "wx-profile__section" }, ht = /* @__PURE__ */ ne({
2992
+ __name: "ProfileDialog",
2993
+ props: {
2994
+ avatarField: { default: void 0 }
2995
+ },
2996
+ setup(l) {
2997
+ const o = l, { resolve: s, dismiss: n, open: x } = ge(), f = oe(), z = Ue(), m = Te(), u = Ge(), N = $e(ba, null);
2998
+ re();
2999
+ const c = ae("webx-auth"), k = m.scope("webx-admin"), $ = ve(), W = A("main"), V = A(!1), w = A(!1), C = A({}), E = R(() => f.state.user), b = A({
3000
+ name: E.value?.name ?? "",
3001
+ avatar: E.value?.avatar ?? null,
3002
+ password: "",
3003
+ current_password: ""
3004
+ }), L = A({ email: "", current_password: "" }), _ = A(null), g = A(b.value.avatar ? { path: b.value.avatar } : null), S = R(() => E.value?.emailChange === !0), F = R(
3005
+ () => m.state.panelLocales.map((D) => ({ value: D.code, label: D.nativeName }))
3006
+ ), U = R(
3007
+ () => typeof E.value?.siteBar == "boolean" ? E.value.siteBar : null
3008
+ ), Y = R(
3009
+ () => N?.hasRoute("webx.connect") === !0 && (f.state.manifest?.modules.some((D) => D.id === "connect") ?? !1)
3010
+ ), y = R({
3011
+ get: () => u.state.preference,
3012
+ set: (D) => {
3013
+ u.set(D), z.setTheme(D);
3014
+ }
3015
+ });
3016
+ async function p(D) {
3017
+ if (!(typeof D != "string" || D === m.state.locale))
3018
+ try {
3019
+ await z.setLocale(D);
3020
+ } catch (P) {
3021
+ Q.danger($(P));
3022
+ }
3023
+ }
3024
+ function i(D) {
3025
+ z.setSiteBar(D === !0).catch((P) => Q.danger($(P)));
3026
+ }
3027
+ function T(D) {
3028
+ return C.value[D]?.[0];
3029
+ }
3030
+ function H(D) {
3031
+ const P = D.body;
3032
+ P?.errors ? C.value = P.errors : Q.danger($(D));
3033
+ }
3034
+ async function I() {
3035
+ V.value = !0, C.value = {};
3036
+ try {
3037
+ await z.updateProfile({
3038
+ name: b.value.name,
3039
+ avatar: g.value?.path ?? null,
3040
+ // Blank is left out entirely rather than sent as an empty string: the server reads a
3041
+ // filled password as "change it", and an empty one would be a change to nothing.
3042
+ ...b.value.password ? { password: b.value.password, current_password: b.value.current_password } : {}
3043
+ }), Q.success(c("profile.saved")), s(!0);
3044
+ } catch (D) {
3045
+ H(D), C.value.password || C.value.current_password ? W.value = "password" : C.value.name && (W.value = "main");
3046
+ } finally {
3047
+ V.value = !1;
3048
+ }
3049
+ }
3050
+ async function Z() {
3051
+ w.value = !0, C.value = {};
3052
+ try {
3053
+ _.value = await z.requestEmailChange(L.value.email, L.value.current_password), L.value = { email: "", current_password: "" };
3054
+ } catch (D) {
3055
+ H(D);
3056
+ } finally {
3057
+ w.value = !1;
3058
+ }
3059
+ }
3060
+ const B = R(() => W.value === "email" ? S.value ? "send" : "close" : W.value === "interface" ? "close" : "save");
3061
+ function K() {
3062
+ n(), N?.push({ name: "webx.connect" });
3063
+ }
3064
+ return (D, P) => (r(), h(e(_e), {
3065
+ open: e(x),
3066
+ "onUpdate:open": P[11] || (P[11] = (J) => Se(x) ? x.value = J : null),
3067
+ title: e(c)("profile.title"),
3068
+ width: 600
3069
+ }, {
3070
+ footer: a(() => [
3071
+ B.value === "close" ? (r(), h(e(X), {
3072
+ key: 0,
3073
+ onClick: P[8] || (P[8] = (J) => e(n)())
3074
+ }, {
3075
+ default: a(() => [
3076
+ v(d(e(c)("profile.cancel")), 1)
3077
+ ]),
3078
+ _: 1
3079
+ })) : B.value === "send" ? (r(), G(se, { key: 1 }, [
3080
+ t(e(X), {
3081
+ onClick: P[9] || (P[9] = (J) => e(n)())
3082
+ }, {
3083
+ default: a(() => [
3084
+ v(d(e(c)("profile.cancel")), 1)
3085
+ ]),
3086
+ _: 1
3087
+ }),
3088
+ t(e(X), {
3089
+ type: "primary",
3090
+ loading: w.value,
3091
+ onClick: Z
3092
+ }, {
3093
+ default: a(() => [
3094
+ v(d(e(c)("profile.email-send")), 1)
3095
+ ]),
3096
+ _: 1
3097
+ }, 8, ["loading"])
3098
+ ], 64)) : (r(), G(se, { key: 2 }, [
3099
+ t(e(X), {
3100
+ onClick: P[10] || (P[10] = (J) => e(n)())
3101
+ }, {
3102
+ default: a(() => [
3103
+ v(d(e(c)("profile.cancel")), 1)
3104
+ ]),
3105
+ _: 1
3106
+ }),
3107
+ t(e(X), {
3108
+ type: "primary",
3109
+ loading: V.value,
3110
+ onClick: I
3111
+ }, {
3112
+ default: a(() => [
3113
+ v(d(e(c)("profile.save")), 1)
3114
+ ]),
3115
+ _: 1
3116
+ }, 8, ["loading"])
3117
+ ], 64))
3118
+ ]),
3119
+ default: a(() => [
3120
+ t(e(ma), {
3121
+ modelValue: W.value,
3122
+ "onUpdate:modelValue": P[7] || (P[7] = (J) => W.value = J),
3123
+ variant: "line",
3124
+ "keep-alive": "",
3125
+ "aria-label": e(c)("profile.title")
3126
+ }, {
3127
+ default: a(() => [
3128
+ t(e(Ce), {
3129
+ value: "main",
3130
+ label: e(c)("profile.tab-main")
3131
+ }, {
3132
+ default: a(() => [
3133
+ M("div", rt, [
3134
+ M("div", ut, [
3135
+ o.avatarField ? (r(), G("div", dt, [
3136
+ (r(), h(qe(o.avatarField), {
3137
+ modelValue: g.value,
3138
+ "onUpdate:modelValue": P[0] || (P[0] = (J) => g.value = J),
3139
+ label: e(c)("profile.avatar"),
3140
+ aspect: "1/1",
3141
+ captions: !1
3142
+ }, null, 8, ["modelValue", "label"]))
3143
+ ])) : O("", !0),
3144
+ M("div", ct, [
3145
+ t(e(j), {
3146
+ label: e(c)("profile.name"),
3147
+ error: T("name")
3148
+ }, {
3149
+ default: a(() => [
3150
+ t(e(te), {
3151
+ modelValue: b.value.name,
3152
+ "onUpdate:modelValue": P[1] || (P[1] = (J) => b.value.name = J),
3153
+ name: "name"
3154
+ }, null, 8, ["modelValue"])
3155
+ ]),
3156
+ _: 1
3157
+ }, 8, ["label", "error"]),
3158
+ t(e(j), {
3159
+ label: e(c)("admins.email")
3160
+ }, {
3161
+ default: a(() => [
3162
+ t(e(te), {
3163
+ "model-value": E.value?.email ?? "",
3164
+ readonly: ""
3165
+ }, null, 8, ["model-value"])
3166
+ ]),
3167
+ _: 1
3168
+ }, 8, ["label"]),
3169
+ Y.value ? (r(), G("div", mt, [
3170
+ M("div", vt, [
3171
+ t(e(q), {
3172
+ size: "sm",
3173
+ weight: "medium"
3174
+ }, {
3175
+ default: a(() => [
3176
+ v(d(e(c)("profile.agents")), 1)
3177
+ ]),
3178
+ _: 1
3179
+ }),
3180
+ t(e(q), {
3181
+ size: "xs",
3182
+ tone: "muted"
3183
+ }, {
3184
+ default: a(() => [
3185
+ v(d(e(c)("profile.agents-hint")), 1)
3186
+ ]),
3187
+ _: 1
3188
+ })
3189
+ ]),
3190
+ t(e(X), {
3191
+ variant: "outline",
3192
+ size: "sm",
3193
+ onClick: K
3194
+ }, {
3195
+ default: a(() => [
3196
+ v(d(e(c)("profile.agents-open")), 1)
3197
+ ]),
3198
+ _: 1
3199
+ })
3200
+ ])) : O("", !0)
3201
+ ])
3202
+ ])
3203
+ ])
3204
+ ]),
3205
+ _: 1
3206
+ }, 8, ["label"]),
3207
+ t(e(Ce), {
3208
+ value: "interface",
3209
+ label: e(c)("profile.tab-interface")
3210
+ }, {
3211
+ default: a(() => [
3212
+ M("div", pt, [
3213
+ t(e(q), {
3214
+ size: "sm",
3215
+ tone: "muted"
3216
+ }, {
3217
+ default: a(() => [
3218
+ v(d(e(c)("profile.interface-hint")), 1)
3219
+ ]),
3220
+ _: 1
3221
+ }),
3222
+ F.value.length > 1 ? (r(), h(e(j), {
3223
+ key: 0,
3224
+ label: e(c)("profile.language")
3225
+ }, {
3226
+ default: a(() => [
3227
+ t(e(ie), {
3228
+ "model-value": e(m).state.locale,
3229
+ options: F.value,
3230
+ name: "locale",
3231
+ "onUpdate:modelValue": p
3232
+ }, null, 8, ["model-value", "options"])
3233
+ ]),
3234
+ _: 1
3235
+ }, 8, ["label"])) : O("", !0),
3236
+ t(e(j), {
3237
+ label: e(c)("profile.theme")
3238
+ }, {
3239
+ default: a(() => [
3240
+ t(e(Ye), {
3241
+ modelValue: y.value,
3242
+ "onUpdate:modelValue": P[2] || (P[2] = (J) => y.value = J),
3243
+ "aria-label": e(k)("theme.label"),
3244
+ "light-label": e(k)("theme.light"),
3245
+ "dark-label": e(k)("theme.dark"),
3246
+ "system-label": e(k)("theme.system")
3247
+ }, null, 8, ["modelValue", "aria-label", "light-label", "dark-label", "system-label"])
3248
+ ]),
3249
+ _: 1
3250
+ }, 8, ["label"]),
3251
+ U.value !== null ? (r(), h(e(j), {
3252
+ key: 1,
3253
+ help: e(c)("profile.site-bar-hint")
3254
+ }, {
3255
+ default: a(() => [
3256
+ t(e(va), {
3257
+ "model-value": U.value,
3258
+ label: e(c)("profile.site-bar"),
3259
+ name: "site_bar",
3260
+ "onUpdate:modelValue": i
3261
+ }, null, 8, ["model-value", "label"])
3262
+ ]),
3263
+ _: 1
3264
+ }, 8, ["help"])) : O("", !0)
3265
+ ])
3266
+ ]),
3267
+ _: 1
3268
+ }, 8, ["label"]),
3269
+ t(e(Ce), {
3270
+ value: "password",
3271
+ label: e(c)("profile.tab-password")
3272
+ }, {
3273
+ default: a(() => [
3274
+ M("div", ft, [
3275
+ t(e(j), {
3276
+ label: e(c)("profile.current-password"),
3277
+ help: e(c)("profile.current-password-hint"),
3278
+ error: W.value === "password" ? T("current_password") : void 0
3279
+ }, {
3280
+ default: a(() => [
3281
+ t(e(te), {
3282
+ modelValue: b.value.current_password,
3283
+ "onUpdate:modelValue": P[3] || (P[3] = (J) => b.value.current_password = J),
3284
+ type: "password",
3285
+ name: "current_password",
3286
+ autocomplete: "current-password"
3287
+ }, null, 8, ["modelValue"])
3288
+ ]),
3289
+ _: 1
3290
+ }, 8, ["label", "help", "error"]),
3291
+ t(e(j), {
3292
+ label: e(c)("profile.password"),
3293
+ help: e(c)("profile.password-hint"),
3294
+ error: T("password")
3295
+ }, {
3296
+ default: a(() => [
3297
+ t(e(te), {
3298
+ modelValue: b.value.password,
3299
+ "onUpdate:modelValue": P[4] || (P[4] = (J) => b.value.password = J),
3300
+ type: "password",
3301
+ name: "password",
3302
+ autocomplete: "new-password"
3303
+ }, null, 8, ["modelValue"])
3304
+ ]),
3305
+ _: 1
3306
+ }, 8, ["label", "help", "error"])
3307
+ ])
3308
+ ]),
3309
+ _: 1
3310
+ }, 8, ["label"]),
3311
+ t(e(Ce), {
3312
+ value: "email",
3313
+ label: e(c)("profile.tab-email")
3314
+ }, {
3315
+ default: a(() => [
3316
+ M("div", yt, [
3317
+ t(e(j), {
3318
+ label: e(c)("profile.email-current")
3319
+ }, {
3320
+ default: a(() => [
3321
+ t(e(te), {
3322
+ "model-value": E.value?.email ?? "",
3323
+ readonly: ""
3324
+ }, null, 8, ["model-value"])
3325
+ ]),
3326
+ _: 1
3327
+ }, 8, ["label"]),
3328
+ S.value ? (r(), G(se, { key: 1 }, [
3329
+ _.value ? (r(), h(e(Ae), {
3330
+ key: 0,
3331
+ type: "success",
3332
+ closable: !1
3333
+ }, {
3334
+ default: a(() => [
3335
+ v(d(e(c)("profile.email-sent", { email: _.value.email, minutes: _.value.minutes })), 1)
3336
+ ]),
3337
+ _: 1
3338
+ })) : O("", !0),
3339
+ t(e(j), {
3340
+ label: e(c)("profile.email-new"),
3341
+ help: e(c)("profile.email-hint"),
3342
+ error: T("email")
3343
+ }, {
3344
+ default: a(() => [
3345
+ t(e(te), {
3346
+ modelValue: L.value.email,
3347
+ "onUpdate:modelValue": P[5] || (P[5] = (J) => L.value.email = J),
3348
+ type: "email",
3349
+ name: "new_email",
3350
+ autocomplete: "email"
3351
+ }, null, 8, ["modelValue"])
3352
+ ]),
3353
+ _: 1
3354
+ }, 8, ["label", "help", "error"]),
3355
+ t(e(j), {
3356
+ label: e(c)("profile.current-password"),
3357
+ help: e(c)("profile.email-password-hint"),
3358
+ error: W.value === "email" ? T("current_password") : void 0
3359
+ }, {
3360
+ default: a(() => [
3361
+ t(e(te), {
3362
+ modelValue: L.value.current_password,
3363
+ "onUpdate:modelValue": P[6] || (P[6] = (J) => L.value.current_password = J),
3364
+ type: "password",
3365
+ name: "email_current_password",
3366
+ autocomplete: "current-password"
3367
+ }, null, 8, ["modelValue"])
3368
+ ]),
3369
+ _: 1
3370
+ }, 8, ["label", "help", "error"])
3371
+ ], 64)) : (r(), h(e(Ae), {
3372
+ key: 0,
3373
+ type: "info",
3374
+ closable: !1
3375
+ }, {
3376
+ default: a(() => [
3377
+ v(d(e(c)("profile.email-unavailable")), 1)
3378
+ ]),
3379
+ _: 1
3380
+ }))
3381
+ ])
3382
+ ]),
3383
+ _: 1
3384
+ }, 8, ["label"])
3385
+ ]),
3386
+ _: 1
3387
+ }, 8, ["modelValue", "aria-label"])
3388
+ ]),
3389
+ _: 1
3390
+ }, 8, ["open", "title"]));
3391
+ }
3392
+ }), bt = /* @__PURE__ */ Le(ht, [["__scopeId", "data-v-39b6c2a5"]]), gt = ["title"], _t = { class: "wx-user-menu__who" }, kt = { class: "wx-user-menu__name" }, wt = { class: "wx-user-menu__email" }, xt = /* @__PURE__ */ ne({
3393
+ __name: "UserMenu",
3394
+ props: {
3395
+ signOutLabel: { default: void 0 },
3396
+ resolveAvatar: { type: Function, default: void 0 },
3397
+ avatarField: { default: void 0 },
3398
+ expanded: { type: Boolean, default: !1 }
3399
+ },
3400
+ setup(l) {
3401
+ const o = l, s = oe(), n = Ue(), x = Te(), f = Ge(), z = ae("webx-auth"), m = x.scope("webx-admin"), u = R(() => s.state.user), N = s.siteUrl, c = R(
3402
+ () => x.state.panelLocales.length > 1 ? x.state.panelLocales : []
3403
+ ), k = $e(Qe, null), $ = $e(Xe, null), W = A(void 0);
3404
+ me(
3405
+ () => typeof u.value?.avatar == "string" ? u.value.avatar : null,
3406
+ async (_) => {
3407
+ const g = o.resolveAvatar ?? k;
3408
+ if (_ === null || _ === "" || g === null) {
3409
+ W.value = void 0;
3410
+ return;
3411
+ }
3412
+ const S = await g(_);
3413
+ u.value?.avatar === _ && (W.value = S ?? void 0);
3414
+ },
3415
+ { immediate: !0 }
3416
+ );
3417
+ const V = be(bt);
3418
+ function w() {
3419
+ setTimeout(
3420
+ () => {
3421
+ V({ avatarField: o.avatarField ?? $ ?? void 0 });
3422
+ },
3423
+ 0
3424
+ );
3425
+ }
3426
+ const C = R({
3427
+ get: () => f.state.preference,
3428
+ set: (_) => {
3429
+ f.set(_), n.setTheme(_);
3430
+ }
3431
+ }), E = R(
3432
+ () => typeof u.value?.siteBar == "boolean" ? u.value.siteBar : null
3433
+ );
3434
+ function b() {
3435
+ E.value !== null && n.setSiteBar(!E.value);
3436
+ }
3437
+ async function L(_) {
3438
+ _ !== x.state.locale && await n.setLocale(_);
3439
+ }
3440
+ return (_, g) => {
3441
+ const S = le("wx-avatar"), F = le("wx-icon"), U = le("wx-text"), Y = le("wx-dropdown-item"), y = le("wx-divider"), p = le("wx-dropdown");
3442
+ return u.value !== null ? (r(), h(p, { key: 0 }, {
3443
+ trigger: a(() => [
3444
+ M("button", {
3445
+ type: "button",
3446
+ class: Ie(["wx-user-menu__trigger", { "wx-user-menu__trigger--named": l.expanded }]),
3447
+ title: u.value.name
3448
+ }, [
3449
+ t(S, {
3450
+ name: u.value.name,
3451
+ src: W.value,
3452
+ size: "lg"
3453
+ }, null, 8, ["name", "src"]),
3454
+ l.expanded ? (r(), G(se, { key: 0 }, [
3455
+ M("span", _t, [
3456
+ M("span", kt, d(u.value.name), 1),
3457
+ M("span", wt, d(u.value.email), 1)
3458
+ ]),
3459
+ t(F, {
3460
+ name: "chevron-up",
3461
+ size: "sm",
3462
+ class: "wx-user-menu__chevron"
3463
+ })
3464
+ ], 64)) : O("", !0)
3465
+ ], 10, gt)
3466
+ ]),
3467
+ default: a(() => [
3468
+ t(Y, { disabled: "" }, {
3469
+ default: a(() => [
3470
+ t(U, { size: "sm" }, {
3471
+ default: a(() => [
3472
+ v(d(u.value.email), 1)
3473
+ ]),
3474
+ _: 1
3475
+ })
3476
+ ]),
3477
+ _: 1
3478
+ }),
3479
+ t(y, { spacing: "sm" }),
3480
+ t(Y, {
3481
+ icon: "user",
3482
+ onClick: w
3483
+ }, {
3484
+ default: a(() => [
3485
+ v(d(e(z)("profile.menu")), 1)
3486
+ ]),
3487
+ _: 1
3488
+ }),
3489
+ e(N) ? (r(), h(Y, {
3490
+ key: 0,
3491
+ icon: "external-link",
3492
+ href: e(N),
3493
+ target: "_blank",
3494
+ rel: "noopener"
3495
+ }, {
3496
+ default: a(() => [
3497
+ v(d(e(m)("nav.open-site")), 1)
3498
+ ]),
3499
+ _: 1
3500
+ }, 8, ["href"])) : O("", !0),
3501
+ t(y, { spacing: "sm" }),
3502
+ t(Y, { disabled: "" }, {
3503
+ default: a(() => [
3504
+ t(U, {
3505
+ size: "sm",
3506
+ tone: "muted"
3507
+ }, {
3508
+ default: a(() => [
3509
+ v(d(e(m)("theme.label")), 1)
3510
+ ]),
3511
+ _: 1
3512
+ })
3513
+ ]),
3514
+ _: 1
3515
+ }),
3516
+ M("div", {
3517
+ class: "wx-user-menu__theme",
3518
+ onClick: g[1] || (g[1] = De(() => {
3519
+ }, ["stop"]))
3520
+ }, [
3521
+ t(e(Ye), {
3522
+ modelValue: C.value,
3523
+ "onUpdate:modelValue": g[0] || (g[0] = (i) => C.value = i),
3524
+ size: "sm",
3525
+ block: "",
3526
+ "aria-label": e(m)("theme.label"),
3527
+ "light-label": e(m)("theme.light"),
3528
+ "dark-label": e(m)("theme.dark"),
3529
+ "system-label": e(m)("theme.system")
3530
+ }, null, 8, ["modelValue", "aria-label", "light-label", "dark-label", "system-label"])
3531
+ ]),
3532
+ E.value !== null ? (r(), G(se, { key: 1 }, [
3533
+ t(y, { spacing: "sm" }),
3534
+ t(Y, {
3535
+ icon: E.value ? "check" : void 0,
3536
+ onClick: b
3537
+ }, {
3538
+ default: a(() => [
3539
+ v(d(e(z)("menu.site-bar")), 1)
3540
+ ]),
3541
+ _: 1
3542
+ }, 8, ["icon"])
3543
+ ], 64)) : O("", !0),
3544
+ c.value.length > 0 ? (r(), G(se, { key: 2 }, [
3545
+ t(y, { spacing: "sm" }),
3546
+ t(Y, { disabled: "" }, {
3547
+ default: a(() => [
3548
+ t(U, {
3549
+ size: "sm",
3550
+ tone: "muted"
3551
+ }, {
3552
+ default: a(() => [
3553
+ v(d(e(z)("menu.language")), 1)
3554
+ ]),
3555
+ _: 1
3556
+ })
3557
+ ]),
3558
+ _: 1
3559
+ }),
3560
+ (r(!0), G(se, null, fe(c.value, (i) => (r(), h(Y, {
3561
+ key: i.code,
3562
+ icon: i.code === e(x).state.locale ? "check" : void 0,
3563
+ onClick: (T) => L(i.code)
3564
+ }, {
3565
+ default: a(() => [
3566
+ v(d(i.nativeName), 1)
3567
+ ]),
3568
+ _: 2
3569
+ }, 1032, ["icon", "onClick"]))), 128)),
3570
+ t(y, { spacing: "sm" })
3571
+ ], 64)) : O("", !0),
3572
+ t(Y, {
3573
+ icon: "logout",
3574
+ onClick: g[2] || (g[2] = (i) => e(n).logout())
3575
+ }, {
3576
+ default: a(() => [
3577
+ v(d(l.signOutLabel ?? e(z)("menu.sign-out")), 1)
3578
+ ]),
3579
+ _: 1
3580
+ })
3581
+ ]),
3582
+ _: 1
3583
+ })) : O("", !0);
3584
+ };
3585
+ }
3586
+ }), Rt = /* @__PURE__ */ Le(xt, [["__scopeId", "data-v-31b12be6"]]);
3587
+ function Wt(l = {}) {
3588
+ const o = l.path ?? "/login";
3589
+ return {
3590
+ install(s) {
3591
+ const n = ga(s.context);
3592
+ s.i18n.defaults("webx-auth", aa), _a(
3593
+ s.app,
3594
+ n,
3595
+ l.resolveAvatar ?? ea(s.context),
3596
+ l.avatarField ?? Ze(s.context)
3597
+ ), s.context.useSessionLoader(() => n.me()), s.router.addRoute({
3598
+ path: o,
3599
+ name: "webx.login",
3600
+ meta: { public: !0 },
3601
+ component: { render: () => Ke(Ca, { ...l.card }) }
3602
+ }), s.router.afterEach(() => {
3603
+ s.context.state.status === "ready" && Ne(s);
3604
+ }), s.router.beforeEach((x) => x.meta.public === !0 || s.context.state.status !== "unauthenticated" ? !0 : { path: o, query: x.fullPath === "/" ? {} : { next: x.fullPath } }), me(
3605
+ () => s.context.state.status,
3606
+ (x) => {
3607
+ const f = s.router.currentRoute.value;
3608
+ if (x === "unauthenticated" && f.path !== o) {
3609
+ s.router.replace({ path: o, query: { next: f.fullPath } });
3610
+ return;
3611
+ }
3612
+ if (x === "ready" && s.router.isReady().then(() => Ne(s)), x === "ready" && f.path === o) {
3613
+ const z = f.query.next;
3614
+ if (typeof z == "string" && Ct(z)) {
3615
+ location.assign(z);
3616
+ return;
3617
+ }
3618
+ s.router.replace(typeof z == "string" ? z : "/");
3619
+ }
3620
+ }
3621
+ );
3622
+ }
3623
+ };
3624
+ }
3625
+ const Ee = /* @__PURE__ */ new WeakSet();
3626
+ function Ne(l) {
3627
+ const o = l.router.currentRoute.value, s = o.query["email-change"];
3628
+ if (s !== "done" && s !== "expired" && s !== "taken" || Ee.has(o)) return;
3629
+ Ee.add(o);
3630
+ const n = l.i18n.scope("webx-auth"), x = { ...o.query };
3631
+ delete x["email-change"], l.router.replace({ path: o.path, query: x, hash: o.hash }), s === "done" ? Q.success(n("profile.email-done")) : Q.danger(n(`profile.email-${s}`));
3632
+ }
3633
+ function Ct(l) {
3634
+ if (!/^https?:\/\//i.test(l))
3635
+ return !1;
3636
+ try {
3637
+ return new URL(l).origin === location.origin;
3638
+ } catch {
3639
+ return !1;
3640
+ }
3641
+ }
3642
+ const Ft = ia(() => import("./ConnectPage-CMJlMsmn.js"));
3643
+ export {
3644
+ Ca as L,
3645
+ bt as P,
3646
+ Rt as U,
3647
+ Ft as W,
3648
+ Le as _,
3649
+ qa as a,
3650
+ Ba as b,
3651
+ Ka as c,
3652
+ Oa as d,
3653
+ ta as e,
3654
+ ot as f,
3655
+ Wa as g,
3656
+ lt as h,
3657
+ nt as i,
3658
+ St as j,
3659
+ Wt as k,
3660
+ Je as l,
3661
+ aa as m,
3662
+ Xe as n,
3663
+ Qe as o,
3664
+ Tt as p,
3665
+ pe as q,
3666
+ ga as r,
3667
+ Fa as s,
3668
+ la as t,
3669
+ re as u,
3670
+ _a as v,
3671
+ Ut as w,
3672
+ Lt as x,
3673
+ Ue as y
3674
+ };
3675
+ //# sourceMappingURL=index-Bd6Dkuu8.js.map