@webx-ui/module-auth 0.7.4 → 0.8.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.
package/dist/index.js CHANGED
@@ -1,61 +1,68 @@
1
- import { inject as ue, defineComponent as j, computed as P, ref as V, useTemplateRef as ne, onBeforeUnmount as Be, resolveComponent as T, openBlock as x, createBlock as F, withCtx as t, createVNode as l, withModifiers as Te, createCommentVNode as M, createElementVNode as O, createTextVNode as $, toDisplayString as C, watch as re, unref as e, isRef as ce, createElementBlock as R, resolveDynamicComponent as Ve, createSlots as Ae, Fragment as oe, renderList as de, h as Ce, normalizeClass as Me } from "vue";
2
- import { useTranslate as D, HttpError as Ee, useAdmin as X, useI18n as $e, useErrorText as ve, rowMenuWidth as Ne, WxDate as Oe, WxRowMenu as ge, WxFilterChips as Re, WxListScreen as De } from "@webx-ui/module-admin";
3
- import { useModal as me, WxDialog as pe, WxFormItem as N, WxInput as K, WxSelect as se, WxSpace as ee, WxCheckbox as _e, WxText as fe, WxButton as Y, toast as Q, useElementWidth as Ie, WxTable as Ke, WxEntityCard as Ye, WxBadge as J, WxAvatar as je, WxIcon as qe, createModal as he, confirm as He } from "@webx-ui/core";
4
- const Le = /* @__PURE__ */ Symbol("webx-auth");
5
- function we() {
6
- const a = ue(Le, null);
7
- if (a === null)
1
+ import { inject as ye, defineComponent as Q, computed as P, ref as T, useTemplateRef as re, onBeforeUnmount as qe, resolveComponent as H, openBlock as p, createBlock as V, withCtx as t, createVNode as a, withModifiers as Pe, createCommentVNode as E, createElementVNode as W, createTextVNode as d, toDisplayString as i, watch as ue, unref as e, isRef as be, createElementBlock as Y, resolveDynamicComponent as Fe, createSlots as Oe, Fragment as me, renderList as _e, h as Re, normalizeClass as Qe } from "vue";
2
+ import { useTranslate as j, HttpError as Xe, useAdmin as ee, useI18n as Be, useErrorText as ve, rowMenuWidth as Ze, WxDate as ie, WxRowMenu as Ve, WxFilterChips as Ee, WxListScreen as De, useTheme as et } from "@webx-ui/module-admin";
3
+ import { useRouter as tt, useRoute as at } from "vue-router";
4
+ import { useModal as ge, WxDialog as we, WxFormItem as M, WxInput as le, WxSelect as ne, WxSpace as oe, WxCheckbox as ze, WxText as B, WxButton as I, toast as q, useElementWidth as xe, WxTable as ke, WxEntityCard as Ce, WxBadge as K, WxAvatar as lt, WxIcon as Z, confirm as Ne, createModal as $e, WxCard as Le, WxHeading as he, WxTabs as nt, WxTab as de, WxAlert as ot, WxThemeSwitch as st } from "@webx-ui/core";
5
+ const Ie = /* @__PURE__ */ Symbol("webx-auth");
6
+ function Ae() {
7
+ const n = ye(Ie, null);
8
+ if (n === null)
8
9
  throw new Error("useAuth() was called outside a panel that installed the auth plugin.");
9
- return a;
10
+ return n;
10
11
  }
11
- function Ge(a) {
12
- const r = `${a.apiPath}/auth`;
12
+ function it(n) {
13
+ const u = `${n.apiPath}/auth`;
13
14
  return {
14
15
  async me() {
15
16
  try {
16
- return (await a.http.get(`${r}/me`)).data;
17
- } catch (s) {
18
- if (Qe(s))
17
+ return (await n.http.get(`${u}/me`)).data;
18
+ } catch (l) {
19
+ if (ut(l))
19
20
  return null;
20
- throw s;
21
+ throw l;
21
22
  }
22
23
  },
23
- async login(s) {
24
- const o = await a.http.post(`${r}/login`, {
25
- email: s.email,
26
- password: s.password,
27
- remember: s.remember ?? !1
24
+ async login(l) {
25
+ const o = await n.http.post(`${u}/login`, {
26
+ email: l.email,
27
+ password: l.password,
28
+ remember: l.remember ?? !1
28
29
  });
29
- return a.setUser(o.data), await a.reload(), o.data;
30
+ return n.setUser(o.data), await n.reload(), o.data;
30
31
  },
31
- async setLocale(s) {
32
- const o = await a.http.put(`${r}/locale`, { locale: s });
33
- a.setUser(o.data), await a.setLocale(s);
32
+ async setLocale(l) {
33
+ const o = await n.http.put(`${u}/locale`, { locale: l });
34
+ n.setUser(o.data), await n.setLocale(l);
34
35
  },
35
- async updateProfile(s) {
36
- const o = await a.http.put(
37
- `${r}/me`,
38
- s
36
+ async setTheme(l) {
37
+ const o = await n.http.put(`${u}/theme`, {
38
+ theme: l === "system" ? null : l
39
+ });
40
+ n.setUser(o.data);
41
+ },
42
+ async updateProfile(l) {
43
+ const o = await n.http.put(
44
+ `${u}/me`,
45
+ l
39
46
  );
40
- return a.setUser(o.data), o.data;
47
+ return n.setUser(o.data), o.data;
41
48
  },
42
49
  async logout() {
43
50
  try {
44
- await a.http.post(`${r}/logout`);
51
+ await n.http.post(`${u}/logout`);
45
52
  } finally {
46
- a.setUser(null), a.state.status = "unauthenticated", a.state.manifest = null;
53
+ n.setUser(null), n.state.status = "unauthenticated", n.state.manifest = null;
47
54
  }
48
55
  }
49
56
  };
50
57
  }
51
- const Ue = /* @__PURE__ */ Symbol("webx-auth-avatar"), Fe = /* @__PURE__ */ Symbol("webx-auth-avatar-field");
52
- function Je(a, r, s = null, o = null) {
53
- a.provide(Le, r), a.provide(Ue, s), a.provide(Fe, o);
58
+ const Me = /* @__PURE__ */ Symbol("webx-auth-avatar"), He = /* @__PURE__ */ Symbol("webx-auth-avatar-field");
59
+ function rt(n, u, l = null, o = null) {
60
+ n.provide(Ie, u), n.provide(Me, l), n.provide(He, o);
54
61
  }
55
- function Qe(a) {
56
- return typeof a == "object" && a !== null && "status" in a && a.status === 401;
62
+ function ut(n) {
63
+ return typeof n == "object" && n !== null && "status" in n && n.status === 401;
57
64
  }
58
- const Xe = ["title", "aria-label", "aria-pressed"], Ze = /* @__PURE__ */ j({
65
+ const ct = ["title", "aria-label", "aria-pressed"], dt = /* @__PURE__ */ Q({
59
66
  __name: "LoginCard",
60
67
  props: {
61
68
  emailLabel: { default: void 0 },
@@ -70,171 +77,171 @@ const Xe = ["title", "aria-label", "aria-pressed"], Ze = /* @__PURE__ */ j({
70
77
  autofocus: { type: Boolean, default: !0 }
71
78
  },
72
79
  emits: ["success"],
73
- setup(a, { expose: r, emit: s }) {
74
- const o = a, i = s, A = we(), f = D("webx-auth"), v = P(() => ({
75
- email: o.emailLabel ?? f("card.email"),
76
- password: o.passwordLabel ?? f("card.password"),
77
- remember: o.rememberLabel ?? f("card.remember"),
78
- submit: o.submitLabel ?? f("card.submit"),
79
- capsLock: o.capsLockWarning ?? f("card.caps-lock"),
80
- reveal: o.revealLabel ?? f("card.reveal"),
81
- hide: o.hideLabel ?? f("card.hide")
82
- })), h = V(""), S = V(""), n = V(!1), m = V(!1), g = V(!1), u = V(!1), w = V(""), b = V({}), d = V(0), L = ne("emailField");
83
- let U = null;
84
- Be(Z);
85
- const B = P(() => d.value > 0), y = P(
86
- () => o.throttleMessage === void 0 ? f("card.throttled", { seconds: d.value }) : o.throttleMessage.replace(":seconds", String(d.value))
80
+ setup(n, { expose: u, emit: l }) {
81
+ const o = n, y = l, c = Ae(), _ = j("webx-auth"), r = P(() => ({
82
+ email: o.emailLabel ?? _("card.email"),
83
+ password: o.passwordLabel ?? _("card.password"),
84
+ remember: o.rememberLabel ?? _("card.remember"),
85
+ submit: o.submitLabel ?? _("card.submit"),
86
+ capsLock: o.capsLockWarning ?? _("card.caps-lock"),
87
+ reveal: o.revealLabel ?? _("card.reveal"),
88
+ hide: o.hideLabel ?? _("card.hide")
89
+ })), b = T(""), O = T(""), v = T(!1), g = T(!1), w = T(!1), m = T(!1), k = T(""), f = T({}), h = T(0), z = re("emailField");
90
+ let A = null;
91
+ qe(D);
92
+ const S = P(() => h.value > 0), s = P(
93
+ () => o.throttleMessage === void 0 ? _("card.throttled", { seconds: h.value }) : o.throttleMessage.replace(":seconds", String(h.value))
87
94
  );
88
- async function p() {
89
- if (!(m.value || B.value)) {
90
- m.value = !0, w.value = "", b.value = {};
95
+ async function x() {
96
+ if (!(g.value || S.value)) {
97
+ g.value = !0, k.value = "", f.value = {};
91
98
  try {
92
- await A.login({
93
- email: h.value,
94
- password: S.value,
95
- remember: n.value
96
- }), S.value = "", i("success");
97
- } catch (W) {
98
- k(W);
99
+ await c.login({
100
+ email: b.value,
101
+ password: O.value,
102
+ remember: v.value
103
+ }), O.value = "", y("success");
104
+ } catch (C) {
105
+ U(C);
99
106
  } finally {
100
- m.value = !1;
107
+ g.value = !1;
101
108
  }
102
109
  }
103
110
  }
104
- function k(W) {
105
- if (!(W instanceof Ee)) {
106
- w.value = W instanceof Error ? W.message : String(W);
111
+ function U(C) {
112
+ if (!(C instanceof Xe)) {
113
+ k.value = C instanceof Error ? C.message : String(C);
107
114
  return;
108
115
  }
109
- if (W.isValidation) {
110
- b.value = W.errors;
116
+ if (C.isValidation) {
117
+ f.value = C.errors;
111
118
  return;
112
119
  }
113
- if (W.isThrottled) {
114
- ie(W.retryAfter ?? 60);
120
+ if (C.isThrottled) {
121
+ X(C.retryAfter ?? 60);
115
122
  return;
116
123
  }
117
- w.value = W.message;
124
+ k.value = C.message;
118
125
  }
119
- function ie(W) {
120
- Z(), d.value = W, U = setInterval(() => {
121
- d.value -= 1, d.value <= 0 && Z();
126
+ function X(C) {
127
+ D(), h.value = C, A = setInterval(() => {
128
+ h.value -= 1, h.value <= 0 && D();
122
129
  }, 1e3);
123
130
  }
124
- function Z() {
125
- U !== null && (clearInterval(U), U = null), d.value = 0;
131
+ function D() {
132
+ A !== null && (clearInterval(A), A = null), h.value = 0;
126
133
  }
127
- function q(W) {
128
- u.value = W.getModifierState("CapsLock");
134
+ function G(C) {
135
+ m.value = C.getModifierState("CapsLock");
129
136
  }
130
- return r({ focus: () => L.value?.focus() }), (W, E) => {
131
- const te = T("wx-alert"), H = T("wx-icon"), le = T("wx-input"), _ = T("wx-form-item"), z = T("wx-checkbox"), c = T("wx-button"), I = T("wx-form"), Pe = T("wx-card");
132
- return x(), F(Pe, {
137
+ return u({ focus: () => z.value?.focus() }), (C, R) => {
138
+ const $ = H("wx-alert"), J = H("wx-icon"), ce = H("wx-input"), F = H("wx-form-item"), N = H("wx-checkbox"), L = H("wx-button"), ae = H("wx-form"), Je = H("wx-card");
139
+ return p(), V(Je, {
133
140
  class: "wx-login",
134
141
  padding: 24
135
142
  }, {
136
143
  default: t(() => [
137
- l(I, {
138
- errors: b.value,
139
- disabled: m.value,
144
+ a(ae, {
145
+ errors: f.value,
146
+ disabled: g.value,
140
147
  gap: "md",
141
- onSubmit: Te(p, ["prevent"])
148
+ onSubmit: Pe(x, ["prevent"])
142
149
  }, {
143
150
  default: t(() => [
144
- w.value !== "" ? (x(), F(te, {
151
+ k.value !== "" ? (p(), V($, {
145
152
  key: 0,
146
153
  type: "danger",
147
154
  variant: "soft",
148
155
  live: "",
149
- description: w.value,
156
+ description: k.value,
150
157
  class: "wx-login__message"
151
- }, null, 8, ["description"])) : B.value ? (x(), F(te, {
158
+ }, null, 8, ["description"])) : S.value ? (p(), V($, {
152
159
  key: 1,
153
160
  type: "warning",
154
161
  variant: "soft",
155
162
  live: "",
156
- description: y.value,
163
+ description: s.value,
157
164
  class: "wx-login__message"
158
- }, null, 8, ["description"])) : M("", !0),
159
- l(_, { name: "email" }, {
165
+ }, null, 8, ["description"])) : E("", !0),
166
+ a(F, { name: "email" }, {
160
167
  default: t(() => [
161
- l(le, {
168
+ a(ce, {
162
169
  ref_key: "emailField",
163
- ref: L,
164
- modelValue: h.value,
165
- "onUpdate:modelValue": E[0] || (E[0] = (G) => h.value = G),
170
+ ref: z,
171
+ modelValue: b.value,
172
+ "onUpdate:modelValue": R[0] || (R[0] = (se) => b.value = se),
166
173
  type: "email",
167
- placeholder: v.value.email,
168
- "aria-label": v.value.email,
174
+ placeholder: r.value.email,
175
+ "aria-label": r.value.email,
169
176
  autocomplete: "username",
170
- autofocus: a.autofocus,
177
+ autofocus: n.autofocus,
171
178
  inputmode: "email",
172
179
  size: "lg"
173
180
  }, {
174
181
  prefix: t(() => [
175
- l(H, { name: "mail" })
182
+ a(J, { name: "mail" })
176
183
  ]),
177
184
  _: 1
178
185
  }, 8, ["modelValue", "placeholder", "aria-label", "autofocus"])
179
186
  ]),
180
187
  _: 1
181
188
  }),
182
- l(_, {
189
+ a(F, {
183
190
  name: "password",
184
- help: u.value ? v.value.capsLock : void 0
191
+ help: m.value ? r.value.capsLock : void 0
185
192
  }, {
186
193
  default: t(() => [
187
- l(le, {
188
- modelValue: S.value,
189
- "onUpdate:modelValue": E[2] || (E[2] = (G) => S.value = G),
190
- type: g.value ? "text" : "password",
191
- placeholder: v.value.password,
192
- "aria-label": v.value.password,
194
+ a(ce, {
195
+ modelValue: O.value,
196
+ "onUpdate:modelValue": R[2] || (R[2] = (se) => O.value = se),
197
+ type: w.value ? "text" : "password",
198
+ placeholder: r.value.password,
199
+ "aria-label": r.value.password,
193
200
  autocomplete: "current-password",
194
201
  size: "lg",
195
- onKeydown: q,
196
- onKeyup: q
202
+ onKeydown: G,
203
+ onKeyup: G
197
204
  }, {
198
205
  prefix: t(() => [
199
- l(H, { name: "lock" })
206
+ a(J, { name: "lock" })
200
207
  ]),
201
208
  suffix: t(() => [
202
- O("button", {
209
+ W("button", {
203
210
  type: "button",
204
211
  class: "wx-login__reveal",
205
- title: g.value ? v.value.hide : v.value.reveal,
206
- "aria-label": g.value ? v.value.hide : v.value.reveal,
207
- "aria-pressed": g.value,
212
+ title: w.value ? r.value.hide : r.value.reveal,
213
+ "aria-label": w.value ? r.value.hide : r.value.reveal,
214
+ "aria-pressed": w.value,
208
215
  tabindex: "-1",
209
- onClick: E[1] || (E[1] = (G) => g.value = !g.value)
216
+ onClick: R[1] || (R[1] = (se) => w.value = !w.value)
210
217
  }, [
211
- l(H, {
212
- name: g.value ? "eye-off" : "eye"
218
+ a(J, {
219
+ name: w.value ? "eye-off" : "eye"
213
220
  }, null, 8, ["name"])
214
- ], 8, Xe)
221
+ ], 8, ct)
215
222
  ]),
216
223
  _: 1
217
224
  }, 8, ["modelValue", "type", "placeholder", "aria-label"])
218
225
  ]),
219
226
  _: 1
220
227
  }, 8, ["help"]),
221
- a.remember ? (x(), F(z, {
228
+ n.remember ? (p(), V(N, {
222
229
  key: 2,
223
- modelValue: n.value,
224
- "onUpdate:modelValue": E[3] || (E[3] = (G) => n.value = G),
225
- label: v.value.remember,
230
+ modelValue: v.value,
231
+ "onUpdate:modelValue": R[3] || (R[3] = (se) => v.value = se),
232
+ label: r.value.remember,
226
233
  class: "wx-login__remember"
227
- }, null, 8, ["modelValue", "label"])) : M("", !0),
228
- l(c, {
234
+ }, null, 8, ["modelValue", "label"])) : E("", !0),
235
+ a(L, {
229
236
  type: "primary",
230
237
  "native-type": "submit",
231
238
  size: "lg",
232
239
  block: "",
233
- loading: m.value,
234
- disabled: B.value
240
+ loading: g.value,
241
+ disabled: S.value
235
242
  }, {
236
243
  default: t(() => [
237
- $(C(v.value.submit), 1)
244
+ d(i(r.value.submit), 1)
238
245
  ]),
239
246
  _: 1
240
247
  }, 8, ["loading", "disabled"])
@@ -246,12 +253,12 @@ const Xe = ["title", "aria-label", "aria-pressed"], Ze = /* @__PURE__ */ j({
246
253
  });
247
254
  };
248
255
  }
249
- }), be = (a, r) => {
250
- const s = a.__vccOpts || a;
251
- for (const [o, i] of r)
252
- s[o] = i;
253
- return s;
254
- }, ea = /* @__PURE__ */ be(Ze, [["__scopeId", "data-v-3c206e31"]]), Se = {
256
+ }), pe = (n, u) => {
257
+ const l = n.__vccOpts || n;
258
+ for (const [o, y] of u)
259
+ l[o] = y;
260
+ return l;
261
+ }, mt = /* @__PURE__ */ pe(dt, [["__scopeId", "data-v-3c206e31"]]), Ke = {
255
262
  card: {
256
263
  email: "Email",
257
264
  password: "Password",
@@ -304,6 +311,91 @@ const Xe = ["title", "aria-label", "aria-pressed"], Ze = /* @__PURE__ */ j({
304
311
  updated: "Administrator saved",
305
312
  deleted: "Administrator deleted"
306
313
  },
314
+ // The trail of what agents did through the panel: the view next to the administrators.
315
+ calls: {
316
+ title: "Agent calls",
317
+ when: "When",
318
+ who: "Who",
319
+ client: "Client",
320
+ tool: "Tool",
321
+ outcome: "Outcome",
322
+ took: "Took",
323
+ ms: ":count ms",
324
+ answered: "Answered",
325
+ refused: "Refused",
326
+ "dry-run": "Dry run",
327
+ local: "Local server",
328
+ deleted: "Administrator #:id",
329
+ "filter-user": "Administrator",
330
+ "filter-tool": "Tool",
331
+ "filter-outcome": "Outcome",
332
+ everybody: "Everybody",
333
+ "all-tools": "All tools",
334
+ "any-outcome": "Any outcome",
335
+ "only-answered": "Answered only",
336
+ "only-refused": "Refused only",
337
+ "only-dry": "Dry runs only",
338
+ arguments: "Arguments",
339
+ "no-arguments": "Called with no arguments",
340
+ error: "Refused with",
341
+ empty: "No calls match"
342
+ },
343
+ // The connections tab and the page that tells somebody how to make one.
344
+ connections: {
345
+ title: "Connections",
346
+ client: "Client",
347
+ allowed: "What is allowed",
348
+ connected: "Connected",
349
+ "last-used": "Last used",
350
+ who: "Administrator",
351
+ full: "Everything :name can do",
352
+ "full-you": "Everything you can do",
353
+ "read-only": "Reading only",
354
+ "returns-to": "Answers go to :host",
355
+ disconnect: "Disconnect",
356
+ disconnected: "Disconnected",
357
+ "never-used": "Never",
358
+ empty: "No agents are connected",
359
+ "empty-all": "Nobody has connected an agent",
360
+ "confirm-title": "Disconnect :client?",
361
+ "confirm-text": "It loses access at once, including the month of refreshing it was given. Connecting it again takes three clicks.",
362
+ confirm: "Disconnect",
363
+ cancel: "Cancel",
364
+ done: ":client is disconnected",
365
+ deleted: "Administrator #:id"
366
+ },
367
+ connect: {
368
+ 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.",
369
+ title: "Connect an agent",
370
+ address: "The address of this panel for agents",
371
+ copy: "Copy the address",
372
+ copied: "Copied",
373
+ "copy-failed": "Could not reach the clipboard. Select the address and copy it by hand.",
374
+ "copy-line": "Copy",
375
+ how: "How to add it",
376
+ "claude-title": "Claude",
377
+ "claude-1": "Open Settings and go to Connectors.",
378
+ "claude-2": 'Press "Add custom connector".',
379
+ "claude-3": "Paste the address and press Add.",
380
+ "chatgpt-title": "ChatGPT",
381
+ "chatgpt-1": "Open Settings and go to Connectors.",
382
+ "chatgpt-2": 'Press "Add" and choose a custom MCP server.',
383
+ "chatgpt-3": "Paste the address, leave the authentication as OAuth, and confirm.",
384
+ "claude-code-title": "Claude Code",
385
+ "claude-code-hint": "One line in a terminal, from any project:",
386
+ "codex-title": "Codex",
387
+ "codex-hint": "These lines in ~/.codex/config.toml:",
388
+ "one-click": "One click",
389
+ "one-click-hint": "These two take the whole thing from a link: the editor opens, asks once, and the server is there.",
390
+ "install-in": "Add to :client",
391
+ "cursor-title": "Cursor",
392
+ "vscode-title": "VS Code",
393
+ next: "What happens next",
394
+ "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.",
395
+ "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.',
396
+ "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.",
397
+ mine: "Your connections"
398
+ },
307
399
  errors: {
308
400
  unauthenticated: "Unauthenticated.",
309
401
  inactive: "This account is no longer active.",
@@ -331,10 +423,10 @@ const Xe = ["title", "aria-label", "aria-pressed"], Ze = /* @__PURE__ */ j({
331
423
  language: "Interface language"
332
424
  }
333
425
  };
334
- function ye(a) {
335
- const r = `${a.apiPath}/auth`, s = (o) => o.data;
426
+ function fe(n) {
427
+ const u = `${n.apiPath}/auth`, l = (o) => o.data;
336
428
  return {
337
- list: (o = {}) => a.http.get(`${r}/admins`, {
429
+ list: (o = {}) => n.http.get(`${u}/admins`, {
338
430
  query: {
339
431
  q: o.q || void 0,
340
432
  role: o.role ?? void 0,
@@ -343,35 +435,44 @@ function ye(a) {
343
435
  page: o.page,
344
436
  per_page: o.per_page
345
437
  }
346
- }).then((i) => ({ ...i.meta, data: i.data })),
347
- get: (o) => a.http.get(`${r}/admins/${o}`).then(s),
348
- create: (o) => a.http.post(`${r}/admins`, o).then(s),
349
- update: (o, i) => a.http.patch(`${r}/admins/${o}`, i).then(s),
350
- remove: (o) => a.http.delete(`${r}/admins/${o}`),
351
- roles: () => a.http.get(`${r}/roles`).then(s)
438
+ }).then((y) => ({ ...y.meta, data: y.data })),
439
+ get: (o) => n.http.get(`${u}/admins/${o}`).then(l),
440
+ create: (o) => n.http.post(`${u}/admins`, o).then(l),
441
+ update: (o, y) => n.http.patch(`${u}/admins/${o}`, y).then(l),
442
+ remove: (o) => n.http.delete(`${u}/admins/${o}`),
443
+ roles: () => n.http.get(`${u}/roles`).then(l),
444
+ calls: (o = {}) => n.http.get(`${u}/mcp-calls`, {
445
+ query: {
446
+ user: o.user ?? void 0,
447
+ tool: o.tool ?? void 0,
448
+ outcome: o.outcome ?? void 0,
449
+ page: o.page,
450
+ per_page: o.per_page
451
+ }
452
+ }).then((y) => ({ ...y.meta, data: y.data, filters: y.filters }))
352
453
  };
353
454
  }
354
- const xe = /* @__PURE__ */ new WeakSet();
355
- function ae() {
455
+ const Se = /* @__PURE__ */ new WeakSet();
456
+ function te() {
356
457
  try {
357
- const { i18n: a } = X();
358
- xe.has(a) || (a.defaults("webx-auth", Se), xe.add(a));
458
+ const { i18n: n } = ee();
459
+ Se.has(n) || (n.defaults("webx-auth", Ke), Se.add(n));
359
460
  } catch {
360
461
  }
361
462
  }
362
- const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la = {
463
+ const vt = { class: "wx-admin-form" }, pt = { class: "wx-admin-form__grid" }, ft = {
363
464
  key: 0,
364
465
  class: "wx-admin-form__aside"
365
- }, oa = { class: "wx-admin-form__fields" }, sa = /* @__PURE__ */ j({
466
+ }, ht = { class: "wx-admin-form__fields" }, yt = /* @__PURE__ */ Q({
366
467
  __name: "AdminDialog",
367
468
  props: {
368
469
  admin: { default: null },
369
470
  avatarField: { default: void 0 }
370
471
  },
371
- setup(a) {
372
- const r = a, { resolve: s, dismiss: o, open: i } = me(), A = X(), f = ye(A), v = $e();
373
- ae();
374
- const h = D("webx-auth"), S = ve(), n = V([]), m = V(!1), g = V({}), u = V({
472
+ setup(n) {
473
+ const u = n, { resolve: l, dismiss: o, open: y } = ge(), c = ee(), _ = fe(c), r = Be();
474
+ te();
475
+ const b = j("webx-auth"), O = ve(), v = T([]), g = T(!1), w = T({}), m = T({
375
476
  name: "",
376
477
  email: "",
377
478
  password: "",
@@ -380,81 +481,81 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
380
481
  is_super: !1,
381
482
  locale: null,
382
483
  roles: []
383
- }), w = P({
384
- get: () => u.value.avatar ? { path: u.value.avatar } : null,
385
- set: (y) => {
386
- u.value.avatar = y?.path ?? null;
484
+ }), k = P({
485
+ get: () => m.value.avatar ? { path: m.value.avatar } : null,
486
+ set: (s) => {
487
+ m.value.avatar = s?.path ?? null;
387
488
  }
388
- }), b = P(() => r.admin !== null), d = P(() => n.value.map((y) => ({ value: y.id, label: y.name }))), L = P(() => [
389
- { value: "auto", label: h("admins.locale-auto") },
390
- ...v.state.panelLocales.map((y) => ({ value: y.code, label: y.nativeName }))
489
+ }), f = P(() => u.admin !== null), h = P(() => v.value.map((s) => ({ value: s.id, label: s.name }))), z = P(() => [
490
+ { value: "auto", label: b("admins.locale-auto") },
491
+ ...r.state.panelLocales.map((s) => ({ value: s.code, label: s.nativeName }))
391
492
  ]);
392
- f.roles().then((y) => n.value = y), re(
393
- () => r.admin,
394
- (y) => {
395
- u.value = {
396
- name: y?.name ?? "",
397
- email: y?.email ?? "",
493
+ _.roles().then((s) => v.value = s), ue(
494
+ () => u.admin,
495
+ (s) => {
496
+ m.value = {
497
+ name: s?.name ?? "",
498
+ email: s?.email ?? "",
398
499
  password: "",
399
- avatar: y?.avatar ?? null,
400
- is_active: y?.is_active ?? !0,
401
- is_super: y?.is_super ?? !1,
402
- locale: y?.locale ?? "auto",
403
- roles: y?.roles.map((p) => p.id) ?? []
404
- }, g.value = {};
500
+ avatar: s?.avatar ?? null,
501
+ is_active: s?.is_active ?? !0,
502
+ is_super: s?.is_super ?? !1,
503
+ locale: s?.locale ?? "auto",
504
+ roles: s?.roles.map((x) => x.id) ?? []
505
+ }, w.value = {};
405
506
  },
406
507
  { immediate: !0 }
407
508
  );
408
- function U(y) {
409
- return g.value[y]?.[0];
509
+ function A(s) {
510
+ return w.value[s]?.[0];
410
511
  }
411
- async function B() {
412
- m.value = !0, g.value = {};
413
- const y = {
414
- name: u.value.name,
415
- email: u.value.email,
416
- avatar: u.value.avatar,
417
- is_active: u.value.is_active,
418
- is_super: u.value.is_super,
419
- locale: u.value.locale === "auto" ? null : u.value.locale,
420
- roles: u.value.roles ?? []
512
+ async function S() {
513
+ g.value = !0, w.value = {};
514
+ const s = {
515
+ name: m.value.name,
516
+ email: m.value.email,
517
+ avatar: m.value.avatar,
518
+ is_active: m.value.is_active,
519
+ is_super: m.value.is_super,
520
+ locale: m.value.locale === "auto" ? null : m.value.locale,
521
+ roles: m.value.roles ?? []
421
522
  };
422
- u.value.password && (y.password = u.value.password);
523
+ m.value.password && (s.password = m.value.password);
423
524
  try {
424
- const p = r.admin ? await f.update(r.admin.id, y) : await f.create(y);
425
- Q.success(h(b.value ? "admins.updated" : "admins.created")), s(p);
426
- } catch (p) {
427
- const k = p.body;
428
- k?.errors ? g.value = k.errors : Q.danger(S(p));
525
+ const x = u.admin ? await _.update(u.admin.id, s) : await _.create(s);
526
+ q.success(b(f.value ? "admins.updated" : "admins.created")), l(x);
527
+ } catch (x) {
528
+ const U = x.body;
529
+ U?.errors ? w.value = U.errors : q.danger(O(x));
429
530
  } finally {
430
- m.value = !1;
531
+ g.value = !1;
431
532
  }
432
533
  }
433
- return (y, p) => (x(), F(e(pe), {
434
- open: e(i),
435
- "onUpdate:open": p[9] || (p[9] = (k) => ce(i) ? i.value = k : null),
436
- title: b.value ? e(h)("admins.edit-short") : e(h)("admins.new-short"),
534
+ return (s, x) => (p(), V(e(we), {
535
+ open: e(y),
536
+ "onUpdate:open": x[9] || (x[9] = (U) => be(y) ? y.value = U : null),
537
+ title: f.value ? e(b)("admins.edit-short") : e(b)("admins.new-short"),
437
538
  width: 720
438
539
  }, {
439
540
  footer: t(() => [
440
- l(e(ee), { size: "sm" }, {
541
+ a(e(oe), { size: "sm" }, {
441
542
  default: t(() => [
442
- l(e(Y), {
543
+ a(e(I), {
443
544
  variant: "outline",
444
- onClick: p[8] || (p[8] = (k) => e(o)())
545
+ onClick: x[8] || (x[8] = (U) => e(o)())
445
546
  }, {
446
547
  default: t(() => [
447
- $(C(e(h)("admins.cancel")), 1)
548
+ d(i(e(b)("admins.cancel")), 1)
448
549
  ]),
449
550
  _: 1
450
551
  }),
451
- l(e(Y), {
552
+ a(e(I), {
452
553
  type: "primary",
453
- loading: m.value,
454
- onClick: B
554
+ loading: g.value,
555
+ onClick: S
455
556
  }, {
456
557
  default: t(() => [
457
- $(C(e(h)("admins.save")), 1)
558
+ d(i(e(b)("admins.save")), 1)
458
559
  ]),
459
560
  _: 1
460
561
  }, 8, ["loading"])
@@ -463,39 +564,39 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
463
564
  })
464
565
  ]),
465
566
  default: t(() => [
466
- O("div", aa, [
467
- O("div", ta, [
468
- a.avatarField ? (x(), R("div", la, [
469
- (x(), F(Ve(a.avatarField), {
470
- modelValue: w.value,
471
- "onUpdate:modelValue": p[0] || (p[0] = (k) => w.value = k),
472
- label: e(h)("admins.avatar"),
567
+ W("div", vt, [
568
+ W("div", pt, [
569
+ n.avatarField ? (p(), Y("div", ft, [
570
+ (p(), V(Fe(n.avatarField), {
571
+ modelValue: k.value,
572
+ "onUpdate:modelValue": x[0] || (x[0] = (U) => k.value = U),
573
+ label: e(b)("admins.avatar"),
473
574
  aspect: "1/1",
474
575
  captions: !1
475
576
  }, null, 8, ["modelValue", "label"]))
476
- ])) : M("", !0),
477
- O("div", oa, [
478
- l(e(N), {
479
- label: e(h)("admins.name"),
480
- error: U("name")
577
+ ])) : E("", !0),
578
+ W("div", ht, [
579
+ a(e(M), {
580
+ label: e(b)("admins.name"),
581
+ error: A("name")
481
582
  }, {
482
583
  default: t(() => [
483
- l(e(K), {
484
- modelValue: u.value.name,
485
- "onUpdate:modelValue": p[1] || (p[1] = (k) => u.value.name = k),
584
+ a(e(le), {
585
+ modelValue: m.value.name,
586
+ "onUpdate:modelValue": x[1] || (x[1] = (U) => m.value.name = U),
486
587
  name: "name"
487
588
  }, null, 8, ["modelValue"])
488
589
  ]),
489
590
  _: 1
490
591
  }, 8, ["label", "error"]),
491
- l(e(N), {
492
- label: e(h)("admins.email"),
493
- error: U("email")
592
+ a(e(M), {
593
+ label: e(b)("admins.email"),
594
+ error: A("email")
494
595
  }, {
495
596
  default: t(() => [
496
- l(e(K), {
497
- modelValue: u.value.email,
498
- "onUpdate:modelValue": p[2] || (p[2] = (k) => u.value.email = k),
597
+ a(e(le), {
598
+ modelValue: m.value.email,
599
+ "onUpdate:modelValue": x[2] || (x[2] = (U) => m.value.email = U),
499
600
  type: "email",
500
601
  name: "email",
501
602
  autocomplete: "off"
@@ -503,15 +604,15 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
503
604
  ]),
504
605
  _: 1
505
606
  }, 8, ["label", "error"]),
506
- l(e(N), {
507
- label: e(h)("admins.password"),
508
- error: U("password"),
509
- help: b.value ? e(h)("admins.password-keep") : e(h)("admins.password-hint")
607
+ a(e(M), {
608
+ label: e(b)("admins.password"),
609
+ error: A("password"),
610
+ help: f.value ? e(b)("admins.password-keep") : e(b)("admins.password-hint")
510
611
  }, {
511
612
  default: t(() => [
512
- l(e(K), {
513
- modelValue: u.value.password,
514
- "onUpdate:modelValue": p[3] || (p[3] = (k) => u.value.password = k),
613
+ a(e(le), {
614
+ modelValue: m.value.password,
615
+ "onUpdate:modelValue": x[3] || (x[3] = (U) => m.value.password = U),
515
616
  type: "password",
516
617
  name: "password",
517
618
  autocomplete: "new-password"
@@ -519,53 +620,53 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
519
620
  ]),
520
621
  _: 1
521
622
  }, 8, ["label", "error", "help"]),
522
- l(e(N), {
523
- label: e(h)("admins.roles"),
524
- error: U("roles")
623
+ a(e(M), {
624
+ label: e(b)("admins.roles"),
625
+ error: A("roles")
525
626
  }, {
526
627
  default: t(() => [
527
- l(e(se), {
528
- modelValue: u.value.roles,
529
- "onUpdate:modelValue": p[4] || (p[4] = (k) => u.value.roles = k),
530
- options: d.value,
628
+ a(e(ne), {
629
+ modelValue: m.value.roles,
630
+ "onUpdate:modelValue": x[4] || (x[4] = (U) => m.value.roles = U),
631
+ options: h.value,
531
632
  multiple: ""
532
633
  }, null, 8, ["modelValue", "options"])
533
634
  ]),
534
635
  _: 1
535
636
  }, 8, ["label", "error"]),
536
- l(e(N), {
537
- label: e(h)("admins.locale")
637
+ a(e(M), {
638
+ label: e(b)("admins.locale")
538
639
  }, {
539
640
  default: t(() => [
540
- l(e(se), {
541
- modelValue: u.value.locale,
542
- "onUpdate:modelValue": p[5] || (p[5] = (k) => u.value.locale = k),
543
- options: L.value
641
+ a(e(ne), {
642
+ modelValue: m.value.locale,
643
+ "onUpdate:modelValue": x[5] || (x[5] = (U) => m.value.locale = U),
644
+ options: z.value
544
645
  }, null, 8, ["modelValue", "options"])
545
646
  ]),
546
647
  _: 1
547
648
  }, 8, ["label"]),
548
- l(e(ee), { size: "md" }, {
649
+ a(e(oe), { size: "md" }, {
549
650
  default: t(() => [
550
- l(e(_e), {
551
- modelValue: u.value.is_active,
552
- "onUpdate:modelValue": p[6] || (p[6] = (k) => u.value.is_active = k),
553
- label: e(h)("admins.active")
651
+ a(e(ze), {
652
+ modelValue: m.value.is_active,
653
+ "onUpdate:modelValue": x[6] || (x[6] = (U) => m.value.is_active = U),
654
+ label: e(b)("admins.active")
554
655
  }, null, 8, ["modelValue", "label"]),
555
- l(e(_e), {
556
- modelValue: u.value.is_super,
557
- "onUpdate:modelValue": p[7] || (p[7] = (k) => u.value.is_super = k),
558
- label: e(h)("admins.super")
656
+ a(e(ze), {
657
+ modelValue: m.value.is_super,
658
+ "onUpdate:modelValue": x[7] || (x[7] = (U) => m.value.is_super = U),
659
+ label: e(b)("admins.super")
559
660
  }, null, 8, ["modelValue", "label"])
560
661
  ]),
561
662
  _: 1
562
663
  }),
563
- l(e(fe), {
664
+ a(e(B), {
564
665
  size: "sm",
565
666
  tone: "muted"
566
667
  }, {
567
668
  default: t(() => [
568
- $(C(e(h)("admins.super-hint")), 1)
669
+ d(i(e(b)("admins.super-hint")), 1)
569
670
  ]),
570
671
  _: 1
571
672
  })
@@ -576,7 +677,7 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
576
677
  _: 1
577
678
  }, 8, ["open", "title"]));
578
679
  }
579
- }), ke = 480, We = /* @__PURE__ */ j({
680
+ }), We = 480, Ye = /* @__PURE__ */ Q({
580
681
  __name: "AdminList",
581
682
  props: {
582
683
  picking: { type: Boolean, default: !1 },
@@ -586,41 +687,41 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
586
687
  resolveAvatar: { type: Function, default: void 0 }
587
688
  },
588
689
  emits: ["open", "chosen", "selection", "remove"],
589
- setup(a, { expose: r, emit: s }) {
590
- const o = a, i = s, A = X(), f = ye(A);
591
- ae();
592
- const v = ne("root"), h = Ie(v), S = P(() => h.value > 0 && h.value < ke), n = D("webx-auth"), m = D("webx-admin"), g = V(null), u = V([]), w = V(!1), b = V("all"), d = V("any"), L = V([]), U = V({});
593
- let B = { page: 1, perPage: 20, sort: null, search: "" };
594
- const y = P(() => [
595
- { value: "all", label: n("admins.all-roles") },
596
- ...u.value.map((_) => ({ value: _.slug, label: _.name }))
597
- ]), p = P(() => [
598
- { value: "any", label: n("admins.any-state") },
599
- { value: "yes", label: n("admins.only-active") },
600
- { value: "no", label: n("admins.only-inactive") }
601
- ]), k = P(() => {
602
- const _ = [], z = u.value.find((c) => c.slug === b.value);
603
- return z && _.push({
690
+ setup(n, { expose: u, emit: l }) {
691
+ const o = n, y = l, c = ee(), _ = fe(c);
692
+ te();
693
+ const r = re("root"), b = xe(r), O = P(() => b.value > 0 && b.value < We), v = j("webx-auth"), g = j("webx-admin"), w = T(null), m = T([]), k = T(!1), f = T("all"), h = T("any"), z = T([]), A = T({});
694
+ let S = { page: 1, perPage: 20, sort: null, search: "" };
695
+ const s = P(() => [
696
+ { value: "all", label: v("admins.all-roles") },
697
+ ...m.value.map((F) => ({ value: F.slug, label: F.name }))
698
+ ]), x = P(() => [
699
+ { value: "any", label: v("admins.any-state") },
700
+ { value: "yes", label: v("admins.only-active") },
701
+ { value: "no", label: v("admins.only-inactive") }
702
+ ]), U = P(() => {
703
+ const F = [], N = m.value.find((L) => L.slug === f.value);
704
+ return N && F.push({
604
705
  key: "role",
605
- label: `${n("admins.filter-role")}: ${z.name}`,
606
- clear: () => b.value = "all"
607
- }), d.value !== "any" && _.push({
706
+ label: `${v("admins.filter-role")}: ${N.name}`,
707
+ clear: () => f.value = "all"
708
+ }), h.value !== "any" && F.push({
608
709
  key: "state",
609
- label: `${n("admins.filter-state")}: ${d.value === "yes" ? n("admins.only-active") : n("admins.only-inactive")}`,
610
- clear: () => d.value = "any"
611
- }), _;
710
+ label: `${v("admins.filter-state")}: ${h.value === "yes" ? v("admins.only-active") : v("admins.only-inactive")}`,
711
+ clear: () => h.value = "any"
712
+ }), F;
612
713
  });
613
- function ie() {
614
- b.value = "all", d.value = "any";
714
+ function X() {
715
+ f.value = "all", h.value = "any";
615
716
  }
616
- const Z = P(() => S.value ? [{ key: "card", label: "" }] : [
617
- { key: "name", label: n("admins.name"), sortable: !0 },
618
- { key: "email", label: n("admins.email"), sortable: !0, hideBelow: 560 },
619
- { key: "roles", label: n("admins.roles"), hideBelow: 760 },
620
- { key: "is_active", label: n("admins.active"), align: "center", hideBelow: 660 },
717
+ const D = P(() => O.value ? [{ key: "card", label: "" }] : [
718
+ { key: "name", label: v("admins.name"), sortable: !0 },
719
+ { key: "email", label: v("admins.email"), sortable: !0, hideBelow: 560 },
720
+ { key: "roles", label: v("admins.roles"), hideBelow: 760 },
721
+ { key: "is_active", label: v("admins.active"), align: "center", hideBelow: 660 },
621
722
  {
622
723
  key: "last_login_at",
623
- label: n("admins.last-login"),
724
+ label: v("admins.last-login"),
624
725
  sortable: !0,
625
726
  hideBelow: 900,
626
727
  // The first thing to go when a row becomes a card: it is a date somebody scans down a
@@ -630,203 +731,203 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
630
731
  {
631
732
  key: "actions",
632
733
  label: "",
633
- width: Ne,
734
+ width: Ze,
634
735
  align: "right",
635
736
  hidden: !o.removable,
636
737
  // A card puts them along its top instead, through the `card-actions` slot.
637
738
  hideOnCards: !0
638
739
  }
639
740
  ]);
640
- f.roles().then((_) => u.value = _), re([b, d], () => q(B));
641
- async function q(_) {
642
- B = _, w.value = !0;
741
+ _.roles().then((F) => m.value = F), ue([f, h], () => G(S));
742
+ async function G(F) {
743
+ S = F, k.value = !0;
643
744
  try {
644
- g.value = await f.list({
645
- q: _.search,
646
- role: b.value === "all" ? null : b.value,
647
- active: d.value === "any" ? null : d.value,
648
- sort: _.sort ? `${_.sort.order === "desc" ? "-" : ""}${_.sort.key}` : "name",
649
- page: _.page,
650
- per_page: _.perPage
651
- }), W();
745
+ w.value = await _.list({
746
+ q: F.search,
747
+ role: f.value === "all" ? null : f.value,
748
+ active: h.value === "any" ? null : h.value,
749
+ sort: F.sort ? `${F.sort.order === "desc" ? "-" : ""}${F.sort.key}` : "name",
750
+ page: F.page,
751
+ per_page: F.perPage
752
+ }), C();
652
753
  } finally {
653
- w.value = !1;
754
+ k.value = !1;
654
755
  }
655
756
  }
656
- async function W() {
657
- const _ = o.resolveAvatar;
658
- if (_)
659
- for (const z of g.value?.data ?? []) {
660
- if (!z.avatar || U.value[z.avatar]) continue;
661
- const c = await _(z.avatar);
662
- c && (U.value = { ...U.value, [z.avatar]: c });
757
+ async function C() {
758
+ const F = o.resolveAvatar;
759
+ if (F)
760
+ for (const N of w.value?.data ?? []) {
761
+ if (!N.avatar || A.value[N.avatar]) continue;
762
+ const L = await F(N.avatar);
763
+ L && (A.value = { ...A.value, [N.avatar]: L });
663
764
  }
664
765
  }
665
- function E(_) {
766
+ function R(F) {
666
767
  return [
667
768
  {
668
769
  key: "delete",
669
770
  icon: "trash",
670
- label: n("admins.delete"),
771
+ label: v("admins.delete"),
671
772
  danger: !0,
672
- run: () => i("remove", _)
773
+ run: () => y("remove", F)
673
774
  }
674
775
  ];
675
776
  }
676
- function te(_) {
777
+ function $(F) {
677
778
  if (o.picking) {
678
- i("chosen", [_]);
779
+ y("chosen", [F]);
679
780
  return;
680
781
  }
681
- i("open", _);
782
+ y("open", F);
682
783
  }
683
- const H = P(() => !(o.picking && o.multiple));
684
- function le(_, z) {
685
- L.value = z, i("selection", z);
784
+ const J = P(() => !(o.picking && o.multiple));
785
+ function ce(F, N) {
786
+ z.value = N, y("selection", N);
686
787
  }
687
- return r({ reload: () => q(B), chosen: () => L.value }), (_, z) => (x(), R("div", {
788
+ return u({ reload: () => G(S), chosen: () => z.value }), (F, N) => (p(), Y("div", {
688
789
  ref_key: "root",
689
- ref: v,
790
+ ref: r,
690
791
  class: "wx-admin-list"
691
792
  }, [
692
- l(e(Ke), {
693
- data: g.value,
694
- columns: Z.value,
793
+ a(e(ke), {
794
+ data: w.value,
795
+ columns: D.value,
695
796
  "row-key": "id",
696
797
  searchable: "",
697
- clickable: H.value,
698
- hover: H.value,
798
+ clickable: J.value,
799
+ hover: J.value,
699
800
  flush: "",
700
- loading: w.value,
701
- "search-placeholder": e(n)("admins.search"),
702
- "empty-text": e(n)("admins.empty"),
703
- selectable: a.picking && a.multiple,
704
- "cards-below": ke,
705
- "filters-count": k.value.length,
706
- "filters-label": e(m)("filters.title"),
707
- onRowClick: te,
708
- onStateChange: q,
709
- onSelectionChange: le
710
- }, Ae({
711
- "cell-name": t(({ row: c }) => [
712
- l(e(ee), {
801
+ loading: k.value,
802
+ "search-placeholder": e(v)("admins.search"),
803
+ "empty-text": e(v)("admins.empty"),
804
+ selectable: n.picking && n.multiple,
805
+ "cards-below": We,
806
+ "filters-count": U.value.length,
807
+ "filters-label": e(g)("filters.title"),
808
+ onRowClick: $,
809
+ onStateChange: G,
810
+ onSelectionChange: ce
811
+ }, Oe({
812
+ "cell-name": t(({ row: L }) => [
813
+ a(e(oe), {
713
814
  size: "sm",
714
815
  align: "center"
715
816
  }, {
716
817
  default: t(() => [
717
- l(e(je), {
718
- name: c.name,
719
- src: c.avatar ? U.value[c.avatar] : void 0,
818
+ a(e(lt), {
819
+ name: L.name,
820
+ src: L.avatar ? A.value[L.avatar] : void 0,
720
821
  size: "sm"
721
822
  }, null, 8, ["name", "src"]),
722
- O("span", null, C(c.name), 1),
723
- c.is_super ? (x(), F(e(J), {
823
+ W("span", null, i(L.name), 1),
824
+ L.is_super ? (p(), V(e(K), {
724
825
  key: 0,
725
826
  type: "warning"
726
827
  }, {
727
828
  default: t(() => [
728
- $(C(e(n)("admins.super")), 1)
829
+ d(i(e(v)("admins.super")), 1)
729
830
  ]),
730
831
  _: 1
731
- })) : M("", !0)
832
+ })) : E("", !0)
732
833
  ]),
733
834
  _: 2
734
835
  }, 1024)
735
836
  ]),
736
- "cell-roles": t(({ row: c }) => [
737
- c.roles.length > 0 ? (x(), F(e(ee), {
837
+ "cell-roles": t(({ row: L }) => [
838
+ L.roles.length > 0 ? (p(), V(e(oe), {
738
839
  key: 0,
739
840
  size: "xs",
740
841
  wrap: ""
741
842
  }, {
742
843
  default: t(() => [
743
- (x(!0), R(oe, null, de(c.roles, (I) => (x(), F(e(J), {
744
- key: I.id
844
+ (p(!0), Y(me, null, _e(L.roles, (ae) => (p(), V(e(K), {
845
+ key: ae.id
745
846
  }, {
746
847
  default: t(() => [
747
- $(C(I.name), 1)
848
+ d(i(ae.name), 1)
748
849
  ]),
749
850
  _: 2
750
851
  }, 1024))), 128))
751
852
  ]),
752
853
  _: 2
753
- }, 1024)) : (x(), F(e(fe), {
854
+ }, 1024)) : (p(), V(e(B), {
754
855
  key: 1,
755
856
  size: "sm",
756
857
  tone: "muted"
757
858
  }, {
758
859
  default: t(() => [
759
- $(C(e(n)("admins.no-roles")), 1)
860
+ d(i(e(v)("admins.no-roles")), 1)
760
861
  ]),
761
862
  _: 1
762
863
  }))
763
864
  ]),
764
- "cell-is_active": t(({ row: c }) => [
765
- l(e(J), {
766
- type: c.is_active ? "success" : "default",
865
+ "cell-is_active": t(({ row: L }) => [
866
+ a(e(K), {
867
+ type: L.is_active ? "success" : "default",
767
868
  dot: ""
768
869
  }, {
769
870
  default: t(() => [
770
- $(C(c.is_active ? e(n)("admins.active") : e(n)("admins.only-inactive")), 1)
871
+ d(i(L.is_active ? e(v)("admins.active") : e(v)("admins.only-inactive")), 1)
771
872
  ]),
772
873
  _: 2
773
874
  }, 1032, ["type"])
774
875
  ]),
775
- "card-actions": t(({ row: c }) => [
776
- a.removable ? (x(), F(e(ge), {
876
+ "card-actions": t(({ row: L }) => [
877
+ n.removable ? (p(), V(e(Ve), {
777
878
  key: 0,
778
- actions: E(c),
779
- label: c.name
780
- }, null, 8, ["actions", "label"])) : M("", !0)
879
+ actions: R(L),
880
+ label: L.name
881
+ }, null, 8, ["actions", "label"])) : E("", !0)
781
882
  ]),
782
- "cell-actions": t(({ row: c }) => [
783
- l(e(ge), {
784
- actions: E(c),
785
- label: c.name
883
+ "cell-actions": t(({ row: L }) => [
884
+ a(e(Ve), {
885
+ actions: R(L),
886
+ label: L.name
786
887
  }, null, 8, ["actions", "label"])
787
888
  ]),
788
- "cell-last_login_at": t(({ row: c }) => [
789
- l(e(Oe), {
790
- value: c.last_login_at,
791
- tone: c.last_login_at ? "default" : "muted",
889
+ "cell-last_login_at": t(({ row: L }) => [
890
+ a(e(ie), {
891
+ value: L.last_login_at,
892
+ tone: L.last_login_at ? "default" : "muted",
792
893
  compact: ""
793
894
  }, null, 8, ["value", "tone"])
794
895
  ]),
795
- "cell-card": t(({ row: c }) => [
796
- l(e(Ye), {
896
+ "cell-card": t(({ row: L }) => [
897
+ a(e(Ce), {
797
898
  variant: "plain",
798
899
  shape: "circle",
799
- title: c.name,
800
- image: c.avatar ? U.value[c.avatar] : void 0,
801
- subtitle: c.email
900
+ title: L.name,
901
+ image: L.avatar ? A.value[L.avatar] : void 0,
902
+ subtitle: L.email
802
903
  }, {
803
904
  meta: t(() => [
804
- c.is_super ? (x(), F(e(J), {
905
+ L.is_super ? (p(), V(e(K), {
805
906
  key: 0,
806
907
  type: "warning",
807
908
  size: "sm"
808
909
  }, {
809
910
  default: t(() => [
810
- $(C(e(n)("admins.super")), 1)
911
+ d(i(e(v)("admins.super")), 1)
811
912
  ]),
812
913
  _: 1
813
- })) : M("", !0),
814
- (x(!0), R(oe, null, de(c.roles, (I) => (x(), F(e(J), {
815
- key: I.id,
914
+ })) : E("", !0),
915
+ (p(!0), Y(me, null, _e(L.roles, (ae) => (p(), V(e(K), {
916
+ key: ae.id,
816
917
  size: "sm"
817
918
  }, {
818
919
  default: t(() => [
819
- $(C(I.name), 1)
920
+ d(i(ae.name), 1)
820
921
  ]),
821
922
  _: 2
822
923
  }, 1024))), 128)),
823
- l(e(J), {
824
- type: c.is_active ? "success" : "default",
924
+ a(e(K), {
925
+ type: L.is_active ? "success" : "default",
825
926
  dot: "",
826
927
  size: "sm"
827
928
  }, {
828
929
  default: t(() => [
829
- $(C(c.is_active ? e(n)("admins.active") : e(n)("admins.only-inactive")), 1)
930
+ d(i(L.is_active ? e(v)("admins.active") : e(v)("admins.only-inactive")), 1)
830
931
  ]),
831
932
  _: 2
832
933
  }, 1032, ["type"])
@@ -836,210 +937,1119 @@ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la
836
937
  ]),
837
938
  _: 2
838
939
  }, [
839
- a.filters ? {
940
+ n.filters ? {
840
941
  name: "filters",
841
942
  fn: t(() => [
842
- l(e(N), {
843
- label: e(n)("admins.filter-role")
943
+ a(e(M), {
944
+ label: e(v)("admins.filter-role")
844
945
  }, {
845
946
  default: t(() => [
846
- l(e(se), {
847
- modelValue: b.value,
848
- "onUpdate:modelValue": z[0] || (z[0] = (c) => b.value = c),
849
- options: y.value,
947
+ a(e(ne), {
948
+ modelValue: f.value,
949
+ "onUpdate:modelValue": N[0] || (N[0] = (L) => f.value = L),
950
+ options: s.value,
850
951
  size: "sm"
851
952
  }, null, 8, ["modelValue", "options"])
852
953
  ]),
853
954
  _: 1
854
955
  }, 8, ["label"]),
855
- l(e(N), {
856
- label: e(n)("admins.filter-state")
956
+ a(e(M), {
957
+ label: e(v)("admins.filter-state")
857
958
  }, {
858
959
  default: t(() => [
859
- l(e(se), {
860
- modelValue: d.value,
861
- "onUpdate:modelValue": z[1] || (z[1] = (c) => d.value = c),
862
- options: p.value,
960
+ a(e(ne), {
961
+ modelValue: h.value,
962
+ "onUpdate:modelValue": N[1] || (N[1] = (L) => h.value = L),
963
+ options: x.value,
863
964
  size: "sm"
864
965
  }, null, 8, ["modelValue", "options"])
865
966
  ]),
866
967
  _: 1
867
968
  }, 8, ["label"]),
868
- k.value.length > 0 ? (x(), F(e(Y), {
969
+ U.value.length > 0 ? (p(), V(e(I), {
869
970
  key: 0,
870
971
  variant: "text",
871
972
  size: "sm",
872
973
  block: "",
873
- onClick: ie
974
+ onClick: X
874
975
  }, {
875
976
  icon: t(() => [
876
- l(e(qe), { name: "close" })
977
+ a(e(Z), { name: "close" })
877
978
  ]),
878
979
  default: t(() => [
879
- $(" " + C(e(m)("filters.reset")), 1)
980
+ d(" " + i(e(g)("filters.reset")), 1)
880
981
  ]),
881
982
  _: 1
882
- })) : M("", !0)
983
+ })) : E("", !0)
883
984
  ]),
884
985
  key: "0"
885
986
  } : void 0,
886
- a.filters ? {
987
+ n.filters ? {
887
988
  name: "applied",
888
989
  fn: t(() => [
889
- l(e(Re), { filters: k.value }, null, 8, ["filters"])
990
+ a(e(Ee), { filters: U.value }, null, 8, ["filters"])
890
991
  ]),
891
992
  key: "1"
892
993
  } : void 0
893
994
  ]), 1032, ["data", "columns", "clickable", "hover", "loading", "search-placeholder", "empty-text", "selectable", "filters-count", "filters-label"])
894
995
  ], 512));
895
996
  }
896
- }), na = /* @__PURE__ */ j({
997
+ }), _t = { class: "wx-call-list__details" }, bt = {
998
+ key: 1,
999
+ class: "wx-call-list__arguments"
1000
+ }, gt = {
1001
+ class: "wx-call-list__glyph",
1002
+ "aria-hidden": "true"
1003
+ }, wt = {
1004
+ key: 1,
1005
+ class: "wx-call-list__arguments"
1006
+ }, Te = 480, xt = /* @__PURE__ */ Q({
1007
+ __name: "CallList",
1008
+ setup(n, { expose: u }) {
1009
+ const l = ee(), o = fe(l);
1010
+ te();
1011
+ const y = re("root"), c = xe(y), _ = P(() => c.value > 0 && c.value < Te), r = j("webx-auth"), b = j("webx-admin"), O = T(null), v = T({ users: [], tools: [] }), g = T(!1), w = T("all"), m = T("all"), k = T("any");
1012
+ let f = { page: 1, perPage: 30, sort: null, search: "" };
1013
+ function h(C) {
1014
+ return C === null ? r("calls.local") : C.name ?? r("calls.deleted", { id: C.id });
1015
+ }
1016
+ const z = P(() => [
1017
+ { value: "all", label: r("calls.everybody") },
1018
+ ...v.value.users.map((C) => ({
1019
+ value: C.id === null ? "none" : String(C.id),
1020
+ label: h(C.id === null ? null : { id: C.id, name: C.name })
1021
+ }))
1022
+ ]), A = P(() => [
1023
+ { value: "all", label: r("calls.all-tools") },
1024
+ ...v.value.tools.map((C) => ({ value: C, label: C }))
1025
+ ]), S = P(() => [
1026
+ { value: "any", label: r("calls.any-outcome") },
1027
+ { value: "ok", label: r("calls.only-answered") },
1028
+ { value: "failed", label: r("calls.only-refused") },
1029
+ { value: "dry", label: r("calls.only-dry") }
1030
+ ]), s = P(() => {
1031
+ const C = [], R = z.value.find((J) => J.value === w.value);
1032
+ w.value !== "all" && R && C.push({
1033
+ key: "user",
1034
+ label: `${r("calls.filter-user")}: ${R.label}`,
1035
+ clear: () => w.value = "all"
1036
+ }), m.value !== "all" && C.push({
1037
+ key: "tool",
1038
+ label: `${r("calls.filter-tool")}: ${m.value}`,
1039
+ clear: () => m.value = "all"
1040
+ });
1041
+ const $ = S.value.find((J) => J.value === k.value);
1042
+ return k.value !== "any" && $ && C.push({
1043
+ key: "outcome",
1044
+ label: `${r("calls.filter-outcome")}: ${$.label}`,
1045
+ clear: () => k.value = "any"
1046
+ }), C;
1047
+ });
1048
+ function x() {
1049
+ w.value = "all", m.value = "all", k.value = "any";
1050
+ }
1051
+ const U = P(() => _.value ? [{ key: "card", label: "" }] : [
1052
+ { key: "at", label: r("calls.when") },
1053
+ { key: "user", label: r("calls.who"), hideBelow: 640 },
1054
+ { key: "tool", label: r("calls.tool") },
1055
+ { key: "outcome", label: r("calls.outcome") },
1056
+ { key: "duration_ms", label: r("calls.took"), align: "right", hideBelow: 820 },
1057
+ { key: "client", label: r("calls.client"), hideBelow: 960 }
1058
+ ]);
1059
+ ue([w, m, k], () => X({ ...f, page: 1 }));
1060
+ async function X(C) {
1061
+ f = C, g.value = !0;
1062
+ try {
1063
+ O.value = await o.calls({
1064
+ user: w.value === "all" ? null : w.value,
1065
+ tool: m.value === "all" ? null : m.value,
1066
+ outcome: k.value === "any" ? null : k.value,
1067
+ page: C.page,
1068
+ per_page: C.perPage
1069
+ }), v.value = O.value.filters;
1070
+ } finally {
1071
+ g.value = !1;
1072
+ }
1073
+ }
1074
+ function D(C) {
1075
+ return C.ok ? C.dry_run ? { type: "info", label: r("calls.dry-run") } : { type: "success", label: r("calls.answered") } : { type: "danger", label: r("calls.refused") };
1076
+ }
1077
+ function G(C) {
1078
+ return C.arguments !== null || C.error !== null;
1079
+ }
1080
+ return u({ reload: () => X(f) }), (C, R) => (p(), Y("div", {
1081
+ ref_key: "root",
1082
+ ref: y,
1083
+ class: "wx-call-list"
1084
+ }, [
1085
+ a(e(ke), {
1086
+ data: O.value,
1087
+ columns: U.value,
1088
+ "row-key": "id",
1089
+ flush: "",
1090
+ loading: g.value,
1091
+ clickable: !1,
1092
+ expandable: !_.value,
1093
+ "expandable-if": G,
1094
+ "empty-text": e(r)("calls.empty"),
1095
+ "cards-below": Te,
1096
+ "filters-count": s.value.length,
1097
+ "filters-label": e(b)("filters.title"),
1098
+ onStateChange: X
1099
+ }, {
1100
+ filters: t(() => [
1101
+ a(e(M), {
1102
+ label: e(r)("calls.filter-user")
1103
+ }, {
1104
+ default: t(() => [
1105
+ a(e(ne), {
1106
+ modelValue: w.value,
1107
+ "onUpdate:modelValue": R[0] || (R[0] = ($) => w.value = $),
1108
+ options: z.value,
1109
+ size: "sm"
1110
+ }, null, 8, ["modelValue", "options"])
1111
+ ]),
1112
+ _: 1
1113
+ }, 8, ["label"]),
1114
+ a(e(M), {
1115
+ label: e(r)("calls.filter-tool")
1116
+ }, {
1117
+ default: t(() => [
1118
+ a(e(ne), {
1119
+ modelValue: m.value,
1120
+ "onUpdate:modelValue": R[1] || (R[1] = ($) => m.value = $),
1121
+ options: A.value,
1122
+ size: "sm"
1123
+ }, null, 8, ["modelValue", "options"])
1124
+ ]),
1125
+ _: 1
1126
+ }, 8, ["label"]),
1127
+ a(e(M), {
1128
+ label: e(r)("calls.filter-outcome")
1129
+ }, {
1130
+ default: t(() => [
1131
+ a(e(ne), {
1132
+ modelValue: k.value,
1133
+ "onUpdate:modelValue": R[2] || (R[2] = ($) => k.value = $),
1134
+ options: S.value,
1135
+ size: "sm"
1136
+ }, null, 8, ["modelValue", "options"])
1137
+ ]),
1138
+ _: 1
1139
+ }, 8, ["label"]),
1140
+ s.value.length > 0 ? (p(), V(e(I), {
1141
+ key: 0,
1142
+ variant: "text",
1143
+ size: "sm",
1144
+ block: "",
1145
+ onClick: x
1146
+ }, {
1147
+ icon: t(() => [
1148
+ a(e(Z), { name: "close" })
1149
+ ]),
1150
+ default: t(() => [
1151
+ d(" " + i(e(b)("filters.reset")), 1)
1152
+ ]),
1153
+ _: 1
1154
+ })) : E("", !0)
1155
+ ]),
1156
+ applied: t(() => [
1157
+ a(e(Ee), { filters: s.value }, null, 8, ["filters"])
1158
+ ]),
1159
+ "cell-at": t(({ row: $ }) => [
1160
+ a(e(ie), {
1161
+ value: $.at,
1162
+ tone: "default",
1163
+ compact: ""
1164
+ }, null, 8, ["value"])
1165
+ ]),
1166
+ "cell-user": t(({ row: $ }) => [
1167
+ a(e(B), {
1168
+ tone: $.user === null || $.user.name === null ? "muted" : "default"
1169
+ }, {
1170
+ default: t(() => [
1171
+ d(i(h($.user)), 1)
1172
+ ]),
1173
+ _: 2
1174
+ }, 1032, ["tone"])
1175
+ ]),
1176
+ "cell-tool": t(({ row: $ }) => [
1177
+ a(e(B), {
1178
+ mono: "",
1179
+ size: "sm"
1180
+ }, {
1181
+ default: t(() => [
1182
+ d(i($.tool), 1)
1183
+ ]),
1184
+ _: 2
1185
+ }, 1024)
1186
+ ]),
1187
+ "cell-outcome": t(({ row: $ }) => [
1188
+ a(e(K), {
1189
+ type: D($).type,
1190
+ dot: ""
1191
+ }, {
1192
+ default: t(() => [
1193
+ d(i(D($).label), 1)
1194
+ ]),
1195
+ _: 2
1196
+ }, 1032, ["type"])
1197
+ ]),
1198
+ "cell-duration_ms": t(({ row: $ }) => [
1199
+ a(e(B), {
1200
+ size: "sm",
1201
+ tone: "muted"
1202
+ }, {
1203
+ default: t(() => [
1204
+ d(i(e(r)("calls.ms", { count: $.duration_ms })), 1)
1205
+ ]),
1206
+ _: 2
1207
+ }, 1024)
1208
+ ]),
1209
+ "cell-client": t(({ row: $ }) => [
1210
+ $.client ? (p(), V(e(B), {
1211
+ key: 0,
1212
+ size: "sm"
1213
+ }, {
1214
+ default: t(() => [
1215
+ d(i($.client), 1)
1216
+ ]),
1217
+ _: 2
1218
+ }, 1024)) : (p(), V(e(B), {
1219
+ key: 1,
1220
+ size: "sm",
1221
+ tone: "muted"
1222
+ }, {
1223
+ default: t(() => [...R[3] || (R[3] = [
1224
+ d("—", -1)
1225
+ ])]),
1226
+ _: 1
1227
+ }))
1228
+ ]),
1229
+ expanded: t(({ row: $ }) => [
1230
+ W("div", _t, [
1231
+ $.error ? (p(), V(e(B), {
1232
+ key: 0,
1233
+ tone: "danger",
1234
+ size: "sm",
1235
+ class: "wx-call-list__error"
1236
+ }, {
1237
+ default: t(() => [
1238
+ W("strong", null, i(e(r)("calls.error")) + ":", 1),
1239
+ d(" " + i($.error), 1)
1240
+ ]),
1241
+ _: 2
1242
+ }, 1024)) : E("", !0),
1243
+ $.arguments ? (p(), Y("pre", bt, i($.arguments), 1)) : (p(), V(e(B), {
1244
+ key: 2,
1245
+ size: "sm",
1246
+ tone: "muted"
1247
+ }, {
1248
+ default: t(() => [
1249
+ d(i(e(r)("calls.no-arguments")), 1)
1250
+ ]),
1251
+ _: 1
1252
+ }))
1253
+ ])
1254
+ ]),
1255
+ "cell-card": t(({ row: $ }) => [
1256
+ a(e(Ce), {
1257
+ variant: "plain",
1258
+ title: $.tool,
1259
+ subtitle: h($.user)
1260
+ }, {
1261
+ media: t(() => [
1262
+ W("span", gt, [
1263
+ a(e(Z), { name: "sliders" })
1264
+ ])
1265
+ ]),
1266
+ meta: t(() => [
1267
+ a(e(K), {
1268
+ type: D($).type,
1269
+ dot: "",
1270
+ size: "sm"
1271
+ }, {
1272
+ default: t(() => [
1273
+ d(i(D($).label), 1)
1274
+ ]),
1275
+ _: 2
1276
+ }, 1032, ["type"]),
1277
+ a(e(ie), {
1278
+ value: $.at,
1279
+ compact: ""
1280
+ }, null, 8, ["value"]),
1281
+ $.client ? (p(), V(e(B), {
1282
+ key: 0,
1283
+ size: "xs",
1284
+ tone: "muted"
1285
+ }, {
1286
+ default: t(() => [
1287
+ d(i($.client), 1)
1288
+ ]),
1289
+ _: 2
1290
+ }, 1024)) : E("", !0)
1291
+ ]),
1292
+ default: t(() => [
1293
+ G($) ? (p(), V(e(oe), {
1294
+ key: 0,
1295
+ direction: "vertical",
1296
+ size: "xs",
1297
+ class: "wx-call-list__card-details"
1298
+ }, {
1299
+ default: t(() => [
1300
+ $.error ? (p(), V(e(B), {
1301
+ key: 0,
1302
+ tone: "danger",
1303
+ size: "sm"
1304
+ }, {
1305
+ default: t(() => [
1306
+ d(i($.error), 1)
1307
+ ]),
1308
+ _: 2
1309
+ }, 1024)) : E("", !0),
1310
+ $.arguments ? (p(), Y("pre", wt, i($.arguments), 1)) : E("", !0)
1311
+ ]),
1312
+ _: 2
1313
+ }, 1024)) : E("", !0)
1314
+ ]),
1315
+ _: 2
1316
+ }, 1032, ["title", "subtitle"])
1317
+ ]),
1318
+ _: 1
1319
+ }, 8, ["data", "columns", "loading", "expandable", "empty-text", "filters-count", "filters-label"])
1320
+ ], 512));
1321
+ }
1322
+ });
1323
+ function kt(n) {
1324
+ const u = `${n.apiPath}/auth/connections`;
1325
+ return {
1326
+ list: (l = "mine") => n.http.get(u, { query: { all: l === "all" ? 1 : void 0 } }).then((o) => ({
1327
+ data: o.data,
1328
+ scope: o.meta.scope,
1329
+ canSeeEverybody: o.meta.can_see_everybody
1330
+ })),
1331
+ disconnect: (l) => n.http.delete(`${u}/${l}`).then((o) => o.data)
1332
+ };
1333
+ }
1334
+ const Ct = {
1335
+ class: "wx-connection-list__glyph",
1336
+ "aria-hidden": "true"
1337
+ }, Ue = 560, je = /* @__PURE__ */ Q({
1338
+ __name: "ConnectionList",
1339
+ props: {
1340
+ scope: { default: "mine" }
1341
+ },
1342
+ setup(n, { expose: u }) {
1343
+ const l = n, o = ee(), y = kt(o);
1344
+ te();
1345
+ const c = j("webx-auth"), _ = ve(), r = re("root"), b = xe(r), O = P(() => b.value > 0 && b.value < Ue), v = T([]), g = T(!1), w = T(null), m = P(() => O.value ? [{ key: "card", label: "" }] : [
1346
+ { key: "client", label: c("connections.client"), minWidth: 210 },
1347
+ ...l.scope === "all" ? [{ key: "user", label: c("connections.who"), minWidth: 140 }] : [],
1348
+ { key: "read_only", label: c("connections.allowed"), minWidth: 160 },
1349
+ { key: "connected_at", label: c("connections.connected"), hideBelow: 860 },
1350
+ { key: "last_used_at", label: c("connections.last-used"), minWidth: 130 },
1351
+ { key: "end", label: "", align: "right", width: 140 }
1352
+ ]);
1353
+ function k(A) {
1354
+ return A.user.name ?? c("calls.deleted", { id: A.user.id });
1355
+ }
1356
+ function f(A) {
1357
+ if (A.read_only) return c("connections.read-only");
1358
+ if (l.scope !== "all") return c("connections.full-you");
1359
+ const S = A.user.name?.split(" ")[0];
1360
+ return c("connections.full", { name: S || k(A) });
1361
+ }
1362
+ async function h() {
1363
+ g.value = !0;
1364
+ try {
1365
+ v.value = (await y.list(l.scope)).data;
1366
+ } catch (A) {
1367
+ q.danger(_(A));
1368
+ } finally {
1369
+ g.value = !1;
1370
+ }
1371
+ }
1372
+ async function z(A) {
1373
+ if (await Ne({
1374
+ title: c("connections.confirm-title", { client: A.client }),
1375
+ message: c("connections.confirm-text"),
1376
+ confirmText: c("connections.confirm"),
1377
+ cancelText: c("connections.cancel"),
1378
+ tone: "danger"
1379
+ })) {
1380
+ w.value = A.id;
1381
+ try {
1382
+ const s = await y.disconnect(A.id);
1383
+ v.value = v.value.map((x) => x.id === s.id ? s : x), q.success(c("connections.done", { client: A.client }));
1384
+ } catch (s) {
1385
+ q.danger(_(s));
1386
+ } finally {
1387
+ w.value = null;
1388
+ }
1389
+ }
1390
+ }
1391
+ return ue(() => l.scope, h, { immediate: !0 }), u({ reload: h }), (A, S) => (p(), Y("div", {
1392
+ ref_key: "root",
1393
+ ref: r,
1394
+ class: "wx-connection-list"
1395
+ }, [
1396
+ a(e(ke), {
1397
+ data: v.value,
1398
+ columns: m.value,
1399
+ "row-key": "id",
1400
+ flush: "",
1401
+ loading: g.value,
1402
+ clickable: !1,
1403
+ "empty-text": n.scope === "all" ? e(c)("connections.empty-all") : e(c)("connections.empty"),
1404
+ "cards-below": Ue,
1405
+ "row-class": (s) => s.revoked_at ? "is-ended" : ""
1406
+ }, {
1407
+ "cell-client": t(({ row: s }) => [
1408
+ a(e(oe), {
1409
+ direction: "vertical",
1410
+ size: "none"
1411
+ }, {
1412
+ default: t(() => [
1413
+ a(e(B), {
1414
+ tone: s.revoked_at ? "muted" : "default",
1415
+ weight: "medium"
1416
+ }, {
1417
+ default: t(() => [
1418
+ d(i(s.client), 1)
1419
+ ]),
1420
+ _: 2
1421
+ }, 1032, ["tone"]),
1422
+ a(e(B), {
1423
+ size: "xs",
1424
+ tone: "muted"
1425
+ }, {
1426
+ default: t(() => [
1427
+ d(i(e(c)("connections.returns-to", { host: s.host })), 1)
1428
+ ]),
1429
+ _: 2
1430
+ }, 1024)
1431
+ ]),
1432
+ _: 2
1433
+ }, 1024)
1434
+ ]),
1435
+ "cell-user": t(({ row: s }) => [
1436
+ a(e(B), {
1437
+ tone: s.user.name === null ? "muted" : "default"
1438
+ }, {
1439
+ default: t(() => [
1440
+ d(i(k(s)), 1)
1441
+ ]),
1442
+ _: 2
1443
+ }, 1032, ["tone"])
1444
+ ]),
1445
+ "cell-read_only": t(({ row: s }) => [
1446
+ s.revoked_at ? (p(), V(e(K), {
1447
+ key: 0,
1448
+ type: "default",
1449
+ dot: ""
1450
+ }, {
1451
+ default: t(() => [
1452
+ d(i(e(c)("connections.disconnected")), 1)
1453
+ ]),
1454
+ _: 1
1455
+ })) : (p(), V(e(K), {
1456
+ key: 1,
1457
+ type: s.read_only ? "info" : "success",
1458
+ dot: ""
1459
+ }, {
1460
+ default: t(() => [
1461
+ d(i(f(s)), 1)
1462
+ ]),
1463
+ _: 2
1464
+ }, 1032, ["type"]))
1465
+ ]),
1466
+ "cell-connected_at": t(({ row: s }) => [
1467
+ a(e(ie), {
1468
+ value: s.connected_at,
1469
+ tone: "muted",
1470
+ compact: ""
1471
+ }, null, 8, ["value"])
1472
+ ]),
1473
+ "cell-last_used_at": t(({ row: s }) => [
1474
+ s.last_used_at ? (p(), V(e(ie), {
1475
+ key: 0,
1476
+ value: s.last_used_at,
1477
+ tone: "default",
1478
+ compact: ""
1479
+ }, null, 8, ["value"])) : (p(), V(e(B), {
1480
+ key: 1,
1481
+ size: "sm",
1482
+ tone: "muted"
1483
+ }, {
1484
+ default: t(() => [
1485
+ d(i(e(c)("connections.never-used")), 1)
1486
+ ]),
1487
+ _: 1
1488
+ }))
1489
+ ]),
1490
+ "cell-end": t(({ row: s }) => [
1491
+ s.revoked_at ? E("", !0) : (p(), V(e(I), {
1492
+ key: 0,
1493
+ type: "danger",
1494
+ variant: "text",
1495
+ size: "sm",
1496
+ loading: w.value === s.id,
1497
+ onClick: (x) => z(s)
1498
+ }, {
1499
+ default: t(() => [
1500
+ d(i(e(c)("connections.disconnect")), 1)
1501
+ ]),
1502
+ _: 1
1503
+ }, 8, ["loading", "onClick"]))
1504
+ ]),
1505
+ "cell-card": t(({ row: s }) => [
1506
+ a(e(Ce), {
1507
+ variant: "plain",
1508
+ title: s.client,
1509
+ subtitle: e(c)("connections.returns-to", { host: s.host })
1510
+ }, {
1511
+ media: t(() => [
1512
+ W("span", Ct, [
1513
+ a(e(Z), { name: "link" })
1514
+ ])
1515
+ ]),
1516
+ meta: t(() => [
1517
+ s.revoked_at ? (p(), V(e(K), {
1518
+ key: 0,
1519
+ type: "default",
1520
+ dot: "",
1521
+ size: "sm"
1522
+ }, {
1523
+ default: t(() => [
1524
+ d(i(e(c)("connections.disconnected")), 1)
1525
+ ]),
1526
+ _: 1
1527
+ })) : (p(), V(e(K), {
1528
+ key: 1,
1529
+ type: s.read_only ? "info" : "success",
1530
+ dot: "",
1531
+ size: "sm"
1532
+ }, {
1533
+ default: t(() => [
1534
+ d(i(f(s)), 1)
1535
+ ]),
1536
+ _: 2
1537
+ }, 1032, ["type"])),
1538
+ n.scope === "all" ? (p(), V(e(B), {
1539
+ key: 2,
1540
+ size: "xs",
1541
+ tone: "muted"
1542
+ }, {
1543
+ default: t(() => [
1544
+ d(i(k(s)), 1)
1545
+ ]),
1546
+ _: 2
1547
+ }, 1024)) : E("", !0),
1548
+ s.last_used_at ? (p(), V(e(ie), {
1549
+ key: 3,
1550
+ value: s.last_used_at,
1551
+ compact: ""
1552
+ }, null, 8, ["value"])) : (p(), V(e(B), {
1553
+ key: 4,
1554
+ size: "xs",
1555
+ tone: "muted"
1556
+ }, {
1557
+ default: t(() => [
1558
+ d(i(e(c)("connections.never-used")), 1)
1559
+ ]),
1560
+ _: 1
1561
+ }))
1562
+ ]),
1563
+ actions: t(() => [
1564
+ s.revoked_at ? E("", !0) : (p(), V(e(I), {
1565
+ key: 0,
1566
+ type: "danger",
1567
+ variant: "text",
1568
+ size: "sm",
1569
+ loading: w.value === s.id,
1570
+ onClick: (x) => z(s)
1571
+ }, {
1572
+ default: t(() => [
1573
+ d(i(e(c)("connections.disconnect")), 1)
1574
+ ]),
1575
+ _: 1
1576
+ }, 8, ["loading", "onClick"]))
1577
+ ]),
1578
+ _: 2
1579
+ }, 1032, ["title", "subtitle"])
1580
+ ]),
1581
+ _: 1
1582
+ }, 8, ["data", "columns", "loading", "empty-text", "row-class"])
1583
+ ], 512));
1584
+ }
1585
+ }), $t = /* @__PURE__ */ Q({
897
1586
  __name: "AdminsPage",
898
1587
  props: {
1588
+ base: { default: "/admins" },
1589
+ current: { default: "admins" },
899
1590
  avatarField: { default: void 0 },
900
1591
  resolveAvatar: { type: Function, default: void 0 }
901
1592
  },
902
- setup(a) {
903
- const r = a, s = X(), o = ye(s);
904
- ae();
905
- const i = D("webx-auth"), A = ve(), f = ne("list"), v = V(null), h = he(sa), S = s.can("admins.manage"), n = P(
906
- () => s.state.manifest?.modules.find((w) => w.id === "admins")?.title ?? i("admins.title")
907
- ), m = P(
908
- () => S ? [
1593
+ setup(n) {
1594
+ const u = n, l = ee(), o = fe(l), y = tt(), c = at();
1595
+ te();
1596
+ const _ = j("webx-auth"), r = ve(), b = re("list"), O = T(null), v = $e(yt), g = l.can("admins.manage"), w = l.can("admins.audit"), m = P(
1597
+ () => l.state.manifest?.modules.find((S) => S.id === "admins")?.title ?? _("admins.title")
1598
+ ), k = P(() => {
1599
+ const S = [{ value: "admins", label: m.value }];
1600
+ return w && S.push({ value: "calls", label: _("calls.title") }), g && S.push({ value: "connections", label: _("connections.title") }), S.length > 1 ? S : void 0;
1601
+ }), f = P({
1602
+ get: () => u.current,
1603
+ set: (S) => {
1604
+ const s = S === "admins" ? u.base : `${u.base}/${String(S)}`;
1605
+ s !== c.path && y.push(s);
1606
+ }
1607
+ }), h = P(
1608
+ () => g && u.current === "admins" ? [
909
1609
  {
910
1610
  key: "new",
911
- label: i("admins.new-short"),
1611
+ label: _("admins.new-short"),
912
1612
  icon: "plus",
913
1613
  primary: !0,
914
1614
  run: () => {
915
- g(null);
1615
+ z(null);
916
1616
  }
917
1617
  }
918
1618
  ] : []
919
1619
  );
920
- async function g(w) {
921
- v.value = w, await h({ admin: w, avatarField: r.avatarField }) && f.value?.reload();
1620
+ async function z(S) {
1621
+ O.value = S, await v({ admin: S, avatarField: u.avatarField }) && b.value?.reload();
922
1622
  }
923
- async function u(w) {
924
- if (await He({
925
- title: i("admins.delete-title", { name: w.name }),
926
- message: i("admins.delete-text"),
927
- confirmText: i("admins.delete"),
928
- cancelText: i("admins.cancel"),
1623
+ async function A(S) {
1624
+ if (await Ne({
1625
+ title: _("admins.delete-title", { name: S.name }),
1626
+ message: _("admins.delete-text"),
1627
+ confirmText: _("admins.delete"),
1628
+ cancelText: _("admins.cancel"),
929
1629
  tone: "danger"
930
1630
  }))
931
1631
  try {
932
- await o.remove(w.id), Q.success(i("admins.deleted")), f.value?.reload();
933
- } catch (d) {
934
- Q.danger(A(d));
1632
+ await o.remove(S.id), q.success(_("admins.deleted")), b.value?.reload();
1633
+ } catch (x) {
1634
+ q.danger(r(x));
935
1635
  }
936
1636
  }
937
- return (w, b) => (x(), F(e(De), {
938
- title: n.value,
939
- actions: m.value
1637
+ return (S, s) => (p(), V(e(De), {
1638
+ view: f.value,
1639
+ "onUpdate:view": s[0] || (s[0] = (x) => f.value = x),
1640
+ title: m.value,
1641
+ views: k.value,
1642
+ actions: h.value
940
1643
  }, {
941
1644
  default: t(() => [
942
- l(We, {
1645
+ n.current === "calls" ? (p(), V(xt, { key: 0 })) : n.current === "connections" ? (p(), V(je, {
1646
+ key: 1,
1647
+ scope: "all"
1648
+ })) : (p(), V(Ye, {
1649
+ key: 2,
943
1650
  ref_key: "list",
944
- ref: f,
945
- removable: e(S),
946
- "resolve-avatar": r.resolveAvatar,
947
- onOpen: g,
948
- onRemove: u
949
- }, null, 8, ["removable", "resolve-avatar"])
1651
+ ref: b,
1652
+ removable: e(g),
1653
+ "resolve-avatar": u.resolveAvatar,
1654
+ onOpen: z,
1655
+ onRemove: A
1656
+ }, null, 8, ["removable", "resolve-avatar"]))
950
1657
  ]),
951
1658
  _: 1
952
- }, 8, ["title", "actions"]));
1659
+ }, 8, ["view", "title", "views", "actions"]));
953
1660
  }
954
- });
955
- function ga(a = {}) {
956
- const r = a.path ?? "/admins";
1661
+ }), At = { class: "wx-connect" }, Vt = { class: "wx-connect__row" }, zt = { class: "wx-connect__url" }, Lt = { class: "wx-connect__section" }, St = { class: "wx-connect__steps" }, Wt = { class: "wx-connect__steps" }, Tt = { class: "wx-connect__snippet" }, Ut = { class: "wx-connect__snippet" }, Pt = { class: "wx-connect__section" }, Ft = { class: "wx-connect__links" }, Ot = { class: "wx-connect__steps" }, Rt = { class: "wx-connect__section" }, Bt = /* @__PURE__ */ Q({
1662
+ __name: "ConnectPage",
1663
+ setup(n) {
1664
+ const u = ee();
1665
+ te();
1666
+ const l = j("webx-auth"), o = T(!1);
1667
+ let y;
1668
+ const c = P(() => {
1669
+ const k = u.state.manifest?.modules.find((f) => f.id === "connect")?.meta;
1670
+ return typeof k?.url == "string" ? k.url : "";
1671
+ }), _ = P(() => {
1672
+ try {
1673
+ return new URL(c.value).hostname.split(".")[0] || "webx";
1674
+ } catch {
1675
+ return "webx";
1676
+ }
1677
+ }), r = P(() => `claude mcp add --transport http ${_.value} ${c.value}`), b = P(() => `[mcp_servers.${_.value}]
1678
+ url = "${c.value}"`), O = P(() => {
1679
+ const k = g(JSON.stringify({ url: c.value }));
1680
+ return `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(_.value)}&config=${k}`;
1681
+ }), v = P(() => {
1682
+ const k = JSON.stringify({ name: _.value, type: "http", url: c.value });
1683
+ return `vscode:mcp/install?${encodeURIComponent(k)}`;
1684
+ });
1685
+ function g(k) {
1686
+ const f = new TextEncoder().encode(k);
1687
+ let h = "";
1688
+ for (const z of f) h += String.fromCharCode(z);
1689
+ return encodeURIComponent(btoa(h));
1690
+ }
1691
+ async function w(k) {
1692
+ try {
1693
+ if (navigator.clipboard?.writeText)
1694
+ await navigator.clipboard.writeText(k);
1695
+ else if (!m(k))
1696
+ throw new Error("no clipboard");
1697
+ o.value = !0, clearTimeout(y), y = setTimeout(() => o.value = !1, 2e3);
1698
+ } catch {
1699
+ if (m(k)) return;
1700
+ q.danger(l("connect.copy-failed"));
1701
+ }
1702
+ }
1703
+ function m(k) {
1704
+ const f = document.createElement("textarea");
1705
+ f.value = k, f.setAttribute("readonly", ""), f.style.position = "fixed", f.style.opacity = "0", document.body.append(f), f.select();
1706
+ try {
1707
+ return document.execCommand("copy");
1708
+ } catch {
1709
+ return !1;
1710
+ } finally {
1711
+ f.remove();
1712
+ }
1713
+ }
1714
+ return (k, f) => (p(), V(e(De), {
1715
+ title: e(l)("connect.title"),
1716
+ card: !1
1717
+ }, {
1718
+ default: t(() => [
1719
+ W("div", At, [
1720
+ a(e(B), { class: "wx-connect__lead" }, {
1721
+ default: t(() => [
1722
+ d(i(e(l)("connect.lead")), 1)
1723
+ ]),
1724
+ _: 1
1725
+ }),
1726
+ a(e(Le), { bordered: "" }, {
1727
+ default: t(() => [
1728
+ a(e(B), {
1729
+ size: "xs",
1730
+ tone: "muted",
1731
+ class: "wx-connect__label"
1732
+ }, {
1733
+ default: t(() => [
1734
+ d(i(e(l)("connect.address")), 1)
1735
+ ]),
1736
+ _: 1
1737
+ }),
1738
+ W("div", Vt, [
1739
+ W("code", zt, i(c.value), 1),
1740
+ a(e(I), {
1741
+ type: "primary",
1742
+ disabled: c.value === "",
1743
+ onClick: f[0] || (f[0] = (h) => w(c.value))
1744
+ }, {
1745
+ icon: t(() => [
1746
+ a(e(Z), {
1747
+ name: o.value ? "check" : "copy"
1748
+ }, null, 8, ["name"])
1749
+ ]),
1750
+ default: t(() => [
1751
+ d(" " + i(o.value ? e(l)("connect.copied") : e(l)("connect.copy")), 1)
1752
+ ]),
1753
+ _: 1
1754
+ }, 8, ["disabled"])
1755
+ ])
1756
+ ]),
1757
+ _: 1
1758
+ }),
1759
+ W("section", Lt, [
1760
+ a(e(he), {
1761
+ level: 2,
1762
+ size: "sm"
1763
+ }, {
1764
+ default: t(() => [
1765
+ d(i(e(l)("connect.how")), 1)
1766
+ ]),
1767
+ _: 1
1768
+ }),
1769
+ a(e(nt), {
1770
+ variant: "line",
1771
+ "aria-label": e(l)("connect.how")
1772
+ }, {
1773
+ default: t(() => [
1774
+ a(e(de), {
1775
+ value: "claude",
1776
+ label: e(l)("connect.claude-title")
1777
+ }, {
1778
+ default: t(() => [
1779
+ W("ol", St, [
1780
+ W("li", null, i(e(l)("connect.claude-1")), 1),
1781
+ W("li", null, i(e(l)("connect.claude-2")), 1),
1782
+ W("li", null, i(e(l)("connect.claude-3")), 1)
1783
+ ])
1784
+ ]),
1785
+ _: 1
1786
+ }, 8, ["label"]),
1787
+ a(e(de), {
1788
+ value: "chatgpt",
1789
+ label: e(l)("connect.chatgpt-title")
1790
+ }, {
1791
+ default: t(() => [
1792
+ W("ol", Wt, [
1793
+ W("li", null, i(e(l)("connect.chatgpt-1")), 1),
1794
+ W("li", null, i(e(l)("connect.chatgpt-2")), 1),
1795
+ W("li", null, i(e(l)("connect.chatgpt-3")), 1)
1796
+ ])
1797
+ ]),
1798
+ _: 1
1799
+ }, 8, ["label"]),
1800
+ a(e(de), {
1801
+ value: "claude-code",
1802
+ label: e(l)("connect.claude-code-title")
1803
+ }, {
1804
+ default: t(() => [
1805
+ a(e(B), { size: "sm" }, {
1806
+ default: t(() => [
1807
+ d(i(e(l)("connect.claude-code-hint")), 1)
1808
+ ]),
1809
+ _: 1
1810
+ }),
1811
+ W("div", Tt, [
1812
+ W("pre", null, i(r.value), 1),
1813
+ a(e(I), {
1814
+ variant: "text",
1815
+ size: "sm",
1816
+ onClick: f[1] || (f[1] = (h) => w(r.value))
1817
+ }, {
1818
+ icon: t(() => [
1819
+ a(e(Z), { name: "copy" })
1820
+ ]),
1821
+ default: t(() => [
1822
+ d(" " + i(e(l)("connect.copy-line")), 1)
1823
+ ]),
1824
+ _: 1
1825
+ })
1826
+ ])
1827
+ ]),
1828
+ _: 1
1829
+ }, 8, ["label"]),
1830
+ a(e(de), {
1831
+ value: "codex",
1832
+ label: e(l)("connect.codex-title")
1833
+ }, {
1834
+ default: t(() => [
1835
+ a(e(B), { size: "sm" }, {
1836
+ default: t(() => [
1837
+ d(i(e(l)("connect.codex-hint")), 1)
1838
+ ]),
1839
+ _: 1
1840
+ }),
1841
+ W("div", Ut, [
1842
+ W("pre", null, i(b.value), 1),
1843
+ a(e(I), {
1844
+ variant: "text",
1845
+ size: "sm",
1846
+ onClick: f[2] || (f[2] = (h) => w(b.value))
1847
+ }, {
1848
+ icon: t(() => [
1849
+ a(e(Z), { name: "copy" })
1850
+ ]),
1851
+ default: t(() => [
1852
+ d(" " + i(e(l)("connect.copy-line")), 1)
1853
+ ]),
1854
+ _: 1
1855
+ })
1856
+ ])
1857
+ ]),
1858
+ _: 1
1859
+ }, 8, ["label"])
1860
+ ]),
1861
+ _: 1
1862
+ }, 8, ["aria-label"])
1863
+ ]),
1864
+ W("section", Pt, [
1865
+ a(e(he), {
1866
+ level: 2,
1867
+ size: "sm"
1868
+ }, {
1869
+ default: t(() => [
1870
+ d(i(e(l)("connect.one-click")), 1)
1871
+ ]),
1872
+ _: 1
1873
+ }),
1874
+ a(e(B), {
1875
+ size: "sm",
1876
+ tone: "muted"
1877
+ }, {
1878
+ default: t(() => [
1879
+ d(i(e(l)("connect.one-click-hint")), 1)
1880
+ ]),
1881
+ _: 1
1882
+ }),
1883
+ W("div", Ft, [
1884
+ a(e(I), {
1885
+ href: O.value,
1886
+ variant: "outline",
1887
+ disabled: c.value === "",
1888
+ class: "wx-connect__link"
1889
+ }, {
1890
+ icon: t(() => [
1891
+ a(e(Z), { name: "external-link" })
1892
+ ]),
1893
+ default: t(() => [
1894
+ d(" " + i(e(l)("connect.install-in", { client: e(l)("connect.cursor-title") })), 1)
1895
+ ]),
1896
+ _: 1
1897
+ }, 8, ["href", "disabled"]),
1898
+ a(e(I), {
1899
+ href: v.value,
1900
+ variant: "outline",
1901
+ disabled: c.value === "",
1902
+ class: "wx-connect__link"
1903
+ }, {
1904
+ icon: t(() => [
1905
+ a(e(Z), { name: "external-link" })
1906
+ ]),
1907
+ default: t(() => [
1908
+ d(" " + i(e(l)("connect.install-in", { client: e(l)("connect.vscode-title") })), 1)
1909
+ ]),
1910
+ _: 1
1911
+ }, 8, ["href", "disabled"])
1912
+ ])
1913
+ ]),
1914
+ a(e(ot), {
1915
+ type: "info",
1916
+ title: e(l)("connect.next")
1917
+ }, {
1918
+ default: t(() => [
1919
+ W("ol", Ot, [
1920
+ W("li", null, i(e(l)("connect.next-1")), 1),
1921
+ W("li", null, i(e(l)("connect.next-2")), 1),
1922
+ W("li", null, i(e(l)("connect.next-3")), 1)
1923
+ ])
1924
+ ]),
1925
+ _: 1
1926
+ }, 8, ["title"]),
1927
+ W("section", Rt, [
1928
+ a(e(he), {
1929
+ level: 2,
1930
+ size: "sm"
1931
+ }, {
1932
+ default: t(() => [
1933
+ d(i(e(l)("connect.mine")), 1)
1934
+ ]),
1935
+ _: 1
1936
+ }),
1937
+ a(e(Le), { padding: "none" }, {
1938
+ default: t(() => [
1939
+ a(je, { scope: "mine" })
1940
+ ]),
1941
+ _: 1
1942
+ })
1943
+ ])
1944
+ ])
1945
+ ]),
1946
+ _: 1
1947
+ }, 8, ["title"]));
1948
+ }
1949
+ }), Et = /* @__PURE__ */ pe(Bt, [["__scopeId", "data-v-92d62c98"]]);
1950
+ function ta(n = {}) {
1951
+ const u = n.path ?? "/admins", l = (o) => ({
1952
+ render: () => Re($t, {
1953
+ base: u,
1954
+ current: o,
1955
+ avatarField: n.avatarField,
1956
+ resolveAvatar: n.resolveAvatar
1957
+ })
1958
+ });
957
1959
  return {
958
1960
  id: "admins",
959
- path: r,
1961
+ path: u,
960
1962
  routes: [
1963
+ { path: u, name: "webx.admins", component: l("admins") },
1964
+ // What their agents did, and which agents they let in: two more views of the same
1965
+ // section, each with an address of its own so that its filters survive a trip to the
1966
+ // people and back.
1967
+ { path: `${u}/calls`, name: "webx.admins.calls", component: l("calls") },
961
1968
  {
962
- path: r,
963
- name: "webx.admins",
964
- component: {
965
- render: () => Ce(na, {
966
- avatarField: a.avatarField,
967
- resolveAvatar: a.resolveAvatar
968
- })
969
- }
1969
+ path: `${u}/connections`,
1970
+ name: "webx.admins.connections",
1971
+ component: l("connections")
970
1972
  }
971
1973
  ]
972
1974
  };
973
1975
  }
974
- const ra = /* @__PURE__ */ j({
1976
+ function aa(n = {}) {
1977
+ const u = n.path ?? "/connect";
1978
+ return {
1979
+ id: "connect",
1980
+ path: u,
1981
+ routes: [{ path: u, name: "webx.connect", component: Et }]
1982
+ };
1983
+ }
1984
+ const Dt = /* @__PURE__ */ Q({
975
1985
  __name: "AdminPicker",
976
1986
  props: {
977
1987
  multiple: { type: Boolean, default: !1 },
978
1988
  title: { default: void 0 },
979
1989
  resolveAvatar: { type: Function, default: void 0 }
980
1990
  },
981
- setup(a) {
982
- const r = a, { open: s, resolve: o, dismiss: i } = me();
983
- ae();
984
- const A = D("webx-auth"), f = ne("list"), v = V(0);
985
- function h(n) {
986
- o(n);
1991
+ setup(n) {
1992
+ const u = n, { open: l, resolve: o, dismiss: y } = ge();
1993
+ te();
1994
+ const c = j("webx-auth"), _ = re("list"), r = T(0);
1995
+ function b(v) {
1996
+ o(v);
987
1997
  }
988
- function S(n) {
989
- v.value = n.length;
1998
+ function O(v) {
1999
+ r.value = v.length;
990
2000
  }
991
- return (n, m) => (x(), F(e(pe), {
992
- open: e(s),
993
- "onUpdate:open": m[2] || (m[2] = (g) => ce(s) ? s.value = g : null),
994
- title: a.title ?? e(A)(a.multiple ? "admins.select-many" : "admins.select-one"),
2001
+ return (v, g) => (p(), V(e(we), {
2002
+ open: e(l),
2003
+ "onUpdate:open": g[2] || (g[2] = (w) => be(l) ? l.value = w : null),
2004
+ title: n.title ?? e(c)(n.multiple ? "admins.select-many" : "admins.select-one"),
995
2005
  width: 880
996
- }, Ae({
2006
+ }, Oe({
997
2007
  default: t(() => [
998
- l(We, {
2008
+ a(Ye, {
999
2009
  ref_key: "list",
1000
- ref: f,
2010
+ ref: _,
1001
2011
  picking: "",
1002
- multiple: a.multiple,
1003
- "resolve-avatar": r.resolveAvatar,
1004
- onChosen: h,
1005
- onSelection: S
2012
+ multiple: n.multiple,
2013
+ "resolve-avatar": u.resolveAvatar,
2014
+ onChosen: b,
2015
+ onSelection: O
1006
2016
  }, null, 8, ["multiple", "resolve-avatar"])
1007
2017
  ]),
1008
2018
  _: 2
1009
2019
  }, [
1010
- a.multiple ? {
2020
+ n.multiple ? {
1011
2021
  name: "footer",
1012
2022
  fn: t(() => [
1013
- l(e(ee), {
2023
+ a(e(oe), {
1014
2024
  size: "sm",
1015
2025
  align: "center"
1016
2026
  }, {
1017
2027
  default: t(() => [
1018
- l(e(fe), {
2028
+ a(e(B), {
1019
2029
  size: "sm",
1020
2030
  tone: "muted"
1021
2031
  }, {
1022
2032
  default: t(() => [
1023
- $(C(e(A)("admins.chosen", { count: v.value })), 1)
2033
+ d(i(e(c)("admins.chosen", { count: r.value })), 1)
1024
2034
  ]),
1025
2035
  _: 1
1026
2036
  }),
1027
- l(e(Y), {
2037
+ a(e(I), {
1028
2038
  variant: "outline",
1029
- onClick: m[0] || (m[0] = (g) => e(i)())
2039
+ onClick: g[0] || (g[0] = (w) => e(y)())
1030
2040
  }, {
1031
2041
  default: t(() => [
1032
- $(C(e(A)("admins.cancel")), 1)
2042
+ d(i(e(c)("admins.cancel")), 1)
1033
2043
  ]),
1034
2044
  _: 1
1035
2045
  }),
1036
- l(e(Y), {
2046
+ a(e(I), {
1037
2047
  type: "primary",
1038
- disabled: v.value === 0,
1039
- onClick: m[1] || (m[1] = (g) => e(o)(f.value?.chosen() ?? []))
2048
+ disabled: r.value === 0,
2049
+ onClick: g[1] || (g[1] = (w) => e(o)(_.value?.chosen() ?? []))
1040
2050
  }, {
1041
2051
  default: t(() => [
1042
- $(C(e(A)("admins.save")), 1)
2052
+ d(i(e(c)("admins.save")), 1)
1043
2053
  ]),
1044
2054
  _: 1
1045
2055
  }, 8, ["disabled"])
@@ -1051,144 +2061,144 @@ const ra = /* @__PURE__ */ j({
1051
2061
  } : void 0
1052
2062
  ]), 1032, ["open", "title"]));
1053
2063
  }
1054
- }), ze = he(ra);
1055
- async function _a(a = {}) {
1056
- return (await ze({ ...a, multiple: !1 }))?.[0];
2064
+ }), Ge = $e(Dt);
2065
+ async function la(n = {}) {
2066
+ return (await Ge({ ...n, multiple: !1 }))?.[0];
1057
2067
  }
1058
- function xa(a = {}) {
1059
- return ze({ ...a, multiple: !0 });
2068
+ function na(n = {}) {
2069
+ return Ge({ ...n, multiple: !0 });
1060
2070
  }
1061
- const ia = { class: "wx-profile-host" }, ua = { class: "wx-profile" }, da = {
2071
+ const Nt = { class: "wx-profile-host" }, It = { class: "wx-profile" }, Mt = {
1062
2072
  key: 0,
1063
2073
  class: "wx-profile__aside"
1064
- }, ca = { class: "wx-profile__fields" }, va = /* @__PURE__ */ j({
2074
+ }, Ht = { class: "wx-profile__fields" }, Kt = /* @__PURE__ */ Q({
1065
2075
  __name: "ProfileDialog",
1066
2076
  props: {
1067
2077
  avatarField: { default: void 0 }
1068
2078
  },
1069
- setup(a) {
1070
- const r = a, { resolve: s, dismiss: o, open: i } = me(), A = X(), f = we();
1071
- ae();
1072
- const v = D("webx-auth"), h = ve(), S = V(!1), n = V({}), m = V({
1073
- name: A.state.user?.name ?? "",
1074
- avatar: A.state.user?.avatar ?? null,
2079
+ setup(n) {
2080
+ const u = n, { resolve: l, dismiss: o, open: y } = ge(), c = ee(), _ = Ae();
2081
+ te();
2082
+ const r = j("webx-auth"), b = ve(), O = T(!1), v = T({}), g = T({
2083
+ name: c.state.user?.name ?? "",
2084
+ avatar: c.state.user?.avatar ?? null,
1075
2085
  password: "",
1076
2086
  current_password: ""
1077
- }), g = V(m.value.avatar ? { path: m.value.avatar } : null);
1078
- function u(b) {
1079
- return n.value[b]?.[0];
2087
+ }), w = T(g.value.avatar ? { path: g.value.avatar } : null);
2088
+ function m(f) {
2089
+ return v.value[f]?.[0];
1080
2090
  }
1081
- async function w() {
1082
- S.value = !0, n.value = {};
2091
+ async function k() {
2092
+ O.value = !0, v.value = {};
1083
2093
  try {
1084
- await f.updateProfile({
1085
- name: m.value.name,
1086
- avatar: g.value?.path ?? null,
2094
+ await _.updateProfile({
2095
+ name: g.value.name,
2096
+ avatar: w.value?.path ?? null,
1087
2097
  // Blank is left out entirely rather than sent as an empty string: the server reads a
1088
2098
  // filled password as "change it", and an empty one would be a change to nothing.
1089
- ...m.value.password ? { password: m.value.password, current_password: m.value.current_password } : {}
1090
- }), Q.success(v("profile.saved")), s(!0);
1091
- } catch (b) {
1092
- const d = b.body;
1093
- d?.errors ? n.value = d.errors : Q.danger(h(b));
2099
+ ...g.value.password ? { password: g.value.password, current_password: g.value.current_password } : {}
2100
+ }), q.success(r("profile.saved")), l(!0);
2101
+ } catch (f) {
2102
+ const h = f.body;
2103
+ h?.errors ? v.value = h.errors : q.danger(b(f));
1094
2104
  } finally {
1095
- S.value = !1;
2105
+ O.value = !1;
1096
2106
  }
1097
2107
  }
1098
- return (b, d) => (x(), F(e(pe), {
1099
- open: e(i),
1100
- "onUpdate:open": d[5] || (d[5] = (L) => ce(i) ? i.value = L : null),
1101
- title: e(v)("profile.title"),
2108
+ return (f, h) => (p(), V(e(we), {
2109
+ open: e(y),
2110
+ "onUpdate:open": h[5] || (h[5] = (z) => be(y) ? y.value = z : null),
2111
+ title: e(r)("profile.title"),
1102
2112
  width: 560
1103
2113
  }, {
1104
2114
  footer: t(() => [
1105
- l(e(Y), {
1106
- onClick: d[4] || (d[4] = (L) => e(o)())
2115
+ a(e(I), {
2116
+ onClick: h[4] || (h[4] = (z) => e(o)())
1107
2117
  }, {
1108
2118
  default: t(() => [
1109
- $(C(e(v)("profile.cancel")), 1)
2119
+ d(i(e(r)("profile.cancel")), 1)
1110
2120
  ]),
1111
2121
  _: 1
1112
2122
  }),
1113
- l(e(Y), {
2123
+ a(e(I), {
1114
2124
  type: "primary",
1115
- loading: S.value,
1116
- onClick: w
2125
+ loading: O.value,
2126
+ onClick: k
1117
2127
  }, {
1118
2128
  default: t(() => [
1119
- $(C(e(v)("profile.save")), 1)
2129
+ d(i(e(r)("profile.save")), 1)
1120
2130
  ]),
1121
2131
  _: 1
1122
2132
  }, 8, ["loading"])
1123
2133
  ]),
1124
2134
  default: t(() => [
1125
- O("div", ia, [
1126
- O("div", ua, [
1127
- r.avatarField ? (x(), R("div", da, [
1128
- (x(), F(Ve(r.avatarField), {
1129
- modelValue: g.value,
1130
- "onUpdate:modelValue": d[0] || (d[0] = (L) => g.value = L),
1131
- label: e(v)("profile.avatar"),
2135
+ W("div", Nt, [
2136
+ W("div", It, [
2137
+ u.avatarField ? (p(), Y("div", Mt, [
2138
+ (p(), V(Fe(u.avatarField), {
2139
+ modelValue: w.value,
2140
+ "onUpdate:modelValue": h[0] || (h[0] = (z) => w.value = z),
2141
+ label: e(r)("profile.avatar"),
1132
2142
  aspect: "1/1",
1133
2143
  captions: !1
1134
2144
  }, null, 8, ["modelValue", "label"]))
1135
- ])) : M("", !0),
1136
- O("div", ca, [
1137
- l(e(N), {
1138
- label: e(v)("profile.name"),
1139
- error: u("name")
2145
+ ])) : E("", !0),
2146
+ W("div", Ht, [
2147
+ a(e(M), {
2148
+ label: e(r)("profile.name"),
2149
+ error: m("name")
1140
2150
  }, {
1141
2151
  default: t(() => [
1142
- l(e(K), {
1143
- modelValue: m.value.name,
1144
- "onUpdate:modelValue": d[1] || (d[1] = (L) => m.value.name = L),
2152
+ a(e(le), {
2153
+ modelValue: g.value.name,
2154
+ "onUpdate:modelValue": h[1] || (h[1] = (z) => g.value.name = z),
1145
2155
  name: "name"
1146
2156
  }, null, 8, ["modelValue"])
1147
2157
  ]),
1148
2158
  _: 1
1149
2159
  }, 8, ["label", "error"]),
1150
- l(e(N), {
1151
- label: e(v)("admins.email")
2160
+ a(e(M), {
2161
+ label: e(r)("admins.email")
1152
2162
  }, {
1153
2163
  default: t(() => [
1154
- l(e(K), {
1155
- "model-value": e(A).state.user?.email ?? "",
2164
+ a(e(le), {
2165
+ "model-value": e(c).state.user?.email ?? "",
1156
2166
  readonly: ""
1157
2167
  }, null, 8, ["model-value"])
1158
2168
  ]),
1159
2169
  _: 1
1160
2170
  }, 8, ["label"]),
1161
- l(e(N), {
1162
- label: e(v)("profile.password"),
1163
- help: e(v)("profile.password-hint"),
1164
- error: u("password")
2171
+ a(e(M), {
2172
+ label: e(r)("profile.password"),
2173
+ help: e(r)("profile.password-hint"),
2174
+ error: m("password")
1165
2175
  }, {
1166
2176
  default: t(() => [
1167
- l(e(K), {
1168
- modelValue: m.value.password,
1169
- "onUpdate:modelValue": d[2] || (d[2] = (L) => m.value.password = L),
2177
+ a(e(le), {
2178
+ modelValue: g.value.password,
2179
+ "onUpdate:modelValue": h[2] || (h[2] = (z) => g.value.password = z),
1170
2180
  type: "password",
1171
2181
  autocomplete: "new-password"
1172
2182
  }, null, 8, ["modelValue"])
1173
2183
  ]),
1174
2184
  _: 1
1175
2185
  }, 8, ["label", "help", "error"]),
1176
- m.value.password ? (x(), F(e(N), {
2186
+ g.value.password ? (p(), V(e(M), {
1177
2187
  key: 0,
1178
- label: e(v)("profile.current-password"),
1179
- help: e(v)("profile.current-password-hint"),
1180
- error: u("current_password")
2188
+ label: e(r)("profile.current-password"),
2189
+ help: e(r)("profile.current-password-hint"),
2190
+ error: m("current_password")
1181
2191
  }, {
1182
2192
  default: t(() => [
1183
- l(e(K), {
1184
- modelValue: m.value.current_password,
1185
- "onUpdate:modelValue": d[3] || (d[3] = (L) => m.value.current_password = L),
2193
+ a(e(le), {
2194
+ modelValue: g.value.current_password,
2195
+ "onUpdate:modelValue": h[3] || (h[3] = (z) => g.value.current_password = z),
1186
2196
  type: "password",
1187
2197
  autocomplete: "current-password"
1188
2198
  }, null, 8, ["modelValue"])
1189
2199
  ]),
1190
2200
  _: 1
1191
- }, 8, ["label", "help", "error"])) : M("", !0)
2201
+ }, 8, ["label", "help", "error"])) : E("", !0)
1192
2202
  ])
1193
2203
  ])
1194
2204
  ])
@@ -1196,10 +2206,10 @@ const ia = { class: "wx-profile-host" }, ua = { class: "wx-profile" }, da = {
1196
2206
  _: 1
1197
2207
  }, 8, ["open", "title"]));
1198
2208
  }
1199
- }), ma = /* @__PURE__ */ be(va, [["__scopeId", "data-v-9583a67a"]]), pa = ["title"], fa = {
2209
+ }), Yt = /* @__PURE__ */ pe(Kt, [["__scopeId", "data-v-9583a67a"]]), jt = ["title"], Gt = {
1200
2210
  key: 0,
1201
2211
  class: "wx-user-menu__name"
1202
- }, ha = /* @__PURE__ */ j({
2212
+ }, Jt = /* @__PURE__ */ Q({
1203
2213
  __name: "UserMenu",
1204
2214
  props: {
1205
2215
  signOutLabel: { default: void 0 },
@@ -1207,161 +2217,216 @@ const ia = { class: "wx-profile-host" }, ua = { class: "wx-profile" }, da = {
1207
2217
  avatarField: { default: void 0 },
1208
2218
  expanded: { type: Boolean, default: !1 }
1209
2219
  },
1210
- setup(a) {
1211
- const r = a, s = X(), o = we(), i = $e(), A = D("webx-auth"), f = P(() => s.state.user), v = P(
1212
- () => i.state.panelLocales.length > 1 ? i.state.panelLocales : []
1213
- ), h = ue(Ue, null), S = ue(Fe, null), n = V(void 0);
1214
- re(
1215
- () => typeof f.value?.avatar == "string" ? f.value.avatar : null,
1216
- async (w) => {
1217
- const b = r.resolveAvatar ?? h;
1218
- if (w === null || w === "" || b === null) {
1219
- n.value = void 0;
2220
+ setup(n) {
2221
+ const u = n, l = ee(), o = Ae(), y = Be(), c = et(), _ = j("webx-auth"), r = y.scope("webx-admin"), b = P(() => l.state.user), O = P(
2222
+ () => y.state.panelLocales.length > 1 ? y.state.panelLocales : []
2223
+ ), v = ye(Me, null), g = ye(He, null), w = T(void 0);
2224
+ ue(
2225
+ () => typeof b.value?.avatar == "string" ? b.value.avatar : null,
2226
+ async (z) => {
2227
+ const A = u.resolveAvatar ?? v;
2228
+ if (z === null || z === "" || A === null) {
2229
+ w.value = void 0;
1220
2230
  return;
1221
2231
  }
1222
- const d = await b(w);
1223
- f.value?.avatar === w && (n.value = d ?? void 0);
2232
+ const S = await A(z);
2233
+ b.value?.avatar === z && (w.value = S ?? void 0);
1224
2234
  },
1225
2235
  { immediate: !0 }
1226
2236
  );
1227
- const m = he(ma);
1228
- function g() {
2237
+ const m = $e(Yt);
2238
+ function k() {
1229
2239
  setTimeout(
1230
2240
  () => {
1231
- m({ avatarField: r.avatarField ?? S ?? void 0 });
2241
+ m({ avatarField: u.avatarField ?? g ?? void 0 });
1232
2242
  },
1233
2243
  0
1234
2244
  );
1235
2245
  }
1236
- async function u(w) {
1237
- w !== i.state.locale && await o.setLocale(w);
2246
+ const f = P({
2247
+ get: () => c.state.preference,
2248
+ set: (z) => {
2249
+ c.set(z), o.setTheme(z);
2250
+ }
2251
+ });
2252
+ async function h(z) {
2253
+ z !== y.state.locale && await o.setLocale(z);
1238
2254
  }
1239
- return (w, b) => {
1240
- const d = T("wx-avatar"), L = T("wx-text"), U = T("wx-dropdown-item"), B = T("wx-divider"), y = T("wx-dropdown");
1241
- return f.value !== null ? (x(), F(y, { key: 0 }, {
2255
+ return (z, A) => {
2256
+ const S = H("wx-avatar"), s = H("wx-text"), x = H("wx-dropdown-item"), U = H("wx-divider"), X = H("wx-dropdown");
2257
+ return b.value !== null ? (p(), V(X, { key: 0 }, {
1242
2258
  trigger: t(() => [
1243
- O("button", {
2259
+ W("button", {
1244
2260
  type: "button",
1245
- class: Me(["wx-user-menu__trigger", { "wx-user-menu__trigger--named": a.expanded }]),
1246
- title: f.value.name
2261
+ class: Qe(["wx-user-menu__trigger", { "wx-user-menu__trigger--named": n.expanded }]),
2262
+ title: b.value.name
1247
2263
  }, [
1248
- l(d, {
1249
- name: f.value.name,
1250
- src: n.value,
2264
+ a(S, {
2265
+ name: b.value.name,
2266
+ src: w.value,
1251
2267
  size: "lg"
1252
2268
  }, null, 8, ["name", "src"]),
1253
- a.expanded ? (x(), R("span", fa, C(f.value.name), 1)) : M("", !0)
1254
- ], 10, pa)
2269
+ n.expanded ? (p(), Y("span", Gt, i(b.value.name), 1)) : E("", !0)
2270
+ ], 10, jt)
1255
2271
  ]),
1256
2272
  default: t(() => [
1257
- l(U, { disabled: "" }, {
2273
+ a(x, { disabled: "" }, {
1258
2274
  default: t(() => [
1259
- l(L, { size: "sm" }, {
2275
+ a(s, { size: "sm" }, {
1260
2276
  default: t(() => [
1261
- $(C(f.value.email), 1)
2277
+ d(i(b.value.email), 1)
1262
2278
  ]),
1263
2279
  _: 1
1264
2280
  })
1265
2281
  ]),
1266
2282
  _: 1
1267
2283
  }),
1268
- l(B, { spacing: "sm" }),
1269
- l(U, {
2284
+ a(U, { spacing: "sm" }),
2285
+ a(x, {
1270
2286
  icon: "user",
1271
- onClick: g
2287
+ onClick: k
1272
2288
  }, {
1273
2289
  default: t(() => [
1274
- $(C(e(A)("profile.menu")), 1)
2290
+ d(i(e(_)("profile.menu")), 1)
2291
+ ]),
2292
+ _: 1
2293
+ }),
2294
+ a(U, { spacing: "sm" }),
2295
+ a(x, { disabled: "" }, {
2296
+ default: t(() => [
2297
+ a(s, {
2298
+ size: "sm",
2299
+ tone: "muted"
2300
+ }, {
2301
+ default: t(() => [
2302
+ d(i(e(r)("theme.label")), 1)
2303
+ ]),
2304
+ _: 1
2305
+ })
1275
2306
  ]),
1276
2307
  _: 1
1277
2308
  }),
1278
- v.value.length > 0 ? (x(), R(oe, { key: 0 }, [
1279
- l(B, { spacing: "sm" }),
1280
- l(U, { disabled: "" }, {
2309
+ W("div", {
2310
+ class: "wx-user-menu__theme",
2311
+ onClick: A[1] || (A[1] = Pe(() => {
2312
+ }, ["stop"]))
2313
+ }, [
2314
+ a(e(st), {
2315
+ modelValue: f.value,
2316
+ "onUpdate:modelValue": A[0] || (A[0] = (D) => f.value = D),
2317
+ size: "sm",
2318
+ block: "",
2319
+ "aria-label": e(r)("theme.label"),
2320
+ "light-label": e(r)("theme.light"),
2321
+ "dark-label": e(r)("theme.dark"),
2322
+ "system-label": e(r)("theme.system")
2323
+ }, null, 8, ["modelValue", "aria-label", "light-label", "dark-label", "system-label"])
2324
+ ]),
2325
+ O.value.length > 0 ? (p(), Y(me, { key: 0 }, [
2326
+ a(U, { spacing: "sm" }),
2327
+ a(x, { disabled: "" }, {
1281
2328
  default: t(() => [
1282
- l(L, {
2329
+ a(s, {
1283
2330
  size: "sm",
1284
2331
  tone: "muted"
1285
2332
  }, {
1286
2333
  default: t(() => [
1287
- $(C(e(A)("menu.language")), 1)
2334
+ d(i(e(_)("menu.language")), 1)
1288
2335
  ]),
1289
2336
  _: 1
1290
2337
  })
1291
2338
  ]),
1292
2339
  _: 1
1293
2340
  }),
1294
- (x(!0), R(oe, null, de(v.value, (p) => (x(), F(U, {
1295
- key: p.code,
1296
- icon: p.code === e(i).state.locale ? "check" : void 0,
1297
- onClick: (k) => u(p.code)
2341
+ (p(!0), Y(me, null, _e(O.value, (D) => (p(), V(x, {
2342
+ key: D.code,
2343
+ icon: D.code === e(y).state.locale ? "check" : void 0,
2344
+ onClick: (G) => h(D.code)
1298
2345
  }, {
1299
2346
  default: t(() => [
1300
- $(C(p.nativeName), 1)
2347
+ d(i(D.nativeName), 1)
1301
2348
  ]),
1302
2349
  _: 2
1303
2350
  }, 1032, ["icon", "onClick"]))), 128)),
1304
- l(B, { spacing: "sm" })
1305
- ], 64)) : M("", !0),
1306
- l(U, {
2351
+ a(U, { spacing: "sm" })
2352
+ ], 64)) : E("", !0),
2353
+ a(x, {
1307
2354
  icon: "logout",
1308
- onClick: b[0] || (b[0] = (p) => e(o).logout())
2355
+ onClick: A[2] || (A[2] = (D) => e(o).logout())
1309
2356
  }, {
1310
2357
  default: t(() => [
1311
- $(C(a.signOutLabel ?? e(A)("menu.sign-out")), 1)
2358
+ d(i(n.signOutLabel ?? e(_)("menu.sign-out")), 1)
1312
2359
  ]),
1313
2360
  _: 1
1314
2361
  })
1315
2362
  ]),
1316
2363
  _: 1
1317
- })) : M("", !0);
2364
+ })) : E("", !0);
1318
2365
  };
1319
2366
  }
1320
- }), ka = /* @__PURE__ */ be(ha, [["__scopeId", "data-v-d51d13e4"]]);
1321
- function Va(a = {}) {
1322
- const r = a.path ?? "/login";
2367
+ }), oa = /* @__PURE__ */ pe(Jt, [["__scopeId", "data-v-4dbd81da"]]);
2368
+ function sa(n = {}) {
2369
+ const u = n.path ?? "/login";
1323
2370
  return {
1324
- install(s) {
1325
- const o = Ge(s.context);
1326
- s.i18n.defaults("webx-auth", Se), Je(s.app, o, a.resolveAvatar ?? null, a.avatarField ?? null), s.context.useSessionLoader(() => o.me()), s.router.addRoute({
1327
- path: r,
2371
+ install(l) {
2372
+ const o = it(l.context);
2373
+ l.i18n.defaults("webx-auth", Ke), rt(l.app, o, n.resolveAvatar ?? null, n.avatarField ?? null), l.context.useSessionLoader(() => o.me()), l.router.addRoute({
2374
+ path: u,
1328
2375
  name: "webx.login",
1329
2376
  meta: { public: !0 },
1330
- component: { render: () => Ce(ea, { ...a.card }) }
1331
- }), s.router.beforeEach((i) => i.meta.public === !0 || s.context.state.status !== "unauthenticated" ? !0 : { path: r, query: i.fullPath === "/" ? {} : { next: i.fullPath } }), re(
1332
- () => s.context.state.status,
1333
- (i) => {
1334
- const A = s.router.currentRoute.value;
1335
- if (i === "unauthenticated" && A.path !== r) {
1336
- s.router.replace({ path: r, query: { next: A.fullPath } });
2377
+ component: { render: () => Re(mt, { ...n.card }) }
2378
+ }), l.router.beforeEach((y) => y.meta.public === !0 || l.context.state.status !== "unauthenticated" ? !0 : { path: u, query: y.fullPath === "/" ? {} : { next: y.fullPath } }), ue(
2379
+ () => l.context.state.status,
2380
+ (y) => {
2381
+ const c = l.router.currentRoute.value;
2382
+ if (y === "unauthenticated" && c.path !== u) {
2383
+ l.router.replace({ path: u, query: { next: c.fullPath } });
1337
2384
  return;
1338
2385
  }
1339
- if (i === "ready" && A.path === r) {
1340
- const f = A.query.next;
1341
- s.router.replace(typeof f == "string" ? f : "/");
2386
+ if (y === "ready" && c.path === u) {
2387
+ const _ = c.query.next;
2388
+ if (typeof _ == "string" && qt(_)) {
2389
+ location.assign(_);
2390
+ return;
2391
+ }
2392
+ l.router.replace(typeof _ == "string" ? _ : "/");
1342
2393
  }
1343
2394
  }
1344
2395
  );
1345
2396
  }
1346
2397
  };
1347
2398
  }
2399
+ function qt(n) {
2400
+ if (!/^https?:\/\//i.test(n))
2401
+ return !1;
2402
+ try {
2403
+ return new URL(n).origin === location.origin;
2404
+ } catch {
2405
+ return !1;
2406
+ }
2407
+ }
1348
2408
  export {
1349
- We as WxAdminList,
1350
- na as WxAdminsPage,
1351
- ea as WxLoginCard,
1352
- ma as WxProfileDialog,
1353
- ka as WxUserMenu,
1354
- ga as admins,
1355
- Va as auth,
1356
- Le as authKey,
1357
- Se as authMessages,
1358
- Fe as avatarFieldKey,
1359
- Ue as avatarResolverKey,
1360
- ye as createAdminsApi,
1361
- Ge as createAuthSession,
1362
- Je as provideAuth,
1363
- _a as selectAdmin,
1364
- xa as selectAdmins,
1365
- we as useAuth
2409
+ Ye as WxAdminList,
2410
+ $t as WxAdminsPage,
2411
+ xt as WxAgentCallList,
2412
+ Et as WxConnectPage,
2413
+ je as WxConnectionList,
2414
+ mt as WxLoginCard,
2415
+ Yt as WxProfileDialog,
2416
+ oa as WxUserMenu,
2417
+ ta as admins,
2418
+ sa as auth,
2419
+ Ie as authKey,
2420
+ Ke as authMessages,
2421
+ He as avatarFieldKey,
2422
+ Me as avatarResolverKey,
2423
+ aa as connect,
2424
+ fe as createAdminsApi,
2425
+ it as createAuthSession,
2426
+ kt as createConnectionsApi,
2427
+ rt as provideAuth,
2428
+ la as selectAdmin,
2429
+ na as selectAdmins,
2430
+ Ae as useAuth
1366
2431
  };
1367
2432
  //# sourceMappingURL=index.js.map