@webx-ui/module-notifications 0.3.0 → 0.3.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.
@@ -1,9 +1,9 @@
1
- import { defineComponent as L, useModel as q, computed as h, openBlock as p, createElementBlock as w, createVNode as g, unref as s, createBlock as k, withCtx as m, createTextVNode as y, toDisplayString as v, createCommentVNode as W, mergeModels as K, provide as xe, inject as $e, ref as j, onMounted as ne, isRef as Te, Fragment as z, renderList as M, createElementVNode as I, watch as Ce, onBeforeUnmount as Se, normalizeStyle as Ae, defineAsyncComponent as pe } from "vue";
2
- import { useRouter as je } from "vue-router";
3
- import { WxLink as We, useModal as Ne, WxDialog as Ve, WxSkeleton as Oe, WxAlert as D, WxEmpty as ze, WxCheckbox as Fe, WxText as N, WxBadge as ae, WxSpace as le, WxButton as V, createModal as Ee, WxInput as Z, WxAction as fe, WxIcon as H, toast as J, WxSelect as Me, useLocales as me, mustacheCompletions as Le, mustacheProblems as Pe, WxCodeEditor as Re, WxTooltip as Ue, confirm as Be, localizedValue as ie, WxCard as Ie } from "@webx-ui/core";
4
- import { useAdmin as G, useTranslate as P, WxRelationsField as De, useErrorText as He } from "@webx-ui/module-admin";
5
- import qe from "mustache";
6
- const Ke = {
1
+ import { defineComponent as P, useModel as K, computed as m, openBlock as p, createElementBlock as w, createVNode as g, unref as s, createBlock as _, withCtx as f, createTextVNode as y, toDisplayString as h, createCommentVNode as j, mergeModels as G, provide as Ce, inject as Se, ref as A, onMounted as ae, isRef as Ae, Fragment as F, renderList as L, createElementVNode as D, mergeProps as fe, watch as je, onBeforeUnmount as We, normalizeStyle as Ne, defineAsyncComponent as me } from "vue";
2
+ import { useRouter as Ve } from "vue-router";
3
+ import { WxLink as Oe, useModal as ze, WxDialog as Fe, WxSkeleton as Ee, WxAlert as H, WxEmpty as Me, WxCheckbox as Le, WxText as W, WxBadge as le, WxSpace as se, WxButton as O, createModal as Pe, WxInput as J, WxAction as he, WxIcon as q, toast as Y, WxSelect as Re, useLocales as ve, mustacheCompletions as Ue, mustacheProblems as Be, WxCodeEditor as Ie, WxTooltip as De, confirm as He, localizedValue as oe, WxCard as qe } from "@webx-ui/core";
4
+ import { useAdmin as Q, useTranslate as R, WxRelationsField as Ke, useErrorText as Ge, useRemoveConfirm as be } from "@webx-ui/module-admin";
5
+ import Qe from "mustache";
6
+ const Xe = {
7
7
  module: {
8
8
  title: "Notifications",
9
9
  channel: "Channel",
@@ -168,18 +168,18 @@ const Ke = {
168
168
  "template-delimiters": "Changing the delimiters ({{=<% %>=}}) is not available in a message template.",
169
169
  "template-pragma": "Pragmas and blocks ({{%…}}, {{$…}}) are not available in a message template."
170
170
  }
171
- }, oe = /* @__PURE__ */ new WeakSet();
172
- function R() {
171
+ }, re = /* @__PURE__ */ new WeakSet();
172
+ function U() {
173
173
  try {
174
- const { i18n: t } = G();
175
- oe.has(t) || (t.defaults("webx-notifications", Ke), oe.add(t));
174
+ const { i18n: t } = Q();
175
+ re.has(t) || (t.defaults("webx-notifications", Xe), re.add(t));
176
176
  } catch {
177
177
  }
178
178
  }
179
- const Ge = { class: "wx-notification-channels" }, Qe = /* @__PURE__ */ L({
179
+ const Ze = { class: "wx-notification-channels" }, Je = /* @__PURE__ */ P({
180
180
  name: "WxNotificationChannelsField",
181
181
  __name: "ChannelsField",
182
- props: /* @__PURE__ */ K({
182
+ props: /* @__PURE__ */ G({
183
183
  event: {},
184
184
  disabled: { type: Boolean, default: !1 },
185
185
  base: { default: "/notifications" },
@@ -191,90 +191,90 @@ const Ge = { class: "wx-notification-channels" }, Qe = /* @__PURE__ */ L({
191
191
  }),
192
192
  emits: ["update:modelValue"],
193
193
  setup(t) {
194
- const e = t, a = q(t, "modelValue");
195
- R();
196
- const l = G(), n = P("webx-notifications"), i = h(() => `notify-${e.event.replace(/[._]/g, "-")}`), o = h(() => l.can("notifications.manage")), d = je(), _ = h(() => `${l.basePath}${e.base}`.replace(/\/{2,}/g, "/"));
197
- function x(b) {
198
- b.metaKey || b.ctrlKey || b.shiftKey || b.button !== 0 || (b.preventDefault(), d.push(e.base));
194
+ const e = t, a = K(t, "modelValue");
195
+ U();
196
+ const l = Q(), n = R("webx-notifications"), i = m(() => `notify-${e.event.replace(/[._]/g, "-")}`), r = m(() => l.can("notifications.manage")), u = Ve(), b = m(() => `${l.basePath}${e.base}`.replace(/\/{2,}/g, "/"));
197
+ function k(v) {
198
+ v.metaKey || v.ctrlKey || v.shiftKey || v.button !== 0 || (v.preventDefault(), u.push(e.base));
199
199
  }
200
- return (b, $) => (p(), w("div", Ge, [
201
- g(s(De), {
200
+ return (v, x) => (p(), w("div", Ze, [
201
+ g(s(Ke), {
202
202
  modelValue: a.value,
203
- "onUpdate:modelValue": $[0] || ($[0] = (C) => a.value = C),
203
+ "onUpdate:modelValue": x[0] || (x[0] = (C) => a.value = C),
204
204
  target: i.value,
205
205
  sortable: !1,
206
206
  disabled: e.disabled,
207
207
  "add-text": e.addText ?? s(n)("panel.pick-channels"),
208
208
  "empty-text": e.emptyText
209
209
  }, null, 8, ["modelValue", "target", "disabled", "add-text", "empty-text"]),
210
- o.value ? (p(), k(s(We), {
210
+ r.value ? (p(), _(s(Oe), {
211
211
  key: 0,
212
- href: _.value,
212
+ href: b.value,
213
213
  size: "sm",
214
- onClick: x
214
+ onClick: k
215
215
  }, {
216
- default: m(() => [
217
- y(v(s(n)("panel.set-up-channels")), 1)
216
+ default: f(() => [
217
+ y(h(s(n)("panel.set-up-channels")), 1)
218
218
  ]),
219
219
  _: 1
220
- }, 8, ["href"])) : W("", !0)
220
+ }, 8, ["href"])) : j("", !0)
221
221
  ]));
222
222
  }
223
- }), U = (t, e) => {
223
+ }), B = (t, e) => {
224
224
  const a = t.__vccOpts || t;
225
225
  for (const [l, n] of e)
226
226
  a[l] = n;
227
227
  return a;
228
- }, Xe = /* @__PURE__ */ U(Qe, [["__scopeId", "data-v-e0a57880"]]);
229
- function he() {
230
- const t = j(null), e = /* @__PURE__ */ new Map();
228
+ }, Ye = /* @__PURE__ */ B(Je, [["__scopeId", "data-v-e0a57880"]]);
229
+ function ge() {
230
+ const t = A(null), e = /* @__PURE__ */ new Map();
231
231
  return {
232
232
  focused: t,
233
233
  inserters: e,
234
234
  insert: (a) => (e.get(t.value ?? "") ?? e.get("template"))?.(a)
235
235
  };
236
236
  }
237
- const ve = /* @__PURE__ */ Symbol("wx-notifications-channel");
238
- function Qt(t, e, a) {
237
+ const we = /* @__PURE__ */ Symbol("wx-notifications-channel");
238
+ function Zt(t, e, a) {
239
239
  const l = {
240
240
  meta: t,
241
241
  values: e,
242
242
  id: a,
243
- provider: h(
243
+ provider: m(
244
244
  () => t.value?.providers.find((n) => n.key === e.value.provider) ?? null
245
245
  ),
246
- event: h(() => t.value?.events.find((n) => n.key === e.value.event) ?? null),
247
- ...he()
246
+ event: m(() => t.value?.events.find((n) => n.key === e.value.event) ?? null),
247
+ ...ge()
248
248
  };
249
- return xe(ve, l), l;
249
+ return Ce(we, l), l;
250
250
  }
251
- function Q() {
252
- return $e(ve, null) ?? {
253
- meta: j(null),
254
- values: j({}),
255
- id: j(null),
256
- provider: h(() => null),
257
- event: h(() => null),
258
- ...he()
251
+ function X() {
252
+ return Se(we, null) ?? {
253
+ meta: A(null),
254
+ values: A({}),
255
+ id: A(null),
256
+ provider: m(() => null),
257
+ event: m(() => null),
258
+ ...ge()
259
259
  };
260
260
  }
261
- const Ze = "notifications";
262
- function Je(t) {
261
+ const et = "notifications";
262
+ function tt(t) {
263
263
  const e = new URLSearchParams();
264
264
  for (const [l, n] of Object.entries(t))
265
265
  n == null || n === "" || e.set(l, typeof n == "boolean" ? n ? "1" : "0" : String(n));
266
266
  const a = e.toString();
267
267
  return a === "" ? "" : `?${a}`;
268
268
  }
269
- function be(t) {
270
- const e = `${t.apiPath}/${Ze}`, a = (n) => n.data, l = (n) => n === null ? e : `${e}/channels/${n}`;
269
+ function ye(t) {
270
+ const e = `${t.apiPath}/${et}`, a = (n) => n.data, l = (n) => n === null ? e : `${e}/channels/${n}`;
271
271
  return {
272
272
  meta: () => t.http.get(`${e}/meta`).then(a),
273
273
  channels: (n = {}) => {
274
274
  const i = new URLSearchParams();
275
275
  n.trashed && i.set("trashed", "1"), n.event && i.set("event", n.event);
276
- const o = i.toString();
277
- return t.http.get(`${e}/channels${o === "" ? "" : `?${o}`}`);
276
+ const r = i.toString();
277
+ return t.http.get(`${e}/channels${r === "" ? "" : `?${r}`}`);
278
278
  },
279
279
  get: (n) => t.http.get(`${e}/channels/${n}`).then(a),
280
280
  create: (n) => t.http.post(`${e}/channels`, { values: n }).then(a),
@@ -285,25 +285,25 @@ function be(t) {
285
285
  purge: (n) => t.http.delete(`${e}/channels/${n}/purge`).then(() => {
286
286
  }),
287
287
  copy: (n, i) => t.http.post(`${e}/channels/${n}/copy`, i ? { name: i } : {}).then(a),
288
- test: (n, i, o) => t.http.post(`${l(n)}/test`, {
288
+ test: (n, i, r) => t.http.post(`${l(n)}/test`, {
289
289
  values: i,
290
- ...o ? { recipient: o } : {}
291
- }).then((d) => d.data.results),
292
- preview: (n, i, o) => t.http.post(`${l(n)}/preview`, { values: i, locale: o }).then(a),
290
+ ...r ? { recipient: r } : {}
291
+ }).then((u) => u.data.results),
292
+ preview: (n, i, r) => t.http.post(`${l(n)}/preview`, { values: i, locale: r }).then(a),
293
293
  check: (n, i) => t.http.post(`${e}/check`, { values: i, ...n ? { channel: n } : {} }).then(a),
294
- findRecipients: ({ provider: n, channel: i, token: o }) => t.http.post(
294
+ findRecipients: ({ provider: n, channel: i, token: r }) => t.http.post(
295
295
  `${e}/find-recipients`,
296
- { provider: n, ...i ? { channel: i } : {}, ...o ? { token: o } : {} }
296
+ { provider: n, ...i ? { channel: i } : {}, ...r ? { token: r } : {} }
297
297
  ).then(a),
298
298
  administrators: () => t.http.get(`${e}/administrators`).then(a),
299
- deliveries: (n = {}) => t.http.get(`${e}/deliveries${Je(n)}`),
299
+ deliveries: (n = {}) => t.http.get(`${e}/deliveries${tt(n)}`),
300
300
  retry: (n) => t.http.post(`${e}/deliveries/${n}/retry`, {}).then(a)
301
301
  };
302
302
  }
303
- const Ye = {
303
+ const nt = {
304
304
  key: 3,
305
305
  class: "wx-notifications-found"
306
- }, et = { class: "wx-notifications-found__text" }, tt = /* @__PURE__ */ L({
306
+ }, at = { class: "wx-notifications-found__text" }, lt = /* @__PURE__ */ P({
307
307
  name: "WxNotificationsFindChats",
308
308
  __name: "FindChatsDialog",
309
309
  props: {
@@ -312,70 +312,70 @@ const Ye = {
312
312
  chosen: { default: () => [] }
313
313
  },
314
314
  setup(t) {
315
- const e = t, { open: a, resolve: l, dismiss: n } = Ne(), i = be(G());
316
- R();
317
- const o = P("webx-notifications"), d = He(), _ = j([]), x = j(null), b = j(null), $ = j(!0), C = j(/* @__PURE__ */ new Set());
318
- async function S() {
319
- $.value = !0, b.value = null;
315
+ const e = t, { open: a, resolve: l, dismiss: n } = ze(), i = ye(Q());
316
+ U();
317
+ const r = R("webx-notifications"), u = Ge(), b = A([]), k = A(null), v = A(null), x = A(!0), C = A(/* @__PURE__ */ new Set());
318
+ async function N() {
319
+ x.value = !0, v.value = null;
320
320
  try {
321
- const r = await i.findRecipients({
321
+ const o = await i.findRecipients({
322
322
  provider: "telegram",
323
323
  channel: e.channel,
324
324
  token: e.token.trim() === "" ? void 0 : e.token.trim()
325
325
  });
326
- _.value = r.recipients, x.value = r.hint;
327
- } catch (r) {
328
- b.value = d(r);
326
+ b.value = o.recipients, k.value = o.hint;
327
+ } catch (o) {
328
+ v.value = u(o);
329
329
  } finally {
330
- $.value = !1;
330
+ x.value = !1;
331
331
  }
332
332
  }
333
- ne(() => {
334
- S();
333
+ ae(() => {
334
+ N();
335
335
  });
336
- const O = h(() => _.value.filter((r) => !e.chosen.includes(r.id)));
337
- function T(r, c) {
338
- const u = new Set(C.value);
339
- c ? u.add(r) : u.delete(r), C.value = u;
336
+ const S = m(() => b.value.filter((o) => !e.chosen.includes(o.id)));
337
+ function $(o, d) {
338
+ const c = new Set(C.value);
339
+ d ? c.add(o) : c.delete(o), C.value = c;
340
340
  }
341
- function f() {
342
- l(O.value.filter((r) => C.value.has(r.id)));
341
+ function V() {
342
+ l(S.value.filter((o) => C.value.has(o.id)));
343
343
  }
344
- return (r, c) => (p(), k(s(Ve), {
344
+ return (o, d) => (p(), _(s(Fe), {
345
345
  open: s(a),
346
- "onUpdate:open": c[1] || (c[1] = (u) => Te(a) ? a.value = u : null),
347
- title: s(o)("panel.find-title"),
346
+ "onUpdate:open": d[1] || (d[1] = (c) => Ae(a) ? a.value = c : null),
347
+ title: s(r)("panel.find-title"),
348
348
  width: 480
349
349
  }, {
350
- footer: m(() => [
351
- g(s(le), { size: "sm" }, {
352
- default: m(() => [
353
- g(s(V), {
350
+ footer: f(() => [
351
+ g(s(se), { size: "sm" }, {
352
+ default: f(() => [
353
+ g(s(O), {
354
354
  variant: "outline",
355
- disabled: $.value,
356
- onClick: S
355
+ disabled: x.value,
356
+ onClick: N
357
357
  }, {
358
- default: m(() => [
359
- y(v(s(o)("panel.find-chats")), 1)
358
+ default: f(() => [
359
+ y(h(s(r)("panel.find-chats")), 1)
360
360
  ]),
361
361
  _: 1
362
362
  }, 8, ["disabled"]),
363
- g(s(V), {
363
+ g(s(O), {
364
364
  variant: "outline",
365
- onClick: c[0] || (c[0] = (u) => s(n)())
365
+ onClick: d[0] || (d[0] = (c) => s(n)())
366
366
  }, {
367
- default: m(() => [
368
- y(v(s(o)("panel.cancel")), 1)
367
+ default: f(() => [
368
+ y(h(s(r)("panel.cancel")), 1)
369
369
  ]),
370
370
  _: 1
371
371
  }),
372
- g(s(V), {
372
+ g(s(O), {
373
373
  type: "primary",
374
374
  disabled: C.value.size === 0,
375
- onClick: f
375
+ onClick: V
376
376
  }, {
377
- default: m(() => [
378
- y(v(s(o)("panel.find-add")), 1)
377
+ default: f(() => [
378
+ y(h(s(r)("panel.find-add")), 1)
379
379
  ]),
380
380
  _: 1
381
381
  }, 8, ["disabled"])
@@ -383,45 +383,45 @@ const Ye = {
383
383
  _: 1
384
384
  })
385
385
  ]),
386
- default: m(() => [
387
- $.value ? (p(), k(s(Oe), {
386
+ default: f(() => [
387
+ x.value ? (p(), _(s(Ee), {
388
388
  key: 0,
389
389
  rows: 3
390
- })) : b.value ? (p(), k(s(D), {
390
+ })) : v.value ? (p(), _(s(H), {
391
391
  key: 1,
392
392
  type: "danger",
393
393
  variant: "soft",
394
- description: b.value
395
- }, null, 8, ["description"])) : _.value.length === 0 ? (p(), k(s(ze), {
394
+ description: v.value
395
+ }, null, 8, ["description"])) : b.value.length === 0 ? (p(), _(s(Me), {
396
396
  key: 2,
397
- title: s(o)("panel.find-title"),
398
- description: x.value ?? s(o)("panel.find-help")
399
- }, null, 8, ["title", "description"])) : (p(), w("ul", Ye, [
400
- (p(!0), w(z, null, M(_.value, (u) => (p(), w("li", {
401
- key: u.id,
397
+ title: s(r)("panel.find-title"),
398
+ description: k.value ?? s(r)("panel.find-help")
399
+ }, null, 8, ["title", "description"])) : (p(), w("ul", nt, [
400
+ (p(!0), w(F, null, L(b.value, (c) => (p(), w("li", {
401
+ key: c.id,
402
402
  class: "wx-notifications-found__row"
403
403
  }, [
404
- g(s(Fe), {
405
- "model-value": e.chosen.includes(u.id) || C.value.has(u.id),
406
- disabled: e.chosen.includes(u.id),
407
- "onUpdate:modelValue": (A) => T(u.id, A)
404
+ g(s(Le), {
405
+ "model-value": e.chosen.includes(c.id) || C.value.has(c.id),
406
+ disabled: e.chosen.includes(c.id),
407
+ "onUpdate:modelValue": (T) => $(c.id, T)
408
408
  }, {
409
- default: m(() => [
410
- I("span", et, [
411
- g(s(N), { truncate: "" }, {
412
- default: m(() => [
413
- y(v(u.title), 1)
409
+ default: f(() => [
410
+ D("span", at, [
411
+ g(s(W), { truncate: "" }, {
412
+ default: f(() => [
413
+ y(h(c.title), 1)
414
414
  ]),
415
415
  _: 2
416
416
  }, 1024),
417
- g(s(N), {
417
+ g(s(W), {
418
418
  size: "sm",
419
419
  tone: "muted",
420
420
  mono: "",
421
421
  truncate: ""
422
422
  }, {
423
- default: m(() => [
424
- y(v([u.id, u.username].filter(Boolean).join(" · ")), 1)
423
+ default: f(() => [
424
+ y(h([c.id, c.username].filter(Boolean).join(" · ")), 1)
425
425
  ]),
426
426
  _: 2
427
427
  }, 1024)
@@ -429,9 +429,9 @@ const Ye = {
429
429
  ]),
430
430
  _: 2
431
431
  }, 1032, ["model-value", "disabled", "onUpdate:modelValue"]),
432
- g(s(ae), null, {
433
- default: m(() => [
434
- y(v(s(o)(`panel.chat-${u.type}`)), 1)
432
+ g(s(le), null, {
433
+ default: f(() => [
434
+ y(h(s(r)(`panel.chat-${c.type}`)), 1)
435
435
  ]),
436
436
  _: 2
437
437
  }, 1024)
@@ -441,8 +441,8 @@ const Ye = {
441
441
  _: 1
442
442
  }, 8, ["open", "title"]));
443
443
  }
444
- }), nt = /* @__PURE__ */ U(tt, [["__scopeId", "data-v-71616d40"]]);
445
- function at(t) {
444
+ }), st = /* @__PURE__ */ B(lt, [["__scopeId", "data-v-71616d40"]]);
445
+ function it(t) {
446
446
  return (t?.variables ?? []).map((e) => ({
447
447
  name: e.name,
448
448
  label: e.label,
@@ -450,7 +450,7 @@ function at(t) {
450
450
  fields: e.fields.length > 0 ? e.fields : void 0
451
451
  }));
452
452
  }
453
- function lt(t, e = "value") {
453
+ function ot(t, e = "value") {
454
454
  const a = t.name.endsWith(".*") ? `${t.name.slice(0, -2)}.name` : t.name;
455
455
  if ((t.fields?.length ?? 0) > 0) {
456
456
  const l = (t.fields ?? []).map((n) => `{{${n.name}}}`).join(" ");
@@ -460,13 +460,13 @@ ${l}
460
460
  }
461
461
  return e === "has" ? `{{#${a}}}{{${a}}}{{/${a}}}` : e === "empty" ? `{{^${a}}}{{/${a}}}` : `{{${a}}}`;
462
462
  }
463
- function ge(t, e) {
463
+ function _e(t, e) {
464
464
  return (t?.variables ?? []).filter((a) => a.address === e);
465
465
  }
466
- const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
466
+ const rt = { class: "wx-notifications-recipients" }, ct = /* @__PURE__ */ P({
467
467
  name: "WxNotificationsChatsField",
468
468
  __name: "ChatsField",
469
- props: /* @__PURE__ */ K({
469
+ props: /* @__PURE__ */ G({
470
470
  disabled: { type: Boolean, default: !1 }
471
471
  }, {
472
472
  modelValue: { default: () => [] },
@@ -474,132 +474,133 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
474
474
  }),
475
475
  emits: ["update:modelValue"],
476
476
  setup(t) {
477
- const e = t, a = q(t, "modelValue");
478
- R();
479
- const l = P("webx-notifications"), n = Q(), i = Ee(nt), o = h(() => Array.isArray(a.value) ? a.value : []), d = h(() => ge(n.event.value, "telegram")), _ = h(
480
- () => d.value.filter((f) => !o.value.some((r) => r.variable === f.name))
477
+ const e = t, a = K(t, "modelValue");
478
+ U();
479
+ const l = R("webx-notifications"), n = be(), i = X(), r = Pe(st), u = m(() => Array.isArray(a.value) ? a.value : []), b = m(() => _e(i.event.value, "telegram")), k = m(
480
+ () => b.value.filter((o) => !u.value.some((d) => d.variable === o.name))
481
481
  );
482
- function x(f) {
483
- return d.value.find((r) => r.name === f)?.label ?? `{{${f}}}`;
482
+ function v(o) {
483
+ return b.value.find((d) => d.name === o)?.label ?? `{{${o}}}`;
484
484
  }
485
- function b(f, r) {
486
- a.value = o.value.map((c, u) => u === f ? { ...c, ...r } : c);
485
+ function x(o, d) {
486
+ a.value = u.value.map((c, T) => T === o ? { ...c, ...d } : c);
487
487
  }
488
- function $(f) {
489
- a.value = [...o.value, f];
488
+ function C(o) {
489
+ a.value = [...u.value, o];
490
490
  }
491
- function C(f) {
492
- a.value = o.value.filter((r, c) => c !== f);
491
+ function N(o) {
492
+ a.value = u.value.filter((d, c) => c !== o);
493
493
  }
494
- const S = h(() => {
495
- const f = n.values.value.token;
496
- return typeof f == "string" ? f : "";
497
- }), O = h(
498
- () => S.value.trim() !== "" || n.id.value !== null && n.values.value.provider === "telegram"
494
+ const S = m(() => {
495
+ const o = i.values.value.token;
496
+ return typeof o == "string" ? o : "";
497
+ }), $ = m(
498
+ () => S.value.trim() !== "" || i.id.value !== null && i.values.value.provider === "telegram"
499
499
  );
500
- async function T() {
501
- if (!O.value) {
502
- J.warning(l("panel.find-token"));
500
+ async function V() {
501
+ if (!$.value) {
502
+ Y.warning(l("panel.find-token"));
503
503
  return;
504
504
  }
505
- const f = await i({
506
- channel: n.id.value,
505
+ const o = await r({
506
+ channel: i.id.value,
507
507
  token: S.value,
508
- chosen: o.value.map((r) => r.chat_id ?? "").filter(Boolean)
508
+ chosen: u.value.map((d) => d.chat_id ?? "").filter(Boolean)
509
509
  });
510
- !f || f.length === 0 || (a.value = [...o.value, ...f.map((r) => ({ chat_id: r.id, label: r.title }))], J.success(l("panel.find-added", { count: String(f.length) })));
510
+ !o || o.length === 0 || (a.value = [...u.value, ...o.map((d) => ({ chat_id: d.id, label: d.title }))], Y.success(l("panel.find-added", { count: String(o.length) })));
511
511
  }
512
- return (f, r) => (p(), w("div", st, [
513
- o.value.length === 0 ? (p(), k(s(N), {
512
+ return (o, d) => (p(), w("div", rt, [
513
+ u.value.length === 0 ? (p(), _(s(W), {
514
514
  key: 0,
515
515
  size: "sm",
516
516
  tone: "placeholder"
517
517
  }, {
518
- default: m(() => [
519
- y(v(s(l)("panel.no-recipients")), 1)
518
+ default: f(() => [
519
+ y(h(s(l)("panel.no-recipients")), 1)
520
520
  ]),
521
521
  _: 1
522
- })) : W("", !0),
523
- (p(!0), w(z, null, M(o.value, (c, u) => (p(), w("div", {
524
- key: u,
522
+ })) : j("", !0),
523
+ (p(!0), w(F, null, L(u.value, (c, T) => (p(), w("div", {
524
+ key: T,
525
525
  class: "wx-notifications-recipients__row"
526
526
  }, [
527
- c.variable ? (p(), k(s(ae), {
527
+ c.variable ? (p(), _(s(le), {
528
528
  key: 0,
529
529
  type: "primary",
530
530
  class: "wx-notifications-recipients__addressee"
531
531
  }, {
532
- default: m(() => [
533
- y(v(s(l)("panel.addressee", { label: x(c.variable) })), 1)
532
+ default: f(() => [
533
+ y(h(s(l)("panel.addressee", { label: v(c.variable) })), 1)
534
534
  ]),
535
535
  _: 2
536
- }, 1024)) : (p(), w(z, { key: 1 }, [
537
- g(s(Z), {
536
+ }, 1024)) : (p(), w(F, { key: 1 }, [
537
+ g(s(J), {
538
538
  class: "wx-notifications-recipients__id",
539
539
  "model-value": c.chat_id ?? "",
540
540
  placeholder: s(l)("panel.chat-id"),
541
541
  "aria-label": s(l)("panel.chat-id"),
542
542
  disabled: e.disabled,
543
543
  inputmode: "text",
544
- "onUpdate:modelValue": (A) => b(u, { chat_id: String(A ?? "") })
544
+ "onUpdate:modelValue": (z) => x(T, { chat_id: String(z ?? "") })
545
545
  }, null, 8, ["model-value", "placeholder", "aria-label", "disabled", "onUpdate:modelValue"]),
546
- g(s(Z), {
546
+ g(s(J), {
547
547
  class: "wx-notifications-recipients__label",
548
548
  "model-value": c.label ?? "",
549
549
  placeholder: s(l)("panel.chat-label"),
550
550
  "aria-label": s(l)("panel.chat-label"),
551
551
  disabled: e.disabled,
552
- "onUpdate:modelValue": (A) => b(u, { label: String(A ?? "") })
552
+ "onUpdate:modelValue": (z) => x(T, { label: String(z ?? "") })
553
553
  }, null, 8, ["model-value", "placeholder", "aria-label", "disabled", "onUpdate:modelValue"])
554
554
  ], 64)),
555
- e.disabled ? W("", !0) : (p(), k(s(fe), {
555
+ e.disabled ? j("", !0) : (p(), _(s(he), fe({
556
556
  key: 2,
557
557
  icon: "trash",
558
558
  tone: "danger",
559
- title: s(l)("panel.remove"),
560
- onClick: (A) => C(u)
561
- }, null, 8, ["title", "onClick"]))
559
+ title: s(l)("panel.remove")
560
+ }, { ref_for: !0 }, s(n), {
561
+ onClick: (z) => N(T)
562
+ }), null, 16, ["title", "onClick"]))
562
563
  ]))), 128)),
563
- e.disabled ? W("", !0) : (p(), k(s(le), {
564
+ e.disabled ? j("", !0) : (p(), _(s(se), {
564
565
  key: 1,
565
566
  size: "sm",
566
567
  wrap: ""
567
568
  }, {
568
- default: m(() => [
569
- g(s(V), {
569
+ default: f(() => [
570
+ g(s(O), {
570
571
  variant: "outline",
571
572
  size: "sm",
572
- onClick: r[0] || (r[0] = (c) => $({ chat_id: "", label: "" }))
573
+ onClick: d[0] || (d[0] = (c) => C({ chat_id: "", label: "" }))
573
574
  }, {
574
- icon: m(() => [
575
- g(s(H), { name: "plus" })
575
+ icon: f(() => [
576
+ g(s(q), { name: "plus" })
576
577
  ]),
577
- default: m(() => [
578
- y(" " + v(s(l)("panel.add-chat")), 1)
578
+ default: f(() => [
579
+ y(" " + h(s(l)("panel.add-chat")), 1)
579
580
  ]),
580
581
  _: 1
581
582
  }),
582
- g(s(V), {
583
+ g(s(O), {
583
584
  variant: "outline",
584
585
  size: "sm",
585
- onClick: T
586
+ onClick: V
586
587
  }, {
587
- icon: m(() => [
588
- g(s(H), { name: "search" })
588
+ icon: f(() => [
589
+ g(s(q), { name: "search" })
589
590
  ]),
590
- default: m(() => [
591
- y(" " + v(s(l)("panel.find-chats")), 1)
591
+ default: f(() => [
592
+ y(" " + h(s(l)("panel.find-chats")), 1)
592
593
  ]),
593
594
  _: 1
594
595
  }),
595
- (p(!0), w(z, null, M(_.value, (c) => (p(), k(s(V), {
596
+ (p(!0), w(F, null, L(k.value, (c) => (p(), _(s(O), {
596
597
  key: c.name,
597
598
  variant: "outline",
598
599
  size: "sm",
599
- onClick: (u) => $({ variable: c.name })
600
+ onClick: (T) => C({ variable: c.name })
600
601
  }, {
601
- default: m(() => [
602
- y(v(s(l)("panel.addressee", { label: c.label })), 1)
602
+ default: f(() => [
603
+ y(h(s(l)("panel.addressee", { label: c.label })), 1)
603
604
  ]),
604
605
  _: 2
605
606
  }, 1032, ["onClick"]))), 128))
@@ -608,10 +609,10 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
608
609
  }))
609
610
  ]));
610
611
  }
611
- }), ot = /* @__PURE__ */ U(it, [["__scopeId", "data-v-00cd60ee"]]), rt = { class: "wx-notifications-recipients" }, ct = /* @__PURE__ */ L({
612
+ }), dt = /* @__PURE__ */ B(ct, [["__scopeId", "data-v-22102841"]]), ut = { class: "wx-notifications-recipients" }, pt = /* @__PURE__ */ P({
612
613
  name: "WxNotificationsEmailsField",
613
614
  __name: "EmailsField",
614
- props: /* @__PURE__ */ K({
615
+ props: /* @__PURE__ */ G({
615
616
  disabled: { type: Boolean, default: !1 }
616
617
  }, {
617
618
  modelValue: { default: () => [] },
@@ -619,124 +620,125 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
619
620
  }),
620
621
  emits: ["update:modelValue"],
621
622
  setup(t) {
622
- const e = t, a = q(t, "modelValue");
623
- R();
624
- const l = P("webx-notifications"), n = Q(), i = G(), o = j([]);
625
- ne(async () => {
623
+ const e = t, a = K(t, "modelValue");
624
+ U();
625
+ const l = R("webx-notifications"), n = be(), i = X(), r = Q(), u = A([]);
626
+ ae(async () => {
626
627
  try {
627
- o.value = await be(i).administrators();
628
+ u.value = await ye(r).administrators();
628
629
  } catch {
629
630
  }
630
631
  });
631
- const d = h(() => Array.isArray(a.value) ? a.value : []), _ = h(
632
- () => o.value.map((f) => ({ value: f.id, label: `${f.name} · ${f.email}` }))
633
- ), x = h(() => ge(n.event.value, "email")), b = h(
634
- () => x.value.filter((f) => !d.value.some((r) => r.variable === f.name))
632
+ const b = m(() => Array.isArray(a.value) ? a.value : []), k = m(
633
+ () => u.value.map((o) => ({ value: o.id, label: `${o.name} · ${o.email}` }))
634
+ ), v = m(() => _e(i.event.value, "email")), x = m(
635
+ () => v.value.filter((o) => !b.value.some((d) => d.variable === o.name))
635
636
  );
636
- function $(f) {
637
- return x.value.find((r) => r.name === f)?.label ?? `{{${f}}}`;
637
+ function C(o) {
638
+ return v.value.find((d) => d.name === o)?.label ?? `{{${o}}}`;
638
639
  }
639
- function C(f, r) {
640
- a.value = d.value.map((c, u) => u === f ? r : c);
640
+ function N(o, d) {
641
+ a.value = b.value.map((c, T) => T === o ? d : c);
641
642
  }
642
- function S(f) {
643
- a.value = [...d.value, f];
643
+ function S(o) {
644
+ a.value = [...b.value, o];
644
645
  }
645
- function O(f) {
646
- a.value = d.value.filter((r, c) => c !== f);
646
+ function $(o) {
647
+ a.value = b.value.filter((d, c) => c !== o);
647
648
  }
648
- function T(f) {
649
- return _.value.some((r) => r.value === f) ? _.value : [..._.value, { value: f, label: l("panel.admin-unknown", { id: String(f) }) }];
649
+ function V(o) {
650
+ return k.value.some((d) => d.value === o) ? k.value : [...k.value, { value: o, label: l("panel.admin-unknown", { id: String(o) }) }];
650
651
  }
651
- return (f, r) => (p(), w("div", rt, [
652
- d.value.length === 0 ? (p(), k(s(N), {
652
+ return (o, d) => (p(), w("div", ut, [
653
+ b.value.length === 0 ? (p(), _(s(W), {
653
654
  key: 0,
654
655
  size: "sm",
655
656
  tone: "placeholder"
656
657
  }, {
657
- default: m(() => [
658
- y(v(s(l)("panel.no-recipients")), 1)
658
+ default: f(() => [
659
+ y(h(s(l)("panel.no-recipients")), 1)
659
660
  ]),
660
661
  _: 1
661
- })) : W("", !0),
662
- (p(!0), w(z, null, M(d.value, (c, u) => (p(), w("div", {
663
- key: u,
662
+ })) : j("", !0),
663
+ (p(!0), w(F, null, L(b.value, (c, T) => (p(), w("div", {
664
+ key: T,
664
665
  class: "wx-notifications-recipients__row"
665
666
  }, [
666
- c.variable ? (p(), k(s(ae), {
667
+ c.variable ? (p(), _(s(le), {
667
668
  key: 0,
668
669
  type: "primary",
669
670
  class: "wx-notifications-recipients__wide"
670
671
  }, {
671
- default: m(() => [
672
- y(v(s(l)("panel.addressee", { label: $(c.variable) })), 1)
672
+ default: f(() => [
673
+ y(h(s(l)("panel.addressee", { label: C(c.variable) })), 1)
673
674
  ]),
674
675
  _: 2
675
- }, 1024)) : c.admin_id !== void 0 ? (p(), k(s(Me), {
676
+ }, 1024)) : c.admin_id !== void 0 ? (p(), _(s(Re), {
676
677
  key: 1,
677
678
  class: "wx-notifications-recipients__wide",
678
679
  "model-value": c.admin_id,
679
- options: T(c.admin_id),
680
+ options: V(c.admin_id),
680
681
  disabled: e.disabled,
681
- "onUpdate:modelValue": (A) => C(u, { admin_id: Number(A) })
682
- }, null, 8, ["model-value", "options", "disabled", "onUpdate:modelValue"])) : (p(), k(s(Z), {
682
+ "onUpdate:modelValue": (z) => N(T, { admin_id: Number(z) })
683
+ }, null, 8, ["model-value", "options", "disabled", "onUpdate:modelValue"])) : (p(), _(s(J), {
683
684
  key: 2,
684
685
  class: "wx-notifications-recipients__wide",
685
686
  type: "email",
686
687
  "model-value": c.email ?? "",
687
688
  placeholder: "manager@site.test",
688
689
  disabled: e.disabled,
689
- "onUpdate:modelValue": (A) => C(u, { email: String(A ?? "") })
690
+ "onUpdate:modelValue": (z) => N(T, { email: String(z ?? "") })
690
691
  }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])),
691
- e.disabled ? W("", !0) : (p(), k(s(fe), {
692
+ e.disabled ? j("", !0) : (p(), _(s(he), fe({
692
693
  key: 3,
693
694
  icon: "trash",
694
695
  tone: "danger",
695
- title: s(l)("panel.remove"),
696
- onClick: (A) => O(u)
697
- }, null, 8, ["title", "onClick"]))
696
+ title: s(l)("panel.remove")
697
+ }, { ref_for: !0 }, s(n), {
698
+ onClick: (z) => $(T)
699
+ }), null, 16, ["title", "onClick"]))
698
700
  ]))), 128)),
699
- e.disabled ? W("", !0) : (p(), k(s(le), {
701
+ e.disabled ? j("", !0) : (p(), _(s(se), {
700
702
  key: 1,
701
703
  size: "sm",
702
704
  wrap: ""
703
705
  }, {
704
- default: m(() => [
705
- g(s(V), {
706
+ default: f(() => [
707
+ g(s(O), {
706
708
  variant: "outline",
707
709
  size: "sm",
708
- disabled: _.value.length === 0,
709
- onClick: r[0] || (r[0] = (c) => S({ admin_id: Number(_.value[0]?.value) }))
710
+ disabled: k.value.length === 0,
711
+ onClick: d[0] || (d[0] = (c) => S({ admin_id: Number(k.value[0]?.value) }))
710
712
  }, {
711
- icon: m(() => [
712
- g(s(H), { name: "user" })
713
+ icon: f(() => [
714
+ g(s(q), { name: "user" })
713
715
  ]),
714
- default: m(() => [
715
- y(" " + v(s(l)("panel.add-admin")), 1)
716
+ default: f(() => [
717
+ y(" " + h(s(l)("panel.add-admin")), 1)
716
718
  ]),
717
719
  _: 1
718
720
  }, 8, ["disabled"]),
719
- g(s(V), {
721
+ g(s(O), {
720
722
  variant: "outline",
721
723
  size: "sm",
722
- onClick: r[1] || (r[1] = (c) => S({ email: "" }))
724
+ onClick: d[1] || (d[1] = (c) => S({ email: "" }))
723
725
  }, {
724
- icon: m(() => [
725
- g(s(H), { name: "mail" })
726
+ icon: f(() => [
727
+ g(s(q), { name: "mail" })
726
728
  ]),
727
- default: m(() => [
728
- y(" " + v(s(l)("panel.add-email")), 1)
729
+ default: f(() => [
730
+ y(" " + h(s(l)("panel.add-email")), 1)
729
731
  ]),
730
732
  _: 1
731
733
  }),
732
- (p(!0), w(z, null, M(b.value, (c) => (p(), k(s(V), {
734
+ (p(!0), w(F, null, L(x.value, (c) => (p(), _(s(O), {
733
735
  key: c.name,
734
736
  variant: "outline",
735
737
  size: "sm",
736
- onClick: (u) => S({ variable: c.name })
738
+ onClick: (T) => S({ variable: c.name })
737
739
  }, {
738
- default: m(() => [
739
- y(v(s(l)("panel.addressee", { label: c.label })), 1)
740
+ default: f(() => [
741
+ y(h(s(l)("panel.addressee", { label: c.label })), 1)
740
742
  ]),
741
743
  _: 2
742
744
  }, 1032, ["onClick"]))), 128))
@@ -745,194 +747,194 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
745
747
  }))
746
748
  ]));
747
749
  }
748
- }), dt = /* @__PURE__ */ U(ct, [["__scopeId", "data-v-ae639366"]]);
749
- function we(t, e) {
750
+ }), ft = /* @__PURE__ */ B(pt, [["__scopeId", "data-v-6ed21265"]]);
751
+ function ke(t, e) {
750
752
  return !t || !e ? null : t.sample[e] ?? t.sample["*"] ?? null;
751
753
  }
752
- function B(t) {
753
- return t == null ? !0 : typeof t == "string" ? t.trim() === "" : typeof t == "object" ? Object.values(t).every((e) => B(e)) : !1;
754
+ function I(t) {
755
+ return t == null ? !0 : typeof t == "string" ? t.trim() === "" : typeof t == "object" ? Object.values(t).every((e) => I(e)) : !1;
754
756
  }
755
- function ye(t, e, a) {
757
+ function xe(t, e, a) {
756
758
  return {
757
759
  ...t,
758
760
  template: { ...e.template },
759
761
  ...a && e.subject !== null ? { subject: { ...e.subject } } : {}
760
762
  };
761
763
  }
762
- function Xt(t, e, a) {
763
- Ce(
764
+ function Jt(t, e, a) {
765
+ je(
764
766
  () => t.values.value.event,
765
767
  (l, n) => {
766
768
  if (e.value || l === n) return;
767
- const i = we(t.event.value, t.provider.value?.key), o = t.provider.value?.subject ?? !1, d = t.values.value;
768
- i === null || !B(d.template) || o && !B(d.subject) || (t.values.value = ye(d, i, o), a());
769
+ const i = ke(t.event.value, t.provider.value?.key), r = t.provider.value?.subject ?? !1, u = t.values.value;
770
+ i === null || !I(u.template) || r && !I(u.subject) || (t.values.value = xe(u, i, r), a());
769
771
  },
770
772
  { flush: "sync" }
771
773
  );
772
774
  }
773
- class E extends Error {
775
+ class M extends Error {
774
776
  constructor(e, a = {}) {
775
777
  super(e), this.key = e, this.replace = a, this.name = "TemplateRefusal";
776
778
  }
777
779
  key;
778
780
  replace;
779
781
  }
780
- const ut = /^[a-z0-9_]+(\.[a-z0-9_]+)?$/;
781
- function _e(t) {
782
+ const mt = /^[a-z0-9_]+(\.[a-z0-9_]+)?$/;
783
+ function $e(t) {
782
784
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
783
785
  }
784
- function re(t) {
786
+ function ce(t) {
785
787
  return t.replace(/[\r\n]+/g, " ");
786
788
  }
787
- function pt(t, e = "") {
788
- return se(t, e) ? ft : t === "telegram" ? _e : (a) => a;
789
+ function ht(t, e = "") {
790
+ return ie(t, e) ? vt : t === "telegram" ? $e : (a) => a;
789
791
  }
790
- function se(t, e) {
792
+ function ie(t, e) {
791
793
  return t === "email" && /^\s*<[a-zA-Z]/.test(e);
792
794
  }
793
- function ft(t) {
794
- return _e(t).replace(/\r\n|\r|\n/g, "<br>");
795
+ function vt(t) {
796
+ return $e(t).replace(/\r\n|\r|\n/g, "<br>");
795
797
  }
796
- function X(t) {
798
+ function Z(t) {
797
799
  const e = document.createElement("textarea");
798
800
  return e.innerHTML = t, e.value;
799
801
  }
800
- const mt = "p|h[1-6]|table|ul|ol|blockquote|pre", ht = "tr|div";
801
- function vt(t) {
802
+ const bt = "p|h[1-6]|table|ul|ol|blockquote|pre", gt = "tr|div";
803
+ function wt(t) {
802
804
  let e = t.replace(/[ \t\r\n\f]+/g, " ");
803
805
  return e = e.replace(
804
806
  /<a\b[^>]*?\bhref\s*=\s*"([^"]*)"[^>]*>([\s\S]*?)<\/a\s*>/gi,
805
807
  (l, n, i) => {
806
- const o = X(n), d = X(i.replace(/<[^>]*>/g, "")).trim();
807
- return d === "" || d === o ? o : /^(https?:|mailto:)/i.test(o) ? `${i} (${n})` : i;
808
+ const r = Z(n), u = Z(i.replace(/<[^>]*>/g, "")).trim();
809
+ return u === "" || u === r ? r : /^(https?:|mailto:)/i.test(r) ? `${i} (${n})` : i;
808
810
  }
809
811
  ), e = e.replace(/<br\s*\/?>/gi, `
810
812
  `), e = e.replace(/<\/t[dh]\s*>\s*(?=<t[dh][\s>])/gi, ": "), e = e.replace(/<li\b[^>]*>/gi, `
811
- - `), e = e.replace(new RegExp(`<hr\\b[^>]*>|</?(?:${mt})\\b[^>]*>`, "gi"), `
813
+ - `), e = e.replace(new RegExp(`<hr\\b[^>]*>|</?(?:${bt})\\b[^>]*>`, "gi"), `
812
814
 
813
- `), e = e.replace(new RegExp(`<div\\b[^>]*>|</(?:${ht})\\s*>`, "gi"), `
814
- `), e = X(e.replace(/<[^>]*>/g, "")), e.split(`
815
+ `), e = e.replace(new RegExp(`<div\\b[^>]*>|</(?:${gt})\\s*>`, "gi"), `
816
+ `), e = Z(e.replace(/<[^>]*>/g, "")), e.split(`
815
817
  `).map((l) => l.replace(/ {2,}/g, " ").trim()).join(`
816
818
  `).replace(/\n{3,}/g, `
817
819
 
818
820
  `).trim();
819
821
  }
820
- function bt(t) {
822
+ function yt(t) {
821
823
  try {
822
- return qe.parse(t, ["{{", "}}"]);
824
+ return Qe.parse(t, ["{{", "}}"]);
823
825
  } catch (e) {
824
826
  const a = e instanceof Error ? e.message : String(e), l = /section "([^"]*)"/.exec(a)?.[1] ?? "";
825
827
  if (a.startsWith("Unopened section"))
826
- throw new E("template-unexpected", { section: l });
828
+ throw new M("template-unexpected", { section: l });
827
829
  if (a.startsWith("Unclosed section"))
828
- throw new E("template-unclosed", { section: l });
830
+ throw new M("template-unclosed", { section: l });
829
831
  const n = Number(/at (\d+)/.exec(a)?.[1] ?? t.lastIndexOf("{{")), i = t.slice(n).replace(/^\{\{\{?[#^/!&>=]?/, "").trim();
830
- throw new E("template-tag", { tag: i });
832
+ throw new M("template-tag", { tag: i });
831
833
  }
832
834
  }
833
- function ke(t) {
835
+ function Te(t) {
834
836
  for (const e of t) {
835
837
  const [a, l] = e;
836
- if (a === ">") throw new E("template-partial");
837
- if (a === "=") throw new E("template-delimiters");
838
+ if (a === ">") throw new M("template-partial");
839
+ if (a === "=") throw new M("template-delimiters");
838
840
  if (a === "text" || a === "!") continue;
839
841
  const n = l.trim();
840
- if (n.startsWith("<")) throw new E("template-partial");
841
- if (n.startsWith("%") || n.startsWith("$")) throw new E("template-pragma");
842
- if (!ut.test(n)) throw new E("template-name", { name: n });
843
- e[4] && ke(e[4]);
842
+ if (n.startsWith("<")) throw new M("template-partial");
843
+ if (n.startsWith("%") || n.startsWith("$")) throw new M("template-pragma");
844
+ if (!mt.test(n)) throw new M("template-name", { name: n });
845
+ e[4] && Te(e[4]);
844
846
  }
845
847
  }
846
- function gt(t) {
848
+ function _t(t) {
847
849
  const e = {};
848
850
  for (const [a, l] of Object.entries(t)) {
849
851
  if (!a.includes(".")) {
850
852
  e[a] = l;
851
853
  continue;
852
854
  }
853
- const [n, ...i] = a.split("."), o = n, d = e[o];
854
- (d === void 0 || F(d)) && (e[o] = { ...F(d) ? d : {}, [i.join(".")]: l });
855
+ const [n, ...i] = a.split("."), r = n, u = e[r];
856
+ (u === void 0 || E(u)) && (e[r] = { ...E(u) ? u : {}, [i.join(".")]: l });
855
857
  }
856
858
  return e;
857
859
  }
858
- function F(t) {
860
+ function E(t) {
859
861
  return typeof t == "object" && t !== null && !Array.isArray(t);
860
862
  }
861
- function ce(t) {
862
- return t == null || t === !1 || t === "" || t === "0" || t === 0 ? !0 : Array.isArray(t) ? t.length === 0 : F(t) ? Object.keys(t).length === 0 : !1;
863
+ function de(t) {
864
+ return t == null || t === !1 || t === "" || t === "0" || t === 0 ? !0 : Array.isArray(t) ? t.length === 0 : E(t) ? Object.keys(t).length === 0 : !1;
863
865
  }
864
- function wt(t, e) {
866
+ function kt(t, e) {
865
867
  const [a, ...l] = e.split(".");
866
868
  let n;
867
869
  for (let i = t.length - 1; i >= 0; i--) {
868
- const o = t[i];
869
- if (F(o) && Object.prototype.hasOwnProperty.call(o, a)) {
870
- n = o[a];
870
+ const r = t[i];
871
+ if (E(r) && Object.prototype.hasOwnProperty.call(r, a)) {
872
+ n = r[a];
871
873
  break;
872
874
  }
873
875
  }
874
876
  for (const i of l) {
875
877
  if (n === "" || n === void 0) return n;
876
- n = F(n) && Object.prototype.hasOwnProperty.call(n, i) ? n[i] : "";
878
+ n = E(n) && Object.prototype.hasOwnProperty.call(n, i) ? n[i] : "";
877
879
  }
878
880
  return n;
879
881
  }
880
- function yt(t) {
882
+ function xt(t) {
881
883
  return typeof t == "string" ? t : typeof t == "number" ? String(t) : t === !0 ? "1" : "";
882
884
  }
883
- function Y(t, e, a) {
885
+ function ee(t, e, a) {
884
886
  let l = "";
885
887
  for (const n of t) {
886
- const [i, o] = n;
888
+ const [i, r] = n;
887
889
  if (i === "text") {
888
- l += o;
890
+ l += r;
889
891
  continue;
890
892
  }
891
893
  if (i === "!") continue;
892
- const d = wt(e, o.trim());
894
+ const u = kt(e, r.trim());
893
895
  if (i === "name" || i === "&") {
894
- l += F(d) || Array.isArray(d) ? "" : a(yt(d));
896
+ l += E(u) || Array.isArray(u) ? "" : a(xt(u));
895
897
  continue;
896
898
  }
897
- const _ = n[4] ?? [];
898
- if (i === "#" && !ce(d))
899
- for (const x of Array.isArray(d) ? d : [d])
900
- l += Y(_, [...e, x], a);
901
- i === "^" && ce(d) && (l += Y(_, e, a));
899
+ const b = n[4] ?? [];
900
+ if (i === "#" && !de(u))
901
+ for (const k of Array.isArray(u) ? u : [u])
902
+ l += ee(b, [...e, k], a);
903
+ i === "^" && de(u) && (l += ee(b, e, a));
902
904
  }
903
905
  return l;
904
906
  }
905
- function ee(t, e = [], a = []) {
907
+ function te(t, e = [], a = []) {
906
908
  for (const l of t) {
907
909
  const [n, i] = l;
908
910
  if (n === "text" || n === "!") continue;
909
- const o = i.trim();
910
- a.push({ name: o, sections: e }), n === "#" && ee(l[4] ?? [], [...e, o], a), n === "^" && ee(l[4] ?? [], e, a);
911
+ const r = i.trim();
912
+ a.push({ name: r, sections: e }), n === "#" && te(l[4] ?? [], [...e, r], a), n === "^" && te(l[4] ?? [], e, a);
911
913
  }
912
914
  return a;
913
915
  }
914
- function de(t, e) {
916
+ function ue(t, e) {
915
917
  const [a, ...l] = e.split(".");
916
918
  for (const n of [...t].reverse()) {
917
- if (!F(n) || !Object.prototype.hasOwnProperty.call(n, a)) continue;
919
+ if (!E(n) || !Object.prototype.hasOwnProperty.call(n, a)) continue;
918
920
  let i = n[a];
919
- for (const o of l) {
920
- if (!F(i) || !Object.prototype.hasOwnProperty.call(i, o)) return null;
921
- i = i[o];
921
+ for (const r of l) {
922
+ if (!E(i) || !Object.prototype.hasOwnProperty.call(i, r)) return null;
923
+ i = i[r];
922
924
  }
923
925
  return i ?? null;
924
926
  }
925
927
  return null;
926
928
  }
927
- function _t(t, e, a) {
929
+ function $t(t, e, a) {
928
930
  const l = [t];
929
931
  for (const n of a) {
930
- const i = de(l, n);
931
- Array.isArray(i) ? l.push(Object.assign({}, ...i.filter(F))) : F(i) && l.push(i);
932
+ const i = ue(l, n);
933
+ Array.isArray(i) ? l.push(Object.assign({}, ...i.filter(E))) : E(i) && l.push(i);
932
934
  }
933
- return de(l, e) !== null;
935
+ return ue(l, e) !== null;
934
936
  }
935
- function kt(t, e, a) {
937
+ function Tt(t, e, a) {
936
938
  for (const l of [...a].reverse()) {
937
939
  const n = t.variables.find((i) => i.name === l);
938
940
  if (n && n.fields.length > 0 && n.fields.some((i) => i.name === e))
@@ -942,47 +944,47 @@ function kt(t, e, a) {
942
944
  (l) => l.name === e || l.name.endsWith(".*") && e.startsWith(l.name.slice(0, -1))
943
945
  );
944
946
  }
945
- function ue(t, e, a, l) {
946
- const n = bt(t);
947
- ke(n);
948
- const i = gt(e), o = /* @__PURE__ */ new Set();
949
- for (const d of ee(n))
950
- !_t(i, d.name, d.sections) && !l?.(d.name, d.sections) && o.add(d.name);
951
- return { text: Y(n, [i], a), unknown: [...o] };
947
+ function pe(t, e, a, l) {
948
+ const n = yt(t);
949
+ Te(n);
950
+ const i = _t(e), r = /* @__PURE__ */ new Set();
951
+ for (const u of te(n))
952
+ !$t(i, u.name, u.sections) && !l?.(u.name, u.sections) && r.add(u.name);
953
+ return { text: ee(n, [i], a), unknown: [...r] };
952
954
  }
953
- function xt(t) {
955
+ function Ct(t) {
954
956
  const e = {};
955
957
  for (const a of t?.variables ?? [])
956
958
  a.name.endsWith(".*") || (e[a.name] = a.example);
957
959
  return e;
958
960
  }
959
- function $t(t) {
961
+ function St(t) {
960
962
  return new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body.textContent ?? "";
961
963
  }
962
- function Tt(t) {
963
- const e = se(t.provider, t.template), a = pt(t.provider, t.template), l = t.event ?? null, n = l === null ? void 0 : (b, $) => kt(l, b, $), i = ue(t.template, t.values, a, n);
964
- let o = null, d = i.unknown;
964
+ function At(t) {
965
+ const e = ie(t.provider, t.template), a = ht(t.provider, t.template), l = t.event ?? null, n = l === null ? void 0 : (v, x) => Tt(l, v, x), i = pe(t.template, t.values, a, n);
966
+ let r = null, u = i.unknown;
965
967
  if (t.hasSubject) {
966
- const b = ue(t.subject ?? "", t.values, re, n);
967
- o = re(b.text).trim(), d = [.../* @__PURE__ */ new Set([...d, ...b.unknown])];
968
+ const v = pe(t.subject ?? "", t.values, ce, n);
969
+ r = ce(v.text).trim(), u = [.../* @__PURE__ */ new Set([...u, ...v.unknown])];
968
970
  }
969
- const _ = e ? vt(i.text) : t.provider === "telegram" ? $t(i.text) : i.text, x = t.limit ?? null;
970
- if (x !== null && [..._].length > x) {
971
- const b = `${[..._].slice(0, x - 1).join("")}…`;
972
- return { subject: o, body: a(b), plain: b, truncated: !0, unknown: d, html: e };
971
+ const b = e ? wt(i.text) : t.provider === "telegram" ? St(i.text) : i.text, k = t.limit ?? null;
972
+ if (k !== null && [...b].length > k) {
973
+ const v = `${[...b].slice(0, k - 1).join("")}…`;
974
+ return { subject: r, body: a(v), plain: v, truncated: !0, unknown: u, html: e };
973
975
  }
974
- return { subject: o, body: i.text, plain: _, truncated: !1, unknown: d, html: e };
976
+ return { subject: r, body: i.text, plain: b, truncated: !1, unknown: u, html: e };
975
977
  }
976
- const Ct = { class: "wx-notifications-template" }, St = {
978
+ const jt = { class: "wx-notifications-template" }, Wt = {
977
979
  key: 0,
978
980
  class: "wx-notifications-template__variables"
979
- }, At = { class: "wx-notifications-template__chips" }, jt = { class: "wx-notifications-template__name" }, Wt = {
981
+ }, Nt = { class: "wx-notifications-template__chips" }, Vt = { class: "wx-notifications-template__name" }, Ot = {
980
982
  key: 2,
981
983
  class: "wx-notifications-template__default"
982
- }, Nt = /* @__PURE__ */ L({
984
+ }, zt = /* @__PURE__ */ P({
983
985
  name: "WxNotificationsTemplateField",
984
986
  __name: "TemplateField",
985
- props: /* @__PURE__ */ K({
987
+ props: /* @__PURE__ */ G({
986
988
  localized: { type: Boolean, default: !1 },
987
989
  disabled: { type: Boolean, default: void 0 },
988
990
  minHeight: { default: "200px" },
@@ -995,10 +997,10 @@ const Ct = { class: "wx-notifications-template" }, St = {
995
997
  }),
996
998
  emits: ["update:modelValue"],
997
999
  setup(t) {
998
- const e = t, a = q(t, "modelValue");
999
- R();
1000
- const l = P("webx-notifications"), n = Q(), i = me(), o = j(null), d = h(() => at(n.event.value)), _ = h(
1001
- () => Le(d.value, {
1000
+ const e = t, a = K(t, "modelValue");
1001
+ U();
1002
+ const l = R("webx-notifications"), n = X(), i = ve(), r = A(null), u = m(() => it(n.event.value)), b = m(
1003
+ () => Ue(u.value, {
1002
1004
  variable: l("panel.hint-variable"),
1003
1005
  list: l("panel.hint-list"),
1004
1006
  field: l("panel.hint-field"),
@@ -1008,131 +1010,131 @@ const Ct = { class: "wx-notifications-template" }, St = {
1008
1010
  comment: l("panel.hint-comment"),
1009
1011
  example: l("panel.hint-example")
1010
1012
  })
1011
- ), x = h(() => {
1012
- const r = a.value;
1013
- if (r == null) return "";
1014
- if (typeof r == "string") return r;
1015
- const c = i.active.value || i.list.value[0]?.code || "";
1016
- return r[c] ?? "";
1017
- }), b = h(() => {
1013
+ ), k = m(() => {
1014
+ const o = a.value;
1015
+ if (o == null) return "";
1016
+ if (typeof o == "string") return o;
1017
+ const d = i.active.value || i.list.value[0]?.code || "";
1018
+ return o[d] ?? "";
1019
+ }), v = m(() => {
1018
1020
  if (e.singleLine) return "mustache";
1019
- const r = n.provider.value?.key ?? "";
1020
- return r === "telegram" || se(r, x.value) ? "mustache-html" : "mustache";
1021
- }), $ = h(
1022
- () => Pe(x.value, n.event.value === null ? void 0 : d.value)
1023
- ), C = h(() => {
1024
- const r = $.value;
1021
+ const o = n.provider.value?.key ?? "";
1022
+ return o === "telegram" || ie(o, k.value) ? "mustache-html" : "mustache";
1023
+ }), x = m(
1024
+ () => Be(k.value, n.event.value === null ? void 0 : u.value)
1025
+ ), C = m(() => {
1026
+ const o = x.value;
1025
1027
  return [
1026
- ...r.unclosed.map((c) => l("panel.problem-unclosed", { name: c })),
1027
- ...r.stray.map((c) => l("panel.problem-stray", { name: c })),
1028
- ...r.refused.map((c) => l("panel.problem-refused", { tag: c })),
1029
- ...r.broken ? [l("panel.problem-broken")] : [],
1030
- ...r.unknown.length > 0 ? [
1028
+ ...o.unclosed.map((d) => l("panel.problem-unclosed", { name: d })),
1029
+ ...o.stray.map((d) => l("panel.problem-stray", { name: d })),
1030
+ ...o.refused.map((d) => l("panel.problem-refused", { tag: d })),
1031
+ ...o.broken ? [l("panel.problem-broken")] : [],
1032
+ ...o.unknown.length > 0 ? [
1031
1033
  l("panel.problem-unknown", {
1032
- names: r.unknown.map((c) => `{{${c}}}`).join(", ")
1034
+ names: o.unknown.map((d) => `{{${d}}}`).join(", ")
1033
1035
  })
1034
1036
  ] : []
1035
1037
  ];
1036
1038
  });
1037
- function S(r) {
1038
- if ((r.fields?.length ?? 0) > 0)
1039
+ function N(o) {
1040
+ if ((o.fields?.length ?? 0) > 0)
1039
1041
  return l("panel.variable-list", {
1040
- fields: (r.fields ?? []).map((u) => u.name).join(", ")
1042
+ fields: (o.fields ?? []).map((c) => c.name).join(", ")
1041
1043
  });
1042
- const c = r.example;
1043
- return typeof c == "string" || typeof c == "number" ? String(c) : "";
1044
+ const d = o.example;
1045
+ return typeof d == "string" || typeof d == "number" ? String(d) : "";
1044
1046
  }
1045
- function O(r) {
1046
- const c = o.value?.view;
1047
- if (!c) return;
1048
- const u = c.state.selection.main;
1049
- c.dispatch({
1050
- changes: { from: u.from, to: u.to, insert: r },
1051
- selection: { anchor: u.from + r.length },
1047
+ function S(o) {
1048
+ const d = r.value?.view;
1049
+ if (!d) return;
1050
+ const c = d.state.selection.main;
1051
+ d.dispatch({
1052
+ changes: { from: c.from, to: c.to, insert: o },
1053
+ selection: { anchor: c.from + o.length },
1052
1054
  scrollIntoView: !0
1053
- }), c.focus();
1055
+ }), d.focus();
1054
1056
  }
1055
- ne(() => n.inserters.set(e.part, O)), Se(() => {
1056
- n.inserters.get(e.part) === O && n.inserters.delete(e.part);
1057
+ ae(() => n.inserters.set(e.part, S)), We(() => {
1058
+ n.inserters.get(e.part) === S && n.inserters.delete(e.part);
1057
1059
  });
1058
- const T = h(() => we(n.event.value, n.provider.value?.key));
1059
- async function f() {
1060
- const r = T.value;
1061
- if (r === null) return;
1062
- const c = n.values.value, u = n.provider.value?.subject ?? !1;
1063
- (!B(c.template) || u && !B(c.subject)) && !await Be({
1060
+ const $ = m(() => ke(n.event.value, n.provider.value?.key));
1061
+ async function V() {
1062
+ const o = $.value;
1063
+ if (o === null) return;
1064
+ const d = n.values.value, c = n.provider.value?.subject ?? !1;
1065
+ (!I(d.template) || c && !I(d.subject)) && !await He({
1064
1066
  title: l("panel.default-title"),
1065
1067
  message: l("panel.default-text"),
1066
1068
  confirmText: l("panel.default-replace"),
1067
1069
  cancelText: l("panel.cancel")
1068
- }) || (n.values.value = ye(n.values.value, r, u), J.info(l("panel.default-inserted")));
1070
+ }) || (n.values.value = xe(n.values.value, o, c), Y.info(l("panel.default-inserted")));
1069
1071
  }
1070
- return (r, c) => (p(), w("div", Ct, [
1071
- g(s(Re), {
1072
+ return (o, d) => (p(), w("div", jt, [
1073
+ g(s(Ie), {
1072
1074
  ref_key: "editor",
1073
- ref: o,
1075
+ ref: r,
1074
1076
  modelValue: a.value,
1075
- "onUpdate:modelValue": c[0] || (c[0] = (u) => a.value = u),
1076
- language: b.value,
1077
- completions: _.value,
1077
+ "onUpdate:modelValue": d[0] || (d[0] = (c) => a.value = c),
1078
+ language: v.value,
1079
+ completions: b.value,
1078
1080
  localized: e.localized,
1079
1081
  disabled: e.disabled,
1080
1082
  "line-numbers": !1,
1081
1083
  "line-wrapping": !e.singleLine,
1082
1084
  "single-line": e.singleLine,
1083
1085
  "min-height": e.singleLine ? void 0 : e.minHeight,
1084
- onFocus: c[1] || (c[1] = (u) => s(n).focused.value = e.part)
1086
+ onFocus: d[1] || (d[1] = (c) => s(n).focused.value = e.part)
1085
1087
  }, null, 8, ["modelValue", "language", "completions", "localized", "disabled", "line-wrapping", "single-line", "min-height"]),
1086
- (p(!0), w(z, null, M(C.value, (u) => (p(), k(s(D), {
1087
- key: u,
1088
+ (p(!0), w(F, null, L(C.value, (c) => (p(), _(s(H), {
1089
+ key: c,
1088
1090
  type: "warning",
1089
1091
  variant: "soft",
1090
- description: u
1092
+ description: c
1091
1093
  }, null, 8, ["description"]))), 128)),
1092
- e.chips ? (p(), w("div", St, [
1093
- g(s(N), {
1094
+ e.chips ? (p(), w("div", Wt, [
1095
+ g(s(W), {
1094
1096
  size: "sm",
1095
1097
  weight: "medium"
1096
1098
  }, {
1097
- default: m(() => [
1098
- y(v(s(l)("panel.variables")), 1)
1099
+ default: f(() => [
1100
+ y(h(s(l)("panel.variables")), 1)
1099
1101
  ]),
1100
1102
  _: 1
1101
1103
  }),
1102
- d.value.length === 0 ? (p(), k(s(N), {
1104
+ u.value.length === 0 ? (p(), _(s(W), {
1103
1105
  key: 0,
1104
1106
  size: "sm",
1105
1107
  tone: "muted"
1106
1108
  }, {
1107
- default: m(() => [
1108
- y(v(s(l)("panel.variables-none")), 1)
1109
+ default: f(() => [
1110
+ y(h(s(l)("panel.variables-none")), 1)
1109
1111
  ]),
1110
1112
  _: 1
1111
- })) : (p(), w(z, { key: 1 }, [
1112
- g(s(N), {
1113
+ })) : (p(), w(F, { key: 1 }, [
1114
+ g(s(W), {
1113
1115
  size: "sm",
1114
1116
  tone: "muted"
1115
1117
  }, {
1116
- default: m(() => [
1117
- y(v(s(l)("panel.variables-help")), 1)
1118
+ default: f(() => [
1119
+ y(h(s(l)("panel.variables-help")), 1)
1118
1120
  ]),
1119
1121
  _: 1
1120
1122
  }),
1121
- I("div", At, [
1122
- (p(!0), w(z, null, M(d.value, (u) => (p(), k(s(Ue), {
1123
- key: u.name,
1124
- content: [u.label, S(u)].filter(Boolean).join(" — ")
1123
+ D("div", Nt, [
1124
+ (p(!0), w(F, null, L(u.value, (c) => (p(), _(s(De), {
1125
+ key: c.name,
1126
+ content: [c.label, N(c)].filter(Boolean).join(" — ")
1125
1127
  }, {
1126
- default: m(() => [
1127
- g(s(V), {
1128
+ default: f(() => [
1129
+ g(s(O), {
1128
1130
  size: "sm",
1129
1131
  variant: "outline",
1130
1132
  class: "wx-notifications-template__chip",
1131
1133
  disabled: e.disabled,
1132
- onClick: (A) => s(n).insert(s(lt)(u))
1134
+ onClick: (T) => s(n).insert(s(ot)(c))
1133
1135
  }, {
1134
- default: m(() => [
1135
- I("span", jt, v((u.fields?.length ?? 0) > 0 ? `#${u.name}` : u.name), 1)
1136
+ default: f(() => [
1137
+ D("span", Vt, h((c.fields?.length ?? 0) > 0 ? `#${c.name}` : c.name), 1)
1136
1138
  ]),
1137
1139
  _: 2
1138
1140
  }, 1032, ["disabled", "onClick"])
@@ -1141,25 +1143,25 @@ const Ct = { class: "wx-notifications-template" }, St = {
1141
1143
  }, 1032, ["content"]))), 128))
1142
1144
  ])
1143
1145
  ], 64)),
1144
- T.value ? (p(), w("div", Wt, [
1145
- g(s(V), {
1146
+ $.value ? (p(), w("div", Ot, [
1147
+ g(s(O), {
1146
1148
  size: "sm",
1147
1149
  variant: "text",
1148
1150
  icon: "file-text",
1149
1151
  disabled: e.disabled,
1150
- onClick: f
1152
+ onClick: V
1151
1153
  }, {
1152
- default: m(() => [
1153
- y(v(s(l)("panel.default-insert")), 1)
1154
+ default: f(() => [
1155
+ y(h(s(l)("panel.default-insert")), 1)
1154
1156
  ]),
1155
1157
  _: 1
1156
1158
  }, 8, ["disabled"])
1157
- ])) : W("", !0)
1158
- ])) : W("", !0)
1159
+ ])) : j("", !0)
1160
+ ])) : j("", !0)
1159
1161
  ]));
1160
1162
  }
1161
- }), Vt = /* @__PURE__ */ U(Nt, [["__scopeId", "data-v-d491fffa"]]);
1162
- function Zt(t = {}) {
1163
+ }), Ft = /* @__PURE__ */ B(zt, [["__scopeId", "data-v-d491fffa"]]);
1164
+ function Yt(t = {}) {
1163
1165
  const e = t.path ?? "/notifications";
1164
1166
  return {
1165
1167
  id: "notifications",
@@ -1168,35 +1170,35 @@ function Zt(t = {}) {
1168
1170
  {
1169
1171
  path: e,
1170
1172
  name: "webx.notifications",
1171
- component: () => import("./NotificationsPage-CtP9bFgU.js"),
1173
+ component: () => import("./NotificationsPage-BkTBIV0B.js"),
1172
1174
  props: { base: e }
1173
1175
  },
1174
1176
  {
1175
1177
  path: `${e}/channels/new`,
1176
1178
  name: "webx.notifications.new",
1177
- component: () => import("./ChannelPage-DB6cyt1W.js"),
1179
+ component: () => import("./ChannelPage-vxVhttk3.js"),
1178
1180
  props: { base: e }
1179
1181
  },
1180
1182
  {
1181
1183
  path: `${e}/channels/:id(\\d+)`,
1182
1184
  name: "webx.notifications.channel",
1183
- component: () => import("./ChannelPage-DB6cyt1W.js"),
1185
+ component: () => import("./ChannelPage-vxVhttk3.js"),
1184
1186
  props: { base: e }
1185
1187
  }
1186
1188
  ],
1187
1189
  types: {
1188
- "wx-notifications-template": { component: Vt, kind: "field", wide: !0 },
1189
- "wx-notifications-chats": { component: ot, kind: "field" },
1190
- "wx-notifications-emails": { component: dt, kind: "field" },
1190
+ "wx-notifications-template": { component: Ft, kind: "field", wide: !0 },
1191
+ "wx-notifications-chats": { component: dt, kind: "field" },
1192
+ "wx-notifications-emails": { component: ft, kind: "field" },
1191
1193
  "wx-notifications-channels": {
1192
- component: Xe,
1194
+ component: Ye,
1193
1195
  kind: "field",
1194
1196
  bind: (a) => ({ event: a.props?.event, base: e })
1195
1197
  }
1196
1198
  }
1197
1199
  };
1198
1200
  }
1199
- const Ot = /* @__PURE__ */ new Set([
1201
+ const Et = /* @__PURE__ */ new Set([
1200
1202
  "b",
1201
1203
  "strong",
1202
1204
  "i",
@@ -1213,7 +1215,7 @@ const Ot = /* @__PURE__ */ new Set([
1213
1215
  "tg-spoiler",
1214
1216
  "span"
1215
1217
  ]);
1216
- function te(t, e, a) {
1218
+ function ne(t, e, a) {
1217
1219
  for (const l of Array.from(t.childNodes)) {
1218
1220
  if (l.nodeType === Node.TEXT_NODE) {
1219
1221
  e.appendChild(a.createTextNode(l.textContent ?? ""));
@@ -1221,194 +1223,194 @@ function te(t, e, a) {
1221
1223
  }
1222
1224
  if (!(l instanceof Element)) continue;
1223
1225
  const n = l.tagName.toLowerCase();
1224
- if (!Ot.has(n) || n === "span" && !l.classList.contains("tg-spoiler")) {
1225
- te(l, e, a);
1226
+ if (!Et.has(n) || n === "span" && !l.classList.contains("tg-spoiler")) {
1227
+ ne(l, e, a);
1226
1228
  continue;
1227
1229
  }
1228
1230
  const i = a.createElement(n === "tg-spoiler" ? "span" : n);
1229
1231
  if ((n === "tg-spoiler" || n === "span") && (i.className = "tg-spoiler"), n === "a") {
1230
- const o = l.getAttribute("href") ?? "";
1231
- /^(https?:|tg:)/i.test(o) && (i.setAttribute("href", o), i.setAttribute("target", "_blank"), i.setAttribute("rel", "noopener noreferrer"));
1232
+ const r = l.getAttribute("href") ?? "";
1233
+ /^(https?:|tg:)/i.test(r) && (i.setAttribute("href", r), i.setAttribute("target", "_blank"), i.setAttribute("rel", "noopener noreferrer"));
1232
1234
  }
1233
- te(l, i, a), e.appendChild(i);
1235
+ ne(l, i, a), e.appendChild(i);
1234
1236
  }
1235
1237
  }
1236
- function zt(t) {
1238
+ function Mt(t) {
1237
1239
  const e = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html"), a = document.implementation.createHTMLDocument(""), l = a.createElement("div");
1238
- return te(e.body, l, a), l.innerHTML;
1240
+ return ne(e.body, l, a), l.innerHTML;
1239
1241
  }
1240
- const Ft = {
1242
+ const Lt = {
1241
1243
  key: 0,
1242
1244
  class: "wx-notifications-preview__chat"
1243
- }, Et = ["innerHTML"], Mt = {
1245
+ }, Pt = ["innerHTML"], Rt = {
1244
1246
  key: 1,
1245
1247
  class: "wx-notifications-preview__bubble"
1246
- }, Lt = {
1248
+ }, Ut = {
1247
1249
  key: 1,
1248
1250
  class: "wx-notifications-preview__letter"
1249
- }, Pt = { class: "wx-notifications-preview__subject" }, Rt = ["title", "srcdoc"], Ut = {
1251
+ }, Bt = { class: "wx-notifications-preview__subject" }, It = ["title", "srcdoc"], Dt = {
1250
1252
  key: 1,
1251
1253
  class: "wx-notifications-preview__body"
1252
- }, Bt = /* @__PURE__ */ L({
1254
+ }, Ht = /* @__PURE__ */ P({
1253
1255
  name: "WxNotificationsPreview",
1254
1256
  __name: "MessagePreview",
1255
1257
  setup(t) {
1256
- R();
1257
- const e = P("webx-notifications"), a = Q(), l = me(), n = h(() => l.active.value || l.list.value[0]?.code || ""), i = h(() => {
1258
- const T = a.provider.value;
1259
- if (T === null) return null;
1260
- const f = a.values.value;
1258
+ U();
1259
+ const e = R("webx-notifications"), a = X(), l = ve(), n = m(() => l.active.value || l.list.value[0]?.code || ""), i = m(() => {
1260
+ const $ = a.provider.value;
1261
+ if ($ === null) return null;
1262
+ const V = a.values.value;
1261
1263
  try {
1262
1264
  return {
1263
- message: Tt({
1264
- provider: T.key,
1265
- template: ie(f.template, n.value),
1266
- subject: ie(f.subject, n.value),
1267
- hasSubject: T.subject,
1268
- limit: T.limit,
1269
- values: xt(a.event.value),
1265
+ message: At({
1266
+ provider: $.key,
1267
+ template: oe(V.template, n.value),
1268
+ subject: oe(V.subject, n.value),
1269
+ hasSubject: $.subject,
1270
+ limit: $.limit,
1271
+ values: Ct(a.event.value),
1270
1272
  event: a.event.value
1271
1273
  })
1272
1274
  };
1273
- } catch (r) {
1274
- if (r instanceof E)
1275
- return { refusal: e(`errors.${r.key}`, r.replace) };
1276
- throw r;
1275
+ } catch (o) {
1276
+ if (o instanceof M)
1277
+ return { refusal: e(`errors.${o.key}`, o.replace) };
1278
+ throw o;
1277
1279
  }
1278
- }), o = h(
1280
+ }), r = m(
1279
1281
  () => i.value !== null && "message" in i.value ? i.value.message : null
1280
- ), d = h(
1282
+ ), u = m(
1281
1283
  () => i.value !== null && "refusal" in i.value ? i.value.refusal : null
1282
- ), _ = h(
1284
+ ), b = m(
1283
1285
  () => e("panel.preview-unknown", {
1284
- names: (o.value?.unknown ?? []).map((T) => "{{" + T + "}}").join(", ")
1286
+ names: (r.value?.unknown ?? []).map(($) => "{{" + $ + "}}").join(", ")
1285
1287
  })
1286
- ), x = h(() => a.provider.value?.key === "telegram"), b = h(
1287
- () => o.value?.html ? `<!doctype html><html><head><meta charset="utf-8"><style>body{margin:0;padding:16px;background:#fff;color:#111827;font:14px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Arial,sans-serif;}</style></head><body>` + o.value.body + "</body></html>" : ""
1288
- ), $ = j(null), C = j(240);
1289
- function S() {
1290
- const T = $.value?.contentDocument?.body;
1291
- T && (C.value = Math.max(80, Math.ceil(T.scrollHeight)));
1288
+ ), k = m(() => a.provider.value?.key === "telegram"), v = m(
1289
+ () => r.value?.html ? `<!doctype html><html><head><meta charset="utf-8"><style>body{margin:0;padding:16px;background:#fff;color:#111827;font:14px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Arial,sans-serif;}</style></head><body>` + r.value.body + "</body></html>" : ""
1290
+ ), x = A(null), C = A(240);
1291
+ function N() {
1292
+ const $ = x.value?.contentDocument?.body;
1293
+ $ && (C.value = Math.max(80, Math.ceil($.scrollHeight)));
1292
1294
  }
1293
- const O = h(
1294
- () => o.value === null || o.value.truncated ? "" : zt(o.value.body)
1295
+ const S = m(
1296
+ () => r.value === null || r.value.truncated ? "" : Mt(r.value.body)
1295
1297
  );
1296
- return (T, f) => (p(), k(s(Ie), {
1298
+ return ($, V) => (p(), _(s(qe), {
1297
1299
  title: s(e)("panel.preview"),
1298
1300
  class: "wx-notifications-preview"
1299
1301
  }, {
1300
- default: m(() => [
1301
- g(s(N), {
1302
+ default: f(() => [
1303
+ g(s(W), {
1302
1304
  size: "sm",
1303
1305
  tone: "muted"
1304
1306
  }, {
1305
- default: m(() => [
1306
- y(v(s(a).event.value ? s(e)("panel.preview-help") : s(e)("panel.preview-no-event")), 1)
1307
+ default: f(() => [
1308
+ y(h(s(a).event.value ? s(e)("panel.preview-help") : s(e)("panel.preview-no-event")), 1)
1307
1309
  ]),
1308
1310
  _: 1
1309
1311
  }),
1310
- d.value ? (p(), k(s(D), {
1312
+ u.value ? (p(), _(s(H), {
1311
1313
  key: 0,
1312
1314
  type: "danger",
1313
1315
  variant: "soft",
1314
1316
  title: s(e)("panel.preview-refused"),
1315
- description: d.value
1316
- }, null, 8, ["title", "description"])) : o.value ? (p(), w(z, { key: 1 }, [
1317
- x.value ? (p(), w("div", Ft, [
1318
- o.value.truncated ? (p(), w("div", Mt, v(o.value.plain), 1)) : (p(), w("div", {
1317
+ description: u.value
1318
+ }, null, 8, ["title", "description"])) : r.value ? (p(), w(F, { key: 1 }, [
1319
+ k.value ? (p(), w("div", Lt, [
1320
+ r.value.truncated ? (p(), w("div", Rt, h(r.value.plain), 1)) : (p(), w("div", {
1319
1321
  key: 0,
1320
1322
  class: "wx-notifications-preview__bubble",
1321
- innerHTML: O.value
1322
- }, null, 8, Et))
1323
- ])) : (p(), w("div", Lt, [
1324
- I("div", Pt, [
1325
- g(s(N), {
1323
+ innerHTML: S.value
1324
+ }, null, 8, Pt))
1325
+ ])) : (p(), w("div", Ut, [
1326
+ D("div", Bt, [
1327
+ g(s(W), {
1326
1328
  size: "sm",
1327
1329
  tone: "muted"
1328
1330
  }, {
1329
- default: m(() => [
1330
- y(v(s(e)("panel.preview-subject")), 1)
1331
+ default: f(() => [
1332
+ y(h(s(e)("panel.preview-subject")), 1)
1331
1333
  ]),
1332
1334
  _: 1
1333
1335
  }),
1334
- g(s(N), { weight: "medium" }, {
1335
- default: m(() => [
1336
- y(v(o.value.subject || "—"), 1)
1336
+ g(s(W), { weight: "medium" }, {
1337
+ default: f(() => [
1338
+ y(h(r.value.subject || "—"), 1)
1337
1339
  ]),
1338
1340
  _: 1
1339
1341
  })
1340
1342
  ]),
1341
- o.value.html ? (p(), w("iframe", {
1343
+ r.value.html ? (p(), w("iframe", {
1342
1344
  key: 0,
1343
1345
  ref_key: "frame",
1344
- ref: $,
1346
+ ref: x,
1345
1347
  class: "wx-notifications-preview__frame",
1346
1348
  sandbox: "allow-same-origin",
1347
1349
  title: s(e)("panel.preview"),
1348
- srcdoc: b.value,
1349
- style: Ae({ height: `${C.value}px` }),
1350
- onLoad: S
1351
- }, null, 44, Rt)) : (p(), w("div", Ut, v(o.value.body), 1))
1350
+ srcdoc: v.value,
1351
+ style: Ne({ height: `${C.value}px` }),
1352
+ onLoad: N
1353
+ }, null, 44, It)) : (p(), w("div", Dt, h(r.value.body), 1))
1352
1354
  ])),
1353
- o.value.plain.trim() === "" ? (p(), k(s(N), {
1355
+ r.value.plain.trim() === "" ? (p(), _(s(W), {
1354
1356
  key: 2,
1355
1357
  size: "sm",
1356
1358
  tone: "muted"
1357
1359
  }, {
1358
- default: m(() => [
1359
- y(v(s(e)("panel.preview-empty")), 1)
1360
+ default: f(() => [
1361
+ y(h(s(e)("panel.preview-empty")), 1)
1360
1362
  ]),
1361
1363
  _: 1
1362
- })) : W("", !0),
1363
- o.value.truncated ? (p(), k(s(D), {
1364
+ })) : j("", !0),
1365
+ r.value.truncated ? (p(), _(s(H), {
1364
1366
  key: 3,
1365
1367
  type: "warning",
1366
1368
  variant: "soft",
1367
1369
  description: s(e)("panel.preview-truncated", { limit: String(s(a).provider.value?.limit ?? "") })
1368
- }, null, 8, ["description"])) : W("", !0),
1369
- o.value.unknown.length > 0 && s(a).event.value ? (p(), k(s(N), {
1370
+ }, null, 8, ["description"])) : j("", !0),
1371
+ r.value.unknown.length > 0 && s(a).event.value ? (p(), _(s(W), {
1370
1372
  key: 4,
1371
1373
  size: "sm",
1372
1374
  tone: "muted"
1373
1375
  }, {
1374
- default: m(() => [
1375
- y(v(_.value), 1)
1376
+ default: f(() => [
1377
+ y(h(b.value), 1)
1376
1378
  ]),
1377
1379
  _: 1
1378
- })) : W("", !0)
1379
- ], 64)) : W("", !0)
1380
+ })) : j("", !0)
1381
+ ], 64)) : j("", !0)
1380
1382
  ]),
1381
1383
  _: 1
1382
1384
  }, 8, ["title"]));
1383
1385
  }
1384
- }), Jt = /* @__PURE__ */ U(Bt, [["__scopeId", "data-v-2e2a2dc3"]]), Yt = pe(() => import("./NotificationsPage-CtP9bFgU.js")), en = pe(() => import("./ChannelPage-DB6cyt1W.js"));
1386
+ }), en = /* @__PURE__ */ B(Ht, [["__scopeId", "data-v-2e2a2dc3"]]), tn = me(() => import("./NotificationsPage-BkTBIV0B.js")), nn = me(() => import("./ChannelPage-vxVhttk3.js"));
1385
1387
  export {
1386
- Xe as C,
1387
- dt as E,
1388
- Jt as M,
1389
- Ze as N,
1390
- E as T,
1391
- en as W,
1392
- U as _,
1393
- ot as a,
1394
- Yt as b,
1395
- be as c,
1396
- Vt as d,
1397
- ge as e,
1398
- Xt as f,
1399
- pt as g,
1400
- _e as h,
1401
- xt as i,
1402
- Ke as j,
1403
- ue as k,
1404
- lt as l,
1405
- Q as m,
1406
- Zt as n,
1407
- Qt as p,
1408
- Tt as r,
1409
- we as s,
1410
- zt as t,
1411
- R as u,
1412
- at as v
1388
+ Ye as C,
1389
+ ft as E,
1390
+ en as M,
1391
+ et as N,
1392
+ M as T,
1393
+ nn as W,
1394
+ B as _,
1395
+ dt as a,
1396
+ tn as b,
1397
+ ye as c,
1398
+ Ft as d,
1399
+ _e as e,
1400
+ Jt as f,
1401
+ ht as g,
1402
+ $e as h,
1403
+ Ct as i,
1404
+ Xe as j,
1405
+ pe as k,
1406
+ ot as l,
1407
+ X as m,
1408
+ Yt as n,
1409
+ Zt as p,
1410
+ At as r,
1411
+ ke as s,
1412
+ Mt as t,
1413
+ U as u,
1414
+ it as v
1413
1415
  };
1414
- //# sourceMappingURL=index-Bki9dkMd.js.map
1416
+ //# sourceMappingURL=index-P5vFp-2X.js.map