@webx-ui/module-banners 0.1.12 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,31 +1,223 @@
1
- import { defineComponent as X, computed as $, ref as W, watch as j, onMounted as _e, onBeforeUnmount as Ce, openBlock as m, createElementBlock as M, Fragment as H, createVNode as c, unref as e, withCtx as p, createSlots as xe, createTextVNode as E, toDisplayString as L, createBlock as D, createCommentVNode as A, useTemplateRef as Ne, nextTick as qe, isRef as De, createElementVNode as R, withKeys as ye, normalizeClass as ae, resolveDynamicComponent as Ie, renderList as Oe } from "vue";
2
- import { useRoute as ie, useRouter as ce, onBeforeRouteLeave as Le } from "vue-router";
3
- import { useLocales as $e, localizedValue as Me, confirm as G, WxSkeleton as Q, WxCard as te, WxBadge as ne, WxFormItem as le, WxSelect as Re, WxActionBar as Ue, WxButton as se, toast as T, useModal as ze, WxDialog as Ae, WxInput as he, WxSpace as Ee, WxTooltip as Ke, WxIcon as re, WxSegmented as Fe, WxEmpty as oe, WxSortableList as Je, WxAlert as je, createModal as He, WxListDetail as Ge, WxText as we, WxIndicator as Qe } from "@webx-ui/core";
4
- import { useAdmin as J, useTranslate as Y, useErrorText as ue, useBodyKeys as Xe, WxScreenHead as Pe, WxScreen as Ye, WxSaveState as Ze, WxRowMenu as Be, WxListScreen as ea } from "@webx-ui/module-admin";
5
- function Z(i) {
6
- const s = `${i.apiPath}/banners`, u = (n) => `${s}/places/${encodeURIComponent(n)}`, y = (n) => n.data;
1
+ import { provide as qt, inject as Kt, defineComponent as Ve, computed as y, ref as A, watch as $e, onMounted as nt, onBeforeUnmount as Vt, openBlock as m, createElementBlock as B, Fragment as ne, createVNode as i, unref as e, withCtx as d, createSlots as zt, createTextVNode as F, toDisplayString as N, createBlock as E, createCommentVNode as H, useTemplateRef as Jt, nextTick as jt, isRef as ye, createElementVNode as P, withKeys as ft, normalizeClass as oe, resolveDynamicComponent as St, renderList as ve, normalizeStyle as Oe, reactive as Ht, withModifiers as Ye } from "vue";
2
+ import { useRoute as st, useRouter as ot, onBeforeRouteLeave as Gt } from "vue-router";
3
+ import { useLocales as Je, localizedValue as Zt, confirm as Fe, WxSkeleton as qe, WxCard as Qe, WxBadge as et, WxFormItem as G, WxSelect as fe, WxActionBar as Xt, WxButton as Q, toast as Z, useModal as Yt, WxDialog as Qt, WxInput as Ke, WxSpace as ea, WxTooltip as tt, WxIcon as le, WxSegmented as it, WxEmpty as at, WxSortableList as Ct, WxAlert as ta, createModal as aa, WxListDetail as la, WxText as re, WxIndicator as na, WxTextarea as sa, WxInputNumber as Le, WxSwitch as Me, WxColorPicker as oa } from "@webx-ui/core";
4
+ import { useAdmin as ze, useTranslate as Se, useErrorText as rt, useBodyKeys as ia, WxScreenHead as Bt, WxScreen as ra, WxSaveState as ua, WxRowMenu as Pt, WxListScreen as da, WxLinkField as ca } from "@webx-ui/module-admin";
5
+ import { WxMediaField as ba, createMediaApi as va } from "@webx-ui/module-media";
6
+ function Ue(t) {
7
+ const c = `${t.apiPath}/banners`, o = (s) => `${c}/places/${encodeURIComponent(s)}`, f = (s) => s.data;
7
8
  return {
8
- places: () => i.http.get(`${s}/places`).then(y),
9
- createPlace: (n) => i.http.post(`${s}/places`, n).then(y),
10
- renamePlace: (n, v) => i.http.put(u(n), { title: v }).then(y),
11
- removePlace: (n) => i.http.delete(u(n)).then(() => {
9
+ places: () => t.http.get(`${c}/places`).then(f),
10
+ createPlace: (s) => t.http.post(`${c}/places`, s).then(f),
11
+ renamePlace: (s, $) => t.http.put(o(s), { title: $ }).then(f),
12
+ removePlace: (s) => t.http.delete(o(s)).then(() => {
12
13
  }),
13
- list: (n, v = !1) => i.http.get(`${u(n)}/banners${v ? "?trashed=1" : ""}`).then(y),
14
- get: (n) => i.http.get(`${s}/${n}`).then(y),
15
- create: (n, v) => i.http.post(`${u(n)}/banners`, { values: v }).then(y),
16
- save: (n, v, d) => i.http.put(
17
- `${s}/${n}`,
18
- d === void 0 ? { values: v } : { values: v, place: d }
19
- ).then(y),
20
- remove: (n) => i.http.delete(`${s}/${n}`).then(() => {
14
+ list: (s, $ = !1) => t.http.get(`${o(s)}/banners${$ ? "?trashed=1" : ""}`).then(f),
15
+ get: (s) => t.http.get(`${c}/${s}`).then(f),
16
+ create: (s, $) => t.http.post(`${o(s)}/banners`, { values: $ }).then(f),
17
+ save: (s, $, _) => t.http.put(
18
+ `${c}/${s}`,
19
+ _ === void 0 ? { values: $ } : { values: $, place: _ }
20
+ ).then(f),
21
+ remove: (s) => t.http.delete(`${c}/${s}`).then(() => {
21
22
  }),
22
23
  // The resource of the list line, and not the form's pair: a restored banner stays closed.
23
- restore: (n) => i.http.post(`${s}/${n}/restore`, {}).then(y),
24
- reorder: (n, v) => i.http.post(`${u(n)}/reorder`, { ids: v }).then(() => {
25
- })
24
+ restore: (s) => t.http.post(`${c}/${s}/restore`, {}).then(f),
25
+ reorder: (s, $) => t.http.post(`${o(s)}/reorder`, { ids: $ }).then(() => {
26
+ }),
27
+ theme: () => t.http.get(`${c}/theme`).then(f)
28
+ };
29
+ }
30
+ const Wt = /* @__PURE__ */ Symbol("wx-banner-editor");
31
+ function ma(t) {
32
+ qt(Wt, t);
33
+ }
34
+ function pa() {
35
+ return Kt(Wt, null);
36
+ }
37
+ const Ne = {
38
+ x: [-50, 150, 5],
39
+ y: [-50, 150, 5],
40
+ w: [1, 150, 40],
41
+ size: [0.3, 20, 3],
42
+ pad: [0, 10, 0],
43
+ radius: [0, 50, 0],
44
+ tracking: [-0.2, 1, 0],
45
+ rotate: [-180, 180, 0],
46
+ gap: [0, 10, 1]
47
+ }, ya = ["tl", "t", "tr", "l", "c", "r", "bl", "b", "br"], fa = {
48
+ tl: [0, 0],
49
+ t: [-50, 0],
50
+ tr: [-100, 0],
51
+ l: [0, -50],
52
+ c: [-50, -50],
53
+ r: [-100, -50],
54
+ bl: [0, -100],
55
+ b: [-50, -100],
56
+ br: [-100, -100]
57
+ }, ht = ["fade", "rise", "slide-start", "slide-end", "zoom"], wt = ["spin", "float"], ha = ["title", "text"];
58
+ function he(t = {}) {
59
+ return {
60
+ x: 5,
61
+ y: 5,
62
+ w: 40,
63
+ size: 3,
64
+ pad: 0,
65
+ radius: 0,
66
+ tracking: 0,
67
+ rotate: 0,
68
+ gap: 1,
69
+ origin: "tl",
70
+ hidden: !1,
71
+ ...t
72
+ };
73
+ }
74
+ function Ae(t = {}) {
75
+ return {
76
+ font: null,
77
+ weight: 400,
78
+ italic: !1,
79
+ uppercase: !1,
80
+ align: "start",
81
+ line_height: 1.2,
82
+ color: null,
83
+ background: null,
84
+ opacity: 1,
85
+ shadow: !1,
86
+ ...t
87
+ };
88
+ }
89
+ function Re(t = {}) {
90
+ return { in: null, loop: null, delay: 0, duration: 600, ...t };
91
+ }
92
+ function lt(t) {
93
+ return JSON.parse(JSON.stringify(t));
94
+ }
95
+ function Lt(t = []) {
96
+ const c = new Set(t);
97
+ let o = "";
98
+ do
99
+ o = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
100
+ while (c.has(o) || !/^[a-z0-9]{4,12}$/.test(o));
101
+ return o;
102
+ }
103
+ function gt(t, c, o) {
104
+ const f = { id: Lt(c), type: t, style: Ae(), motion: Re() };
105
+ switch (t) {
106
+ case "text":
107
+ return {
108
+ ...f,
109
+ text: { [o]: "Text" },
110
+ tag: "p",
111
+ frames: { desktop: he({ x: 10, y: 10, size: 2.4 }), mobile: null }
112
+ };
113
+ case "image":
114
+ return {
115
+ ...f,
116
+ image: null,
117
+ frames: { desktop: he({ x: 60, y: 10, w: 20 }), mobile: null }
118
+ };
119
+ case "button":
120
+ return {
121
+ ...f,
122
+ text: { [o]: "Button" },
123
+ link: null,
124
+ variant: null,
125
+ frames: { desktop: he({ x: 10, y: 25, w: 30, size: 1.2 }), mobile: null }
126
+ };
127
+ case "buttons":
128
+ return {
129
+ ...f,
130
+ frames: { desktop: he({ x: 6, y: 27, w: 50, size: 1.2 }), mobile: null }
131
+ };
132
+ }
133
+ }
134
+ function wa(t) {
135
+ const c = [], o = (f) => {
136
+ const s = { ...f, id: Lt(c) };
137
+ return c.push(s.id), s;
26
138
  };
139
+ return [
140
+ o({
141
+ type: "text",
142
+ text: { [t]: "{title}" },
143
+ tag: "h2",
144
+ style: Ae({ weight: 700, line_height: 1.05, color: "#ffffff", shadow: !0 }),
145
+ frames: { desktop: he({ x: 6, y: 6, w: 45, size: 4.2 }), mobile: null },
146
+ motion: Re({ in: "rise" })
147
+ }),
148
+ o({
149
+ type: "text",
150
+ text: { [t]: "{text}" },
151
+ tag: "p",
152
+ style: Ae({ line_height: 1.4, color: "#ffffff", shadow: !0 }),
153
+ frames: { desktop: he({ x: 6, y: 18, w: 40, size: 1.4 }), mobile: null },
154
+ motion: Re({ in: "rise", delay: 150 })
155
+ }),
156
+ o({
157
+ type: "buttons",
158
+ style: Ae(),
159
+ frames: { desktop: he({ x: 6, y: 28, w: 50, size: 1.2 }), mobile: null },
160
+ motion: Re({ in: "rise", delay: 300 })
161
+ })
162
+ ];
163
+ }
164
+ function ga(t, c, o, f) {
165
+ const s = t ?? {};
166
+ return ([.../* @__PURE__ */ new Set([c, ...o, ...Object.keys(s)])].map((h) => s[h]).find((h) => (h ?? "").trim() !== "") ?? "").replaceAll("{title}", f.title ?? "").replaceAll("{text}", f.text ?? "").trim();
167
+ }
168
+ function xa(t) {
169
+ return [...t.matchAll(/\{([a-z_.]+)\}/g)].map((c) => c[1] ?? "").filter((c) => !ha.includes(c));
170
+ }
171
+ function xt(t) {
172
+ if (typeof t != "string") return null;
173
+ if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/.test(t)) return t;
174
+ const c = /^token:([a-z][a-z0-9-]{0,40})$/.exec(t);
175
+ return c ? `var(--site-color-${c[1]})` : null;
176
+ }
177
+ const Ot = (t) => Math.round(t * 100) / 100;
178
+ function ka(t, c) {
179
+ const o = {}, f = t.frames.desktop, s = t.frames.mobile ?? f;
180
+ for (const [h, b] of [
181
+ ["", f],
182
+ ["m-", s]
183
+ ]) {
184
+ for (const g of Object.keys(Ne))
185
+ o[`--${h}${g}`] = String(Ot(b[g]));
186
+ const [v, w] = fa[b.origin] ?? [0, 0];
187
+ o[`--${h}ox`] = `${v}%`, o[`--${h}oy`] = `${w}%`, o[`--${h}display`] = b.hidden ? "none" : "block";
188
+ }
189
+ o["--weight"] = String(t.style.weight), o["--leading"] = String(t.style.line_height), o["--opacity"] = String(t.style.opacity), o["--align"] = t.style.align;
190
+ const $ = xt(t.style.color), _ = xt(t.style.background);
191
+ return $ && (o["--color"] = $), _ && (o["--background"] = _), t.style.font && (o["--font"] = `var(--site-font-${t.style.font})`), o["z-index"] = String(c), o;
192
+ }
193
+ function _a(t) {
194
+ const c = ["webx-banner__layer", `webx-banner__layer--${t.type}`];
195
+ return t.style.italic && c.push("is-italic"), t.style.uppercase && c.push("is-uppercase"), t.style.shadow && c.push("is-shadow"), t.style.background && c.push("has-background"), c;
27
196
  }
28
- const aa = {
197
+ function kt(t, c) {
198
+ if (typeof t == "number") return t > 0 ? t : c;
199
+ const o = /^\s*(\d+(?:\.\d+)?)\s*(?:\/\s*(\d+(?:\.\d+)?))?\s*$/.exec(t ?? "");
200
+ if (!o) return c;
201
+ const f = Number(o[1]) / Number(o[2] ?? 1);
202
+ return Number.isFinite(f) && f > 0 ? f : c;
203
+ }
204
+ function $a(t, c) {
205
+ if (t > c) {
206
+ const f = c / t * 100;
207
+ return { left: (100 - f) / 2, top: 0, width: f, height: 100 };
208
+ }
209
+ const o = t / c * 100;
210
+ return { left: 0, top: (100 - o) / 2, width: 100, height: o };
211
+ }
212
+ function Va(t) {
213
+ const c = { ...t };
214
+ for (const o of Object.keys(Ne)) {
215
+ const [f, s] = Ne[o];
216
+ c[o] = Ot(Math.min(s, Math.max(f, Number(c[o]) || 0)));
217
+ }
218
+ return c;
219
+ }
220
+ const za = {
29
221
  module: {
30
222
  banners: "Banners"
31
223
  },
@@ -108,7 +300,9 @@ const aa = {
108
300
  deleted: "Moved to the bin.",
109
301
  "reorder-failed": "The new order was not saved.",
110
302
  "save-failed": "Not saved.",
111
- cancel: "Cancel"
303
+ cancel: "Cancel",
304
+ previous: "Previous banner",
305
+ next: "Next banner"
112
306
  },
113
307
  screen: {
114
308
  media: "Pictures and video",
@@ -133,47 +327,138 @@ const aa = {
133
327
  "variant-placeholder": "The first one",
134
328
  settings: "Settings",
135
329
  enabled: "On",
136
- "enabled-help": "Only a banner that is on is shown on the site. A new one starts off."
330
+ "enabled-help": "Only a banner that is on is shown on the site. A new one starts off.",
331
+ layers: "Layers",
332
+ "layers-help": "Texts, pictures and buttons placed on the picture. Every size is a percent of the picture’s width, so the banner scales as a whole."
333
+ },
334
+ layers: {
335
+ text: "Text",
336
+ image: "Picture",
337
+ button: "Button",
338
+ "title-layer": "Banner title",
339
+ "text-layer": "Banner text",
340
+ "buttons-layer": "Banner buttons",
341
+ desktop: "Computer",
342
+ mobile: "Phone",
343
+ layout: "Layout",
344
+ undo: "Undo (Ctrl+Z)",
345
+ redo: "Redo (Ctrl+Shift+Z)",
346
+ "not-here": "This place does not print layers: they are kept, but the site does not show them.",
347
+ canvas: "Banner canvas",
348
+ "no-picture": "Choose a picture above",
349
+ hint: "Click to select, drag to move, the handles resize. Arrows move by 0.05 (with Shift by 0.5), Delete removes, Ctrl+D duplicates, Ctrl+Z undoes. Alt while dragging: no snapping. The shade is what the frame of the place crops away.",
350
+ empty: "No layers yet",
351
+ list: "Layers",
352
+ outside: "Outside the frame: not seen on the site",
353
+ show: "Show on this layout",
354
+ hide: "Hide on this layout",
355
+ delete: "Delete",
356
+ choose: "Select a layer on the picture or in the list.",
357
+ name: "Name in the list",
358
+ label: "Label",
359
+ words: "Words",
360
+ "falls-back": "Empty here: the site shows the words in :code.",
361
+ "words-help": "Empty in a language — the default language is shown. {title} and {text} put in the banner’s fields.",
362
+ "unknown-field": "Not a field of the banner: :fields. Fields are {title} and {text}.",
363
+ tag: "Tag",
364
+ link: "Link",
365
+ variant: "Look",
366
+ "buttons-help": "The buttons of the banner, in a row. Edit them in “Buttons” below.",
367
+ "geometry-desktop": "Position on a computer",
368
+ "geometry-mobile-own": "Position on a phone",
369
+ "geometry-mobile-same": "Position on a phone — as on a computer",
370
+ "same-as-desktop": "As on a computer",
371
+ unit: "In percent of the picture’s width.",
372
+ x: "x (from the left)",
373
+ y: "y (from the top)",
374
+ w: "Width",
375
+ size: "Font size",
376
+ pad: "Padding",
377
+ radius: "Rounding",
378
+ tracking: "Letter spacing, em",
379
+ rotate: "Rotation, °",
380
+ gap: "Gap",
381
+ origin: "Anchor",
382
+ "origin-help": "Which point of the layer stands at x and y: longer words grow away from it.",
383
+ "hidden-here": "Hidden on this layout",
384
+ look: "Look",
385
+ font: "Font",
386
+ "font-site": "As on the site",
387
+ "font-heading": "Headings",
388
+ "font-body": "Body text",
389
+ weight: "Weight",
390
+ "line-height": "Line height",
391
+ opacity: "Opacity",
392
+ align: "Alignment",
393
+ "align-start": "Start",
394
+ "align-center": "Centre",
395
+ "align-end": "End",
396
+ italic: "Italic",
397
+ uppercase: "Capitals",
398
+ shadow: "Shadow",
399
+ color: "Colour",
400
+ background: "Background",
401
+ motion: "Motion",
402
+ entrance: "Entrance",
403
+ loop: "Loop",
404
+ delay: "Delay, ms",
405
+ duration: "Duration, ms",
406
+ "motion-none": "None",
407
+ "in-fade": "Fade in",
408
+ "in-rise": "Rise",
409
+ "in-slide-start": "From the start",
410
+ "in-slide-end": "From the end",
411
+ "in-zoom": "Zoom",
412
+ "loop-spin": "Spin",
413
+ "loop-float": "Float"
137
414
  }
138
- }, ge = /* @__PURE__ */ new WeakSet();
139
- function ee() {
415
+ }, _t = /* @__PURE__ */ new WeakSet();
416
+ function Te() {
140
417
  try {
141
- const { i18n: i } = J();
142
- ge.has(i) || (i.defaults("webx-banners", aa), ge.add(i));
418
+ const { i18n: t } = ze();
419
+ _t.has(t) || (t.defaults("webx-banners", za), _t.add(t));
143
420
  } catch {
144
421
  }
145
422
  }
146
- const ta = /* @__PURE__ */ X({
423
+ const Sa = /* @__PURE__ */ Ve({
147
424
  name: "WxBannerEditorPage",
148
425
  __name: "BannerEditorPage",
149
426
  props: {
150
427
  base: { default: "/banners" }
151
428
  },
152
- setup(i) {
153
- const s = i, u = J(), y = Z(u), n = ie(), v = ce(), d = $e();
154
- ee();
155
- const l = Y("webx-banners"), t = ue(), P = $(() => {
156
- const a = n.params.id;
429
+ setup(t) {
430
+ const c = t, o = ze(), f = Ue(o), s = st(), $ = ot(), _ = Je();
431
+ Te();
432
+ const h = Se("webx-banners"), b = rt(), v = y(() => {
433
+ const a = s.params.id;
157
434
  return typeof a == "string" && a !== "" ? Number(a) : null;
158
- }), b = W(null), g = W({}), S = W(""), h = W(null), k = W(null), O = W([]), C = W(!0), B = W(!1), w = W({}), x = $(() => u.can("banners.manage")), N = $(() => JSON.stringify(g.value)), U = $(
159
- () => S.value !== "" && (N.value !== S.value || h.value !== k.value)
160
- ), K = $(() => B.value ? "saving" : U.value || P.value === null ? "unsaved" : "saved"), F = $(() => {
161
- const a = g.value.title, q = P.value === null ? l("banner.new") : b.value?.title ?? "";
162
- return Me(a, d.active.value, q) || l("banner.untitled");
163
- }), r = $(() => {
164
- const a = k.value ?? h.value;
165
- return a === null ? s.base : `${s.base}?place=${encodeURIComponent(a)}`;
166
- }), I = $(
167
- () => u.state.manifest?.modules.find((a) => a.id === "banners")?.title ?? l("module.banners")
168
- ), f = $(
169
- () => O.value.map((a) => ({ value: a.key, label: `${a.title} · ${a.key}` }))
170
- ), o = $({
171
- get: () => h.value,
435
+ }), w = A(null), g = A({}), T = A(""), V = A(null), W = A(null), K = A([]), J = A(!0), U = A(!1), C = A({}), L = y(() => o.can("banners.manage")), R = y(() => JSON.stringify(g.value)), X = y(
436
+ () => T.value !== "" && (R.value !== T.value || V.value !== W.value)
437
+ ), ee = y(() => U.value ? "saving" : X.value || v.value === null ? "unsaved" : "saved"), se = y(() => {
438
+ const a = g.value.title, n = v.value === null ? h("banner.new") : w.value?.title ?? "";
439
+ return Zt(a, _.active.value, n) || h("banner.untitled");
440
+ }), k = y(() => {
441
+ const a = W.value ?? V.value;
442
+ return a === null ? c.base : `${c.base}?place=${encodeURIComponent(a)}`;
443
+ }), q = y(
444
+ () => o.state.manifest?.modules.find((a) => a.id === "banners")?.title ?? h("module.banners")
445
+ ), z = y(() => K.value.find((a) => a.key === V.value) ?? null);
446
+ ma({ values: g, place: z });
447
+ const S = y(
448
+ () => z.value?.layers ? [] : [{ op: "remove", target: "layers-card" }]
449
+ );
450
+ function M(a) {
451
+ return !z.value?.layers || a.layers !== null && a.layers !== void 0 ? a : { ...a, layers: wa(_.list.value[0]?.code ?? _.active.value) };
452
+ }
453
+ const D = y(
454
+ () => K.value.map((a) => ({ value: a.key, label: `${a.title} · ${a.key}` }))
455
+ ), we = y({
456
+ get: () => V.value,
172
457
  set: (a) => {
173
- h.value = a == null ? null : String(a);
458
+ V.value = a == null ? null : String(a);
174
459
  }
175
460
  });
176
- function V() {
461
+ function Ce() {
177
462
  return {
178
463
  image: null,
179
464
  image_mobile: null,
@@ -181,127 +466,134 @@ const ta = /* @__PURE__ */ X({
181
466
  title: {},
182
467
  text: {},
183
468
  buttons: [],
469
+ layers: null,
184
470
  enabled: !1
185
471
  };
186
472
  }
187
- function _(a) {
188
- b.value = a.banner, g.value = a.values, S.value = JSON.stringify(a.values), h.value = a.banner.place, k.value = a.banner.place;
473
+ function ge(a) {
474
+ w.value = a.banner, V.value = a.banner.place, W.value = a.banner.place;
475
+ const n = M(a.values);
476
+ g.value = n, T.value = JSON.stringify(n);
189
477
  }
190
- async function pe() {
191
- C.value = !0;
478
+ async function me() {
479
+ J.value = !0;
192
480
  try {
193
- const [a, q] = await Promise.all([
194
- y.places(),
195
- P.value === null ? Promise.resolve(null) : y.get(P.value)
481
+ const [a, n] = await Promise.all([
482
+ f.places(),
483
+ v.value === null ? Promise.resolve(null) : f.get(v.value)
196
484
  ]);
197
- if (O.value = a, q !== null)
198
- _(q);
485
+ if (K.value = a, n !== null)
486
+ ge(n);
199
487
  else {
200
- const z = n.query.place, Se = typeof z == "string" && a.some((Ve) => Ve.key === z) ? z : null, me = V();
201
- b.value = null, g.value = me, S.value = JSON.stringify(me), h.value = Se ?? a[0]?.key ?? null, k.value = h.value;
488
+ const I = s.query.place, ue = typeof I == "string" && a.some((je) => je.key === I) ? I : null;
489
+ w.value = null, V.value = ue ?? a[0]?.key ?? null, W.value = V.value;
490
+ const De = M(Ce());
491
+ g.value = De, T.value = JSON.stringify(De);
202
492
  }
203
493
  } catch (a) {
204
- T.danger(t(a)), v.push(s.base);
494
+ Z.danger(b(a)), $.push(c.base);
205
495
  } finally {
206
- C.value = !1;
496
+ J.value = !1;
207
497
  }
208
498
  }
209
- async function ve() {
210
- if (!(B.value || !x.value || h.value === null)) {
211
- B.value = !0, w.value = {};
499
+ async function ie() {
500
+ if (!(U.value || !L.value || V.value === null)) {
501
+ U.value = !0, C.value = {};
212
502
  try {
213
- const a = P.value === null, q = a ? await y.create(h.value, g.value) : await y.save(
214
- P.value,
503
+ const a = v.value === null, n = a ? await f.create(V.value, g.value) : await f.save(
504
+ v.value,
215
505
  g.value,
216
- h.value !== k.value ? h.value : void 0
506
+ V.value !== W.value ? V.value : void 0
217
507
  );
218
- _(q), T.success(l("banner.saved")), a && v.replace(`${s.base}/${q.banner.id}`);
508
+ ge(n), Z.success(h("banner.saved")), a && $.replace(`${c.base}/${n.banner.id}`);
219
509
  } catch (a) {
220
- const q = a.body;
221
- q?.errors ? (w.value = q.errors, T.danger(l("banner.save-failed"))) : T.danger(t(a));
510
+ const n = a.body;
511
+ n?.errors ? (C.value = n.errors, Z.danger(h("banner.save-failed"))) : Z.danger(b(a));
222
512
  } finally {
223
- B.value = !1;
513
+ U.value = !1;
224
514
  }
225
515
  }
226
516
  }
227
- async function We() {
228
- const a = b.value;
229
- if (!(!a || !await G({
230
- title: l("banner.delete-title", { name: a.title }),
231
- message: l("banner.delete-text"),
232
- confirmText: l("banner.delete"),
233
- cancelText: l("banner.cancel"),
517
+ async function de() {
518
+ const a = w.value;
519
+ if (!(!a || !await Fe({
520
+ title: h("banner.delete-title", { name: a.title }),
521
+ message: h("banner.delete-text"),
522
+ confirmText: h("banner.delete"),
523
+ cancelText: h("banner.cancel"),
234
524
  tone: "danger"
235
525
  })))
236
526
  try {
237
- await y.remove(a.id), T.success(l("banner.deleted")), S.value = N.value, h.value = k.value, v.push(r.value);
238
- } catch (z) {
239
- T.danger(t(z));
527
+ await f.remove(a.id), Z.success(h("banner.deleted")), T.value = R.value, V.value = W.value, $.push(k.value);
528
+ } catch (I) {
529
+ Z.danger(b(I));
240
530
  }
241
531
  }
242
- function be(a) {
243
- U.value && a.preventDefault();
244
- }
245
- function fe(a) {
246
- (a.ctrlKey || a.metaKey) && a.key.toLowerCase() === "s" && (a.preventDefault(), (U.value || P.value === null) && ve());
247
- }
248
- Xe(fe), j(P, (a) => {
249
- a !== null && b.value?.id === a || pe();
250
- }), _e(() => {
251
- pe(), window.addEventListener("beforeunload", be);
252
- }), Ce(() => {
253
- window.removeEventListener("beforeunload", be);
254
- }), Le(async () => !U.value || !x.value ? !0 : await G({
255
- title: l("banner.leave-title"),
256
- message: l("banner.leave-text"),
257
- confirmText: l("banner.leave"),
258
- cancelText: l("banner.cancel"),
532
+ function xe(a) {
533
+ X.value && a.preventDefault();
534
+ }
535
+ function ce(a) {
536
+ (a.ctrlKey || a.metaKey) && a.key.toLowerCase() === "s" && (a.preventDefault(), (X.value || v.value === null) && ie());
537
+ }
538
+ ia(ce), $e(V, () => {
539
+ J.value || (g.value = M(g.value));
540
+ }), $e(v, (a) => {
541
+ a !== null && w.value?.id === a || me();
542
+ }), nt(() => {
543
+ me(), window.addEventListener("beforeunload", xe);
544
+ }), Vt(() => {
545
+ window.removeEventListener("beforeunload", xe);
546
+ }), Gt(async () => !X.value || !L.value ? !0 : await Fe({
547
+ title: h("banner.leave-title"),
548
+ message: h("banner.leave-text"),
549
+ confirmText: h("banner.leave"),
550
+ cancelText: h("banner.cancel"),
259
551
  tone: "danger"
260
552
  }));
261
- const Te = $(
262
- () => x.value && b.value !== null ? [
553
+ const p = y(
554
+ () => L.value && w.value !== null ? [
263
555
  {
264
556
  key: "delete",
265
- label: l("banner.delete"),
557
+ label: h("banner.delete"),
266
558
  icon: "trash",
267
559
  danger: !0,
268
560
  menu: !0,
269
561
  run: () => {
270
- We();
562
+ de();
271
563
  }
272
564
  }
273
565
  ] : []
274
566
  );
275
- return (a, q) => (m(), M("div", {
567
+ return (a, n) => (m(), B("div", {
276
568
  class: "wx-banner-editor",
277
- onKeydown: fe
569
+ onKeydown: ce
278
570
  }, [
279
- C.value ? (m(), M(H, { key: 0 }, [
280
- c(e(Q), {
571
+ J.value ? (m(), B(ne, { key: 0 }, [
572
+ i(e(qe), {
281
573
  class: "wx-banner-editor__ghost",
282
574
  title: "",
283
575
  rows: 1
284
576
  }),
285
- c(e(te), null, {
286
- default: p(() => [
287
- c(e(Q), { rows: 6 })
577
+ i(e(Qe), null, {
578
+ default: d(() => [
579
+ i(e(qe), { rows: 6 })
288
580
  ]),
289
581
  _: 1
290
582
  })
291
- ], 64)) : (m(), M(H, { key: 1 }, [
292
- c(e(Pe), {
583
+ ], 64)) : (m(), B(ne, { key: 1 }, [
584
+ i(e(Bt), {
293
585
  divider: "",
294
- back: r.value,
295
- "back-label": I.value,
296
- title: F.value,
297
- actions: Te.value
298
- }, xe({ _: 2 }, [
299
- b.value && !b.value.enabled ? {
586
+ back: k.value,
587
+ "back-label": q.value,
588
+ title: se.value,
589
+ actions: p.value
590
+ }, zt({ _: 2 }, [
591
+ w.value && !w.value.enabled ? {
300
592
  name: "title-after",
301
- fn: p(() => [
302
- c(e(ne), { dot: "" }, {
303
- default: p(() => [
304
- E(L(e(l)("banner.disabled")), 1)
593
+ fn: d(() => [
594
+ i(e(et), { dot: "" }, {
595
+ default: d(() => [
596
+ F(N(e(h)("banner.disabled")), 1)
305
597
  ]),
306
598
  _: 1
307
599
  })
@@ -309,21 +601,21 @@ const ta = /* @__PURE__ */ X({
309
601
  key: "0"
310
602
  } : void 0
311
603
  ]), 1032, ["back", "back-label", "title", "actions"]),
312
- c(e(te), { class: "wx-banner-editor__place" }, {
313
- default: p(() => [
314
- c(e(le), {
315
- label: e(l)("banner.place"),
316
- help: P.value === null ? void 0 : e(l)("banner.place-help"),
317
- error: w.value.place?.[0],
604
+ i(e(Qe), { class: "wx-banner-editor__place" }, {
605
+ default: d(() => [
606
+ i(e(G), {
607
+ label: e(h)("banner.place"),
608
+ help: v.value === null ? void 0 : e(h)("banner.place-help"),
609
+ error: C.value.place?.[0],
318
610
  required: ""
319
611
  }, {
320
- default: p(() => [
321
- c(e(Re), {
322
- modelValue: o.value,
323
- "onUpdate:modelValue": q[0] || (q[0] = (z) => o.value = z),
324
- options: f.value,
325
- disabled: !x.value || B.value,
326
- "aria-label": e(l)("banner.place")
612
+ default: d(() => [
613
+ i(e(fe), {
614
+ modelValue: we.value,
615
+ "onUpdate:modelValue": n[0] || (n[0] = (I) => we.value = I),
616
+ options: D.value,
617
+ disabled: !L.value || U.value,
618
+ "aria-label": e(h)("banner.place")
327
619
  }, null, 8, ["modelValue", "options", "disabled", "aria-label"])
328
620
  ]),
329
621
  _: 1
@@ -331,107 +623,108 @@ const ta = /* @__PURE__ */ X({
331
623
  ]),
332
624
  _: 1
333
625
  }),
334
- c(e(Ye), {
626
+ i(e(ra), {
335
627
  modelValue: g.value,
336
- "onUpdate:modelValue": q[1] || (q[1] = (z) => g.value = z),
628
+ "onUpdate:modelValue": n[1] || (n[1] = (I) => g.value = I),
337
629
  name: "banners.form",
338
- errors: w.value,
339
- disabled: !x.value || B.value
340
- }, null, 8, ["modelValue", "errors", "disabled"]),
341
- x.value ? (m(), D(e(Ue), { key: 0 }, {
342
- state: p(() => [
343
- c(e(Ze), { state: K.value }, null, 8, ["state"])
630
+ patch: S.value,
631
+ errors: C.value,
632
+ disabled: !L.value || U.value
633
+ }, null, 8, ["modelValue", "patch", "errors", "disabled"]),
634
+ L.value ? (m(), E(e(Xt), { key: 0 }, {
635
+ state: d(() => [
636
+ i(e(ua), { state: ee.value }, null, 8, ["state"])
344
637
  ]),
345
- default: p(() => [
346
- c(e(se), {
638
+ default: d(() => [
639
+ i(e(Q), {
347
640
  type: "primary",
348
- loading: B.value,
349
- disabled: !U.value && P.value !== null || h.value === null,
350
- onClick: ve
641
+ loading: U.value,
642
+ disabled: !X.value && v.value !== null || V.value === null,
643
+ onClick: ie
351
644
  }, {
352
- default: p(() => [
353
- E(L(e(l)("banner.save")), 1)
645
+ default: d(() => [
646
+ F(N(e(h)("banner.save")), 1)
354
647
  ]),
355
648
  _: 1
356
649
  }, 8, ["loading", "disabled"])
357
650
  ]),
358
651
  _: 1
359
- })) : A("", !0)
652
+ })) : H("", !0)
360
653
  ], 64))
361
654
  ], 32));
362
655
  }
363
- }), de = (i, s) => {
364
- const u = i.__vccOpts || i;
365
- for (const [y, n] of s)
366
- u[y] = n;
367
- return u;
368
- }, ke = /* @__PURE__ */ de(ta, [["__scopeId", "data-v-2c21e525"]]), na = /* @__PURE__ */ X({
656
+ }), Ie = (t, c) => {
657
+ const o = t.__vccOpts || t;
658
+ for (const [f, s] of c)
659
+ o[f] = s;
660
+ return o;
661
+ }, $t = /* @__PURE__ */ Ie(Sa, [["__scopeId", "data-v-b6bd4d3f"]]), Ca = /* @__PURE__ */ Ve({
369
662
  name: "WxBannerPlaceDialog",
370
663
  __name: "PlaceDialog",
371
664
  props: {
372
665
  place: { default: null }
373
666
  },
374
- setup(i) {
375
- const s = i, { open: u, resolve: y, dismiss: n } = ze(), v = Z(J()), d = $e();
376
- ee();
377
- const l = Y("webx-banners"), t = s.place !== null;
378
- function P() {
379
- if (s.place === null) return {};
380
- if (s.place.titles) return { ...s.place.titles };
381
- const w = d.list.value[0]?.code;
382
- return w === void 0 ? {} : { [w]: s.place.title };
383
- }
384
- const b = W(s.place?.key ?? ""), g = W(P()), S = W(!1), h = W({}), k = Ne("field");
385
- _e(async () => {
386
- await qe(), k.value?.querySelector("input")?.focus();
667
+ setup(t) {
668
+ const c = t, { open: o, resolve: f, dismiss: s } = Yt(), $ = Ue(ze()), _ = Je();
669
+ Te();
670
+ const h = Se("webx-banners"), b = c.place !== null;
671
+ function v() {
672
+ if (c.place === null) return {};
673
+ if (c.place.titles) return { ...c.place.titles };
674
+ const C = _.list.value[0]?.code;
675
+ return C === void 0 ? {} : { [C]: c.place.title };
676
+ }
677
+ const w = A(c.place?.key ?? ""), g = A(v()), T = A(!1), V = A({}), W = Jt("field");
678
+ nt(async () => {
679
+ await jt(), W.value?.querySelector("input")?.focus();
387
680
  });
388
- function O() {
389
- return Object.values(g.value).some((w) => w.trim() !== "");
681
+ function K() {
682
+ return Object.values(g.value).some((C) => C.trim() !== "");
390
683
  }
391
- function C(w) {
392
- const x = Object.keys(h.value).find((N) => N === w || N.startsWith(`${w}.`));
393
- return x === void 0 ? void 0 : h.value[x]?.[0];
684
+ function J(C) {
685
+ const L = Object.keys(V.value).find((R) => R === C || R.startsWith(`${C}.`));
686
+ return L === void 0 ? void 0 : V.value[L]?.[0];
394
687
  }
395
- async function B() {
396
- if (!(!O() || S.value)) {
397
- S.value = !0, h.value = {};
688
+ async function U() {
689
+ if (!(!K() || T.value)) {
690
+ T.value = !0, V.value = {};
398
691
  try {
399
- y(
400
- t && s.place !== null ? await v.renamePlace(s.place.key, g.value) : await v.createPlace({ key: b.value.trim(), title: g.value })
692
+ f(
693
+ b && c.place !== null ? await $.renamePlace(c.place.key, g.value) : await $.createPlace({ key: w.value.trim(), title: g.value })
401
694
  );
402
- } catch (w) {
403
- h.value = w.body?.errors ?? {};
695
+ } catch (C) {
696
+ V.value = C.body?.errors ?? {};
404
697
  } finally {
405
- S.value = !1;
698
+ T.value = !1;
406
699
  }
407
700
  }
408
701
  }
409
- return (w, x) => (m(), D(e(Ae), {
410
- open: e(u),
411
- "onUpdate:open": x[3] || (x[3] = (N) => De(u) ? u.value = N : null),
412
- title: t ? e(l)("places.rename-title") : e(l)("places.new-title"),
702
+ return (C, L) => (m(), E(e(Qt), {
703
+ open: e(o),
704
+ "onUpdate:open": L[3] || (L[3] = (R) => ye(o) ? o.value = R : null),
705
+ title: b ? e(h)("places.rename-title") : e(h)("places.new-title"),
413
706
  width: 440
414
707
  }, {
415
- footer: p(() => [
416
- c(e(Ee), { size: "sm" }, {
417
- default: p(() => [
418
- c(e(se), {
708
+ footer: d(() => [
709
+ i(e(ea), { size: "sm" }, {
710
+ default: d(() => [
711
+ i(e(Q), {
419
712
  variant: "outline",
420
- onClick: x[2] || (x[2] = (N) => e(n)())
713
+ onClick: L[2] || (L[2] = (R) => e(s)())
421
714
  }, {
422
- default: p(() => [
423
- E(L(e(l)("places.cancel")), 1)
715
+ default: d(() => [
716
+ F(N(e(h)("places.cancel")), 1)
424
717
  ]),
425
718
  _: 1
426
719
  }),
427
- c(e(se), {
720
+ i(e(Q), {
428
721
  type: "primary",
429
- loading: S.value,
430
- disabled: !O() || b.value.trim() === "",
431
- onClick: B
722
+ loading: T.value,
723
+ disabled: !K() || w.value.trim() === "",
724
+ onClick: U
432
725
  }, {
433
- default: p(() => [
434
- E(L(t ? e(l)("places.save") : e(l)("places.create")), 1)
726
+ default: d(() => [
727
+ F(N(b ? e(h)("places.save") : e(h)("places.create")), 1)
435
728
  ]),
436
729
  _: 1
437
730
  }, 8, ["loading", "disabled"])
@@ -439,42 +732,42 @@ const ta = /* @__PURE__ */ X({
439
732
  _: 1
440
733
  })
441
734
  ]),
442
- default: p(() => [
443
- c(e(le), {
444
- label: e(l)("places.field-title"),
445
- error: C("title"),
735
+ default: d(() => [
736
+ i(e(G), {
737
+ label: e(h)("places.field-title"),
738
+ error: J("title"),
446
739
  required: ""
447
740
  }, {
448
- default: p(() => [
449
- R("div", {
741
+ default: d(() => [
742
+ P("div", {
450
743
  ref_key: "field",
451
- ref: k
744
+ ref: W
452
745
  }, [
453
- c(e(he), {
746
+ i(e(Ke), {
454
747
  modelValue: g.value,
455
- "onUpdate:modelValue": x[0] || (x[0] = (N) => g.value = N),
748
+ "onUpdate:modelValue": L[0] || (L[0] = (R) => g.value = R),
456
749
  localized: "",
457
- "aria-label": e(l)("places.field-title"),
458
- onKeyup: ye(B, ["enter"])
750
+ "aria-label": e(h)("places.field-title"),
751
+ onKeyup: ft(U, ["enter"])
459
752
  }, null, 8, ["modelValue", "aria-label"])
460
753
  ], 512)
461
754
  ]),
462
755
  _: 1
463
756
  }, 8, ["label", "error"]),
464
- c(e(le), {
465
- label: e(l)("places.field-key"),
466
- error: C("key"),
467
- help: t ? void 0 : e(l)("places.key-help"),
757
+ i(e(G), {
758
+ label: e(h)("places.field-key"),
759
+ error: J("key"),
760
+ help: b ? void 0 : e(h)("places.key-help"),
468
761
  required: ""
469
762
  }, {
470
- default: p(() => [
471
- c(e(he), {
472
- modelValue: b.value,
473
- "onUpdate:modelValue": x[1] || (x[1] = (N) => b.value = N),
474
- disabled: t,
475
- "aria-label": e(l)("places.field-key"),
763
+ default: d(() => [
764
+ i(e(Ke), {
765
+ modelValue: w.value,
766
+ "onUpdate:modelValue": L[1] || (L[1] = (R) => w.value = R),
767
+ disabled: b,
768
+ "aria-label": e(h)("places.field-key"),
476
769
  autocomplete: "off",
477
- onKeyup: ye(B, ["enter"])
770
+ onKeyup: ft(U, ["enter"])
478
771
  }, null, 8, ["modelValue", "aria-label"])
479
772
  ]),
480
773
  _: 1
@@ -483,13 +776,13 @@ const ta = /* @__PURE__ */ X({
483
776
  _: 1
484
777
  }, 8, ["open", "title"]));
485
778
  }
486
- }), la = { class: "wx-banner-place" }, sa = ["aria-label"], ra = { class: "wx-banner-place__usage" }, oa = {
779
+ }), Ba = { class: "wx-banner-place" }, Pa = ["aria-label"], Wa = { class: "wx-banner-place__usage" }, La = {
487
780
  key: 0,
488
781
  class: "wx-banner-place__layout"
489
- }, ia = { class: "wx-banner-row__thumb" }, ca = ["src"], ua = { class: "wx-banner-row__body" }, da = { class: "wx-banner-row__title" }, pa = {
782
+ }, Oa = { class: "wx-banner-row__thumb" }, Na = ["src"], Ua = { class: "wx-banner-row__body" }, Ta = { class: "wx-banner-row__title" }, Ia = {
490
783
  key: 0,
491
784
  class: "wx-banner-row__facts"
492
- }, va = /* @__PURE__ */ X({
785
+ }, Da = /* @__PURE__ */ Ve({
493
786
  name: "WxBannerPlacePane",
494
787
  __name: "PlacePane",
495
788
  props: {
@@ -498,155 +791,155 @@ const ta = /* @__PURE__ */ X({
498
791
  inline: { type: Boolean, default: !0 }
499
792
  },
500
793
  emits: ["back", "changed"],
501
- setup(i, { emit: s }) {
502
- const u = i, y = s, n = J(), v = Z(n), d = ie(), l = ce();
503
- ee();
504
- const t = Y("webx-banners"), P = ue(), b = W([]), g = W(!0), S = $(() => n.can("banners.manage")), h = $({
505
- get: () => d.query.view === "trashed" ? "trashed" : "live",
506
- set: (o) => {
507
- l.replace({
508
- query: { ...d.query, view: o === "trashed" ? "trashed" : void 0 }
794
+ setup(t, { emit: c }) {
795
+ const o = t, f = c, s = ze(), $ = Ue(s), _ = st(), h = ot();
796
+ Te();
797
+ const b = Se("webx-banners"), v = rt(), w = A([]), g = A(!0), T = y(() => s.can("banners.manage")), V = y({
798
+ get: () => _.query.view === "trashed" ? "trashed" : "live",
799
+ set: (S) => {
800
+ h.replace({
801
+ query: { ..._.query, view: S === "trashed" ? "trashed" : void 0 }
509
802
  });
510
803
  }
511
- }), k = $(() => h.value === "trashed"), O = $(() => [
512
- { value: "live", label: t("banner.all") },
513
- { value: "trashed", label: t("banner.trashed"), icon: "trash" }
514
- ]), C = $(() => S.value && !k.value && b.value.length > 1), B = $(() => ["single", "random", "slider"].includes(u.place.layout) ? t(`places.layout-${u.place.layout}`) : "");
515
- async function w() {
804
+ }), W = y(() => V.value === "trashed"), K = y(() => [
805
+ { value: "live", label: b("banner.all") },
806
+ { value: "trashed", label: b("banner.trashed"), icon: "trash" }
807
+ ]), J = y(() => T.value && !W.value && w.value.length > 1), U = y(() => ["single", "random", "slider"].includes(o.place.layout) ? b(`places.layout-${o.place.layout}`) : "");
808
+ async function C() {
516
809
  g.value = !0;
517
810
  try {
518
- b.value = await v.list(u.place.key, k.value);
519
- } catch (o) {
520
- T.danger(P(o));
811
+ w.value = await $.list(o.place.key, W.value);
812
+ } catch (S) {
813
+ Z.danger(v(S));
521
814
  } finally {
522
815
  g.value = !1;
523
816
  }
524
817
  }
525
- j(k, () => {
526
- w();
527
- }), w();
528
- function x(o) {
529
- return `${u.base}/${o.id}`;
818
+ $e(W, () => {
819
+ C();
820
+ }), C();
821
+ function L(S) {
822
+ return `${o.base}/${S.id}`;
530
823
  }
531
- function N() {
532
- l.push({ path: `${u.base}/new`, query: { place: u.place.key } });
824
+ function R() {
825
+ h.push({ path: `${o.base}/new`, query: { place: o.place.key } });
533
826
  }
534
- async function U() {
827
+ async function X() {
535
828
  try {
536
- await v.reorder(
537
- u.place.key,
538
- b.value.map((o) => o.id)
829
+ await $.reorder(
830
+ o.place.key,
831
+ w.value.map((S) => S.id)
539
832
  );
540
- } catch (o) {
541
- T.danger(P(o, t("banner.reorder-failed"))), await w();
833
+ } catch (S) {
834
+ Z.danger(v(S, b("banner.reorder-failed"))), await C();
542
835
  }
543
836
  }
544
- async function K(o) {
837
+ async function ee(S) {
545
838
  try {
546
- const V = await v.get(o.id);
547
- await v.save(o.id, { ...V.values, enabled: !o.enabled }), T.success(o.enabled ? t("banner.switched-off") : t("banner.switched-on"));
548
- } catch (V) {
549
- T.danger(P(V));
839
+ const M = await $.get(S.id);
840
+ await $.save(S.id, { ...M.values, enabled: !S.enabled }), Z.success(S.enabled ? b("banner.switched-off") : b("banner.switched-on"));
841
+ } catch (M) {
842
+ Z.danger(v(M));
550
843
  } finally {
551
- await w();
844
+ await C();
552
845
  }
553
846
  }
554
- async function F(o) {
555
- if (await G({
556
- title: t("banner.delete-title", { name: o.title }),
557
- message: t("banner.delete-text"),
558
- confirmText: t("banner.delete"),
559
- cancelText: t("banner.cancel"),
847
+ async function se(S) {
848
+ if (await Fe({
849
+ title: b("banner.delete-title", { name: S.title }),
850
+ message: b("banner.delete-text"),
851
+ confirmText: b("banner.delete"),
852
+ cancelText: b("banner.cancel"),
560
853
  tone: "danger"
561
854
  }))
562
855
  try {
563
- await v.remove(o.id), T.success(t("banner.deleted")), y("changed");
564
- } catch (_) {
565
- T.danger(P(_));
856
+ await $.remove(S.id), Z.success(b("banner.deleted")), f("changed");
857
+ } catch (D) {
858
+ Z.danger(v(D));
566
859
  } finally {
567
- await w();
860
+ await C();
568
861
  }
569
862
  }
570
- async function r(o) {
863
+ async function k(S) {
571
864
  try {
572
- await v.restore(o.id), T.success(t("banner.restored")), y("changed");
573
- } catch (V) {
574
- T.danger(P(V));
865
+ await $.restore(S.id), Z.success(b("banner.restored")), f("changed");
866
+ } catch (M) {
867
+ Z.danger(v(M));
575
868
  } finally {
576
- await w();
869
+ await C();
577
870
  }
578
871
  }
579
- function I(o) {
580
- if (k.value)
581
- return S.value ? [
872
+ function q(S) {
873
+ if (W.value)
874
+ return T.value ? [
582
875
  {
583
876
  key: "restore",
584
877
  icon: "refresh",
585
- label: t("banner.restore"),
878
+ label: b("banner.restore"),
586
879
  run: () => {
587
- r(o);
880
+ k(S);
588
881
  }
589
882
  }
590
883
  ] : [];
591
- const V = {
884
+ const M = {
592
885
  key: "open",
593
886
  icon: "edit",
594
- label: t("banner.open"),
887
+ label: b("banner.open"),
595
888
  run: () => {
596
- l.push(x(o));
889
+ h.push(L(S));
597
890
  }
598
891
  };
599
- return S.value ? [
600
- V,
892
+ return T.value ? [
893
+ M,
601
894
  {
602
895
  key: "toggle",
603
- icon: o.enabled ? "eye-off" : "eye",
604
- label: o.enabled ? t("banner.disable") : t("banner.enable"),
896
+ icon: S.enabled ? "eye-off" : "eye",
897
+ label: S.enabled ? b("banner.disable") : b("banner.enable"),
605
898
  run: () => {
606
- K(o);
899
+ ee(S);
607
900
  }
608
901
  },
609
902
  {
610
903
  key: "delete",
611
904
  icon: "trash",
612
- label: t("banner.delete"),
905
+ label: b("banner.delete"),
613
906
  danger: !0,
614
907
  run: () => {
615
- F(o);
908
+ se(S);
616
909
  }
617
910
  }
618
- ] : [V];
911
+ ] : [M];
619
912
  }
620
- const f = $(
621
- () => S.value && !k.value ? [{ key: "new", label: t("banner.new"), icon: "plus", primary: !0, run: N }] : []
913
+ const z = y(
914
+ () => T.value && !W.value ? [{ key: "new", label: b("banner.new"), icon: "plus", primary: !0, run: R }] : []
622
915
  );
623
- return (o, V) => (m(), M("div", la, [
624
- c(e(Pe), {
916
+ return (S, M) => (m(), B("div", Ba, [
917
+ i(e(Bt), {
625
918
  level: 3,
626
- back: !u.inline,
627
- "back-label": e(t)("places.places"),
628
- title: i.place.title,
629
- actions: f.value,
919
+ back: !o.inline,
920
+ "back-label": e(b)("places.places"),
921
+ title: t.place.title,
922
+ actions: z.value,
630
923
  "collapse-below": 420,
631
- onBack: V[0] || (V[0] = (_) => y("back"))
632
- }, xe({ _: 2 }, [
633
- i.place.declared ? {
924
+ onBack: M[0] || (M[0] = (D) => f("back"))
925
+ }, zt({ _: 2 }, [
926
+ t.place.declared ? {
634
927
  name: "title-after",
635
- fn: p(() => [
636
- c(e(Ke), {
637
- content: e(t)("places.declared-help")
928
+ fn: d(() => [
929
+ i(e(tt), {
930
+ content: e(b)("places.declared-help")
638
931
  }, {
639
- default: p(() => [
640
- R("span", {
932
+ default: d(() => [
933
+ P("span", {
641
934
  class: "wx-banner-place__lock",
642
935
  tabindex: "0",
643
- "aria-label": e(t)("places.declared")
936
+ "aria-label": e(b)("places.declared")
644
937
  }, [
645
- c(e(re), {
938
+ i(e(le), {
646
939
  name: "lock",
647
940
  size: "sm"
648
941
  })
649
- ], 8, sa)
942
+ ], 8, Pa)
650
943
  ]),
651
944
  _: 1
652
945
  }, 8, ["content"])
@@ -654,286 +947,287 @@ const ta = /* @__PURE__ */ X({
654
947
  key: "0"
655
948
  } : void 0
656
949
  ]), 1032, ["back", "back-label", "title", "actions"]),
657
- R("p", ra, [
658
- R("span", null, L(e(t)("places.usage")), 1),
659
- R("code", null, "banners('" + L(i.place.key) + "')", 1),
660
- B.value ? (m(), M("span", oa, "· " + L(B.value), 1)) : A("", !0)
950
+ P("p", Wa, [
951
+ P("span", null, N(e(b)("places.usage")), 1),
952
+ P("code", null, "banners('" + N(t.place.key) + "')", 1),
953
+ U.value ? (m(), B("span", La, "· " + N(U.value), 1)) : H("", !0)
661
954
  ]),
662
- c(e(Fe), {
663
- modelValue: h.value,
664
- "onUpdate:modelValue": V[1] || (V[1] = (_) => h.value = _),
955
+ i(e(it), {
956
+ modelValue: V.value,
957
+ "onUpdate:modelValue": M[1] || (M[1] = (D) => V.value = D),
665
958
  class: "wx-banner-place__views",
666
959
  size: "sm",
667
- options: O.value,
668
- "aria-label": e(t)("banner.all")
960
+ options: K.value,
961
+ "aria-label": e(b)("banner.all")
669
962
  }, null, 8, ["modelValue", "options", "aria-label"]),
670
- g.value && b.value.length === 0 ? (m(), D(e(Q), {
963
+ g.value && w.value.length === 0 ? (m(), E(e(qe), {
671
964
  key: 0,
672
965
  rows: 4
673
- })) : b.value.length === 0 ? (m(), D(e(oe), {
966
+ })) : w.value.length === 0 ? (m(), E(e(at), {
674
967
  key: 1,
675
- title: k.value ? e(t)("banner.empty-bin") : e(t)("banner.empty"),
676
- description: k.value ? void 0 : e(t)("banner.empty-help")
677
- }, null, 8, ["title", "description"])) : (m(), M(H, { key: 2 }, [
678
- c(e(Je), {
679
- modelValue: b.value,
680
- "onUpdate:modelValue": V[2] || (V[2] = (_) => b.value = _),
681
- class: ae(["wx-banner-place__list", { "is-loading": g.value }]),
968
+ title: W.value ? e(b)("banner.empty-bin") : e(b)("banner.empty"),
969
+ description: W.value ? void 0 : e(b)("banner.empty-help")
970
+ }, null, 8, ["title", "description"])) : (m(), B(ne, { key: 2 }, [
971
+ i(e(Ct), {
972
+ modelValue: w.value,
973
+ "onUpdate:modelValue": M[2] || (M[2] = (D) => w.value = D),
974
+ class: oe(["wx-banner-place__list", { "is-loading": g.value }]),
975
+ hoverable: "",
682
976
  plain: "",
683
977
  "item-key": "id",
684
- handle: C.value ? "grip" : "row",
685
- "item-label": (_) => _.title,
686
- disabled: !C.value,
687
- onMove: U
978
+ handle: J.value ? "grip" : "row",
979
+ "item-label": (D) => D.title,
980
+ disabled: !J.value,
981
+ onMove: X
688
982
  }, {
689
- default: p(({ item: _ }) => [
690
- (m(), D(Ie(k.value ? "div" : "router-link"), {
691
- to: k.value ? void 0 : x(_),
692
- class: ae(["wx-banner-row", { "is-off": !_.enabled && !k.value }])
983
+ default: d(({ item: D }) => [
984
+ (m(), E(St(W.value ? "div" : "router-link"), {
985
+ to: W.value ? void 0 : L(D),
986
+ class: oe(["wx-banner-row", { "is-off": !D.enabled && !W.value }])
693
987
  }, {
694
- default: p(() => [
695
- R("span", ia, [
696
- _.thumb ? (m(), M("img", {
988
+ default: d(() => [
989
+ P("span", Oa, [
990
+ D.thumb ? (m(), B("img", {
697
991
  key: 0,
698
- src: _.thumb,
992
+ src: D.thumb,
699
993
  alt: "",
700
994
  loading: "lazy"
701
- }, null, 8, ca)) : (m(), D(e(re), {
995
+ }, null, 8, Na)) : (m(), E(e(le), {
702
996
  key: 1,
703
997
  name: "image",
704
998
  size: "sm",
705
- "aria-label": e(t)("banner.no-picture")
999
+ "aria-label": e(b)("banner.no-picture")
706
1000
  }, null, 8, ["aria-label"]))
707
1001
  ]),
708
- R("span", ua, [
709
- R("span", da, L(_.title), 1),
710
- _.video || !_.enabled && !k.value ? (m(), M("span", pa, [
711
- _.video ? (m(), D(e(ne), {
1002
+ P("span", Ua, [
1003
+ P("span", Ta, N(D.title), 1),
1004
+ D.video || !D.enabled && !W.value ? (m(), B("span", Ia, [
1005
+ D.video ? (m(), E(e(et), {
712
1006
  key: 0,
713
1007
  size: "sm",
714
1008
  type: "info"
715
1009
  }, {
716
- default: p(() => [
717
- E(L(e(t)("banner.video")), 1)
1010
+ default: d(() => [
1011
+ F(N(e(b)("banner.video")), 1)
718
1012
  ]),
719
1013
  _: 1
720
- })) : A("", !0),
721
- !_.enabled && !k.value ? (m(), D(e(ne), {
1014
+ })) : H("", !0),
1015
+ !D.enabled && !W.value ? (m(), E(e(et), {
722
1016
  key: 1,
723
1017
  dot: "",
724
1018
  size: "sm"
725
1019
  }, {
726
- default: p(() => [
727
- E(L(e(t)("banner.disabled")), 1)
1020
+ default: d(() => [
1021
+ F(N(e(b)("banner.disabled")), 1)
728
1022
  ]),
729
1023
  _: 1
730
- })) : A("", !0)
731
- ])) : A("", !0)
1024
+ })) : H("", !0)
1025
+ ])) : H("", !0)
732
1026
  ])
733
1027
  ]),
734
1028
  _: 2
735
1029
  }, 1032, ["to", "class"]))
736
1030
  ]),
737
- actions: p(({ item: _ }) => [
738
- c(e(Be), {
739
- actions: I(_),
740
- label: _.title
1031
+ actions: d(({ item: D }) => [
1032
+ i(e(Pt), {
1033
+ actions: q(D),
1034
+ label: D.title
741
1035
  }, null, 8, ["actions", "label"])
742
1036
  ]),
743
1037
  _: 1
744
1038
  }, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
745
- C.value ? (m(), D(e(je), {
1039
+ J.value ? (m(), E(e(ta), {
746
1040
  key: 0,
747
1041
  class: "wx-banner-place__note",
748
1042
  type: "info",
749
- description: e(t)("banner.order")
750
- }, null, 8, ["description"])) : A("", !0)
1043
+ description: e(b)("banner.order")
1044
+ }, null, 8, ["description"])) : H("", !0)
751
1045
  ], 64))
752
1046
  ]));
753
1047
  }
754
- }), ba = /* @__PURE__ */ de(va, [["__scopeId", "data-v-23c95ae5"]]), fa = {
1048
+ }), Ea = /* @__PURE__ */ Ie(Da, [["__scopeId", "data-v-48d645bf"]]), Ma = {
755
1049
  key: 2,
756
1050
  class: "wx-banners__list"
757
- }, ma = ["onClick"], ya = { class: "wx-banners__name" }, ha = /* @__PURE__ */ X({
1051
+ }, Aa = ["onClick"], Ra = { class: "wx-banners__name" }, Fa = /* @__PURE__ */ Ve({
758
1052
  __name: "BannersPage",
759
1053
  props: {
760
1054
  base: { default: "/banners" }
761
1055
  },
762
- setup(i) {
763
- const s = i, u = J(), y = Z(u), n = ie(), v = ce();
764
- ee();
765
- const d = Y("webx-banners"), l = ue(), t = W([]), P = W(!0), b = W(!1), g = W(!0), S = $(() => u.can("banners.manage")), h = He(na), k = $(
766
- () => u.state.manifest?.modules.find((r) => r.id === "banners")?.title ?? d("module.banners")
767
- ), O = $(() => {
768
- const r = n.query.place;
769
- return typeof r == "string" && r !== "" ? r : null;
770
- }), C = $(() => t.value.find((r) => r.key === O.value) ?? null);
771
- async function B() {
772
- P.value = !0;
1056
+ setup(t) {
1057
+ const c = t, o = ze(), f = Ue(o), s = st(), $ = ot();
1058
+ Te();
1059
+ const _ = Se("webx-banners"), h = rt(), b = A([]), v = A(!0), w = A(!1), g = A(!0), T = y(() => o.can("banners.manage")), V = aa(Ca), W = y(
1060
+ () => o.state.manifest?.modules.find((k) => k.id === "banners")?.title ?? _("module.banners")
1061
+ ), K = y(() => {
1062
+ const k = s.query.place;
1063
+ return typeof k == "string" && k !== "" ? k : null;
1064
+ }), J = y(() => b.value.find((k) => k.key === K.value) ?? null);
1065
+ async function U() {
1066
+ v.value = !0;
773
1067
  try {
774
- t.value = await y.places();
775
- } catch (r) {
776
- T.danger(l(r));
1068
+ b.value = await f.places();
1069
+ } catch (k) {
1070
+ Z.danger(h(k));
777
1071
  } finally {
778
- P.value = !1;
1072
+ v.value = !1;
779
1073
  }
780
1074
  }
781
- B(), j([t, C, g], () => {
782
- !g.value || t.value.length === 0 || C.value !== null || v.replace({ query: { ...n.query, place: t.value[0].key } });
783
- }), j(C, (r) => {
784
- r !== null && g.value && (b.value = !0);
785
- }), O.value !== null && (b.value = !0);
786
- function w(r) {
787
- const I = { ...n.query, place: r.key };
788
- delete I.view, v.replace({ query: I }), b.value = !0;
789
- }
790
- async function x() {
791
- const r = await h({ place: null });
792
- r && (T.success(d("places.created")), await B(), w(r));
793
- }
794
- async function N(r) {
795
- await h({ place: r }) && (T.success(d("places.renamed")), await B());
796
- }
797
- async function U(r) {
798
- if (await G({
799
- title: d("places.delete-title", { place: r.title }),
800
- message: d("places.delete-text"),
801
- confirmText: d("places.delete"),
802
- cancelText: d("places.cancel"),
1075
+ U(), $e([b, J, g], () => {
1076
+ !g.value || b.value.length === 0 || J.value !== null || $.replace({ query: { ...s.query, place: b.value[0].key } });
1077
+ }), $e(J, (k) => {
1078
+ k !== null && g.value && (w.value = !0);
1079
+ }), K.value !== null && (w.value = !0);
1080
+ function C(k) {
1081
+ const q = { ...s.query, place: k.key };
1082
+ delete q.view, $.replace({ query: q }), w.value = !0;
1083
+ }
1084
+ async function L() {
1085
+ const k = await V({ place: null });
1086
+ k && (Z.success(_("places.created")), await U(), C(k));
1087
+ }
1088
+ async function R(k) {
1089
+ await V({ place: k }) && (Z.success(_("places.renamed")), await U());
1090
+ }
1091
+ async function X(k) {
1092
+ if (await Fe({
1093
+ title: _("places.delete-title", { place: k.title }),
1094
+ message: _("places.delete-text"),
1095
+ confirmText: _("places.delete"),
1096
+ cancelText: _("places.cancel"),
803
1097
  tone: "danger"
804
1098
  }))
805
1099
  try {
806
- if (await y.removePlace(r.key), T.success(d("places.deleted")), O.value === r.key) {
807
- const f = { ...n.query };
808
- delete f.place, delete f.view, v.replace({ query: f }), b.value = !1;
1100
+ if (await f.removePlace(k.key), Z.success(_("places.deleted")), K.value === k.key) {
1101
+ const z = { ...s.query };
1102
+ delete z.place, delete z.view, $.replace({ query: z }), w.value = !1;
809
1103
  }
810
- } catch (f) {
811
- T.danger(l(f));
1104
+ } catch (z) {
1105
+ Z.danger(h(z));
812
1106
  } finally {
813
- await B();
1107
+ await U();
814
1108
  }
815
1109
  }
816
- function K(r) {
817
- return !S.value || r.declared ? [] : [
818
- { key: "rename", icon: "edit", label: d("places.rename"), run: () => {
819
- N(r);
1110
+ function ee(k) {
1111
+ return !T.value || k.declared ? [] : [
1112
+ { key: "rename", icon: "edit", label: _("places.rename"), run: () => {
1113
+ R(k);
820
1114
  } },
821
1115
  {
822
1116
  key: "delete",
823
1117
  icon: "trash",
824
1118
  // Said in the line itself, since a switched-off line cannot carry a tooltip: an empty
825
1119
  // place is the only kind that goes (decision 1).
826
- label: r.count > 0 ? d("places.delete-empty-first") : d("places.delete"),
1120
+ label: k.count > 0 ? _("places.delete-empty-first") : _("places.delete"),
827
1121
  danger: !0,
828
- disabled: r.count > 0,
1122
+ disabled: k.count > 0,
829
1123
  run: () => {
830
- U(r);
1124
+ X(k);
831
1125
  }
832
1126
  }
833
1127
  ];
834
1128
  }
835
- const F = $(
836
- () => S.value ? [{ key: "new-place", label: d("places.new"), icon: "plus", run: () => {
837
- x();
1129
+ const se = y(
1130
+ () => T.value ? [{ key: "new-place", label: _("places.new"), icon: "plus", run: () => {
1131
+ L();
838
1132
  } }] : []
839
1133
  );
840
- return (r, I) => (m(), D(e(ea), {
841
- title: k.value,
842
- actions: F.value,
1134
+ return (k, q) => (m(), E(e(da), {
1135
+ title: W.value,
1136
+ actions: se.value,
843
1137
  card: !1
844
1138
  }, {
845
- default: p(() => [
846
- c(e(te), {
1139
+ default: d(() => [
1140
+ i(e(Qe), {
847
1141
  class: "wx-banners",
848
1142
  padding: "none"
849
1143
  }, {
850
- default: p(() => [
851
- c(e(Ge), {
852
- open: b.value,
853
- "onUpdate:open": I[0] || (I[0] = (f) => b.value = f),
1144
+ default: d(() => [
1145
+ i(e(la), {
1146
+ open: w.value,
1147
+ "onUpdate:open": q[0] || (q[0] = (z) => w.value = z),
854
1148
  class: "wx-banners__panes",
855
1149
  "list-width": 300,
856
1150
  "detail-min": 440,
857
- "detail-label": e(d)("places.places"),
858
- onDetailInline: I[1] || (I[1] = (f) => g.value = f)
1151
+ "detail-label": e(_)("places.places"),
1152
+ onDetailInline: q[1] || (q[1] = (z) => g.value = z)
859
1153
  }, {
860
- list: p(() => [
861
- P.value && t.value.length === 0 ? (m(), D(e(Q), {
1154
+ list: d(() => [
1155
+ v.value && b.value.length === 0 ? (m(), E(e(qe), {
862
1156
  key: 0,
863
1157
  class: "wx-banners__loading",
864
1158
  rows: 3
865
- })) : t.value.length === 0 ? (m(), D(e(oe), {
1159
+ })) : b.value.length === 0 ? (m(), E(e(at), {
866
1160
  key: 1,
867
- title: e(d)("places.empty"),
868
- description: e(d)("places.empty-help")
869
- }, null, 8, ["title", "description"])) : (m(), M("ul", fa, [
870
- (m(!0), M(H, null, Oe(t.value, (f) => (m(), M("li", {
871
- key: f.key,
1161
+ title: e(_)("places.empty"),
1162
+ description: e(_)("places.empty-help")
1163
+ }, null, 8, ["title", "description"])) : (m(), B("ul", Ma, [
1164
+ (m(!0), B(ne, null, ve(b.value, (z) => (m(), B("li", {
1165
+ key: z.key,
872
1166
  class: "wx-banners__row"
873
1167
  }, [
874
- R("button", {
1168
+ P("button", {
875
1169
  type: "button",
876
- class: ae(["wx-banners__open", { "is-current": f.key === O.value }]),
877
- onClick: (o) => w(f)
1170
+ class: oe(["wx-banners__open", { "is-current": z.key === K.value }]),
1171
+ onClick: (S) => C(z)
878
1172
  }, [
879
- R("span", ya, [
880
- c(e(we), {
1173
+ P("span", Ra, [
1174
+ i(e(re), {
881
1175
  truncate: "",
882
1176
  weight: "medium"
883
1177
  }, {
884
- default: p(() => [
885
- E(L(f.title), 1)
1178
+ default: d(() => [
1179
+ F(N(z.title), 1)
886
1180
  ]),
887
1181
  _: 2
888
1182
  }, 1024),
889
- f.declared ? (m(), D(e(re), {
1183
+ z.declared ? (m(), E(e(le), {
890
1184
  key: 0,
891
1185
  class: "wx-banners__lock",
892
1186
  name: "lock",
893
1187
  size: "sm",
894
- "aria-label": e(d)("places.declared")
895
- }, null, 8, ["aria-label"])) : A("", !0),
896
- c(e(Qe), {
1188
+ "aria-label": e(_)("places.declared")
1189
+ }, null, 8, ["aria-label"])) : H("", !0),
1190
+ i(e(na), {
897
1191
  class: "wx-banners__count",
898
1192
  type: "neutral",
899
- value: f.count,
900
- label: e(d)("places.count")
1193
+ value: z.count,
1194
+ label: e(_)("places.count")
901
1195
  }, null, 8, ["value", "label"])
902
1196
  ]),
903
- c(e(we), {
1197
+ i(e(re), {
904
1198
  size: "sm",
905
1199
  tone: "muted",
906
1200
  mono: "",
907
1201
  truncate: ""
908
1202
  }, {
909
- default: p(() => [
910
- E("banners('" + L(f.key) + "')", 1)
1203
+ default: d(() => [
1204
+ F("banners('" + N(z.key) + "')", 1)
911
1205
  ]),
912
1206
  _: 2
913
1207
  }, 1024)
914
- ], 10, ma),
915
- K(f).length > 0 ? (m(), D(e(Be), {
1208
+ ], 10, Aa),
1209
+ ee(z).length > 0 ? (m(), E(e(Pt), {
916
1210
  key: 0,
917
- actions: K(f),
918
- label: f.title
919
- }, null, 8, ["actions", "label"])) : A("", !0)
1211
+ actions: ee(z),
1212
+ label: z.title
1213
+ }, null, 8, ["actions", "label"])) : H("", !0)
920
1214
  ]))), 128))
921
1215
  ]))
922
1216
  ]),
923
- detail: p(({ inline: f, back: o }) => [
924
- C.value ? (m(), D(ba, {
925
- key: C.value.key,
926
- place: C.value,
927
- base: s.base,
928
- inline: f,
929
- onBack: o,
930
- onChanged: B
931
- }, null, 8, ["place", "base", "inline", "onBack"])) : A("", !0)
1217
+ detail: d(({ inline: z, back: S }) => [
1218
+ J.value ? (m(), E(Ea, {
1219
+ key: J.value.key,
1220
+ place: J.value,
1221
+ base: c.base,
1222
+ inline: z,
1223
+ onBack: S,
1224
+ onChanged: U
1225
+ }, null, 8, ["place", "base", "inline", "onBack"])) : H("", !0)
932
1226
  ]),
933
- empty: p(() => [
934
- c(e(oe), {
935
- title: e(d)("places.choose"),
936
- description: e(d)("places.choose-help")
1227
+ empty: d(() => [
1228
+ i(e(at), {
1229
+ title: e(_)("places.choose"),
1230
+ description: e(_)("places.choose-help")
937
1231
  }, null, 8, ["title", "description"])
938
1232
  ]),
939
1233
  _: 1
@@ -945,36 +1239,1249 @@ const ta = /* @__PURE__ */ X({
945
1239
  _: 1
946
1240
  }, 8, ["title", "actions"]));
947
1241
  }
948
- }), wa = /* @__PURE__ */ de(ha, [["__scopeId", "data-v-615232f0"]]);
949
- function $a(i = {}) {
950
- const s = i.path ?? "/banners";
1242
+ }), qa = /* @__PURE__ */ Ie(Fa, [["__scopeId", "data-v-615232f0"]]), Ka = { class: "wx-banner-layer-inspector" }, Ja = { class: "wx-banner-layer-inspector__head" }, ja = { class: "wx-banner-layer-inspector__fields" }, Ha = { class: "wx-banner-layer-inspector__group" }, Ga = { class: "wx-banner-layer-inspector__title" }, Za = { class: "wx-banner-layer-inspector__grid" }, Xa = ["aria-label"], Ya = ["aria-checked", "aria-label", "disabled", "onClick"], Qa = {
1243
+ key: 5,
1244
+ class: "wx-banner-layer-inspector__group"
1245
+ }, el = { class: "wx-banner-layer-inspector__grid" }, tl = { class: "wx-banner-layer-inspector__switches" }, al = { class: "wx-banner-layer-inspector__color" }, ll = ["title", "aria-label", "disabled", "onClick"], nl = { class: "wx-banner-layer-inspector__group" }, sl = { class: "wx-banner-layer-inspector__grid" }, ol = /* @__PURE__ */ Ve({
1246
+ name: "WxBannerLayerInspector",
1247
+ __name: "LayerInspector",
1248
+ props: {
1249
+ layer: {},
1250
+ view: {},
1251
+ tags: {},
1252
+ variants: {},
1253
+ palette: {},
1254
+ disabled: { type: Boolean }
1255
+ },
1256
+ emits: ["update", "frame", "same-as-desktop", "delete"],
1257
+ setup(t, { emit: c }) {
1258
+ const o = t, f = c, s = Se("webx-banners"), $ = Je(), _ = y(
1259
+ () => o.view === "mobile" ? o.layer.frames.mobile ?? o.layer.frames.desktop : o.layer.frames.desktop
1260
+ ), h = y(() => o.view === "mobile" && o.layer.frames.mobile !== null);
1261
+ function b(p) {
1262
+ const a = lt(o.layer);
1263
+ p(a), f("update", a);
1264
+ }
1265
+ function v(p, a) {
1266
+ b((n) => {
1267
+ n.style[p] = a;
1268
+ });
1269
+ }
1270
+ const w = y(() => o.layer.type === "text" || o.layer.type === "button"), g = y({
1271
+ get: () => o.layer.text ?? {},
1272
+ set: (p) => b((a) => {
1273
+ a.text = p;
1274
+ })
1275
+ }), T = y({
1276
+ get: () => o.layer.name ?? "",
1277
+ set: (p) => b((a) => {
1278
+ a.name = p;
1279
+ })
1280
+ }), V = y(() => xa(g.value[$.active.value] ?? "")), W = y(() => V.value.map((p) => `{${p}}`).join(", ")), K = y(() => {
1281
+ const p = g.value, a = $.active.value;
1282
+ return (p[a] ?? "").trim() !== "" ? null : [...$.list.value.map((n) => n.code), ...Object.keys(p)].find(
1283
+ (n) => (p[n] ?? "").trim() !== ""
1284
+ ) ?? null;
1285
+ });
1286
+ function J(p) {
1287
+ const a = $.active.value, n = g.value[a] ?? "";
1288
+ g.value = { ...g.value, [a]: `${n}${n === "" ? "" : " "}{${p}}` };
1289
+ }
1290
+ const U = y({
1291
+ get: () => o.layer.image ?? null,
1292
+ set: (p) => b((a) => {
1293
+ a.image = p;
1294
+ })
1295
+ }), C = y({
1296
+ get: () => o.layer.link ?? null,
1297
+ set: (p) => b((a) => {
1298
+ a.link = p;
1299
+ })
1300
+ }), L = (p, a) => y({
1301
+ get: () => p(),
1302
+ set: (n) => a(n)
1303
+ }), R = L(
1304
+ () => o.layer.tag ?? "p",
1305
+ (p) => b((a) => {
1306
+ a.tag = p;
1307
+ })
1308
+ ), X = L(
1309
+ () => o.layer.variant ?? o.variants[0]?.value ?? null,
1310
+ (p) => b((a) => {
1311
+ a.variant = p;
1312
+ })
1313
+ ), ee = L(
1314
+ () => o.layer.style.font ?? "site",
1315
+ (p) => v("font", p === "heading" || p === "body" ? p : null)
1316
+ ), se = L(
1317
+ () => o.layer.style.weight,
1318
+ (p) => v("weight", Number(p))
1319
+ ), k = y({
1320
+ get: () => o.layer.style.align,
1321
+ set: (p) => v("align", p)
1322
+ }), q = L(
1323
+ () => o.layer.motion.in ?? "none",
1324
+ (p) => b((a) => {
1325
+ a.motion.in = ht.includes(p) ? p : null;
1326
+ })
1327
+ ), z = L(
1328
+ () => o.layer.motion.loop ?? "none",
1329
+ (p) => b((a) => {
1330
+ a.motion.loop = wt.includes(p) ? p : null;
1331
+ })
1332
+ ), S = y(() => {
1333
+ switch (o.layer.type) {
1334
+ case "image":
1335
+ return ["x", "y", "w", "radius", "rotate"];
1336
+ case "buttons":
1337
+ return ["x", "y", "w", "size", "gap", "rotate"];
1338
+ default:
1339
+ return ["x", "y", "w", "size", "pad", "radius", "tracking", "rotate"];
1340
+ }
1341
+ }), M = {
1342
+ x: 0.05,
1343
+ y: 0.05,
1344
+ w: 0.5,
1345
+ size: 0.05,
1346
+ pad: 0.05,
1347
+ radius: 0.1,
1348
+ tracking: 0.01,
1349
+ rotate: 1,
1350
+ gap: 0.1
1351
+ };
1352
+ function D(p, a) {
1353
+ a === null || Number.isNaN(a) || f("frame", { [p]: a });
1354
+ }
1355
+ function we(p) {
1356
+ f("frame", { origin: p });
1357
+ }
1358
+ const Ce = y(() => [
1359
+ { value: "site", label: s("layers.font-site") },
1360
+ { value: "heading", label: s("layers.font-heading") },
1361
+ { value: "body", label: s("layers.font-body") }
1362
+ ]), ge = [100, 200, 300, 400, 500, 600, 700, 800, 900].map((p) => ({
1363
+ value: p,
1364
+ label: String(p)
1365
+ })), me = y(() => [
1366
+ { value: "start", label: s("layers.align-start") },
1367
+ { value: "center", label: s("layers.align-center") },
1368
+ { value: "end", label: s("layers.align-end") }
1369
+ ]), ie = y(() => [
1370
+ { value: "none", label: s("layers.motion-none") },
1371
+ ...ht.map((p) => ({ value: p, label: s(`layers.in-${p}`) }))
1372
+ ]), de = y(() => [
1373
+ { value: "none", label: s("layers.motion-none") },
1374
+ ...wt.map((p) => ({ value: p, label: s(`layers.loop-${p}`) }))
1375
+ ]);
1376
+ function xe(p) {
1377
+ const a = o.layer.style[p];
1378
+ return a === null ? null : a.startsWith("token:") ? o.palette.find((n) => `token:${n.key}` === a)?.value ?? null : a;
1379
+ }
1380
+ function ce(p, a) {
1381
+ const n = typeof a == "string" && /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(a) ? a.toLowerCase() : null;
1382
+ v(p, n);
1383
+ }
1384
+ return (p, a) => (m(), B("div", Ka, [
1385
+ P("div", Ja, [
1386
+ i(e(Ke), {
1387
+ modelValue: T.value,
1388
+ "onUpdate:modelValue": a[0] || (a[0] = (n) => T.value = n),
1389
+ size: "sm",
1390
+ placeholder: e(s)("layers.name"),
1391
+ "aria-label": e(s)("layers.name"),
1392
+ disabled: t.disabled
1393
+ }, null, 8, ["modelValue", "placeholder", "aria-label", "disabled"]),
1394
+ i(e(Q), {
1395
+ size: "sm",
1396
+ variant: "outline",
1397
+ danger: "",
1398
+ disabled: t.disabled,
1399
+ onClick: a[1] || (a[1] = (n) => f("delete"))
1400
+ }, {
1401
+ icon: d(() => [
1402
+ i(e(le), { name: "trash" })
1403
+ ]),
1404
+ default: d(() => [
1405
+ F(" " + N(e(s)("layers.delete")), 1)
1406
+ ]),
1407
+ _: 1
1408
+ }, 8, ["disabled"])
1409
+ ]),
1410
+ w.value ? (m(), B(ne, { key: 0 }, [
1411
+ i(e(G), {
1412
+ label: t.layer.type === "button" ? e(s)("layers.label") : e(s)("layers.words"),
1413
+ help: K.value ? e(s)("layers.falls-back", { code: K.value.toUpperCase() }) : e(s)("layers.words-help")
1414
+ }, {
1415
+ default: d(() => [
1416
+ t.layer.type === "text" ? (m(), E(e(sa), {
1417
+ key: 0,
1418
+ modelValue: g.value,
1419
+ "onUpdate:modelValue": a[2] || (a[2] = (n) => g.value = n),
1420
+ localized: "",
1421
+ rows: 2,
1422
+ disabled: t.disabled
1423
+ }, null, 8, ["modelValue", "disabled"])) : (m(), E(e(Ke), {
1424
+ key: 1,
1425
+ modelValue: g.value,
1426
+ "onUpdate:modelValue": a[3] || (a[3] = (n) => g.value = n),
1427
+ localized: "",
1428
+ disabled: t.disabled
1429
+ }, null, 8, ["modelValue", "disabled"]))
1430
+ ]),
1431
+ _: 1
1432
+ }, 8, ["label", "help"]),
1433
+ P("div", ja, [
1434
+ i(e(Q), {
1435
+ size: "sm",
1436
+ variant: "text",
1437
+ disabled: t.disabled,
1438
+ onClick: a[4] || (a[4] = (n) => J("title"))
1439
+ }, {
1440
+ default: d(() => [...a[24] || (a[24] = [
1441
+ F("+ {title}", -1)
1442
+ ])]),
1443
+ _: 1
1444
+ }, 8, ["disabled"]),
1445
+ i(e(Q), {
1446
+ size: "sm",
1447
+ variant: "text",
1448
+ disabled: t.disabled,
1449
+ onClick: a[5] || (a[5] = (n) => J("text"))
1450
+ }, {
1451
+ default: d(() => [...a[25] || (a[25] = [
1452
+ F("+ {text}", -1)
1453
+ ])]),
1454
+ _: 1
1455
+ }, 8, ["disabled"])
1456
+ ]),
1457
+ V.value.length > 0 ? (m(), E(e(re), {
1458
+ key: 0,
1459
+ size: "sm",
1460
+ tone: "warning"
1461
+ }, {
1462
+ default: d(() => [
1463
+ F(N(e(s)("layers.unknown-field", { fields: W.value })), 1)
1464
+ ]),
1465
+ _: 1
1466
+ })) : H("", !0)
1467
+ ], 64)) : H("", !0),
1468
+ t.layer.type === "text" ? (m(), E(e(G), {
1469
+ key: 1,
1470
+ label: e(s)("layers.tag")
1471
+ }, {
1472
+ default: d(() => [
1473
+ i(e(fe), {
1474
+ modelValue: e(R),
1475
+ "onUpdate:modelValue": a[6] || (a[6] = (n) => ye(R) ? R.value = n : null),
1476
+ options: t.tags,
1477
+ size: "sm",
1478
+ disabled: t.disabled
1479
+ }, null, 8, ["modelValue", "options", "disabled"])
1480
+ ]),
1481
+ _: 1
1482
+ }, 8, ["label"])) : H("", !0),
1483
+ t.layer.type === "image" ? (m(), E(e(G), {
1484
+ key: 2,
1485
+ label: e(s)("layers.image")
1486
+ }, {
1487
+ default: d(() => [
1488
+ i(e(ba), {
1489
+ modelValue: U.value,
1490
+ "onUpdate:modelValue": a[7] || (a[7] = (n) => U.value = n),
1491
+ accept: "image",
1492
+ aspect: null,
1493
+ height: 120,
1494
+ disabled: t.disabled
1495
+ }, null, 8, ["modelValue", "disabled"])
1496
+ ]),
1497
+ _: 1
1498
+ }, 8, ["label"])) : H("", !0),
1499
+ t.layer.type === "button" ? (m(), B(ne, { key: 3 }, [
1500
+ i(e(G), {
1501
+ label: e(s)("layers.link")
1502
+ }, {
1503
+ default: d(() => [
1504
+ i(e(ca), {
1505
+ modelValue: C.value,
1506
+ "onUpdate:modelValue": a[8] || (a[8] = (n) => C.value = n),
1507
+ "allow-none": !1,
1508
+ disabled: t.disabled
1509
+ }, null, 8, ["modelValue", "disabled"])
1510
+ ]),
1511
+ _: 1
1512
+ }, 8, ["label"]),
1513
+ i(e(G), {
1514
+ label: e(s)("layers.variant")
1515
+ }, {
1516
+ default: d(() => [
1517
+ i(e(fe), {
1518
+ modelValue: e(X),
1519
+ "onUpdate:modelValue": a[9] || (a[9] = (n) => ye(X) ? X.value = n : null),
1520
+ options: t.variants,
1521
+ size: "sm",
1522
+ disabled: t.disabled
1523
+ }, null, 8, ["modelValue", "options", "disabled"])
1524
+ ]),
1525
+ _: 1
1526
+ }, 8, ["label"])
1527
+ ], 64)) : H("", !0),
1528
+ t.layer.type === "buttons" ? (m(), E(e(re), {
1529
+ key: 4,
1530
+ size: "sm",
1531
+ tone: "muted"
1532
+ }, {
1533
+ default: d(() => [
1534
+ F(N(e(s)("layers.buttons-help")), 1)
1535
+ ]),
1536
+ _: 1
1537
+ })) : H("", !0),
1538
+ P("section", Ha, [
1539
+ P("div", Ga, [
1540
+ i(e(re), {
1541
+ size: "sm",
1542
+ strong: ""
1543
+ }, {
1544
+ default: d(() => [
1545
+ F(N(t.view === "mobile" ? h.value ? e(s)("layers.geometry-mobile-own") : e(s)("layers.geometry-mobile-same") : e(s)("layers.geometry-desktop")), 1)
1546
+ ]),
1547
+ _: 1
1548
+ }),
1549
+ h.value ? (m(), E(e(Q), {
1550
+ key: 0,
1551
+ size: "sm",
1552
+ variant: "text",
1553
+ disabled: t.disabled,
1554
+ onClick: a[10] || (a[10] = (n) => f("same-as-desktop"))
1555
+ }, {
1556
+ default: d(() => [
1557
+ F(N(e(s)("layers.same-as-desktop")), 1)
1558
+ ]),
1559
+ _: 1
1560
+ }, 8, ["disabled"])) : H("", !0)
1561
+ ]),
1562
+ i(e(re), {
1563
+ size: "sm",
1564
+ tone: "muted"
1565
+ }, {
1566
+ default: d(() => [
1567
+ F(N(e(s)("layers.unit")), 1)
1568
+ ]),
1569
+ _: 1
1570
+ }),
1571
+ P("div", Za, [
1572
+ (m(!0), B(ne, null, ve(S.value, (n) => (m(), E(e(G), {
1573
+ key: n,
1574
+ label: e(s)(`layers.${n}`)
1575
+ }, {
1576
+ default: d(() => [
1577
+ i(e(Le), {
1578
+ "model-value": _.value[n],
1579
+ min: e(Ne)[n][0],
1580
+ max: e(Ne)[n][1],
1581
+ step: M[n],
1582
+ precision: 2,
1583
+ size: "sm",
1584
+ disabled: t.disabled,
1585
+ "onUpdate:modelValue": (I) => D(n, I ?? null)
1586
+ }, null, 8, ["model-value", "min", "max", "step", "disabled", "onUpdate:modelValue"])
1587
+ ]),
1588
+ _: 2
1589
+ }, 1032, ["label"]))), 128))
1590
+ ]),
1591
+ i(e(G), {
1592
+ label: e(s)("layers.origin"),
1593
+ help: e(s)("layers.origin-help")
1594
+ }, {
1595
+ default: d(() => [
1596
+ P("div", {
1597
+ class: "wx-banner-layer-inspector__origins",
1598
+ role: "radiogroup",
1599
+ "aria-label": e(s)("layers.origin")
1600
+ }, [
1601
+ (m(!0), B(ne, null, ve(e(ya), (n) => (m(), B("button", {
1602
+ key: n,
1603
+ type: "button",
1604
+ role: "radio",
1605
+ "aria-checked": _.value.origin === n,
1606
+ "aria-label": n,
1607
+ disabled: t.disabled,
1608
+ class: oe([
1609
+ "wx-banner-layer-inspector__origin",
1610
+ { "is-active": _.value.origin === n }
1611
+ ]),
1612
+ onClick: (I) => we(n)
1613
+ }, null, 10, Ya))), 128))
1614
+ ], 8, Xa)
1615
+ ]),
1616
+ _: 1
1617
+ }, 8, ["label", "help"]),
1618
+ i(e(Me), {
1619
+ "model-value": _.value.hidden,
1620
+ label: e(s)("layers.hidden-here"),
1621
+ disabled: t.disabled,
1622
+ "onUpdate:modelValue": a[11] || (a[11] = (n) => f("frame", { hidden: n === !0 }))
1623
+ }, null, 8, ["model-value", "label", "disabled"])
1624
+ ]),
1625
+ t.layer.type !== "image" ? (m(), B("section", Qa, [
1626
+ i(e(re), {
1627
+ size: "sm",
1628
+ strong: ""
1629
+ }, {
1630
+ default: d(() => [
1631
+ F(N(e(s)("layers.look")), 1)
1632
+ ]),
1633
+ _: 1
1634
+ }),
1635
+ P("div", el, [
1636
+ i(e(G), {
1637
+ label: e(s)("layers.font")
1638
+ }, {
1639
+ default: d(() => [
1640
+ i(e(fe), {
1641
+ modelValue: e(ee),
1642
+ "onUpdate:modelValue": a[12] || (a[12] = (n) => ye(ee) ? ee.value = n : null),
1643
+ options: Ce.value,
1644
+ size: "sm",
1645
+ disabled: t.disabled
1646
+ }, null, 8, ["modelValue", "options", "disabled"])
1647
+ ]),
1648
+ _: 1
1649
+ }, 8, ["label"]),
1650
+ i(e(G), {
1651
+ label: e(s)("layers.weight")
1652
+ }, {
1653
+ default: d(() => [
1654
+ i(e(fe), {
1655
+ modelValue: e(se),
1656
+ "onUpdate:modelValue": a[13] || (a[13] = (n) => ye(se) ? se.value = n : null),
1657
+ options: e(ge),
1658
+ size: "sm",
1659
+ disabled: t.disabled
1660
+ }, null, 8, ["modelValue", "options", "disabled"])
1661
+ ]),
1662
+ _: 1
1663
+ }, 8, ["label"]),
1664
+ i(e(G), {
1665
+ label: e(s)("layers.line-height")
1666
+ }, {
1667
+ default: d(() => [
1668
+ i(e(Le), {
1669
+ "model-value": t.layer.style.line_height,
1670
+ min: 0.8,
1671
+ max: 3,
1672
+ step: 0.05,
1673
+ precision: 2,
1674
+ size: "sm",
1675
+ disabled: t.disabled,
1676
+ "onUpdate:modelValue": a[14] || (a[14] = (n) => n != null && v("line_height", n))
1677
+ }, null, 8, ["model-value", "disabled"])
1678
+ ]),
1679
+ _: 1
1680
+ }, 8, ["label"]),
1681
+ i(e(G), {
1682
+ label: e(s)("layers.opacity")
1683
+ }, {
1684
+ default: d(() => [
1685
+ i(e(Le), {
1686
+ "model-value": t.layer.style.opacity,
1687
+ min: 0,
1688
+ max: 1,
1689
+ step: 0.05,
1690
+ precision: 2,
1691
+ size: "sm",
1692
+ disabled: t.disabled,
1693
+ "onUpdate:modelValue": a[15] || (a[15] = (n) => n != null && v("opacity", n))
1694
+ }, null, 8, ["model-value", "disabled"])
1695
+ ]),
1696
+ _: 1
1697
+ }, 8, ["label"])
1698
+ ]),
1699
+ i(e(G), {
1700
+ label: e(s)("layers.align")
1701
+ }, {
1702
+ default: d(() => [
1703
+ i(e(it), {
1704
+ modelValue: k.value,
1705
+ "onUpdate:modelValue": a[16] || (a[16] = (n) => k.value = n),
1706
+ options: me.value,
1707
+ size: "sm",
1708
+ disabled: t.disabled
1709
+ }, null, 8, ["modelValue", "options", "disabled"])
1710
+ ]),
1711
+ _: 1
1712
+ }, 8, ["label"]),
1713
+ P("div", tl, [
1714
+ i(e(Me), {
1715
+ "model-value": t.layer.style.italic,
1716
+ label: e(s)("layers.italic"),
1717
+ disabled: t.disabled,
1718
+ "onUpdate:modelValue": a[17] || (a[17] = (n) => v("italic", n === !0))
1719
+ }, null, 8, ["model-value", "label", "disabled"]),
1720
+ i(e(Me), {
1721
+ "model-value": t.layer.style.uppercase,
1722
+ label: e(s)("layers.uppercase"),
1723
+ disabled: t.disabled,
1724
+ "onUpdate:modelValue": a[18] || (a[18] = (n) => v("uppercase", n === !0))
1725
+ }, null, 8, ["model-value", "label", "disabled"]),
1726
+ i(e(Me), {
1727
+ "model-value": t.layer.style.shadow,
1728
+ label: e(s)("layers.shadow"),
1729
+ disabled: t.disabled,
1730
+ "onUpdate:modelValue": a[19] || (a[19] = (n) => v("shadow", n === !0))
1731
+ }, null, 8, ["model-value", "label", "disabled"])
1732
+ ]),
1733
+ (m(), B(ne, null, ve(["color", "background"], (n) => i(e(G), {
1734
+ key: n,
1735
+ label: e(s)(`layers.${n}`)
1736
+ }, {
1737
+ default: d(() => [
1738
+ P("div", al, [
1739
+ (m(!0), B(ne, null, ve(t.palette, (I) => (m(), B("button", {
1740
+ key: I.key,
1741
+ type: "button",
1742
+ title: I.key,
1743
+ "aria-label": I.key,
1744
+ disabled: t.disabled,
1745
+ class: oe([
1746
+ "wx-banner-layer-inspector__swatch",
1747
+ { "is-active": t.layer.style[n] === `token:${I.key}` }
1748
+ ]),
1749
+ style: Oe({ background: I.value }),
1750
+ onClick: (ue) => v(n, `token:${I.key}`)
1751
+ }, null, 14, ll))), 128)),
1752
+ i(e(oa), {
1753
+ "model-value": xe(n),
1754
+ clearable: "",
1755
+ size: "sm",
1756
+ disabled: t.disabled,
1757
+ "onUpdate:modelValue": (I) => ce(n, I)
1758
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
1759
+ ])
1760
+ ]),
1761
+ _: 2
1762
+ }, 1032, ["label"])), 64))
1763
+ ])) : H("", !0),
1764
+ P("section", nl, [
1765
+ i(e(re), {
1766
+ size: "sm",
1767
+ strong: ""
1768
+ }, {
1769
+ default: d(() => [
1770
+ F(N(e(s)("layers.motion")), 1)
1771
+ ]),
1772
+ _: 1
1773
+ }),
1774
+ P("div", sl, [
1775
+ i(e(G), {
1776
+ label: e(s)("layers.entrance")
1777
+ }, {
1778
+ default: d(() => [
1779
+ i(e(fe), {
1780
+ modelValue: e(q),
1781
+ "onUpdate:modelValue": a[20] || (a[20] = (n) => ye(q) ? q.value = n : null),
1782
+ options: ie.value,
1783
+ size: "sm",
1784
+ disabled: t.disabled
1785
+ }, null, 8, ["modelValue", "options", "disabled"])
1786
+ ]),
1787
+ _: 1
1788
+ }, 8, ["label"]),
1789
+ i(e(G), {
1790
+ label: e(s)("layers.loop")
1791
+ }, {
1792
+ default: d(() => [
1793
+ i(e(fe), {
1794
+ modelValue: e(z),
1795
+ "onUpdate:modelValue": a[21] || (a[21] = (n) => ye(z) ? z.value = n : null),
1796
+ options: de.value,
1797
+ size: "sm",
1798
+ disabled: t.disabled
1799
+ }, null, 8, ["modelValue", "options", "disabled"])
1800
+ ]),
1801
+ _: 1
1802
+ }, 8, ["label"]),
1803
+ i(e(G), {
1804
+ label: e(s)("layers.delay")
1805
+ }, {
1806
+ default: d(() => [
1807
+ i(e(Le), {
1808
+ "model-value": t.layer.motion.delay,
1809
+ min: 0,
1810
+ max: 1e4,
1811
+ step: 50,
1812
+ size: "sm",
1813
+ disabled: t.disabled || t.layer.motion.in === null,
1814
+ "onUpdate:modelValue": a[22] || (a[22] = (n) => n != null && b((I) => I.motion.delay = n))
1815
+ }, null, 8, ["model-value", "disabled"])
1816
+ ]),
1817
+ _: 1
1818
+ }, 8, ["label"]),
1819
+ i(e(G), {
1820
+ label: e(s)("layers.duration")
1821
+ }, {
1822
+ default: d(() => [
1823
+ i(e(Le), {
1824
+ "model-value": t.layer.motion.duration,
1825
+ min: 100,
1826
+ max: 5e3,
1827
+ step: 50,
1828
+ size: "sm",
1829
+ disabled: t.disabled || t.layer.motion.in === null,
1830
+ "onUpdate:modelValue": a[23] || (a[23] = (n) => n != null && b((I) => I.motion.duration = n))
1831
+ }, null, 8, ["model-value", "disabled"])
1832
+ ]),
1833
+ _: 1
1834
+ }, 8, ["label"])
1835
+ ])
1836
+ ])
1837
+ ]));
1838
+ }
1839
+ }), il = /* @__PURE__ */ Ie(ol, [["__scopeId", "data-v-32ff51cd"]]), rl = { class: "wx-banner-layers__bar" }, ul = { class: "wx-banner-layers__tools" }, dl = { class: "wx-banner-layers__body" }, cl = { class: "wx-banner-layers__main" }, bl = ["aria-label"], vl = { class: "webx-banner__picture" }, ml = ["src"], pl = {
1840
+ key: 1,
1841
+ class: "wx-banner-layers__empty"
1842
+ }, yl = {
1843
+ key: 0,
1844
+ class: "webx-banner__inner wx-banner-layers__words"
1845
+ }, fl = ["src"], hl = {
1846
+ key: 2,
1847
+ class: "webx-banner__inner webx-banner__buttons"
1848
+ }, wl = {
1849
+ key: 3,
1850
+ class: "webx-banner__inner webx-banner__buttons"
1851
+ }, gl = {
1852
+ key: 0,
1853
+ class: "webx-banner__button"
1854
+ }, xl = ["onPointerdown"], kl = ["onPointerdown"], _l = ["onClick"], $l = { class: "wx-banner-layers__name" }, Vl = 3, zl = 6, Sl = /* @__PURE__ */ Ve({
1855
+ name: "WxBannerLayers",
1856
+ __name: "LayersField",
1857
+ props: {
1858
+ modelValue: {},
1859
+ disabled: { type: Boolean }
1860
+ },
1861
+ emits: ["update:modelValue"],
1862
+ setup(t, { emit: c }) {
1863
+ const o = t, f = c, s = ze(), $ = pa(), _ = Je(), h = va(s), b = Ue(s);
1864
+ Te();
1865
+ const v = Se("webx-banners"), w = y(() => o.modelValue ?? []), g = y(() => $?.place.value?.layers ?? null), T = A("desktop"), V = A(null), W = y(() => w.value.find((l) => l.id === V.value) ?? null), K = y(() => {
1866
+ const l = _.active.value;
1867
+ return _.list.value.some((r) => r.code === l) ? l : _.list.value[0]?.code ?? "en";
1868
+ }), J = y(() => _.list.value.map((l) => l.code)), U = A([]), C = A([]);
1869
+ function L() {
1870
+ U.value = [...U.value.slice(-99), JSON.stringify(w.value)], C.value = [];
1871
+ }
1872
+ function R(l, r = !0) {
1873
+ r && L(), f("update:modelValue", l);
1874
+ }
1875
+ function X() {
1876
+ const l = U.value.at(-1);
1877
+ l !== void 0 && (C.value = [...C.value, JSON.stringify(w.value)], U.value = U.value.slice(0, -1), f("update:modelValue", JSON.parse(l)));
1878
+ }
1879
+ function ee() {
1880
+ const l = C.value.at(-1);
1881
+ l !== void 0 && (U.value = [...U.value, JSON.stringify(w.value)], C.value = C.value.slice(0, -1), f("update:modelValue", JSON.parse(l)));
1882
+ }
1883
+ function se(l, r, u = !0) {
1884
+ R(
1885
+ w.value.map((x) => x.id === l ? r(lt(x)) : x),
1886
+ u
1887
+ );
1888
+ }
1889
+ function k(l, r = T.value) {
1890
+ return r === "mobile" ? l.frames.mobile ?? l.frames.desktop : l.frames.desktop;
1891
+ }
1892
+ function q(l, r, u = !0) {
1893
+ se(
1894
+ l,
1895
+ (x) => {
1896
+ const O = Va({ ...k(x), ...r });
1897
+ return T.value === "mobile" ? x.frames.mobile = O : x.frames.desktop = O, x;
1898
+ },
1899
+ u
1900
+ );
1901
+ }
1902
+ let z = { id: "", at: 0 };
1903
+ function S(l) {
1904
+ const r = Date.now(), u = z.id === l.id && r - z.at < 800;
1905
+ z = { id: l.id, at: r }, se(l.id, () => l, !u);
1906
+ }
1907
+ function M(l) {
1908
+ const r = gt(
1909
+ l,
1910
+ w.value.map((u) => u.id),
1911
+ K.value
1912
+ );
1913
+ R([r, ...w.value]), V.value = r.id;
1914
+ }
1915
+ function D(l) {
1916
+ R(w.value.filter((r) => r.id !== l)), V.value === l && (V.value = null);
1917
+ }
1918
+ function we(l) {
1919
+ const r = w.value.findIndex((te) => te.id === l), u = w.value[r];
1920
+ if (!u || u.type === "buttons") return;
1921
+ const x = lt(u);
1922
+ x.id = gt(
1923
+ "text",
1924
+ w.value.map((te) => te.id),
1925
+ K.value
1926
+ ).id, x.frames.desktop = {
1927
+ ...x.frames.desktop,
1928
+ x: x.frames.desktop.x + 2,
1929
+ y: x.frames.desktop.y + 2
1930
+ };
1931
+ const O = [...w.value];
1932
+ O.splice(r, 0, x), R(O), V.value = x.id;
1933
+ }
1934
+ function Ce(l) {
1935
+ q(l.id, { hidden: !k(l).hidden });
1936
+ }
1937
+ const ge = y(() => w.value.some((l) => l.type === "buttons")), me = y({
1938
+ get: () => w.value,
1939
+ set: (l) => R(l)
1940
+ }), ie = Ht({});
1941
+ function de(l) {
1942
+ const r = l?.path;
1943
+ return typeof r == "string" && r !== "" ? r : null;
1944
+ }
1945
+ async function xe(l) {
1946
+ if (!(l === null || l in ie)) {
1947
+ ie[l] = null;
1948
+ try {
1949
+ const r = await h.fileByPath(l);
1950
+ ie[l] = r ? { url: r.url, ratio: r.width && r.height ? r.width / r.height : null } : null;
1951
+ } catch {
1952
+ ie[l] = null;
1953
+ }
1954
+ }
1955
+ }
1956
+ const ce = y(() => de($?.values.value.image)), p = y(() => de($?.values.value.image_mobile));
1957
+ $e(
1958
+ () => [ce.value, p.value, ...w.value.map((l) => de(l.image))],
1959
+ (l) => l.forEach((r) => {
1960
+ xe(r);
1961
+ }),
1962
+ { immediate: !0 }
1963
+ );
1964
+ const a = y(
1965
+ () => T.value === "mobile" ? kt(g.value?.ratio_mobile, 0.8) : kt(g.value?.ratio, 16 / 6)
1966
+ ), n = y(() => {
1967
+ const l = p.value === null ? null : ie[p.value] ?? null, r = ce.value === null ? null : ie[ce.value] ?? null;
1968
+ return T.value === "mobile" ? l ?? r : r;
1969
+ }), I = y(() => n.value?.ratio ?? a.value), ue = y(() => $a(I.value, a.value)), De = y(() => {
1970
+ const l = String(I.value);
1971
+ return { "--ratio": l, "--ratio-mobile": l, "--img": l, "--img-m": l };
1972
+ }), je = y(() => {
1973
+ const l = (r) => ($?.values.value[r]?.[K.value] ?? "").trim();
1974
+ return { title: l("title"), text: l("text") };
1975
+ });
1976
+ function ut(l) {
1977
+ return ga(l.text, K.value, J.value, je.value);
1978
+ }
1979
+ const dt = y(
1980
+ () => ($?.values.value.buttons ?? []).map((l) => ({
1981
+ label: (l.label?.[K.value] ?? "").trim(),
1982
+ variant: l.variant ?? g.value?.variants[0]?.value ?? "primary"
1983
+ })).filter((l) => l.label !== "")
1984
+ );
1985
+ function Nt(l) {
1986
+ return l.type === "text" && /^(p|span|h[1-6])$/.test(l.tag ?? "") ? l.tag : "div";
1987
+ }
1988
+ function Ut(l) {
1989
+ if (l.name) return l.name;
1990
+ const r = l.text?.[K.value] ?? Object.values(l.text ?? {})[0] ?? "";
1991
+ return r.trim() === "{title}" ? v("layers.title-layer") : r.trim() === "{text}" ? v("layers.text-layer") : l.type === "buttons" ? v("layers.buttons-layer") : l.type === "image" ? v("layers.image") : r.trim() || v(`layers.${l.type}`);
1992
+ }
1993
+ const Tt = {
1994
+ text: "file-text",
1995
+ image: "image",
1996
+ button: "link",
1997
+ buttons: "grid"
1998
+ };
1999
+ function ct(l) {
2000
+ const r = k(l), u = 100 / I.value, x = ue.value, O = x.left, te = x.left + x.width, Y = x.top / 100 * u, ae = (x.top + x.height) / 100 * u, j = r.x + Ze(r.origin)[0] / 100 * r.w;
2001
+ return j > te || j + r.w < O || r.y > ae || r.y < Y - 50;
2002
+ }
2003
+ const He = A(null), bt = A(null), Be = A([]);
2004
+ function It(l, r) {
2005
+ const u = 100 / I.value, x = ue.value, O = l === "x" ? [0, 50, 100, x.left, x.left + x.width] : [0, u / 2, u, x.top / 100 * u, (x.top + x.height) / 100 * u];
2006
+ for (const te of w.value) {
2007
+ if (te.id === r) continue;
2008
+ const Y = k(te);
2009
+ l === "x" ? O.push(Y.x, Y.x + Y.w) : O.push(Y.y);
2010
+ }
2011
+ return O;
2012
+ }
2013
+ function vt(l, r, u, x, O, te) {
2014
+ if (te) return r;
2015
+ const Y = [0, u / 2, u];
2016
+ let ae = null;
2017
+ for (const j of It(l, O))
2018
+ for (const be of Y) {
2019
+ const ke = j - (r + be);
2020
+ Math.abs(ke) * x <= zl && (ae === null || Math.abs(ke) < Math.abs(ae.delta)) && (ae = { delta: ke, at: j });
2021
+ }
2022
+ return ae === null ? r : (Be.value = [...Be.value.filter((j) => j.axis !== l), { axis: l, at: ae.at }], r + ae.delta);
2023
+ }
2024
+ function mt(l) {
2025
+ V.value = l.id, bt.value?.focus({ preventScroll: !0 });
2026
+ }
2027
+ function Ge(l, r, u) {
2028
+ if (mt(r), o.disabled || l.button !== 0 || !He.value) return;
2029
+ l.preventDefault();
2030
+ const O = He.value.getBoundingClientRect().width / 100, Y = l.target.closest(".webx-banner__layer")?.getBoundingClientRect(), ae = Y ? Y.height / O : 0, j = { ...k(r) }, be = { x: l.clientX, y: l.clientY };
2031
+ let ke = !1;
2032
+ const yt = (_e) => {
2033
+ const Xe = (_e.clientX - be.x) / O, At = (_e.clientY - be.y) / O;
2034
+ if (!ke) {
2035
+ if (Math.hypot(_e.clientX - be.x, _e.clientY - be.y) < Vl) return;
2036
+ ke = !0, L();
2037
+ }
2038
+ if (Be.value = [], u === "move") {
2039
+ const pe = {
2040
+ x: Ze(j.origin)[0] / 100 * j.w,
2041
+ y: Ze(j.origin)[1] / 100 * ae
2042
+ }, Rt = vt("x", j.x + Xe + pe.x, j.w, O, r.id, _e.altKey), Ft = vt("y", j.y + At + pe.y, ae, O, r.id, _e.altKey);
2043
+ q(r.id, { x: Rt - pe.x, y: Ft - pe.y }, !1);
2044
+ } else if (u === "width")
2045
+ q(r.id, { w: Math.max(1, j.w + Xe) }, !1);
2046
+ else {
2047
+ const pe = Math.max(0.05, (j.w + Xe) / j.w);
2048
+ q(r.id, { w: j.w * pe, size: j.size * pe }, !1);
2049
+ }
2050
+ }, Ee = () => {
2051
+ window.removeEventListener("pointermove", yt), window.removeEventListener("pointerup", Ee), window.removeEventListener("pointercancel", Ee), Be.value = [];
2052
+ };
2053
+ window.addEventListener("pointermove", yt), window.addEventListener("pointerup", Ee), window.addEventListener("pointercancel", Ee);
2054
+ }
2055
+ function Ze(l) {
2056
+ const r = l.endsWith("r") ? -100 : l === "t" || l === "c" || l === "b" ? -50 : 0, u = l.startsWith("b") ? -100 : l === "l" || l === "c" || l === "r" ? -50 : 0;
2057
+ return [r, u];
2058
+ }
2059
+ function Dt(l) {
2060
+ l.target.closest(".webx-banner__layer") || (V.value = null);
2061
+ }
2062
+ function Et(l) {
2063
+ const r = l.ctrlKey || l.metaKey, u = l.key.toLowerCase();
2064
+ if (r && u === "z") {
2065
+ l.preventDefault(), l.shiftKey ? ee() : X();
2066
+ return;
2067
+ }
2068
+ if (r && u === "y") {
2069
+ l.preventDefault(), ee();
2070
+ return;
2071
+ }
2072
+ const x = W.value;
2073
+ if (!x || o.disabled) return;
2074
+ if (r && u === "d") {
2075
+ l.preventDefault(), we(x.id);
2076
+ return;
2077
+ }
2078
+ if (u === "delete" || u === "backspace") {
2079
+ l.preventDefault(), D(x.id);
2080
+ return;
2081
+ }
2082
+ if (u === "escape") {
2083
+ V.value = null;
2084
+ return;
2085
+ }
2086
+ const O = l.shiftKey ? 0.5 : 0.05, Y = {
2087
+ arrowleft: [-O, 0],
2088
+ arrowright: [O, 0],
2089
+ arrowup: [0, -O],
2090
+ arrowdown: [0, O]
2091
+ }[u];
2092
+ if (!Y) return;
2093
+ l.preventDefault();
2094
+ const ae = k(x), j = Date.now(), be = z.id === `arrows:${x.id}` && j - z.at < 800;
2095
+ z = { id: `arrows:${x.id}`, at: j }, q(x.id, { x: ae.x + Y[0], y: ae.y + Y[1] }, !be);
2096
+ }
2097
+ const Pe = A(null);
2098
+ let We = null;
2099
+ nt(async () => {
2100
+ try {
2101
+ Pe.value = await b.theme();
2102
+ } catch {
2103
+ Pe.value = null;
2104
+ }
2105
+ const l = `${Pe.value?.tokens_css ?? ""}
2106
+ ${Pe.value?.fonts_css ?? ""}`.trim();
2107
+ l !== "" && !document.getElementById("wx-banners-theme") && (We = document.createElement("style"), We.id = "wx-banners-theme", We.textContent = l, document.head.append(We));
2108
+ }), Vt(() => {
2109
+ We?.remove();
2110
+ });
2111
+ const Mt = y(() => [
2112
+ { value: "desktop", label: v("layers.desktop"), icon: "monitor" },
2113
+ { value: "mobile", label: v("layers.mobile"), icon: "smartphone" }
2114
+ ]), pt = y({
2115
+ get: () => T.value,
2116
+ set: (l) => {
2117
+ T.value = l === "mobile" ? "mobile" : "desktop";
2118
+ }
2119
+ });
2120
+ return (l, r) => (m(), B("div", {
2121
+ class: oe(["wx-banner-layers", { "is-disabled": t.disabled }])
2122
+ }, [
2123
+ P("div", rl, [
2124
+ i(e(it), {
2125
+ modelValue: pt.value,
2126
+ "onUpdate:modelValue": r[0] || (r[0] = (u) => pt.value = u),
2127
+ options: Mt.value,
2128
+ size: "sm",
2129
+ "aria-label": e(v)("layers.layout")
2130
+ }, null, 8, ["modelValue", "options", "aria-label"]),
2131
+ P("div", ul, [
2132
+ i(e(tt), {
2133
+ content: e(v)("layers.undo")
2134
+ }, {
2135
+ default: d(() => [
2136
+ i(e(Q), {
2137
+ size: "sm",
2138
+ variant: "text",
2139
+ disabled: t.disabled || U.value.length === 0,
2140
+ "aria-label": e(v)("layers.undo"),
2141
+ onClick: X
2142
+ }, {
2143
+ icon: d(() => [
2144
+ i(e(le), { name: "rotate-left" })
2145
+ ]),
2146
+ _: 1
2147
+ }, 8, ["disabled", "aria-label"])
2148
+ ]),
2149
+ _: 1
2150
+ }, 8, ["content"]),
2151
+ i(e(tt), {
2152
+ content: e(v)("layers.redo")
2153
+ }, {
2154
+ default: d(() => [
2155
+ i(e(Q), {
2156
+ size: "sm",
2157
+ variant: "text",
2158
+ disabled: t.disabled || C.value.length === 0,
2159
+ "aria-label": e(v)("layers.redo"),
2160
+ onClick: ee
2161
+ }, {
2162
+ icon: d(() => [
2163
+ i(e(le), { name: "rotate-right" })
2164
+ ]),
2165
+ _: 1
2166
+ }, 8, ["disabled", "aria-label"])
2167
+ ]),
2168
+ _: 1
2169
+ }, 8, ["content"]),
2170
+ i(e(Q), {
2171
+ size: "sm",
2172
+ variant: "outline",
2173
+ disabled: t.disabled,
2174
+ onClick: r[1] || (r[1] = (u) => M("text"))
2175
+ }, {
2176
+ icon: d(() => [
2177
+ i(e(le), { name: "plus" })
2178
+ ]),
2179
+ default: d(() => [
2180
+ F(" " + N(e(v)("layers.text")), 1)
2181
+ ]),
2182
+ _: 1
2183
+ }, 8, ["disabled"]),
2184
+ i(e(Q), {
2185
+ size: "sm",
2186
+ variant: "outline",
2187
+ disabled: t.disabled,
2188
+ onClick: r[2] || (r[2] = (u) => M("image"))
2189
+ }, {
2190
+ icon: d(() => [
2191
+ i(e(le), { name: "plus" })
2192
+ ]),
2193
+ default: d(() => [
2194
+ F(" " + N(e(v)("layers.image")), 1)
2195
+ ]),
2196
+ _: 1
2197
+ }, 8, ["disabled"]),
2198
+ i(e(Q), {
2199
+ size: "sm",
2200
+ variant: "outline",
2201
+ disabled: t.disabled,
2202
+ onClick: r[3] || (r[3] = (u) => M("button"))
2203
+ }, {
2204
+ icon: d(() => [
2205
+ i(e(le), { name: "plus" })
2206
+ ]),
2207
+ default: d(() => [
2208
+ F(" " + N(e(v)("layers.button")), 1)
2209
+ ]),
2210
+ _: 1
2211
+ }, 8, ["disabled"]),
2212
+ ge.value ? H("", !0) : (m(), E(e(Q), {
2213
+ key: 0,
2214
+ size: "sm",
2215
+ variant: "outline",
2216
+ disabled: t.disabled,
2217
+ onClick: r[4] || (r[4] = (u) => M("buttons"))
2218
+ }, {
2219
+ icon: d(() => [
2220
+ i(e(le), { name: "plus" })
2221
+ ]),
2222
+ default: d(() => [
2223
+ F(" " + N(e(v)("layers.buttons-layer")), 1)
2224
+ ]),
2225
+ _: 1
2226
+ }, 8, ["disabled"]))
2227
+ ])
2228
+ ]),
2229
+ g.value ? H("", !0) : (m(), E(e(re), {
2230
+ key: 0,
2231
+ size: "sm",
2232
+ tone: "muted"
2233
+ }, {
2234
+ default: d(() => [
2235
+ F(N(e(v)("layers.not-here")), 1)
2236
+ ]),
2237
+ _: 1
2238
+ })),
2239
+ P("div", dl, [
2240
+ P("div", cl, [
2241
+ P("div", {
2242
+ ref_key: "canvas",
2243
+ ref: bt,
2244
+ class: oe(["wx-banner-layers__canvas", { "is-overflow": g.value?.overflow }]),
2245
+ tabindex: "0",
2246
+ "aria-label": e(v)("layers.canvas"),
2247
+ onPointerdown: Dt,
2248
+ onKeydown: Et
2249
+ }, [
2250
+ P("div", {
2251
+ class: oe(["webx-banner wx-banner-layers__frame", { "is-mobile": T.value === "mobile" }]),
2252
+ style: Oe(De.value)
2253
+ }, [
2254
+ P("div", vl, [
2255
+ n.value ? (m(), B("img", {
2256
+ key: 0,
2257
+ class: "webx-banner__image",
2258
+ src: n.value.url,
2259
+ alt: ""
2260
+ }, null, 8, ml)) : (m(), B("div", pl, N(e(v)("layers.no-picture")), 1))
2261
+ ]),
2262
+ P("div", {
2263
+ ref_key: "stage",
2264
+ ref: He,
2265
+ class: "webx-banner__stage"
2266
+ }, [
2267
+ (m(!0), B(ne, null, ve(w.value, (u, x) => (m(), E(St(Nt(u)), {
2268
+ key: u.id,
2269
+ class: oe([
2270
+ ...e(_a)(u),
2271
+ { "is-selected": u.id === V.value, "is-outside": ct(u) }
2272
+ ]),
2273
+ style: Oe(e(ka)(u, w.value.length - x)),
2274
+ onPointerdown: Ye((O) => Ge(O, u, "move"), ["stop"])
2275
+ }, {
2276
+ default: d(() => [
2277
+ u.type === "text" ? (m(), B("span", yl, N(ut(u) || "…"), 1)) : u.type === "image" ? (m(), B("img", {
2278
+ key: 1,
2279
+ class: "webx-banner__inner",
2280
+ src: ie[de(u.image) ?? ""]?.url ?? "",
2281
+ alt: "",
2282
+ draggable: "false"
2283
+ }, null, 8, fl)) : u.type === "button" ? (m(), B("span", hl, [
2284
+ P("span", {
2285
+ class: oe([
2286
+ "webx-banner__button",
2287
+ `webx-banner__button--${u.variant ?? g.value?.variants[0]?.value ?? "primary"}`
2288
+ ])
2289
+ }, N(ut(u) || "…"), 3)
2290
+ ])) : (m(), B("span", wl, [
2291
+ (m(!0), B(ne, null, ve(dt.value, (O, te) => (m(), B("span", {
2292
+ key: te,
2293
+ class: oe(["webx-banner__button", `webx-banner__button--${O.variant}`])
2294
+ }, N(O.label), 3))), 128)),
2295
+ dt.value.length === 0 ? (m(), B("span", gl, N(e(v)("layers.buttons-layer")), 1)) : H("", !0)
2296
+ ])),
2297
+ u.id === V.value && !t.disabled ? (m(), B(ne, { key: 4 }, [
2298
+ P("span", {
2299
+ class: "wx-banner-layers__handle wx-banner-layers__handle--width",
2300
+ onPointerdown: Ye((O) => Ge(O, u, "width"), ["stop"])
2301
+ }, null, 40, xl),
2302
+ P("span", {
2303
+ class: "wx-banner-layers__handle wx-banner-layers__handle--scale",
2304
+ onPointerdown: Ye((O) => Ge(O, u, "scale"), ["stop"])
2305
+ }, null, 40, kl)
2306
+ ], 64)) : H("", !0)
2307
+ ]),
2308
+ _: 2
2309
+ }, 1064, ["class", "style", "onPointerdown"]))), 128))
2310
+ ], 512),
2311
+ P("div", {
2312
+ class: "wx-banner-layers__crop",
2313
+ style: Oe({
2314
+ left: `${ue.value.left}%`,
2315
+ top: `${ue.value.top}%`,
2316
+ width: `${ue.value.width}%`,
2317
+ height: `${ue.value.height}%`
2318
+ })
2319
+ }, null, 4),
2320
+ (m(!0), B(ne, null, ve(Be.value, (u) => (m(), B("div", {
2321
+ key: u.axis,
2322
+ class: oe(["wx-banner-layers__guide", `wx-banner-layers__guide--${u.axis}`]),
2323
+ style: Oe(
2324
+ u.axis === "x" ? { left: `${u.at}%` } : { top: `calc(${u.at} * 1cqw)` }
2325
+ )
2326
+ }, null, 6))), 128))
2327
+ ], 6)
2328
+ ], 42, bl),
2329
+ i(e(re), {
2330
+ size: "sm",
2331
+ tone: "muted"
2332
+ }, {
2333
+ default: d(() => [
2334
+ F(N(e(v)("layers.hint")), 1)
2335
+ ]),
2336
+ _: 1
2337
+ }),
2338
+ i(e(Ct), {
2339
+ modelValue: me.value,
2340
+ "onUpdate:modelValue": r[5] || (r[5] = (u) => me.value = u),
2341
+ class: "wx-banner-layers__list",
2342
+ "item-key": "id",
2343
+ size: "sm",
2344
+ disabled: t.disabled,
2345
+ "empty-text": e(v)("layers.empty"),
2346
+ "aria-label": e(v)("layers.list")
2347
+ }, {
2348
+ default: d(({ item: u }) => [
2349
+ P("button", {
2350
+ type: "button",
2351
+ class: oe(["wx-banner-layers__row", { "is-selected": u.id === V.value }]),
2352
+ onClick: (x) => mt(u)
2353
+ }, [
2354
+ i(e(le), {
2355
+ name: Tt[u.type]
2356
+ }, null, 8, ["name"]),
2357
+ P("span", $l, N(Ut(u)), 1),
2358
+ ct(u) ? (m(), E(e(le), {
2359
+ key: 0,
2360
+ name: "warning",
2361
+ class: "wx-banner-layers__warn",
2362
+ "aria-label": e(v)("layers.outside")
2363
+ }, null, 8, ["aria-label"])) : H("", !0)
2364
+ ], 10, _l)
2365
+ ]),
2366
+ actions: d(({ item: u }) => [
2367
+ i(e(Q), {
2368
+ size: "sm",
2369
+ variant: "text",
2370
+ disabled: t.disabled,
2371
+ "aria-label": k(u).hidden ? e(v)("layers.show") : e(v)("layers.hide"),
2372
+ onClick: (x) => Ce(u)
2373
+ }, {
2374
+ icon: d(() => [
2375
+ i(e(le), {
2376
+ name: k(u).hidden ? "eye-off" : "eye"
2377
+ }, null, 8, ["name"])
2378
+ ]),
2379
+ _: 2
2380
+ }, 1032, ["disabled", "aria-label", "onClick"]),
2381
+ i(e(Q), {
2382
+ size: "sm",
2383
+ variant: "text",
2384
+ disabled: t.disabled,
2385
+ "aria-label": e(v)("layers.delete"),
2386
+ onClick: (x) => D(u.id)
2387
+ }, {
2388
+ icon: d(() => [
2389
+ i(e(le), { name: "trash" })
2390
+ ]),
2391
+ _: 1
2392
+ }, 8, ["disabled", "aria-label", "onClick"])
2393
+ ]),
2394
+ _: 1
2395
+ }, 8, ["modelValue", "disabled", "empty-text", "aria-label"])
2396
+ ]),
2397
+ W.value ? (m(), E(il, {
2398
+ key: 0,
2399
+ class: "wx-banner-layers__inspector",
2400
+ layer: W.value,
2401
+ view: T.value,
2402
+ tags: g.value?.tags ?? [],
2403
+ variants: g.value?.variants ?? [],
2404
+ palette: Pe.value?.palette ?? [],
2405
+ disabled: t.disabled,
2406
+ onUpdate: S,
2407
+ onFrame: r[6] || (r[6] = (u) => q(W.value.id, u)),
2408
+ onSameAsDesktop: r[7] || (r[7] = (u) => se(W.value.id, (x) => ({
2409
+ ...x,
2410
+ frames: { ...x.frames, mobile: null }
2411
+ }))),
2412
+ onDelete: r[8] || (r[8] = (u) => D(W.value.id))
2413
+ }, null, 8, ["layer", "view", "tags", "variants", "palette", "disabled"])) : (m(), E(e(re), {
2414
+ key: 1,
2415
+ class: "wx-banner-layers__inspector",
2416
+ size: "sm",
2417
+ tone: "muted"
2418
+ }, {
2419
+ default: d(() => [
2420
+ F(N(e(v)("layers.choose")), 1)
2421
+ ]),
2422
+ _: 1
2423
+ }))
2424
+ ])
2425
+ ], 2));
2426
+ }
2427
+ }), Cl = /* @__PURE__ */ Ie(Sl, [["__scopeId", "data-v-540c304c"]]);
2428
+ function Nl(t = {}) {
2429
+ const c = t.path ?? "/banners";
951
2430
  return {
952
2431
  id: "banners",
953
- path: s,
2432
+ path: c,
954
2433
  routes: [
955
2434
  // The open place is in the address (`?place=`), so a link to it is a link to its banners.
956
- { path: s, name: "webx.banners", component: wa, props: { base: s } },
2435
+ { path: c, name: "webx.banners", component: qa, props: { base: c } },
957
2436
  // A banner not written yet: the place it goes to rides in the query (`?place=hero`).
958
2437
  {
959
- path: `${s}/new`,
2438
+ path: `${c}/new`,
960
2439
  name: "webx.banners.new",
961
- component: ke,
962
- props: { base: s }
2440
+ component: $t,
2441
+ props: { base: c }
963
2442
  },
964
2443
  {
965
- path: `${s}/:id(\\d+)`,
2444
+ path: `${c}/:id(\\d+)`,
966
2445
  name: "webx.banners.edit",
967
- component: ke,
968
- props: { base: s }
2446
+ component: $t,
2447
+ props: { base: c }
969
2448
  }
970
- ]
2449
+ ],
2450
+ /*
2451
+ * The one node of `banners.form` only this module can draw: the layers, on the banner's
2452
+ * picture. A field like any other — its value is the list of layers.
2453
+ */
2454
+ types: {
2455
+ "wx-banner-layers": { component: Cl, kind: "field", wide: !0 }
2456
+ }
971
2457
  };
972
2458
  }
973
2459
  export {
974
- ke as WxBannerEditorPage,
975
- wa as WxBannersPage,
976
- $a as banners,
977
- aa as bannersMessages,
978
- Z as createBannersApi
2460
+ ht as ENTRANCES,
2461
+ ha as FIELDS,
2462
+ Ne as FRAME_LIMITS,
2463
+ wt as LOOPS,
2464
+ ya as ORIGINS,
2465
+ $t as WxBannerEditorPage,
2466
+ Cl as WxBannerLayers,
2467
+ qa as WxBannersPage,
2468
+ Nl as banners,
2469
+ za as bannersMessages,
2470
+ Va as clampFrame,
2471
+ lt as clone,
2472
+ Ue as createBannersApi,
2473
+ $a as cropBox,
2474
+ xt as cssColor,
2475
+ wa as defaultLayers,
2476
+ he as frame,
2477
+ _a as layerClasses,
2478
+ Lt as layerId,
2479
+ ka as layerVars,
2480
+ ga as layerWords,
2481
+ Re as motion,
2482
+ gt as newLayer,
2483
+ kt as ratioOf,
2484
+ Ae as style,
2485
+ xa as unknownFields
979
2486
  };
980
2487
  //# sourceMappingURL=index.js.map