@webx-ui/module-seo 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { defineComponent as F, useModel as Ue, ref as z, computed as S, openBlock as w, createElementBlock as L, createVNode as a, unref as e, withCtx as t, createElementVNode as O, isRef as I, createTextVNode as b, toDisplayString as m, createCommentVNode as j, createBlock as W, resolveDynamicComponent as We, mergeModels as ze, renderSlot as Te, watch as ge, withKeys as De, Fragment as se, renderList as ue, createSlots as fe, withModifiers as Z, markRaw as Oe } from "vue";
2
- import { useAdmin as P, useTranslate as M } from "@webx-ui/module-admin";
3
- import { useLocales as Re, WxTabs as je, WxTab as oe, WxFormItem as U, WxInput as N, WxText as R, WxTextarea as ce, WxCheckboxGroup as Le, WxCodeEditor as Be, localizedValue as he, WxHeading as Ie, WxSpace as H, WxSegmented as Ne, WxButton as A, useModal as ie, WxDialog as de, WxSelect as ee, WxSwitch as be, toast as B, WxAlert as pe, WxBadge as J, WxDescriptions as Ae, WxDescriptionsItem as Fe, WxEmpty as Pe, createModal as te, WxCard as ye, WxTable as _e, WxActions as ae, WxAction as le, confirm as xe, WxInputNumber as Me } from "@webx-ui/core";
4
- import { useRouter as Ee, useRoute as Ke } from "vue-router";
5
- const He = {
1
+ import { defineComponent as M, computed as C, openBlock as x, createElementBlock as j, createElementVNode as A, createVNode as l, unref as e, withCtx as t, createTextVNode as f, toDisplayString as m, renderSlot as Ue, ref as z, createBlock as U, isRef as P, withKeys as ze, Fragment as oe, createCommentVNode as R, renderList as me, useModel as We, resolveDynamicComponent as Te, mergeModels as De, watch as ye, createSlots as _e, withModifiers as te, markRaw as Le } from "vue";
2
+ import { useAdmin as E, useTranslate as K } from "@webx-ui/module-admin";
3
+ import { WxHeading as Oe, WxSpace as G, WxSegmented as Ae, WxButton as N, useModal as de, WxDialog as re, WxInput as I, WxAlert as X, WxText as L, WxBadge as F, WxDescriptions as Re, WxDescriptionsItem as je, WxEmpty as Be, createModal as Y, WxCard as ue, WxTable as ce, WxLink as Pe, useLocales as Ie, WxTabs as Ne, WxTab as ne, WxFormItem as T, WxTextarea as fe, WxCheckboxGroup as Fe, WxCodeEditor as Me, localizedValue as xe, WxSelect as ae, WxSwitch as we, toast as B, WxActions as le, WxAction as se, confirm as ke, WxInputNumber as Ee } from "@webx-ui/core";
4
+ import { useRouter as Ke, useRoute as He } from "vue-router";
5
+ const Je = {
6
6
  module: {
7
7
  title: "SEO"
8
8
  },
@@ -52,7 +52,16 @@ const He = {
52
52
  "test-none": "No rule matches this address.",
53
53
  "test-redirected": "This address is redirected to :target with a :status.",
54
54
  "test-result": "What the page will say",
55
- "test-chain": "Where each part came from"
55
+ "test-chain": "Where each part came from",
56
+ automatic: "Automatic",
57
+ "search-aliases": "Search by address or destination",
58
+ "aliases-empty": "Nothing has moved yet.",
59
+ "aliases-help": "The site writes these itself: renaming or moving a page leaves its old address behind answering 301, so nothing that linked to it dies. They cannot be edited here — a redirect of your own is tried first and wins.",
60
+ language: "Language",
61
+ "moved-at": "Moved",
62
+ gone: "Leads nowhere",
63
+ occupied: "A page of the site answers at :path. A redirect is tried before it, so the page stops being reachable there.",
64
+ "occupied-alias": "This address already leads to :target — what a move left behind. A redirect written here is tried first."
56
65
  },
57
66
  card: {
58
67
  "section-page": "The page",
@@ -80,30 +89,446 @@ const He = {
80
89
  "json-ld-invalid": "This is not valid JSON.",
81
90
  preview: "In search results"
82
91
  }
83
- }, ve = /* @__PURE__ */ new WeakSet();
84
- function E() {
92
+ }, he = /* @__PURE__ */ new WeakSet();
93
+ function H() {
85
94
  try {
86
- const { i18n: n } = P();
87
- ve.has(n) || (n.defaults("webx-seo", He), ve.add(n));
95
+ const { i18n: o } = E();
96
+ he.has(o) || (o.defaults("webx-seo", Je), he.add(o));
88
97
  } catch {
89
98
  }
90
99
  }
91
- const ne = [
100
+ const qe = { class: "wx-seo-layout" }, Ge = { class: "wx-seo-layout__head" }, Qe = /* @__PURE__ */ M({
101
+ __name: "SeoLayout",
102
+ props: {
103
+ base: {},
104
+ current: {}
105
+ },
106
+ emits: ["test"],
107
+ setup(o, { emit: r }) {
108
+ const d = o, c = r, a = E(), n = Ke(), h = He();
109
+ H();
110
+ const s = K("webx-seo"), w = C(
111
+ () => a.state.manifest?.modules.find((p) => p.id === "seo")?.title ?? s("module.title")
112
+ ), V = C(() => [
113
+ { value: "rules", label: s("page.rules") },
114
+ { value: "redirects", label: s("page.redirects") },
115
+ { value: "aliases", label: s("page.automatic") }
116
+ ]), v = C({
117
+ get: () => d.current,
118
+ set: (p) => {
119
+ const b = p === "rules" ? d.base : `${d.base}/${String(p)}`;
120
+ b !== h.path && n.push(b);
121
+ }
122
+ });
123
+ return (p, b) => (x(), j("div", qe, [
124
+ A("div", Ge, [
125
+ l(e(Oe), { level: 2 }, {
126
+ default: t(() => [
127
+ f(m(w.value), 1)
128
+ ]),
129
+ _: 1
130
+ }),
131
+ l(e(G), { size: "sm" }, {
132
+ default: t(() => [
133
+ l(e(Ae), {
134
+ modelValue: v.value,
135
+ "onUpdate:modelValue": b[0] || (b[0] = (k) => v.value = k),
136
+ options: V.value,
137
+ size: "sm"
138
+ }, null, 8, ["modelValue", "options"]),
139
+ l(e(N), {
140
+ variant: "outline",
141
+ icon: "search",
142
+ onClick: b[1] || (b[1] = (k) => c("test"))
143
+ }, {
144
+ default: t(() => [
145
+ f(m(e(s)("page.test")), 1)
146
+ ]),
147
+ _: 1
148
+ })
149
+ ]),
150
+ _: 1
151
+ })
152
+ ]),
153
+ Ue(p.$slots, "default", {}, void 0, !0)
154
+ ]));
155
+ }
156
+ }), J = (o, r) => {
157
+ const d = o.__vccOpts || o;
158
+ for (const [c, a] of r)
159
+ d[c] = a;
160
+ return d;
161
+ }, pe = /* @__PURE__ */ J(Qe, [["__scopeId", "data-v-f68ce04b"]]);
162
+ function Q(o) {
163
+ const r = `${o.apiPath}/seo`, d = (n) => n.data, c = (n) => ({
164
+ ...n.meta,
165
+ data: n.data
166
+ }), a = (n) => ({
167
+ q: n.q || void 0,
168
+ match_type: n.match_type ?? void 0,
169
+ is_active: n.is_active ?? void 0,
170
+ sort: n.sort || void 0,
171
+ page: n.page,
172
+ per_page: n.per_page
173
+ });
174
+ return {
175
+ urls: (n = {}) => o.http.get(`${r}/urls`, {
176
+ query: a(n)
177
+ }).then(c),
178
+ url: (n) => o.http.get(`${r}/urls/${n}`).then(d),
179
+ createUrl: (n) => o.http.post(`${r}/urls`, n).then(d),
180
+ updateUrl: (n, h) => o.http.put(`${r}/urls/${n}`, h).then(d),
181
+ removeUrl: (n) => o.http.delete(`${r}/urls/${n}`),
182
+ redirects: (n = {}) => o.http.get(
183
+ `${r}/redirects`,
184
+ { query: a(n) }
185
+ ).then(c),
186
+ createRedirect: (n) => o.http.post(`${r}/redirects`, n).then(d),
187
+ updateRedirect: (n, h) => o.http.put(`${r}/redirects/${n}`, h).then(d),
188
+ removeRedirect: (n) => o.http.delete(`${r}/redirects/${n}`),
189
+ aliases: (n = {}) => o.http.get(`${r}/aliases`, {
190
+ query: {
191
+ q: n.q || void 0,
192
+ locale: n.locale ?? void 0,
193
+ page: n.page,
194
+ per_page: n.per_page
195
+ }
196
+ }).then(c),
197
+ // A POST because it carries an address in its body, and an address in a query string is an
198
+ // address somebody has to escape twice.
199
+ test: (n, h = null) => o.http.post(`${r}/test-url`, { url: n, locale: h ?? void 0 }).then(d)
200
+ };
201
+ }
202
+ const Xe = { class: "wx-seo-test" }, Ye = {
203
+ key: 3,
204
+ class: "wx-seo-test__matched"
205
+ }, Ze = {
206
+ key: 4,
207
+ class: "wx-seo-test__result"
208
+ }, et = {
209
+ key: 5,
210
+ class: "wx-seo-test__chain"
211
+ }, tt = /* @__PURE__ */ M({
212
+ __name: "TestUrlDialog",
213
+ setup(o) {
214
+ const { open: r } = de(), d = E(), c = Q(d);
215
+ H();
216
+ const a = K("webx-seo"), n = z(""), h = z(!1), s = z(null), w = C(() => {
217
+ const v = s.value?.seo;
218
+ return v ? [
219
+ { label: a("card.title"), value: v.title },
220
+ { label: a("card.h1"), value: v.h1 },
221
+ { label: a("card.description"), value: v.description },
222
+ { label: a("card.keywords"), value: v.keywords },
223
+ { label: a("card.canonical"), value: v.canonical },
224
+ { label: a("card.robots"), value: v.robots }
225
+ ].filter((p) => p.value) : [];
226
+ });
227
+ async function V() {
228
+ if (n.value.trim() !== "") {
229
+ h.value = !0;
230
+ try {
231
+ s.value = await c.test(n.value);
232
+ } finally {
233
+ h.value = !1;
234
+ }
235
+ }
236
+ }
237
+ return (v, p) => (x(), U(e(re), {
238
+ open: e(r),
239
+ "onUpdate:open": p[1] || (p[1] = (b) => P(r) ? r.value = b : null),
240
+ title: e(a)("page.test"),
241
+ width: 720
242
+ }, {
243
+ default: t(() => [
244
+ A("div", Xe, [
245
+ l(e(G), {
246
+ size: "sm",
247
+ class: "wx-seo-test__ask"
248
+ }, {
249
+ default: t(() => [
250
+ l(e(I), {
251
+ modelValue: n.value,
252
+ "onUpdate:modelValue": p[0] || (p[0] = (b) => n.value = b),
253
+ placeholder: e(a)("page.test-placeholder"),
254
+ class: "wx-seo-test__input",
255
+ onKeyup: ze(V, ["enter"])
256
+ }, null, 8, ["modelValue", "placeholder"]),
257
+ l(e(N), {
258
+ type: "primary",
259
+ loading: h.value,
260
+ onClick: V
261
+ }, {
262
+ default: t(() => [
263
+ f(m(e(a)("page.test-run")), 1)
264
+ ]),
265
+ _: 1
266
+ }, 8, ["loading"])
267
+ ]),
268
+ _: 1
269
+ }),
270
+ s.value ? (x(), j(oe, { key: 0 }, [
271
+ s.value.redirect ? (x(), U(e(X), {
272
+ key: 0,
273
+ type: "warning",
274
+ description: e(a)("page.test-redirected", {
275
+ target: s.value.redirect.target,
276
+ status: s.value.redirect.status
277
+ })
278
+ }, null, 8, ["description"])) : R("", !0),
279
+ s.value.route ? (x(), U(e(X), {
280
+ key: 1,
281
+ type: "info",
282
+ description: s.value.route.kind === "alias" ? e(a)("page.occupied-alias", { target: s.value.route.target ?? s.value.route.path }) : e(a)("page.occupied", { path: s.value.route.path })
283
+ }, null, 8, ["description"])) : R("", !0),
284
+ s.value.matched ? (x(), j("div", Ye, [
285
+ l(e(L), {
286
+ size: "sm",
287
+ tone: "muted"
288
+ }, {
289
+ default: t(() => [
290
+ f(m(e(a)("page.test-matched")), 1)
291
+ ]),
292
+ _: 1
293
+ }),
294
+ l(e(G), {
295
+ size: "sm",
296
+ align: "center"
297
+ }, {
298
+ default: t(() => [
299
+ l(e(F), null, {
300
+ default: t(() => [
301
+ f(m(e(a)(`page.${s.value.matched.match_type}`)), 1)
302
+ ]),
303
+ _: 1
304
+ }),
305
+ l(e(L), {
306
+ mono: "",
307
+ size: "sm"
308
+ }, {
309
+ default: t(() => [
310
+ f(m(s.value.matched.pattern), 1)
311
+ ]),
312
+ _: 1
313
+ })
314
+ ]),
315
+ _: 1
316
+ })
317
+ ])) : (x(), U(e(X), {
318
+ key: 2,
319
+ type: "info",
320
+ description: e(a)("page.test-none")
321
+ }, null, 8, ["description"])),
322
+ w.value.length > 0 ? (x(), j("div", Ze, [
323
+ l(e(L), {
324
+ size: "sm",
325
+ tone: "muted"
326
+ }, {
327
+ default: t(() => [
328
+ f(m(e(a)("page.test-result")), 1)
329
+ ]),
330
+ _: 1
331
+ }),
332
+ l(e(Re), {
333
+ columns: 1,
334
+ bordered: "",
335
+ size: "sm"
336
+ }, {
337
+ default: t(() => [
338
+ (x(!0), j(oe, null, me(w.value, (b) => (x(), U(e(je), {
339
+ key: b.label,
340
+ label: b.label
341
+ }, {
342
+ default: t(() => [
343
+ f(m(b.value), 1)
344
+ ]),
345
+ _: 2
346
+ }, 1032, ["label"]))), 128))
347
+ ]),
348
+ _: 1
349
+ })
350
+ ])) : R("", !0),
351
+ s.value.chain.length > 0 ? (x(), j("div", et, [
352
+ l(e(L), {
353
+ size: "sm",
354
+ tone: "muted"
355
+ }, {
356
+ default: t(() => [
357
+ f(m(e(a)("page.test-chain")), 1)
358
+ ]),
359
+ _: 1
360
+ }),
361
+ l(e(G), {
362
+ size: "xs",
363
+ wrap: ""
364
+ }, {
365
+ default: t(() => [
366
+ (x(!0), j(oe, null, me(s.value.chain, (b) => (x(), U(e(F), {
367
+ key: b.source
368
+ }, {
369
+ default: t(() => [
370
+ f(m(b.source) + " · " + m(b.priority), 1)
371
+ ]),
372
+ _: 2
373
+ }, 1024))), 128))
374
+ ]),
375
+ _: 1
376
+ })
377
+ ])) : R("", !0)
378
+ ], 64)) : h.value ? R("", !0) : (x(), U(e(Be), {
379
+ key: 1,
380
+ icon: "search",
381
+ description: e(a)("page.test-empty")
382
+ }, null, 8, ["description"]))
383
+ ])
384
+ ]),
385
+ _: 1
386
+ }, 8, ["open", "title"]));
387
+ }
388
+ }), ve = /* @__PURE__ */ J(tt, [["__scopeId", "data-v-116e47cd"]]), at = /* @__PURE__ */ M({
389
+ __name: "SeoAliasesPage",
390
+ props: {
391
+ base: { default: "/seo" }
392
+ },
393
+ setup(o) {
394
+ const r = o, d = E(), c = Q(d);
395
+ H();
396
+ const a = K("webx-seo"), n = z(null), h = z(!1), s = Y(ve), w = C(() => (d.state.manifest?.locales?.length ?? 1) > 1), V = C(() => [
397
+ { key: "pattern", label: a("page.address"), sortable: !1 },
398
+ { key: "target", label: a("page.target") },
399
+ {
400
+ key: "locale",
401
+ label: a("page.language"),
402
+ align: "center",
403
+ hidden: !w.value,
404
+ hideBelow: 760
405
+ },
406
+ { key: "created_at", label: a("page.moved-at"), hideBelow: 900, hideOnCards: !0 }
407
+ ]);
408
+ async function v(p) {
409
+ h.value = !0;
410
+ try {
411
+ n.value = await c.aliases({
412
+ q: p.search,
413
+ page: p.page,
414
+ per_page: p.perPage
415
+ });
416
+ } finally {
417
+ h.value = !1;
418
+ }
419
+ }
420
+ return (p, b) => (x(), U(pe, {
421
+ base: r.base,
422
+ current: "aliases",
423
+ onTest: b[0] || (b[0] = (k) => e(s)({}))
424
+ }, {
425
+ default: t(() => [
426
+ l(e(ue), null, {
427
+ header: t(() => [
428
+ f(m(e(a)("page.automatic")), 1)
429
+ ]),
430
+ default: t(() => [
431
+ l(e(X), {
432
+ type: "info",
433
+ variant: "soft",
434
+ description: e(a)("page.aliases-help"),
435
+ class: "wx-seo-aliases__note"
436
+ }, null, 8, ["description"]),
437
+ l(e(ce), {
438
+ data: n.value,
439
+ columns: V.value,
440
+ "row-key": "id",
441
+ searchable: "",
442
+ flush: "",
443
+ loading: h.value,
444
+ "search-placeholder": e(a)("page.search-aliases"),
445
+ "empty-text": e(a)("page.aliases-empty"),
446
+ onStateChange: v
447
+ }, {
448
+ "cell-pattern": t(({ row: k }) => [
449
+ l(e(L), {
450
+ mono: "",
451
+ size: "sm"
452
+ }, {
453
+ default: t(() => [
454
+ f(m(k.pattern), 1)
455
+ ]),
456
+ _: 2
457
+ }, 1024)
458
+ ]),
459
+ "cell-target": t(({ row: k }) => [
460
+ k.target && k.target_url ? (x(), U(e(Pe), {
461
+ key: 0,
462
+ href: k.target_url,
463
+ external: "",
464
+ size: "sm"
465
+ }, {
466
+ default: t(() => [
467
+ l(e(L), {
468
+ mono: "",
469
+ size: "sm"
470
+ }, {
471
+ default: t(() => [
472
+ f(m(k.target), 1)
473
+ ]),
474
+ _: 2
475
+ }, 1024)
476
+ ]),
477
+ _: 2
478
+ }, 1032, ["href"])) : (x(), U(e(F), {
479
+ key: 1,
480
+ type: "warning"
481
+ }, {
482
+ default: t(() => [
483
+ f(m(e(a)("page.gone")), 1)
484
+ ]),
485
+ _: 1
486
+ }))
487
+ ]),
488
+ "cell-locale": t(({ row: k }) => [
489
+ l(e(F), null, {
490
+ default: t(() => [
491
+ f(m(k.locale), 1)
492
+ ]),
493
+ _: 2
494
+ }, 1024)
495
+ ]),
496
+ "cell-created_at": t(({ row: k }) => [
497
+ l(e(L), {
498
+ size: "sm",
499
+ tone: "muted"
500
+ }, {
501
+ default: t(() => [
502
+ f(m(k.created_at ? new Date(k.created_at).toLocaleString() : ""), 1)
503
+ ]),
504
+ _: 2
505
+ }, 1024)
506
+ ]),
507
+ _: 1
508
+ }, 8, ["data", "columns", "loading", "search-placeholder", "empty-text"])
509
+ ]),
510
+ _: 1
511
+ })
512
+ ]),
513
+ _: 1
514
+ }, 8, ["base"]));
515
+ }
516
+ }), lt = /* @__PURE__ */ J(at, [["__scopeId", "data-v-11e0403c"]]), ie = [
92
517
  "noindex",
93
518
  "nofollow",
94
519
  "noarchive",
95
520
  "nosnippet",
96
521
  "noimageindex"
97
- ], Je = { class: "wx-seo" }, qe = { class: "wx-seo__fields" }, Ge = { class: "wx-seo__count" }, Qe = { class: "wx-seo__count" }, Xe = {
522
+ ], st = { class: "wx-seo" }, ot = { class: "wx-seo__fields" }, nt = { class: "wx-seo__count" }, it = { class: "wx-seo__count" }, dt = {
98
523
  key: 0,
99
524
  class: "wx-seo__preview"
100
- }, Ye = { class: "wx-seo__snippet" }, Ze = {
525
+ }, rt = { class: "wx-seo__snippet" }, ut = {
101
526
  key: 0,
102
527
  class: "wx-seo__snippet-address"
103
- }, et = { class: "wx-seo__snippet-title" }, tt = { class: "wx-seo__snippet-text" }, at = { class: "wx-seo__fields" }, lt = { class: "wx-seo__fields" }, st = /* @__PURE__ */ F({
528
+ }, ct = { class: "wx-seo__snippet-title" }, pt = { class: "wx-seo__snippet-text" }, vt = { class: "wx-seo__fields" }, gt = { class: "wx-seo__fields" }, mt = /* @__PURE__ */ M({
104
529
  name: "WxSeo",
105
530
  __name: "SeoCard",
106
- props: /* @__PURE__ */ ze({
531
+ props: /* @__PURE__ */ De({
107
532
  mediaField: { default: void 0 },
108
533
  disabled: { type: Boolean, default: !1 },
109
534
  titleLimit: { default: 60 },
@@ -115,98 +540,98 @@ const ne = [
115
540
  modelModifiers: {}
116
541
  }),
117
542
  emits: ["update:modelValue"],
118
- setup(n) {
119
- const u = n, i = Ue(n, "modelValue");
120
- E();
121
- const c = M("webx-seo"), l = Re(), d = z(null), h = z(!1);
122
- function o(f) {
123
- return S({
124
- get: () => i.value?.[f],
125
- set: (x) => {
126
- i.value = { ...i.value ?? {}, [f]: x };
543
+ setup(o) {
544
+ const r = o, d = We(o, "modelValue");
545
+ H();
546
+ const c = K("webx-seo"), a = Ie(), n = z(null), h = z(!1);
547
+ function s(_) {
548
+ return C({
549
+ get: () => d.value?.[_],
550
+ set: ($) => {
551
+ d.value = { ...d.value ?? {}, [_]: $ };
127
552
  }
128
553
  });
129
554
  }
130
- const y = o("title"), k = o("h1"), p = o("description"), _ = o("keywords"), g = o("og_title"), T = o("og_description"), D = S({
131
- get: () => i.value?.canonical ?? "",
132
- set: (f) => {
133
- i.value = { ...i.value ?? {}, canonical: f.trim() === "" ? null : f };
555
+ const w = s("title"), V = s("h1"), v = s("description"), p = s("keywords"), b = s("og_title"), k = s("og_description"), O = C({
556
+ get: () => d.value?.canonical ?? "",
557
+ set: (_) => {
558
+ d.value = { ...d.value ?? {}, canonical: _.trim() === "" ? null : _ };
134
559
  }
135
- }), $ = S({
136
- get: () => i.value?.og_image ?? null,
137
- set: (f) => {
138
- i.value = { ...i.value ?? {}, og_image: f };
560
+ }), S = C({
561
+ get: () => d.value?.og_image ?? null,
562
+ set: (_) => {
563
+ d.value = { ...d.value ?? {}, og_image: _ };
139
564
  }
140
- }), v = S(() => (i.value?.robots ?? "").split(",").map((f) => f.trim())), s = S(
141
- () => v.value.filter((f) => f !== "" && !ne.includes(f))
142
- ), r = S({
143
- get: () => v.value.filter((f) => ne.includes(f)),
144
- set: (f) => {
145
- const x = [...f, ...s.value].join(", ");
146
- i.value = { ...i.value ?? {}, robots: x === "" ? null : x };
565
+ }), y = C(() => (d.value?.robots ?? "").split(",").map((_) => _.trim())), i = C(
566
+ () => y.value.filter((_) => _ !== "" && !ie.includes(_))
567
+ ), u = C({
568
+ get: () => y.value.filter((_) => ie.includes(_)),
569
+ set: (_) => {
570
+ const $ = [..._, ...i.value].join(", ");
571
+ d.value = { ...d.value ?? {}, robots: $ === "" ? null : $ };
147
572
  }
148
- }), V = S(
149
- () => ne.map((f) => ({ value: f, label: c(`card.${f}`) }))
150
- ), Q = S({
573
+ }), g = C(
574
+ () => ie.map((_) => ({ value: _, label: c(`card.${_}`) }))
575
+ ), D = C({
151
576
  get: () => {
152
- if (d.value !== null) return d.value;
153
- const f = i.value?.json_ld;
154
- return f == null ? "" : JSON.stringify(f, null, 2);
577
+ if (n.value !== null) return n.value;
578
+ const _ = d.value?.json_ld;
579
+ return _ == null ? "" : JSON.stringify(_, null, 2);
155
580
  },
156
- set: (f) => {
157
- if (d.value = f, f.trim() === "") {
158
- h.value = !1, i.value = { ...i.value ?? {}, json_ld: null };
581
+ set: (_) => {
582
+ if (n.value = _, _.trim() === "") {
583
+ h.value = !1, d.value = { ...d.value ?? {}, json_ld: null };
159
584
  return;
160
585
  }
161
586
  try {
162
- i.value = { ...i.value ?? {}, json_ld: JSON.parse(f) }, h.value = !1;
587
+ d.value = { ...d.value ?? {}, json_ld: JSON.parse(_) }, h.value = !1;
163
588
  } catch {
164
589
  h.value = !0;
165
590
  }
166
591
  }
167
592
  });
168
- function X(f) {
169
- return he(f, l.active.value);
593
+ function Z(_) {
594
+ return xe(_, a.active.value);
170
595
  }
171
- const Y = S(() => ({
172
- title: X(y.value).length,
173
- description: X(p.value).length
174
- })), K = S(() => ({
175
- title: X(y.value),
176
- description: X(p.value),
177
- address: D.value || (u.site ?? "")
178
- })), Se = S(() => K.value.title !== "" || K.value.description !== ""), Ce = S(
179
- () => s.value.length === 0 ? void 0 : c("card.robots-kept", { directives: s.value.join(", ") })
596
+ const ee = C(() => ({
597
+ title: Z(w.value).length,
598
+ description: Z(v.value).length
599
+ })), q = C(() => ({
600
+ title: Z(w.value),
601
+ description: Z(v.value),
602
+ address: O.value || (r.site ?? "")
603
+ })), Se = C(() => q.value.title !== "" || q.value.description !== ""), Ce = C(
604
+ () => i.value.length === 0 ? void 0 : c("card.robots-kept", { directives: i.value.join(", ") })
180
605
  );
181
- function re(f, x) {
182
- return f > x ? "warning" : "muted";
606
+ function ge(_, $) {
607
+ return _ > $ ? "warning" : "muted";
183
608
  }
184
- return (f, x) => (w(), L("div", Je, [
185
- a(e(je), { "keep-alive": "" }, {
609
+ return (_, $) => (x(), j("div", st, [
610
+ l(e(Ne), { "keep-alive": "" }, {
186
611
  default: t(() => [
187
- a(e(oe), {
612
+ l(e(ne), {
188
613
  label: e(c)("card.section-page"),
189
614
  value: "page"
190
615
  }, {
191
616
  default: t(() => [
192
- O("div", qe, [
193
- a(e(U), {
617
+ A("div", ot, [
618
+ l(e(T), {
194
619
  label: e(c)("card.title"),
195
- disabled: n.disabled
620
+ disabled: o.disabled
196
621
  }, {
197
622
  default: t(() => [
198
- a(e(N), {
199
- modelValue: e(y),
200
- "onUpdate:modelValue": x[0] || (x[0] = (C) => I(y) ? y.value = C : null),
623
+ l(e(I), {
624
+ modelValue: e(w),
625
+ "onUpdate:modelValue": $[0] || ($[0] = (W) => P(w) ? w.value = W : null),
201
626
  localized: ""
202
627
  }, null, 8, ["modelValue"]),
203
- O("div", Ge, [
204
- a(e(R), {
628
+ A("div", nt, [
629
+ l(e(L), {
205
630
  size: "sm",
206
- tone: re(Y.value.title, n.titleLimit)
631
+ tone: ge(ee.value.title, o.titleLimit)
207
632
  }, {
208
633
  default: t(() => [
209
- b(m(Y.value.title) + " / " + m(n.titleLimit), 1)
634
+ f(m(ee.value.title) + " / " + m(o.titleLimit), 1)
210
635
  ]),
211
636
  _: 1
212
637
  }, 8, ["tone"])
@@ -214,37 +639,37 @@ const ne = [
214
639
  ]),
215
640
  _: 1
216
641
  }, 8, ["label", "disabled"]),
217
- a(e(U), {
642
+ l(e(T), {
218
643
  label: e(c)("card.h1"),
219
- disabled: n.disabled
644
+ disabled: o.disabled
220
645
  }, {
221
646
  default: t(() => [
222
- a(e(N), {
223
- modelValue: e(k),
224
- "onUpdate:modelValue": x[1] || (x[1] = (C) => I(k) ? k.value = C : null),
647
+ l(e(I), {
648
+ modelValue: e(V),
649
+ "onUpdate:modelValue": $[1] || ($[1] = (W) => P(V) ? V.value = W : null),
225
650
  localized: ""
226
651
  }, null, 8, ["modelValue"])
227
652
  ]),
228
653
  _: 1
229
654
  }, 8, ["label", "disabled"]),
230
- a(e(U), {
655
+ l(e(T), {
231
656
  label: e(c)("card.description"),
232
- disabled: n.disabled
657
+ disabled: o.disabled
233
658
  }, {
234
659
  default: t(() => [
235
- a(e(ce), {
236
- modelValue: e(p),
237
- "onUpdate:modelValue": x[2] || (x[2] = (C) => I(p) ? p.value = C : null),
660
+ l(e(fe), {
661
+ modelValue: e(v),
662
+ "onUpdate:modelValue": $[2] || ($[2] = (W) => P(v) ? v.value = W : null),
238
663
  localized: "",
239
664
  rows: 3
240
665
  }, null, 8, ["modelValue"]),
241
- O("div", Qe, [
242
- a(e(R), {
666
+ A("div", it, [
667
+ l(e(L), {
243
668
  size: "sm",
244
- tone: re(Y.value.description, n.descriptionLimit)
669
+ tone: ge(ee.value.description, o.descriptionLimit)
245
670
  }, {
246
671
  default: t(() => [
247
- b(m(Y.value.description) + " / " + m(n.descriptionLimit), 1)
672
+ f(m(ee.value.description) + " / " + m(o.descriptionLimit), 1)
248
673
  ]),
249
674
  _: 1
250
675
  }, 8, ["tone"])
@@ -252,76 +677,76 @@ const ne = [
252
677
  ]),
253
678
  _: 1
254
679
  }, 8, ["label", "disabled"]),
255
- a(e(U), {
680
+ l(e(T), {
256
681
  label: e(c)("card.keywords"),
257
- disabled: n.disabled
682
+ disabled: o.disabled
258
683
  }, {
259
684
  default: t(() => [
260
- a(e(N), {
261
- modelValue: e(_),
262
- "onUpdate:modelValue": x[3] || (x[3] = (C) => I(_) ? _.value = C : null),
685
+ l(e(I), {
686
+ modelValue: e(p),
687
+ "onUpdate:modelValue": $[3] || ($[3] = (W) => P(p) ? p.value = W : null),
263
688
  localized: ""
264
689
  }, null, 8, ["modelValue"])
265
690
  ]),
266
691
  _: 1
267
692
  }, 8, ["label", "disabled"]),
268
- Se.value ? (w(), L("div", Xe, [
269
- a(e(R), {
693
+ Se.value ? (x(), j("div", dt, [
694
+ l(e(L), {
270
695
  size: "sm",
271
696
  tone: "muted"
272
697
  }, {
273
698
  default: t(() => [
274
- b(m(e(c)("card.preview")), 1)
699
+ f(m(e(c)("card.preview")), 1)
275
700
  ]),
276
701
  _: 1
277
702
  }),
278
- O("div", Ye, [
279
- K.value.address ? (w(), L("div", Ze, m(K.value.address), 1)) : j("", !0),
280
- O("div", et, m(K.value.title), 1),
281
- O("div", tt, m(K.value.description), 1)
703
+ A("div", rt, [
704
+ q.value.address ? (x(), j("div", ut, m(q.value.address), 1)) : R("", !0),
705
+ A("div", ct, m(q.value.title), 1),
706
+ A("div", pt, m(q.value.description), 1)
282
707
  ])
283
- ])) : j("", !0)
708
+ ])) : R("", !0)
284
709
  ])
285
710
  ]),
286
711
  _: 1
287
712
  }, 8, ["label"]),
288
- a(e(oe), {
713
+ l(e(ne), {
289
714
  label: e(c)("card.section-share"),
290
715
  value: "share"
291
716
  }, {
292
717
  default: t(() => [
293
- O("div", at, [
294
- n.mediaField ? (w(), W(We(n.mediaField), {
718
+ A("div", vt, [
719
+ o.mediaField ? (x(), U(Te(o.mediaField), {
295
720
  key: 0,
296
- modelValue: $.value,
297
- "onUpdate:modelValue": x[4] || (x[4] = (C) => $.value = C),
721
+ modelValue: S.value,
722
+ "onUpdate:modelValue": $[4] || ($[4] = (W) => S.value = W),
298
723
  label: e(c)("card.og-image"),
299
724
  aspect: "16/9",
300
725
  accept: "image",
301
- disabled: n.disabled
302
- }, null, 8, ["modelValue", "label", "disabled"])) : j("", !0),
303
- a(e(U), {
726
+ disabled: o.disabled
727
+ }, null, 8, ["modelValue", "label", "disabled"])) : R("", !0),
728
+ l(e(T), {
304
729
  label: e(c)("card.og-title"),
305
730
  help: e(c)("card.og-help"),
306
- disabled: n.disabled
731
+ disabled: o.disabled
307
732
  }, {
308
733
  default: t(() => [
309
- a(e(N), {
310
- modelValue: e(g),
311
- "onUpdate:modelValue": x[5] || (x[5] = (C) => I(g) ? g.value = C : null),
734
+ l(e(I), {
735
+ modelValue: e(b),
736
+ "onUpdate:modelValue": $[5] || ($[5] = (W) => P(b) ? b.value = W : null),
312
737
  localized: ""
313
738
  }, null, 8, ["modelValue"])
314
739
  ]),
315
740
  _: 1
316
741
  }, 8, ["label", "help", "disabled"]),
317
- a(e(U), {
742
+ l(e(T), {
318
743
  label: e(c)("card.og-description"),
319
- disabled: n.disabled
744
+ disabled: o.disabled
320
745
  }, {
321
746
  default: t(() => [
322
- a(e(ce), {
323
- modelValue: e(T),
324
- "onUpdate:modelValue": x[6] || (x[6] = (C) => I(T) ? T.value = C : null),
747
+ l(e(fe), {
748
+ modelValue: e(k),
749
+ "onUpdate:modelValue": $[6] || ($[6] = (W) => P(k) ? k.value = W : null),
325
750
  localized: "",
326
751
  rows: 2
327
752
  }, null, 8, ["modelValue"])
@@ -332,51 +757,51 @@ const ne = [
332
757
  ]),
333
758
  _: 1
334
759
  }, 8, ["label"]),
335
- a(e(oe), {
760
+ l(e(ne), {
336
761
  label: e(c)("card.section-advanced"),
337
762
  value: "advanced"
338
763
  }, {
339
764
  default: t(() => [
340
- O("div", lt, [
341
- a(e(U), {
765
+ A("div", gt, [
766
+ l(e(T), {
342
767
  label: e(c)("card.canonical"),
343
768
  help: e(c)("card.canonical-help"),
344
- disabled: n.disabled
769
+ disabled: o.disabled
345
770
  }, {
346
771
  default: t(() => [
347
- a(e(N), {
348
- modelValue: D.value,
349
- "onUpdate:modelValue": x[7] || (x[7] = (C) => D.value = C),
772
+ l(e(I), {
773
+ modelValue: O.value,
774
+ "onUpdate:modelValue": $[7] || ($[7] = (W) => O.value = W),
350
775
  placeholder: "https://example.com/page"
351
776
  }, null, 8, ["modelValue"])
352
777
  ]),
353
778
  _: 1
354
779
  }, 8, ["label", "help", "disabled"]),
355
- a(e(U), {
780
+ l(e(T), {
356
781
  label: e(c)("card.robots"),
357
782
  help: Ce.value,
358
- disabled: n.disabled
783
+ disabled: o.disabled
359
784
  }, {
360
785
  default: t(() => [
361
- a(e(Le), {
362
- modelValue: r.value,
363
- "onUpdate:modelValue": x[8] || (x[8] = (C) => r.value = C),
364
- options: V.value
786
+ l(e(Fe), {
787
+ modelValue: u.value,
788
+ "onUpdate:modelValue": $[8] || ($[8] = (W) => u.value = W),
789
+ options: g.value
365
790
  }, null, 8, ["modelValue", "options"])
366
791
  ]),
367
792
  _: 1
368
793
  }, 8, ["label", "help", "disabled"]),
369
- n.structuredData ? (w(), W(e(U), {
794
+ o.structuredData ? (x(), U(e(T), {
370
795
  key: 0,
371
796
  label: e(c)("card.json-ld"),
372
797
  help: e(c)("card.json-ld-help"),
373
798
  error: h.value ? e(c)("card.json-ld-invalid") : void 0,
374
- disabled: n.disabled
799
+ disabled: o.disabled
375
800
  }, {
376
801
  default: t(() => [
377
- a(e(Be), {
378
- modelValue: Q.value,
379
- "onUpdate:modelValue": x[9] || (x[9] = (C) => Q.value = C),
802
+ l(e(Me), {
803
+ modelValue: D.value,
804
+ "onUpdate:modelValue": $[9] || ($[9] = (W) => D.value = W),
380
805
  language: "json",
381
806
  lint: "",
382
807
  "min-height": "120px",
@@ -384,7 +809,7 @@ const ne = [
384
809
  }, null, 8, ["modelValue"])
385
810
  ]),
386
811
  _: 1
387
- }, 8, ["label", "help", "error", "disabled"])) : j("", !0)
812
+ }, 8, ["label", "help", "error", "disabled"])) : R("", !0)
388
813
  ])
389
814
  ]),
390
815
  _: 1
@@ -394,174 +819,93 @@ const ne = [
394
819
  })
395
820
  ]));
396
821
  }
397
- }), q = (n, u) => {
398
- const i = n.__vccOpts || n;
399
- for (const [c, l] of u)
400
- i[c] = l;
401
- return i;
402
- }, we = /* @__PURE__ */ q(st, [["__scopeId", "data-v-b7ea284e"]]), ot = { class: "wx-seo-layout" }, nt = { class: "wx-seo-layout__head" }, it = /* @__PURE__ */ F({
403
- __name: "SeoLayout",
404
- props: {
405
- base: {},
406
- current: {}
407
- },
408
- emits: ["test"],
409
- setup(n, { emit: u }) {
410
- const i = n, c = u, l = P(), d = Ee(), h = Ke();
411
- E();
412
- const o = M("webx-seo"), y = S(
413
- () => l.state.manifest?.modules.find((_) => _.id === "seo")?.title ?? o("module.title")
414
- ), k = S(() => [
415
- { value: "rules", label: o("page.rules") },
416
- { value: "redirects", label: o("page.redirects") }
417
- ]), p = S({
418
- get: () => i.current,
419
- set: (_) => {
420
- const g = _ === "redirects" ? `${i.base}/redirects` : i.base;
421
- g !== h.path && d.push(g);
422
- }
423
- });
424
- return (_, g) => (w(), L("div", ot, [
425
- O("div", nt, [
426
- a(e(Ie), { level: 2 }, {
427
- default: t(() => [
428
- b(m(y.value), 1)
429
- ]),
430
- _: 1
431
- }),
432
- a(e(H), { size: "sm" }, {
433
- default: t(() => [
434
- a(e(Ne), {
435
- modelValue: p.value,
436
- "onUpdate:modelValue": g[0] || (g[0] = (T) => p.value = T),
437
- options: k.value,
438
- size: "sm"
439
- }, null, 8, ["modelValue", "options"]),
440
- a(e(A), {
441
- variant: "outline",
442
- icon: "search",
443
- onClick: g[1] || (g[1] = (T) => c("test"))
444
- }, {
445
- default: t(() => [
446
- b(m(e(o)("page.test")), 1)
447
- ]),
448
- _: 1
449
- })
450
- ]),
451
- _: 1
452
- })
453
- ]),
454
- Te(_.$slots, "default", {}, void 0, !0)
455
- ]));
456
- }
457
- }), ke = /* @__PURE__ */ q(it, [["__scopeId", "data-v-01bc38b5"]]);
458
- function G(n) {
459
- const u = `${n.apiPath}/seo`, i = (d) => d.data, c = (d) => ({
460
- ...d.meta,
461
- data: d.data
462
- }), l = (d) => ({
463
- q: d.q || void 0,
464
- match_type: d.match_type ?? void 0,
465
- is_active: d.is_active ?? void 0,
466
- sort: d.sort || void 0,
467
- page: d.page,
468
- per_page: d.per_page
469
- });
470
- return {
471
- urls: (d = {}) => n.http.get(`${u}/urls`, {
472
- query: l(d)
473
- }).then(c),
474
- url: (d) => n.http.get(`${u}/urls/${d}`).then(i),
475
- createUrl: (d) => n.http.post(`${u}/urls`, d).then(i),
476
- updateUrl: (d, h) => n.http.put(`${u}/urls/${d}`, h).then(i),
477
- removeUrl: (d) => n.http.delete(`${u}/urls/${d}`),
478
- redirects: (d = {}) => n.http.get(
479
- `${u}/redirects`,
480
- { query: l(d) }
481
- ).then(c),
482
- createRedirect: (d) => n.http.post(`${u}/redirects`, d).then(i),
483
- updateRedirect: (d, h) => n.http.put(`${u}/redirects/${d}`, h).then(i),
484
- removeRedirect: (d) => n.http.delete(`${u}/redirects/${d}`),
485
- // A POST because it carries an address in its body, and an address in a query string is an
486
- // address somebody has to escape twice.
487
- test: (d, h = null) => n.http.post(`${u}/test-url`, { url: d, locale: h ?? void 0 }).then(i)
488
- };
489
- }
490
- const dt = { class: "wx-seo-redirect" }, rt = { class: "wx-seo-redirect__row" }, ut = /* @__PURE__ */ F({
822
+ }), Ve = /* @__PURE__ */ J(mt, [["__scopeId", "data-v-b7ea284e"]]), ft = { class: "wx-seo-redirect" }, ht = { class: "wx-seo-redirect__row" }, bt = /* @__PURE__ */ M({
491
823
  __name: "SeoRedirectDialog",
492
824
  props: {
493
825
  redirect: { default: null }
494
826
  },
495
- setup(n) {
496
- const u = n, { resolve: i, dismiss: c, open: l } = ie(), d = P(), h = G(d);
497
- E();
498
- const o = M("webx-seo"), y = z(!1), k = z({}), p = z({
827
+ setup(o) {
828
+ const r = o, { resolve: d, dismiss: c, open: a } = de(), n = E(), h = Q(n);
829
+ H();
830
+ const s = K("webx-seo"), w = z(!1), V = z({}), v = z(null), p = z({
499
831
  match_type: "exact",
500
832
  pattern: "",
501
833
  target: "",
502
834
  status: 301,
503
835
  is_active: !0
504
- }), _ = S(() => u.redirect !== null), g = S(() => [
505
- { value: "exact", label: o("page.exact") },
506
- { value: "mask", label: o("page.mask") },
507
- { value: "regex", label: o("page.regex") }
508
- ]), T = [
836
+ }), b = C(() => r.redirect !== null), k = C(() => [
837
+ { value: "exact", label: s("page.exact") },
838
+ { value: "mask", label: s("page.mask") },
839
+ { value: "regex", label: s("page.regex") }
840
+ ]), O = [
509
841
  { value: 301, label: "301" },
510
842
  { value: 302, label: "302" }
511
843
  ];
512
- ge(
513
- () => u.redirect,
514
- (v) => {
844
+ ye(
845
+ () => r.redirect,
846
+ (u) => {
515
847
  p.value = {
516
- match_type: v?.match_type ?? "exact",
517
- pattern: v?.pattern ?? "",
518
- target: v?.target ?? "",
519
- status: v?.status ?? 301,
520
- is_active: v?.is_active ?? !0
521
- }, k.value = {};
848
+ match_type: u?.match_type ?? "exact",
849
+ pattern: u?.pattern ?? "",
850
+ target: u?.target ?? "",
851
+ status: u?.status ?? 301,
852
+ is_active: u?.is_active ?? !0
853
+ }, V.value = {}, v.value = null, S();
522
854
  },
523
855
  { immediate: !0 }
524
856
  );
525
- function D(v) {
526
- return k.value[v]?.[0];
857
+ async function S() {
858
+ const u = p.value.pattern.trim();
859
+ if (p.value.match_type !== "exact" || u === "") {
860
+ v.value = null;
861
+ return;
862
+ }
863
+ try {
864
+ v.value = (await h.test(u)).route;
865
+ } catch {
866
+ v.value = null;
867
+ }
527
868
  }
528
- async function $() {
529
- y.value = !0, k.value = {};
869
+ function y(u) {
870
+ return V.value[u]?.[0];
871
+ }
872
+ async function i() {
873
+ w.value = !0, V.value = {};
530
874
  try {
531
- const v = u.redirect ? await h.updateRedirect(u.redirect.id, p.value) : await h.createRedirect(p.value);
532
- B.success(o("page.saved")), i(v);
533
- } catch (v) {
534
- const s = v.body;
535
- s?.errors ? (k.value = s.errors, B.danger(o("page.failed"))) : B.danger(s?.message ?? o("page.failed"));
875
+ const u = r.redirect ? await h.updateRedirect(r.redirect.id, p.value) : await h.createRedirect(p.value);
876
+ B.success(s("page.saved")), d(u);
877
+ } catch (u) {
878
+ const g = u.body;
879
+ g?.errors ? (V.value = g.errors, B.danger(s("page.failed"))) : B.danger(g?.message ?? s("page.failed"));
536
880
  } finally {
537
- y.value = !1;
881
+ w.value = !1;
538
882
  }
539
883
  }
540
- return (v, s) => (w(), W(e(de), {
541
- open: e(l),
542
- "onUpdate:open": s[6] || (s[6] = (r) => I(l) ? l.value = r : null),
543
- title: e(o)("page.redirect"),
884
+ return (u, g) => (x(), U(e(re), {
885
+ open: e(a),
886
+ "onUpdate:open": g[6] || (g[6] = (D) => P(a) ? a.value = D : null),
887
+ title: e(s)("page.redirect"),
544
888
  width: 640
545
889
  }, {
546
890
  footer: t(() => [
547
- a(e(H), { size: "sm" }, {
891
+ l(e(G), { size: "sm" }, {
548
892
  default: t(() => [
549
- a(e(A), {
893
+ l(e(N), {
550
894
  variant: "outline",
551
- onClick: s[5] || (s[5] = (r) => e(c)())
895
+ onClick: g[5] || (g[5] = (D) => e(c)())
552
896
  }, {
553
897
  default: t(() => [
554
- b(m(e(o)("page.cancel")), 1)
898
+ f(m(e(s)("page.cancel")), 1)
555
899
  ]),
556
900
  _: 1
557
901
  }),
558
- a(e(A), {
902
+ l(e(N), {
559
903
  type: "primary",
560
- loading: y.value,
561
- onClick: $
904
+ loading: w.value,
905
+ onClick: i
562
906
  }, {
563
907
  default: t(() => [
564
- b(m(_.value ? e(o)("page.save") : e(o)("page.new-redirect")), 1)
908
+ f(m(b.value ? e(s)("page.save") : e(s)("page.new-redirect")), 1)
565
909
  ]),
566
910
  _: 1
567
911
  }, 8, ["loading"])
@@ -570,67 +914,75 @@ const dt = { class: "wx-seo-redirect" }, rt = { class: "wx-seo-redirect__row" },
570
914
  })
571
915
  ]),
572
916
  default: t(() => [
573
- O("div", dt, [
574
- a(e(U), {
575
- label: e(o)("page.kind")
917
+ A("div", ft, [
918
+ l(e(T), {
919
+ label: e(s)("page.kind")
576
920
  }, {
577
921
  default: t(() => [
578
- a(e(ee), {
922
+ l(e(ae), {
579
923
  modelValue: p.value.match_type,
580
- "onUpdate:modelValue": s[0] || (s[0] = (r) => p.value.match_type = r),
581
- options: g.value
924
+ "onUpdate:modelValue": g[0] || (g[0] = (D) => p.value.match_type = D),
925
+ options: k.value,
926
+ onChange: S
582
927
  }, null, 8, ["modelValue", "options"])
583
928
  ]),
584
929
  _: 1
585
930
  }, 8, ["label"]),
586
- a(e(U), {
587
- label: e(o)("page.address"),
588
- help: e(o)("page.address-help"),
589
- error: D("pattern")
931
+ l(e(T), {
932
+ label: e(s)("page.address"),
933
+ help: e(s)("page.address-help"),
934
+ error: y("pattern")
590
935
  }, {
591
936
  default: t(() => [
592
- a(e(N), {
937
+ l(e(I), {
593
938
  modelValue: p.value.pattern,
594
- "onUpdate:modelValue": s[1] || (s[1] = (r) => p.value.pattern = r),
595
- placeholder: "/old-address"
939
+ "onUpdate:modelValue": g[1] || (g[1] = (D) => p.value.pattern = D),
940
+ placeholder: "/old-address",
941
+ onBlur: S
596
942
  }, null, 8, ["modelValue"])
597
943
  ]),
598
944
  _: 1
599
945
  }, 8, ["label", "help", "error"]),
600
- a(e(U), {
601
- label: e(o)("page.target"),
602
- help: e(o)("page.target-help"),
603
- error: D("target")
946
+ v.value ? (x(), U(e(X), {
947
+ key: 0,
948
+ type: "warning",
949
+ variant: "soft",
950
+ description: v.value.kind === "alias" ? e(s)("page.occupied-alias", { target: v.value.target ?? v.value.path }) : e(s)("page.occupied", { path: v.value.path })
951
+ }, null, 8, ["description"])) : R("", !0),
952
+ l(e(T), {
953
+ label: e(s)("page.target"),
954
+ help: e(s)("page.target-help"),
955
+ error: y("target")
604
956
  }, {
605
957
  default: t(() => [
606
- a(e(N), {
958
+ l(e(I), {
607
959
  modelValue: p.value.target,
608
- "onUpdate:modelValue": s[2] || (s[2] = (r) => p.value.target = r),
960
+ "onUpdate:modelValue": g[2] || (g[2] = (D) => p.value.target = D),
609
961
  placeholder: "/new-address"
610
962
  }, null, 8, ["modelValue"])
611
963
  ]),
612
964
  _: 1
613
965
  }, 8, ["label", "help", "error"]),
614
- O("div", rt, [
615
- a(e(U), {
616
- label: e(o)("page.status")
966
+ A("div", ht, [
967
+ l(e(T), {
968
+ label: e(s)("page.status")
617
969
  }, {
618
970
  default: t(() => [
619
- a(e(ee), {
971
+ l(e(ae), {
620
972
  modelValue: p.value.status,
621
- "onUpdate:modelValue": s[3] || (s[3] = (r) => p.value.status = r),
622
- options: T
973
+ "onUpdate:modelValue": g[3] || (g[3] = (D) => p.value.status = D),
974
+ options: O
623
975
  }, null, 8, ["modelValue"])
624
976
  ]),
625
977
  _: 1
626
978
  }, 8, ["label"]),
627
- a(e(U), {
628
- label: e(o)("page.state")
979
+ l(e(T), {
980
+ label: e(s)("page.state")
629
981
  }, {
630
982
  default: t(() => [
631
- a(e(be), {
983
+ l(e(we), {
632
984
  modelValue: p.value.is_active,
633
- "onUpdate:modelValue": s[4] || (s[4] = (r) => p.value.is_active = r)
985
+ "onUpdate:modelValue": g[4] || (g[4] = (D) => p.value.is_active = D)
634
986
  }, null, 8, ["modelValue"])
635
987
  ]),
636
988
  _: 1
@@ -641,354 +993,173 @@ const dt = { class: "wx-seo-redirect" }, rt = { class: "wx-seo-redirect__row" },
641
993
  _: 1
642
994
  }, 8, ["open", "title"]));
643
995
  }
644
- }), ct = /* @__PURE__ */ q(ut, [["__scopeId", "data-v-b30b1bf0"]]), pt = { class: "wx-seo-test" }, vt = {
645
- key: 2,
646
- class: "wx-seo-test__matched"
647
- }, mt = {
648
- key: 3,
649
- class: "wx-seo-test__result"
650
- }, gt = {
651
- key: 4,
652
- class: "wx-seo-test__chain"
653
- }, ft = /* @__PURE__ */ F({
654
- __name: "TestUrlDialog",
655
- setup(n) {
656
- const { open: u } = ie(), i = P(), c = G(i);
657
- E();
658
- const l = M("webx-seo"), d = z(""), h = z(!1), o = z(null), y = S(() => {
659
- const p = o.value?.seo;
660
- return p ? [
661
- { label: l("card.title"), value: p.title },
662
- { label: l("card.h1"), value: p.h1 },
663
- { label: l("card.description"), value: p.description },
664
- { label: l("card.keywords"), value: p.keywords },
665
- { label: l("card.canonical"), value: p.canonical },
666
- { label: l("card.robots"), value: p.robots }
667
- ].filter((_) => _.value) : [];
668
- });
669
- async function k() {
670
- if (d.value.trim() !== "") {
671
- h.value = !0;
672
- try {
673
- o.value = await c.test(d.value);
674
- } finally {
675
- h.value = !1;
676
- }
677
- }
678
- }
679
- return (p, _) => (w(), W(e(de), {
680
- open: e(u),
681
- "onUpdate:open": _[1] || (_[1] = (g) => I(u) ? u.value = g : null),
682
- title: e(l)("page.test"),
683
- width: 720
684
- }, {
685
- default: t(() => [
686
- O("div", pt, [
687
- a(e(H), {
688
- size: "sm",
689
- class: "wx-seo-test__ask"
690
- }, {
691
- default: t(() => [
692
- a(e(N), {
693
- modelValue: d.value,
694
- "onUpdate:modelValue": _[0] || (_[0] = (g) => d.value = g),
695
- placeholder: e(l)("page.test-placeholder"),
696
- class: "wx-seo-test__input",
697
- onKeyup: De(k, ["enter"])
698
- }, null, 8, ["modelValue", "placeholder"]),
699
- a(e(A), {
700
- type: "primary",
701
- loading: h.value,
702
- onClick: k
703
- }, {
704
- default: t(() => [
705
- b(m(e(l)("page.test-run")), 1)
706
- ]),
707
- _: 1
708
- }, 8, ["loading"])
709
- ]),
710
- _: 1
711
- }),
712
- o.value ? (w(), L(se, { key: 0 }, [
713
- o.value.redirect ? (w(), W(e(pe), {
714
- key: 0,
715
- type: "warning",
716
- description: e(l)("page.test-redirected", {
717
- target: o.value.redirect.target,
718
- status: o.value.redirect.status
719
- })
720
- }, null, 8, ["description"])) : j("", !0),
721
- o.value.matched ? (w(), L("div", vt, [
722
- a(e(R), {
723
- size: "sm",
724
- tone: "muted"
725
- }, {
726
- default: t(() => [
727
- b(m(e(l)("page.test-matched")), 1)
728
- ]),
729
- _: 1
730
- }),
731
- a(e(H), {
732
- size: "sm",
733
- align: "center"
734
- }, {
735
- default: t(() => [
736
- a(e(J), null, {
737
- default: t(() => [
738
- b(m(e(l)(`page.${o.value.matched.match_type}`)), 1)
739
- ]),
740
- _: 1
741
- }),
742
- a(e(R), {
743
- mono: "",
744
- size: "sm"
745
- }, {
746
- default: t(() => [
747
- b(m(o.value.matched.pattern), 1)
748
- ]),
749
- _: 1
750
- })
751
- ]),
752
- _: 1
753
- })
754
- ])) : (w(), W(e(pe), {
755
- key: 1,
756
- type: "info",
757
- description: e(l)("page.test-none")
758
- }, null, 8, ["description"])),
759
- y.value.length > 0 ? (w(), L("div", mt, [
760
- a(e(R), {
761
- size: "sm",
762
- tone: "muted"
763
- }, {
764
- default: t(() => [
765
- b(m(e(l)("page.test-result")), 1)
766
- ]),
767
- _: 1
768
- }),
769
- a(e(Ae), {
770
- columns: 1,
771
- bordered: "",
772
- size: "sm"
773
- }, {
774
- default: t(() => [
775
- (w(!0), L(se, null, ue(y.value, (g) => (w(), W(e(Fe), {
776
- key: g.label,
777
- label: g.label
778
- }, {
779
- default: t(() => [
780
- b(m(g.value), 1)
781
- ]),
782
- _: 2
783
- }, 1032, ["label"]))), 128))
784
- ]),
785
- _: 1
786
- })
787
- ])) : j("", !0),
788
- o.value.chain.length > 0 ? (w(), L("div", gt, [
789
- a(e(R), {
790
- size: "sm",
791
- tone: "muted"
792
- }, {
793
- default: t(() => [
794
- b(m(e(l)("page.test-chain")), 1)
795
- ]),
796
- _: 1
797
- }),
798
- a(e(H), {
799
- size: "xs",
800
- wrap: ""
801
- }, {
802
- default: t(() => [
803
- (w(!0), L(se, null, ue(o.value.chain, (g) => (w(), W(e(J), {
804
- key: g.source
805
- }, {
806
- default: t(() => [
807
- b(m(g.source) + " · " + m(g.priority), 1)
808
- ]),
809
- _: 2
810
- }, 1024))), 128))
811
- ]),
812
- _: 1
813
- })
814
- ])) : j("", !0)
815
- ], 64)) : h.value ? j("", !0) : (w(), W(e(Pe), {
816
- key: 1,
817
- icon: "search",
818
- description: e(l)("page.test-empty")
819
- }, null, 8, ["description"]))
820
- ])
821
- ]),
822
- _: 1
823
- }, 8, ["open", "title"]));
824
- }
825
- }), Ve = /* @__PURE__ */ q(ft, [["__scopeId", "data-v-59071f71"]]), ht = /* @__PURE__ */ F({
996
+ }), yt = /* @__PURE__ */ J(bt, [["__scopeId", "data-v-fabd0f11"]]), _t = /* @__PURE__ */ M({
826
997
  __name: "SeoRedirectsPage",
827
998
  props: {
828
999
  base: { default: "/seo" }
829
1000
  },
830
- setup(n) {
831
- const u = n, i = P(), c = G(i);
832
- E();
833
- const l = M("webx-seo"), d = z(null), h = z(!1);
834
- let o = { page: 1, perPage: 20, sort: null, search: "" };
835
- const y = i.can("seo.manage"), k = te(ct), p = te(Ve), _ = S(() => [
836
- { key: "pattern", label: l("page.address"), sortable: !0 },
837
- { key: "target", label: l("page.target") },
838
- { key: "status", label: l("page.status"), align: "center", hideBelow: 560 },
839
- { key: "hits", label: l("page.hits"), align: "center", sortable: !0, hideBelow: 760 },
1001
+ setup(o) {
1002
+ const r = o, d = E(), c = Q(d);
1003
+ H();
1004
+ const a = K("webx-seo"), n = z(null), h = z(!1);
1005
+ let s = { page: 1, perPage: 20, sort: null, search: "" };
1006
+ const w = d.can("seo.manage"), V = Y(yt), v = Y(ve), p = C(() => [
1007
+ { key: "pattern", label: a("page.address"), sortable: !0 },
1008
+ { key: "target", label: a("page.target") },
1009
+ { key: "status", label: a("page.status"), align: "center", hideBelow: 560 },
1010
+ { key: "hits", label: a("page.hits"), align: "center", sortable: !0, hideBelow: 760 },
840
1011
  {
841
1012
  key: "last_hit_at",
842
- label: l("page.last-hit"),
1013
+ label: a("page.last-hit"),
843
1014
  sortable: !0,
844
1015
  hideBelow: 900,
845
1016
  hideOnCards: !0
846
1017
  },
847
- { key: "is_active", label: l("page.state"), align: "center", hideBelow: 660 },
1018
+ { key: "is_active", label: a("page.state"), align: "center", hideBelow: 660 },
848
1019
  {
849
1020
  key: "actions",
850
1021
  label: "",
851
1022
  width: 56,
852
1023
  align: "right",
853
- hidden: !y,
1024
+ hidden: !w,
854
1025
  hideOnCards: !0
855
1026
  }
856
1027
  ]);
857
- async function g($) {
858
- o = $, h.value = !0;
1028
+ async function b(S) {
1029
+ s = S, h.value = !0;
859
1030
  try {
860
- d.value = await c.redirects({
861
- q: $.search,
862
- sort: $.sort ? `${$.sort.order === "desc" ? "-" : ""}${$.sort.key}` : "-hits",
863
- page: $.page,
864
- per_page: $.perPage
1031
+ n.value = await c.redirects({
1032
+ q: S.search,
1033
+ sort: S.sort ? `${S.sort.order === "desc" ? "-" : ""}${S.sort.key}` : "-hits",
1034
+ page: S.page,
1035
+ per_page: S.perPage
865
1036
  });
866
1037
  } finally {
867
1038
  h.value = !1;
868
1039
  }
869
1040
  }
870
- async function T($) {
871
- await k({ redirect: $ }) && g(o);
1041
+ async function k(S) {
1042
+ await V({ redirect: S }) && b(s);
872
1043
  }
873
- async function D($) {
874
- if (await xe({
875
- title: l("page.delete-title", { pattern: $.pattern }),
876
- message: l("page.delete-text"),
877
- confirmText: l("page.delete"),
878
- cancelText: l("page.cancel"),
1044
+ async function O(S) {
1045
+ if (await ke({
1046
+ title: a("page.delete-title", { pattern: S.pattern }),
1047
+ message: a("page.delete-text"),
1048
+ confirmText: a("page.delete"),
1049
+ cancelText: a("page.cancel"),
879
1050
  tone: "danger"
880
1051
  }))
881
1052
  try {
882
- await c.removeRedirect($.id), B.success(l("page.deleted")), g(o);
883
- } catch (s) {
884
- B.danger(s.body?.message ?? String(s));
1053
+ await c.removeRedirect(S.id), B.success(a("page.deleted")), b(s);
1054
+ } catch (i) {
1055
+ B.danger(i.body?.message ?? String(i));
885
1056
  }
886
1057
  }
887
- return ($, v) => (w(), W(ke, {
888
- base: u.base,
1058
+ return (S, y) => (x(), U(pe, {
1059
+ base: r.base,
889
1060
  current: "redirects",
890
- onTest: v[4] || (v[4] = (s) => e(p)({}))
1061
+ onTest: y[4] || (y[4] = (i) => e(v)({}))
891
1062
  }, {
892
1063
  default: t(() => [
893
- a(e(ye), null, fe({
1064
+ l(e(ue), null, _e({
894
1065
  header: t(() => [
895
- b(m(e(l)("page.redirects")), 1)
1066
+ f(m(e(a)("page.redirects")), 1)
896
1067
  ]),
897
1068
  default: t(() => [
898
- a(e(_e), {
899
- data: d.value,
900
- columns: _.value,
1069
+ l(e(ce), {
1070
+ data: n.value,
1071
+ columns: p.value,
901
1072
  "row-key": "id",
902
1073
  searchable: "",
903
1074
  hover: "",
904
1075
  flush: "",
905
1076
  loading: h.value,
906
- "search-placeholder": e(l)("page.search-redirects"),
907
- "empty-text": e(l)("page.empty"),
908
- onStateChange: g,
909
- onRowClick: v[3] || (v[3] = (s) => e(y) ? T(s) : void 0)
1077
+ "search-placeholder": e(a)("page.search-redirects"),
1078
+ "empty-text": e(a)("page.empty"),
1079
+ onStateChange: b,
1080
+ onRowClick: y[3] || (y[3] = (i) => e(w) ? k(i) : void 0)
910
1081
  }, {
911
- "cell-pattern": t(({ row: s }) => [
912
- a(e(R), {
1082
+ "cell-pattern": t(({ row: i }) => [
1083
+ l(e(L), {
913
1084
  mono: "",
914
1085
  size: "sm"
915
1086
  }, {
916
1087
  default: t(() => [
917
- b(m(s.pattern), 1)
1088
+ f(m(i.pattern), 1)
918
1089
  ]),
919
1090
  _: 2
920
1091
  }, 1024),
921
- s.is_loop ? (w(), W(e(J), {
1092
+ i.is_loop ? (x(), U(e(F), {
922
1093
  key: 0,
923
1094
  type: "warning"
924
1095
  }, {
925
1096
  default: t(() => [
926
- b(m(e(l)("page.loop")), 1)
1097
+ f(m(e(a)("page.loop")), 1)
927
1098
  ]),
928
1099
  _: 1
929
- })) : j("", !0)
1100
+ })) : R("", !0)
930
1101
  ]),
931
- "cell-target": t(({ row: s }) => [
932
- a(e(R), {
1102
+ "cell-target": t(({ row: i }) => [
1103
+ l(e(L), {
933
1104
  mono: "",
934
1105
  size: "sm"
935
1106
  }, {
936
1107
  default: t(() => [
937
- b(m(s.target), 1)
1108
+ f(m(i.target), 1)
938
1109
  ]),
939
1110
  _: 2
940
1111
  }, 1024)
941
1112
  ]),
942
- "cell-last_hit_at": t(({ row: s }) => [
943
- a(e(R), {
1113
+ "cell-last_hit_at": t(({ row: i }) => [
1114
+ l(e(L), {
944
1115
  size: "sm",
945
- tone: s.last_hit_at ? "default" : "muted"
1116
+ tone: i.last_hit_at ? "default" : "muted"
946
1117
  }, {
947
1118
  default: t(() => [
948
- b(m(s.last_hit_at ? new Date(s.last_hit_at).toLocaleString() : e(l)("page.never")), 1)
1119
+ f(m(i.last_hit_at ? new Date(i.last_hit_at).toLocaleString() : e(a)("page.never")), 1)
949
1120
  ]),
950
1121
  _: 2
951
1122
  }, 1032, ["tone"])
952
1123
  ]),
953
- "cell-is_active": t(({ row: s }) => [
954
- a(e(J), {
955
- type: s.is_active ? "success" : "default",
1124
+ "cell-is_active": t(({ row: i }) => [
1125
+ l(e(F), {
1126
+ type: i.is_active ? "success" : "default",
956
1127
  dot: ""
957
1128
  }, {
958
1129
  default: t(() => [
959
- b(m(s.is_active ? e(l)("page.active") : e(l)("page.inactive")), 1)
1130
+ f(m(i.is_active ? e(a)("page.active") : e(a)("page.inactive")), 1)
960
1131
  ]),
961
1132
  _: 2
962
1133
  }, 1032, ["type"])
963
1134
  ]),
964
- "card-actions": t(({ row: s }) => [
965
- e(y) ? (w(), W(e(ae), {
1135
+ "card-actions": t(({ row: i }) => [
1136
+ e(w) ? (x(), U(e(le), {
966
1137
  key: 0,
967
1138
  size: "sm",
968
- onClick: v[1] || (v[1] = Z(() => {
1139
+ onClick: y[1] || (y[1] = te(() => {
969
1140
  }, ["stop"]))
970
1141
  }, {
971
1142
  default: t(() => [
972
- a(e(le), {
1143
+ l(e(se), {
973
1144
  type: "remove",
974
- title: e(l)("page.delete"),
975
- onClick: (r) => D(s)
1145
+ title: e(a)("page.delete"),
1146
+ onClick: (u) => O(i)
976
1147
  }, null, 8, ["title", "onClick"])
977
1148
  ]),
978
1149
  _: 2
979
- }, 1024)) : j("", !0)
1150
+ }, 1024)) : R("", !0)
980
1151
  ]),
981
- "cell-actions": t(({ row: s }) => [
982
- a(e(ae), {
1152
+ "cell-actions": t(({ row: i }) => [
1153
+ l(e(le), {
983
1154
  size: "sm",
984
- onClick: v[2] || (v[2] = Z(() => {
1155
+ onClick: y[2] || (y[2] = te(() => {
985
1156
  }, ["stop"]))
986
1157
  }, {
987
1158
  default: t(() => [
988
- a(e(le), {
1159
+ l(e(se), {
989
1160
  type: "remove",
990
- title: e(l)("page.delete"),
991
- onClick: (r) => D(s)
1161
+ title: e(a)("page.delete"),
1162
+ onClick: (u) => O(i)
992
1163
  }, null, 8, ["title", "onClick"])
993
1164
  ]),
994
1165
  _: 2
@@ -999,16 +1170,16 @@ const dt = { class: "wx-seo-redirect" }, rt = { class: "wx-seo-redirect__row" },
999
1170
  ]),
1000
1171
  _: 2
1001
1172
  }, [
1002
- e(y) ? {
1173
+ e(w) ? {
1003
1174
  name: "extra",
1004
1175
  fn: t(() => [
1005
- a(e(A), {
1176
+ l(e(N), {
1006
1177
  type: "primary",
1007
1178
  icon: "add",
1008
- onClick: v[0] || (v[0] = (s) => T(null))
1179
+ onClick: y[0] || (y[0] = (i) => k(null))
1009
1180
  }, {
1010
1181
  default: t(() => [
1011
- b(m(e(l)("page.new-redirect")), 1)
1182
+ f(m(e(a)("page.new-redirect")), 1)
1012
1183
  ]),
1013
1184
  _: 1
1014
1185
  })
@@ -1032,96 +1203,96 @@ const dt = { class: "wx-seo-redirect" }, rt = { class: "wx-seo-redirect__row" },
1032
1203
  "robots",
1033
1204
  "json_ld"
1034
1205
  ];
1035
- function me(n, u) {
1036
- return he(n.title, u);
1206
+ function be(o, r) {
1207
+ return xe(o.title, r);
1037
1208
  }
1038
- function bt(n) {
1039
- if (!n) return {};
1040
- const u = {};
1041
- for (const i of $e) {
1042
- const c = n[i];
1043
- c != null && Object.assign(u, { [i]: c });
1209
+ function xt(o) {
1210
+ if (!o) return {};
1211
+ const r = {};
1212
+ for (const d of $e) {
1213
+ const c = o[d];
1214
+ c != null && Object.assign(r, { [d]: c });
1044
1215
  }
1045
- return u;
1216
+ return r;
1046
1217
  }
1047
- function yt(n, u) {
1048
- const i = { ...n };
1218
+ function wt(o, r) {
1219
+ const d = { ...o };
1049
1220
  for (const c of $e)
1050
- Object.assign(i, { [c]: u[c] ?? null });
1051
- return i;
1221
+ Object.assign(d, { [c]: r[c] ?? null });
1222
+ return d;
1052
1223
  }
1053
- const _t = { class: "wx-seo-rule" }, xt = { class: "wx-seo-rule__where" }, wt = /* @__PURE__ */ F({
1224
+ const kt = { class: "wx-seo-rule" }, Vt = { class: "wx-seo-rule__where" }, $t = /* @__PURE__ */ M({
1054
1225
  __name: "SeoUrlDialog",
1055
1226
  props: {
1056
1227
  rule: { default: null },
1057
1228
  mediaField: { default: void 0 }
1058
1229
  },
1059
- setup(n) {
1060
- const u = n, { resolve: i, dismiss: c, open: l } = ie(), d = P(), h = G(d);
1061
- E();
1062
- const o = M("webx-seo"), y = z(!1), k = z({}), p = z({
1230
+ setup(o) {
1231
+ const r = o, { resolve: d, dismiss: c, open: a } = de(), n = E(), h = Q(n);
1232
+ H();
1233
+ const s = K("webx-seo"), w = z(!1), V = z({}), v = z({
1063
1234
  match_type: "exact",
1064
1235
  pattern: "",
1065
1236
  priority: 0,
1066
1237
  is_active: !0
1067
- }), _ = z({}), g = S(() => u.rule !== null), T = S(() => [
1068
- { value: "exact", label: o("page.exact") },
1069
- { value: "mask", label: o("page.mask") },
1070
- { value: "regex", label: o("page.regex") }
1238
+ }), p = z({}), b = C(() => r.rule !== null), k = C(() => [
1239
+ { value: "exact", label: s("page.exact") },
1240
+ { value: "mask", label: s("page.mask") },
1241
+ { value: "regex", label: s("page.regex") }
1071
1242
  ]);
1072
- ge(
1073
- () => u.rule,
1074
- (v) => {
1075
- p.value = {
1076
- match_type: v?.match_type ?? "exact",
1077
- pattern: v?.pattern ?? "",
1078
- priority: v?.priority ?? 0,
1079
- is_active: v?.is_active ?? !0
1080
- }, _.value = bt(v), k.value = {};
1243
+ ye(
1244
+ () => r.rule,
1245
+ (y) => {
1246
+ v.value = {
1247
+ match_type: y?.match_type ?? "exact",
1248
+ pattern: y?.pattern ?? "",
1249
+ priority: y?.priority ?? 0,
1250
+ is_active: y?.is_active ?? !0
1251
+ }, p.value = xt(y), V.value = {};
1081
1252
  },
1082
1253
  { immediate: !0 }
1083
1254
  );
1084
- function D(v) {
1085
- return k.value[v]?.[0];
1255
+ function O(y) {
1256
+ return V.value[y]?.[0];
1086
1257
  }
1087
- async function $() {
1088
- y.value = !0, k.value = {};
1089
- const v = yt(p.value, _.value);
1258
+ async function S() {
1259
+ w.value = !0, V.value = {};
1260
+ const y = wt(v.value, p.value);
1090
1261
  try {
1091
- const s = u.rule ? await h.updateUrl(u.rule.id, v) : await h.createUrl(v);
1092
- B.success(o("page.saved")), i(s);
1093
- } catch (s) {
1094
- const r = s.body;
1095
- r?.errors ? (k.value = r.errors, B.danger(o("page.failed"))) : B.danger(r?.message ?? o("page.failed"));
1262
+ const i = r.rule ? await h.updateUrl(r.rule.id, y) : await h.createUrl(y);
1263
+ B.success(s("page.saved")), d(i);
1264
+ } catch (i) {
1265
+ const u = i.body;
1266
+ u?.errors ? (V.value = u.errors, B.danger(s("page.failed"))) : B.danger(u?.message ?? s("page.failed"));
1096
1267
  } finally {
1097
- y.value = !1;
1268
+ w.value = !1;
1098
1269
  }
1099
1270
  }
1100
- return (v, s) => (w(), W(e(de), {
1101
- open: e(l),
1102
- "onUpdate:open": s[6] || (s[6] = (r) => I(l) ? l.value = r : null),
1103
- title: e(o)("page.rule"),
1271
+ return (y, i) => (x(), U(e(re), {
1272
+ open: e(a),
1273
+ "onUpdate:open": i[6] || (i[6] = (u) => P(a) ? a.value = u : null),
1274
+ title: e(s)("page.rule"),
1104
1275
  width: 860
1105
1276
  }, {
1106
1277
  footer: t(() => [
1107
- a(e(H), { size: "sm" }, {
1278
+ l(e(G), { size: "sm" }, {
1108
1279
  default: t(() => [
1109
- a(e(A), {
1280
+ l(e(N), {
1110
1281
  variant: "outline",
1111
- onClick: s[5] || (s[5] = (r) => e(c)())
1282
+ onClick: i[5] || (i[5] = (u) => e(c)())
1112
1283
  }, {
1113
1284
  default: t(() => [
1114
- b(m(e(o)("page.cancel")), 1)
1285
+ f(m(e(s)("page.cancel")), 1)
1115
1286
  ]),
1116
1287
  _: 1
1117
1288
  }),
1118
- a(e(A), {
1289
+ l(e(N), {
1119
1290
  type: "primary",
1120
- loading: y.value,
1121
- onClick: $
1291
+ loading: w.value,
1292
+ onClick: S
1122
1293
  }, {
1123
1294
  default: t(() => [
1124
- b(m(g.value ? e(o)("page.save") : e(o)("page.new-rule")), 1)
1295
+ f(m(b.value ? e(s)("page.save") : e(s)("page.new-rule")), 1)
1125
1296
  ]),
1126
1297
  _: 1
1127
1298
  }, 8, ["loading"])
@@ -1130,243 +1301,243 @@ const _t = { class: "wx-seo-rule" }, xt = { class: "wx-seo-rule__where" }, wt =
1130
1301
  })
1131
1302
  ]),
1132
1303
  default: t(() => [
1133
- O("div", _t, [
1134
- O("div", xt, [
1135
- a(e(U), {
1136
- label: e(o)("page.kind")
1304
+ A("div", kt, [
1305
+ A("div", Vt, [
1306
+ l(e(T), {
1307
+ label: e(s)("page.kind")
1137
1308
  }, {
1138
1309
  default: t(() => [
1139
- a(e(ee), {
1140
- modelValue: p.value.match_type,
1141
- "onUpdate:modelValue": s[0] || (s[0] = (r) => p.value.match_type = r),
1142
- options: T.value
1310
+ l(e(ae), {
1311
+ modelValue: v.value.match_type,
1312
+ "onUpdate:modelValue": i[0] || (i[0] = (u) => v.value.match_type = u),
1313
+ options: k.value
1143
1314
  }, null, 8, ["modelValue", "options"])
1144
1315
  ]),
1145
1316
  _: 1
1146
1317
  }, 8, ["label"]),
1147
- a(e(U), {
1148
- label: e(o)("page.address"),
1149
- help: e(o)("page.address-help"),
1150
- error: D("pattern"),
1318
+ l(e(T), {
1319
+ label: e(s)("page.address"),
1320
+ help: e(s)("page.address-help"),
1321
+ error: O("pattern"),
1151
1322
  class: "wx-seo-rule__address"
1152
1323
  }, {
1153
1324
  default: t(() => [
1154
- a(e(N), {
1155
- modelValue: p.value.pattern,
1156
- "onUpdate:modelValue": s[1] || (s[1] = (r) => p.value.pattern = r),
1325
+ l(e(I), {
1326
+ modelValue: v.value.pattern,
1327
+ "onUpdate:modelValue": i[1] || (i[1] = (u) => v.value.pattern = u),
1157
1328
  placeholder: "/catalog/shoes"
1158
1329
  }, null, 8, ["modelValue"])
1159
1330
  ]),
1160
1331
  _: 1
1161
1332
  }, 8, ["label", "help", "error"]),
1162
- a(e(U), {
1163
- label: e(o)("page.priority"),
1164
- help: e(o)("page.priority-help")
1333
+ l(e(T), {
1334
+ label: e(s)("page.priority"),
1335
+ help: e(s)("page.priority-help")
1165
1336
  }, {
1166
1337
  default: t(() => [
1167
- a(e(Me), {
1168
- modelValue: p.value.priority,
1169
- "onUpdate:modelValue": s[2] || (s[2] = (r) => p.value.priority = r),
1338
+ l(e(Ee), {
1339
+ modelValue: v.value.priority,
1340
+ "onUpdate:modelValue": i[2] || (i[2] = (u) => v.value.priority = u),
1170
1341
  step: 10
1171
1342
  }, null, 8, ["modelValue"])
1172
1343
  ]),
1173
1344
  _: 1
1174
1345
  }, 8, ["label", "help"]),
1175
- a(e(U), {
1176
- label: e(o)("page.state")
1346
+ l(e(T), {
1347
+ label: e(s)("page.state")
1177
1348
  }, {
1178
1349
  default: t(() => [
1179
- a(e(be), {
1180
- modelValue: p.value.is_active,
1181
- "onUpdate:modelValue": s[3] || (s[3] = (r) => p.value.is_active = r)
1350
+ l(e(we), {
1351
+ modelValue: v.value.is_active,
1352
+ "onUpdate:modelValue": i[3] || (i[3] = (u) => v.value.is_active = u)
1182
1353
  }, null, 8, ["modelValue"])
1183
1354
  ]),
1184
1355
  _: 1
1185
1356
  }, 8, ["label"])
1186
1357
  ]),
1187
- a(we, {
1188
- modelValue: _.value,
1189
- "onUpdate:modelValue": s[4] || (s[4] = (r) => _.value = r),
1190
- "media-field": u.mediaField
1358
+ l(Ve, {
1359
+ modelValue: p.value,
1360
+ "onUpdate:modelValue": i[4] || (i[4] = (u) => p.value = u),
1361
+ "media-field": r.mediaField
1191
1362
  }, null, 8, ["modelValue", "media-field"])
1192
1363
  ])
1193
1364
  ]),
1194
1365
  _: 1
1195
1366
  }, 8, ["open", "title"]));
1196
1367
  }
1197
- }), kt = /* @__PURE__ */ q(wt, [["__scopeId", "data-v-fd7826d1"]]), Vt = /* @__PURE__ */ F({
1368
+ }), St = /* @__PURE__ */ J($t, [["__scopeId", "data-v-fd7826d1"]]), Ct = /* @__PURE__ */ M({
1198
1369
  __name: "SeoUrlsPage",
1199
1370
  props: {
1200
1371
  base: { default: "/seo" },
1201
1372
  mediaField: { default: void 0 }
1202
1373
  },
1203
- setup(n) {
1204
- const u = n, i = P(), c = G(i);
1205
- E();
1206
- const l = M("webx-seo"), d = z(null), h = z(!1), o = z("any");
1207
- let y = { page: 1, perPage: 20, sort: null, search: "" };
1208
- const k = i.can("seo.manage"), p = te(
1209
- kt
1210
- ), _ = te(Ve), g = S(() => [
1211
- { value: "any", label: l("page.any-kind") },
1212
- { value: "exact", label: l("page.exact") },
1213
- { value: "mask", label: l("page.mask") },
1214
- { value: "regex", label: l("page.regex") }
1215
- ]), T = S(() => [
1216
- { key: "pattern", label: l("page.address") },
1217
- { key: "match_type", label: l("page.kind"), hideBelow: 560 },
1218
- { key: "title", label: l("page.title"), hideBelow: 900 },
1219
- { key: "priority", label: l("page.priority"), align: "center", hideBelow: 760 },
1220
- { key: "is_active", label: l("page.state"), align: "center", hideBelow: 660 },
1374
+ setup(o) {
1375
+ const r = o, d = E(), c = Q(d);
1376
+ H();
1377
+ const a = K("webx-seo"), n = z(null), h = z(!1), s = z("any");
1378
+ let w = { page: 1, perPage: 20, sort: null, search: "" };
1379
+ const V = d.can("seo.manage"), v = Y(
1380
+ St
1381
+ ), p = Y(ve), b = C(() => [
1382
+ { value: "any", label: a("page.any-kind") },
1383
+ { value: "exact", label: a("page.exact") },
1384
+ { value: "mask", label: a("page.mask") },
1385
+ { value: "regex", label: a("page.regex") }
1386
+ ]), k = C(() => [
1387
+ { key: "pattern", label: a("page.address") },
1388
+ { key: "match_type", label: a("page.kind"), hideBelow: 560 },
1389
+ { key: "title", label: a("page.title"), hideBelow: 900 },
1390
+ { key: "priority", label: a("page.priority"), align: "center", hideBelow: 760 },
1391
+ { key: "is_active", label: a("page.state"), align: "center", hideBelow: 660 },
1221
1392
  {
1222
1393
  key: "actions",
1223
1394
  label: "",
1224
1395
  width: 56,
1225
1396
  align: "right",
1226
- hidden: !k,
1397
+ hidden: !V,
1227
1398
  hideOnCards: !0
1228
1399
  }
1229
1400
  ]);
1230
- async function D(s) {
1231
- y = s, h.value = !0;
1401
+ async function O(i) {
1402
+ w = i, h.value = !0;
1232
1403
  try {
1233
- d.value = await c.urls({
1234
- q: s.search,
1235
- match_type: o.value === "any" ? null : o.value,
1236
- page: s.page,
1237
- per_page: s.perPage
1404
+ n.value = await c.urls({
1405
+ q: i.search,
1406
+ match_type: s.value === "any" ? null : s.value,
1407
+ page: i.page,
1408
+ per_page: i.perPage
1238
1409
  });
1239
1410
  } finally {
1240
1411
  h.value = !1;
1241
1412
  }
1242
1413
  }
1243
- async function $(s) {
1244
- await p({ rule: s, mediaField: u.mediaField }) && D(y);
1414
+ async function S(i) {
1415
+ await v({ rule: i, mediaField: r.mediaField }) && O(w);
1245
1416
  }
1246
- async function v(s) {
1247
- if (await xe({
1248
- title: l("page.delete-title", { pattern: s.pattern }),
1249
- message: l("page.delete-text"),
1250
- confirmText: l("page.delete"),
1251
- cancelText: l("page.cancel"),
1417
+ async function y(i) {
1418
+ if (await ke({
1419
+ title: a("page.delete-title", { pattern: i.pattern }),
1420
+ message: a("page.delete-text"),
1421
+ confirmText: a("page.delete"),
1422
+ cancelText: a("page.cancel"),
1252
1423
  tone: "danger"
1253
1424
  }))
1254
1425
  try {
1255
- await c.removeUrl(s.id), B.success(l("page.deleted")), D(y);
1256
- } catch (V) {
1257
- B.danger(V.body?.message ?? String(V));
1426
+ await c.removeUrl(i.id), B.success(a("page.deleted")), O(w);
1427
+ } catch (g) {
1428
+ B.danger(g.body?.message ?? String(g));
1258
1429
  }
1259
1430
  }
1260
- return (s, r) => (w(), W(ke, {
1261
- base: u.base,
1431
+ return (i, u) => (x(), U(pe, {
1432
+ base: r.base,
1262
1433
  current: "rules",
1263
- onTest: r[5] || (r[5] = (V) => e(_)({}))
1434
+ onTest: u[5] || (u[5] = (g) => e(p)({}))
1264
1435
  }, {
1265
1436
  default: t(() => [
1266
- a(e(ye), null, fe({
1437
+ l(e(ue), null, _e({
1267
1438
  header: t(() => [
1268
- b(m(e(l)("page.rules")), 1)
1439
+ f(m(e(a)("page.rules")), 1)
1269
1440
  ]),
1270
1441
  default: t(() => [
1271
- a(e(_e), {
1272
- data: d.value,
1273
- columns: T.value,
1442
+ l(e(ce), {
1443
+ data: n.value,
1444
+ columns: k.value,
1274
1445
  "row-key": "id",
1275
1446
  searchable: "",
1276
1447
  hover: "",
1277
1448
  flush: "",
1278
1449
  loading: h.value,
1279
- "search-placeholder": e(l)("page.search-rules"),
1280
- "empty-text": e(l)("page.empty"),
1281
- onStateChange: D,
1282
- onRowClick: r[4] || (r[4] = (V) => e(k) ? $(V) : void 0)
1450
+ "search-placeholder": e(a)("page.search-rules"),
1451
+ "empty-text": e(a)("page.empty"),
1452
+ onStateChange: O,
1453
+ onRowClick: u[4] || (u[4] = (g) => e(V) ? S(g) : void 0)
1283
1454
  }, {
1284
1455
  actions: t(() => [
1285
- a(e(ee), {
1286
- modelValue: o.value,
1287
- "onUpdate:modelValue": r[1] || (r[1] = (V) => o.value = V),
1288
- options: g.value,
1456
+ l(e(ae), {
1457
+ modelValue: s.value,
1458
+ "onUpdate:modelValue": u[1] || (u[1] = (g) => s.value = g),
1459
+ options: b.value,
1289
1460
  class: "wx-seo-urls__kind"
1290
1461
  }, null, 8, ["modelValue", "options"])
1291
1462
  ]),
1292
- "cell-pattern": t(({ row: V }) => [
1293
- a(e(R), {
1463
+ "cell-pattern": t(({ row: g }) => [
1464
+ l(e(L), {
1294
1465
  mono: "",
1295
1466
  size: "sm"
1296
1467
  }, {
1297
1468
  default: t(() => [
1298
- b(m(V.pattern), 1)
1469
+ f(m(g.pattern), 1)
1299
1470
  ]),
1300
1471
  _: 2
1301
1472
  }, 1024)
1302
1473
  ]),
1303
- "cell-match_type": t(({ row: V }) => [
1304
- a(e(J), null, {
1474
+ "cell-match_type": t(({ row: g }) => [
1475
+ l(e(F), null, {
1305
1476
  default: t(() => [
1306
- b(m(e(l)(`page.${V.match_type}`)), 1)
1477
+ f(m(e(a)(`page.${g.match_type}`)), 1)
1307
1478
  ]),
1308
1479
  _: 2
1309
1480
  }, 1024)
1310
1481
  ]),
1311
- "cell-title": t(({ row: V }) => [
1312
- e(me)(V) ? (w(), W(e(R), {
1482
+ "cell-title": t(({ row: g }) => [
1483
+ e(be)(g) ? (x(), U(e(L), {
1313
1484
  key: 0,
1314
1485
  size: "sm"
1315
1486
  }, {
1316
1487
  default: t(() => [
1317
- b(m(e(me)(V)), 1)
1488
+ f(m(e(be)(g)), 1)
1318
1489
  ]),
1319
1490
  _: 2
1320
- }, 1024)) : (w(), W(e(R), {
1491
+ }, 1024)) : (x(), U(e(L), {
1321
1492
  key: 1,
1322
1493
  size: "sm",
1323
1494
  tone: "muted"
1324
1495
  }, {
1325
- default: t(() => [...r[6] || (r[6] = [
1326
- b("—", -1)
1496
+ default: t(() => [...u[6] || (u[6] = [
1497
+ f("—", -1)
1327
1498
  ])]),
1328
1499
  _: 1
1329
1500
  }))
1330
1501
  ]),
1331
- "cell-is_active": t(({ row: V }) => [
1332
- a(e(J), {
1333
- type: V.is_active ? "success" : "default",
1502
+ "cell-is_active": t(({ row: g }) => [
1503
+ l(e(F), {
1504
+ type: g.is_active ? "success" : "default",
1334
1505
  dot: ""
1335
1506
  }, {
1336
1507
  default: t(() => [
1337
- b(m(V.is_active ? e(l)("page.active") : e(l)("page.inactive")), 1)
1508
+ f(m(g.is_active ? e(a)("page.active") : e(a)("page.inactive")), 1)
1338
1509
  ]),
1339
1510
  _: 2
1340
1511
  }, 1032, ["type"])
1341
1512
  ]),
1342
- "card-actions": t(({ row: V }) => [
1343
- e(k) ? (w(), W(e(ae), {
1513
+ "card-actions": t(({ row: g }) => [
1514
+ e(V) ? (x(), U(e(le), {
1344
1515
  key: 0,
1345
1516
  size: "sm",
1346
- onClick: r[2] || (r[2] = Z(() => {
1517
+ onClick: u[2] || (u[2] = te(() => {
1347
1518
  }, ["stop"]))
1348
1519
  }, {
1349
1520
  default: t(() => [
1350
- a(e(le), {
1521
+ l(e(se), {
1351
1522
  type: "remove",
1352
- title: e(l)("page.delete"),
1353
- onClick: (Q) => v(V)
1523
+ title: e(a)("page.delete"),
1524
+ onClick: (D) => y(g)
1354
1525
  }, null, 8, ["title", "onClick"])
1355
1526
  ]),
1356
1527
  _: 2
1357
- }, 1024)) : j("", !0)
1528
+ }, 1024)) : R("", !0)
1358
1529
  ]),
1359
- "cell-actions": t(({ row: V }) => [
1360
- a(e(ae), {
1530
+ "cell-actions": t(({ row: g }) => [
1531
+ l(e(le), {
1361
1532
  size: "sm",
1362
- onClick: r[3] || (r[3] = Z(() => {
1533
+ onClick: u[3] || (u[3] = te(() => {
1363
1534
  }, ["stop"]))
1364
1535
  }, {
1365
1536
  default: t(() => [
1366
- a(e(le), {
1537
+ l(e(se), {
1367
1538
  type: "remove",
1368
- title: e(l)("page.delete"),
1369
- onClick: (Q) => v(V)
1539
+ title: e(a)("page.delete"),
1540
+ onClick: (D) => y(g)
1370
1541
  }, null, 8, ["title", "onClick"])
1371
1542
  ]),
1372
1543
  _: 2
@@ -1377,16 +1548,16 @@ const _t = { class: "wx-seo-rule" }, xt = { class: "wx-seo-rule__where" }, wt =
1377
1548
  ]),
1378
1549
  _: 2
1379
1550
  }, [
1380
- e(k) ? {
1551
+ e(V) ? {
1381
1552
  name: "extra",
1382
1553
  fn: t(() => [
1383
- a(e(A), {
1554
+ l(e(N), {
1384
1555
  type: "primary",
1385
1556
  icon: "add",
1386
- onClick: r[0] || (r[0] = (V) => $(null))
1557
+ onClick: u[0] || (u[0] = (g) => S(null))
1387
1558
  }, {
1388
1559
  default: t(() => [
1389
- b(m(e(l)("page.new-rule")), 1)
1560
+ f(m(e(a)("page.new-rule")), 1)
1390
1561
  ]),
1391
1562
  _: 1
1392
1563
  })
@@ -1398,49 +1569,59 @@ const _t = { class: "wx-seo-rule" }, xt = { class: "wx-seo-rule__where" }, wt =
1398
1569
  _: 1
1399
1570
  }, 8, ["base"]));
1400
1571
  }
1401
- }), $t = /* @__PURE__ */ q(Vt, [["__scopeId", "data-v-d9fce714"]]);
1402
- function zt(n = {}) {
1403
- const u = n.path ?? "/seo", i = n.mediaField ? Oe(n.mediaField) : void 0;
1572
+ }), Ut = /* @__PURE__ */ J(Ct, [["__scopeId", "data-v-d9fce714"]]);
1573
+ function Lt(o = {}) {
1574
+ const r = o.path ?? "/seo", d = o.mediaField ? Le(o.mediaField) : void 0;
1404
1575
  return {
1405
1576
  id: "seo",
1406
- path: u,
1577
+ path: r,
1407
1578
  routes: [
1408
1579
  // The section's own path travels as a prop, so a panel that mounted it somewhere else
1409
1580
  // still links between its two screens correctly.
1410
1581
  {
1411
- path: u,
1582
+ path: r,
1412
1583
  name: "webx.seo",
1413
- component: $t,
1414
- props: { base: u, mediaField: i }
1584
+ component: Ut,
1585
+ props: { base: r, mediaField: d }
1415
1586
  },
1416
1587
  {
1417
- path: `${u}/redirects`,
1588
+ path: `${r}/redirects`,
1418
1589
  name: "webx.seo.redirects",
1419
- component: ht,
1420
- props: { base: u }
1590
+ component: _t,
1591
+ props: { base: r }
1592
+ },
1593
+ // The trail of renames, from `webx-ui/routing`. The screen is here whether or not any
1594
+ // content module has registered a type yet: without one the table is simply empty, and an
1595
+ // empty table is a better answer than a tab that appears one day without explanation.
1596
+ {
1597
+ path: `${r}/aliases`,
1598
+ name: "webx.seo.aliases",
1599
+ component: lt,
1600
+ props: { base: r }
1421
1601
  }
1422
1602
  ],
1423
1603
  // What a screen means by `wx-seo`: everything a page says about itself, as one value. The
1424
1604
  // server registers the same name for what it stores.
1425
1605
  types: {
1426
1606
  "wx-seo": {
1427
- component: we,
1607
+ component: Ve,
1428
1608
  kind: "field",
1429
- bind: () => ({ mediaField: i })
1609
+ bind: () => ({ mediaField: d })
1430
1610
  }
1431
1611
  }
1432
1612
  };
1433
1613
  }
1434
1614
  export {
1435
- we as WxSeo,
1436
- ht as WxSeoRedirectsPage,
1437
- $t as WxSeoUrlsPage,
1438
- G as createSeoApi,
1439
- ne as robotsDirectives,
1440
- yt as ruleInput,
1441
- me as ruleTitle,
1442
- zt as seo,
1443
- He as seoMessages,
1444
- bt as seoOf
1615
+ Ve as WxSeo,
1616
+ lt as WxSeoAliasesPage,
1617
+ _t as WxSeoRedirectsPage,
1618
+ Ut as WxSeoUrlsPage,
1619
+ Q as createSeoApi,
1620
+ ie as robotsDirectives,
1621
+ wt as ruleInput,
1622
+ be as ruleTitle,
1623
+ Lt as seo,
1624
+ Je as seoMessages,
1625
+ xt as seoOf
1445
1626
  };
1446
1627
  //# sourceMappingURL=index.js.map