@webx-ui/module-blocks 0.3.0 → 0.4.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,29 +1,29 @@
1
- import { defineComponent as Y, computed as C, openBlock as i, createElementBlock as x, createVNode as r, unref as e, createElementVNode as $, createTextVNode as _, toDisplayString as p, Fragment as H, createCommentVNode as A, renderList as ee, ref as N, onMounted as xe, watch as oe, createBlock as W, withCtx as d, normalizeStyle as de, reactive as je, onBeforeUnmount as Ze, resolveComponent as Ge, withDirectives as zt, vModelText as Et, isRef as ct, normalizeClass as he, withKeys as tt, withModifiers as He, provide as pt, inject as Ee, useModel as Ut, getCurrentInstance as It, mergeModels as Nt, createSlots as Lt } from "vue";
2
- import { useRoute as Mt, useRouter as ft } from "vue-router";
3
- import { useTranslate as te, useAdmin as $e, useErrorText as Ve, WxDate as Pt, adminKey as Ot, WxListScreen as Dt } from "@webx-ui/module-admin";
4
- import { WxIcon as ae, WxSkeleton as me, WxText as R, WxBadge as K, WxButton as J, confirm as Ie, toast as q, useElementWidth as Ye, WxSegmented as vt, WxCard as fe, WxAlert as mt, WxTabs as Rt, WxTab as ve, WxCodeEditor as Ae, WxFormItem as G, WxInput as be, WxSelect as ht, WxTextarea as jt, WxInputNumber as lt, WxTagsInput as nt, WxSwitch as Ht, WxActionBar as Ft, useModal as bt, WxDialog as gt, WxEmpty as kt, WxSortableList as qt, WxAction as Fe, createModal as yt, WxSpace as Jt, WxSkeletonItem as ze } from "@webx-ui/core";
5
- import { WxScreenRenderer as wt, coreTypes as qe } from "@webx-ui/schema";
6
- function ge(t) {
7
- const l = `${t.apiPath}/blocks`, a = (s) => s.data;
1
+ import { defineComponent as Q, computed as B, openBlock as i, createElementBlock as V, createVNode as u, unref as e, createElementVNode as $, createTextVNode as w, toDisplayString as p, Fragment as H, createCommentVNode as L, renderList as te, ref as U, onMounted as Ce, watch as ie, createBlock as W, withCtx as c, normalizeStyle as ce, reactive as je, onBeforeUnmount as Ze, resolveComponent as vt, isRef as mt, normalizeClass as be, withKeys as lt, withModifiers as He, provide as ht, inject as Ne, useModel as Ut, getCurrentInstance as Nt, mergeModels as Pt, createSlots as Mt } from "vue";
2
+ import { useRoute as Ot, useRouter as bt } from "vue-router";
3
+ import { useTranslate as le, useAdmin as Te, useErrorText as Be, WxDate as Dt, WxBackButton as Rt, WxRenameButton as jt, WxHelpButton as Ht, adminKey as Ft, WxListScreen as qt } from "@webx-ui/module-admin";
4
+ import { WxIcon as oe, WxSkeleton as he, WxText as j, WxBadge as J, WxButton as q, confirm as Me, toast as F, useElementWidth as Ge, WxSegmented as gt, WxCard as ve, WxAlert as kt, WxTabs as Jt, WxTab as me, WxCodeEditor as Ie, WxFormItem as Y, WxInput as ge, WxSelect as yt, WxTextarea as Kt, WxInputNumber as nt, WxTagsInput as at, WxSwitch as Zt, WxActionBar as Gt, useModal as wt, WxDialog as _t, WxEmpty as xt, WxSortableList as Yt, WxAction as Fe, createModal as $t, WxSpace as Qt, WxSkeletonItem as Ue } from "@webx-ui/core";
5
+ import { WxScreenRenderer as Vt, coreTypes as qe } from "@webx-ui/schema";
6
+ function ke(t) {
7
+ const l = `${t.apiPath}/blocks`, s = (n) => n.data;
8
8
  return {
9
- list: () => t.http.get(l).then(a),
10
- catalog: () => t.http.get(`${l}/catalog`).then(a),
11
- get: (s) => t.http.get(`${l}/${s}`).then(a),
12
- create: (s) => t.http.post(l, s).then(a),
13
- update: (s, o) => t.http.put(`${l}/${s}`, o).then(a),
14
- remove: (s) => t.http.delete(`${l}/${s}`),
15
- publish: (s) => t.http.post(`${l}/${s}/publish`, {}).then(a),
16
- render: (s, o = {}) => t.http.post(`${l}/${s}/render`, o).then(a),
17
- usage: (s) => t.http.get(`${l}/${s}/usage`).then(a),
18
- versions: (s) => t.http.get(`${l}/${s}/versions`).then(a),
19
- version: (s, o) => t.http.get(`${l}/${s}/versions/${o}`).then(a),
20
- restore: (s, o) => t.http.post(`${l}/${s}/versions/${o}/restore`, {}).then(a)
9
+ list: () => t.http.get(l).then(s),
10
+ catalog: () => t.http.get(`${l}/catalog`).then(s),
11
+ get: (n) => t.http.get(`${l}/${n}`).then(s),
12
+ create: (n) => t.http.post(l, n).then(s),
13
+ update: (n, o) => t.http.put(`${l}/${n}`, o).then(s),
14
+ remove: (n) => t.http.delete(`${l}/${n}`),
15
+ publish: (n) => t.http.post(`${l}/${n}/publish`, {}).then(s),
16
+ render: (n, o = {}) => t.http.post(`${l}/${n}/render`, o).then(s),
17
+ usage: (n) => t.http.get(`${l}/${n}/usage`).then(s),
18
+ versions: (n) => t.http.get(`${l}/${n}/versions`).then(s),
19
+ version: (n, o) => t.http.get(`${l}/${n}/versions/${o}`).then(s),
20
+ restore: (n, o) => t.http.post(`${l}/${n}/versions/${o}/restore`, {}).then(s)
21
21
  };
22
22
  }
23
- const Kt = { class: "wx-block-checks" }, Zt = {
23
+ const Xt = { class: "wx-block-checks" }, el = {
24
24
  key: 0,
25
25
  class: "wx-block-checks__line is-error"
26
- }, Gt = /* @__PURE__ */ Y({
26
+ }, tl = /* @__PURE__ */ Q({
27
27
  __name: "BlockChecks",
28
28
  props: {
29
29
  file: {},
@@ -32,50 +32,50 @@ const Kt = { class: "wx-block-checks" }, Zt = {
32
32
  error: {}
33
33
  },
34
34
  setup(t) {
35
- const l = t, a = te("webx-blocks"), s = C(() => l.lints.filter((u) => u.file === l.file)), o = C(() => {
36
- const u = new Set(s.value.map((v) => v.code)), n = [];
37
- return l.file === "template" && (u.has("no-marker") || n.push(a("checks.ok-marker")), u.has("variables-missing") || n.push(a("checks.ok-variables"))), l.file === "styles" && (u.has("stray-selectors") || n.push(a("checks.ok-prefix", { slug: l.slug })), u.has("bare-selectors") || n.push(a("checks.ok-bare")), u.has("media-query") || n.push(a("checks.ok-container"))), n;
35
+ const l = t, s = le("webx-blocks"), n = B(() => l.lints.filter((r) => r.file === l.file)), o = B(() => {
36
+ const r = new Set(n.value.map((v) => v.code)), a = [];
37
+ return l.file === "template" && (r.has("no-marker") || a.push(s("checks.ok-marker")), r.has("variables-missing") || a.push(s("checks.ok-variables"))), l.file === "styles" && (r.has("stray-selectors") || a.push(s("checks.ok-prefix", { slug: l.slug })), r.has("bare-selectors") || a.push(s("checks.ok-bare")), r.has("media-query") || a.push(s("checks.ok-container"))), a;
38
38
  });
39
- return (u, n) => (i(), x("div", Kt, [
40
- t.error ? (i(), x("div", Zt, [
41
- r(e(ae), { name: "close-circle" }),
39
+ return (r, a) => (i(), V("div", Xt, [
40
+ t.error ? (i(), V("div", el, [
41
+ u(e(oe), { name: "close-circle" }),
42
42
  $("span", null, [
43
- _(p(t.error.message) + " ", 1),
44
- t.error.line !== null ? (i(), x(H, { key: 0 }, [
45
- _(" · " + p(e(a)("page.line", { line: t.error.line })), 1)
46
- ], 64)) : A("", !0),
47
- t.error.where ? (i(), x(H, { key: 1 }, [
48
- _(" · " + p(t.error.where), 1)
49
- ], 64)) : A("", !0)
43
+ w(p(t.error.message) + " ", 1),
44
+ t.error.line !== null ? (i(), V(H, { key: 0 }, [
45
+ w(" · " + p(e(s)("page.line", { line: t.error.line })), 1)
46
+ ], 64)) : L("", !0),
47
+ t.error.where ? (i(), V(H, { key: 1 }, [
48
+ w(" · " + p(t.error.where), 1)
49
+ ], 64)) : L("", !0)
50
50
  ])
51
- ])) : A("", !0),
52
- (i(!0), x(H, null, ee(s.value, (v) => (i(), x("div", {
51
+ ])) : L("", !0),
52
+ (i(!0), V(H, null, te(n.value, (v) => (i(), V("div", {
53
53
  key: v.code,
54
54
  class: "wx-block-checks__line is-warning"
55
55
  }, [
56
- r(e(ae), { name: "warning" }),
56
+ u(e(oe), { name: "warning" }),
57
57
  $("span", null, [
58
- _(p(v.message) + " ", 1),
59
- v.line !== null ? (i(), x(H, { key: 0 }, [
60
- _(" · " + p(e(a)("page.line", { line: v.line })), 1)
61
- ], 64)) : A("", !0)
58
+ w(p(v.message) + " ", 1),
59
+ v.line !== null ? (i(), V(H, { key: 0 }, [
60
+ w(" · " + p(e(s)("page.line", { line: v.line })), 1)
61
+ ], 64)) : L("", !0)
62
62
  ])
63
63
  ]))), 128)),
64
- (i(!0), x(H, null, ee(o.value, (v) => (i(), x("div", {
64
+ (i(!0), V(H, null, te(o.value, (v) => (i(), V("div", {
65
65
  key: v,
66
66
  class: "wx-block-checks__line is-ok"
67
67
  }, [
68
- r(e(ae), { name: "check" }),
68
+ u(e(oe), { name: "check" }),
69
69
  $("span", null, p(v), 1)
70
70
  ]))), 128))
71
71
  ]));
72
72
  }
73
- }), Q = (t, l) => {
74
- const a = t.__vccOpts || t;
75
- for (const [s, o] of l)
76
- a[s] = o;
77
- return a;
78
- }, at = /* @__PURE__ */ Q(Gt, [["__scopeId", "data-v-a96ffa19"]]), Yt = { class: "wx-block-history" }, Qt = { class: "wx-block-history__number" }, Xt = { class: "wx-block-history__who" }, el = /* @__PURE__ */ Y({
73
+ }), X = (t, l) => {
74
+ const s = t.__vccOpts || t;
75
+ for (const [n, o] of l)
76
+ s[n] = o;
77
+ return s;
78
+ }, st = /* @__PURE__ */ X(tl, [["__scopeId", "data-v-e56947a8"]]), ll = { class: "wx-block-history" }, nl = { class: "wx-block-history__number" }, al = { class: "wx-block-history__who" }, sl = /* @__PURE__ */ Q({
79
79
  __name: "BlockHistory",
80
80
  props: {
81
81
  block: {},
@@ -83,165 +83,212 @@ const Kt = { class: "wx-block-checks" }, Zt = {
83
83
  },
84
84
  emits: ["restored"],
85
85
  setup(t, { emit: l }) {
86
- const a = t, s = l, o = $e(), u = ge(o), n = te("webx-blocks"), v = Ve(), z = N(null);
87
- async function c() {
88
- z.value = await u.versions(a.block.id);
86
+ const s = t, n = l, o = Te(), r = ke(o), a = le("webx-blocks"), v = Be(), A = U(null);
87
+ async function d() {
88
+ A.value = await r.versions(s.block.id);
89
89
  }
90
- function g(f) {
91
- return a.block.draft?.number === f.number ? "draft" : a.block.published?.number === f.number ? "live" : "replaced";
90
+ function b(h) {
91
+ return s.block.draft?.number === h.number ? "draft" : s.block.published?.number === h.number ? "live" : "replaced";
92
92
  }
93
- async function m(f) {
94
- if (await Ie({
95
- title: n("page.restore-title", { number: f.number }),
96
- message: n("page.restore-text"),
97
- confirmText: n("page.restore"),
98
- cancelText: n("page.cancel")
93
+ async function m(h) {
94
+ if (await Me({
95
+ title: a("page.restore-title", { number: h.number }),
96
+ message: a("page.restore-text"),
97
+ confirmText: a("page.restore"),
98
+ cancelText: a("page.cancel")
99
99
  }))
100
100
  try {
101
- const y = await u.restore(a.block.id, f.number);
102
- q.success(n("page.restored", { number: y.draft?.number ?? f.number })), s("restored", y), await c();
101
+ const y = await r.restore(s.block.id, h.number);
102
+ F.success(a("page.restored", { number: y.draft?.number ?? h.number })), n("restored", y), await d();
103
103
  } catch (y) {
104
- q.danger(v(y));
104
+ F.danger(v(y));
105
105
  }
106
106
  }
107
- return xe(c), oe(
108
- () => [a.block.draft?.number, a.block.published?.number],
107
+ return Ce(d), ie(
108
+ () => [s.block.draft?.number, s.block.published?.number],
109
109
  () => {
110
- c();
110
+ d();
111
111
  }
112
- ), (f, h) => (i(), x("div", Yt, [
113
- z.value === null ? (i(), W(e(me), {
112
+ ), (h, f) => (i(), V("div", ll, [
113
+ A.value === null ? (i(), W(e(he), {
114
114
  key: 0,
115
+ class: "wx-block-history__ghost",
115
116
  rows: 3
116
- })) : (i(!0), x(H, { key: 1 }, ee(z.value, (y) => (i(), x("div", {
117
+ })) : (i(!0), V(H, { key: 1 }, te(A.value, (y) => (i(), V("div", {
117
118
  key: y.number,
118
119
  class: "wx-block-history__row"
119
120
  }, [
120
- $("code", Qt, p(e(n)("page.version", { number: y.number })), 1),
121
- $("div", Xt, [
122
- r(e(R), null, {
123
- default: d(() => [
124
- _(p(e(n)(`page.version-${g(y)}`)), 1)
121
+ $("code", nl, p(e(a)("page.version", { number: y.number })), 1),
122
+ $("div", al, [
123
+ u(e(j), null, {
124
+ default: c(() => [
125
+ w(p(e(a)(`page.version-${b(y)}`)), 1)
125
126
  ]),
126
127
  _: 2
127
128
  }, 1024),
128
- r(e(R), {
129
+ u(e(j), {
129
130
  size: "sm",
130
131
  tone: "muted"
131
132
  }, {
132
- default: d(() => [
133
- y.created_at ? (i(), W(e(Pt), {
133
+ default: c(() => [
134
+ y.created_at ? (i(), W(e(Dt), {
134
135
  key: 0,
135
136
  value: y.created_at
136
- }, null, 8, ["value"])) : A("", !0),
137
- _(" · " + p(y.author ?? e(n)(`page.source-${y.source}`)) + " ", 1),
138
- y.comment ? (i(), x(H, { key: 1 }, [
139
- _(" · " + p(y.comment), 1)
140
- ], 64)) : A("", !0)
137
+ }, null, 8, ["value"])) : L("", !0),
138
+ w(" · " + p(y.author ?? e(a)(`page.source-${y.source}`)) + " ", 1),
139
+ y.comment ? (i(), V(H, { key: 1 }, [
140
+ w(" · " + p(y.comment), 1)
141
+ ], 64)) : L("", !0)
141
142
  ]),
142
143
  _: 2
143
144
  }, 1024)
144
145
  ]),
145
- g(y) === "draft" ? (i(), W(e(K), {
146
+ b(y) === "draft" ? (i(), W(e(J), {
146
147
  key: 0,
147
148
  type: "warning",
148
149
  dot: ""
149
150
  }, {
150
- default: d(() => [
151
- _(p(e(n)("page.version-draft")), 1)
151
+ default: c(() => [
152
+ w(p(e(a)("page.version-draft")), 1)
152
153
  ]),
153
154
  _: 1
154
- })) : g(y) === "live" ? (i(), W(e(K), {
155
+ })) : b(y) === "live" ? (i(), W(e(J), {
155
156
  key: 1,
156
157
  type: "success",
157
158
  dot: ""
158
159
  }, {
159
- default: d(() => [
160
- _(p(e(n)("page.version-live")), 1)
160
+ default: c(() => [
161
+ w(p(e(a)("page.version-live")), 1)
161
162
  ]),
162
163
  _: 1
163
- })) : A("", !0),
164
- t.canManage && g(y) === "replaced" ? (i(), W(e(J), {
164
+ })) : L("", !0),
165
+ t.canManage && b(y) === "replaced" ? (i(), W(e(q), {
165
166
  key: 2,
166
167
  size: "sm",
167
168
  variant: "outline",
168
- onClick: (w) => m(y)
169
+ onClick: (_) => m(y)
169
170
  }, {
170
- default: d(() => [
171
- _(p(e(n)("page.restore")), 1)
171
+ default: c(() => [
172
+ w(p(e(a)("page.restore")), 1)
172
173
  ]),
173
174
  _: 1
174
- }, 8, ["onClick"])) : A("", !0)
175
+ }, 8, ["onClick"])) : L("", !0)
175
176
  ]))), 128))
176
177
  ]));
177
178
  }
178
- }), tl = /* @__PURE__ */ Q(el, [["__scopeId", "data-v-99ceb7fe"]]), Ue = "wx-preview-selected", st = "wx-preview-style";
179
- function _t(t, l) {
180
- const s = (t.ownerDocument ?? t).createTreeWalker(
179
+ }), ol = /* @__PURE__ */ X(sl, [["__scopeId", "data-v-42c6b7ad"]]), Se = "wx-preview-selected", Pe = "wx-preview-hover", ot = "wx-preview-style";
180
+ function St(t, l) {
181
+ const n = (t.ownerDocument ?? t).createTreeWalker(
181
182
  t,
182
183
  128
183
184
  /* NodeFilter.SHOW_COMMENT */
184
185
  );
185
186
  let o = null;
186
- for (let u = s.nextNode(); u; u = s.nextNode()) {
187
- const n = u.data.trim();
188
- if (o === null && n === `wx:${l}`)
189
- o = u;
190
- else if (o !== null && n === `/wx:${l}`)
191
- return { start: o, end: u };
187
+ for (let r = n.nextNode(); r; r = n.nextNode()) {
188
+ const a = r.data.trim();
189
+ if (o === null && a === `wx:${l}`)
190
+ o = r;
191
+ else if (o !== null && a === `/wx:${l}`)
192
+ return { start: o, end: r };
192
193
  }
193
194
  return null;
194
195
  }
195
- function ll(t, l, a) {
196
- const s = _t(t, l);
197
- if (!s) return !1;
198
- const o = s.start.parentNode;
196
+ function il(t, l, s) {
197
+ const n = St(t, l);
198
+ if (!n) return !1;
199
+ const o = n.start.parentNode;
199
200
  if (!o) return !1;
200
- const u = t.createElement("template");
201
- u.innerHTML = a;
202
- const n = s.end.nextSibling;
203
- let v = s.start;
201
+ const r = t.createElement("template");
202
+ r.innerHTML = s;
203
+ const a = n.end.nextSibling;
204
+ let v = n.start;
204
205
  for (; v; ) {
205
- const m = v.nextSibling, f = v === s.end;
206
- if (o.removeChild(v), f) break;
206
+ const m = v.nextSibling, h = v === n.end;
207
+ if (o.removeChild(v), h) break;
207
208
  v = m;
208
209
  }
209
- const z = u.content, c = Array.from(z.childNodes);
210
- o.insertBefore(z, n);
211
- const g = t.defaultView?.webx;
212
- if (g?.mount)
213
- for (const m of c)
214
- m.nodeType === 1 && g.mount(m);
210
+ const A = r.content, d = Array.from(A.childNodes);
211
+ o.insertBefore(A, a);
212
+ const b = t.defaultView?.webx;
213
+ if (b?.mount)
214
+ for (const m of d)
215
+ m.nodeType === 1 && b.mount(m);
215
216
  return !0;
216
217
  }
217
- function nl(t, l) {
218
- const a = _t(t, l);
219
- if (!a) return null;
220
- for (let s = a.start.nextSibling; s && s !== a.end; s = s.nextSibling)
221
- if (s.nodeType === 1) return s;
218
+ function Ye(t, l) {
219
+ const s = St(t, l);
220
+ if (!s) return null;
221
+ for (let n = s.start.nextSibling; n && n !== s.end; n = n.nextSibling)
222
+ if (n.nodeType === 1) return n;
222
223
  return null;
223
224
  }
224
225
  function Je(t, l) {
225
- al(t);
226
- for (const s of Array.from(t.querySelectorAll(`.${Ue}`)))
227
- s.classList.remove(Ue);
226
+ Qe(t);
227
+ for (const n of Array.from(t.querySelectorAll(`.${Se}`)))
228
+ n.classList.remove(Se);
228
229
  if (l === null) return null;
229
- const a = nl(t, l);
230
- return a?.classList.add(Ue), a;
230
+ const s = Ye(t, l);
231
+ return s?.classList.add(Se), s;
232
+ }
233
+ function it(t, l) {
234
+ Qe(t);
235
+ for (const s of Array.from(t.querySelectorAll(`.${Pe}`)))
236
+ s.classList.remove(Pe);
237
+ l !== null && Ye(t, l)?.classList.add(Pe);
238
+ }
239
+ function rt(t) {
240
+ let l = t?.nodeType === 1 ? t : t?.parentElement ?? null;
241
+ for (; l; ) {
242
+ let s = 0;
243
+ for (let n = l.previousSibling; n; n = n.previousSibling) {
244
+ if (n.nodeType !== 8) continue;
245
+ const o = n.data.trim();
246
+ if (o.startsWith("/wx:"))
247
+ s += 1;
248
+ else if (o.startsWith("wx:")) {
249
+ if (s === 0) return o.slice(3);
250
+ s -= 1;
251
+ }
252
+ }
253
+ l = l.parentElement;
254
+ }
255
+ return null;
231
256
  }
232
- function al(t) {
233
- if (t.getElementById(st)) return;
257
+ function rl(t, l) {
258
+ Qe(t);
259
+ let s = null;
260
+ function n(v) {
261
+ v.preventDefault(), v.stopPropagation();
262
+ }
263
+ function o(v) {
264
+ n(v), l.select(rt(v.target));
265
+ }
266
+ function r(v) {
267
+ const A = rt(v.target);
268
+ A !== s && (s = A, it(t, A));
269
+ }
270
+ function a() {
271
+ s = null, it(t, null);
272
+ }
273
+ return t.addEventListener("click", o, !0), t.addEventListener("auxclick", n, !0), t.addEventListener("submit", n, !0), t.addEventListener("dragstart", n, !0), t.addEventListener("mousemove", r, !0), t.addEventListener("mouseleave", a), {
274
+ release() {
275
+ t.removeEventListener("click", o, !0), t.removeEventListener("auxclick", n, !0), t.removeEventListener("submit", n, !0), t.removeEventListener("dragstart", n, !0), t.removeEventListener("mousemove", r, !0), t.removeEventListener("mouseleave", a);
276
+ }
277
+ };
278
+ }
279
+ function Qe(t) {
280
+ if (t.getElementById(ot)) return;
234
281
  const l = t.createElement("style");
235
- l.id = st, l.textContent = `.${Ue}{outline:2px solid #427edd;outline-offset:-2px;}`, (t.head ?? t.documentElement).appendChild(l);
282
+ l.id = ot, l.textContent = `.${Se}{outline:2px solid #427edd;outline-offset:-2px;}.${Pe}:not(.${Se}){outline:1px solid #427edd;outline-offset:-1px;cursor:pointer;}`, (t.head ?? t.documentElement).appendChild(l);
236
283
  }
237
- function xt(t) {
238
- const l = t.base ? `<base href="${ot(t.base)}">` : "", a = t.frame ? `<style>${t.frame}</style>` : "", s = t.script && t.runtime ? `<script src="${ot(t.runtime)}"><\/script><script>${t.script}<\/script>` : "";
239
- return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${l}<style>html,body{margin:0}body{container-type:inline-size}</style>${a}<style>${t.styles}</style></head><body>${t.html}${s}</body></html>`;
284
+ function Ct(t) {
285
+ const l = t.base ? `<base href="${ut(t.base)}">` : "", s = t.frame ? `<style>${t.frame}</style>` : "", n = t.script && t.runtime ? `<script src="${ut(t.runtime)}"><\/script><script>${t.script}<\/script>` : "";
286
+ return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${l}<style>html,body{margin:0}body{container-type:inline-size}</style>${s}<style>${t.styles}</style></head><body>${t.html}${n}</body></html>`;
240
287
  }
241
- function ot(t) {
288
+ function ut(t) {
242
289
  return t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
243
290
  }
244
- const sl = { class: "wx-block-stage" }, ol = { class: "wx-block-stage__bar" }, il = ["srcdoc", "title"], rl = /* @__PURE__ */ Y({
291
+ const ul = { class: "wx-block-stage" }, cl = { class: "wx-block-stage__bar" }, dl = ["srcdoc", "title"], pl = /* @__PURE__ */ Q({
245
292
  __name: "BlockStage",
246
293
  props: {
247
294
  html: {},
@@ -251,12 +298,12 @@ const sl = { class: "wx-block-stage" }, ol = { class: "wx-block-stage__bar" }, i
251
298
  loading: { type: Boolean, default: !1 }
252
299
  },
253
300
  setup(t) {
254
- const l = t, a = te("webx-blocks"), s = C(() => [
255
- { value: 1280, label: a("page.width-desktop") },
256
- { value: 834, label: a("page.width-tablet") },
257
- { value: 390, label: a("page.width-phone") }
258
- ]), o = N(1280), u = N(null), n = N(null), v = Ye(u), z = N(360), c = C(() => v.value === 0 ? 1 : Math.min(1, v.value / o.value)), g = C(
259
- () => xt({
301
+ const l = t, s = le("webx-blocks"), n = B(() => [
302
+ { value: 1280, label: s("page.width-desktop") },
303
+ { value: 834, label: s("page.width-tablet") },
304
+ { value: 390, label: s("page.width-phone") }
305
+ ]), o = U(1280), r = U(null), a = U(null), v = Ge(r), A = U(360), d = B(() => v.value === 0 ? 1 : Math.min(1, v.value / o.value)), b = B(
306
+ () => Ct({
260
307
  html: l.html,
261
308
  styles: l.styles,
262
309
  script: l.script,
@@ -265,155 +312,155 @@ const sl = { class: "wx-block-stage" }, ol = { class: "wx-block-stage__bar" }, i
265
312
  })
266
313
  );
267
314
  function m() {
268
- const w = n.value?.contentDocument;
269
- w?.documentElement && (z.value = Math.max(120, w.documentElement.scrollHeight));
315
+ const _ = a.value?.contentDocument;
316
+ _?.documentElement && (A.value = Math.max(120, _.documentElement.scrollHeight));
270
317
  }
271
- function f() {
318
+ function h() {
272
319
  m(), setTimeout(m, 300);
273
320
  }
274
- oe(o, () => setTimeout(m, 50));
275
- const h = C(() => ({
321
+ ie(o, () => setTimeout(m, 50));
322
+ const f = B(() => ({
276
323
  width: `${o.value}px`,
277
- height: `${z.value}px`,
278
- transform: `scale(${c.value})`
279
- })), y = C(() => ({
280
- width: `${Math.round(o.value * c.value)}px`,
281
- height: `${Math.round(z.value * c.value)}px`
324
+ height: `${A.value}px`,
325
+ transform: `scale(${d.value})`
326
+ })), y = B(() => ({
327
+ width: `${Math.round(o.value * d.value)}px`,
328
+ height: `${Math.round(A.value * d.value)}px`
282
329
  }));
283
- return (w, V) => (i(), x("div", sl, [
284
- $("div", ol, [
285
- r(e(vt), {
330
+ return (_, S) => (i(), V("div", ul, [
331
+ $("div", cl, [
332
+ u(e(gt), {
286
333
  modelValue: o.value,
287
- "onUpdate:modelValue": V[0] || (V[0] = (k) => o.value = k),
288
- options: s.value,
334
+ "onUpdate:modelValue": S[0] || (S[0] = (k) => o.value = k),
335
+ options: n.value,
289
336
  size: "sm"
290
337
  }, null, 8, ["modelValue", "options"])
291
338
  ]),
292
339
  $("div", {
293
340
  ref_key: "box",
294
- ref: u,
341
+ ref: r,
295
342
  class: "wx-block-stage__ground"
296
343
  }, [
297
- t.loading && !t.html ? (i(), W(e(me), {
344
+ t.loading && !t.html ? (i(), W(e(he), {
298
345
  key: 0,
299
346
  rows: 3
300
- })) : (i(), x("div", {
347
+ })) : (i(), V("div", {
301
348
  key: 1,
302
349
  class: "wx-block-stage__clip",
303
- style: de(y.value)
350
+ style: ce(y.value)
304
351
  }, [
305
352
  $("iframe", {
306
353
  ref_key: "frame",
307
- ref: n,
354
+ ref: a,
308
355
  class: "wx-block-stage__frame",
309
- srcdoc: g.value,
310
- style: de(h.value),
356
+ srcdoc: b.value,
357
+ style: ce(f.value),
311
358
  sandbox: "allow-same-origin allow-scripts",
312
- title: e(a)("page.preview"),
313
- onLoad: f
314
- }, null, 44, il)
359
+ title: e(s)("page.preview"),
360
+ onLoad: h
361
+ }, null, 44, dl)
315
362
  ], 4))
316
363
  ], 512)
317
364
  ]));
318
365
  }
319
- }), ul = /* @__PURE__ */ Q(rl, [["__scopeId", "data-v-976b03f0"]]);
320
- function $t(t) {
366
+ }), fl = /* @__PURE__ */ X(pl, [["__scopeId", "data-v-9aa4b1df"]]);
367
+ function Tt(t) {
321
368
  return typeof t == "object" && t !== null && typeof t.type == "string" && t.type !== "";
322
369
  }
323
- function Ne(t) {
324
- return Array.isArray(t) && t.length > 0 && t.every($t);
370
+ function Oe(t) {
371
+ return Array.isArray(t) && t.length > 0 && t.every(Tt);
325
372
  }
326
373
  function Ke() {
327
374
  return (typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().replace(/-/g, "") : Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).slice(0, 12);
328
375
  }
329
- function dl(t, l = {}) {
376
+ function vl(t, l = {}) {
330
377
  return { key: Ke(), type: t, values: l };
331
378
  }
332
379
  function se(t, l) {
333
- return Vt(t, l, null, null);
380
+ return Bt(t, l, null, null);
334
381
  }
335
- function Vt(t, l, a, s) {
382
+ function Bt(t, l, s, n) {
336
383
  for (let o = 0; o < t.length; o++) {
337
- const u = t[o];
338
- if (u.key === l) return { node: u, parent: a, field: s, list: t, index: o };
339
- for (const [n, v] of Object.entries(u.values ?? {}))
340
- if (Ne(v)) {
341
- const z = Vt(v, l, u, n);
342
- if (z) return z;
384
+ const r = t[o];
385
+ if (r.key === l) return { node: r, parent: s, field: n, list: t, index: o };
386
+ for (const [a, v] of Object.entries(r.values ?? {}))
387
+ if (Oe(v)) {
388
+ const A = Bt(v, l, r, a);
389
+ if (A) return A;
343
390
  }
344
391
  }
345
392
  return null;
346
393
  }
347
- function Le(t, l, a = 0, s = null) {
394
+ function De(t, l, s = 0, n = null) {
348
395
  for (const o of t)
349
- if ($t(o)) {
350
- l(o, a, s);
351
- for (const u of Object.values(o.values ?? {}))
352
- Ne(u) && Le(u, l, a + 1, o);
396
+ if (Tt(o)) {
397
+ l(o, s, n);
398
+ for (const r of Object.values(o.values ?? {}))
399
+ Oe(r) && De(r, l, s + 1, o);
353
400
  }
354
401
  }
355
- function cl(t, l) {
356
- let a = 0;
357
- return Le(t, (s) => {
358
- s.type === l && a++;
359
- }), a;
402
+ function ml(t, l) {
403
+ let s = 0;
404
+ return De(t, (n) => {
405
+ n.type === l && s++;
406
+ }), s;
360
407
  }
361
- function pl(t) {
408
+ function hl(t) {
362
409
  let l = 0;
363
- for (const a of Object.values(t.values ?? {}))
364
- Ne(a) && Le(a, () => l++);
410
+ for (const s of Object.values(t.values ?? {}))
411
+ Oe(s) && De(s, () => l++);
365
412
  return l;
366
413
  }
367
- function Qn(t) {
414
+ function aa(t) {
368
415
  const l = [];
369
- return Le(t, (a) => {
370
- l.includes(a.type) || l.push(a.type);
416
+ return De(t, (s) => {
417
+ l.includes(s.type) || l.push(s.type);
371
418
  }), l;
372
419
  }
373
- function Tt(t) {
420
+ function Et(t) {
374
421
  const l = [];
375
- for (const a of t)
376
- a.type === "wx-blocks" && l.push(a), a.children && l.push(...Tt(a.children));
422
+ for (const s of t)
423
+ s.type === "wx-blocks" && l.push(s), s.children && l.push(...Et(s.children));
377
424
  return l;
378
425
  }
379
- function Ct(t) {
426
+ function Wt(t) {
380
427
  const l = {};
381
- for (const [a, s] of Object.entries(t.values ?? {}))
382
- l[a] = Ne(s) ? s.map(Ct) : ie(s);
428
+ for (const [s, n] of Object.entries(t.values ?? {}))
429
+ l[s] = Oe(n) ? n.map(Wt) : re(n);
383
430
  return t.hidden === !0 ? { key: Ke(), type: t.type, hidden: !0, values: l } : { key: Ke(), type: t.type, values: l };
384
431
  }
385
- function fl(t, l, a) {
386
- const s = ie(t), o = se(s, l);
387
- return o ? (a ? o.node.hidden = !0 : delete o.node.hidden, s) : t;
432
+ function bl(t, l, s) {
433
+ const n = re(t), o = se(n, l);
434
+ return o ? (s ? o.node.hidden = !0 : delete o.node.hidden, n) : t;
388
435
  }
389
- function vl(t, l, a) {
436
+ function gl(t, l, s) {
390
437
  if (l === null) return t;
391
- const s = se(t, l);
392
- if (!s || a === null) return null;
393
- const o = s.node.values[a];
394
- return Array.isArray(o) || (s.node.values[a] = []), s.node.values[a];
438
+ const n = se(t, l);
439
+ if (!n || s === null) return null;
440
+ const o = n.node.values[s];
441
+ return Array.isArray(o) || (n.node.values[s] = []), n.node.values[s];
395
442
  }
396
- function it(t, l, a, s, o) {
397
- const u = ie(t), n = vl(u, l, a);
398
- return n ? (n.splice(Math.max(0, Math.min(s, n.length)), 0, o), u) : t;
443
+ function ct(t, l, s, n, o) {
444
+ const r = re(t), a = gl(r, l, s);
445
+ return a ? (a.splice(Math.max(0, Math.min(n, a.length)), 0, o), r) : t;
399
446
  }
400
- function ml(t, l) {
401
- const a = ie(t), s = se(a, l);
402
- return s ? (s.list.splice(s.index, 1), a) : t;
447
+ function kl(t, l) {
448
+ const s = re(t), n = se(s, l);
449
+ return n ? (n.list.splice(n.index, 1), s) : t;
403
450
  }
404
- function hl(t, l, a) {
405
- const s = ie(t), o = se(s, l);
406
- return o ? (o.node.values = a, s) : t;
451
+ function yl(t, l, s) {
452
+ const n = re(t), o = se(n, l);
453
+ return o ? (o.node.values = s, n) : t;
407
454
  }
408
- function bl(t, l, a, s) {
409
- if (l === null) return ie(s);
410
- const o = ie(t), u = se(o, l);
411
- return !u || a === null ? t : (u.node.values[a] = ie(s), o);
455
+ function wl(t, l, s, n) {
456
+ if (l === null) return re(n);
457
+ const o = re(t), r = se(o, l);
458
+ return !r || s === null ? t : (r.node.values[s] = re(n), o);
412
459
  }
413
- function ie(t) {
460
+ function re(t) {
414
461
  return t === void 0 ? t : JSON.parse(JSON.stringify(t));
415
462
  }
416
- const gl = {
463
+ const _l = {
417
464
  module: {
418
465
  title: "Blocks"
419
466
  },
@@ -556,127 +603,127 @@ const gl = {
556
603
  "ok-container": "Width is decided by container queries.",
557
604
  "ok-variables": "Every variable of the template is a field of the schema."
558
605
  }
559
- }, rt = /* @__PURE__ */ new WeakSet();
560
- function Te() {
606
+ }, dt = /* @__PURE__ */ new WeakSet();
607
+ function Ee() {
561
608
  try {
562
- const { i18n: t } = $e();
563
- rt.has(t) || (t.defaults("webx-blocks", gl), rt.add(t));
609
+ const { i18n: t } = Te();
610
+ dt.has(t) || (t.defaults("webx-blocks", _l), dt.add(t));
564
611
  } catch {
565
612
  }
566
613
  }
567
- const kl = ["block", "entity", "loop", "__env", "errors", "app"];
568
- function yl(t, l, a) {
569
- const s = [];
570
- /data-wx-block\s*=/.test(l.template) || s.push({ file: "template", code: "no-marker", line: null, message: a("checks.no-marker") });
571
- const o = wl(l.template, l.schema);
572
- o.length > 0 && s.push({
614
+ const xl = ["block", "entity", "loop", "__env", "errors", "app"];
615
+ function $l(t, l, s) {
616
+ const n = [];
617
+ /data-wx-block\s*=/.test(l.template) || n.push({ file: "template", code: "no-marker", line: null, message: s("checks.no-marker") });
618
+ const o = Vl(l.template, l.schema);
619
+ o.length > 0 && n.push({
573
620
  file: "template",
574
621
  code: "variables-missing",
575
622
  line: null,
576
- message: a("checks.variables-missing", {
577
- variables: o.map((g) => `$${g}`).join(", ")
623
+ message: s("checks.variables-missing", {
624
+ variables: o.map((b) => `$${b}`).join(", ")
578
625
  })
579
626
  });
580
- const u = [], n = [], v = `.b-${t}`;
581
- for (const [g, m] of _l(l.styles))
582
- g.startsWith(v) || g.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(g) ? n.push([g, m]) : u.push([g, m]));
583
- u.length > 0 && s.push({
627
+ const r = [], a = [], v = `.b-${t}`;
628
+ for (const [b, m] of Sl(l.styles))
629
+ b.startsWith(v) || b.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(b) ? a.push([b, m]) : r.push([b, m]));
630
+ r.length > 0 && n.push({
584
631
  file: "styles",
585
632
  code: "stray-selectors",
586
- line: u[0][1],
587
- message: a("checks.stray-selectors", { slug: t, selectors: ut(u) })
588
- }), n.length > 0 && s.push({
633
+ line: r[0][1],
634
+ message: s("checks.stray-selectors", { slug: t, selectors: pt(r) })
635
+ }), a.length > 0 && n.push({
589
636
  file: "styles",
590
637
  code: "bare-selectors",
591
- line: n[0][1],
592
- message: a("checks.bare-selectors", { selectors: ut(n) })
638
+ line: a[0][1],
639
+ message: s("checks.bare-selectors", { selectors: pt(a) })
593
640
  });
594
- const z = Bt(l.styles), c = /@media\b/.exec(z);
595
- return c && s.push({
641
+ const A = Lt(l.styles), d = /@media\b/.exec(A);
642
+ return d && n.push({
596
643
  file: "styles",
597
644
  code: "media-query",
598
- line: Wt(z, c.index),
599
- message: a("checks.media-query")
600
- }), s;
645
+ line: zt(A, d.index),
646
+ message: s("checks.media-query")
647
+ }), n;
601
648
  }
602
- function St(t) {
649
+ function At(t) {
603
650
  const l = [];
604
- for (const a of t)
605
- a.id && l.push(a.id), a.children && l.push(...St(a.children));
651
+ for (const s of t)
652
+ s.id && l.push(s.id), s.children && l.push(...At(s.children));
606
653
  return l;
607
654
  }
608
- function wl(t, l) {
609
- const a = /* @__PURE__ */ new Set([...St(l), ...kl]);
655
+ function Vl(t, l) {
656
+ const s = /* @__PURE__ */ new Set([...At(l), ...xl]);
610
657
  for (const o of t.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
611
- a.add(o[1]), o[2] && a.add(o[2]);
658
+ s.add(o[1]), o[2] && s.add(o[2]);
612
659
  for (const o of t.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
613
- a.add(o[1]);
614
- const s = [];
660
+ s.add(o[1]);
661
+ const n = [];
615
662
  for (const o of t.matchAll(/\$([a-zA-Z_]\w*)/g)) {
616
- const u = o[1];
617
- !a.has(u) && !s.includes(u) && s.push(u);
663
+ const r = o[1];
664
+ !s.has(r) && !n.includes(r) && n.push(r);
618
665
  }
619
- return s;
666
+ return n;
620
667
  }
621
- function _l(t) {
622
- const l = Bt(t), a = [];
623
- for (const s of l.matchAll(/([^{};]+)\{/g)) {
624
- const o = s[1], u = o.trim();
625
- if (!(u === "" || u.startsWith("@")))
626
- for (const n of o.split(",")) {
627
- const v = n.trim();
628
- v === "" || v === "from" || v === "to" || v.endsWith("%") || a.push([v, Wt(l, s.index + o.indexOf(v))]);
668
+ function Sl(t) {
669
+ const l = Lt(t), s = [];
670
+ for (const n of l.matchAll(/([^{};]+)\{/g)) {
671
+ const o = n[1], r = o.trim();
672
+ if (!(r === "" || r.startsWith("@")))
673
+ for (const a of o.split(",")) {
674
+ const v = a.trim();
675
+ v === "" || v === "from" || v === "to" || v.endsWith("%") || s.push([v, zt(l, n.index + o.indexOf(v))]);
629
676
  }
630
677
  }
631
- return a;
678
+ return s;
632
679
  }
633
- function Bt(t) {
680
+ function Lt(t) {
634
681
  return t.replace(/\/\*[\s\S]*?\*\//g, (l) => l.replace(/[^\n]/g, " "));
635
682
  }
636
- function Wt(t, l) {
683
+ function zt(t, l) {
637
684
  return t.slice(0, Math.max(0, l)).split(`
638
685
  `).length;
639
686
  }
640
- function ut(t) {
641
- const l = [...new Set(t.map(([a]) => a))];
687
+ function pt(t) {
688
+ const l = [...new Set(t.map(([s]) => s))];
642
689
  return l.slice(0, 3).join(", ") + (l.length > 3 ? ", …" : "");
643
690
  }
644
- function Qe(t) {
691
+ function Xe(t) {
645
692
  return t.map((l) => ({
646
693
  ...l,
647
694
  name: l.name ?? l.id,
648
- children: l.children ? Qe(l.children) : l.children
695
+ children: l.children ? Xe(l.children) : l.children
649
696
  }));
650
697
  }
651
- function ke(t, l) {
652
- const a = `groups.${t}`, s = l(a);
653
- return s === a || s === `webx-blocks::${a}` ? t.charAt(0).toUpperCase() + t.slice(1) : s;
698
+ function ye(t, l) {
699
+ const s = `groups.${t}`, n = l(s);
700
+ return n === s || n === `webx-blocks::${s}` ? t.charAt(0).toUpperCase() + t.slice(1) : n;
654
701
  }
655
- const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns" }, Vl = { class: "wx-block-editor__head" }, Tl = { class: "wx-block-editor__id" }, Cl = ["aria-label", "disabled"], Sl = { class: "wx-block-editor__actions" }, Bl = { class: "wx-block-editor__columns" }, Wl = { class: "wx-block-editor__files" }, Al = { class: "wx-block-editor__pane" }, zl = {
702
+ const Cl = { class: "wx-block-editor" }, Tl = { class: "wx-block-editor__columns" }, Bl = { class: "wx-block-editor__head" }, El = { class: "wx-block-editor__id" }, Wl = { class: "wx-block-editor__name" }, Al = { class: "wx-block-editor__title" }, Ll = { class: "wx-block-editor__actions" }, zl = { class: "wx-block-editor__columns" }, Il = { class: "wx-block-editor__files" }, Ul = { class: "wx-block-editor__pane" }, Nl = {
656
703
  key: 0,
657
704
  class: "wx-block-editor__pills"
658
- }, El = ["disabled", "onClick", "textContent"], Ul = { class: "wx-block-editor__pane" }, Il = { class: "wx-block-editor__pane" }, Nl = { class: "wx-block-editor__note" }, Ll = { class: "wx-block-editor__pane" }, Ml = { class: "wx-block-editor__note" }, Pl = { class: "wx-block-editor__settings" }, Ol = {
705
+ }, Pl = ["disabled", "onClick", "textContent"], Ml = { class: "wx-block-editor__pane" }, Ol = { class: "wx-block-editor__pane" }, Dl = { class: "wx-block-editor__note" }, Rl = { class: "wx-block-editor__pane" }, jl = { class: "wx-block-editor__note" }, Hl = { class: "wx-block-editor__settings" }, Fl = {
659
706
  key: 0,
660
707
  class: "is-wide wx-block-editor__danger"
661
- }, Dl = { class: "wx-block-editor__side" }, Rl = {
708
+ }, ql = { class: "wx-block-editor__side" }, Jl = {
662
709
  key: 1,
663
710
  class: "wx-block-editor__usage"
664
- }, jl = /* @__PURE__ */ Y({
711
+ }, Kl = /* @__PURE__ */ Q({
665
712
  __name: "BlockEditorPage",
666
713
  props: {
667
714
  base: { default: "/blocks" }
668
715
  },
669
716
  setup(t) {
670
- const l = t, a = $e(), s = ge(a), o = Mt(), u = ft();
671
- Te();
672
- const n = te("webx-blocks"), v = Ve(), z = C(() => Number(o.params.id)), c = N(null), g = N([]), m = N(!0), f = N(!1), h = N(!1), y = N("template"), w = C(() => {
673
- const S = a.state.manifest?.modules.find((b) => b.id === "blocks")?.meta;
717
+ const l = t, s = Te(), n = ke(s), o = Ot(), r = bt();
718
+ Ee();
719
+ const a = le("webx-blocks"), v = Be(), A = B(() => Number(o.params.id)), d = U(null), b = U([]), m = U(!0), h = U(!1), f = U(!1), y = U("template"), _ = B(() => {
720
+ const E = s.state.manifest?.modules.find((g) => g.id === "blocks")?.meta;
674
721
  return {
675
- groups: S?.groups ?? [],
676
- editing: S?.editing ?? !0,
677
- provides: S?.provides ?? []
722
+ groups: E?.groups ?? [],
723
+ editing: E?.editing ?? !0,
724
+ provides: E?.provides ?? []
678
725
  };
679
- }), V = C(() => a.can("blocks.manage") && w.value.editing), k = je({
726
+ }), S = B(() => s.can("blocks.manage") && _.value.editing), k = je({
680
727
  slug: "",
681
728
  title: "",
682
729
  description: "",
@@ -687,826 +734,824 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
687
734
  allowed_in: [],
688
735
  max_per_entity: null,
689
736
  is_enabled: !0
690
- }), T = je({
737
+ }), C = je({
691
738
  schema: [],
692
739
  template: "",
693
740
  styles: "",
694
741
  script: null,
695
742
  sample: {}
696
- }), D = N("[]"), P = N(null), F = N(""), B = N({}), L = N(null), I = je({
743
+ }), D = U("[]"), K = U(null), ne = U(""), z = U({}), N = U(null), I = je({
697
744
  html: "",
698
745
  styles: "",
699
746
  script: null,
700
747
  runtime: null,
701
748
  loading: !1
702
- }), ne = C(() => JSON.stringify({ settings: k, content: T })), re = C(() => F.value !== "" && ne.value !== F.value), Ce = C(() => yl(k.slug, T, n)), Me = C(() => {
703
- const S = [...w.value.groups];
704
- return S.includes(k.group) || S.push(k.group), S.map((b) => ({ value: b, label: ke(b, n) }));
705
- }), Se = C({
706
- get: () => T.sample,
707
- set: (S) => {
708
- T.sample = S;
749
+ }), M = B(() => JSON.stringify({ settings: k, content: C })), O = B(() => ne.value !== "" && M.value !== ne.value), ee = B(() => $l(k.slug, C, a)), de = B(() => {
750
+ const E = [..._.value.groups];
751
+ return E.includes(k.group) || E.push(k.group), E.map((g) => ({ value: g, label: ye(g, a) }));
752
+ }), We = B({
753
+ get: () => C.sample,
754
+ set: (E) => {
755
+ C.sample = E;
709
756
  }
710
- }), ye = C(() => Be(T.schema));
711
- function Be(S) {
712
- const b = [];
713
- for (const j of S)
714
- j.type !== "wx-blocks" && !(j.children?.length && !j.name) && b.push(j.id), j.children && b.push(...Be(j.children));
715
- return b;
757
+ }), Ae = B(() => we(C.schema));
758
+ function we(E) {
759
+ const g = [];
760
+ for (const x of E)
761
+ x.type !== "wx-blocks" && !(x.children?.length && !x.name) && g.push(x.id), x.children && g.push(...we(x.children));
762
+ return g;
716
763
  }
717
- function ue(S) {
718
- c.value = S, Object.assign(k, {
719
- slug: S.slug,
720
- title: S.title,
721
- description: S.description,
722
- icon: S.icon,
723
- group: S.group,
724
- sort: S.sort,
725
- allow: S.allow ?? [],
726
- allowed_in: S.allowed_in ?? [],
727
- max_per_entity: S.max_per_entity,
728
- is_enabled: S.is_enabled
764
+ function pe(E) {
765
+ d.value = E, Object.assign(k, {
766
+ slug: E.slug,
767
+ title: E.title,
768
+ description: E.description,
769
+ icon: E.icon,
770
+ group: E.group,
771
+ sort: E.sort,
772
+ allow: E.allow ?? [],
773
+ allowed_in: E.allowed_in ?? [],
774
+ max_per_entity: E.max_per_entity,
775
+ is_enabled: E.is_enabled
729
776
  });
730
- const b = S.content ?? {
777
+ const g = E.content ?? {
731
778
  schema: [],
732
779
  template: "",
733
780
  styles: "",
734
781
  script: null,
735
782
  sample: {}
736
783
  };
737
- Object.assign(T, ie(b)), D.value = JSON.stringify(b.schema, null, 2), P.value = null, F.value = ne.value;
784
+ Object.assign(C, re(g)), D.value = JSON.stringify(g.schema, null, 2), K.value = null, ne.value = M.value;
738
785
  }
739
- async function we() {
786
+ async function fe() {
740
787
  m.value = !0;
741
788
  try {
742
- ue(await s.get(z.value)), g.value = await s.usage(z.value);
743
- } catch (S) {
744
- q.danger(v(S));
789
+ pe(await n.get(A.value)), b.value = await n.usage(A.value);
790
+ } catch (E) {
791
+ F.danger(v(E));
745
792
  } finally {
746
793
  m.value = !1;
747
794
  }
748
795
  }
749
- function Pe(S) {
750
- D.value = S;
796
+ function Le(E) {
797
+ D.value = E;
751
798
  try {
752
- const b = JSON.parse(S);
753
- if (!Array.isArray(b)) throw new Error("not a list");
754
- T.schema = b, P.value = null;
755
- } catch (b) {
756
- P.value = n("page.schema-invalid", { error: b.message });
799
+ const g = JSON.parse(E);
800
+ if (!Array.isArray(g)) throw new Error("not a list");
801
+ C.schema = g, K.value = null;
802
+ } catch (g) {
803
+ K.value = a("page.schema-invalid", { error: g.message });
757
804
  }
758
805
  }
759
- let E, M = 0;
760
- function O() {
761
- clearTimeout(E), E = setTimeout(() => {
762
- X();
806
+ let _e, T = 0;
807
+ function P() {
808
+ clearTimeout(_e), _e = setTimeout(() => {
809
+ R();
763
810
  }, 250);
764
811
  }
765
- async function X() {
766
- if (!c.value) return;
767
- const S = ++M;
812
+ async function R() {
813
+ if (!d.value) return;
814
+ const E = ++T;
768
815
  I.loading = !0;
769
816
  try {
770
- const b = await s.render(c.value.id, {
771
- values: T.sample,
772
- content: V.value ? {
773
- template: T.template,
774
- styles: T.styles,
775
- script: T.script,
776
- schema: T.schema
817
+ const g = await n.render(d.value.id, {
818
+ values: C.sample,
819
+ content: S.value ? {
820
+ template: C.template,
821
+ styles: C.styles,
822
+ script: C.script,
823
+ schema: C.schema
777
824
  } : void 0
778
825
  });
779
- if (S !== M) return;
780
- I.html = b.html, I.styles = b.styles, I.script = b.script, I.runtime = b.runtime;
781
- } catch (b) {
782
- S === M && q.danger(v(b));
826
+ if (E !== T) return;
827
+ I.html = g.html, I.styles = g.styles, I.script = g.script, I.runtime = g.runtime;
828
+ } catch (g) {
829
+ E === T && F.danger(v(g));
783
830
  } finally {
784
- S === M && (I.loading = !1);
831
+ E === T && (I.loading = !1);
785
832
  }
786
833
  }
787
- oe(
788
- () => [T.template, T.styles, T.script, T.schema, T.sample],
789
- O,
834
+ ie(
835
+ () => [C.template, C.styles, C.script, C.schema, C.sample],
836
+ P,
790
837
  { deep: !0 }
791
838
  );
792
- const Z = N(null);
793
- function Oe(S) {
794
- return `{{ $${S} }}`;
839
+ const Z = U(null);
840
+ function G(E) {
841
+ return `{{ $${E} }}`;
795
842
  }
796
- function _e(S) {
797
- const j = Z.value?.view?.value;
798
- if (!j) {
799
- T.template += `{{ $${S} }}`;
843
+ function Re(E) {
844
+ const x = Z.value?.view?.value;
845
+ if (!x) {
846
+ C.template += `{{ $${E} }}`;
800
847
  return;
801
848
  }
802
- j.dispatch(j.state.replaceSelection(`{{ $${S} }}`)), j.focus();
849
+ x.dispatch(x.state.replaceSelection(`{{ $${E} }}`)), x.focus();
803
850
  }
804
- async function ce() {
805
- if (!c.value) return;
806
- f.value = !0, B.value = {}, L.value = null;
807
- const S = c.value.draft?.number ?? null;
851
+ async function ue() {
852
+ if (!d.value) return;
853
+ h.value = !0, z.value = {}, N.value = null;
854
+ const E = d.value.draft?.number ?? null;
808
855
  try {
809
- const b = await s.update(c.value.id, {
856
+ const g = await n.update(d.value.id, {
810
857
  ...k,
811
858
  allow: k.allow.length ? k.allow : null,
812
859
  allowed_in: k.allowed_in.length ? k.allowed_in : null,
813
860
  description: k.description || null,
814
861
  icon: k.icon || null,
815
- content: P.value ? { ...T, schema: void 0 } : T
862
+ content: K.value ? { ...C, schema: void 0 } : C
816
863
  });
817
- ue(b), q.success(
818
- b.draft && b.draft.number !== S ? n("page.saved", { number: b.draft.number }) : n("page.unchanged")
864
+ pe(g), F.success(
865
+ g.draft && g.draft.number !== E ? a("page.saved", { number: g.draft.number }) : a("page.unchanged")
819
866
  );
820
- } catch (b) {
821
- const j = b.body;
822
- j?.errors ? (B.value = j.errors, q.danger(n("page.failed"))) : q.danger(v(b, n("page.failed")));
867
+ } catch (g) {
868
+ const x = g.body;
869
+ x?.errors ? (z.value = x.errors, F.danger(a("page.failed"))) : F.danger(v(g, a("page.failed")));
823
870
  } finally {
824
- f.value = !1;
871
+ h.value = !1;
825
872
  }
826
873
  }
827
- async function pe() {
828
- if (!(!c.value?.draft || (re.value && await ce(), !c.value.draft) || !await Ie({
829
- title: n("page.publish-title", { number: c.value.draft.number }),
830
- message: n("page.publish-text", { count: c.value.usage_count }),
831
- confirmText: n("page.publish"),
832
- cancelText: n("page.cancel")
874
+ async function xe() {
875
+ if (!(!d.value?.draft || (O.value && await ue(), !d.value.draft) || !await Me({
876
+ title: a("page.publish-title", { number: d.value.draft.number }),
877
+ message: a("page.publish-text", { count: d.value.usage_count }),
878
+ confirmText: a("page.publish"),
879
+ cancelText: a("page.cancel")
833
880
  }))) {
834
- h.value = !0, L.value = null;
881
+ f.value = !0, N.value = null;
835
882
  try {
836
- ue(await s.publish(c.value.id)), q.success(n("page.published", { number: c.value.published?.number ?? 0 }));
837
- } catch (b) {
838
- const j = b.body;
839
- j?.errors ? (L.value = j, y.value = "template", q.danger(n("page.publish-failed"))) : q.danger(v(b, n("page.publish-failed")));
883
+ pe(await n.publish(d.value.id)), F.success(a("page.published", { number: d.value.published?.number ?? 0 }));
884
+ } catch (g) {
885
+ const x = g.body;
886
+ x?.errors ? (N.value = x, y.value = "template", F.danger(a("page.publish-failed"))) : F.danger(v(g, a("page.publish-failed")));
840
887
  } finally {
841
- h.value = !1;
888
+ f.value = !1;
842
889
  }
843
890
  }
844
891
  }
845
- async function We() {
846
- if (!(!c.value || !await Ie({
847
- title: n("page.delete-title", { title: c.value.title }),
848
- message: n("page.delete-text"),
849
- confirmText: n("page.delete"),
850
- cancelText: n("page.cancel"),
892
+ async function $e() {
893
+ if (!(!d.value || !await Me({
894
+ title: a("page.delete-title", { title: d.value.title }),
895
+ message: a("page.delete-text"),
896
+ confirmText: a("page.delete"),
897
+ cancelText: a("page.cancel"),
851
898
  tone: "danger"
852
899
  })))
853
900
  try {
854
- await s.remove(c.value.id), q.success(n("page.deleted")), u.push(l.base);
855
- } catch (b) {
856
- q.danger(v(b));
901
+ await n.remove(d.value.id), F.success(a("page.deleted")), r.push(l.base);
902
+ } catch (g) {
903
+ F.danger(v(g));
857
904
  }
858
905
  }
859
- const De = C(
860
- () => L.value ? {
861
- message: L.value.errors.template?.[0] ?? L.value.message,
862
- line: L.value.line,
863
- where: L.value.entity ? n("page.failed-on", {
864
- title: L.value.entity.title ?? `#${L.value.entity.id}`
906
+ const ze = B(
907
+ () => N.value ? {
908
+ message: N.value.errors.template?.[0] ?? N.value.message,
909
+ line: N.value.line,
910
+ where: N.value.entity ? a("page.failed-on", {
911
+ title: N.value.entity.title ?? `#${N.value.entity.id}`
865
912
  }) : null
866
913
  } : null
867
- ), Re = C(() => g.value.slice(0, 5));
868
- function le(S) {
869
- return B.value[S]?.[0];
914
+ ), Ve = B(() => b.value.slice(0, 5));
915
+ function ae(E) {
916
+ return z.value[E]?.[0];
870
917
  }
871
- function et(S) {
872
- re.value && S.preventDefault();
918
+ function tt(E) {
919
+ O.value && E.preventDefault();
873
920
  }
874
- return xe(() => {
875
- we(), window.addEventListener("beforeunload", et);
921
+ return Ce(() => {
922
+ fe(), window.addEventListener("beforeunload", tt);
876
923
  }), Ze(() => {
877
- clearTimeout(E), window.removeEventListener("beforeunload", et);
878
- }), oe(z, () => {
879
- we();
880
- }), (S, b) => {
881
- const j = Ge("router-link");
882
- return i(), x("div", xl, [
883
- m.value || !c.value ? (i(), x(H, { key: 0 }, [
884
- r(e(me), {
885
- class: "wx-block-editor__ghost-head",
886
- title: "",
887
- rows: 1
924
+ clearTimeout(_e), window.removeEventListener("beforeunload", tt);
925
+ }), ie(A, () => {
926
+ fe();
927
+ }), (E, g) => (i(), V("div", Cl, [
928
+ m.value || !d.value ? (i(), V(H, { key: 0 }, [
929
+ u(e(he), {
930
+ class: "wx-block-editor__ghost-head",
931
+ title: "",
932
+ rows: 1
933
+ }),
934
+ $("div", Tl, [
935
+ u(e(ve), null, {
936
+ default: c(() => [
937
+ u(e(he), { rows: 8 })
938
+ ]),
939
+ _: 1
888
940
  }),
889
- $("div", $l, [
890
- r(e(fe), null, {
891
- default: d(() => [
892
- r(e(me), { rows: 8 })
941
+ u(e(ve), null, {
942
+ default: c(() => [
943
+ u(e(he), { rows: 4 })
944
+ ]),
945
+ _: 1
946
+ })
947
+ ])
948
+ ], 64)) : (i(), V(H, { key: 1 }, [
949
+ $("div", Bl, [
950
+ u(e(Rt), {
951
+ class: "wx-block-editor__back",
952
+ to: t.base,
953
+ label: e(a)("page.back")
954
+ }, null, 8, ["to", "label"]),
955
+ $("div", El, [
956
+ $("div", Wl, [
957
+ $("h1", Al, p(k.title), 1),
958
+ S.value ? (i(), W(e(jt), {
959
+ key: 0,
960
+ name: k.title,
961
+ placeholder: e(a)("page.title"),
962
+ onRename: g[0] || (g[0] = (x) => k.title = x)
963
+ }, null, 8, ["name", "placeholder"])) : L("", !0)
964
+ ]),
965
+ u(e(j), {
966
+ size: "sm",
967
+ tone: "muted"
968
+ }, {
969
+ default: c(() => [
970
+ $("code", null, p(k.slug), 1),
971
+ w(" · " + p(e(ye)(k.group, e(a))) + " · " + p(d.value.usage_count > 0 ? e(a)("page.on-pages", { count: d.value.usage_count }) : e(a)("page.not-used")), 1)
893
972
  ]),
894
973
  _: 1
895
- }),
896
- r(e(fe), null, {
897
- default: d(() => [
898
- r(e(me), { rows: 4 })
974
+ })
975
+ ]),
976
+ $("div", Ll, [
977
+ O.value ? (i(), W(e(J), {
978
+ key: 0,
979
+ type: "primary",
980
+ dot: ""
981
+ }, {
982
+ default: c(() => [
983
+ w(p(e(a)("page.unsaved")), 1)
899
984
  ]),
900
985
  _: 1
901
- })
902
- ])
903
- ], 64)) : (i(), x(H, { key: 1 }, [
904
- $("div", Vl, [
905
- $("div", Tl, [
906
- r(j, {
907
- to: t.base,
908
- class: "wx-block-editor__back"
909
- }, {
910
- default: d(() => [
911
- _("‹ " + p(e(n)("page.back")), 1)
912
- ]),
913
- _: 1
914
- }, 8, ["to"]),
915
- zt($("input", {
916
- "onUpdate:modelValue": b[0] || (b[0] = (U) => k.title = U),
917
- class: "wx-block-editor__title",
918
- "aria-label": e(n)("page.title"),
919
- disabled: !V.value
920
- }, null, 8, Cl), [
921
- [Et, k.title]
986
+ })) : L("", !0),
987
+ d.value.draft ? (i(), W(e(J), {
988
+ key: 1,
989
+ type: "warning",
990
+ dot: ""
991
+ }, {
992
+ default: c(() => [
993
+ w(p(e(a)("page.draft", { number: d.value.draft.number })), 1)
922
994
  ]),
923
- r(e(R), {
924
- size: "sm",
925
- tone: "muted"
995
+ _: 1
996
+ })) : L("", !0),
997
+ d.value.published ? (i(), W(e(J), {
998
+ key: 2,
999
+ type: "success",
1000
+ dot: ""
1001
+ }, {
1002
+ default: c(() => [
1003
+ w(p(e(a)("page.live", { number: d.value.published.number })), 1)
1004
+ ]),
1005
+ _: 1
1006
+ })) : (i(), W(e(J), {
1007
+ key: 3,
1008
+ type: "default"
1009
+ }, {
1010
+ default: c(() => [
1011
+ w(p(e(a)("page.never-published")), 1)
1012
+ ]),
1013
+ _: 1
1014
+ })),
1015
+ S.value ? (i(), V(H, { key: 4 }, [
1016
+ u(e(q), {
1017
+ variant: "outline",
1018
+ loading: h.value,
1019
+ onClick: ue
926
1020
  }, {
927
- default: d(() => [
928
- $("code", null, p(k.slug), 1),
929
- _(" · " + p(e(ke)(k.group, e(n))) + " · " + p(c.value.usage_count > 0 ? e(n)("page.on-pages", { count: c.value.usage_count }) : e(n)("page.not-used")), 1)
1021
+ default: c(() => [
1022
+ w(p(e(a)("page.save")), 1)
930
1023
  ]),
931
1024
  _: 1
932
- })
933
- ]),
934
- $("div", Sl, [
935
- re.value ? (i(), W(e(K), {
936
- key: 0,
1025
+ }, 8, ["loading"]),
1026
+ u(e(q), {
937
1027
  type: "primary",
938
- dot: ""
939
- }, {
940
- default: d(() => [
941
- _(p(e(n)("page.unsaved")), 1)
942
- ]),
943
- _: 1
944
- })) : A("", !0),
945
- c.value.draft ? (i(), W(e(K), {
946
- key: 1,
947
- type: "warning",
948
- dot: ""
949
- }, {
950
- default: d(() => [
951
- _(p(e(n)("page.draft", { number: c.value.draft.number })), 1)
952
- ]),
953
- _: 1
954
- })) : A("", !0),
955
- c.value.published ? (i(), W(e(K), {
956
- key: 2,
957
- type: "success",
958
- dot: ""
959
- }, {
960
- default: d(() => [
961
- _(p(e(n)("page.live", { number: c.value.published.number })), 1)
962
- ]),
963
- _: 1
964
- })) : (i(), W(e(K), {
965
- key: 3,
966
- type: "default"
1028
+ loading: f.value,
1029
+ disabled: !d.value.draft && !O.value,
1030
+ onClick: xe
967
1031
  }, {
968
- default: d(() => [
969
- _(p(e(n)("page.never-published")), 1)
1032
+ default: c(() => [
1033
+ w(p(e(a)("page.publish")), 1)
970
1034
  ]),
971
1035
  _: 1
972
- })),
973
- V.value ? (i(), x(H, { key: 4 }, [
974
- r(e(J), {
975
- variant: "outline",
976
- loading: f.value,
977
- onClick: ce
1036
+ }, 8, ["loading", "disabled"])
1037
+ ], 64)) : L("", !0)
1038
+ ])
1039
+ ]),
1040
+ _.value.editing ? L("", !0) : (i(), W(e(kt), {
1041
+ key: 0,
1042
+ type: "info",
1043
+ variant: "soft",
1044
+ description: e(a)("page.editing-off")
1045
+ }, null, 8, ["description"])),
1046
+ $("div", zl, [
1047
+ $("div", Il, [
1048
+ u(e(Jt), {
1049
+ modelValue: y.value,
1050
+ "onUpdate:modelValue": g[13] || (g[13] = (x) => y.value = x),
1051
+ "keep-alive": ""
1052
+ }, {
1053
+ default: c(() => [
1054
+ u(e(me), {
1055
+ value: "template",
1056
+ label: e(a)("page.tab-template")
978
1057
  }, {
979
- default: d(() => [
980
- _(p(e(n)("page.save")), 1)
1058
+ default: c(() => [
1059
+ $("div", Ul, [
1060
+ u(e(Ie), {
1061
+ ref_key: "templateEditor",
1062
+ ref: Z,
1063
+ modelValue: C.template,
1064
+ "onUpdate:modelValue": g[1] || (g[1] = (x) => C.template = x),
1065
+ language: "php",
1066
+ readonly: !S.value,
1067
+ "min-height": "340px",
1068
+ "max-height": "70vh",
1069
+ "line-wrapping": ""
1070
+ }, null, 8, ["modelValue", "readonly"]),
1071
+ Ae.value.length ? (i(), V("div", Nl, [
1072
+ u(e(j), {
1073
+ size: "sm",
1074
+ tone: "muted"
1075
+ }, {
1076
+ default: c(() => [
1077
+ w(p(e(a)("page.insert-field")), 1)
1078
+ ]),
1079
+ _: 1
1080
+ }),
1081
+ (i(!0), V(H, null, te(Ae.value, (x) => (i(), V("button", {
1082
+ key: x,
1083
+ type: "button",
1084
+ class: "wx-block-editor__pill",
1085
+ disabled: !S.value,
1086
+ onClick: (Qn) => Re(x),
1087
+ textContent: p(G(x))
1088
+ }, null, 8, Pl))), 128))
1089
+ ])) : L("", !0),
1090
+ u(st, {
1091
+ file: "template",
1092
+ lints: ee.value,
1093
+ slug: k.slug,
1094
+ error: ze.value
1095
+ }, null, 8, ["lints", "slug", "error"])
1096
+ ])
981
1097
  ]),
982
1098
  _: 1
983
- }, 8, ["loading"]),
984
- r(e(J), {
985
- type: "primary",
986
- loading: h.value,
987
- disabled: !c.value.draft && !re.value,
988
- onClick: pe
1099
+ }, 8, ["label"]),
1100
+ u(e(me), {
1101
+ value: "styles",
1102
+ label: e(a)("page.tab-styles")
989
1103
  }, {
990
- default: d(() => [
991
- _(p(e(n)("page.publish")), 1)
1104
+ default: c(() => [
1105
+ $("div", Ml, [
1106
+ u(e(Ie), {
1107
+ modelValue: C.styles,
1108
+ "onUpdate:modelValue": g[2] || (g[2] = (x) => C.styles = x),
1109
+ language: "css",
1110
+ readonly: !S.value,
1111
+ "min-height": "340px",
1112
+ "max-height": "70vh"
1113
+ }, null, 8, ["modelValue", "readonly"]),
1114
+ u(st, {
1115
+ file: "styles",
1116
+ lints: ee.value,
1117
+ slug: k.slug
1118
+ }, null, 8, ["lints", "slug"])
1119
+ ])
992
1120
  ]),
993
1121
  _: 1
994
- }, 8, ["loading", "disabled"])
995
- ], 64)) : A("", !0)
996
- ])
997
- ]),
998
- w.value.editing ? A("", !0) : (i(), W(e(mt), {
999
- key: 0,
1000
- type: "info",
1001
- variant: "soft",
1002
- description: e(n)("page.editing-off")
1003
- }, null, 8, ["description"])),
1004
- $("div", Bl, [
1005
- $("div", Wl, [
1006
- r(e(Rt), {
1007
- modelValue: y.value,
1008
- "onUpdate:modelValue": b[13] || (b[13] = (U) => y.value = U),
1009
- "keep-alive": ""
1010
- }, {
1011
- default: d(() => [
1012
- r(e(ve), {
1013
- value: "template",
1014
- label: e(n)("page.tab-template")
1015
- }, {
1016
- default: d(() => [
1017
- $("div", Al, [
1018
- r(e(Ae), {
1019
- ref_key: "templateEditor",
1020
- ref: Z,
1021
- modelValue: T.template,
1022
- "onUpdate:modelValue": b[1] || (b[1] = (U) => T.template = U),
1023
- language: "php",
1024
- readonly: !V.value,
1025
- "min-height": "340px",
1026
- "max-height": "70vh",
1027
- "line-wrapping": ""
1028
- }, null, 8, ["modelValue", "readonly"]),
1029
- ye.value.length ? (i(), x("div", zl, [
1030
- r(e(R), {
1031
- size: "sm",
1032
- tone: "muted"
1122
+ }, 8, ["label"]),
1123
+ u(e(me), {
1124
+ value: "script",
1125
+ label: e(a)("page.tab-script")
1126
+ }, {
1127
+ default: c(() => [
1128
+ $("div", Ol, [
1129
+ u(e(Ie), {
1130
+ "model-value": C.script ?? "",
1131
+ language: "javascript",
1132
+ readonly: !S.value,
1133
+ "min-height": "340px",
1134
+ "max-height": "70vh",
1135
+ "onUpdate:modelValue": g[3] || (g[3] = (x) => C.script = x || null)
1136
+ }, null, 8, ["model-value", "readonly"]),
1137
+ $("div", Dl, [
1138
+ u(e(j), {
1139
+ size: "sm",
1140
+ tone: "muted"
1141
+ }, {
1142
+ default: c(() => [
1143
+ w(p(e(a)("page.script-help")), 1)
1144
+ ]),
1145
+ _: 1
1146
+ }),
1147
+ u(e(j), {
1148
+ size: "sm",
1149
+ tone: "muted"
1150
+ }, {
1151
+ default: c(() => [
1152
+ w(p(_.value.provides.length ? e(a)("page.provides", { names: _.value.provides.join(", ") }) : e(a)("page.provides-none")), 1)
1153
+ ]),
1154
+ _: 1
1155
+ })
1156
+ ])
1157
+ ])
1158
+ ]),
1159
+ _: 1
1160
+ }, 8, ["label"]),
1161
+ u(e(me), {
1162
+ value: "fields",
1163
+ label: e(a)("page.tab-fields")
1164
+ }, {
1165
+ default: c(() => [
1166
+ $("div", Rl, [
1167
+ u(e(Ie), {
1168
+ "model-value": D.value,
1169
+ language: "json",
1170
+ lint: "",
1171
+ readonly: !S.value,
1172
+ "min-height": "340px",
1173
+ "max-height": "70vh",
1174
+ "onUpdate:modelValue": Le
1175
+ }, null, 8, ["model-value", "readonly"]),
1176
+ $("div", jl, [
1177
+ K.value ? (i(), W(e(j), {
1178
+ key: 0,
1179
+ size: "sm",
1180
+ tone: "danger"
1181
+ }, {
1182
+ default: c(() => [
1183
+ w(p(K.value), 1)
1184
+ ]),
1185
+ _: 1
1186
+ })) : ae("content.schema") ? (i(), W(e(j), {
1187
+ key: 1,
1188
+ size: "sm",
1189
+ tone: "danger"
1190
+ }, {
1191
+ default: c(() => [
1192
+ w(p(ae("content.schema")), 1)
1193
+ ]),
1194
+ _: 1
1195
+ })) : (i(), W(e(j), {
1196
+ key: 2,
1197
+ size: "sm",
1198
+ tone: "muted"
1199
+ }, {
1200
+ default: c(() => [
1201
+ w(p(e(a)("page.fields-help")), 1)
1202
+ ]),
1203
+ _: 1
1204
+ })),
1205
+ u(e(Ht), {
1206
+ title: e(a)("help.schema-title"),
1207
+ body: e(a)("help.schema")
1208
+ }, null, 8, ["title", "body"])
1209
+ ])
1210
+ ])
1211
+ ]),
1212
+ _: 1
1213
+ }, 8, ["label"]),
1214
+ u(e(me), {
1215
+ value: "settings",
1216
+ label: e(a)("page.tab-settings")
1217
+ }, {
1218
+ default: c(() => [
1219
+ u(e(ve), { class: "wx-block-editor__sheet" }, {
1220
+ default: c(() => [
1221
+ $("div", Hl, [
1222
+ u(e(Y), {
1223
+ label: e(a)("page.identifier"),
1224
+ help: e(a)("page.identifier-help"),
1225
+ error: ae("slug"),
1226
+ disabled: !S.value
1033
1227
  }, {
1034
- default: d(() => [
1035
- _(p(e(n)("page.insert-field")), 1)
1228
+ default: c(() => [
1229
+ u(e(ge), {
1230
+ modelValue: k.slug,
1231
+ "onUpdate:modelValue": g[4] || (g[4] = (x) => k.slug = x)
1232
+ }, null, 8, ["modelValue"])
1036
1233
  ]),
1037
1234
  _: 1
1038
- }),
1039
- (i(!0), x(H, null, ee(ye.value, (U) => (i(), x("button", {
1040
- key: U,
1041
- type: "button",
1042
- class: "wx-block-editor__pill",
1043
- disabled: !V.value,
1044
- onClick: (qn) => _e(U),
1045
- textContent: p(Oe(U))
1046
- }, null, 8, El))), 128))
1047
- ])) : A("", !0),
1048
- r(at, {
1049
- file: "template",
1050
- lints: Ce.value,
1051
- slug: k.slug,
1052
- error: De.value
1053
- }, null, 8, ["lints", "slug", "error"])
1054
- ])
1055
- ]),
1056
- _: 1
1057
- }, 8, ["label"]),
1058
- r(e(ve), {
1059
- value: "styles",
1060
- label: e(n)("page.tab-styles")
1061
- }, {
1062
- default: d(() => [
1063
- $("div", Ul, [
1064
- r(e(Ae), {
1065
- modelValue: T.styles,
1066
- "onUpdate:modelValue": b[2] || (b[2] = (U) => T.styles = U),
1067
- language: "css",
1068
- readonly: !V.value,
1069
- "min-height": "340px",
1070
- "max-height": "70vh"
1071
- }, null, 8, ["modelValue", "readonly"]),
1072
- r(at, {
1073
- file: "styles",
1074
- lints: Ce.value,
1075
- slug: k.slug
1076
- }, null, 8, ["lints", "slug"])
1077
- ])
1078
- ]),
1079
- _: 1
1080
- }, 8, ["label"]),
1081
- r(e(ve), {
1082
- value: "script",
1083
- label: e(n)("page.tab-script")
1084
- }, {
1085
- default: d(() => [
1086
- $("div", Il, [
1087
- r(e(Ae), {
1088
- "model-value": T.script ?? "",
1089
- language: "javascript",
1090
- readonly: !V.value,
1091
- "min-height": "340px",
1092
- "max-height": "70vh",
1093
- "onUpdate:modelValue": b[3] || (b[3] = (U) => T.script = U || null)
1094
- }, null, 8, ["model-value", "readonly"]),
1095
- $("div", Nl, [
1096
- r(e(R), {
1097
- size: "sm",
1098
- tone: "muted"
1235
+ }, 8, ["label", "help", "error", "disabled"]),
1236
+ u(e(Y), {
1237
+ label: e(a)("page.group"),
1238
+ help: e(a)("page.group-help"),
1239
+ error: ae("group"),
1240
+ disabled: !S.value
1099
1241
  }, {
1100
- default: d(() => [
1101
- _(p(e(n)("page.script-help")), 1)
1242
+ default: c(() => [
1243
+ u(e(yt), {
1244
+ modelValue: k.group,
1245
+ "onUpdate:modelValue": g[5] || (g[5] = (x) => k.group = x),
1246
+ options: de.value
1247
+ }, null, 8, ["modelValue", "options"])
1102
1248
  ]),
1103
1249
  _: 1
1104
- }),
1105
- r(e(R), {
1106
- size: "sm",
1107
- tone: "muted"
1250
+ }, 8, ["label", "help", "error", "disabled"]),
1251
+ u(e(Y), {
1252
+ class: "is-wide",
1253
+ label: e(a)("page.description"),
1254
+ help: e(a)("page.description-help"),
1255
+ error: ae("description"),
1256
+ disabled: !S.value
1108
1257
  }, {
1109
- default: d(() => [
1110
- _(p(w.value.provides.length ? e(n)("page.provides", { names: w.value.provides.join(", ") }) : e(n)("page.provides-none")), 1)
1258
+ default: c(() => [
1259
+ u(e(Kt), {
1260
+ "model-value": k.description ?? "",
1261
+ rows: 2,
1262
+ "onUpdate:modelValue": g[6] || (g[6] = (x) => k.description = String(x ?? ""))
1263
+ }, null, 8, ["model-value"])
1111
1264
  ]),
1112
1265
  _: 1
1113
- })
1114
- ])
1115
- ])
1116
- ]),
1117
- _: 1
1118
- }, 8, ["label"]),
1119
- r(e(ve), {
1120
- value: "fields",
1121
- label: e(n)("page.tab-fields")
1122
- }, {
1123
- default: d(() => [
1124
- $("div", Ll, [
1125
- r(e(Ae), {
1126
- "model-value": D.value,
1127
- language: "json",
1128
- lint: "",
1129
- readonly: !V.value,
1130
- "min-height": "340px",
1131
- "max-height": "70vh",
1132
- "onUpdate:modelValue": Pe
1133
- }, null, 8, ["model-value", "readonly"]),
1134
- $("div", Ml, [
1135
- P.value ? (i(), W(e(R), {
1136
- key: 0,
1137
- size: "sm",
1138
- tone: "danger"
1266
+ }, 8, ["label", "help", "error", "disabled"]),
1267
+ u(e(Y), {
1268
+ label: e(a)("page.icon"),
1269
+ error: ae("icon"),
1270
+ disabled: !S.value
1139
1271
  }, {
1140
- default: d(() => [
1141
- _(p(P.value), 1)
1272
+ default: c(() => [
1273
+ u(e(ge), {
1274
+ "model-value": k.icon ?? "",
1275
+ placeholder: "grid",
1276
+ "onUpdate:modelValue": g[7] || (g[7] = (x) => k.icon = String(x ?? ""))
1277
+ }, null, 8, ["model-value"])
1142
1278
  ]),
1143
1279
  _: 1
1144
- })) : le("content.schema") ? (i(), W(e(R), {
1145
- key: 1,
1146
- size: "sm",
1147
- tone: "danger"
1280
+ }, 8, ["label", "error", "disabled"]),
1281
+ u(e(Y), {
1282
+ label: e(a)("page.sort"),
1283
+ help: e(a)("page.sort-help"),
1284
+ error: ae("sort"),
1285
+ disabled: !S.value
1148
1286
  }, {
1149
- default: d(() => [
1150
- _(p(le("content.schema")), 1)
1287
+ default: c(() => [
1288
+ u(e(nt), {
1289
+ modelValue: k.sort,
1290
+ "onUpdate:modelValue": g[8] || (g[8] = (x) => k.sort = x)
1291
+ }, null, 8, ["modelValue"])
1151
1292
  ]),
1152
1293
  _: 1
1153
- })) : (i(), W(e(R), {
1154
- key: 2,
1155
- size: "sm",
1156
- tone: "muted"
1294
+ }, 8, ["label", "help", "error", "disabled"]),
1295
+ u(e(Y), {
1296
+ label: e(a)("page.allow"),
1297
+ help: e(a)("page.allow-help"),
1298
+ error: ae("allow"),
1299
+ disabled: !S.value
1157
1300
  }, {
1158
- default: d(() => [
1159
- _(p(e(n)("page.fields-help")), 1)
1301
+ default: c(() => [
1302
+ u(e(at), {
1303
+ modelValue: k.allow,
1304
+ "onUpdate:modelValue": g[9] || (g[9] = (x) => k.allow = x),
1305
+ "allow-create": ""
1306
+ }, null, 8, ["modelValue"])
1160
1307
  ]),
1161
1308
  _: 1
1162
- }))
1163
- ])
1164
- ])
1165
- ]),
1166
- _: 1
1167
- }, 8, ["label"]),
1168
- r(e(ve), {
1169
- value: "settings",
1170
- label: e(n)("page.tab-settings")
1171
- }, {
1172
- default: d(() => [
1173
- r(e(fe), { class: "wx-block-editor__sheet" }, {
1174
- default: d(() => [
1175
- $("div", Pl, [
1176
- r(e(G), {
1177
- label: e(n)("page.identifier"),
1178
- help: e(n)("page.identifier-help"),
1179
- error: le("slug"),
1180
- disabled: !V.value
1181
- }, {
1182
- default: d(() => [
1183
- r(e(be), {
1184
- modelValue: k.slug,
1185
- "onUpdate:modelValue": b[4] || (b[4] = (U) => k.slug = U)
1186
- }, null, 8, ["modelValue"])
1187
- ]),
1188
- _: 1
1189
- }, 8, ["label", "help", "error", "disabled"]),
1190
- r(e(G), {
1191
- label: e(n)("page.group"),
1192
- help: e(n)("page.group-help"),
1193
- error: le("group"),
1194
- disabled: !V.value
1195
- }, {
1196
- default: d(() => [
1197
- r(e(ht), {
1198
- modelValue: k.group,
1199
- "onUpdate:modelValue": b[5] || (b[5] = (U) => k.group = U),
1200
- options: Me.value
1201
- }, null, 8, ["modelValue", "options"])
1202
- ]),
1203
- _: 1
1204
- }, 8, ["label", "help", "error", "disabled"]),
1205
- r(e(G), {
1206
- class: "is-wide",
1207
- label: e(n)("page.description"),
1208
- help: e(n)("page.description-help"),
1209
- error: le("description"),
1210
- disabled: !V.value
1211
- }, {
1212
- default: d(() => [
1213
- r(e(jt), {
1214
- "model-value": k.description ?? "",
1215
- rows: 2,
1216
- "onUpdate:modelValue": b[6] || (b[6] = (U) => k.description = String(U ?? ""))
1217
- }, null, 8, ["model-value"])
1218
- ]),
1219
- _: 1
1220
- }, 8, ["label", "help", "error", "disabled"]),
1221
- r(e(G), {
1222
- label: e(n)("page.icon"),
1223
- error: le("icon"),
1224
- disabled: !V.value
1225
- }, {
1226
- default: d(() => [
1227
- r(e(be), {
1228
- "model-value": k.icon ?? "",
1229
- placeholder: "grid",
1230
- "onUpdate:modelValue": b[7] || (b[7] = (U) => k.icon = String(U ?? ""))
1231
- }, null, 8, ["model-value"])
1232
- ]),
1233
- _: 1
1234
- }, 8, ["label", "error", "disabled"]),
1235
- r(e(G), {
1236
- label: e(n)("page.sort"),
1237
- help: e(n)("page.sort-help"),
1238
- error: le("sort"),
1239
- disabled: !V.value
1240
- }, {
1241
- default: d(() => [
1242
- r(e(lt), {
1243
- modelValue: k.sort,
1244
- "onUpdate:modelValue": b[8] || (b[8] = (U) => k.sort = U)
1245
- }, null, 8, ["modelValue"])
1246
- ]),
1247
- _: 1
1248
- }, 8, ["label", "help", "error", "disabled"]),
1249
- r(e(G), {
1250
- label: e(n)("page.allow"),
1251
- help: e(n)("page.allow-help"),
1252
- error: le("allow"),
1253
- disabled: !V.value
1254
- }, {
1255
- default: d(() => [
1256
- r(e(nt), {
1257
- modelValue: k.allow,
1258
- "onUpdate:modelValue": b[9] || (b[9] = (U) => k.allow = U),
1259
- "allow-create": ""
1260
- }, null, 8, ["modelValue"])
1261
- ]),
1262
- _: 1
1263
- }, 8, ["label", "help", "error", "disabled"]),
1264
- r(e(G), {
1265
- label: e(n)("page.allowed-in"),
1266
- help: e(n)("page.allowed-in-help"),
1267
- error: le("allowed_in"),
1268
- disabled: !V.value
1269
- }, {
1270
- default: d(() => [
1271
- r(e(nt), {
1272
- modelValue: k.allowed_in,
1273
- "onUpdate:modelValue": b[10] || (b[10] = (U) => k.allowed_in = U),
1274
- "allow-create": "",
1275
- suggestions: ["root"]
1276
- }, null, 8, ["modelValue"])
1277
- ]),
1278
- _: 1
1279
- }, 8, ["label", "help", "error", "disabled"]),
1280
- r(e(G), {
1281
- label: e(n)("page.max-per-entity"),
1282
- help: e(n)("page.max-per-entity-help"),
1283
- error: le("max_per_entity"),
1284
- disabled: !V.value
1309
+ }, 8, ["label", "help", "error", "disabled"]),
1310
+ u(e(Y), {
1311
+ label: e(a)("page.allowed-in"),
1312
+ help: e(a)("page.allowed-in-help"),
1313
+ error: ae("allowed_in"),
1314
+ disabled: !S.value
1315
+ }, {
1316
+ default: c(() => [
1317
+ u(e(at), {
1318
+ modelValue: k.allowed_in,
1319
+ "onUpdate:modelValue": g[10] || (g[10] = (x) => k.allowed_in = x),
1320
+ "allow-create": "",
1321
+ suggestions: ["root"]
1322
+ }, null, 8, ["modelValue"])
1323
+ ]),
1324
+ _: 1
1325
+ }, 8, ["label", "help", "error", "disabled"]),
1326
+ u(e(Y), {
1327
+ label: e(a)("page.max-per-entity"),
1328
+ help: e(a)("page.max-per-entity-help"),
1329
+ error: ae("max_per_entity"),
1330
+ disabled: !S.value
1331
+ }, {
1332
+ default: c(() => [
1333
+ u(e(nt), {
1334
+ "model-value": k.max_per_entity ?? void 0,
1335
+ min: 1,
1336
+ "onUpdate:modelValue": g[11] || (g[11] = (x) => k.max_per_entity = x ?? null)
1337
+ }, null, 8, ["model-value"])
1338
+ ]),
1339
+ _: 1
1340
+ }, 8, ["label", "help", "error", "disabled"]),
1341
+ u(e(Y), {
1342
+ label: e(a)("page.enabled"),
1343
+ help: e(a)("page.enabled-help"),
1344
+ disabled: !S.value
1345
+ }, {
1346
+ default: c(() => [
1347
+ u(e(Zt), {
1348
+ modelValue: k.is_enabled,
1349
+ "onUpdate:modelValue": g[12] || (g[12] = (x) => k.is_enabled = x)
1350
+ }, null, 8, ["modelValue"])
1351
+ ]),
1352
+ _: 1
1353
+ }, 8, ["label", "help", "disabled"]),
1354
+ S.value ? (i(), V("div", Fl, [
1355
+ u(e(q), {
1356
+ type: "danger",
1357
+ variant: "outline",
1358
+ disabled: d.value.usage_count > 0,
1359
+ onClick: $e
1285
1360
  }, {
1286
- default: d(() => [
1287
- r(e(lt), {
1288
- "model-value": k.max_per_entity ?? void 0,
1289
- min: 1,
1290
- "onUpdate:modelValue": b[11] || (b[11] = (U) => k.max_per_entity = U ?? null)
1291
- }, null, 8, ["model-value"])
1361
+ default: c(() => [
1362
+ w(p(e(a)("page.delete")), 1)
1292
1363
  ]),
1293
1364
  _: 1
1294
- }, 8, ["label", "help", "error", "disabled"]),
1295
- r(e(G), {
1296
- label: e(n)("page.enabled"),
1297
- help: e(n)("page.enabled-help"),
1298
- disabled: !V.value
1365
+ }, 8, ["disabled"]),
1366
+ d.value.usage_count > 0 ? (i(), W(e(j), {
1367
+ key: 0,
1368
+ size: "sm",
1369
+ tone: "muted"
1299
1370
  }, {
1300
- default: d(() => [
1301
- r(e(Ht), {
1302
- modelValue: k.is_enabled,
1303
- "onUpdate:modelValue": b[12] || (b[12] = (U) => k.is_enabled = U)
1304
- }, null, 8, ["modelValue"])
1371
+ default: c(() => [
1372
+ w(p(e(a)("page.delete-used", { count: d.value.usage_count })), 1)
1305
1373
  ]),
1306
1374
  _: 1
1307
- }, 8, ["label", "help", "disabled"]),
1308
- V.value ? (i(), x("div", Ol, [
1309
- r(e(J), {
1310
- type: "danger",
1311
- variant: "outline",
1312
- disabled: c.value.usage_count > 0,
1313
- onClick: We
1314
- }, {
1315
- default: d(() => [
1316
- _(p(e(n)("page.delete")), 1)
1317
- ]),
1318
- _: 1
1319
- }, 8, ["disabled"]),
1320
- c.value.usage_count > 0 ? (i(), W(e(R), {
1321
- key: 0,
1322
- size: "sm",
1323
- tone: "muted"
1324
- }, {
1325
- default: d(() => [
1326
- _(p(e(n)("page.delete-used", { count: c.value.usage_count })), 1)
1327
- ]),
1328
- _: 1
1329
- })) : A("", !0)
1330
- ])) : A("", !0)
1331
- ])
1332
- ]),
1333
- _: 1
1334
- })
1335
- ]),
1336
- _: 1
1337
- }, 8, ["label"]),
1338
- r(e(ve), {
1339
- value: "history",
1340
- label: e(n)("page.tab-history")
1341
- }, {
1342
- default: d(() => [
1343
- r(e(fe), {
1344
- class: "wx-block-editor__sheet",
1345
- padding: "none"
1346
- }, {
1347
- default: d(() => [
1348
- r(tl, {
1349
- block: c.value,
1350
- "can-manage": V.value,
1351
- onRestored: ue
1352
- }, null, 8, ["block", "can-manage"])
1353
- ]),
1354
- _: 1
1355
- })
1356
- ]),
1357
- _: 1
1358
- }, 8, ["label"])
1359
- ]),
1360
- _: 1
1361
- }, 8, ["modelValue"])
1362
- ]),
1363
- $("div", Dl, [
1364
- r(ul, {
1365
- html: I.html,
1366
- styles: I.styles,
1367
- script: I.script,
1368
- runtime: I.runtime,
1369
- loading: I.loading
1370
- }, null, 8, ["html", "styles", "script", "runtime", "loading"]),
1371
- r(e(fe), {
1372
- title: e(n)("page.sample")
1373
- }, {
1374
- default: d(() => [
1375
- T.schema.length ? (i(), W(e(wt), {
1376
- key: 0,
1377
- modelValue: Se.value,
1378
- "onUpdate:modelValue": b[14] || (b[14] = (U) => Se.value = U),
1379
- root: e(Qe)(T.schema),
1380
- types: e(a).types,
1381
- translate: e(a).i18n.t,
1382
- can: e(a).can,
1383
- disabled: !V.value,
1384
- size: "sm"
1385
- }, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : A("", !0),
1386
- r(e(R), {
1387
- size: "sm",
1388
- tone: "muted"
1389
- }, {
1390
- default: d(() => [
1391
- _(p(e(n)("page.sample-help")), 1)
1392
- ]),
1393
- _: 1
1394
- })
1395
- ]),
1396
- _: 1
1397
- }, 8, ["title"]),
1398
- r(e(fe), {
1399
- title: e(n)("page.usage")
1400
- }, {
1401
- default: d(() => [
1402
- g.value.length === 0 ? (i(), W(e(R), {
1375
+ })) : L("", !0)
1376
+ ])) : L("", !0)
1377
+ ])
1378
+ ]),
1379
+ _: 1
1380
+ })
1381
+ ]),
1382
+ _: 1
1383
+ }, 8, ["label"]),
1384
+ u(e(me), {
1385
+ value: "history",
1386
+ label: e(a)("page.tab-history")
1387
+ }, {
1388
+ default: c(() => [
1389
+ u(e(ve), {
1390
+ class: "wx-block-editor__sheet",
1391
+ padding: "none"
1392
+ }, {
1393
+ default: c(() => [
1394
+ u(ol, {
1395
+ block: d.value,
1396
+ "can-manage": S.value,
1397
+ onRestored: pe
1398
+ }, null, 8, ["block", "can-manage"])
1399
+ ]),
1400
+ _: 1
1401
+ })
1402
+ ]),
1403
+ _: 1
1404
+ }, 8, ["label"])
1405
+ ]),
1406
+ _: 1
1407
+ }, 8, ["modelValue"])
1408
+ ]),
1409
+ $("div", ql, [
1410
+ u(fl, {
1411
+ html: I.html,
1412
+ styles: I.styles,
1413
+ script: I.script,
1414
+ runtime: I.runtime,
1415
+ loading: I.loading
1416
+ }, null, 8, ["html", "styles", "script", "runtime", "loading"]),
1417
+ u(e(ve), {
1418
+ title: e(a)("page.sample")
1419
+ }, {
1420
+ default: c(() => [
1421
+ C.schema.length ? (i(), W(e(Vt), {
1422
+ key: 0,
1423
+ modelValue: We.value,
1424
+ "onUpdate:modelValue": g[14] || (g[14] = (x) => We.value = x),
1425
+ root: e(Xe)(C.schema),
1426
+ types: e(s).types,
1427
+ translate: e(s).i18n.t,
1428
+ can: e(s).can,
1429
+ disabled: !S.value,
1430
+ size: "sm"
1431
+ }, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : L("", !0),
1432
+ u(e(j), {
1433
+ size: "sm",
1434
+ tone: "muted"
1435
+ }, {
1436
+ default: c(() => [
1437
+ w(p(e(a)("page.sample-help")), 1)
1438
+ ]),
1439
+ _: 1
1440
+ })
1441
+ ]),
1442
+ _: 1
1443
+ }, 8, ["title"]),
1444
+ u(e(ve), {
1445
+ title: e(a)("page.usage")
1446
+ }, {
1447
+ default: c(() => [
1448
+ b.value.length === 0 ? (i(), W(e(j), {
1449
+ key: 0,
1450
+ size: "sm",
1451
+ tone: "muted"
1452
+ }, {
1453
+ default: c(() => [
1454
+ w(p(e(a)("page.usage-empty")), 1)
1455
+ ]),
1456
+ _: 1
1457
+ })) : (i(), V("div", Jl, [
1458
+ (i(!0), V(H, null, te(Ve.value, (x) => (i(), V("div", {
1459
+ key: `${x.model}:${x.id}`,
1460
+ class: "wx-block-editor__use"
1461
+ }, [
1462
+ $("span", null, p(x.title ?? `#${x.id}`), 1),
1463
+ x.published ? L("", !0) : (i(), W(e(J), {
1464
+ key: 0,
1465
+ type: "warning",
1466
+ size: "sm"
1467
+ }, {
1468
+ default: c(() => [
1469
+ w(p(e(a)("page.unpublished-page")), 1)
1470
+ ]),
1471
+ _: 1
1472
+ }))
1473
+ ]))), 128)),
1474
+ b.value.length > Ve.value.length ? (i(), W(e(j), {
1403
1475
  key: 0,
1404
1476
  size: "sm",
1405
1477
  tone: "muted"
1406
1478
  }, {
1407
- default: d(() => [
1408
- _(p(e(n)("page.usage-empty")), 1)
1479
+ default: c(() => [
1480
+ w(p(e(a)("page.usage-more", { count: b.value.length - Ve.value.length })), 1)
1409
1481
  ]),
1410
1482
  _: 1
1411
- })) : (i(), x("div", Rl, [
1412
- (i(!0), x(H, null, ee(Re.value, (U) => (i(), x("div", {
1413
- key: `${U.model}:${U.id}`,
1414
- class: "wx-block-editor__use"
1415
- }, [
1416
- $("span", null, p(U.title ?? `#${U.id}`), 1),
1417
- U.published ? A("", !0) : (i(), W(e(K), {
1418
- key: 0,
1419
- type: "warning",
1420
- size: "sm"
1421
- }, {
1422
- default: d(() => [
1423
- _(p(e(n)("page.unpublished-page")), 1)
1424
- ]),
1425
- _: 1
1426
- }))
1427
- ]))), 128)),
1428
- g.value.length > Re.value.length ? (i(), W(e(R), {
1429
- key: 0,
1430
- size: "sm",
1431
- tone: "muted"
1432
- }, {
1433
- default: d(() => [
1434
- _(p(e(n)("page.usage-more", { count: g.value.length - Re.value.length })), 1)
1435
- ]),
1436
- _: 1
1437
- })) : A("", !0)
1438
- ]))
1439
- ]),
1440
- _: 1
1441
- }, 8, ["title"])
1442
- ])
1483
+ })) : L("", !0)
1484
+ ]))
1485
+ ]),
1486
+ _: 1
1487
+ }, 8, ["title"])
1488
+ ])
1489
+ ]),
1490
+ S.value ? (i(), W(e(Gt), { key: 1 }, {
1491
+ state: c(() => [
1492
+ O.value ? (i(), W(e(J), {
1493
+ key: 0,
1494
+ type: "primary",
1495
+ dot: ""
1496
+ }, {
1497
+ default: c(() => [
1498
+ w(p(e(a)("page.unsaved")), 1)
1499
+ ]),
1500
+ _: 1
1501
+ })) : L("", !0),
1502
+ d.value.draft ? (i(), W(e(J), {
1503
+ key: 1,
1504
+ type: "warning",
1505
+ dot: ""
1506
+ }, {
1507
+ default: c(() => [
1508
+ w(p(e(a)("page.draft", { number: d.value.draft.number })), 1)
1509
+ ]),
1510
+ _: 1
1511
+ })) : L("", !0),
1512
+ d.value.published ? (i(), W(e(J), {
1513
+ key: 2,
1514
+ type: "success",
1515
+ dot: ""
1516
+ }, {
1517
+ default: c(() => [
1518
+ w(p(e(a)("page.live", { number: d.value.published.number })), 1)
1519
+ ]),
1520
+ _: 1
1521
+ })) : L("", !0)
1443
1522
  ]),
1444
- V.value ? (i(), W(e(Ft), { key: 1 }, {
1445
- state: d(() => [
1446
- re.value ? (i(), W(e(K), {
1447
- key: 0,
1448
- type: "primary",
1449
- dot: ""
1450
- }, {
1451
- default: d(() => [
1452
- _(p(e(n)("page.unsaved")), 1)
1453
- ]),
1454
- _: 1
1455
- })) : A("", !0),
1456
- c.value.draft ? (i(), W(e(K), {
1457
- key: 1,
1458
- type: "warning",
1459
- dot: ""
1460
- }, {
1461
- default: d(() => [
1462
- _(p(e(n)("page.draft", { number: c.value.draft.number })), 1)
1463
- ]),
1464
- _: 1
1465
- })) : A("", !0),
1466
- c.value.published ? (i(), W(e(K), {
1467
- key: 2,
1468
- type: "success",
1469
- dot: ""
1470
- }, {
1471
- default: d(() => [
1472
- _(p(e(n)("page.live", { number: c.value.published.number })), 1)
1473
- ]),
1474
- _: 1
1475
- })) : A("", !0)
1476
- ]),
1477
- default: d(() => [
1478
- r(e(J), {
1479
- variant: "outline",
1480
- loading: f.value,
1481
- onClick: ce
1482
- }, {
1483
- default: d(() => [
1484
- _(p(e(n)("page.save")), 1)
1485
- ]),
1486
- _: 1
1487
- }, 8, ["loading"]),
1488
- r(e(J), {
1489
- type: "primary",
1490
- loading: h.value,
1491
- disabled: !c.value.draft && !re.value,
1492
- onClick: pe
1493
- }, {
1494
- default: d(() => [
1495
- _(p(e(n)("page.publish")), 1)
1496
- ]),
1497
- _: 1
1498
- }, 8, ["loading", "disabled"])
1499
- ]),
1500
- _: 1
1501
- })) : A("", !0)
1502
- ], 64))
1503
- ]);
1504
- };
1523
+ default: c(() => [
1524
+ u(e(q), {
1525
+ variant: "outline",
1526
+ loading: h.value,
1527
+ onClick: ue
1528
+ }, {
1529
+ default: c(() => [
1530
+ w(p(e(a)("page.save")), 1)
1531
+ ]),
1532
+ _: 1
1533
+ }, 8, ["loading"]),
1534
+ u(e(q), {
1535
+ type: "primary",
1536
+ loading: f.value,
1537
+ disabled: !d.value.draft && !O.value,
1538
+ onClick: xe
1539
+ }, {
1540
+ default: c(() => [
1541
+ w(p(e(a)("page.publish")), 1)
1542
+ ]),
1543
+ _: 1
1544
+ }, 8, ["loading", "disabled"])
1545
+ ]),
1546
+ _: 1
1547
+ })) : L("", !0)
1548
+ ], 64))
1549
+ ]));
1505
1550
  }
1506
- }), Hl = /* @__PURE__ */ Q(jl, [["__scopeId", "data-v-c6f731c6"]]), Fl = ["srcdoc"], ql = {
1551
+ }), Zl = /* @__PURE__ */ X(Kl, [["__scopeId", "data-v-ae45e358"]]), Gl = ["srcdoc"], Yl = {
1507
1552
  key: 1,
1508
1553
  class: "wx-block-thumb__empty"
1509
- }, Jl = /* @__PURE__ */ Y({
1554
+ }, Ql = /* @__PURE__ */ Q({
1510
1555
  __name: "BlockThumb",
1511
1556
  props: {
1512
1557
  thumbnail: {},
@@ -1514,36 +1559,36 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1514
1559
  height: { default: 120 }
1515
1560
  },
1516
1561
  setup(t) {
1517
- const l = t, a = N(null), s = Ye(a), o = C(() => s.value > 0 ? s.value / l.width : 0.2), u = C(
1518
- () => l.thumbnail ? xt({ html: l.thumbnail.html, styles: l.thumbnail.styles }) : ""
1519
- ), n = C(() => ({
1562
+ const l = t, s = U(null), n = Ge(s), o = B(() => n.value > 0 ? n.value / l.width : 0.2), r = B(
1563
+ () => l.thumbnail ? Ct({ html: l.thumbnail.html, styles: l.thumbnail.styles }) : ""
1564
+ ), a = B(() => ({
1520
1565
  width: `${l.width}px`,
1521
1566
  height: `${Math.round(l.height / o.value)}px`,
1522
1567
  transform: `scale(${o.value})`
1523
1568
  }));
1524
- return (v, z) => (i(), x("div", {
1569
+ return (v, A) => (i(), V("div", {
1525
1570
  ref_key: "box",
1526
- ref: a,
1571
+ ref: s,
1527
1572
  class: "wx-block-thumb",
1528
- style: de({ height: `${t.height}px` })
1573
+ style: ce({ height: `${t.height}px` })
1529
1574
  }, [
1530
- t.thumbnail ? (i(), x("iframe", {
1575
+ t.thumbnail ? (i(), V("iframe", {
1531
1576
  key: 0,
1532
1577
  class: "wx-block-thumb__frame",
1533
- srcdoc: u.value,
1534
- style: de(n.value),
1578
+ srcdoc: r.value,
1579
+ style: ce(a.value),
1535
1580
  sandbox: "allow-same-origin",
1536
1581
  tabindex: "-1",
1537
1582
  "aria-hidden": "true"
1538
- }, null, 12, Fl)) : (i(), x("div", ql, [
1539
- r(e(ae), { name: "grid" })
1583
+ }, null, 12, Gl)) : (i(), V("div", Yl, [
1584
+ u(e(oe), { name: "grid" })
1540
1585
  ]))
1541
1586
  ], 4));
1542
1587
  }
1543
- }), At = /* @__PURE__ */ Q(Jl, [["__scopeId", "data-v-615b818a"]]), Kl = { class: "wx-block-picker" }, Zl = {
1588
+ }), It = /* @__PURE__ */ X(Ql, [["__scopeId", "data-v-615b818a"]]), Xl = { class: "wx-block-picker" }, en = {
1544
1589
  key: 0,
1545
1590
  class: "wx-block-picker__group-title"
1546
- }, Gl = { class: "wx-block-picker__cards" }, Yl = ["disabled", "title", "onClick"], Ql = { class: "wx-block-picker__body" }, Xl = { class: "wx-block-picker__title" }, en = /* @__PURE__ */ Y({
1591
+ }, tn = { class: "wx-block-picker__cards" }, ln = ["disabled", "title", "onClick"], nn = { class: "wx-block-picker__body" }, an = { class: "wx-block-picker__title" }, sn = /* @__PURE__ */ Q({
1547
1592
  __name: "BlockPicker",
1548
1593
  props: {
1549
1594
  catalog: {},
@@ -1554,134 +1599,134 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1554
1599
  blocksPath: { default: null }
1555
1600
  },
1556
1601
  setup(t) {
1557
- const l = t, { resolve: a, dismiss: s, open: o } = bt();
1558
- Te();
1559
- const u = te("webx-blocks"), n = N("");
1560
- function v(f) {
1602
+ const l = t, { resolve: s, dismiss: n, open: o } = wt();
1603
+ Ee();
1604
+ const r = le("webx-blocks"), a = U("");
1605
+ function v(h) {
1561
1606
  if (l.parent === null)
1562
- return f.allowed_in === null || f.allowed_in.includes("root");
1563
- const h = l.allow ? l.allow.includes(f.slug) : l.parent.allow?.includes(f.slug) === !0, y = f.allowed_in === null || f.allowed_in.includes(l.parent.slug);
1564
- return h && y;
1607
+ return h.allowed_in === null || h.allowed_in.includes("root");
1608
+ const f = l.allow ? l.allow.includes(h.slug) : l.parent.allow?.includes(h.slug) === !0, y = h.allowed_in === null || h.allowed_in.includes(l.parent.slug);
1609
+ return f && y;
1565
1610
  }
1566
- const z = C(
1567
- () => l.catalog.filter((f) => f.is_enabled && f.published !== null && v(f)).map((f) => {
1568
- const h = cl(l.tree, f.slug), y = f.max_per_entity !== null && h >= f.max_per_entity;
1569
- return { type: f, reason: y ? u("field.limit-reached", { count: h }) : null };
1611
+ const A = B(
1612
+ () => l.catalog.filter((h) => h.is_enabled && h.published !== null && v(h)).map((h) => {
1613
+ const f = ml(l.tree, h.slug), y = h.max_per_entity !== null && f >= h.max_per_entity;
1614
+ return { type: h, reason: y ? r("field.limit-reached", { count: f }) : null };
1570
1615
  })
1571
- ), c = C(() => {
1572
- const f = n.value.trim().toLowerCase();
1573
- return f === "" ? z.value : z.value.filter(
1574
- ({ type: h }) => h.title.toLowerCase().includes(f) || h.slug.includes(f) || (h.description ?? "").toLowerCase().includes(f)
1616
+ ), d = B(() => {
1617
+ const h = a.value.trim().toLowerCase();
1618
+ return h === "" ? A.value : A.value.filter(
1619
+ ({ type: f }) => f.title.toLowerCase().includes(h) || f.slug.includes(h) || (f.description ?? "").toLowerCase().includes(h)
1575
1620
  );
1576
- }), g = C(() => {
1577
- const f = [...l.groups];
1578
- for (const { type: w } of c.value)
1579
- f.includes(w.group) || f.push(w.group);
1580
- const h = f.map((w) => ({
1581
- id: w,
1582
- label: ke(w, u),
1583
- options: c.value.filter((V) => V.type.group === w)
1584
- })).filter((w) => w.options.length > 0);
1585
- return c.value.length <= 5 || n.value.trim() !== "" || h.length < 2 ? [{ id: "", label: "", options: c.value }] : h;
1586
- }), m = C(() => {
1587
- if (l.catalog.length === 0) return u("field.pick-none");
1588
- if (z.value.length === 0 && l.parent) {
1589
- const f = (l.allow ?? l.parent.allow ?? []).filter(
1590
- (h) => l.catalog.some((y) => y.slug === h)
1621
+ }), b = B(() => {
1622
+ const h = [...l.groups];
1623
+ for (const { type: _ } of d.value)
1624
+ h.includes(_.group) || h.push(_.group);
1625
+ const f = h.map((_) => ({
1626
+ id: _,
1627
+ label: ye(_, r),
1628
+ options: d.value.filter((S) => S.type.group === _)
1629
+ })).filter((_) => _.options.length > 0);
1630
+ return d.value.length <= 5 || a.value.trim() !== "" || f.length < 2 ? [{ id: "", label: "", options: d.value }] : f;
1631
+ }), m = B(() => {
1632
+ if (l.catalog.length === 0) return r("field.pick-none");
1633
+ if (A.value.length === 0 && l.parent) {
1634
+ const h = (l.allow ?? l.parent.allow ?? []).filter(
1635
+ (f) => l.catalog.some((y) => y.slug === f)
1591
1636
  );
1592
- return f.length === 0 ? u("field.pick-nothing-allowed", { parent: l.parent.title }) : u("field.pick-limited", { parent: l.parent.title, types: f.join(", ") });
1637
+ return h.length === 0 ? r("field.pick-nothing-allowed", { parent: l.parent.title }) : r("field.pick-limited", { parent: l.parent.title, types: h.join(", ") });
1593
1638
  }
1594
- return u("field.pick-empty");
1639
+ return r("field.pick-empty");
1595
1640
  });
1596
- return (f, h) => {
1597
- const y = Ge("router-link");
1598
- return i(), W(e(gt), {
1641
+ return (h, f) => {
1642
+ const y = vt("router-link");
1643
+ return i(), W(e(_t), {
1599
1644
  open: e(o),
1600
- "onUpdate:open": h[2] || (h[2] = (w) => ct(o) ? o.value = w : null),
1601
- title: e(u)("field.pick"),
1645
+ "onUpdate:open": f[2] || (f[2] = (_) => mt(o) ? o.value = _ : null),
1646
+ title: e(r)("field.pick"),
1602
1647
  width: 860
1603
1648
  }, {
1604
- footer: d(() => [
1605
- r(e(J), {
1649
+ footer: c(() => [
1650
+ u(e(q), {
1606
1651
  variant: "outline",
1607
- onClick: h[1] || (h[1] = (w) => e(s)())
1652
+ onClick: f[1] || (f[1] = (_) => e(n)())
1608
1653
  }, {
1609
- default: d(() => [
1610
- _(p(e(u)("field.close")), 1)
1654
+ default: c(() => [
1655
+ w(p(e(r)("field.close")), 1)
1611
1656
  ]),
1612
1657
  _: 1
1613
1658
  })
1614
1659
  ]),
1615
- default: d(() => [
1616
- $("div", Kl, [
1617
- z.value.length > 0 ? (i(), W(e(be), {
1660
+ default: c(() => [
1661
+ $("div", Xl, [
1662
+ A.value.length > 0 ? (i(), W(e(ge), {
1618
1663
  key: 0,
1619
- modelValue: n.value,
1620
- "onUpdate:modelValue": h[0] || (h[0] = (w) => n.value = w),
1621
- placeholder: e(u)("field.search"),
1664
+ modelValue: a.value,
1665
+ "onUpdate:modelValue": f[0] || (f[0] = (_) => a.value = _),
1666
+ placeholder: e(r)("field.search"),
1622
1667
  clearable: "",
1623
1668
  autofocus: ""
1624
- }, null, 8, ["modelValue", "placeholder"])) : A("", !0),
1625
- c.value.length === 0 ? (i(), W(e(kt), {
1669
+ }, null, 8, ["modelValue", "placeholder"])) : L("", !0),
1670
+ d.value.length === 0 ? (i(), W(e(xt), {
1626
1671
  key: 1,
1627
1672
  icon: "grid",
1628
1673
  title: m.value,
1629
1674
  size: "sm"
1630
1675
  }, {
1631
- default: d(() => [
1676
+ default: c(() => [
1632
1677
  t.catalog.length === 0 && t.blocksPath ? (i(), W(y, {
1633
1678
  key: 0,
1634
1679
  to: t.blocksPath
1635
1680
  }, {
1636
- default: d(() => [
1637
- _(p(e(u)("field.pick-none-link")), 1)
1681
+ default: c(() => [
1682
+ w(p(e(r)("field.pick-none-link")), 1)
1638
1683
  ]),
1639
1684
  _: 1
1640
- }, 8, ["to"])) : A("", !0)
1685
+ }, 8, ["to"])) : L("", !0)
1641
1686
  ]),
1642
1687
  _: 1
1643
- }, 8, ["title"])) : A("", !0),
1644
- (i(!0), x(H, null, ee(g.value, (w) => (i(), x("section", {
1645
- key: w.id,
1688
+ }, 8, ["title"])) : L("", !0),
1689
+ (i(!0), V(H, null, te(b.value, (_) => (i(), V("section", {
1690
+ key: _.id,
1646
1691
  class: "wx-block-picker__group"
1647
1692
  }, [
1648
- w.label ? (i(), x("div", Zl, p(w.label), 1)) : A("", !0),
1649
- $("div", Gl, [
1650
- (i(!0), x(H, null, ee(w.options, (V) => (i(), x("button", {
1651
- key: V.type.id,
1693
+ _.label ? (i(), V("div", en, p(_.label), 1)) : L("", !0),
1694
+ $("div", tn, [
1695
+ (i(!0), V(H, null, te(_.options, (S) => (i(), V("button", {
1696
+ key: S.type.id,
1652
1697
  type: "button",
1653
- class: he(["wx-block-picker__card", { "is-disabled": V.reason !== null }]),
1654
- disabled: V.reason !== null,
1655
- title: V.reason ?? void 0,
1656
- onClick: (k) => e(a)(V.type)
1698
+ class: be(["wx-block-picker__card", { "is-disabled": S.reason !== null }]),
1699
+ disabled: S.reason !== null,
1700
+ title: S.reason ?? void 0,
1701
+ onClick: (k) => e(s)(S.type)
1657
1702
  }, [
1658
- r(At, {
1659
- thumbnail: V.type.thumbnail,
1703
+ u(It, {
1704
+ thumbnail: S.type.thumbnail,
1660
1705
  height: 96
1661
1706
  }, null, 8, ["thumbnail"]),
1662
- $("div", Ql, [
1663
- $("div", Xl, p(V.type.title), 1),
1664
- V.reason ? (i(), W(e(R), {
1707
+ $("div", nn, [
1708
+ $("div", an, p(S.type.title), 1),
1709
+ S.reason ? (i(), W(e(j), {
1665
1710
  key: 0,
1666
1711
  size: "sm",
1667
1712
  tone: "warning"
1668
1713
  }, {
1669
- default: d(() => [
1670
- _(p(V.reason), 1)
1714
+ default: c(() => [
1715
+ w(p(S.reason), 1)
1671
1716
  ]),
1672
1717
  _: 2
1673
- }, 1024)) : V.type.description ? (i(), W(e(R), {
1718
+ }, 1024)) : S.type.description ? (i(), W(e(j), {
1674
1719
  key: 1,
1675
1720
  size: "sm",
1676
1721
  tone: "muted"
1677
1722
  }, {
1678
- default: d(() => [
1679
- _(p(V.type.description), 1)
1723
+ default: c(() => [
1724
+ w(p(S.type.description), 1)
1680
1725
  ]),
1681
1726
  _: 2
1682
- }, 1024)) : A("", !0)
1727
+ }, 1024)) : L("", !0)
1683
1728
  ])
1684
- ], 10, Yl))), 128))
1729
+ ], 10, ln))), 128))
1685
1730
  ])
1686
1731
  ]))), 128))
1687
1732
  ])
@@ -1690,7 +1735,7 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1690
1735
  }, 8, ["open", "title"]);
1691
1736
  };
1692
1737
  }
1693
- }), tn = /* @__PURE__ */ Q(en, [["__scopeId", "data-v-99f4090e"]]), ln = { class: "wx-blocks-preview__bar" }, nn = { class: "wx-blocks-preview__tools" }, an = ["src", "title"], sn = /* @__PURE__ */ Y({
1738
+ }), on = /* @__PURE__ */ X(sn, [["__scopeId", "data-v-99f4090e"]]), rn = { class: "wx-blocks-preview__bar" }, un = { class: "wx-blocks-preview__tools" }, cn = ["src", "title"], dn = /* @__PURE__ */ Q({
1694
1739
  __name: "BlocksPreview",
1695
1740
  props: {
1696
1741
  url: {},
@@ -1699,82 +1744,93 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1699
1744
  reload: { default: 0 },
1700
1745
  fill: { type: Boolean, default: !1 }
1701
1746
  },
1702
- setup(t, { expose: l }) {
1703
- const a = t, s = te("webx-blocks"), o = N(null), u = N(null), n = Ye(u), v = N(!1), z = N(1280), c = N(!1), g = C(() => [
1704
- { value: 1280, label: s("field.width-desktop") },
1705
- { value: 834, label: s("field.width-tablet") },
1706
- { value: 390, label: s("field.width-phone") }
1707
- ]), m = C(
1708
- () => v.value ? z.value : a.mode === "phone" ? 390 : 1280
1709
- ), f = C(() => v.value || a.mode === "phone" || n.value === 0 ? 1 : Math.min(1, n.value / m.value)), h = C(() => ({
1710
- width: `${m.value}px`,
1711
- transform: `scale(${f.value})`
1712
- })), y = C(() => {
1713
- if (!a.url) return "";
1747
+ emits: ["select"],
1748
+ setup(t, { expose: l, emit: s }) {
1749
+ const n = t, o = s, r = le("webx-blocks"), a = U(null), v = U(null), A = Ge(v), d = U(!1), b = U(1280), m = U(!1), h = B(() => [
1750
+ { value: 1280, label: r("field.width-desktop") },
1751
+ { value: 834, label: r("field.width-tablet") },
1752
+ { value: 390, label: r("field.width-phone") }
1753
+ ]), f = B(
1754
+ () => d.value ? b.value : n.mode === "phone" ? 390 : 1280
1755
+ ), y = B(() => d.value || n.mode === "phone" || A.value === 0 ? 1 : Math.min(1, A.value / f.value)), _ = B(() => ({
1756
+ width: `${f.value}px`,
1757
+ transform: `scale(${y.value})`
1758
+ })), S = B(() => {
1759
+ if (!n.url) return "";
1714
1760
  try {
1715
- return `${new URL(a.url, location.origin).pathname} · ${m.value} px`;
1761
+ return `${new URL(n.url, location.origin).pathname} · ${f.value} px`;
1716
1762
  } catch {
1717
- return a.url;
1763
+ return n.url;
1718
1764
  }
1719
1765
  });
1720
- function w() {
1766
+ function k() {
1721
1767
  try {
1722
- return o.value?.contentDocument ?? null;
1768
+ return a.value?.contentDocument ?? null;
1723
1769
  } catch {
1724
1770
  return null;
1725
1771
  }
1726
1772
  }
1727
- function V() {
1728
- c.value = !0;
1729
- const P = w();
1730
- P && Je(P, a.selected ?? null);
1773
+ let C = null, D = !1;
1774
+ function K() {
1775
+ m.value = !0;
1776
+ const M = k();
1777
+ M && (C?.release(), C = rl(M, {
1778
+ select: (O) => {
1779
+ D = !0, o("select", O), D = !1;
1780
+ }
1781
+ }), Je(M, n.selected ?? null), ne(M, n.selected ?? null));
1731
1782
  }
1732
- function k(P, F) {
1733
- const B = w();
1734
- if (!B || !c.value) return !1;
1735
- const L = ll(B, P, F);
1736
- return L && Je(B, a.selected ?? null), L;
1783
+ function ne(M, O) {
1784
+ O === null || D || Ye(M, O)?.scrollIntoView({ behavior: "smooth", block: "center" });
1737
1785
  }
1738
- function T() {
1739
- c.value = !1, o.value && a.url && (o.value.src = a.url);
1786
+ function z(M, O) {
1787
+ const ee = k();
1788
+ if (!ee || !m.value) return !1;
1789
+ const de = il(ee, M, O);
1790
+ return de && Je(ee, n.selected ?? null), de;
1740
1791
  }
1741
- function D(P) {
1742
- P.key === "Escape" && v.value && (v.value = !1, P.stopPropagation());
1792
+ function N() {
1793
+ m.value = !1, a.value && n.url && (a.value.src = n.url);
1743
1794
  }
1744
- return oe(
1745
- () => a.selected,
1746
- (P) => {
1747
- const F = w();
1748
- F && c.value && Je(F, P ?? null);
1795
+ function I(M) {
1796
+ M.key === "Escape" && d.value && (d.value = !1, M.stopPropagation());
1797
+ }
1798
+ return ie(
1799
+ () => n.selected,
1800
+ (M) => {
1801
+ const O = k();
1802
+ !O || !m.value || (Je(O, M ?? null), ne(O, M ?? null));
1749
1803
  }
1750
- ), oe(() => a.reload, T), oe(
1751
- () => a.url,
1752
- () => c.value = !1
1753
- ), xe(() => window.addEventListener("keydown", D)), Ze(() => window.removeEventListener("keydown", D)), l({ replace: k, refresh: T, open: () => v.value = !0 }), (P, F) => (i(), x("div", {
1754
- class: he(["wx-blocks-preview", { "is-fullscreen": v.value, "is-phone": t.mode === "phone", "is-fill": t.fill }]),
1755
- style: de({ "--wx-preview-scale": f.value })
1804
+ ), ie(() => n.reload, N), ie(
1805
+ () => n.url,
1806
+ () => m.value = !1
1807
+ ), Ce(() => window.addEventListener("keydown", I)), Ze(() => {
1808
+ window.removeEventListener("keydown", I), C?.release();
1809
+ }), l({ replace: z, refresh: N, open: () => d.value = !0 }), (M, O) => (i(), V("div", {
1810
+ class: be(["wx-blocks-preview", { "is-fullscreen": d.value, "is-phone": t.mode === "phone", "is-fill": t.fill }]),
1811
+ style: ce({ "--wx-preview-scale": y.value })
1756
1812
  }, [
1757
- $("div", ln, [
1758
- r(e(R), {
1813
+ $("div", rn, [
1814
+ u(e(j), {
1759
1815
  size: "xs",
1760
1816
  tone: "muted",
1761
1817
  class: "wx-blocks-preview__label",
1762
1818
  truncate: ""
1763
1819
  }, {
1764
- default: d(() => [
1765
- _(p(y.value), 1)
1820
+ default: c(() => [
1821
+ w(p(S.value), 1)
1766
1822
  ]),
1767
1823
  _: 1
1768
1824
  }),
1769
- $("div", nn, [
1770
- v.value ? (i(), W(e(vt), {
1825
+ $("div", un, [
1826
+ d.value ? (i(), W(e(gt), {
1771
1827
  key: 0,
1772
- modelValue: z.value,
1773
- "onUpdate:modelValue": F[0] || (F[0] = (B) => z.value = B),
1774
- options: g.value,
1828
+ modelValue: b.value,
1829
+ "onUpdate:modelValue": O[0] || (O[0] = (ee) => b.value = ee),
1830
+ options: h.value,
1775
1831
  size: "sm"
1776
- }, null, 8, ["modelValue", "options"])) : A("", !0),
1777
- t.url ? (i(), W(e(J), {
1832
+ }, null, 8, ["modelValue", "options"])) : L("", !0),
1833
+ t.url ? (i(), W(e(q), {
1778
1834
  key: 1,
1779
1835
  size: "sm",
1780
1836
  variant: "outline",
@@ -1782,18 +1838,18 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1782
1838
  target: "_blank",
1783
1839
  rel: "noopener"
1784
1840
  }, {
1785
- default: d(() => [
1786
- _(p(e(s)("field.open-site")), 1)
1841
+ default: c(() => [
1842
+ w(p(e(r)("field.open-site")), 1)
1787
1843
  ]),
1788
1844
  _: 1
1789
- }, 8, ["href"])) : A("", !0),
1790
- r(e(J), {
1845
+ }, 8, ["href"])) : L("", !0),
1846
+ u(e(q), {
1791
1847
  size: "sm",
1792
1848
  variant: "outline",
1793
- onClick: F[1] || (F[1] = (B) => v.value = !v.value)
1849
+ onClick: O[1] || (O[1] = (ee) => d.value = !d.value)
1794
1850
  }, {
1795
- default: d(() => [
1796
- _(p(v.value ? e(s)("field.close") : e(s)("field.fullscreen")), 1)
1851
+ default: c(() => [
1852
+ w(p(d.value ? e(r)("field.close") : e(r)("field.fullscreen")), 1)
1797
1853
  ]),
1798
1854
  _: 1
1799
1855
  })
@@ -1801,28 +1857,28 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1801
1857
  ]),
1802
1858
  $("div", {
1803
1859
  ref_key: "box",
1804
- ref: u,
1860
+ ref: v,
1805
1861
  class: "wx-blocks-preview__ground"
1806
1862
  }, [
1807
1863
  $("div", {
1808
1864
  class: "wx-blocks-preview__clip",
1809
- style: de({ width: `${Math.round(m.value * f.value)}px` })
1865
+ style: ce({ width: `${Math.round(f.value * y.value)}px` })
1810
1866
  }, [
1811
- t.url ? (i(), x("iframe", {
1867
+ t.url ? (i(), V("iframe", {
1812
1868
  key: 0,
1813
1869
  ref_key: "frame",
1814
- ref: o,
1870
+ ref: a,
1815
1871
  class: "wx-blocks-preview__frame",
1816
1872
  src: t.url,
1817
- style: de(h.value),
1818
- title: e(s)("field.preview"),
1819
- onLoad: V
1820
- }, null, 44, an)) : A("", !0)
1873
+ style: ce(_.value),
1874
+ title: e(r)("field.preview"),
1875
+ onLoad: K
1876
+ }, null, 44, cn)) : L("", !0)
1821
1877
  ], 4)
1822
1878
  ], 512)
1823
1879
  ], 6));
1824
1880
  }
1825
- }), on = /* @__PURE__ */ Q(sn, [["__scopeId", "data-v-02b32374"]]), rn = { class: "wx-blocks-tree__node" }, un = ["onClick", "onKeydown"], dn = { class: "wx-blocks-tree__icon" }, cn = { class: "wx-blocks-tree__name" }, pn = ["title"], fn = ["title"], vn = ["title"], mn = ["title"], hn = ["onClick"], bn = /* @__PURE__ */ Y({
1881
+ }), pn = /* @__PURE__ */ X(dn, [["__scopeId", "data-v-0b137d74"]]), fn = { class: "wx-blocks-tree__node" }, vn = ["onClick", "onKeydown"], mn = { class: "wx-blocks-tree__icon" }, hn = { class: "wx-blocks-tree__name" }, bn = ["title"], gn = ["title"], kn = ["title"], yn = ["title"], wn = ["onClick"], _n = /* @__PURE__ */ Q({
1826
1882
  __name: "BlocksTree",
1827
1883
  props: {
1828
1884
  nodes: {},
@@ -1835,138 +1891,138 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1835
1891
  },
1836
1892
  emits: ["select", "add", "remove", "duplicate", "visibility", "reorder"],
1837
1893
  setup(t, { emit: l }) {
1838
- const a = t, s = l, o = te("webx-blocks");
1839
- function u(g) {
1840
- return a.catalog.find((m) => m.slug === g.type) ?? null;
1894
+ const s = t, n = l, o = le("webx-blocks");
1895
+ function r(b) {
1896
+ return s.catalog.find((m) => m.slug === b.type) ?? null;
1841
1897
  }
1842
- function n(g) {
1843
- return u(g)?.title ?? g.type;
1898
+ function a(b) {
1899
+ return r(b)?.title ?? b.type;
1844
1900
  }
1845
- function v(g) {
1846
- const m = u(g);
1847
- return m?.content ? Tt(m.content.schema) : [];
1901
+ function v(b) {
1902
+ const m = r(b);
1903
+ return m?.content ? Et(m.content.schema) : [];
1848
1904
  }
1849
- function z(g, m) {
1850
- const f = g.values[m.id];
1851
- return Array.isArray(f) ? f : [];
1905
+ function A(b, m) {
1906
+ const h = b.values[m.id];
1907
+ return Array.isArray(h) ? h : [];
1852
1908
  }
1853
- function c(g) {
1854
- return u(g)?.icon ?? "grid";
1909
+ function d(b) {
1910
+ return r(b)?.icon ?? "grid";
1855
1911
  }
1856
- return (g, m) => {
1857
- const f = Ge("blocks-tree", !0);
1858
- return i(), W(e(qt), {
1912
+ return (b, m) => {
1913
+ const h = vt("blocks-tree", !0);
1914
+ return i(), W(e(Yt), {
1859
1915
  "model-value": t.nodes,
1860
1916
  "item-key": "key",
1861
- "item-label": (h) => n(h),
1917
+ "item-label": (f) => a(f),
1862
1918
  disabled: t.disabled,
1863
1919
  plain: "",
1864
1920
  size: "sm",
1865
1921
  "empty-text": t.depth === 0 ? e(o)("field.empty") : "",
1866
- class: he(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
1867
- "onUpdate:modelValue": m[7] || (m[7] = (h) => s("reorder", t.parentKey, t.field, h))
1922
+ class: be(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
1923
+ "onUpdate:modelValue": m[7] || (m[7] = (f) => n("reorder", t.parentKey, t.field, f))
1868
1924
  }, {
1869
- default: d(({ item: h }) => [
1870
- $("div", rn, [
1925
+ default: c(({ item: f }) => [
1926
+ $("div", fn, [
1871
1927
  $("div", {
1872
- class: he(["wx-blocks-tree__row", { "is-selected": t.selected === h.key, "is-hidden": h.hidden === !0 }]),
1928
+ class: be(["wx-blocks-tree__row", { "is-selected": t.selected === f.key, "is-hidden": f.hidden === !0 }]),
1873
1929
  role: "button",
1874
1930
  tabindex: "0",
1875
- onClick: (y) => s("select", h.key),
1931
+ onClick: (y) => n("select", f.key),
1876
1932
  onKeydown: [
1877
- tt(He((y) => s("select", h.key), ["prevent"]), ["enter"]),
1878
- tt(He((y) => s("select", h.key), ["prevent"]), ["space"])
1933
+ lt(He((y) => n("select", f.key), ["prevent"]), ["enter"]),
1934
+ lt(He((y) => n("select", f.key), ["prevent"]), ["space"])
1879
1935
  ]
1880
1936
  }, [
1881
- $("span", dn, [
1882
- r(e(ae), {
1883
- name: c(h)
1937
+ $("span", mn, [
1938
+ u(e(oe), {
1939
+ name: d(f)
1884
1940
  }, null, 8, ["name"])
1885
1941
  ]),
1886
- $("span", cn, p(n(h)), 1),
1887
- u(h) ? u(h)?.draft ? (i(), x("span", {
1942
+ $("span", hn, p(a(f)), 1),
1943
+ r(f) ? r(f)?.draft ? (i(), V("span", {
1888
1944
  key: 1,
1889
1945
  class: "wx-blocks-tree__flag is-warning",
1890
1946
  title: e(o)("field.draft-type")
1891
1947
  }, [
1892
- r(e(ae), { name: "warning" })
1893
- ], 8, fn)) : u(h)?.is_enabled === !1 ? (i(), x("span", {
1948
+ u(e(oe), { name: "warning" })
1949
+ ], 8, gn)) : r(f)?.is_enabled === !1 ? (i(), V("span", {
1894
1950
  key: 2,
1895
1951
  class: "wx-blocks-tree__flag",
1896
1952
  title: e(o)("field.disabled-type")
1897
1953
  }, [
1898
- r(e(ae), { name: "lock" })
1899
- ], 8, vn)) : A("", !0) : (i(), x("span", {
1954
+ u(e(oe), { name: "lock" })
1955
+ ], 8, kn)) : L("", !0) : (i(), V("span", {
1900
1956
  key: 0,
1901
1957
  class: "wx-blocks-tree__flag is-danger",
1902
- title: e(o)("field.unknown-type", { type: h.type })
1958
+ title: e(o)("field.unknown-type", { type: f.type })
1903
1959
  }, [
1904
- r(e(ae), { name: "close-circle" })
1905
- ], 8, pn)),
1906
- h.hidden === !0 ? (i(), x("span", {
1960
+ u(e(oe), { name: "close-circle" })
1961
+ ], 8, bn)),
1962
+ f.hidden === !0 ? (i(), V("span", {
1907
1963
  key: 3,
1908
1964
  class: "wx-blocks-tree__flag",
1909
1965
  title: e(o)("field.hidden-note")
1910
1966
  }, [
1911
- r(e(ae), { name: "eye-off" })
1912
- ], 8, mn)) : A("", !0),
1913
- t.disabled ? A("", !0) : (i(), x("span", {
1967
+ u(e(oe), { name: "eye-off" })
1968
+ ], 8, yn)) : L("", !0),
1969
+ t.disabled ? L("", !0) : (i(), V("span", {
1914
1970
  key: 4,
1915
1971
  class: "wx-blocks-tree__actions",
1916
1972
  onClick: m[0] || (m[0] = He(() => {
1917
1973
  }, ["stop"]))
1918
1974
  }, [
1919
- r(e(Fe), {
1920
- icon: h.hidden === !0 ? "eye-off" : "eye",
1975
+ u(e(Fe), {
1976
+ icon: f.hidden === !0 ? "eye-off" : "eye",
1921
1977
  size: "sm",
1922
- title: h.hidden === !0 ? e(o)("field.show") : e(o)("field.hide"),
1923
- onClick: (y) => s("visibility", h.key, h.hidden !== !0)
1978
+ title: f.hidden === !0 ? e(o)("field.show") : e(o)("field.hide"),
1979
+ onClick: (y) => n("visibility", f.key, f.hidden !== !0)
1924
1980
  }, null, 8, ["icon", "title", "onClick"]),
1925
- r(e(Fe), {
1981
+ u(e(Fe), {
1926
1982
  icon: "copy",
1927
1983
  size: "sm",
1928
1984
  title: e(o)("field.duplicate"),
1929
- onClick: (y) => s("duplicate", h.key)
1985
+ onClick: (y) => n("duplicate", f.key)
1930
1986
  }, null, 8, ["title", "onClick"]),
1931
- r(e(Fe), {
1987
+ u(e(Fe), {
1932
1988
  icon: "trash",
1933
1989
  size: "sm",
1934
1990
  tone: "danger",
1935
1991
  title: e(o)("field.remove"),
1936
- onClick: (y) => s("remove", h.key)
1992
+ onClick: (y) => n("remove", f.key)
1937
1993
  }, null, 8, ["title", "onClick"])
1938
1994
  ]))
1939
- ], 42, un),
1940
- (i(!0), x(H, null, ee(v(h), (y) => (i(), x("div", {
1995
+ ], 42, vn),
1996
+ (i(!0), V(H, null, te(v(f), (y) => (i(), V("div", {
1941
1997
  key: y.id,
1942
1998
  class: "wx-blocks-tree__kids"
1943
1999
  }, [
1944
- r(f, {
1945
- nodes: z(h, y),
2000
+ u(h, {
2001
+ nodes: A(f, y),
1946
2002
  catalog: t.catalog,
1947
- "parent-key": h.key,
2003
+ "parent-key": f.key,
1948
2004
  field: y.id,
1949
2005
  selected: t.selected,
1950
2006
  disabled: t.disabled,
1951
2007
  depth: t.depth + 1,
1952
- onSelect: m[1] || (m[1] = (w) => s("select", w)),
1953
- onAdd: m[2] || (m[2] = (w, V, k) => s("add", w, V, k)),
1954
- onRemove: m[3] || (m[3] = (w) => s("remove", w)),
1955
- onDuplicate: m[4] || (m[4] = (w) => s("duplicate", w)),
1956
- onVisibility: m[5] || (m[5] = (w, V) => s("visibility", w, V)),
1957
- onReorder: m[6] || (m[6] = (w, V, k) => s("reorder", w, V, k))
2008
+ onSelect: m[1] || (m[1] = (_) => n("select", _)),
2009
+ onAdd: m[2] || (m[2] = (_, S, k) => n("add", _, S, k)),
2010
+ onRemove: m[3] || (m[3] = (_) => n("remove", _)),
2011
+ onDuplicate: m[4] || (m[4] = (_) => n("duplicate", _)),
2012
+ onVisibility: m[5] || (m[5] = (_, S) => n("visibility", _, S)),
2013
+ onReorder: m[6] || (m[6] = (_, S, k) => n("reorder", _, S, k))
1958
2014
  }, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
1959
- t.disabled ? A("", !0) : (i(), x("button", {
2015
+ t.disabled ? L("", !0) : (i(), V("button", {
1960
2016
  key: 0,
1961
2017
  type: "button",
1962
2018
  class: "wx-blocks-tree__add is-inner",
1963
- onClick: (w) => s("add", h.key, y.id, y)
2019
+ onClick: (_) => n("add", f.key, y.id, y)
1964
2020
  }, [
1965
- _(" + " + p(e(o)("field.add-inside")), 1),
1966
- v(h).length > 1 ? (i(), x(H, { key: 0 }, [
1967
- _(" · " + p(y.label ?? y.id), 1)
1968
- ], 64)) : A("", !0)
1969
- ], 8, hn))
2021
+ w(" + " + p(e(o)("field.add-inside")), 1),
2022
+ v(f).length > 1 ? (i(), V(H, { key: 0 }, [
2023
+ w(" · " + p(y.label ?? y.id), 1)
2024
+ ], 64)) : L("", !0)
2025
+ ], 8, wn))
1970
2026
  ]))), 128))
1971
2027
  ])
1972
2028
  ]),
@@ -1974,27 +2030,27 @@ const xl = { class: "wx-block-editor" }, $l = { class: "wx-block-editor__columns
1974
2030
  }, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
1975
2031
  };
1976
2032
  }
1977
- }), gn = /* @__PURE__ */ Q(bn, [["__scopeId", "data-v-2f2a917a"]]), Xe = /* @__PURE__ */ Symbol("wx-blocks-preview");
1978
- function Xn(t) {
1979
- pt(Xe, t);
2033
+ }), xn = /* @__PURE__ */ X(_n, [["__scopeId", "data-v-4fe464bb"]]), et = /* @__PURE__ */ Symbol("wx-blocks-preview");
2034
+ function sa(t) {
2035
+ ht(et, t);
1980
2036
  }
1981
- function ea() {
1982
- return Ee(Xe, null);
2037
+ function oa() {
2038
+ return Ne(et, null);
1983
2039
  }
1984
- const dt = /* @__PURE__ */ Symbol("wx-blocks-root"), kn = {
2040
+ const ft = /* @__PURE__ */ Symbol("wx-blocks-root"), $n = {
1985
2041
  key: 0,
1986
2042
  class: "wx-blocks-nested"
1987
- }, yn = { class: "wx-blocks__tree" }, wn = { class: "wx-blocks__panel-head" }, _n = { class: "wx-blocks__panel-title" }, xn = {
2043
+ }, Vn = { class: "wx-blocks__tree" }, Sn = { class: "wx-blocks__panel-head" }, Cn = { class: "wx-blocks__panel-title" }, Tn = { class: "wx-blocks__tools" }, Bn = {
1988
2044
  key: 0,
1989
2045
  class: "wx-blocks__fields"
1990
- }, $n = { class: "wx-blocks__panel-head" }, Vn = { class: "wx-blocks__panel-title" }, Tn = { class: "wx-blocks__panel-extra" }, Cn = { class: "wx-blocks__form" }, Sn = {
2046
+ }, En = { class: "wx-blocks__panel-head" }, Wn = { class: "wx-blocks__panel-title" }, An = { class: "wx-blocks__panel-extra" }, Ln = { class: "wx-blocks__form" }, zn = {
1991
2047
  key: 1,
1992
2048
  class: "wx-blocks__preview"
1993
- }, Bn = /* @__PURE__ */ Y({
2049
+ }, In = /* @__PURE__ */ Q({
1994
2050
  name: "WxBlocks",
1995
2051
  inheritAttrs: !1,
1996
2052
  __name: "BlocksField",
1997
- props: /* @__PURE__ */ Nt({
2053
+ props: /* @__PURE__ */ Pt({
1998
2054
  node: { default: void 0 },
1999
2055
  context: { default: void 0 },
2000
2056
  name: { default: void 0 },
@@ -2011,298 +2067,303 @@ const dt = /* @__PURE__ */ Symbol("wx-blocks-root"), kn = {
2011
2067
  }),
2012
2068
  emits: ["update:modelValue"],
2013
2069
  setup(t) {
2014
- const l = t, a = Ut(t, "modelValue"), s = Ee(dt, !1);
2015
- pt(dt, !0), Te();
2016
- const o = te("webx-blocks"), u = Ve(), n = Ee(Ot, null);
2070
+ const l = t, s = Ut(t, "modelValue"), n = Ne(ft, !1);
2071
+ ht(ft, !0), Ee();
2072
+ const o = le("webx-blocks"), r = Be(), a = Ne(Ft, null);
2017
2073
  let v = null;
2018
- const z = N([]), c = C(() => l.catalog ?? z.value), g = C(() => Array.isArray(a.value) ? a.value : []), m = N(null), f = C(() => m.value ? se(g.value, m.value) : null), h = C(
2019
- () => f.value ? c.value.find((E) => E.slug === f.value?.node.type) ?? null : null
2020
- ), y = Ee(Xe, null), w = N(null), V = C(
2021
- () => n?.state.manifest?.modules.find((E) => E.id === "blocks")?.meta?.groups ?? []
2022
- ), k = It()?.type, T = C(() => l.context?.types ? l.context.types : n?.types ? { ...qe, ...n.types } : k ? { ...qe, "wx-blocks": { component: k, kind: "field", nested: !0 } } : qe), D = C(
2023
- () => l.context?.translate ?? n?.i18n.t ?? ((E) => E)
2024
- ), P = C(() => l.context?.can ?? n?.can ?? (() => !0)), F = yt(tn);
2025
- function B(E) {
2026
- a.value = E;
2074
+ const A = U([]), d = B(() => l.catalog ?? A.value), b = B(() => Array.isArray(s.value) ? s.value : []), m = U(null), h = B(() => m.value ? se(b.value, m.value) : null), f = B(
2075
+ () => h.value ? d.value.find((T) => T.slug === h.value?.node.type) ?? null : null
2076
+ ), y = Ne(et, null), _ = U(null), S = B(
2077
+ () => a?.state.manifest?.modules.find((T) => T.id === "blocks")?.meta?.groups ?? []
2078
+ ), k = Nt()?.type, C = B(() => l.context?.types ? l.context.types : a?.types ? { ...qe, ...a.types } : k ? { ...qe, "wx-blocks": { component: k, kind: "field", nested: !0 } } : qe), D = B(
2079
+ () => l.context?.translate ?? a?.i18n.t ?? ((T) => T)
2080
+ ), K = B(() => l.context?.can ?? a?.can ?? (() => !0)), ne = $t(on);
2081
+ function z(T) {
2082
+ s.value = T;
2027
2083
  }
2028
- async function L(E, M, O) {
2029
- const X = E ? se(g.value, E) : null, Z = X ? c.value.find((De) => De.slug === X.node.type) ?? null : null, Oe = E === null ? l.allow : O?.props?.allow ?? null, _e = E === null ? l.max : O?.props?.max ?? null, ce = E === null ? g.value : X && M ? X.node.values[M] ?? [] : [];
2030
- if (_e != null && ce.length >= _e) return;
2031
- const pe = await F({
2032
- catalog: c.value,
2033
- parent: Z,
2034
- allow: Oe,
2035
- tree: g.value,
2036
- groups: V.value,
2084
+ async function N(T, P, R) {
2085
+ const Z = T ? se(b.value, T) : null, G = Z ? d.value.find((Ve) => Ve.slug === Z.node.type) ?? null : null, Re = T === null ? l.allow : R?.props?.allow ?? null, ue = T === null ? l.max : R?.props?.max ?? null, xe = T === null ? b.value : Z && P ? Z.node.values[P] ?? [] : [];
2086
+ if (ue != null && xe.length >= ue) return;
2087
+ const $e = await ne({
2088
+ catalog: d.value,
2089
+ parent: G,
2090
+ allow: Re,
2091
+ tree: b.value,
2092
+ groups: S.value,
2037
2093
  blocksPath: l.blocksPath
2038
2094
  });
2039
- if (!pe) return;
2040
- const We = dl(pe.slug, I(pe));
2041
- B(it(g.value, E, M, ce.length, We)), m.value = We.key;
2095
+ if (!$e) return;
2096
+ const ze = vl($e.slug, I($e));
2097
+ z(ct(b.value, T, P, xe.length, ze)), m.value = ze.key;
2042
2098
  }
2043
- function I(E) {
2044
- const M = E.content?.sample ?? {}, O = {};
2045
- for (const [X, Z] of Object.entries(M))
2046
- (!Array.isArray(Z) || Z.length === 0 || typeof Z[0] != "object") && (O[X] = Z);
2047
- return O;
2099
+ function I(T) {
2100
+ const P = T.content?.sample ?? {}, R = {};
2101
+ for (const [Z, G] of Object.entries(P))
2102
+ (!Array.isArray(G) || G.length === 0 || typeof G[0] != "object") && (R[Z] = G);
2103
+ return R;
2048
2104
  }
2049
- async function ne(E) {
2050
- const M = se(g.value, E);
2051
- if (!M) return;
2052
- const O = pl(M.node);
2053
- O > 0 && !await Ie({
2105
+ async function M(T) {
2106
+ const P = se(b.value, T);
2107
+ if (!P) return;
2108
+ const R = hl(P.node);
2109
+ R > 0 && !await Me({
2054
2110
  title: o("field.remove-title", {
2055
- title: c.value.find((Z) => Z.slug === M.node.type)?.title ?? M.node.type
2111
+ title: d.value.find((G) => G.slug === P.node.type)?.title ?? P.node.type
2056
2112
  }),
2057
- message: o("field.remove-text", { count: O }),
2113
+ message: o("field.remove-text", { count: R }),
2058
2114
  confirmText: o("field.remove"),
2059
2115
  cancelText: o("page.cancel"),
2060
2116
  tone: "danger"
2061
- }) || (m.value === E && (m.value = null), B(ml(g.value, E)));
2117
+ }) || (m.value === T && (m.value = null), z(kl(b.value, T)));
2118
+ }
2119
+ function O(T) {
2120
+ const P = se(b.value, T);
2121
+ if (!P) return;
2122
+ const R = Wt(P.node);
2123
+ z(ct(b.value, P.parent?.key ?? null, P.field, P.index + 1, R)), m.value = R.key;
2062
2124
  }
2063
- function re(E) {
2064
- const M = se(g.value, E);
2065
- if (!M) return;
2066
- const O = Ct(M.node);
2067
- B(it(g.value, M.parent?.key ?? null, M.field, M.index + 1, O)), m.value = O.key;
2125
+ function ee(T, P) {
2126
+ z(bl(b.value, T, P));
2068
2127
  }
2069
- function Ce(E, M) {
2070
- B(fl(g.value, E, M));
2128
+ function de(T, P, R) {
2129
+ z(wl(b.value, T, P, R));
2071
2130
  }
2072
- function Me(E, M, O) {
2073
- B(bl(g.value, E, M, O));
2131
+ function We(T) {
2132
+ m.value = m.value === T ? null : T;
2074
2133
  }
2075
- function Se(E) {
2076
- m.value = m.value === E ? null : E;
2134
+ function Ae(T) {
2135
+ T === null || !se(b.value, T) || (m.value = T);
2077
2136
  }
2078
- function ye() {
2137
+ function we() {
2079
2138
  m.value = null;
2080
2139
  }
2081
- function Be(E) {
2082
- m.value && B(hl(g.value, m.value, E));
2140
+ function pe(T) {
2141
+ m.value && z(yl(b.value, m.value, T));
2083
2142
  }
2084
- let ue;
2085
- oe(
2086
- () => f.value?.node.values,
2087
- (E, M) => {
2088
- if (!E || !M || !h.value || !v || !y) return;
2089
- const O = m.value, X = h.value.id;
2090
- clearTimeout(ue), ue = setTimeout(() => {
2091
- !O || !v || v.render(X, { values: E, key: O }).then((Z) => {
2092
- w.value?.replace(O, Z.html) || w.value?.refresh();
2143
+ let fe;
2144
+ ie(
2145
+ () => h.value?.node.values,
2146
+ (T, P) => {
2147
+ if (!T || !P || !f.value || !v || !y) return;
2148
+ const R = m.value, Z = f.value.id;
2149
+ clearTimeout(fe), fe = setTimeout(() => {
2150
+ !R || !v || v.render(Z, { values: T, key: R }).then((G) => {
2151
+ _.value?.replace(R, G.html) || _.value?.refresh();
2093
2152
  }).catch(() => {
2094
2153
  });
2095
2154
  }, 300);
2096
2155
  },
2097
2156
  { deep: !0 }
2098
2157
  );
2099
- function we(E) {
2100
- E.key === "Escape" && m.value && ye();
2158
+ function Le(T) {
2159
+ T.key === "Escape" && m.value && we();
2101
2160
  }
2102
- xe(async () => {
2103
- if (window.addEventListener("keydown", we), l.catalog === null && n) {
2104
- v = ge(n);
2161
+ Ce(async () => {
2162
+ if (window.addEventListener("keydown", Le), l.catalog === null && a) {
2163
+ v = ke(a);
2105
2164
  try {
2106
- z.value = await v.catalog();
2107
- } catch (E) {
2108
- q.danger(u(E));
2165
+ A.value = await v.catalog();
2166
+ } catch (T) {
2167
+ F.danger(r(T));
2109
2168
  }
2110
- } else n && (v = ge(n));
2169
+ } else a && (v = ke(a));
2111
2170
  }), Ze(() => {
2112
- clearTimeout(ue), window.removeEventListener("keydown", we);
2171
+ clearTimeout(fe), window.removeEventListener("keydown", Le);
2113
2172
  });
2114
- const Pe = C(
2115
- () => h.value?.content ? Qe(h.value.content.schema) : []
2173
+ const _e = B(
2174
+ () => f.value?.content ? Xe(f.value.content.schema) : []
2116
2175
  );
2117
- return (E, M) => e(s) ? (i(), x("div", kn, [
2118
- r(e(R), {
2176
+ return (T, P) => e(n) ? (i(), V("div", $n, [
2177
+ u(e(j), {
2119
2178
  size: "sm",
2120
2179
  tone: "muted"
2121
2180
  }, {
2122
- default: d(() => [
2123
- _(p(e(o)("field.nested-note")), 1)
2181
+ default: c(() => [
2182
+ w(p(e(o)("field.nested-note")), 1)
2124
2183
  ]),
2125
2184
  _: 1
2126
2185
  })
2127
- ])) : (i(), x("div", {
2186
+ ])) : (i(), V("div", {
2128
2187
  key: 1,
2129
- class: he(["wx-blocks-host", { "is-fill": t.fill }])
2188
+ class: be(["wx-blocks-host", { "is-fill": t.fill }])
2130
2189
  }, [
2131
2190
  $("div", {
2132
- class: he(["wx-blocks", {
2133
- "is-editing": f.value !== null,
2191
+ class: be(["wx-blocks", {
2192
+ "is-editing": h.value !== null,
2134
2193
  "has-preview": e(y) !== null && e(y).url.value !== null
2135
2194
  }])
2136
2195
  }, [
2137
- $("div", yn, [
2138
- $("div", wn, [
2139
- $("span", _n, p(e(o)("field.blocks")), 1),
2140
- r(e(R), {
2196
+ $("div", Vn, [
2197
+ $("div", Sn, [
2198
+ $("span", Cn, p(e(o)("field.blocks")), 1),
2199
+ u(e(j), {
2141
2200
  size: "sm",
2142
2201
  tone: "muted"
2143
2202
  }, {
2144
- default: d(() => [
2145
- _(p(g.value.length), 1)
2203
+ default: c(() => [
2204
+ w(p(b.value.length), 1)
2146
2205
  ]),
2147
2206
  _: 1
2148
2207
  })
2149
2208
  ]),
2150
- r(gn, {
2151
- nodes: g.value,
2152
- catalog: c.value,
2209
+ u(xn, {
2210
+ nodes: b.value,
2211
+ catalog: d.value,
2153
2212
  selected: m.value,
2154
2213
  disabled: t.disabled,
2155
- onSelect: Se,
2156
- onAdd: L,
2157
- onRemove: ne,
2158
- onDuplicate: re,
2159
- onVisibility: Ce,
2160
- onReorder: Me
2214
+ onSelect: We,
2215
+ onAdd: N,
2216
+ onRemove: M,
2217
+ onDuplicate: O,
2218
+ onVisibility: ee,
2219
+ onReorder: de
2161
2220
  }, null, 8, ["nodes", "catalog", "selected", "disabled"]),
2162
- !t.disabled && (t.max === null || g.value.length < t.max) ? (i(), W(e(J), {
2163
- key: 0,
2164
- variant: "outline",
2165
- block: "",
2166
- icon: "plus",
2167
- class: "wx-blocks__add",
2168
- onClick: M[0] || (M[0] = (O) => L(null, null, null))
2169
- }, {
2170
- default: d(() => [
2171
- _(p(e(o)("field.add")), 1)
2172
- ]),
2173
- _: 1
2174
- })) : A("", !0),
2175
- e(y) && e(y).url.value ? (i(), W(e(J), {
2176
- key: 1,
2177
- variant: "text",
2178
- block: "",
2179
- class: "wx-blocks__preview-button",
2180
- onClick: M[1] || (M[1] = (O) => w.value?.open())
2181
- }, {
2182
- default: d(() => [
2183
- _(p(e(o)("field.preview")), 1)
2184
- ]),
2185
- _: 1
2186
- })) : A("", !0)
2221
+ $("div", Tn, [
2222
+ !t.disabled && (t.max === null || b.value.length < t.max) ? (i(), W(e(q), {
2223
+ key: 0,
2224
+ variant: "outline",
2225
+ icon: "plus",
2226
+ class: "wx-blocks__add",
2227
+ onClick: P[0] || (P[0] = (R) => N(null, null, null))
2228
+ }, {
2229
+ default: c(() => [
2230
+ w(p(e(o)("field.add")), 1)
2231
+ ]),
2232
+ _: 1
2233
+ })) : L("", !0),
2234
+ e(y) && e(y).url.value ? (i(), W(e(q), {
2235
+ key: 1,
2236
+ variant: "outline",
2237
+ icon: "eye",
2238
+ class: "wx-blocks__preview-button",
2239
+ onClick: P[1] || (P[1] = (R) => _.value?.open())
2240
+ }, {
2241
+ default: c(() => [
2242
+ w(p(e(o)("field.preview")), 1)
2243
+ ]),
2244
+ _: 1
2245
+ })) : L("", !0)
2246
+ ])
2187
2247
  ]),
2188
- f.value ? (i(), x("div", xn, [
2189
- $("div", $n, [
2190
- $("span", Vn, p(h.value?.title ?? f.value.node.type), 1),
2191
- $("span", Tn, [
2192
- $("code", null, p(f.value.node.type), 1),
2193
- r(e(J), {
2248
+ h.value ? (i(), V("div", Bn, [
2249
+ $("div", En, [
2250
+ $("span", Wn, p(f.value?.title ?? h.value.node.type), 1),
2251
+ $("span", An, [
2252
+ $("code", null, p(h.value.node.type), 1),
2253
+ u(e(q), {
2194
2254
  size: "sm",
2195
2255
  variant: "outline",
2196
- onClick: ye
2256
+ onClick: we
2197
2257
  }, {
2198
- default: d(() => [
2199
- _(p(e(o)("field.done")) + " · Esc", 1)
2258
+ default: c(() => [
2259
+ w(p(e(o)("field.done")) + " · Esc", 1)
2200
2260
  ]),
2201
2261
  _: 1
2202
2262
  })
2203
2263
  ])
2204
2264
  ]),
2205
- $("div", Cn, [
2206
- h.value?.content ? (i(), W(e(wt), {
2207
- key: f.value.node.key,
2208
- "model-value": f.value.node.values,
2209
- root: Pe.value,
2210
- types: T.value,
2265
+ $("div", Ln, [
2266
+ f.value?.content ? (i(), W(e(Vt), {
2267
+ key: h.value.node.key,
2268
+ "model-value": h.value.node.values,
2269
+ root: _e.value,
2270
+ types: C.value,
2211
2271
  translate: D.value,
2212
- can: P.value,
2272
+ can: K.value,
2213
2273
  disabled: t.disabled,
2214
- "onUpdate:modelValue": Be
2215
- }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (i(), W(e(R), {
2274
+ "onUpdate:modelValue": pe
2275
+ }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (i(), W(e(j), {
2216
2276
  key: 1,
2217
2277
  size: "sm",
2218
2278
  tone: "danger"
2219
2279
  }, {
2220
- default: d(() => [
2221
- _(p(e(o)("field.unknown-type", { type: f.value.node.type })), 1)
2280
+ default: c(() => [
2281
+ w(p(e(o)("field.unknown-type", { type: h.value.node.type })), 1)
2222
2282
  ]),
2223
2283
  _: 1
2224
2284
  }))
2225
2285
  ])
2226
- ])) : A("", !0),
2227
- e(y) && e(y).url.value ? (i(), x("div", Sn, [
2228
- r(on, {
2286
+ ])) : L("", !0),
2287
+ e(y) && e(y).url.value ? (i(), V("div", zn, [
2288
+ u(pn, {
2229
2289
  ref_key: "previewEl",
2230
- ref: w,
2290
+ ref: _,
2231
2291
  url: e(y).url.value,
2232
2292
  selected: m.value,
2233
- mode: f.value ? "phone" : "wide",
2293
+ mode: h.value ? "phone" : "wide",
2234
2294
  reload: e(y).reload?.value ?? 0,
2235
- fill: t.fill
2295
+ fill: t.fill,
2296
+ onSelect: Ae
2236
2297
  }, null, 8, ["url", "selected", "mode", "reload", "fill"])
2237
- ])) : A("", !0)
2298
+ ])) : L("", !0)
2238
2299
  ], 2)
2239
2300
  ], 2));
2240
2301
  }
2241
- }), Wn = /* @__PURE__ */ Q(Bn, [["__scopeId", "data-v-84cb4c0e"]]), An = { class: "wx-block-card__body" }, zn = { class: "wx-block-card__title" }, En = { class: "wx-block-card__chips" }, Un = /* @__PURE__ */ Y({
2302
+ }), Un = /* @__PURE__ */ X(In, [["__scopeId", "data-v-40ee98fe"]]), Nn = { class: "wx-block-card__body" }, Pn = { class: "wx-block-card__title" }, Mn = { class: "wx-block-card__chips" }, On = /* @__PURE__ */ Q({
2242
2303
  __name: "BlockCard",
2243
2304
  props: {
2244
2305
  block: {}
2245
2306
  },
2246
2307
  emits: ["open"],
2247
2308
  setup(t, { emit: l }) {
2248
- const a = l, s = te("webx-blocks");
2249
- return (o, u) => (i(), x("button", {
2309
+ const s = l, n = le("webx-blocks");
2310
+ return (o, r) => (i(), V("button", {
2250
2311
  type: "button",
2251
2312
  class: "wx-block-card",
2252
- onClick: u[0] || (u[0] = (n) => a("open", t.block))
2313
+ onClick: r[0] || (r[0] = (a) => s("open", t.block))
2253
2314
  }, [
2254
- r(At, {
2315
+ u(It, {
2255
2316
  thumbnail: t.block.thumbnail,
2256
2317
  height: 120
2257
2318
  }, null, 8, ["thumbnail"]),
2258
- $("div", An, [
2259
- $("div", zn, p(t.block.title), 1),
2260
- r(e(R), {
2319
+ $("div", Nn, [
2320
+ $("div", Pn, p(t.block.title), 1),
2321
+ u(e(j), {
2261
2322
  size: "sm",
2262
2323
  tone: "muted"
2263
2324
  }, {
2264
- default: d(() => [
2325
+ default: c(() => [
2265
2326
  $("code", null, p(t.block.slug), 1),
2266
- _(" · " + p(t.block.usage_count > 0 ? e(s)("page.on-pages", { count: t.block.usage_count }) : e(s)("page.not-used")), 1)
2327
+ w(" · " + p(t.block.usage_count > 0 ? e(n)("page.on-pages", { count: t.block.usage_count }) : e(n)("page.not-used")), 1)
2267
2328
  ]),
2268
2329
  _: 1
2269
2330
  }),
2270
- $("div", En, [
2271
- t.block.draft ? (i(), W(e(K), {
2331
+ $("div", Mn, [
2332
+ t.block.draft ? (i(), W(e(J), {
2272
2333
  key: 0,
2273
2334
  type: "warning",
2274
2335
  dot: ""
2275
2336
  }, {
2276
- default: d(() => [
2277
- _(p(e(s)("page.draft", { number: t.block.draft.number })), 1)
2337
+ default: c(() => [
2338
+ w(p(e(n)("page.draft", { number: t.block.draft.number })), 1)
2278
2339
  ]),
2279
2340
  _: 1
2280
- })) : A("", !0),
2281
- t.block.published ? (i(), W(e(K), {
2341
+ })) : L("", !0),
2342
+ t.block.published ? (i(), W(e(J), {
2282
2343
  key: 1,
2283
2344
  type: "success",
2284
2345
  dot: ""
2285
2346
  }, {
2286
- default: d(() => [
2287
- _(p(e(s)("page.live", { number: t.block.published.number })), 1)
2347
+ default: c(() => [
2348
+ w(p(e(n)("page.live", { number: t.block.published.number })), 1)
2288
2349
  ]),
2289
2350
  _: 1
2290
- })) : (i(), W(e(K), {
2351
+ })) : (i(), W(e(J), {
2291
2352
  key: 2,
2292
2353
  type: "default"
2293
2354
  }, {
2294
- default: d(() => [
2295
- _(p(e(s)("page.never-published")), 1)
2355
+ default: c(() => [
2356
+ w(p(e(n)("page.never-published")), 1)
2296
2357
  ]),
2297
2358
  _: 1
2298
2359
  })),
2299
- t.block.is_enabled ? A("", !0) : (i(), W(e(K), {
2360
+ t.block.is_enabled ? L("", !0) : (i(), W(e(J), {
2300
2361
  key: 3,
2301
2362
  type: "default",
2302
2363
  variant: "outline"
2303
2364
  }, {
2304
- default: d(() => [
2305
- _(p(e(s)("page.hidden")), 1)
2365
+ default: c(() => [
2366
+ w(p(e(n)("page.hidden")), 1)
2306
2367
  ]),
2307
2368
  _: 1
2308
2369
  }))
@@ -2310,62 +2371,62 @@ const dt = /* @__PURE__ */ Symbol("wx-blocks-root"), kn = {
2310
2371
  ])
2311
2372
  ]));
2312
2373
  }
2313
- }), In = /* @__PURE__ */ Q(Un, [["__scopeId", "data-v-daa12de4"]]), Nn = { class: "wx-block-create" }, Ln = /* @__PURE__ */ Y({
2374
+ }), Dn = /* @__PURE__ */ X(On, [["__scopeId", "data-v-daa12de4"]]), Rn = { class: "wx-block-create" }, jn = /* @__PURE__ */ Q({
2314
2375
  __name: "BlockCreateDialog",
2315
2376
  setup(t) {
2316
- const { resolve: l, dismiss: a, open: s } = bt(), o = $e(), u = ge(o);
2317
- Te();
2318
- const n = te("webx-blocks"), v = Ve(), z = C(() => o.state.manifest?.modules.find((T) => T.id === "blocks")?.meta?.groups ?? ["content"]), c = N({ title: "", slug: "", group: z.value[0] ?? "content" }), g = N({}), m = N(!1), f = N(!1), h = C(
2319
- () => z.value.map((k) => ({ value: k, label: ke(k, n) }))
2377
+ const { resolve: l, dismiss: s, open: n } = wt(), o = Te(), r = ke(o);
2378
+ Ee();
2379
+ const a = le("webx-blocks"), v = Be(), A = B(() => o.state.manifest?.modules.find((C) => C.id === "blocks")?.meta?.groups ?? ["content"]), d = U({ title: "", slug: "", group: A.value[0] ?? "content" }), b = U({}), m = U(!1), h = U(!1), f = B(
2380
+ () => A.value.map((k) => ({ value: k, label: ye(k, a) }))
2320
2381
  );
2321
2382
  function y(k) {
2322
2383
  return k.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
2323
2384
  }
2324
- oe(
2325
- () => c.value.title,
2385
+ ie(
2386
+ () => d.value.title,
2326
2387
  (k) => {
2327
- f.value || (c.value.slug = y(k));
2388
+ h.value || (d.value.slug = y(k));
2328
2389
  }
2329
2390
  );
2330
- function w(k) {
2331
- return g.value[k]?.[0];
2391
+ function _(k) {
2392
+ return b.value[k]?.[0];
2332
2393
  }
2333
- async function V() {
2334
- m.value = !0, g.value = {};
2394
+ async function S() {
2395
+ m.value = !0, b.value = {};
2335
2396
  try {
2336
- l(await u.create(c.value));
2397
+ l(await r.create(d.value));
2337
2398
  } catch (k) {
2338
- const T = k.body;
2339
- T?.errors ? g.value = T.errors : q.danger(v(k, n("page.failed")));
2399
+ const C = k.body;
2400
+ C?.errors ? b.value = C.errors : F.danger(v(k, a("page.failed")));
2340
2401
  } finally {
2341
2402
  m.value = !1;
2342
2403
  }
2343
2404
  }
2344
- return (k, T) => (i(), W(e(gt), {
2345
- open: e(s),
2346
- "onUpdate:open": T[5] || (T[5] = (D) => ct(s) ? s.value = D : null),
2347
- title: e(n)("page.new"),
2405
+ return (k, C) => (i(), W(e(_t), {
2406
+ open: e(n),
2407
+ "onUpdate:open": C[5] || (C[5] = (D) => mt(n) ? n.value = D : null),
2408
+ title: e(a)("page.new"),
2348
2409
  width: 520
2349
2410
  }, {
2350
- footer: d(() => [
2351
- r(e(Jt), { size: "sm" }, {
2352
- default: d(() => [
2353
- r(e(J), {
2411
+ footer: c(() => [
2412
+ u(e(Qt), { size: "sm" }, {
2413
+ default: c(() => [
2414
+ u(e(q), {
2354
2415
  variant: "outline",
2355
- onClick: T[4] || (T[4] = (D) => e(a)())
2416
+ onClick: C[4] || (C[4] = (D) => e(s)())
2356
2417
  }, {
2357
- default: d(() => [
2358
- _(p(e(n)("page.cancel")), 1)
2418
+ default: c(() => [
2419
+ w(p(e(a)("page.cancel")), 1)
2359
2420
  ]),
2360
2421
  _: 1
2361
2422
  }),
2362
- r(e(J), {
2423
+ u(e(q), {
2363
2424
  type: "primary",
2364
2425
  loading: m.value,
2365
- onClick: V
2426
+ onClick: S
2366
2427
  }, {
2367
- default: d(() => [
2368
- _(p(e(n)("page.create")), 1)
2428
+ default: c(() => [
2429
+ w(p(e(a)("page.create")), 1)
2369
2430
  ]),
2370
2431
  _: 1
2371
2432
  }, 8, ["loading"])
@@ -2373,46 +2434,46 @@ const dt = /* @__PURE__ */ Symbol("wx-blocks-root"), kn = {
2373
2434
  _: 1
2374
2435
  })
2375
2436
  ]),
2376
- default: d(() => [
2377
- $("div", Nn, [
2378
- r(e(G), {
2379
- label: e(n)("page.title"),
2380
- error: w("title")
2437
+ default: c(() => [
2438
+ $("div", Rn, [
2439
+ u(e(Y), {
2440
+ label: e(a)("page.title"),
2441
+ error: _("title")
2381
2442
  }, {
2382
- default: d(() => [
2383
- r(e(be), {
2384
- modelValue: c.value.title,
2385
- "onUpdate:modelValue": T[0] || (T[0] = (D) => c.value.title = D),
2443
+ default: c(() => [
2444
+ u(e(ge), {
2445
+ modelValue: d.value.title,
2446
+ "onUpdate:modelValue": C[0] || (C[0] = (D) => d.value.title = D),
2386
2447
  autofocus: ""
2387
2448
  }, null, 8, ["modelValue"])
2388
2449
  ]),
2389
2450
  _: 1
2390
2451
  }, 8, ["label", "error"]),
2391
- r(e(G), {
2392
- label: e(n)("page.identifier"),
2393
- help: e(n)("page.identifier-help"),
2394
- error: w("slug")
2452
+ u(e(Y), {
2453
+ label: e(a)("page.identifier"),
2454
+ help: e(a)("page.identifier-help"),
2455
+ error: _("slug")
2395
2456
  }, {
2396
- default: d(() => [
2397
- r(e(be), {
2398
- modelValue: c.value.slug,
2399
- "onUpdate:modelValue": T[1] || (T[1] = (D) => c.value.slug = D),
2457
+ default: c(() => [
2458
+ u(e(ge), {
2459
+ modelValue: d.value.slug,
2460
+ "onUpdate:modelValue": C[1] || (C[1] = (D) => d.value.slug = D),
2400
2461
  placeholder: "hero",
2401
- onInput: T[2] || (T[2] = (D) => f.value = !0)
2462
+ onInput: C[2] || (C[2] = (D) => h.value = !0)
2402
2463
  }, null, 8, ["modelValue"])
2403
2464
  ]),
2404
2465
  _: 1
2405
2466
  }, 8, ["label", "help", "error"]),
2406
- r(e(G), {
2407
- label: e(n)("page.group"),
2408
- help: e(n)("page.group-help"),
2409
- error: w("group")
2467
+ u(e(Y), {
2468
+ label: e(a)("page.group"),
2469
+ help: e(a)("page.group-help"),
2470
+ error: _("group")
2410
2471
  }, {
2411
- default: d(() => [
2412
- r(e(ht), {
2413
- modelValue: c.value.group,
2414
- "onUpdate:modelValue": T[3] || (T[3] = (D) => c.value.group = D),
2415
- options: h.value
2472
+ default: c(() => [
2473
+ u(e(yt), {
2474
+ modelValue: d.value.group,
2475
+ "onUpdate:modelValue": C[3] || (C[3] = (D) => d.value.group = D),
2476
+ options: f.value
2416
2477
  }, null, 8, ["modelValue", "options"])
2417
2478
  ]),
2418
2479
  _: 1
@@ -2422,114 +2483,114 @@ const dt = /* @__PURE__ */ Symbol("wx-blocks-root"), kn = {
2422
2483
  _: 1
2423
2484
  }, 8, ["open", "title"]));
2424
2485
  }
2425
- }), Mn = /* @__PURE__ */ Q(Ln, [["__scopeId", "data-v-a4c0d44c"]]), Pn = {
2486
+ }), Hn = /* @__PURE__ */ X(jn, [["__scopeId", "data-v-a4c0d44c"]]), Fn = {
2426
2487
  key: 1,
2427
2488
  class: "wx-blocks-page__toolbar"
2428
- }, On = { class: "wx-blocks-page__cards" }, Dn = { class: "wx-blocks-page__ghost-body" }, Rn = {
2489
+ }, qn = { class: "wx-blocks-page__cards" }, Jn = { class: "wx-blocks-page__ghost-body" }, Kn = {
2429
2490
  key: 0,
2430
2491
  class: "wx-blocks-page__group-title"
2431
- }, jn = { class: "wx-blocks-page__cards" }, Hn = /* @__PURE__ */ Y({
2492
+ }, Zn = { class: "wx-blocks-page__cards" }, Gn = /* @__PURE__ */ Q({
2432
2493
  __name: "BlocksPage",
2433
2494
  props: {
2434
2495
  base: { default: "/blocks" }
2435
2496
  },
2436
2497
  setup(t) {
2437
- const l = t, a = $e(), s = ge(a), o = ft();
2438
- Te();
2439
- const u = te("webx-blocks"), n = Ve(), v = N([]), z = N(!0), c = N(""), g = N(""), m = yt(Mn), f = C(() => {
2440
- const B = a.state.manifest?.modules.find((L) => L.id === "blocks")?.meta;
2498
+ const l = t, s = Te(), n = ke(s), o = bt();
2499
+ Ee();
2500
+ const r = le("webx-blocks"), a = Be(), v = U([]), A = U(!0), d = U(""), b = U(""), m = $t(Hn), h = B(() => {
2501
+ const z = s.state.manifest?.modules.find((N) => N.id === "blocks")?.meta;
2441
2502
  return {
2442
- groups: B?.groups ?? [],
2443
- editing: B?.editing ?? !0,
2444
- provides: B?.provides ?? []
2503
+ groups: z?.groups ?? [],
2504
+ editing: z?.editing ?? !0,
2505
+ provides: z?.provides ?? []
2445
2506
  };
2446
- }), h = C(() => a.can("blocks.manage") && f.value.editing), y = C(
2447
- () => a.state.manifest?.modules.find((B) => B.id === "blocks")?.title ?? u("module.title")
2448
- ), w = C(() => {
2449
- const B = c.value.trim().toLowerCase(), L = g.value === "" ? v.value : v.value.filter((I) => I.group === g.value);
2450
- return B === "" ? L : L.filter(
2451
- (I) => I.title.toLowerCase().includes(B) || I.slug.includes(B) || (I.description ?? "").toLowerCase().includes(B)
2507
+ }), f = B(() => s.can("blocks.manage") && h.value.editing), y = B(
2508
+ () => s.state.manifest?.modules.find((z) => z.id === "blocks")?.title ?? r("module.title")
2509
+ ), _ = B(() => {
2510
+ const z = d.value.trim().toLowerCase(), N = b.value === "" ? v.value : v.value.filter((I) => I.group === b.value);
2511
+ return z === "" ? N : N.filter(
2512
+ (I) => I.title.toLowerCase().includes(z) || I.slug.includes(z) || (I.description ?? "").toLowerCase().includes(z)
2452
2513
  );
2453
- }), V = C(() => {
2454
- const B = [...f.value.groups];
2455
- for (const L of v.value)
2456
- B.includes(L.group) || B.push(L.group);
2457
- return B.filter((L) => v.value.some((I) => I.group === L));
2458
- }), k = C(
2459
- () => V.value.length < 2 ? [] : [
2460
- { value: "", label: u("page.all-groups") },
2461
- ...V.value.map((B) => ({ value: B, label: ke(B, u) }))
2514
+ }), S = B(() => {
2515
+ const z = [...h.value.groups];
2516
+ for (const N of v.value)
2517
+ z.includes(N.group) || z.push(N.group);
2518
+ return z.filter((N) => v.value.some((I) => I.group === N));
2519
+ }), k = B(
2520
+ () => S.value.length < 2 ? [] : [
2521
+ { value: "", label: r("page.all-groups") },
2522
+ ...S.value.map((z) => ({ value: z, label: ye(z, r) }))
2462
2523
  ]
2463
- ), T = C(() => {
2464
- const B = V.value.map((I) => ({
2524
+ ), C = B(() => {
2525
+ const z = S.value.map((I) => ({
2465
2526
  id: I,
2466
- label: ke(I, u),
2467
- blocks: w.value.filter((ne) => ne.group === I)
2527
+ label: ye(I, r),
2528
+ blocks: _.value.filter((M) => M.group === I)
2468
2529
  })).filter((I) => I.blocks.length > 0);
2469
- return g.value !== "" || w.value.length <= 5 || c.value.trim() !== "" || B.length < 2 ? [{ id: "", label: "", blocks: w.value }] : B;
2530
+ return b.value !== "" || _.value.length <= 5 || d.value.trim() !== "" || z.length < 2 ? [{ id: "", label: "", blocks: _.value }] : z;
2470
2531
  });
2471
2532
  async function D() {
2472
- z.value = !0;
2533
+ A.value = !0;
2473
2534
  try {
2474
- v.value = await s.list();
2475
- } catch (B) {
2476
- q.danger(n(B));
2535
+ v.value = await n.list();
2536
+ } catch (z) {
2537
+ F.danger(a(z));
2477
2538
  } finally {
2478
- z.value = !1;
2539
+ A.value = !1;
2479
2540
  }
2480
2541
  }
2481
- function P(B) {
2482
- o.push(`${l.base}/${B.id}`);
2542
+ function K(z) {
2543
+ o.push(`${l.base}/${z.id}`);
2483
2544
  }
2484
- async function F() {
2485
- const B = await m({});
2486
- B && P(B);
2545
+ async function ne() {
2546
+ const z = await m({});
2547
+ z && K(z);
2487
2548
  }
2488
- return xe(D), (B, L) => (i(), W(e(Dt), {
2489
- view: g.value,
2490
- "onUpdate:view": L[1] || (L[1] = (I) => g.value = I),
2549
+ return Ce(D), (z, N) => (i(), W(e(qt), {
2550
+ view: b.value,
2551
+ "onUpdate:view": N[1] || (N[1] = (I) => b.value = I),
2491
2552
  class: "wx-blocks-page",
2492
2553
  title: y.value,
2493
2554
  views: k.value
2494
- }, Lt({
2495
- default: d(() => [
2496
- f.value.editing ? A("", !0) : (i(), W(e(mt), {
2555
+ }, Mt({
2556
+ default: c(() => [
2557
+ h.value.editing ? L("", !0) : (i(), W(e(kt), {
2497
2558
  key: 0,
2498
2559
  type: "info",
2499
2560
  variant: "soft",
2500
- description: e(u)("page.editing-off")
2561
+ description: e(r)("page.editing-off")
2501
2562
  }, null, 8, ["description"])),
2502
- z.value || v.value.length > 0 ? (i(), x("div", Pn, [
2503
- r(e(be), {
2504
- modelValue: c.value,
2505
- "onUpdate:modelValue": L[0] || (L[0] = (I) => c.value = I),
2563
+ A.value || v.value.length > 0 ? (i(), V("div", Fn, [
2564
+ u(e(ge), {
2565
+ modelValue: d.value,
2566
+ "onUpdate:modelValue": N[0] || (N[0] = (I) => d.value = I),
2506
2567
  class: "wx-blocks-page__search",
2507
- placeholder: e(u)("page.search"),
2568
+ placeholder: e(r)("page.search"),
2508
2569
  clearable: ""
2509
2570
  }, null, 8, ["modelValue", "placeholder"])
2510
- ])) : A("", !0),
2511
- z.value ? (i(), W(e(me), { key: 2 }, {
2512
- template: d(() => [
2513
- $("div", On, [
2514
- (i(), x(H, null, ee(4, (I) => $("div", {
2571
+ ])) : L("", !0),
2572
+ A.value ? (i(), W(e(he), { key: 2 }, {
2573
+ template: c(() => [
2574
+ $("div", qn, [
2575
+ (i(), V(H, null, te(4, (I) => $("div", {
2515
2576
  key: I,
2516
2577
  class: "wx-blocks-page__ghost"
2517
2578
  }, [
2518
- r(e(ze), {
2579
+ u(e(Ue), {
2519
2580
  variant: "image",
2520
2581
  height: 120,
2521
2582
  class: "wx-blocks-page__ghost-thumb"
2522
2583
  }),
2523
- $("div", Dn, [
2524
- r(e(ze), {
2584
+ $("div", Jn, [
2585
+ u(e(Ue), {
2525
2586
  variant: "title",
2526
2587
  width: "45%"
2527
2588
  }),
2528
- r(e(ze), {
2589
+ u(e(Ue), {
2529
2590
  variant: "text",
2530
2591
  width: "70%"
2531
2592
  }),
2532
- r(e(ze), {
2593
+ u(e(Ue), {
2533
2594
  variant: "button",
2534
2595
  width: "64px",
2535
2596
  height: "22px"
@@ -2539,37 +2600,37 @@ const dt = /* @__PURE__ */ Symbol("wx-blocks-root"), kn = {
2539
2600
  ])
2540
2601
  ]),
2541
2602
  _: 1
2542
- })) : v.value.length === 0 ? (i(), W(e(kt), {
2603
+ })) : v.value.length === 0 ? (i(), W(e(xt), {
2543
2604
  key: 3,
2544
2605
  icon: "grid",
2545
- title: e(u)("page.empty"),
2546
- description: e(u)("page.empty-help")
2547
- }, null, 8, ["title", "description"])) : (i(!0), x(H, { key: 4 }, ee(T.value, (I) => (i(), x("section", {
2606
+ title: e(r)("page.empty"),
2607
+ description: e(r)("page.empty-help")
2608
+ }, null, 8, ["title", "description"])) : (i(!0), V(H, { key: 4 }, te(C.value, (I) => (i(), V("section", {
2548
2609
  key: I.id,
2549
2610
  class: "wx-blocks-page__group"
2550
2611
  }, [
2551
- I.label ? (i(), x("div", Rn, p(I.label), 1)) : A("", !0),
2552
- $("div", jn, [
2553
- (i(!0), x(H, null, ee(I.blocks, (ne) => (i(), W(In, {
2554
- key: ne.id,
2555
- block: ne,
2556
- onOpen: P
2612
+ I.label ? (i(), V("div", Kn, p(I.label), 1)) : L("", !0),
2613
+ $("div", Zn, [
2614
+ (i(!0), V(H, null, te(I.blocks, (M) => (i(), W(Dn, {
2615
+ key: M.id,
2616
+ block: M,
2617
+ onOpen: K
2557
2618
  }, null, 8, ["block"]))), 128))
2558
2619
  ])
2559
2620
  ]))), 128))
2560
2621
  ]),
2561
2622
  _: 2
2562
2623
  }, [
2563
- h.value ? {
2624
+ f.value ? {
2564
2625
  name: "actions",
2565
- fn: d(() => [
2566
- r(e(J), {
2626
+ fn: c(() => [
2627
+ u(e(q), {
2567
2628
  type: "primary",
2568
2629
  icon: "plus",
2569
- onClick: F
2630
+ onClick: ne
2570
2631
  }, {
2571
- default: d(() => [
2572
- _(p(e(u)("page.new")), 1)
2632
+ default: c(() => [
2633
+ w(p(e(r)("page.new")), 1)
2573
2634
  ]),
2574
2635
  _: 1
2575
2636
  })
@@ -2578,18 +2639,18 @@ const dt = /* @__PURE__ */ Symbol("wx-blocks-root"), kn = {
2578
2639
  } : void 0
2579
2640
  ]), 1032, ["view", "title", "views"]));
2580
2641
  }
2581
- }), Fn = /* @__PURE__ */ Q(Hn, [["__scopeId", "data-v-3cb993d5"]]);
2582
- function ta(t = {}) {
2642
+ }), Yn = /* @__PURE__ */ X(Gn, [["__scopeId", "data-v-3cb993d5"]]);
2643
+ function ia(t = {}) {
2583
2644
  const l = t.path ?? "/blocks";
2584
2645
  return {
2585
2646
  id: "blocks",
2586
2647
  path: l,
2587
2648
  routes: [
2588
- { path: l, name: "webx.blocks", component: Fn, props: { base: l } },
2649
+ { path: l, name: "webx.blocks", component: Yn, props: { base: l } },
2589
2650
  {
2590
2651
  path: `${l}/:id(\\d+)`,
2591
2652
  name: "webx.blocks.edit",
2592
- component: Hl,
2653
+ component: Zl,
2593
2654
  props: { base: l }
2594
2655
  }
2595
2656
  ],
@@ -2598,7 +2659,7 @@ function ta(t = {}) {
2598
2659
  // draws its children through the renderer; it needs the node for `props.allow` alone.
2599
2660
  types: {
2600
2661
  "wx-blocks": {
2601
- component: Wn,
2662
+ component: Un,
2602
2663
  kind: "field",
2603
2664
  nested: !0,
2604
2665
  bind: () => ({ blocksPath: l })
@@ -2607,37 +2668,37 @@ function ta(t = {}) {
2607
2668
  };
2608
2669
  }
2609
2670
  export {
2610
- Hl as WxBlockEditorPage,
2611
- tn as WxBlockPicker,
2612
- ul as WxBlockStage,
2613
- At as WxBlockThumb,
2614
- Wn as WxBlocks,
2615
- Fn as WxBlocksPage,
2616
- ta as blocks,
2617
- gl as blocksMessages,
2618
- Xe as blocksPreviewKey,
2619
- Ct as cloneNode,
2620
- cl as countType,
2621
- ge as createBlocksApi,
2622
- _t as findRange,
2623
- Qe as formSchema,
2671
+ Zl as WxBlockEditorPage,
2672
+ on as WxBlockPicker,
2673
+ fl as WxBlockStage,
2674
+ It as WxBlockThumb,
2675
+ Un as WxBlocks,
2676
+ Yn as WxBlocksPage,
2677
+ ia as blocks,
2678
+ _l as blocksMessages,
2679
+ et as blocksPreviewKey,
2680
+ Wt as cloneNode,
2681
+ ml as countType,
2682
+ ke as createBlocksApi,
2683
+ St as findRange,
2684
+ Xe as formSchema,
2624
2685
  Je as highlightBlock,
2625
- it as insertNode,
2626
- $t as isNode,
2627
- Ne as isNodeList,
2628
- yl as lintBlock,
2686
+ ct as insertNode,
2687
+ Tt as isNode,
2688
+ Oe as isNodeList,
2689
+ $l as lintBlock,
2629
2690
  se as locate,
2630
- dl as makeNode,
2691
+ vl as makeNode,
2631
2692
  Ke as newKey,
2632
- Xn as provideBlocksPreview,
2633
- ml as removeNode,
2634
- ll as replaceBlock,
2635
- bl as replaceList,
2636
- xt as stageDocument,
2637
- Qn as typesIn,
2638
- wl as undeclared,
2639
- hl as updateValues,
2640
- ea as useBlocksPreview,
2641
- Le as walk
2693
+ sa as provideBlocksPreview,
2694
+ kl as removeNode,
2695
+ il as replaceBlock,
2696
+ wl as replaceList,
2697
+ Ct as stageDocument,
2698
+ aa as typesIn,
2699
+ Vl as undeclared,
2700
+ yl as updateValues,
2701
+ oa as useBlocksPreview,
2702
+ De as walk
2642
2703
  };
2643
2704
  //# sourceMappingURL=index.js.map