@webx-ui/module-services 0.1.15 → 0.1.17

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,38 +1,38 @@
1
- import { reorderItems as De, useAdmin as ae, useDates as Oe, useTranslate as le, useErrorText as me, provideRecordAddress as Pe, WxScreenHead as Ae, WxScreen as Me, WxSaveState as Le, WxDate as Re, useItemOrder as Ue, WxListScreen as He, WxRowMenu as Fe, categoryRoutes as Ke } from "@webx-ui/module-admin";
2
- import { provide as Ge, inject as Je, defineComponent as ne, computed as f, ref as b, watch as se, onMounted as Te, onBeforeUnmount as Se, openBlock as d, createElementBlock as N, Fragment as X, createVNode as p, unref as e, withCtx as o, createTextVNode as _, toDisplayString as w, createBlock as k, createCommentVNode as R, createElementVNode as E, renderList as $e, normalizeClass as ye, useTemplateRef as je, nextTick as Qe, isRef as Xe, withKeys as Ye, resolveDynamicComponent as Ze, mergeProps as et } from "vue";
3
- import { useRoute as We, useRouter as Ce, onBeforeRouteLeave as tt } from "vue-router";
4
- import { provideBlocksPreview as st } from "@webx-ui/module-blocks";
5
- import { useLocales as at, localizedValue as rt, confirm as Z, WxSkeleton as ie, WxCard as it, WxBadge as j, WxBreadcrumb as lt, WxBreadcrumbItem as _e, WxAlert as Ve, WxButton as Q, WxActionBar as nt, toast as S, WxEmpty as qe, WxText as ot, useModal as ct, WxDialog as ut, WxFormItem as dt, WxInput as Ie, WxSpace as vt, createModal as pt, WxIcon as xe, WxSelect as ht, WxSortableList as ft, WxTooltip as yt } from "@webx-ui/core";
1
+ import { reorderItems as De, useAdmin as ie, useDates as Me, useTranslate as ae, useErrorText as me, provideRecordAddress as Le, WxScreenHead as Re, WxScreen as Ue, WxSaveState as He, WxDate as Fe, useItemOrder as Ke, WxListScreen as Ge, WxRowMenu as Je, WxAddressNote as je, categoryRoutes as Qe } from "@webx-ui/module-admin";
2
+ import { provide as Xe, inject as Ye, defineComponent as oe, computed as y, ref as b, watch as re, onMounted as Te, onBeforeUnmount as Se, openBlock as d, createElementBlock as B, Fragment as Y, createVNode as h, unref as e, withCtx as c, createTextVNode as _, toDisplayString as w, createBlock as k, createCommentVNode as D, createElementVNode as A, renderList as $e, normalizeClass as ye, useTemplateRef as Ze, nextTick as et, isRef as tt, withKeys as st, resolveDynamicComponent as at, mergeProps as rt } from "vue";
3
+ import { useRoute as We, useRouter as Ce, onBeforeRouteLeave as it } from "vue-router";
4
+ import { provideBlocksPreview as lt } from "@webx-ui/module-blocks";
5
+ import { useLocales as nt, localizedValue as ot, confirm as j, WxSkeleton as ne, WxCard as ct, WxBadge as Q, WxBreadcrumb as ut, WxBreadcrumbItem as xe, WxAlert as Ve, WxButton as X, WxActionBar as dt, toast as S, WxEmpty as qe, WxText as vt, useModal as pt, WxDialog as ht, WxFormItem as ft, WxInput as Ie, WxSpace as yt, createModal as gt, WxIcon as _e, WxSelect as mt, WxSortableList as bt, WxTooltip as wt } from "@webx-ui/core";
6
6
  const ge = "services";
7
- function oe(c) {
8
- const n = `${c.apiPath}/${ge}`, y = (r) => r.data;
7
+ function ce(u) {
8
+ const o = `${u.apiPath}/${ge}`, g = (a) => a.data;
9
9
  return {
10
- list: (r = {}) => {
10
+ list: (a = {}) => {
11
11
  const l = new URLSearchParams();
12
- return r.q && l.set("q", r.q), r.category != null && l.set("category", String(r.category)), r.status && l.set("status", r.status), r.trashed && l.set("trashed", "1"), c.http.get(l.size > 0 ? `${n}?${l}` : n);
12
+ return a.q && l.set("q", a.q), a.category != null && l.set("category", String(a.category)), a.status && l.set("status", a.status), a.trashed && l.set("trashed", "1"), u.http.get(l.size > 0 ? `${o}?${l}` : o);
13
13
  },
14
- get: (r) => c.http.get(`${n}/${r}`).then(y),
15
- create: (r) => c.http.post(n, r).then(y),
16
- save: (r, l) => c.http.put(`${n}/${r}`, l).then(y),
17
- discard: (r) => c.http.post(`${n}/${r}/discard`, {}).then(y),
18
- publish: (r) => c.http.post(`${n}/${r}/publish`, {}).then(y),
19
- unpublish: (r) => c.http.post(`${n}/${r}/unpublish`, {}).then(y),
20
- remove: (r) => c.http.delete(`${n}/${r}`).then(() => {
14
+ get: (a) => u.http.get(`${o}/${a}`).then(g),
15
+ create: (a) => u.http.post(o, a).then(g),
16
+ save: (a, l) => u.http.put(`${o}/${a}`, l).then(g),
17
+ discard: (a) => u.http.post(`${o}/${a}/discard`, {}).then(g),
18
+ publish: (a) => u.http.post(`${o}/${a}/publish`, {}).then(g),
19
+ unpublish: (a) => u.http.post(`${o}/${a}/unpublish`, {}).then(g),
20
+ remove: (a) => u.http.delete(`${o}/${a}`).then(() => {
21
21
  }),
22
- restore: (r) => c.http.post(`${n}/${r}/restore`, {}).then(y),
23
- versions: (r) => c.http.get(`${n}/${r}/versions`).then(y),
24
- restoreVersion: (r, l) => c.http.post(`${n}/${r}/versions/${l}/restore`, {}).then(y),
25
- reorder: (r, l = null) => De(c, ge, r, l)
22
+ restore: (a) => u.http.post(`${o}/${a}/restore`, {}).then(g),
23
+ versions: (a) => u.http.get(`${o}/${a}/versions`).then(g),
24
+ restoreVersion: (a, l) => u.http.post(`${o}/${a}/versions/${l}/restore`, {}).then(g),
25
+ reorder: (a, l = null) => De(u, ge, a, l)
26
26
  };
27
27
  }
28
28
  const ze = /* @__PURE__ */ Symbol("wx-service-editor");
29
- function gt(c) {
30
- Ge(ze, c);
29
+ function xt(u) {
30
+ Xe(ze, u);
31
31
  }
32
- function mt() {
33
- return Je(ze, null);
32
+ function _t() {
33
+ return Ye(ze, null);
34
34
  }
35
- const bt = {
35
+ const kt = {
36
36
  module: {
37
37
  group: "Services",
38
38
  services: "Services",
@@ -90,8 +90,6 @@ const bt = {
90
90
  "publish-nowhere": "It has no address in this language yet, so nothing will answer.",
91
91
  preview: "Preview",
92
92
  discard: "Discard changes",
93
- "discard-title": "Discard what is waiting?",
94
- "discard-text": "The service goes back to what the site is showing. What was written since is not listed anywhere.",
95
93
  discarded: "The service is back to what is published.",
96
94
  "conflict-title": "The service changed while you were editing",
97
95
  "conflict-mine": "Keep mine",
@@ -140,215 +138,244 @@ const bt = {
140
138
  "address-moving": "The address is changing. The old one keeps working and leads to the new one."
141
139
  }
142
140
  }, ke = /* @__PURE__ */ new WeakSet();
143
- function ce() {
141
+ function ue() {
144
142
  try {
145
- const { i18n: c } = ae();
146
- ke.has(c) || (c.defaults("webx-services", bt), ke.add(c));
143
+ const { i18n: u } = ie();
144
+ ke.has(u) || (u.defaults("webx-services", kt), ke.add(u));
147
145
  } catch {
148
146
  }
149
147
  }
150
- const wt = { class: "wx-service-editor__screen" }, _t = 1200, xt = /* @__PURE__ */ ne({
148
+ const Tt = { class: "wx-service-editor__screen" }, St = 1200, $t = /* @__PURE__ */ oe({
151
149
  __name: "ServiceEditorPage",
152
150
  props: {
153
151
  base: { default: "/services" }
154
152
  },
155
- setup(c) {
156
- const n = c, y = ae(), r = oe(y), l = We(), B = Ce(), a = at(), T = Oe();
157
- ce();
158
- const s = le("webx-services"), $ = me(), W = f(() => Number(l.params.id)), O = f(() => n.base), u = b(null), g = b({}), m = b(""), h = b(null), C = b(null), P = b(!0), M = b(!1), U = b(!1), H = b({}), V = b(null), Y = b(""), F = b(0), D = f(() => y.can("services.manage")), ue = f(() => !D.value || U.value), L = f(() => JSON.stringify(g.value)), z = f(() => Y.value !== "" && L.value !== Y.value), de = f(() => M.value ? "saving" : z.value ? "unsaved" : "saved"), ee = f(() => {
159
- const i = g.value.title;
160
- return rt(i, a.active.value, u.value?.title ?? "");
161
- }), ve = f(() => {
162
- const i = u.value;
163
- return !i || i.status !== "published" && i.status !== "modified" ? "" : s("service.live-since", { date: T.short(i.published_at) });
153
+ setup(u) {
154
+ const o = u, g = ie(), a = ce(g), l = We(), O = Ce(), r = nt(), W = Me();
155
+ ue();
156
+ const s = ae("webx-services"), x = ae("webx-admin"), T = me(), M = y(() => Number(l.params.id)), V = y(() => o.base), n = b(null), f = b({}), p = b(""), z = b(null), E = b(null), F = b(!0), K = b(!1), N = b(!1), Z = b({}), q = b(null), L = b(""), ee = b(0), P = y(() => g.can("services.manage")), le = y(() => !P.value || N.value), R = y(() => JSON.stringify(f.value)), I = y(() => L.value !== "" && R.value !== L.value), de = y(() => K.value ? "saving" : I.value ? "unsaved" : "saved"), te = y(() => {
157
+ const i = f.value.title;
158
+ return ot(i, r.active.value, n.value?.title ?? "");
159
+ }), ve = y(() => {
160
+ const i = n.value;
161
+ return !i || i.status !== "published" && i.status !== "modified" ? "" : s("service.live-since", { date: W.short(i.published_at) });
164
162
  });
165
- st({ url: f(() => C.value), reload: F }), Pe({
166
- values: g,
167
- prefix: h,
168
- path: f(() => u.value?.path),
163
+ lt({ url: y(() => E.value), reload: ee }), Le({
164
+ values: f,
165
+ prefix: z,
166
+ path: y(() => n.value?.path),
169
167
  moving: () => s("service.address-moving")
170
- }), gt({ service: u, canManage: D.value, reload: () => A(!0) });
171
- function re(i) {
172
- u.value = i.service, g.value = i.values, m.value = i.revision, h.value = i.prefix, C.value = i.preview_url, Y.value = JSON.stringify(i.values), V.value = null;
168
+ }), xt({ service: n, canManage: P.value, reload: () => U(!0) });
169
+ function G(i) {
170
+ n.value = i.service, f.value = i.values, p.value = i.revision, z.value = i.prefix, E.value = i.preview_url, L.value = JSON.stringify(i.values), q.value = null;
173
171
  }
174
- async function A(i = !1) {
175
- i || (P.value = !0);
172
+ async function U(i = !1) {
173
+ i || (F.value = !0);
176
174
  try {
177
- re(await r.get(W.value));
178
- } catch (q) {
179
- S.danger($(q)), B.push(O.value);
175
+ G(await a.get(M.value));
176
+ } catch ($) {
177
+ S.danger(T($)), O.push(V.value);
180
178
  } finally {
181
- P.value = !1;
179
+ F.value = !1;
182
180
  }
183
181
  }
184
- let K;
182
+ let J;
185
183
  function pe() {
186
- !D.value || V.value || !z.value || (clearTimeout(K), K = setTimeout(() => {
187
- t();
188
- }, _t));
184
+ !P.value || q.value || !I.value || (clearTimeout(J), J = setTimeout(() => {
185
+ m();
186
+ }, St));
189
187
  }
190
188
  function he() {
191
- !D.value || V.value || !z.value || M.value || (clearTimeout(K), t());
189
+ !P.value || q.value || !I.value || K.value || (clearTimeout(J), m());
192
190
  }
193
- let G;
194
- async function t() {
195
- for (; G; ) {
196
- const { carried: I, done: J } = G;
197
- if (await J, !z.value || V.value || L.value === I) return;
191
+ let t;
192
+ async function m() {
193
+ for (; t; ) {
194
+ const { carried: C, done: H } = t;
195
+ if (await H, !I.value || q.value || R.value === C) return;
198
196
  }
199
- const i = L.value, q = x();
200
- G = { carried: i, done: q };
197
+ const i = R.value, $ = v();
198
+ t = { carried: i, done: $ };
201
199
  try {
202
- await q;
200
+ await $;
203
201
  } finally {
204
- G?.done === q && (G = void 0);
202
+ t?.done === $ && (t = void 0);
205
203
  }
206
204
  }
207
- async function x() {
208
- if (!u.value || !D.value) return;
209
- clearTimeout(K);
210
- const i = L.value, q = g.value;
211
- M.value = !0, H.value = {};
205
+ async function v() {
206
+ if (!n.value || !P.value) return;
207
+ clearTimeout(J);
208
+ const i = R.value, $ = f.value;
209
+ K.value = !0, Z.value = {};
212
210
  try {
213
- const I = await r.save(u.value.id, { values: q, revision: m.value });
214
- u.value = I.service, m.value = I.revision, h.value = I.prefix, C.value = I.preview_url, V.value = null, L.value === i && (Y.value = i), F.value += 1;
215
- } catch (I) {
216
- const J = I;
217
- J.status === 409 && J.body?.data ? V.value = J.body : J.body?.errors ? (H.value = J.body.errors, S.danger(s("service.save-failed"))) : S.danger($(I));
211
+ const C = await a.save(n.value.id, { values: $, revision: p.value });
212
+ n.value = C.service, p.value = C.revision, z.value = C.prefix, E.value = C.preview_url, q.value = null, R.value === i && (L.value = i), ee.value += 1;
213
+ } catch (C) {
214
+ const H = C;
215
+ H.status === 409 && H.body?.data ? q.value = H.body : H.body?.errors ? (Z.value = H.body.errors, S.danger(s("service.save-failed"))) : S.danger(T(C));
218
216
  } finally {
219
- M.value = !1;
217
+ K.value = !1;
220
218
  }
221
219
  }
222
- async function v() {
223
- await Z({
220
+ async function se() {
221
+ await j({
224
222
  title: s("service.conflict-theirs-title"),
225
223
  message: s("service.conflict-theirs-text"),
226
224
  confirmText: s("service.conflict-theirs"),
227
225
  cancelText: s("panel.cancel"),
228
226
  tone: "danger"
229
- }) && await A(!0);
230
- }
231
- async function te() {
232
- const i = V.value;
233
- i && (m.value = i.data.revision, V.value = null, await t());
227
+ }) && await U(!0);
234
228
  }
235
229
  async function fe() {
236
- if (!(!u.value || !await Z({
237
- title: s("service.discard-title"),
238
- message: s("service.discard-text"),
230
+ const i = q.value;
231
+ i && (p.value = i.data.revision, q.value = null, await m());
232
+ }
233
+ async function Ee() {
234
+ if (!(!n.value || !await j({
235
+ title: x("editor.discard-title"),
236
+ message: x("editor.discard-text"),
239
237
  confirmText: s("service.discard"),
240
- cancelText: s("panel.cancel"),
238
+ // Not «Cancel»: beside «Discard changes» the two read as the same word.
239
+ cancelText: x("editor.keep-changes"),
241
240
  tone: "danger"
242
241
  }))) {
243
- U.value = !0;
242
+ N.value = !0;
244
243
  try {
245
- re(await r.discard(u.value.id)), S.success(s("service.discarded"));
246
- } catch (q) {
247
- S.danger($(q));
244
+ G(await a.discard(n.value.id)), S.success(s("service.discarded"));
245
+ } catch ($) {
246
+ S.danger(T($));
248
247
  } finally {
249
- U.value = !1;
248
+ N.value = !1;
250
249
  }
251
250
  }
252
251
  }
253
- async function Ee() {
254
- const i = u.value;
255
- if (!(!i || !await Z({
256
- title: s("service.publish-title", { title: ee.value || i.title }),
257
- message: i.path === null ? s("service.publish-nowhere") : s("service.publish-text", { address: `/${i.path}` }),
252
+ async function Ne() {
253
+ if (I.value && await m(), q.value || I.value) return;
254
+ const i = n.value;
255
+ if (!i) return;
256
+ const $ = i.next_path ?? i.path, C = i.next_path != null && i.path !== null ? ` ${x("editor.publish-moves", { old: `/${i.path}` })}` : "";
257
+ if (await j({
258
+ title: s("service.publish-title", { title: te.value || i.title }),
259
+ message: $ === null ? s("service.publish-nowhere") : s("service.publish-text", { address: `/${$}` }) + C,
258
260
  confirmText: s("panel.publish"),
259
261
  cancelText: s("panel.cancel")
260
- })) && (z.value && await t(), !V.value)) {
261
- U.value = !0;
262
+ })) {
263
+ N.value = !0;
262
264
  try {
263
- await r.publish(i.id), await A(!0), S.success(s("panel.published"));
264
- } catch (I) {
265
- S.danger($(I));
265
+ await a.publish(i.id), await U(!0), S.success(s("panel.published"));
266
+ } catch (Pe) {
267
+ S.danger(T(Pe));
266
268
  } finally {
267
- U.value = !1;
269
+ N.value = !1;
268
270
  }
269
271
  }
270
272
  }
271
- function Ne() {
272
- const i = u.value?.status;
273
+ async function Ae() {
274
+ const i = n.value;
275
+ if (!(!i || !await j({
276
+ title: x("editor.unpublish-title"),
277
+ message: x("editor.unpublish-text"),
278
+ confirmText: x("editor.unpublish"),
279
+ cancelText: x("editor.keep-published")
280
+ }))) {
281
+ N.value = !0;
282
+ try {
283
+ await a.unpublish(i.id), await U(!0), S.success(x("editor.unpublished"));
284
+ } catch (C) {
285
+ S.danger(T(C));
286
+ } finally {
287
+ N.value = !1;
288
+ }
289
+ }
290
+ }
291
+ function Be() {
292
+ const i = n.value?.status;
273
293
  return i === "published" || i === "modified" ? "success" : "default";
274
294
  }
275
295
  function we(i) {
276
- z.value && i.preventDefault();
296
+ I.value && i.preventDefault();
277
297
  }
278
- se(L, pe), se(W, () => {
279
- A();
298
+ re(R, pe), re(M, () => {
299
+ U();
280
300
  }), Te(() => {
281
- A(), window.addEventListener("beforeunload", we);
301
+ U(), window.addEventListener("beforeunload", we);
282
302
  }), Se(() => {
283
- clearTimeout(K), window.removeEventListener("beforeunload", we);
284
- }), tt(async () => !z.value || !D.value || (await t(), !z.value) ? !0 : await Z({
303
+ clearTimeout(J), window.removeEventListener("beforeunload", we);
304
+ }), it(async () => !I.value || !P.value || (await m(), !I.value) ? !0 : await j({
285
305
  title: s("service.leave-title"),
286
306
  message: s("service.leave-text"),
287
307
  confirmText: s("service.leave"),
288
308
  cancelText: s("panel.cancel"),
289
309
  tone: "danger"
290
310
  }));
291
- const Be = f(() => {
311
+ const Oe = y(() => {
292
312
  const i = [];
293
- return C.value && i.push({ key: "preview", label: s("service.preview"), icon: "eye", href: C.value }), u.value?.url && u.value.status !== "draft" && i.push({
313
+ return E.value && i.push({ key: "preview", label: s("service.preview"), icon: "eye", href: E.value }), n.value?.url && n.value.status !== "draft" && i.push({
294
314
  key: "site",
295
315
  label: s("panel.open-on-site"),
296
316
  icon: "link",
297
- href: u.value.url
298
- }), u.value?.status === "modified" && i.push({
317
+ href: n.value.url
318
+ }), P.value && (n.value?.status === "published" || n.value?.status === "modified") && i.push({
319
+ key: "unpublish",
320
+ label: x("editor.unpublish"),
321
+ icon: "eye-off",
322
+ run: () => {
323
+ Ae();
324
+ }
325
+ }), n.value?.status === "modified" && i.push({
299
326
  key: "discard",
300
327
  label: s("service.discard"),
301
328
  icon: "refresh",
302
329
  danger: !0,
303
330
  menu: !0,
304
331
  run: () => {
305
- fe();
332
+ Ee();
306
333
  }
307
334
  }), i;
308
335
  });
309
- return (i, q) => (d(), N("div", {
336
+ return (i, $) => (d(), B("div", {
310
337
  class: "wx-service-editor",
311
338
  onFocusout: he
312
339
  }, [
313
- P.value || !u.value ? (d(), N(X, { key: 0 }, [
314
- p(e(ie), {
340
+ F.value || !n.value ? (d(), B(Y, { key: 0 }, [
341
+ h(e(ne), {
315
342
  class: "wx-service-editor__ghost",
316
343
  title: "",
317
344
  rows: 1
318
345
  }),
319
- p(e(it), null, {
320
- default: o(() => [
321
- p(e(ie), { rows: 8 })
346
+ h(e(ct), null, {
347
+ default: c(() => [
348
+ h(e(ne), { rows: 8 })
322
349
  ]),
323
350
  _: 1
324
351
  })
325
- ], 64)) : (d(), N(X, { key: 1 }, [
326
- p(e(Ae), {
352
+ ], 64)) : (d(), B(Y, { key: 1 }, [
353
+ h(e(Re), {
327
354
  divider: "",
328
- back: O.value,
355
+ back: V.value,
329
356
  "back-label": e(s)("module.services"),
330
- title: ee.value || e(s)("service.untitled"),
357
+ title: te.value || e(s)("service.untitled"),
331
358
  subtitle: ve.value,
332
- actions: Be.value
359
+ actions: Oe.value
333
360
  }, {
334
- trail: o(() => [
335
- p(e(lt), {
361
+ trail: c(() => [
362
+ h(e(ut), {
336
363
  size: "sm",
337
364
  label: e(s)("service.trail")
338
365
  }, {
339
- default: o(() => [
340
- p(e(_e), {
366
+ default: c(() => [
367
+ h(e(xe), {
341
368
  as: "router-link",
342
- to: O.value
369
+ to: V.value
343
370
  }, {
344
- default: o(() => [
371
+ default: c(() => [
345
372
  _(w(e(s)("module.services")), 1)
346
373
  ]),
347
374
  _: 1
348
375
  }, 8, ["to"]),
349
- p(e(_e), { current: "" }, {
350
- default: o(() => [
351
- _(w(ee.value || e(s)("service.untitled")), 1)
376
+ h(e(xe), { current: "" }, {
377
+ default: c(() => [
378
+ _(w(te.value || e(s)("service.untitled")), 1)
352
379
  ]),
353
380
  _: 1
354
381
  })
@@ -356,253 +383,253 @@ const wt = { class: "wx-service-editor__screen" }, _t = 1200, xt = /* @__PURE__
356
383
  _: 1
357
384
  }, 8, ["label"])
358
385
  ]),
359
- "title-after": o(() => [
360
- p(e(j), {
361
- type: Ne(),
386
+ "title-after": c(() => [
387
+ h(e(Q), {
388
+ type: Be(),
362
389
  dot: ""
363
390
  }, {
364
- default: o(() => [
365
- _(w(e(s)(`panel.status-${u.value.status}`)), 1)
391
+ default: c(() => [
392
+ _(w(e(s)(`panel.status-${n.value.status}`)), 1)
366
393
  ]),
367
394
  _: 1
368
395
  }, 8, ["type"]),
369
- u.value.status === "modified" ? (d(), k(e(j), {
396
+ n.value.status === "modified" ? (d(), k(e(Q), {
370
397
  key: 0,
371
398
  type: "primary",
372
399
  round: ""
373
400
  }, {
374
- default: o(() => [
401
+ default: c(() => [
375
402
  _(w(e(s)("panel.edits")), 1)
376
403
  ]),
377
404
  _: 1
378
- })) : R("", !0)
405
+ })) : D("", !0)
379
406
  ]),
380
407
  _: 1
381
408
  }, 8, ["back", "back-label", "title", "subtitle", "actions"]),
382
- V.value ? (d(), k(e(Ve), {
409
+ q.value ? (d(), k(e(Ve), {
383
410
  key: 0,
384
411
  type: "warning",
385
412
  title: e(s)("service.conflict-title"),
386
- description: V.value.message
413
+ description: q.value.message
387
414
  }, {
388
- actions: o(() => [
389
- p(e(Q), {
415
+ actions: c(() => [
416
+ h(e(X), {
390
417
  size: "sm",
391
418
  variant: "outline",
392
- onClick: v
419
+ onClick: se
393
420
  }, {
394
- default: o(() => [
421
+ default: c(() => [
395
422
  _(w(e(s)("service.conflict-theirs")), 1)
396
423
  ]),
397
424
  _: 1
398
425
  }),
399
- p(e(Q), {
426
+ h(e(X), {
400
427
  size: "sm",
401
428
  type: "primary",
402
- onClick: te
429
+ onClick: fe
403
430
  }, {
404
- default: o(() => [
431
+ default: c(() => [
405
432
  _(w(e(s)("service.conflict-mine")), 1)
406
433
  ]),
407
434
  _: 1
408
435
  })
409
436
  ]),
410
437
  _: 1
411
- }, 8, ["title", "description"])) : R("", !0),
412
- E("div", wt, [
413
- p(e(Me), {
414
- modelValue: g.value,
415
- "onUpdate:modelValue": q[0] || (q[0] = (I) => g.value = I),
438
+ }, 8, ["title", "description"])) : D("", !0),
439
+ A("div", Tt, [
440
+ h(e(Ue), {
441
+ modelValue: f.value,
442
+ "onUpdate:modelValue": $[0] || ($[0] = (C) => f.value = C),
416
443
  name: "services.form",
417
- errors: H.value,
418
- disabled: ue.value
444
+ errors: Z.value,
445
+ disabled: le.value
419
446
  }, null, 8, ["modelValue", "errors", "disabled"])
420
447
  ]),
421
- D.value ? (d(), k(e(nt), { key: 1 }, {
422
- state: o(() => [
423
- p(e(Le), { state: de.value }, null, 8, ["state"])
448
+ P.value ? (d(), k(e(dt), { key: 1 }, {
449
+ state: c(() => [
450
+ h(e(He), { state: de.value }, null, 8, ["state"])
424
451
  ]),
425
- default: o(() => [
426
- p(e(Q), {
452
+ default: c(() => [
453
+ h(e(X), {
427
454
  variant: "outline",
428
- loading: M.value,
429
- disabled: !z.value,
430
- onClick: t
455
+ loading: K.value,
456
+ disabled: !I.value,
457
+ onClick: m
431
458
  }, {
432
- default: o(() => [
459
+ default: c(() => [
433
460
  _(w(e(s)("service.save")), 1)
434
461
  ]),
435
462
  _: 1
436
463
  }, 8, ["loading", "disabled"]),
437
- p(e(Q), {
464
+ h(e(X), {
438
465
  type: "primary",
439
- loading: U.value,
440
- disabled: u.value.status === "published" && !z.value,
441
- onClick: Ee
466
+ loading: N.value,
467
+ disabled: n.value.status === "published" && !I.value,
468
+ onClick: Ne
442
469
  }, {
443
- default: o(() => [
470
+ default: c(() => [
444
471
  _(w(e(s)("panel.publish")), 1)
445
472
  ]),
446
473
  _: 1
447
474
  }, 8, ["loading", "disabled"])
448
475
  ]),
449
476
  _: 1
450
- })) : R("", !0)
477
+ })) : D("", !0)
451
478
  ], 64))
452
479
  ], 32));
453
480
  }
454
- }), be = (c, n) => {
455
- const y = c.__vccOpts || c;
456
- for (const [r, l] of n)
457
- y[r] = l;
458
- return y;
459
- }, kt = /* @__PURE__ */ be(xt, [["__scopeId", "data-v-15dec02d"]]), Tt = { class: "wx-service-history" }, St = { class: "wx-service-history__number" }, $t = { class: "wx-service-history__who" }, Wt = /* @__PURE__ */ ne({
481
+ }), be = (u, o) => {
482
+ const g = u.__vccOpts || u;
483
+ for (const [a, l] of o)
484
+ g[a] = l;
485
+ return g;
486
+ }, Wt = /* @__PURE__ */ be($t, [["__scopeId", "data-v-13029584"]]), Ct = { class: "wx-service-history" }, Vt = { class: "wx-service-history__number" }, qt = { class: "wx-service-history__who" }, It = /* @__PURE__ */ oe({
460
487
  name: "WxServiceHistory",
461
488
  __name: "ServiceHistory",
462
- setup(c) {
463
- const n = ae(), y = oe(n), r = mt();
464
- ce();
465
- const l = le("webx-services"), B = me(), a = b(null), T = b(!1), s = f(() => r?.service.value ?? null), $ = f(() => r?.canManage ?? !1), W = f(
466
- () => s.value?.status === "published" || s.value?.status === "modified" ? a.value?.[0]?.number ?? null : null
489
+ setup(u) {
490
+ const o = ie(), g = ce(o), a = _t();
491
+ ue();
492
+ const l = ae("webx-services"), O = me(), r = b(null), W = b(!1), s = y(() => a?.service.value ?? null), x = y(() => a?.canManage ?? !1), T = y(
493
+ () => s.value?.status === "published" || s.value?.status === "modified" ? r.value?.[0]?.number ?? null : null
467
494
  );
468
- async function O() {
469
- const g = s.value;
470
- if (g)
495
+ async function M() {
496
+ const n = s.value;
497
+ if (n)
471
498
  try {
472
- a.value = await y.versions(g.id);
473
- } catch (m) {
474
- a.value = [], S.danger(B(m));
499
+ r.value = await g.versions(n.id);
500
+ } catch (f) {
501
+ r.value = [], S.danger(O(f));
475
502
  }
476
503
  }
477
- async function u(g) {
478
- const m = s.value;
479
- if (!(!m || !await Z({
480
- title: l("service.restore-title", { number: g.number }),
504
+ async function V(n) {
505
+ const f = s.value;
506
+ if (!(!f || !await j({
507
+ title: l("service.restore-title", { number: n.number }),
481
508
  message: l("service.restore-text"),
482
509
  confirmText: l("service.restore-version"),
483
510
  cancelText: l("panel.cancel")
484
511
  }))) {
485
- T.value = !0;
512
+ W.value = !0;
486
513
  try {
487
- await y.restoreVersion(m.id, g.number), await r?.reload(), S.success(l("service.restored-version", { number: g.number }));
488
- } catch (C) {
489
- S.danger(B(C));
514
+ await g.restoreVersion(f.id, n.number), await a?.reload(), S.success(l("service.restored-version", { number: n.number }));
515
+ } catch (z) {
516
+ S.danger(O(z));
490
517
  } finally {
491
- T.value = !1;
518
+ W.value = !1;
492
519
  }
493
520
  }
494
521
  }
495
- return se(
522
+ return re(
496
523
  () => [s.value?.id, s.value?.published_at, s.value?.updated_at],
497
524
  () => {
498
- O();
525
+ M();
499
526
  },
500
527
  { immediate: !0 }
501
- ), (g, m) => (d(), N("div", Tt, [
502
- a.value === null ? (d(), k(e(ie), {
528
+ ), (n, f) => (d(), B("div", Ct, [
529
+ r.value === null ? (d(), k(e(ne), {
503
530
  key: 0,
504
531
  class: "wx-service-history__ghost",
505
532
  rows: 3
506
- })) : a.value.length === 0 ? (d(), k(e(qe), {
533
+ })) : r.value.length === 0 ? (d(), k(e(qe), {
507
534
  key: 1,
508
535
  description: e(l)("service.history-empty")
509
- }, null, 8, ["description"])) : (d(!0), N(X, { key: 2 }, $e(a.value, (h) => (d(), N("div", {
510
- key: h.number,
511
- class: ye(["wx-service-history__row", { "is-live": h.number === W.value }])
536
+ }, null, 8, ["description"])) : (d(!0), B(Y, { key: 2 }, $e(r.value, (p) => (d(), B("div", {
537
+ key: p.number,
538
+ class: ye(["wx-service-history__row", { "is-live": p.number === T.value }])
512
539
  }, [
513
- E("code", St, w(e(l)("service.version", { number: h.number })), 1),
514
- E("div", $t, [
515
- h.created_at ? (d(), k(e(Re), {
540
+ A("code", Vt, w(e(l)("service.version", { number: p.number })), 1),
541
+ A("div", qt, [
542
+ p.created_at ? (d(), k(e(Fe), {
516
543
  key: 0,
517
- value: h.created_at,
544
+ value: p.created_at,
518
545
  size: "md",
519
546
  tone: "default"
520
- }, null, 8, ["value"])) : R("", !0),
521
- p(e(ot), {
547
+ }, null, 8, ["value"])) : D("", !0),
548
+ h(e(vt), {
522
549
  size: "sm",
523
550
  tone: "muted"
524
551
  }, {
525
- default: o(() => [
526
- _(w(h.author ?? e(l)(`service.source-${h.source}`)) + " ", 1),
527
- h.comment ? (d(), N(X, { key: 0 }, [
528
- _(" · " + w(h.comment), 1)
529
- ], 64)) : R("", !0)
552
+ default: c(() => [
553
+ _(w(p.author ?? e(l)(`service.source-${p.source}`)) + " ", 1),
554
+ p.comment ? (d(), B(Y, { key: 0 }, [
555
+ _(" · " + w(p.comment), 1)
556
+ ], 64)) : D("", !0)
530
557
  ]),
531
558
  _: 2
532
559
  }, 1024)
533
560
  ]),
534
- h.number === W.value ? (d(), k(e(j), {
561
+ p.number === T.value ? (d(), k(e(Q), {
535
562
  key: 0,
536
563
  type: "success",
537
564
  dot: ""
538
565
  }, {
539
- default: o(() => [
566
+ default: c(() => [
540
567
  _(w(e(l)("service.version-live")), 1)
541
568
  ]),
542
569
  _: 1
543
- })) : R("", !0),
544
- $.value && h.number !== W.value ? (d(), k(e(Q), {
570
+ })) : D("", !0),
571
+ x.value && p.number !== T.value ? (d(), k(e(X), {
545
572
  key: 1,
546
573
  size: "sm",
547
574
  variant: "outline",
548
- loading: T.value,
549
- onClick: (C) => u(h)
575
+ loading: W.value,
576
+ onClick: (z) => V(p)
550
577
  }, {
551
- default: o(() => [
578
+ default: c(() => [
552
579
  _(w(e(l)("service.restore-version")), 1)
553
580
  ]),
554
581
  _: 1
555
- }, 8, ["loading", "onClick"])) : R("", !0)
582
+ }, 8, ["loading", "onClick"])) : D("", !0)
556
583
  ], 2))), 128))
557
584
  ]));
558
585
  }
559
- }), Ct = /* @__PURE__ */ be(Wt, [["__scopeId", "data-v-72dccbb1"]]), Vt = /* @__PURE__ */ ne({
586
+ }), zt = /* @__PURE__ */ be(It, [["__scopeId", "data-v-72dccbb1"]]), Et = /* @__PURE__ */ oe({
560
587
  __name: "ServiceCreateDialog",
561
- setup(c) {
562
- const { open: n, resolve: y, dismiss: r } = ct(), l = ae(), B = oe(l);
563
- ce();
564
- const a = le("webx-services"), T = b(""), s = b(!1), $ = b({}), W = je("field");
588
+ setup(u) {
589
+ const { open: o, resolve: g, dismiss: a } = pt(), l = ie(), O = ce(l);
590
+ ue();
591
+ const r = ae("webx-services"), W = b(""), s = b(!1), x = b({}), T = Ze("field");
565
592
  Te(async () => {
566
- await Qe(), W.value?.querySelector("input")?.focus();
593
+ await et(), T.value?.querySelector("input")?.focus();
567
594
  });
568
- async function O() {
569
- if (!(T.value.trim() === "" || s.value)) {
570
- s.value = !0, $.value = {};
595
+ async function M() {
596
+ if (!(W.value.trim() === "" || s.value)) {
597
+ s.value = !0, x.value = {};
571
598
  try {
572
- y(await B.create({ title: T.value.trim() }));
573
- } catch (u) {
574
- $.value = u.body?.errors ?? {};
599
+ g(await O.create({ title: W.value.trim() }));
600
+ } catch (V) {
601
+ x.value = V.body?.errors ?? {};
575
602
  } finally {
576
603
  s.value = !1;
577
604
  }
578
605
  }
579
606
  }
580
- return (u, g) => (d(), k(e(ut), {
581
- open: e(n),
582
- "onUpdate:open": g[2] || (g[2] = (m) => Xe(n) ? n.value = m : null),
583
- title: e(a)("panel.new-title"),
607
+ return (V, n) => (d(), k(e(ht), {
608
+ open: e(o),
609
+ "onUpdate:open": n[2] || (n[2] = (f) => tt(o) ? o.value = f : null),
610
+ title: e(r)("panel.new-title"),
584
611
  width: 440
585
612
  }, {
586
- footer: o(() => [
587
- p(e(vt), { size: "sm" }, {
588
- default: o(() => [
589
- p(e(Q), {
613
+ footer: c(() => [
614
+ h(e(yt), { size: "sm" }, {
615
+ default: c(() => [
616
+ h(e(X), {
590
617
  variant: "outline",
591
- onClick: g[1] || (g[1] = (m) => e(r)())
618
+ onClick: n[1] || (n[1] = (f) => e(a)())
592
619
  }, {
593
- default: o(() => [
594
- _(w(e(a)("panel.cancel")), 1)
620
+ default: c(() => [
621
+ _(w(e(r)("panel.cancel")), 1)
595
622
  ]),
596
623
  _: 1
597
624
  }),
598
- p(e(Q), {
625
+ h(e(X), {
599
626
  type: "primary",
600
627
  loading: s.value,
601
- disabled: T.value.trim() === "",
602
- onClick: O
628
+ disabled: W.value.trim() === "",
629
+ onClick: M
603
630
  }, {
604
- default: o(() => [
605
- _(w(e(a)("panel.create")), 1)
631
+ default: c(() => [
632
+ _(w(e(r)("panel.create")), 1)
606
633
  ]),
607
634
  _: 1
608
635
  }, 8, ["loading", "disabled"])
@@ -610,22 +637,22 @@ const wt = { class: "wx-service-editor__screen" }, _t = 1200, xt = /* @__PURE__
610
637
  _: 1
611
638
  })
612
639
  ]),
613
- default: o(() => [
614
- p(e(dt), {
615
- label: e(a)("panel.field-title"),
616
- error: $.value.title?.[0] ?? $.value.slug?.[0],
640
+ default: c(() => [
641
+ h(e(ft), {
642
+ label: e(r)("panel.field-title"),
643
+ error: x.value.title?.[0] ?? x.value.slug?.[0],
617
644
  required: ""
618
645
  }, {
619
- default: o(() => [
620
- E("div", {
646
+ default: c(() => [
647
+ A("div", {
621
648
  ref_key: "field",
622
- ref: W
649
+ ref: T
623
650
  }, [
624
- p(e(Ie), {
625
- modelValue: T.value,
626
- "onUpdate:modelValue": g[0] || (g[0] = (m) => T.value = m),
627
- "aria-label": e(a)("panel.field-title"),
628
- onKeyup: Ye(O, ["enter"])
651
+ h(e(Ie), {
652
+ modelValue: W.value,
653
+ "onUpdate:modelValue": n[0] || (n[0] = (f) => W.value = f),
654
+ "aria-label": e(r)("panel.field-title"),
655
+ onKeyup: st(M, ["enter"])
629
656
  }, null, 8, ["modelValue", "aria-label"])
630
657
  ], 512)
631
658
  ]),
@@ -635,351 +662,357 @@ const wt = { class: "wx-service-editor__screen" }, _t = 1200, xt = /* @__PURE__
635
662
  _: 1
636
663
  }, 8, ["open", "title"]));
637
664
  }
638
- }), qt = { class: "wx-services" }, It = { class: "wx-services__bar" }, zt = ["src"], Et = { class: "wx-service-row__name" }, Nt = { class: "wx-service-row__title" }, Bt = { class: "wx-service-row__address" }, Dt = { class: "wx-service-row__facts" }, Ot = { class: "wx-service-row__chips" }, Pt = { class: "wx-service-row__state" }, At = /* @__PURE__ */ ne({
665
+ }), Nt = { class: "wx-services" }, At = { class: "wx-services__bar" }, Bt = ["src"], Ot = { class: "wx-service-row__name" }, Pt = { class: "wx-service-row__title" }, Dt = { class: "wx-service-row__address" }, Mt = { class: "wx-service-row__facts" }, Lt = { class: "wx-service-row__chips" }, Rt = { class: "wx-service-row__state" }, Ut = /* @__PURE__ */ oe({
639
666
  __name: "ServicesPage",
640
667
  props: {
641
668
  base: { default: "/services" }
642
669
  },
643
- setup(c) {
644
- const n = c, y = ae(), r = oe(y), l = We(), B = Ce();
645
- ce();
646
- const a = le("webx-services"), T = me(), s = b([]), $ = b([]), W = b(!0), O = pt(Vt), u = f(() => y.can("services.manage")), g = f(
647
- () => y.state.manifest?.modules.find((t) => t.id === "services")?.title ?? a("module.services")
648
- ), m = f({
670
+ setup(u) {
671
+ const o = u, g = ie(), a = ce(g), l = We(), O = Ce();
672
+ ue();
673
+ const r = ae("webx-services"), W = me(), s = b([]), x = b([]), T = b(!0), M = gt(Et), V = y(() => g.can("services.manage")), n = y(
674
+ () => g.state.manifest?.modules.find((t) => t.id === "services")?.title ?? r("module.services")
675
+ ), f = y({
649
676
  get: () => typeof l.query.view == "string" ? l.query.view : "",
650
677
  set: (t) => {
651
- B.replace({
678
+ O.replace({
652
679
  query: { ...l.query, view: t === "" ? void 0 : String(t) }
653
680
  });
654
681
  }
655
- }), h = f(() => m.value === "trashed"), C = f(() => {
682
+ }), p = y(() => f.value === "trashed"), z = y(() => {
656
683
  const t = l.query.category;
657
684
  return typeof t == "string" && t !== "" && Number(t) || null;
658
- }), P = f(() => typeof l.query.q == "string" ? l.query.q : ""), M = b(P.value), U = f(() => [
659
- { value: "", label: a("panel.view-all") },
660
- { value: "published", label: a("panel.view-published") },
661
- { value: "draft", label: a("panel.view-draft") },
662
- { value: "unpublished", label: a("panel.view-unpublished") },
663
- { value: "trashed", label: a("panel.bin"), icon: "trash" }
664
- ]), H = Ue(ge, () => ({
665
- q: P.value,
666
- category: C.value,
667
- filtered: m.value !== ""
668
- })), V = f(() => u.value && H.sortable.value), Y = f(() => P.value !== "" ? a("panel.empty-search") : h.value ? a("panel.empty-bin") : a("panel.empty"));
669
- async function F() {
670
- W.value = !0;
685
+ }), E = y(() => typeof l.query.q == "string" ? l.query.q : ""), F = b(E.value), K = y(() => [
686
+ { value: "", label: r("panel.view-all") },
687
+ { value: "published", label: r("panel.view-published") },
688
+ { value: "draft", label: r("panel.view-draft") },
689
+ { value: "unpublished", label: r("panel.view-unpublished") },
690
+ { value: "trashed", label: r("panel.bin"), icon: "trash" }
691
+ ]), N = Ke(ge, () => ({
692
+ q: E.value,
693
+ category: z.value,
694
+ filtered: f.value !== ""
695
+ })), Z = y(() => V.value && N.sortable.value), q = y(() => E.value !== "" ? r("panel.empty-search") : p.value ? r("panel.empty-bin") : r("panel.empty"));
696
+ async function L() {
697
+ T.value = !0;
671
698
  try {
672
- const t = await r.list({
673
- q: P.value,
674
- category: C.value,
675
- status: h.value ? "" : m.value,
676
- trashed: h.value
699
+ const t = await a.list({
700
+ q: E.value,
701
+ category: z.value,
702
+ status: p.value ? "" : f.value,
703
+ trashed: p.value
677
704
  });
678
- s.value = t.data, $.value = t.filters.categories;
705
+ s.value = t.data, x.value = t.filters.categories;
679
706
  } catch (t) {
680
- S.danger(T(t));
707
+ S.danger(W(t));
681
708
  } finally {
682
- W.value = !1;
709
+ T.value = !1;
683
710
  }
684
711
  }
685
- se(
686
- () => [m.value, C.value, P.value],
712
+ re(
713
+ () => [f.value, z.value, E.value],
687
714
  () => {
688
- F();
715
+ L();
689
716
  }
690
- ), F();
691
- let D;
692
- se(M, (t) => {
693
- clearTimeout(D), D = setTimeout(() => {
694
- B.replace({ query: { ...l.query, q: t.trim() === "" ? void 0 : t } });
717
+ ), L();
718
+ let ee;
719
+ re(F, (t) => {
720
+ clearTimeout(ee), ee = setTimeout(() => {
721
+ O.replace({ query: { ...l.query, q: t.trim() === "" ? void 0 : t } });
695
722
  }, 300);
696
- }), Se(() => clearTimeout(D));
697
- function ue(t) {
698
- B.replace({
723
+ }), Se(() => clearTimeout(ee));
724
+ function P(t) {
725
+ O.replace({
699
726
  query: { ...l.query, category: typeof t == "number" ? String(t) : void 0 }
700
727
  });
701
728
  }
702
- function L(t) {
703
- B.push({ path: `${n.base}/${t.id}`, query: { ...l.query } });
729
+ function le(t) {
730
+ O.push({ path: `${o.base}/${t.id}`, query: { ...l.query } });
704
731
  }
705
- async function z() {
706
- const t = await O({});
707
- t && L(t);
732
+ async function R() {
733
+ const t = await M({});
734
+ t && le(t);
708
735
  }
709
- async function de() {
736
+ async function I() {
710
737
  try {
711
- await H.move(s.value.map((t) => t.id));
738
+ await N.move(s.value.map((t) => t.id));
712
739
  } catch (t) {
713
- S.danger(T(t, a("panel.reorder-failed"))), await F();
740
+ S.danger(W(t, r("panel.reorder-failed"))), await L();
714
741
  }
715
742
  }
716
- function ee(t) {
717
- if (!u.value) return [];
718
- if (h.value)
743
+ function de(t) {
744
+ if (!V.value) return [];
745
+ if (p.value)
719
746
  return [
720
747
  {
721
748
  key: "restore",
722
749
  icon: "refresh",
723
- label: a("panel.restore"),
750
+ label: r("panel.restore"),
724
751
  run: () => {
725
- re(t);
752
+ ve(t);
726
753
  }
727
754
  }
728
755
  ];
729
- const x = [
730
- { key: "open", icon: "edit", label: a("panel.open"), run: () => L(t) }
756
+ const m = [
757
+ { key: "open", icon: "edit", label: r("panel.open"), run: () => le(t) }
731
758
  ];
732
- return t.url && t.status !== "draft" && x.push({
759
+ return t.url && t.status !== "draft" && m.push({
733
760
  key: "site",
734
761
  icon: "external-link",
735
- label: a("panel.open-on-site"),
762
+ label: r("panel.open-on-site"),
736
763
  href: t.url
737
- }), t.url && x.push({
764
+ }), t.url && m.push({
738
765
  key: "copy",
739
766
  icon: "copy",
740
- label: a("panel.copy-address"),
767
+ label: r("panel.copy-address"),
741
768
  run: () => {
742
- K(t);
769
+ U(t);
743
770
  }
744
- }), x.push(
771
+ }), m.push(
745
772
  t.status === "published" || t.status === "modified" ? {
746
773
  key: "unpublish",
747
774
  icon: "eye-off",
748
- label: a("panel.unpublish"),
775
+ label: r("panel.unpublish"),
749
776
  run: () => {
750
- A(() => r.unpublish(t.id), a("panel.unpublished-done"));
777
+ G(() => a.unpublish(t.id), r("panel.unpublished-done"));
751
778
  }
752
779
  } : {
753
780
  key: "publish",
754
781
  icon: "upload",
755
- label: a("panel.publish"),
782
+ label: r("panel.publish"),
756
783
  run: () => {
757
- A(() => r.publish(t.id), a("panel.published"));
784
+ G(() => a.publish(t.id), r("panel.published"));
758
785
  }
759
786
  }
760
- ), x.push({
787
+ ), m.push({
761
788
  key: "delete",
762
789
  icon: "trash",
763
- label: a("panel.delete"),
790
+ label: r("panel.delete"),
764
791
  danger: !0,
765
792
  run: () => {
766
- ve(t);
793
+ te(t);
767
794
  }
768
- }), x;
795
+ }), m;
769
796
  }
770
- async function ve(t) {
771
- await Z({
772
- title: a("panel.delete-title", { title: t.title }),
773
- message: a("panel.delete-text"),
774
- confirmText: a("panel.delete"),
775
- cancelText: a("panel.cancel"),
797
+ async function te(t) {
798
+ await j({
799
+ title: r("panel.delete-title", { title: t.title }),
800
+ message: r("panel.delete-text"),
801
+ confirmText: r("panel.delete"),
802
+ cancelText: r("panel.cancel"),
776
803
  tone: "danger"
777
- }) && await A(() => r.remove(t.id), a("panel.deleted"));
804
+ }) && await G(() => a.remove(t.id), r("panel.deleted"));
778
805
  }
779
- async function re(t) {
780
- await A(() => r.restore(t.id), a("panel.restored"));
806
+ async function ve(t) {
807
+ await G(() => a.restore(t.id), r("panel.restored"));
781
808
  }
782
- async function A(t, x) {
809
+ async function G(t, m) {
783
810
  try {
784
- await t(), S.success(x);
811
+ await t(), S.success(m);
785
812
  } catch (v) {
786
- S.danger(T(v));
813
+ S.danger(W(v));
787
814
  } finally {
788
- await F();
815
+ await L();
789
816
  }
790
817
  }
791
- async function K(t) {
818
+ async function U(t) {
792
819
  if (t.url)
793
820
  try {
794
- await navigator.clipboard.writeText(t.url), S.success(a("panel.address-copied"));
821
+ await navigator.clipboard.writeText(t.url), S.success(r("panel.address-copied"));
795
822
  } catch {
796
823
  }
797
824
  }
798
- function pe(t) {
825
+ function J(t) {
799
826
  return t === "published" || t === "modified" ? "success" : "default";
800
827
  }
801
- function he(t) {
802
- return h.value ? "—" : t.path === null ? a("panel.no-address") : `/${t.path}`;
828
+ function pe(t) {
829
+ return p.value ? "—" : t.path === null ? r("panel.no-address") : `/${t.path}`;
803
830
  }
804
- const G = f(
805
- () => u.value ? [{ key: "new", label: a("panel.new"), icon: "plus", primary: !0, run: () => {
806
- z();
831
+ const he = y(
832
+ () => V.value ? [{ key: "new", label: r("panel.new"), icon: "plus", primary: !0, run: () => {
833
+ R();
807
834
  } }] : []
808
835
  );
809
- return (t, x) => (d(), N("div", qt, [
810
- p(e(He), {
811
- view: m.value,
812
- "onUpdate:view": x[2] || (x[2] = (v) => m.value = v),
813
- title: g.value,
814
- views: U.value,
815
- actions: G.value,
836
+ return (t, m) => (d(), B("div", Nt, [
837
+ h(e(Ge), {
838
+ view: f.value,
839
+ "onUpdate:view": m[2] || (m[2] = (v) => f.value = v),
840
+ title: n.value,
841
+ views: K.value,
842
+ actions: he.value,
816
843
  padding: "sm"
817
844
  }, {
818
- default: o(() => [
819
- E("div", It, [
820
- p(e(Ie), {
821
- modelValue: M.value,
822
- "onUpdate:modelValue": x[0] || (x[0] = (v) => M.value = v),
845
+ default: c(() => [
846
+ A("div", At, [
847
+ h(e(Ie), {
848
+ modelValue: F.value,
849
+ "onUpdate:modelValue": m[0] || (m[0] = (v) => F.value = v),
823
850
  class: "wx-services__search",
824
851
  size: "sm",
825
852
  clearable: "",
826
- placeholder: e(a)("panel.search"),
827
- "aria-label": e(a)("panel.search")
853
+ placeholder: e(r)("panel.search"),
854
+ "aria-label": e(r)("panel.search")
828
855
  }, {
829
- prefix: o(() => [
830
- p(e(xe), {
856
+ prefix: c(() => [
857
+ h(e(_e), {
831
858
  name: "search",
832
859
  size: "sm"
833
860
  })
834
861
  ]),
835
862
  _: 1
836
863
  }, 8, ["modelValue", "placeholder", "aria-label"]),
837
- p(e(ht), {
864
+ h(e(mt), {
838
865
  class: "wx-services__category",
839
- "model-value": C.value,
840
- options: $.value.map((v) => ({ value: v.id, label: v.title })),
841
- placeholder: e(a)("panel.any-category"),
842
- "aria-label": e(a)("panel.filter-category"),
866
+ "model-value": z.value,
867
+ options: x.value.map((v) => ({ value: v.id, label: v.title })),
868
+ placeholder: e(r)("panel.any-category"),
869
+ "aria-label": e(r)("panel.filter-category"),
843
870
  clearable: "",
844
871
  size: "sm",
845
- "onUpdate:modelValue": ue
872
+ "onUpdate:modelValue": P
846
873
  }, null, 8, ["model-value", "options", "placeholder", "aria-label"])
847
874
  ]),
848
- W.value && s.value.length === 0 ? (d(), k(e(ie), {
875
+ T.value && s.value.length === 0 ? (d(), k(e(ne), {
849
876
  key: 0,
850
877
  class: "wx-services__loading",
851
878
  rows: 5
852
879
  })) : s.value.length === 0 ? (d(), k(e(qe), {
853
880
  key: 1,
854
- title: Y.value,
855
- description: m.value === "" && P.value === "" && C.value === null ? e(a)("panel.empty-help") : void 0
856
- }, null, 8, ["title", "description"])) : (d(), N(X, { key: 2 }, [
857
- p(e(ft), {
881
+ title: q.value,
882
+ description: f.value === "" && E.value === "" && z.value === null ? e(r)("panel.empty-help") : void 0
883
+ }, null, 8, ["title", "description"])) : (d(), B(Y, { key: 2 }, [
884
+ h(e(bt), {
858
885
  modelValue: s.value,
859
- "onUpdate:modelValue": x[1] || (x[1] = (v) => s.value = v),
860
- class: ye(["wx-services__list", { "is-loading": W.value }]),
886
+ "onUpdate:modelValue": m[1] || (m[1] = (v) => s.value = v),
887
+ class: ye(["wx-services__list", { "is-loading": T.value }]),
861
888
  plain: "",
862
889
  "item-key": "id",
863
- handle: V.value ? "grip" : "row",
890
+ handle: Z.value ? "grip" : "row",
864
891
  "item-label": (v) => v.title,
865
- disabled: !V.value,
866
- onMove: de
892
+ disabled: !Z.value,
893
+ onMove: I
867
894
  }, {
868
- default: o(({ item: v }) => [
869
- (d(), k(Ze(h.value ? "div" : "router-link"), et({ class: "wx-service-row" }, h.value ? {} : { to: { path: `${n.base}/${v.id}`, query: e(l).query } }), {
870
- default: o(() => [
871
- E("span", {
895
+ default: c(({ item: v }) => [
896
+ (d(), k(at(p.value ? "div" : "router-link"), rt({ class: "wx-service-row" }, p.value ? {} : { to: { path: `${o.base}/${v.id}`, query: e(l).query } }), {
897
+ default: c(() => [
898
+ A("span", {
872
899
  class: ye(["wx-service-row__cover", { "is-empty": !v.cover }])
873
900
  }, [
874
- v.cover?.thumb ? (d(), N("img", {
901
+ v.cover?.thumb ? (d(), B("img", {
875
902
  key: 0,
876
903
  src: v.cover.thumb,
877
904
  alt: "",
878
905
  loading: "lazy"
879
- }, null, 8, zt)) : (d(), k(e(xe), {
906
+ }, null, 8, Bt)) : (d(), k(e(_e), {
880
907
  key: 1,
881
908
  name: "image",
882
909
  size: "sm"
883
910
  }))
884
911
  ], 2),
885
- E("span", Et, [
886
- E("span", Nt, w(v.title), 1),
887
- E("span", Bt, w(he(v)), 1)
912
+ A("span", Ot, [
913
+ A("span", Pt, w(v.title), 1),
914
+ A("span", Dt, [
915
+ _(w(pe(v)), 1),
916
+ p.value ? D("", !0) : (d(), k(e(je), {
917
+ key: 0,
918
+ locale: v.address_locale
919
+ }, null, 8, ["locale"]))
920
+ ])
888
921
  ]),
889
- E("span", Dt, [
890
- E("span", Ot, [
891
- (d(!0), N(X, null, $e(v.categories, (te, fe) => (d(), N(X, {
892
- key: te.id
922
+ A("span", Mt, [
923
+ A("span", Lt, [
924
+ (d(!0), B(Y, null, $e(v.categories, (se, fe) => (d(), B(Y, {
925
+ key: se.id
893
926
  }, [
894
- fe === 0 ? (d(), k(e(yt), {
927
+ fe === 0 ? (d(), k(e(wt), {
895
928
  key: 0,
896
- content: e(a)("panel.main-category")
929
+ content: e(r)("panel.main-category")
897
930
  }, {
898
- default: o(() => [
899
- p(e(j), {
931
+ default: c(() => [
932
+ h(e(Q), {
900
933
  size: "sm",
901
934
  round: "",
902
935
  type: "primary"
903
936
  }, {
904
- default: o(() => [
905
- _(w(te.title), 1)
937
+ default: c(() => [
938
+ _(w(se.title), 1)
906
939
  ]),
907
940
  _: 2
908
941
  }, 1024)
909
942
  ]),
910
943
  _: 2
911
- }, 1032, ["content"])) : (d(), k(e(j), {
944
+ }, 1032, ["content"])) : (d(), k(e(Q), {
912
945
  key: 1,
913
946
  size: "sm",
914
947
  round: ""
915
948
  }, {
916
- default: o(() => [
917
- _(w(te.title), 1)
949
+ default: c(() => [
950
+ _(w(se.title), 1)
918
951
  ]),
919
952
  _: 2
920
953
  }, 1024))
921
954
  ], 64))), 128))
922
955
  ]),
923
- E("span", Pt, [
924
- p(e(j), {
925
- type: pe(v.status),
956
+ A("span", Rt, [
957
+ h(e(Q), {
958
+ type: J(v.status),
926
959
  dot: "",
927
960
  size: "sm"
928
961
  }, {
929
- default: o(() => [
930
- _(w(e(a)(`panel.status-${v.status}`)), 1)
962
+ default: c(() => [
963
+ _(w(e(r)(`panel.status-${v.status}`)), 1)
931
964
  ]),
932
965
  _: 2
933
966
  }, 1032, ["type"]),
934
- v.status === "modified" ? (d(), k(e(j), {
967
+ v.status === "modified" ? (d(), k(e(Q), {
935
968
  key: 0,
936
969
  type: "primary",
937
970
  size: "sm",
938
971
  round: ""
939
972
  }, {
940
- default: o(() => [
941
- _(w(e(a)("panel.edits")), 1)
973
+ default: c(() => [
974
+ _(w(e(r)("panel.edits")), 1)
942
975
  ]),
943
976
  _: 1
944
- })) : R("", !0)
977
+ })) : D("", !0)
945
978
  ])
946
979
  ])
947
980
  ]),
948
981
  _: 2
949
982
  }, 1040))
950
983
  ]),
951
- actions: o(({ item: v }) => [
952
- p(e(Fe), {
953
- actions: ee(v),
984
+ actions: c(({ item: v }) => [
985
+ h(e(Je), {
986
+ actions: de(v),
954
987
  label: v.title
955
988
  }, null, 8, ["actions", "label"])
956
989
  ]),
957
990
  _: 1
958
991
  }, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
959
- u.value && !h.value ? (d(), k(e(Ve), {
992
+ V.value && !p.value ? (d(), k(e(Ve), {
960
993
  key: 0,
961
994
  class: "wx-services__note",
962
995
  type: "info",
963
- description: e(H).hint.value
964
- }, null, 8, ["description"])) : R("", !0)
996
+ description: e(N).hint.value
997
+ }, null, 8, ["description"])) : D("", !0)
965
998
  ], 64))
966
999
  ]),
967
1000
  _: 1
968
1001
  }, 8, ["view", "title", "views", "actions"])
969
1002
  ]));
970
1003
  }
971
- }), Mt = /* @__PURE__ */ be(At, [["__scopeId", "data-v-f99d37d6"]]);
972
- function Lt(c = "/services") {
1004
+ }), Ht = /* @__PURE__ */ be(Ut, [["__scopeId", "data-v-b32f9ad4"]]);
1005
+ function Ft(u = "/services") {
973
1006
  return {
974
1007
  api: "services/categories",
975
- path: `${c}/categories`,
1008
+ path: `${u}/categories`,
976
1009
  name: "webx.services.categories",
977
1010
  module: "service-categories",
978
1011
  screen: "services.category-form",
979
1012
  manage: "services.categories.manage",
980
1013
  count: "services_count",
981
1014
  // The list narrowed to one category is also where its own order is dragged.
982
- items: (n) => ({ path: c, query: { category: String(n) } }),
1015
+ items: (o) => ({ path: u, query: { category: String(o) } }),
983
1016
  words: {
984
1017
  new: "webx-services::category.new",
985
1018
  empty: "webx-services::category.empty",
@@ -999,19 +1032,19 @@ function Lt(c = "/services") {
999
1032
  }
1000
1033
  };
1001
1034
  }
1002
- function Gt(c = {}) {
1003
- const n = c.path ?? "/services";
1035
+ function Xt(u = {}) {
1036
+ const o = u.path ?? "/services";
1004
1037
  return [
1005
1038
  {
1006
1039
  id: "services",
1007
- path: n,
1040
+ path: o,
1008
1041
  routes: [
1009
- { path: n, name: "webx.services", component: Mt, props: { base: n } },
1042
+ { path: o, name: "webx.services", component: Ht, props: { base: o } },
1010
1043
  {
1011
- path: `${n}/:id(\\d+)`,
1044
+ path: `${o}/:id(\\d+)`,
1012
1045
  name: "webx.services.edit",
1013
- component: kt,
1014
- props: { base: n }
1046
+ component: Wt,
1047
+ props: { base: o }
1015
1048
  }
1016
1049
  ],
1017
1050
  /*
@@ -1020,28 +1053,28 @@ function Gt(c = {}) {
1020
1053
  * particular is shared, and reads the prefix from the editor hosting the screen.
1021
1054
  */
1022
1055
  types: {
1023
- "wx-service-history": { component: Ct, kind: "display" }
1056
+ "wx-service-history": { component: zt, kind: "display" }
1024
1057
  }
1025
1058
  },
1026
1059
  {
1027
1060
  id: "service-categories",
1028
- path: `${n}/categories`,
1029
- routes: Ke(Lt(n))
1061
+ path: `${o}/categories`,
1062
+ routes: Qe(Ft(o))
1030
1063
  }
1031
1064
  ];
1032
1065
  }
1033
1066
  export {
1034
1067
  ge as SERVICES_API,
1035
- Vt as WxServiceCreateDialog,
1036
- kt as WxServiceEditorPage,
1037
- Ct as WxServiceHistory,
1038
- Mt as WxServicesPage,
1039
- oe as createServicesApi,
1040
- gt as provideServiceEditor,
1041
- Lt as serviceCategoriesOptions,
1068
+ Et as WxServiceCreateDialog,
1069
+ Wt as WxServiceEditorPage,
1070
+ zt as WxServiceHistory,
1071
+ Ht as WxServicesPage,
1072
+ ce as createServicesApi,
1073
+ xt as provideServiceEditor,
1074
+ Ft as serviceCategoriesOptions,
1042
1075
  ze as serviceEditorKey,
1043
- Gt as services,
1044
- bt as servicesMessages,
1045
- mt as useServiceEditor
1076
+ Xt as services,
1077
+ kt as servicesMessages,
1078
+ _t as useServiceEditor
1046
1079
  };
1047
1080
  //# sourceMappingURL=index.js.map