@topvisor/ui 1.4.3-projectSelector.0 → 1.4.3-updateGroupSelector.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.
Files changed (41) hide show
  1. package/.chunks/policy.vue_vue_type_style_index_0_lang-8Te7yOxJ.amd.js +2 -0
  2. package/.chunks/policy.vue_vue_type_style_index_0_lang-8Te7yOxJ.amd.js.map +1 -0
  3. package/.chunks/policy.vue_vue_type_style_index_0_lang-uPC0N7jl.es.js +496 -0
  4. package/.chunks/policy.vue_vue_type_style_index_0_lang-uPC0N7jl.es.js.map +1 -0
  5. package/assets/policy.css +1 -1
  6. package/assets/project.css +1 -1
  7. package/formsExt/formsExt.amd.js +1 -1
  8. package/formsExt/formsExt.js +1 -1
  9. package/package.json +1 -1
  10. package/popup/popup.amd.js +1 -1
  11. package/popup/popup.amd.js.map +1 -1
  12. package/popup/popup.js +2 -2
  13. package/popup/popup.js.map +1 -1
  14. package/project/project.amd.js +1 -1
  15. package/project/project.amd.js.map +1 -1
  16. package/project/project.js +531 -859
  17. package/project/project.js.map +1 -1
  18. package/src/components/formsExt/selector2/composables/useAPI.d.ts +0 -2
  19. package/src/components/formsExt/selector2/composables/useMenu.d.ts +1 -3
  20. package/src/components/formsExt/selector2/selector2.vue.d.ts +0 -2
  21. package/src/components/formsExt/selector2/types.d.ts +0 -26
  22. package/src/components/popup/popup/listItem.vue.d.ts +4 -24
  23. package/src/components/popup/popup/types.d.ts +0 -1
  24. package/src/components/project/groupSelector/folders/types.d.ts +1 -0
  25. package/src/components/project/groupSelector/folders/utils.d.ts +417 -38
  26. package/src/components/project/groupSelector/groupSelector.vue.d.ts +1 -0
  27. package/src/components/project/groupSelector/groups/groups.vue.d.ts +1 -9
  28. package/src/components/project/groupSelector/groups/types.d.ts +1 -0
  29. package/src/components/project/groupSelector/groups/utils.d.ts +791 -57
  30. package/src/components/project/groupSelector/types.d.ts +6 -0
  31. package/src/components/project/project.d.ts +0 -1
  32. package/.chunks/policy.vue_vue_type_style_index_0_lang-AfwHvWs8.amd.js +0 -2
  33. package/.chunks/policy.vue_vue_type_style_index_0_lang-AfwHvWs8.amd.js.map +0 -1
  34. package/.chunks/policy.vue_vue_type_style_index_0_lang-BiCaYVJ6.es.js +0 -515
  35. package/.chunks/policy.vue_vue_type_style_index_0_lang-BiCaYVJ6.es.js.map +0 -1
  36. package/src/components/project/projectSelector/cache.d.ts +0 -30
  37. package/src/components/project/projectSelector/projectSelector.vue.d.ts +0 -128
  38. package/src/components/project/projectSelector/submenu/submenu.vue.d.ts +0 -4
  39. package/src/components/project/projectSelector/submenu/types.d.ts +0 -17
  40. package/src/components/project/projectSelector/types.d.ts +0 -52
  41. package/src/components/project/projectSelector/utils.d.ts +0 -230
@@ -3,20 +3,18 @@
3
3
  const fileNames = ['../assets/project.css'].map(fileName => import.meta.resolve(fileName));
4
4
  _autoloadCSSCore.insertCSSLinkToPage(fileNames, true);
5
5
 
6
- import { defineComponent as L, mergeModels as V, useModel as b, computed as M, createElementBlock as T, openBlock as p, createBlock as k, unref as m, withCtx as j, Fragment as F, renderList as fe, normalizeClass as oe, createElementVNode as R, toDisplayString as B, createVNode as O, createTextVNode as J, toValue as be, ref as _, watch as G, createCommentVNode as E, reactive as Ne, resolveComponent as De, shallowRef as qe, onMounted as Ze, withModifiers as W, isRef as we, mergeProps as Fe, withKeys as Pe, nextTick as et, resolveDirective as tt, withDirectives as ot, resolveDynamicComponent as at, renderSlot as lt, createSlots as nt } from "vue";
7
- import { u as A, C as Q, e as ee, q as he, d as rt } from "../.chunks/forms-CUaoBGD5.es.js";
8
- import { _ as ke, b as Te, a as it } from "../.chunks/popupHint.vue_vue_type_style_index_0_lang-DzT1BFMx.es.js";
9
- import { a as dt, _ as je, b as Ae, c as We, I as me } from "../.chunks/policy.vue_vue_type_style_index_0_lang-BiCaYVJ6.es.js";
10
- import { u as st } from "../.chunks/utils-Kzz2mc2t.es.js";
11
- import { getSearcherGIcon as ut, getLangLabel as ct, getDeviceGIcon as ft } from "../utils/searchers.js";
6
+ import { defineComponent as R, mergeModels as V, useModel as T, computed as M, createElementBlock as A, openBlock as h, createBlock as C, unref as v, withCtx as B, Fragment as Q, renderList as me, normalizeClass as Z, createElementVNode as oe, toDisplayString as b, createVNode as P, createTextVNode as J, toValue as ye, ref as K, watch as E, createCommentVNode as O, reactive as be, isRef as he, withModifiers as U, mergeProps as Ve, withKeys as Ie, nextTick as Re, resolveDirective as Pe, withDirectives as Ne, resolveDynamicComponent as qe, renderSlot as De, shallowRef as Fe, createSlots as Ue } from "vue";
7
+ import { u as w, C as z, e as H, q as ce, d as ze } from "../.chunks/forms-CUaoBGD5.es.js";
8
+ import { _ as we, b as ve, a as Je } from "../.chunks/popupHint.vue_vue_type_style_index_0_lang-DzT1BFMx.es.js";
9
+ import { a as We, _ as Me, b as $e, c as Ee, I as ue } from "../.chunks/policy.vue_vue_type_style_index_0_lang-uPC0N7jl.es.js";
10
+ import { u as Ye } from "../.chunks/utils-Kzz2mc2t.es.js";
11
+ import { getSearcherGIcon as Qe, getLangLabel as He, getDeviceGIcon as Xe } from "../utils/searchers.js";
12
12
  import "../.chunks/core-DBWAn2Eg.es.js";
13
13
  import "../.chunks/dialogs.vue_vue_type_script_setup_true_lang-BZM_iKPW.es.js";
14
- import { g as ye, a as le } from "../.chunks/field-CyyFzM-Y.es.js";
15
- import { validUrl as $e } from "../utils/check.js";
16
- import { ellipsis as gt } from "../utils/string.js";
17
- import { storage as X } from "../utils/dom.js";
18
- import { TopPopupWorker as mt } from "../popup/worker.js";
19
- const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" }, xo = /* @__PURE__ */ L({
14
+ import { g as Se } from "../.chunks/field-CyyFzM-Y.es.js";
15
+ import { storage as W } from "../utils/dom.js";
16
+ import { TopPopupWorker as Ze } from "../popup/worker.js";
17
+ const _e = { class: "top-competitorSelector" }, et = { class: "top-ellipsis1" }, Rt = /* @__PURE__ */ R({
20
18
  __name: "competitorSelector",
21
19
  props: /* @__PURE__ */ V({
22
20
  modelValue: {},
@@ -28,47 +26,47 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
28
26
  }),
29
27
  emits: ["update:modelValue"],
30
28
  setup(e) {
31
- const t = e, o = b(e, "modelValue"), a = M(() => {
32
- if (t.showSelectAllItem)
29
+ const a = e, o = T(e, "modelValue"), t = M(() => {
30
+ if (a.showSelectAllItem)
33
31
  return {
34
32
  icon: "",
35
- title: A().Common.Select_all,
33
+ title: w().Common.Select_all,
36
34
  value: "all",
37
35
  content: ""
38
36
  };
39
37
  });
40
- return (r, l) => (p(), T("div", vt, [
41
- m(Q).state.isMobile ? (p(), k(ke, { key: 0 }, {
42
- opener: j(() => [
43
- O(ee, {
38
+ return (r, l) => (h(), A("div", _e, [
39
+ v(z).state.isMobile ? (h(), C(we, { key: 0 }, {
40
+ opener: B(() => [
41
+ P(H, {
44
42
  class: "top-competitorSelector_opener",
45
43
  color: "theme",
46
44
  icon: "",
47
45
  icon2: ""
48
46
  }, {
49
- default: j(() => [
50
- J(B(e.items.find((n) => n.value === o.value?.[0])?.content), 1)
47
+ default: B(() => [
48
+ J(b(e.items.find((n) => n.value === o.value?.[0])?.content), 1)
51
49
  ]),
52
50
  _: 1
53
51
  })
54
52
  ]),
55
- contentList: j(() => [
56
- (p(!0), T(F, null, fe(e.items, (n) => (p(), k(Te, {
57
- class: oe({
53
+ contentList: B(() => [
54
+ (h(!0), A(Q, null, me(e.items, (n) => (h(), C(ve, {
55
+ class: Z({
58
56
  "top-active": o.value?.includes(n.value)
59
57
  }),
60
58
  "data-top-icon": n.icon,
61
59
  title: n.title,
62
60
  onClick: () => o.value = [n.value]
63
61
  }, {
64
- default: j(() => [
65
- R("span", pt, B(n.content), 1)
62
+ default: B(() => [
63
+ oe("span", et, b(n.content), 1)
66
64
  ]),
67
65
  _: 2
68
66
  }, 1032, ["class", "data-top-icon", "title", "onClick"]))), 256))
69
67
  ]),
70
68
  _: 1
71
- })) : (p(), k(dt, {
69
+ })) : (h(), C(We, {
72
70
  key: 1,
73
71
  modelValue: o.value,
74
72
  "onUpdate:modelValue": l[0] || (l[0] = (n) => o.value = n),
@@ -76,16 +74,16 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
76
74
  isMultiple: !0,
77
75
  styling: "bar",
78
76
  canBeEmptyMultiple: !1,
79
- selectAllItem: a.value
77
+ selectAllItem: t.value
80
78
  }, null, 8, ["modelValue", "items", "selectAllItem"]))
81
79
  ]));
82
80
  }
83
- }), Co = (e, t) => M(() => be(e).filter((r) => r.on >= 0 || r.id === t).map((r) => ({
81
+ }), Pt = (e, a) => M(() => ye(e).filter((r) => r.on >= 0 || r.id === a).map((r) => ({
84
82
  value: r.id,
85
83
  title: r.url + ` [${r.id}]`,
86
- icon: r.id === be(t) ? "" : "",
84
+ icon: r.id === ye(a) ? "" : "",
87
85
  content: r.name
88
- }))), D = -1, y = -2, ie = -1, ht = {
86
+ }))), L = -1, y = -2, le = -1, tt = {
89
87
  0: "Yandex",
90
88
  1: "Google",
91
89
  4: "YouTube",
@@ -95,44 +93,44 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
95
93
  9: "GoogleStore",
96
94
  20: "Yandex.com",
97
95
  21: "Yandex.com.tr"
98
- }, Me = {
96
+ }, xe = {
99
97
  key: y,
100
98
  name: "--",
101
99
  index: y
102
- }, Je = {
100
+ }, Ge = {
103
101
  key: y,
104
102
  name: "--",
105
- regions: [Me],
106
- regionByIndex: /* @__PURE__ */ new Map([[y, Me]])
107
- }, de = {
103
+ regions: [xe],
104
+ regionByIndex: /* @__PURE__ */ new Map([[y, xe]])
105
+ }, ae = {
108
106
  key: y,
109
107
  name: "Autoselect",
110
108
  index: y
111
- }, ve = {
109
+ }, se = {
112
110
  key: y,
113
111
  name: "Autoselect",
114
- regions: [de],
115
- regionByIndex: /* @__PURE__ */ new Map([[y, de]])
116
- }, _e = {
112
+ regions: [ae],
113
+ regionByIndex: /* @__PURE__ */ new Map([[y, ae]])
114
+ }, ke = {
117
115
  countryCode: "00",
118
116
  depth: 1,
119
117
  device: 0,
120
- key: ie,
121
- index: ie,
118
+ key: le,
119
+ index: le,
122
120
  lang: "ru",
123
121
  name: "Without region"
124
- }, yt = () => (de.name = A().Common.Autoselect, de), St = () => (yt(), ve.name = A().Common.Autoselect, console.log(ve), ve), It = () => (_e.name = A().Keywords.Without_region, _e), He = (e = !1, t = !1, o = []) => {
125
- let a;
126
- return e ? a = xt(o) : a = ze(o), t && a.set(y, St()), a.size || a.set(y, Je), a;
127
- }, ze = (e, t = !0, o = [], a = !1) => {
122
+ }, ot = () => (ae.name = w().Common.Autoselect, ae), lt = () => (ot(), se.name = w().Common.Autoselect, console.log(se), se), at = () => (ke.name = w().Keywords.Without_region, ke), Ke = (e = !1, a = !1, o = []) => {
123
+ let t;
124
+ return e ? t = nt(o) : t = Oe(o), a && t.set(y, lt()), t.size || t.set(y, Ge), t;
125
+ }, Oe = (e, a = !0, o = [], t = !1) => {
128
126
  const r = /* @__PURE__ */ new Map();
129
127
  return e.forEach((l) => {
130
- if (!l.enabled || a && typeof l.key == "number" && l.key > 1) return;
128
+ if (!l.enabled || t && typeof l.key == "number" && l.key > 1) return;
131
129
  const n = { ...l };
132
- n.regionByIndex = /* @__PURE__ */ new Map(), l.regions && l.regions.forEach((s) => {
133
- if (t && !s.enabled) return;
134
- const g = { ...s };
135
- n.regionByIndex.set(g.index, g);
130
+ n.regionByIndex = /* @__PURE__ */ new Map(), l.regions && l.regions.forEach((u) => {
131
+ if (a && !u.enabled) return;
132
+ const f = { ...u };
133
+ n.regionByIndex.set(f.index, f);
136
134
  }), !n.regionByIndex.size && o.length, // режим вывода ПС без регионов
137
135
  (!l.regions || // есть включенные регионы
138
136
  n.regionByIndex.size || // запрошен вывод конкретных ПС
@@ -141,42 +139,42 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
141
139
  if (r.has(l)) return;
142
140
  const n = {
143
141
  key: l,
144
- name: ht[l],
142
+ name: tt[l],
145
143
  regions: [],
146
144
  regionByIndex: /* @__PURE__ */ new Map()
147
145
  };
148
146
  r.set(n.key, n);
149
147
  }), r;
150
- }, xt = (e) => {
151
- const t = ze(e, !1, [0, 1], !0);
152
- if (t.has(2)) {
153
- const o = t.get(2);
148
+ }, nt = (e) => {
149
+ const a = Oe(e, !1, [0, 1], !0);
150
+ if (a.has(2)) {
151
+ const o = a.get(2);
154
152
  o && (o.regionByIndex = /* @__PURE__ */ new Map());
155
153
  }
156
- return t.forEach((o) => {
154
+ return a.forEach((o) => {
157
155
  if (!o.regionByIndex) return;
158
- const a = { ...It() };
159
- o.regionByIndex.set(a.index, a);
160
- }), t;
161
- }, Ct = (e, t, o = []) => {
162
- const a = He(e, !1, o);
156
+ const t = { ...at() };
157
+ o.regionByIndex.set(t.index, t);
158
+ }), a;
159
+ }, rt = (e, a, o = []) => {
160
+ const t = Ke(e, !1, o);
163
161
  let r;
164
- return a.forEach((l) => {
165
- if (!(t.searcher_key !== void 0 && t.searcher_key != l.key) && l.regions && (l.regions.forEach((n) => {
166
- if (!r && !(t.key !== void 0 && t.key != n.key) && !(t.index !== void 0 && t.index != n.index) && !(!e && (t.lang !== void 0 && t.lang != n.lang || t.device !== void 0 && t.device != n.device)))
162
+ return t.forEach((l) => {
163
+ if (!(a.searcher_key !== void 0 && a.searcher_key != l.key) && l.regions && (l.regions.forEach((n) => {
164
+ if (!r && !(a.key !== void 0 && a.key != n.key) && !(a.index !== void 0 && a.index != n.index) && !(!e && (a.lang !== void 0 && a.lang != n.lang || a.device !== void 0 && a.device != n.device)))
167
165
  return n.searcher_key = l.key, r = n, !1;
168
166
  }), r))
169
167
  return !1;
170
168
  }), r;
171
- }, kt = st(() => import("../.chunks/dialog_regionSelectorRegions-BMWyYCfD.es.js")), Tt = (e, t) => {
172
- const o = A(), a = _(t.value.keys().next().value ?? y), r = M(() => {
169
+ }, it = Ye(() => import("../.chunks/dialog_regionSelectorRegions-BMWyYCfD.es.js")), dt = (e, a) => {
170
+ const o = w(), t = K(a.value.keys().next().value ?? y), r = M(() => {
173
171
  const l = /* @__PURE__ */ new Map();
174
- if (t.value.forEach((n) => {
175
- let s = {
172
+ if (a.value.forEach((n) => {
173
+ let u = {
176
174
  value: n.key,
177
175
  title: n.name
178
176
  };
179
- e.addSearcherIcon && (s.icon = ut(n.key)), l.set(n.key, s);
177
+ e.addSearcherIcon && (u.icon = Qe(n.key)), l.set(n.key, u);
180
178
  }), e.addCompare && !l.has(y)) {
181
179
  const n = {
182
180
  value: "",
@@ -184,74 +182,74 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
184
182
  disabled: !0
185
183
  };
186
184
  l.set(n.value, n);
187
- const s = {
188
- value: D,
185
+ const u = {
186
+ value: L,
189
187
  title: o.Common.Compare
190
188
  };
191
- l.set(s.value, s);
189
+ l.set(u.value, u);
192
190
  }
193
191
  return l;
194
192
  });
195
193
  return {
196
- searcherKey: a,
194
+ searcherKey: t,
197
195
  optionBySearcherKey: r
198
196
  };
199
- }, jt = (e, t) => {
200
- const o = A(), a = _(y);
201
- e.modelValue.length === 1 && (a.value = e.modelValue[0]), a.value === y && (e.forFrequency ? a.value = t.value?.regionByIndex.values().next().value?.key ?? y : a.value = t.value?.regionByIndex.keys().next().value ?? y);
197
+ }, ut = (e, a) => {
198
+ const o = w(), t = K(y);
199
+ e.modelValue.length === 1 && (t.value = e.modelValue[0]), t.value === y && (e.forFrequency ? t.value = a.value?.regionByIndex.values().next().value?.key ?? y : t.value = a.value?.regionByIndex.keys().next().value ?? y);
202
200
  const r = M(() => {
203
201
  const l = /* @__PURE__ */ new Map();
204
- return t.value.regionByIndex?.forEach((n) => {
205
- let s = n.name;
202
+ return a.value.regionByIndex?.forEach((n) => {
203
+ let u = n.name;
206
204
  if (e.forFrequency) {
207
- const S = {
205
+ const x = {
208
206
  value: n.key,
209
- title: s
207
+ title: u
210
208
  };
211
- l.has(n.key) || l.set(n.key, S);
209
+ l.has(n.key) || l.set(n.key, x);
212
210
  return;
213
211
  }
214
- n.device && (s += " (" + o.Common["Device_" + n.device] + ")");
215
- const g = ct(t.value.key || 0, n.lang ?? "");
216
- g && (s += " / " + g);
212
+ n.device && (u += " (" + o.Common["Device_" + n.device] + ")");
213
+ const f = He(a.value.key || 0, n.lang ?? "");
214
+ f && (u += " / " + f);
217
215
  const c = {
218
216
  value: n.index,
219
- title: s,
220
- icon: n.device ? ft(n.device) : void 0
217
+ title: u,
218
+ icon: n.device ? Xe(n.device) : void 0
221
219
  };
222
220
  l.set(n.index, c);
223
221
  }), l;
224
222
  });
225
- return G(r, (l, n) => {
226
- if (e.onlySearcher || a.value !== void 0 && l.get(a.value))
223
+ return E(r, (l, n) => {
224
+ if (e.onlySearcher || t.value !== void 0 && l.get(t.value))
227
225
  return;
228
- let s = l.keys().next().value;
229
- if (a.value === y || s === y) {
230
- a.value = s;
226
+ let u = l.keys().next().value;
227
+ if (t.value === y || u === y) {
228
+ t.value = u;
231
229
  return;
232
230
  }
233
- let g = n?.get(a.value)?.title || "", c = -1;
234
- for (const [S, i] of l.entries()) {
235
- const v = i.title;
236
- if (typeof v != "string" || typeof S == "string")
231
+ let f = n?.get(t.value)?.title || "", c = -1;
232
+ for (const [x, i] of l.entries()) {
233
+ const m = i.title;
234
+ if (typeof m != "string" || typeof x == "string")
237
235
  break;
238
- if (v === g) {
239
- s = S;
236
+ if (m === f) {
237
+ u = x;
240
238
  break;
241
239
  }
242
240
  const d = new RegExp(` \\((${o.Common.Device_1}|${o.Common.Device_2})\\)`);
243
- let f = g, u = 3;
244
- v.indexOf(f) === -1 && (f = g.replace(/^[^a-zа-я]/i, "").replace(d, ""), u--), v.indexOf(f) === -1 && (f = g.replace(/ \/.*/, ""), u--), v.indexOf(f) === -1 && (f = g.replace(/ \/.*/, ""), f = f.replace(/^[^a-zа-я]/i, "").replace(d, ""), u--), v.indexOf(f) !== -1 && (u <= c || (c = u, s = S));
241
+ let s = f, g = 3;
242
+ m.indexOf(s) === -1 && (s = f.replace(/^[^a-zа-я]/i, "").replace(d, ""), g--), m.indexOf(s) === -1 && (s = f.replace(/ \/.*/, ""), g--), m.indexOf(s) === -1 && (s = f.replace(/ \/.*/, ""), s = s.replace(/^[^a-zа-я]/i, "").replace(d, ""), g--), m.indexOf(s) !== -1 && (g <= c || (c = g, u = x));
245
243
  }
246
- a.value = s;
244
+ t.value = u;
247
245
  }), {
248
- regionIndex: a,
246
+ regionIndex: t,
249
247
  optionByRegionIndex: r
250
248
  };
251
- }, At = (e, t, o) => {
252
- const a = _([]), r = () => {
253
- if (e.onlySearcher && t.value) {
254
- a.value = Array.from(t.value.keys());
249
+ }, st = (e, a, o) => {
250
+ const t = K([]), r = () => {
251
+ if (e.onlySearcher && a.value) {
252
+ t.value = Array.from(a.value.keys());
255
253
  return;
256
254
  }
257
255
  let n = [];
@@ -264,70 +262,70 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
264
262
  ) ?? [];
265
263
  } catch {
266
264
  }
267
- n.length && (n = n.filter((s) => o.value.has(s))), n.length || (n = Array.from(o.value)), a.value = [...n];
265
+ n.length && (n = n.filter((u) => o.value.has(u))), n.length || (n = Array.from(o.value)), t.value = [...n];
268
266
  }, l = () => {
269
- a.value.length ? localStorage.setItem("ui:project:regionSelector:" + e.projectId + ":regionsIndexes", JSON.stringify(a.value)) : localStorage.removeItem("ui:project:regionSelector:" + e.projectId + ":regionsIndexes");
267
+ t.value.length ? localStorage.setItem("ui:project:regionSelector:" + e.projectId + ":regionsIndexes", JSON.stringify(t.value)) : localStorage.removeItem("ui:project:regionSelector:" + e.projectId + ":regionsIndexes");
270
268
  };
271
- return G(a, () => {
269
+ return E(t, () => {
272
270
  l();
273
271
  }), e.addCompare && r(), {
274
- regionsIndexes: a
272
+ regionsIndexes: t
275
273
  };
276
- }, Bt = (e) => {
277
- const t = M(() => He(e.forFrequency, e.autoRegion, e.searchers)), o = M(() => t.value.get(r.searcherKey.value) || Je), a = M(() => {
274
+ }, ct = (e) => {
275
+ const a = M(() => Ke(e.forFrequency, e.autoRegion, e.searchers)), o = M(() => a.value.get(r.searcherKey.value) || Ge), t = M(() => {
278
276
  const i = /* @__PURE__ */ new Set();
279
- return t.value.forEach((v) => {
280
- v.regionByIndex.forEach((d) => {
281
- d.index !== ie && d.index !== y && i.add(d.index);
277
+ return a.value.forEach((m) => {
278
+ m.regionByIndex.forEach((d) => {
279
+ d.index !== le && d.index !== y && i.add(d.index);
282
280
  });
283
281
  }), i;
284
- }), r = Tt(e, t), l = jt(e, o), n = At(e, t, a);
285
- G(t, () => {
286
- if (e.onlySearcher ? n.regionsIndexes.value = Array.from(t.value.keys()) : n.regionsIndexes.value = n.regionsIndexes.value.filter((v) => a.value.has(v)), r.searcherKey.value === D) return;
287
- let i = t.value.keys().next().value;
288
- t.value.forEach((v) => {
289
- if (e.onlySearcher && v.key === r.searcherKey.value) {
282
+ }), r = dt(e, a), l = ut(e, o), n = st(e, a, t);
283
+ E(a, () => {
284
+ if (e.onlySearcher ? n.regionsIndexes.value = Array.from(a.value.keys()) : n.regionsIndexes.value = n.regionsIndexes.value.filter((m) => t.value.has(m)), r.searcherKey.value === L) return;
285
+ let i = a.value.keys().next().value;
286
+ a.value.forEach((m) => {
287
+ if (e.onlySearcher && m.key === r.searcherKey.value) {
290
288
  i = r.searcherKey.value;
291
289
  return;
292
290
  }
293
- if (l.regionIndex.value && v.regionByIndex?.has(l.regionIndex.value) && (i = v.key), !e.onlySearcher) {
291
+ if (l.regionIndex.value && m.regionByIndex?.has(l.regionIndex.value) && (i = m.key), !e.onlySearcher) {
294
292
  let d;
295
- i !== void 0 && (d = t.value.get(i)?.regionByIndex);
296
- const f = t.value.get(v.key)?.regionByIndex;
297
- d?.has(y) && !f?.has(y) && (i = v.key);
293
+ i !== void 0 && (d = a.value.get(i)?.regionByIndex);
294
+ const s = a.value.get(m.key)?.regionByIndex;
295
+ d?.has(y) && !s?.has(y) && (i = m.key);
298
296
  }
299
297
  }), i !== void 0 && (r.searcherKey.value = i), l.regionIndex.value !== void 0 && !o.value?.regionByIndex?.has(l.regionIndex.value) && (l.regionIndex.value = o.value?.regions?.keys().next().value);
300
298
  }, { immediate: !0 });
301
- const s = () => {
302
- if (!(r.searcherKey.value === D || r.searcherKey.value === y))
299
+ const u = () => {
300
+ if (!(r.searcherKey.value === L || r.searcherKey.value === y))
303
301
  return r.searcherKey.value;
304
- }, g = () => {
302
+ }, f = () => {
305
303
  if (e.onlySearcher || l.regionIndex.value === y) return;
306
304
  let i = l.regionIndex.value;
307
305
  if (e.forFrequency) {
308
- const v = l.regionIndex.value;
309
- i = Ct(e.forFrequency, { searcher_key: s(), key: v }, e.searchers)?.index;
306
+ const m = l.regionIndex.value;
307
+ i = rt(e.forFrequency, { searcher_key: u(), key: m }, e.searchers)?.index;
310
308
  }
311
309
  return i;
312
310
  }, c = () => {
313
- const i = s();
311
+ const i = u();
314
312
  if (i !== void 0)
315
- return t.value.get(i);
313
+ return a.value.get(i);
316
314
  };
317
315
  return {
318
316
  selectSearcher: r,
319
317
  selectRegion: l,
320
318
  compare: n,
321
- searcherByKey: t,
322
- allRegionsIndexes: a,
319
+ searcherByKey: a,
320
+ allRegionsIndexes: t,
323
321
  getSearcher: c,
324
322
  getRegion: () => {
325
- const i = g();
323
+ const i = f();
326
324
  if (i !== void 0)
327
325
  return c()?.regionByIndex?.get(i);
328
326
  }
329
327
  };
330
- }, ko = /* @__PURE__ */ L({
328
+ }, Nt = /* @__PURE__ */ R({
331
329
  __name: "regionSelector",
332
330
  props: /* @__PURE__ */ V({
333
331
  projectId: {},
@@ -348,84 +346,84 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
348
346
  modelValueSingleModifiers: {}
349
347
  }),
350
348
  emits: ["update:modelValue", "update:modelValueSingle"],
351
- setup(e, { expose: t }) {
352
- const o = e, a = b(e, "modelValue"), r = b(e, "modelValueSingle"), {
349
+ setup(e, { expose: a }) {
350
+ const o = e, t = T(e, "modelValue"), r = T(e, "modelValueSingle"), {
353
351
  selectSearcher: l,
354
352
  selectRegion: n,
355
- compare: s,
356
- searcherByKey: g,
353
+ compare: u,
354
+ searcherByKey: f,
357
355
  allRegionsIndexes: c,
358
- getSearcher: S,
356
+ getSearcher: x,
359
357
  getRegion: i
360
- } = Bt(o), v = () => {
358
+ } = ct(o), m = () => {
361
359
  const d = [];
362
- g.value.forEach((f) => {
363
- f.enabled && f.regions.forEach((u) => {
364
- u.enabled && d.push(u);
360
+ f.value.forEach((s) => {
361
+ s.enabled && s.regions.forEach((g) => {
362
+ g.enabled && d.push(g);
365
363
  });
366
- }), kt.open("regions", {
364
+ }), it.open("regions", {
367
365
  regions: d,
368
- regionsIndexes: s.regionsIndexes.value,
369
- "@update:regionsIndexes": (f) => s.regionsIndexes.value = f
366
+ regionsIndexes: u.regionsIndexes.value,
367
+ "@update:regionsIndexes": (s) => u.regionsIndexes.value = s
370
368
  });
371
369
  };
372
- return G([n.regionIndex, l.searcherKey, s.regionsIndexes], () => {
373
- if (l.searcherKey.value === D && s.regionsIndexes.value.length) {
374
- if (JSON.stringify(a.value) === JSON.stringify(s.regionsIndexes.value))
370
+ return E([n.regionIndex, l.searcherKey, u.regionsIndexes], () => {
371
+ if (l.searcherKey.value === L && u.regionsIndexes.value.length) {
372
+ if (JSON.stringify(t.value) === JSON.stringify(u.regionsIndexes.value))
375
373
  return;
376
- a.value = [...s.regionsIndexes.value];
374
+ t.value = [...u.regionsIndexes.value];
377
375
  } else
378
- o.onlySearcher ? (a.value = [l.searcherKey.value], l.searcherKey.value === y && !o.autoRegion && (a.value.length = 0)) : (a.value = [n.regionIndex.value], n.regionIndex.value === y && !o.autoRegion && (a.value.length = 0));
376
+ o.onlySearcher ? (t.value = [l.searcherKey.value], l.searcherKey.value === y && !o.autoRegion && (t.value.length = 0)) : (t.value = [n.regionIndex.value], n.regionIndex.value === y && !o.autoRegion && (t.value.length = 0));
379
377
  !o.onlySearcher && !c.value.size && (l.searcherKey.value = y);
380
- }), r.value && G(r, () => {
381
- r.value && (a.value = [r.value]);
382
- }, { immediate: !0 }), G(a, () => {
383
- if (a.value[0] && (r.value = a.value[0]), o.onlySearcher) {
384
- if (!a.value.length || a.value.length === 1 && !g.value.has(a.value[0]) || a.value.length === 1 && a.value[0] === y && !o.autoRegion) {
385
- let d = g.value.keys().next().value;
386
- d === y && !o.autoRegion && (d = void 0, r.value = y), d !== void 0 ? a.value = [d] : a.value.length = 0;
378
+ }), r.value && E(r, () => {
379
+ r.value && (t.value = [r.value]);
380
+ }, { immediate: !0 }), E(t, () => {
381
+ if (t.value[0] && (r.value = t.value[0]), o.onlySearcher) {
382
+ if (!t.value.length || t.value.length === 1 && !f.value.has(t.value[0]) || t.value.length === 1 && t.value[0] === y && !o.autoRegion) {
383
+ let d = f.value.keys().next().value;
384
+ d === y && !o.autoRegion && (d = void 0, r.value = y), d !== void 0 ? t.value = [d] : t.value.length = 0;
387
385
  return;
388
386
  }
389
- if (a.value.length > 1 && JSON.stringify(a.value) !== JSON.stringify(s.regionsIndexes.value)) {
390
- a.value = [...s.regionsIndexes.value];
387
+ if (t.value.length > 1 && JSON.stringify(t.value) !== JSON.stringify(u.regionsIndexes.value)) {
388
+ t.value = [...u.regionsIndexes.value];
391
389
  return;
392
390
  }
393
391
  } else {
394
- let d = [...new Set(a.value)], f = g.value.values().next().value?.regionByIndex?.keys().next().value;
395
- if (o.forFrequency && (f = g.value.values().next().value?.regionByIndex?.values().next().value?.key), f === y && !o.autoRegion && (f = void 0, r.value = y), !d.length)
396
- f !== void 0 && d.push(f);
392
+ let d = [...new Set(t.value)], s = f.value.values().next().value?.regionByIndex?.keys().next().value;
393
+ if (o.forFrequency && (s = f.value.values().next().value?.regionByIndex?.values().next().value?.key), s === y && !o.autoRegion && (s = void 0, r.value = y), !d.length)
394
+ s !== void 0 && d.push(s);
397
395
  else if (d.length === 1) {
398
- let u = c.value;
399
- o.forFrequency && (u = /* @__PURE__ */ new Set(), g.value.forEach((w) => {
400
- w.regionByIndex.forEach((U) => {
401
- U.index !== ie && U.index !== y && u.add(U.key);
396
+ let g = c.value;
397
+ o.forFrequency && (g = /* @__PURE__ */ new Set(), f.value.forEach((_) => {
398
+ _.regionByIndex.forEach((N) => {
399
+ N.index !== le && N.index !== y && g.add(N.key);
402
400
  });
403
- })), u.has(d[0]) || (d = [], f !== void 0 && d.push(f));
401
+ })), g.has(d[0]) || (d = [], s !== void 0 && d.push(s));
404
402
  } else
405
- d = d.filter((u) => c.value.has(u)), !d.length && f !== void 0 && d.push(f);
406
- if (JSON.stringify(a.value) !== JSON.stringify(d)) {
407
- a.value = d;
403
+ d = d.filter((g) => c.value.has(g)), !d.length && s !== void 0 && d.push(s);
404
+ if (JSON.stringify(t.value) !== JSON.stringify(d)) {
405
+ t.value = d;
408
406
  return;
409
407
  }
410
408
  }
411
- if (!(a.value.length === 1 && a.value[0] === (o.onlySearcher ? l.searcherKey.value : n.regionIndex.value)))
409
+ if (!(t.value.length === 1 && t.value[0] === (o.onlySearcher ? l.searcherKey.value : n.regionIndex.value)))
412
410
  if (o.onlySearcher) {
413
- if (a.value.length === 1) {
414
- l.searcherKey.value = a.value[0];
411
+ if (t.value.length === 1) {
412
+ l.searcherKey.value = t.value[0];
415
413
  return;
416
414
  }
417
- l.searcherKey.value = D;
415
+ l.searcherKey.value = L;
418
416
  return;
419
417
  } else {
420
- if (!a.value.length)
418
+ if (!t.value.length)
421
419
  return;
422
- if (a.value.length === 1 && l.searcherKey.value !== D) {
423
- n.regionIndex.value = a.value[0];
420
+ if (t.value.length === 1 && l.searcherKey.value !== L) {
421
+ n.regionIndex.value = t.value[0];
424
422
  let d;
425
- for (const f of g.value.values()) {
426
- for (const u of f.regionByIndex.values())
427
- if ((o.forFrequency ? u.key : u.index) === n.regionIndex.value) {
428
- d = f.key;
423
+ for (const s of f.value.values()) {
424
+ for (const g of s.regionByIndex.values())
425
+ if ((o.forFrequency ? g.key : g.index) === n.regionIndex.value) {
426
+ d = s.key;
429
427
  break;
430
428
  }
431
429
  if (d !== void 0)
@@ -433,76 +431,76 @@ const vt = { class: "top-competitorSelector" }, pt = { class: "top-ellipsis1" },
433
431
  }
434
432
  d !== void 0 && (l.searcherKey.value = d);
435
433
  } else
436
- l.searcherKey.value = D, s.regionsIndexes.value = [...a.value];
434
+ l.searcherKey.value = L, u.regionsIndexes.value = [...t.value];
437
435
  }
438
- }, { immediate: !0 }), t({
439
- getSearcher: S,
436
+ }, { immediate: !0 }), a({
437
+ getSearcher: x,
440
438
  getRegion: i
441
- }), (d, f) => (p(), T("div", {
442
- class: oe({
439
+ }), (d, s) => (h(), A("div", {
440
+ class: Z({
443
441
  "top-selectorRegion": !0,
444
442
  "top-selectorRegion-onlySearcher": e.onlySearcher
445
443
  })
446
444
  }, [
447
- O(he, {
448
- options: m(l).optionBySearcherKey.value,
449
- modelValue: m(l).searcherKey.value,
450
- "onUpdate:modelValue": f[0] || (f[0] = (u) => m(l).searcherKey.value = u),
445
+ P(ce, {
446
+ options: v(l).optionBySearcherKey.value,
447
+ modelValue: v(l).searcherKey.value,
448
+ "onUpdate:modelValue": s[0] || (s[0] = (g) => v(l).searcherKey.value = g),
451
449
  name: "searcher_key",
452
450
  addChanger: e.addChanger
453
451
  }, null, 8, ["options", "modelValue", "addChanger"]),
454
- !e.onlySearcher && m(l).searcherKey.value !== m(D) ? (p(), k(he, {
452
+ !e.onlySearcher && v(l).searcherKey.value !== v(L) ? (h(), C(ce, {
455
453
  key: 0,
456
454
  class: "top-select-region",
457
- options: m(n).optionByRegionIndex.value,
458
- modelValue: m(n).regionIndex.value,
459
- "onUpdate:modelValue": f[1] || (f[1] = (u) => m(n).regionIndex.value = u),
455
+ options: v(n).optionByRegionIndex.value,
456
+ modelValue: v(n).regionIndex.value,
457
+ "onUpdate:modelValue": s[1] || (s[1] = (g) => v(n).regionIndex.value = g),
460
458
  name: e.forFrequency ? "region_key" : "region_index",
461
459
  addChanger: e.addChanger,
462
460
  "data-top-icon": e.addRegionIcon ? "" : void 0
463
- }, null, 8, ["options", "modelValue", "name", "addChanger", "data-top-icon"])) : E("", !0),
464
- e.addCompare && !e.onlySearcher && m(l).searcherKey.value === m(D) ? (p(), k(ee, {
461
+ }, null, 8, ["options", "modelValue", "name", "addChanger", "data-top-icon"])) : O("", !0),
462
+ e.addCompare && !e.onlySearcher && v(l).searcherKey.value === v(L) ? (h(), C(H, {
465
463
  key: 1,
466
464
  name: "compare",
467
- onClick: v,
468
- "data-count-compare-regions-indexes": m(s).regionsIndexes.value.length
465
+ onClick: m,
466
+ "data-count-compare-regions-indexes": v(u).regionsIndexes.value.length
469
467
  }, {
470
- default: j(() => [
471
- J(B(d.$i18n.Common.Selected_regions), 1)
468
+ default: B(() => [
469
+ J(b(d.$i18n.Common.Selected_regions), 1)
472
470
  ]),
473
471
  _: 1
474
- }, 8, ["data-count-compare-regions-indexes"])) : E("", !0)
472
+ }, 8, ["data-count-compare-regions-indexes"])) : O("", !0)
475
473
  ], 2));
476
474
  }
477
- }), q = {
475
+ }), j = {
478
476
  id: 0,
479
477
  name: "/",
480
478
  path: "/"
481
479
  };
482
- function bt(e) {
483
- return e ? A()?.Common.All_folders : "/ (" + A()?.Keywords.Root_folder + ")";
480
+ function gt(e) {
481
+ return e ? w()?.Common.All_folders : "/ (" + w()?.Keywords.Root_folder + ")";
484
482
  }
485
- const Be = (e, t, o = /* @__PURE__ */ new Map(), a = { id: "root" }, r = 0) => (a.childsIds = [], a.id && (a.countAllGroupsActive = a.count_groups_active), e[a.id] && e[a.id].forEach((l) => {
486
- l = { ...l }, a.childsIds.push(l.id), l.id === 0 && (l.name = bt(t));
483
+ const pe = (e, a, o = /* @__PURE__ */ new Map(), t = { id: "root" }, r = 0) => (t.childsIds = [], t.id && (t.countAllGroupsActive = t.count_groups_active), e[t.id] && e[t.id].forEach((l) => {
484
+ l = { ...l }, t.childsIds.push(l.id), l.id === 0 && (l.name = gt(a));
487
485
  const n = r > 1 ? "-".repeat(r - 1) + " " : "";
488
- n && !l.name.startsWith(n) && (l.name = n + l.name), o.set(l.id, l), Be(e, t, o, l, r + 1), a.childsIds = a.childsIds.concat(l.childsIds), a.id && l.count_groups_active && (a.countAllGroupsActive += l.count_groups_active);
489
- }), o), wt = (e) => e.gen("/get/keywords_2/folders/", ["id", "parent_id", "name", "path"]).changeParams({ orders: ["ord_path"], limit: 100 });
490
- function Se(e, t, o) {
491
- const a = Object.keys(e), r = a.map((l) => e[l]);
492
- return G(r, (l, n, s) => {
493
- const g = {};
494
- l.forEach((c, S) => {
495
- if (!Object.is(c, n[S])) {
496
- const i = a[S];
497
- g[i] = {
498
- old: n[S],
486
+ n && !l.name.startsWith(n) && (l.name = n + l.name), o.set(l.id, l), pe(e, a, o, l, r + 1), t.childsIds = t.childsIds.concat(l.childsIds), t.id && l.count_groups_active && (t.countAllGroupsActive += l.count_groups_active);
487
+ }), o), ft = (e, a) => e.gen(`/get/${a}/folders/`, ["id", "parent_id", "name", "path"]).changeParams({ orders: ["ord_path"], limit: 100 });
488
+ function ge(e, a, o) {
489
+ const t = Object.keys(e), r = t.map((l) => e[l]);
490
+ return E(r, (l, n, u) => {
491
+ const f = {};
492
+ l.forEach((c, x) => {
493
+ if (!Object.is(c, n[x])) {
494
+ const i = t[x];
495
+ f[i] = {
496
+ old: n[x],
499
497
  new: c
500
498
  };
501
499
  }
502
- }), Object.keys(g).length && t(g, s);
500
+ }), Object.keys(f).length && a(f, u);
503
501
  }, o);
504
502
  }
505
- const Pt = /* @__PURE__ */ L({
503
+ const mt = /* @__PURE__ */ R({
506
504
  __name: "folders",
507
505
  props: /* @__PURE__ */ V({
508
506
  folderId: {},
@@ -512,66 +510,67 @@ const Pt = /* @__PURE__ */ L({
512
510
  canSelectAll: { type: Boolean },
513
511
  addChanger: { type: Boolean },
514
512
  addIcon: { type: Boolean, default: !0 },
515
- client: {}
513
+ client: {},
514
+ service: {}
516
515
  }, {
517
516
  folderId: { required: !0 },
518
517
  folderIdModifiers: {},
519
- folder: { default: q },
518
+ folder: { default: j },
520
519
  folderModifiers: {}
521
520
  }),
522
521
  emits: ["update:folderId", "update:folder"],
523
522
  setup(e) {
524
- const t = e, o = b(e, "folderId"), a = b(e, "folder"), r = t.client && !t.folders ? wt(t.client) : void 0, l = _(null);
525
- G(() => t.projectId, () => {
523
+ const a = e, o = T(e, "folderId"), t = T(e, "folder"), r = a.client && !a.folders ? ft(a.client, a.service) : void 0, l = K(null);
524
+ E(() => a.projectId, () => {
526
525
  r?.changeParams({
527
- project_id: t.projectId
526
+ project_id: a.projectId
528
527
  }), r?.setOptions({
529
- checkFingerprint: "TopGroupSelectorFolders:" + t.projectId
528
+ checkFingerprint: "TopGroupSelectorFolders:" + a.projectId
530
529
  }), l.value?.resetCache();
531
530
  }, { immediate: !0 });
532
- const n = M(() => Be(t.folders ?? { root: [q] }, t.canSelectAll));
533
- return Se({
534
- modelFolder: a,
531
+ const n = M(() => pe(a.folders ?? { root: [j] }, a.canSelectAll));
532
+ return ge({
533
+ modelFolder: t,
535
534
  modelFolderId: o
536
- }, async (s) => {
537
- if (o.value === a.value.id)
535
+ }, async (u) => {
536
+ if (o.value === t.value.id)
538
537
  return;
539
- if (s.modelFolder && !s.modelFolderId) {
540
- o.value = a.value.id;
538
+ if (u.modelFolder && !u.modelFolderId) {
539
+ o.value = t.value.id;
541
540
  return;
542
541
  }
543
- let g = n.value.get(t.folderId);
544
- g || (g = q), a.value = g, o.value = g.id;
545
- }, { immediate: !0 }), (s, g) => (p(), k(je, {
542
+ let f = n.value.get(a.folderId);
543
+ f || (f = j), t.value = f, o.value = f.id;
544
+ }, { immediate: !0 }), (u, f) => (h(), C(Me, {
546
545
  class: "top-groupSelector_folder",
547
- modelValue: a.value,
548
- "onUpdate:modelValue": g[0] || (g[0] = (c) => a.value = c),
546
+ modelValue: t.value,
547
+ "onUpdate:modelValue": f[0] || (f[0] = (c) => t.value = c),
549
548
  items: e.folders ? [...n.value.values()] : void 0,
550
549
  "search-type": "inline",
551
550
  icon: e.addIcon ? "" : void 0,
552
- api: e.folders ? void 0 : m(r),
553
- apiSetSearchParams: (...c) => m(Ae)(...c, "name"),
551
+ api: e.folders ? void 0 : v(r),
552
+ apiSetSearchParams: (...c) => v($e)(...c, "name"),
554
553
  addChanger: e.addChanger,
555
554
  useCache: ""
556
555
  }, null, 8, ["modelValue", "items", "icon", "api", "apiSetSearchParams", "addChanger"]));
557
556
  }
558
- }), se = {
557
+ }), ne = {
559
558
  id: -1,
560
559
  name: "--",
561
- folder_id: q.id,
562
- folder_path: q.path
563
- }, ue = {
564
- id: We,
560
+ folder_id: j.id,
561
+ folder_path: j.path
562
+ }, re = {
563
+ id: Ee,
565
564
  name: "All groups",
566
- folder_id: q.id,
567
- folder_path: q.path
568
- }, Z = () => (ue.name = A()?.Common.All_groups, ue), Ye = () => (ue.name = A()?.Keywords.Choose_group, ue), $t = (e, t, o) => (e = [...e], t !== void 0 && (e = e.filter((a) => a.on == Number(t))), o && o.id && o.childsIds && (e = e.filter((a) => a.folder_id === o.id || o.childsIds.includes(a.folder_id))), e), Ee = (e) => e.gen("/get/keywords_2/groups/", ["id", "name", "folder_id", "folder_path"]).changeParams({ folder_id_depth: !0, limit: 100 }), Mt = (e) => e.gen("/add/keywords_2/groups/"), _t = { class: "top-groupSelector_groupItem" }, Et = {
565
+ folder_id: j.id,
566
+ folder_path: j.path
567
+ }, Y = () => (re.name = w()?.Common.All_groups, re), Le = () => (re.name = w()?.Keywords.Choose_group, re), vt = (e, a, o) => (e = [...e], a !== void 0 && (e = e.filter((t) => t.on == Number(a))), o && o.id && o.childsIds && (e = e.filter((t) => t.folder_id === o.id || o.childsIds.includes(t.folder_id))), e), Ce = (e, a) => e.gen(`/get/${a}/groups/`, ["id", "name", "folder_id", "folder_path"]).changeParams({ folder_id_depth: !0, limit: 100 }), pt = (e, a) => e.gen(`/add/${a}/groups/`), yt = { class: "top-groupSelector_groupItem" }, ht = {
569
568
  key: 0,
570
569
  class: "top-comment"
571
- }, Vt = {
570
+ }, It = {
572
571
  key: 1,
573
572
  class: "top-groupSelector_groupItemFolderPath"
574
- }, Gt = /* @__PURE__ */ L({
573
+ }, St = /* @__PURE__ */ R({
575
574
  __name: "groups",
576
575
  props: /* @__PURE__ */ V({
577
576
  groupId: {},
@@ -586,7 +585,8 @@ const Pt = /* @__PURE__ */ L({
586
585
  addChanger: { type: Boolean, default: !0 },
587
586
  showPath: { type: Boolean },
588
587
  addIcon: { type: Boolean, default: !0 },
589
- client: {}
588
+ client: {},
589
+ service: {}
590
590
  }, {
591
591
  groupId: { required: !0 },
592
592
  groupIdModifiers: {},
@@ -594,19 +594,19 @@ const Pt = /* @__PURE__ */ L({
594
594
  groupModifiers: {}
595
595
  }),
596
596
  emits: /* @__PURE__ */ V(["addGroup"], ["update:groupId", "update:group"]),
597
- setup(e, { emit: t }) {
598
- const o = e, a = t, r = b(e, "groupId"), l = b(e, "group"), n = o.client && !o.groups ? Ee(o.client) : void 0, s = o.client ? Mt(o.client) : void 0, g = _(null), c = _(void 0), S = ye("folder_id", "EQUALS", [o.folder?.id ?? 0]);
597
+ setup(e, { emit: a }) {
598
+ const o = e, t = a, r = T(e, "groupId"), l = T(e, "group"), n = o.client && !o.groups ? Ce(o.client, o.service) : void 0, u = o.client ? pt(o.client, o.service) : void 0, f = K(null), c = K(void 0), x = Se("folder_id", "EQUALS", [o.folder?.id ?? 0]);
599
599
  n?.changeParams({
600
600
  project_id: o.projectId,
601
601
  folder_id_depth: !0,
602
602
  filters: [
603
- S
603
+ x
604
604
  ]
605
- }), o.on !== void 0 && n?.params.filters?.push(ye("on", "EQUALS", [Number(o.on)]));
605
+ }), o.on !== void 0 && n?.params.filters?.push(Se("on", "EQUALS", [Number(o.on)]));
606
606
  const i = (d) => {
607
607
  l.value = d, r.value = d.id;
608
608
  };
609
- Se({
609
+ ge({
610
610
  projectId: () => o.projectId,
611
611
  folderId: () => o.folder?.id,
612
612
  canSelectAll: () => o.canSelectAll
@@ -615,13 +615,13 @@ const Pt = /* @__PURE__ */ L({
615
615
  project_id: o.projectId
616
616
  }), n?.setOptions({
617
617
  checkFingerprint: "TopGroupSelectorGroups:" + o.projectId
618
- })), d.folderId && (S.values = [
618
+ })), d.folderId && (x.values = [
619
619
  o.folder?.id ?? 0
620
- ], o.groups && (c.value = $t(o.groups, o.on, o.folder))), g.value?.resetCache(), (d.folderId?.old !== void 0 || d.canSelectAll?.old !== void 0) && r.value !== me) {
621
- let f;
622
- o.autoselect === "first" && (f = c.value?.[0], o.canSelectAll && (f = Ne(Z()))), (o.autoselect === "placeholder" || !f) && (f = Ye()), i(f);
620
+ ], o.groups && (c.value = vt(o.groups, o.on, o.folder))), f.value?.resetCache(), (d.folderId?.old !== void 0 || d.canSelectAll?.old !== void 0) && r.value !== ue) {
621
+ let s;
622
+ o.autoselect === "first" && (s = c.value?.[0], o.canSelectAll && (s = be(Y()))), (o.autoselect === "placeholder" || !s) && (s = Le()), i(s);
623
623
  }
624
- }, { immediate: !0 }), Se({
624
+ }, { immediate: !0 }), ge({
625
625
  modelGroup: l,
626
626
  modelGroupId: r
627
627
  }, async (d) => {
@@ -630,72 +630,72 @@ const Pt = /* @__PURE__ */ L({
630
630
  r.value = l.value.id;
631
631
  return;
632
632
  }
633
- if (!(o.canAdd && r.value === me)) {
633
+ if (!(o.canAdd && r.value === ue)) {
634
634
  if (o.groups) {
635
- let f = c.value?.find((u) => u.id === r.value);
636
- if (!f && o.canSelectAll && (f = Z()), f)
637
- i(f);
635
+ let s = c.value?.find((g) => g.id === r.value);
636
+ if (!s && o.canSelectAll && (s = Y()), s)
637
+ i(s);
638
638
  else {
639
- const u = c.value?.[0];
640
- u && !r.value ? i(u) : i(se);
639
+ const g = c.value?.[0];
640
+ g && !r.value ? i(g) : i(ne);
641
641
  }
642
642
  }
643
- if (o.client && !o.groups && (r.value || r.value === We && !o.canSelectAll)) {
644
- const f = Ee(o.client).changeParams({
643
+ if (o.client && !o.groups && (r.value || r.value === Ee && !o.canSelectAll)) {
644
+ const s = Ce(o.client, o.service).changeParams({
645
645
  project_id: o.projectId,
646
646
  id: r.value,
647
647
  filters: [
648
- S
648
+ x
649
649
  ]
650
650
  });
651
- f?.setOptions({
651
+ s?.setOptions({
652
652
  checkFingerprint: "TopGroupSelectorFindGroup:" + o.projectId
653
653
  });
654
- const u = await f.call();
655
- if (!u.errors?.length && !u.result) return;
656
- !u.errors && u.result[0] ? i(u.result[0]) : i(se);
654
+ const g = await s.call();
655
+ if (!g.errors?.length && !g.result) return;
656
+ !g.errors && g.result[0] ? i(g.result[0]) : i(ne);
657
657
  }
658
658
  }
659
659
  }
660
660
  }, { immediate: !0 });
661
- const v = async (d) => {
662
- if (o.canAdd !== "api" || !s) return;
663
- const f = l.value, u = await s.changeParams({
661
+ const m = async (d) => {
662
+ if (o.canAdd !== "api" || !u) return;
663
+ const s = l.value, g = await u.changeParams({
664
664
  project_id: o.projectId,
665
665
  names: [d.name],
666
- to_id: o.folder?.id ?? q.id,
666
+ to_id: o.folder?.id ?? j.id,
667
667
  to_type: "in_folder_last"
668
668
  }).call();
669
- u.result ? (i(u.result), a("addGroup", u.result)) : i(f), g.value?.resetCache(!0);
669
+ g.result ? (i(g.result), t("addGroup", g.result)) : i(s), f.value?.resetCache(!0);
670
670
  };
671
- return (d, f) => (p(), k(je, {
671
+ return (d, s) => (h(), C(Me, {
672
672
  ref_key: "refSelector",
673
- ref: g,
673
+ ref: f,
674
674
  class: "top-groupSelector_group",
675
675
  modelValue: l.value,
676
- "onUpdate:modelValue": f[0] || (f[0] = (u) => l.value = u),
676
+ "onUpdate:modelValue": s[0] || (s[0] = (g) => l.value = g),
677
677
  items: c.value ?? e.groups,
678
678
  searchType: "inline",
679
679
  icon: e.addIcon ? "" : void 0,
680
- api: e.groups ? void 0 : m(n),
681
- apiSetSearchParams: (...u) => m(Ae)(...u, "name"),
680
+ api: e.groups ? void 0 : v(n),
681
+ apiSetSearchParams: (...g) => v($e)(...g, "name"),
682
682
  appendSearchToResult: !!e.canAdd,
683
- useAllItem: e.canSelectAll ? m(Z)().name : !1,
683
+ useAllItem: e.canSelectAll ? v(Y)().name : !1,
684
684
  addChanger: e.addChanger,
685
685
  useCache: "",
686
- onAppendItem: v
686
+ onAppendItem: m
687
687
  }, {
688
- item: j(({ item: u }) => [
689
- R("div", _t, [
690
- u.id === m(me) ? (p(), T("div", Et, B(d.$i18n.Common.Add) + ": ", 1)) : E("", !0),
691
- R("span", null, B(u.name), 1),
692
- u.folder_path && e.showPath ? (p(), T("span", Vt, B(u.folder_path), 1)) : E("", !0)
688
+ item: B(({ item: g }) => [
689
+ oe("div", yt, [
690
+ g.id === v(ue) ? (h(), A("div", ht, b(d.$i18n.Common.Add) + ": ", 1)) : O("", !0),
691
+ oe("span", null, b(g.name), 1),
692
+ g.folder_path && e.showPath ? (h(), A("span", It, b(g.folder_path), 1)) : O("", !0)
693
693
  ])
694
694
  ]),
695
695
  _: 1
696
696
  }, 8, ["modelValue", "items", "icon", "api", "apiSetSearchParams", "appendSearchToResult", "useAllItem", "addChanger"]));
697
697
  }
698
- }), Lt = { class: "top-groupSelector" }, To = /* @__PURE__ */ L({
698
+ }), xt = { class: "top-groupSelector" }, qt = /* @__PURE__ */ R({
699
699
  __name: "groupSelector",
700
700
  props: /* @__PURE__ */ V({
701
701
  folderId: {},
@@ -713,7 +713,8 @@ const Pt = /* @__PURE__ */ L({
713
713
  showFolders: { type: Boolean, default: !0 },
714
714
  showGroups: { type: Boolean, default: !0 },
715
715
  addIcon: { type: Boolean, default: !0 },
716
- client: {}
716
+ client: {},
717
+ service: { default: "keywords_2" }
717
718
  }, {
718
719
  folderId: { required: !0 },
719
720
  folderIdModifiers: {},
@@ -721,39 +722,40 @@ const Pt = /* @__PURE__ */ L({
721
722
  folderModifiers: {},
722
723
  groupId: { required: !0 },
723
724
  groupIdModifiers: {},
724
- group: { default: se },
725
+ group: { default: ne },
725
726
  groupModifiers: {}
726
727
  }),
727
728
  emits: /* @__PURE__ */ V(["update:groups"], ["update:folderId", "update:folder", "update:groupId", "update:group"]),
728
- setup(e, { emit: t }) {
729
- const o = e, a = b(e, "folderId"), r = b(e, "folder"), l = b(e, "groupId"), n = b(e, "group"), s = t, g = Be(o.folders ?? { root: [q] }, o.canSelectAllGroups);
730
- r.value = g.get(a.value);
729
+ setup(e, { emit: a }) {
730
+ const o = e, t = T(e, "folderId"), r = T(e, "folder"), l = T(e, "groupId"), n = T(e, "group"), u = a, f = pe(o.folders ?? { root: [j] }, o.canSelectAllGroups);
731
+ r.value = f.get(t.value);
731
732
  let c = o.groups?.find((i) => i.id === l.value);
732
- l.value || (c = o.groups?.[0]), o.canSelectAllGroups && !c && (c = Z()), o.canSelectAllGroups && !c && (c = Z()), (o.autoselect === "placeholder" || !c) && (c = Ye()), c ??= se, n.value = c;
733
- const S = (i) => {
734
- let v;
735
- o.groups && i && (v = [...o.groups, i]), s("update:groups", v);
733
+ l.value || (c = o.groups?.[0]), o.canSelectAllGroups && !c && (c = Y()), o.canSelectAllGroups && !c && (c = Y()), (o.autoselect === "placeholder" || !c) && (c = Le()), c ??= ne, n.value = c;
734
+ const x = (i) => {
735
+ let m;
736
+ o.groups && i && (m = [...o.groups, i]), u("update:groups", m);
736
737
  };
737
- return (i, v) => (p(), T("div", Lt, [
738
- e.showFolders ? (p(), k(Pt, {
738
+ return (i, m) => (h(), A("div", xt, [
739
+ e.showFolders ? (h(), C(mt, {
739
740
  key: 0,
740
- folderId: a.value,
741
- "onUpdate:folderId": v[0] || (v[0] = (d) => a.value = d),
741
+ folderId: t.value,
742
+ "onUpdate:folderId": m[0] || (m[0] = (d) => t.value = d),
742
743
  folder: r.value,
743
- "onUpdate:folder": v[1] || (v[1] = (d) => r.value = d),
744
+ "onUpdate:folder": m[1] || (m[1] = (d) => r.value = d),
744
745
  projectId: e.projectId,
745
746
  folders: e.folders,
746
747
  canSelectAll: e.canSelectAllGroups,
747
748
  addChanger: e.addChanger,
748
749
  addIcon: e.addIcon,
749
- client: e.client
750
- }, null, 8, ["folderId", "folder", "projectId", "folders", "canSelectAll", "addChanger", "addIcon", "client"])) : E("", !0),
751
- e.showGroups ? (p(), k(Gt, {
750
+ client: e.client,
751
+ service: e.service
752
+ }, null, 8, ["folderId", "folder", "projectId", "folders", "canSelectAll", "addChanger", "addIcon", "client", "service"])) : O("", !0),
753
+ e.showGroups ? (h(), C(St, {
752
754
  key: 1,
753
755
  groupId: l.value,
754
- "onUpdate:groupId": v[2] || (v[2] = (d) => l.value = d),
756
+ "onUpdate:groupId": m[2] || (m[2] = (d) => l.value = d),
755
757
  group: n.value,
756
- "onUpdate:group": v[3] || (v[3] = (d) => n.value = d),
758
+ "onUpdate:group": m[3] || (m[3] = (d) => n.value = d),
757
759
  projectId: e.projectId,
758
760
  folder: r.value,
759
761
  groups: e.groups,
@@ -765,395 +767,66 @@ const Pt = /* @__PURE__ */ L({
765
767
  showPath: e.showFolders && !!e.folders?.[0],
766
768
  addIcon: e.addIcon,
767
769
  client: e.client,
768
- onAddGroup: S
769
- }, null, 8, ["groupId", "group", "projectId", "folder", "groups", "on", "canAdd", "canSelectAll", "autoselect", "addChanger", "showPath", "addIcon", "client"])) : E("", !0)
770
+ service: e.service,
771
+ onAddGroup: x
772
+ }, null, 8, ["groupId", "group", "projectId", "folder", "groups", "on", "canAdd", "canSelectAll", "autoselect", "addChanger", "showPath", "addIcon", "client", "service"])) : O("", !0)
770
773
  ]));
771
774
  }
772
- }), Kt = { class: "top-projectSelectorSubmenu_item" }, Ot = ["href", "title", "data-top-icon", "data-right"], Rt = { class: "top-projectSelectorSubmenu_item" }, Ut = ["href"], Nt = /* @__PURE__ */ L({
773
- __name: "submenu",
774
- props: {
775
- id: {},
776
- right: {},
777
- url: {}
778
- },
779
- setup(e) {
780
- const t = e, o = A();
781
- let a = [
782
- {
783
- href: `/project/keywords/${t.id}/`,
784
- title: o.Common.Menu_phrases,
785
- icon: "",
786
- right: "2"
787
- },
788
- {
789
- href: `/project/dynamics/${t.id}/`,
790
- title: o.Common.Menu_dynamics,
791
- icon: "",
792
- right: "1"
793
- },
794
- {
795
- href: `/project/snapshots/${t.id}/`,
796
- title: o.Common.Menu_snapshots,
797
- icon: "",
798
- right: "1"
799
- },
800
- {
801
- href: `/project/competitors/${t.id}/`,
802
- title: o.Common.Menu_competitors,
803
- icon: "",
804
- right: "1"
805
- },
806
- {
807
- href: `/project/analytics/${t.id}/`,
808
- title: o.Common.Menu_analytics,
809
- icon: "",
810
- right: "5"
811
- },
812
- {
813
- href: `/project/broker/${t.id}/`,
814
- title: o.Common.Menu_broker,
815
- icon: "",
816
- right: "6"
817
- },
818
- {
819
- href: `/project/audit/${t.id}/sitemap/`,
820
- title: o.Audit.Sitemap_gen,
821
- icon: "",
822
- right: "8"
823
- },
824
- {
825
- href: `/project/audit/${t.id}/audit/`,
826
- title: o.Common.Menu_audit,
827
- icon: "",
828
- right: "8"
829
- },
830
- {
831
- href: `//project/audit/${t.id}/indexing/`,
832
- title: o.Audit.Indexing,
833
- icon: "",
834
- right: "8"
835
- },
836
- {
837
- href: `/project/audit/${t.id}/watcher/`,
838
- title: o.Audit.Watcher,
839
- icon: "",
840
- right: "9"
841
- },
842
- {
843
- href: `/project/settings/${t.id}/`,
844
- title: o.Common.Menu_settings,
845
- icon: "",
846
- right: "2"
847
- }
848
- ];
849
- const r = M(() => t.right.includes("0") ? a.filter((l) => t.right[l.right] === "1") : a);
850
- return (l, n) => {
851
- const s = De("TopButton");
852
- return p(), k(m(ke), {
853
- class: "top-projectSelectorSubmenu",
854
- notch: !1,
855
- pos: "2"
856
- }, {
857
- opener: j(() => [
858
- O(s, {
859
- class: "top-projectSelectorSubmenu_opener",
860
- "data-top-icon": "",
861
- color: "theme"
862
- })
863
- ]),
864
- contentList: j(() => [
865
- (p(!0), T(F, null, fe(r.value, (g) => (p(), T("li", Kt, [
866
- R("a", {
867
- href: g.href,
868
- title: g.title,
869
- "data-top-icon": g.icon,
870
- "data-right": g.right
871
- }, null, 8, Ot)
872
- ]))), 256)),
873
- R("li", Rt, [
874
- R("a", {
875
- href: e.url,
876
- "data-top-icon": "",
877
- target: "_blank"
878
- }, null, 8, Ut)
879
- ])
880
- ]),
881
- _: 1
882
- });
883
- };
884
- }
885
- }), pe = (e) => ({
886
- id: null,
887
- name: e,
888
- listItemProps: {
889
- type: "title"
890
- }
891
- }), Ie = {
892
- scheduledUpdate: !1,
893
- manualUpdate: !1,
894
- guestProjects: !1
895
- }, Dt = (e, t) => {
896
- const o = [], a = {
897
- scheduledUpdate: pe(A().Projects.Scheduled_update),
898
- manualUpdate: pe(A().Projects.Manual_update),
899
- guestProjects: pe(A().Projects.Guest_projects)
900
- }, r = t ? {
901
- scheduledUpdate: !1,
902
- manualUpdate: !1,
903
- guestProjects: !1
904
- } : Ie;
905
- for (const l of e)
906
- !r.scheduledUpdate && l.right?.startsWith("1") && l.on > 0 && (o.push(a.scheduledUpdate), r.scheduledUpdate = !0), !r.manualUpdate && l.right?.startsWith("1") && l.on === 0 && (o.push(a.manualUpdate), r.manualUpdate = !0), !r.guestProjects && l.right?.startsWith("0") && l.on >= 0 && (o.push(a.guestProjects), r.guestProjects = !0), o.push(l);
907
- return o;
908
- }, qt = (e, t, o, a) => !e || e.length === 0 ? [] : (t && (e = e.filter((r) => r.id !== t)), o && Object.keys(Ie).forEach((r) => Ie[r] = !1), Dt(e, a)), Ft = (e) => {
909
- if (!e) return "";
910
- let t = e;
911
- return t = t.replace(/historyView=[^&]*/, ""), t = t.replace(/competitorsIds=[^&]*/, ""), t = t.replace(/searchersKeys=[^&]*/, ""), t = t.replace(/regionIndex=[^&]*/, ""), t = t.replace(/regionsIndexes=[^&]*/, ""), t = t.replace(/folderId=[^&]*/, ""), t = t.replace(/groupId=[^&]*/, ""), t = t.replace(/tags=[^&]*/, ""), window.mo?.getHash && !window.mo.getHash("dataSort").toString().includes("0000-00-00") && (t = t.replace(/dataSort=[^&]*/, "")), t = t.replace(/%22historyView%22:[^,]*,/, ""), t = t.replace(/%22competitorsIds%22:\[[^\]]*\],/, ""), t = t.replace(/%22searchersKeys%22:\[[^\]]*\],/, ""), t = t.replace(/%22regionIndex%22:[^,]*,/, ""), t = t.replace(/%22regionsIndexes%22:\[[^\]]*\],/, ""), t = t.replace(/%22folderId%22:[^,]*,/, ""), t = t.replace(/%22groupId%22:[^,]*,/, ""), t = t.replace(/%22tagsIds%22:\[[^\]]*\],/, ""), /%22dataSort%22:\{[^\}]*0000-00-00[^\}]*\}/.test(t) || (t = t.replace(/%22dataSort%22:\{[^\}]*\},/, "")), t;
912
- }, Qe = (e) => {
913
- const t = location.pathname.split("/");
914
- let o = "project/dynamics/", a = "";
915
- t[1] == "project" && (o = t[1] + "/" + t[2] + "/"), ["watcher", "indexing", "sitemap", "audit", "direct", "adwords"].includes(t[4]) && (a = t[4] + "/");
916
- let r = "/" + o + e + "/" + a;
917
- const l = Ft(location.hash);
918
- return r += l, r;
919
- }, Wt = (e, t) => {
920
- if (e)
921
- return e.map((o) => o.id ? {
922
- ...o,
923
- listItemProps: {
924
- class: "top-projectSelector_item",
925
- href: t ? Qe(Number(o.id)) : void 0,
926
- title: o.name
927
- }
928
- } : o);
929
- }, Ve = (e) => {
930
- let t = e.startsWith("http") ? e : "http://" + e;
931
- return t = t.replace(/"/g, "%22"), t;
932
- }, Ge = (e, t, o, a) => {
933
- const r = e.gen("/get/projects_2/projects/", ["id", "user_id", "name", "url", "on", "right"]);
934
- return r.params = {
935
- ...a,
936
- filters: [
937
- ye("on", "GREATER_THAN_EQUALS", [0])
938
- ],
939
- orders: [
940
- le("user_id", "DESC", [t]),
941
- le("on", "DESC"),
942
- le("favorite", "DESC"),
943
- le("id", "DESC")
944
- ]
945
- }, r.options.onApiLoaded = (l, n, s) => {
946
- const g = n.data.filters.length === 1 && n.data.offset === 0 || n.data.limit === 1e3, c = n.data.limit === 100 && n.data.filters.length > 1 ? !0 : void 0;
947
- l.result = qt(l.result, o, g, c), s?.(l, n);
948
- }, r;
949
- }, Jt = (e) => e.gen("/add/projects_2/projects/"), xe = "ui_project_selector_total:", Ht = 1440 * 60 * 1e3, N = qe(), Xe = _(0), ne = _(null), Le = (e, t) => {
950
- localStorage.setItem(
951
- xe + e,
952
- JSON.stringify({ projectsTotal: t, expiresAt: Date.now() + Ht })
953
- );
954
- }, zt = (e) => {
955
- const t = localStorage.getItem(xe + e);
956
- if (!t) return;
957
- const { projectsTotal: o, expiresAt: a } = JSON.parse(t);
958
- if (Date.now() > a) {
959
- localStorage.removeItem(xe + e);
960
- return;
961
- }
962
- return o;
963
- }, Yt = (e = !0) => {
964
- N.value = void 0, e && Xe.value++;
965
- }, Qt = { class: "top-projectSelector_itemText" }, Xt = { class: "top-projectSelector_itemName" }, Zt = { class: "top-projectSelector_itemId" }, eo = { key: 1 }, to = {
966
- key: 0,
967
- class: "top-comment"
968
- }, Ke = 1e3, jo = /* @__PURE__ */ L({
969
- __name: "projectSelector",
970
- props: /* @__PURE__ */ V({
971
- userId: { default: window.mo?.user?.id },
972
- client: {},
973
- project: {},
974
- addLinksToProjects: { type: Boolean, default: !0 },
975
- excludeProjectId: {},
976
- modificator: { default: "projectSelector" },
977
- placeholder: {},
978
- buttonProps: {},
979
- openerShortcut: {}
980
- }, {
981
- project: { required: !1 },
982
- projectModifiers: {}
983
- }),
984
- emits: ["update:project"],
985
- setup(e) {
986
- const t = A(), o = e, a = b(e, "project"), r = Ge(
987
- o.client,
988
- o.userId,
989
- o.excludeProjectId
990
- ), l = Jt(o.client), n = _(zt(o.userId)), s = _(null), g = M(() => o.placeholder ?? t.Projects.Select_project), c = M(() => {
991
- if (!(!n.value && n.value !== 0))
992
- return n.value < Ke ? "static" : "api";
993
- });
994
- G(Xe, () => {
995
- d();
996
- });
997
- const S = async () => {
998
- if (!ne.value) {
999
- const w = Ge(
1000
- o.client,
1001
- o.userId,
1002
- o.excludeProjectId,
1003
- { limit: Ke }
1004
- );
1005
- ne.value = w.call();
1006
- }
1007
- const u = await ne.value;
1008
- if (!u.errors)
1009
- return ne.value = null, u;
1010
- }, i = async () => {
1011
- if (n.value) return;
1012
- const u = await S();
1013
- u && (n.value = u.total, c.value === "static" && !N.value && (N.value = u.result), n.value && Le(o.userId, n.value));
1014
- }, v = async (u) => {
1015
- const w = await l.changeParams({
1016
- url: u.name,
1017
- name: u.name
1018
- }).call();
1019
- if (!w.errors) {
1020
- if (N.value && c.value === "static") {
1021
- const U = {
1022
- id: Number(w.result),
1023
- user_id: o.userId,
1024
- name: u.name,
1025
- url: u.name,
1026
- on: 0,
1027
- right: "11111111111111111111",
1028
- listItemProps: {
1029
- class: "top-projectSelector_item",
1030
- href: o.addLinksToProjects ? Qe(Number(w.result)) : void 0,
1031
- title: u.name
1032
- }
1033
- };
1034
- N.value = [U, ...N.value], n.value && Le(o.userId, n.value + 1);
1035
- }
1036
- c.value === "api" && Yt(o.userId);
1037
- }
1038
- }, d = () => {
1039
- c.value === "api" && s.value?.resetCache(!0);
1040
- }, f = async () => {
1041
- if (N.value || c.value !== "static") return;
1042
- const u = await S();
1043
- u && (N.value = u.result);
1044
- };
1045
- return Ze(async () => {
1046
- await i();
1047
- }), (u, w) => {
1048
- const U = De("TopButton");
1049
- return c.value ? (p(), k(je, {
1050
- key: 0,
1051
- ref_key: "refSelector",
1052
- ref: s,
1053
- class: "top-projectSelector",
1054
- modelValue: a.value,
1055
- "onUpdate:modelValue": w[1] || (w[1] = (P) => a.value = P),
1056
- items: m(Wt)(m(N), e.addLinksToProjects),
1057
- title: u.$i18n.Projects.Search_projects,
1058
- modificator: e.modificator,
1059
- placeholder: g.value,
1060
- hasCloserBtn: "",
1061
- api: c.value === "api" ? m(r) : void 0,
1062
- apiSetSearchParams: c.value === "api" ? (...P) => m(Ae)(...P, "name") : void 0,
1063
- useCache: "",
1064
- appendSearchToResult: "",
1065
- appendSearchToResultCond: m($e),
1066
- appendWithoutSelect: "",
1067
- buttonProps: e.buttonProps,
1068
- openerShortcut: e.openerShortcut,
1069
- onAppendItem: v,
1070
- onOpen: f
1071
- }, {
1072
- item: j(({ item: P }) => [
1073
- P.id ? (p(), T(F, { key: 0 }, [
1074
- R("div", Qt, [
1075
- R("span", Xt, B(m(gt)(P.name, 20)), 1),
1076
- R("span", Zt, " id " + B(P.id), 1)
1077
- ]),
1078
- u.$core.state.isMobile ? E("", !0) : (p(), k(U, {
1079
- key: 0,
1080
- class: "top-projectSelector_itemLink",
1081
- href: m(Ve)(P.url),
1082
- "data-top-icon": "",
1083
- color: "theme",
1084
- target: "_blank",
1085
- onClick: w[0] || (w[0] = W(() => {
1086
- }, ["stop"]))
1087
- }, null, 8, ["href"])),
1088
- O(Nt, {
1089
- id: P.id,
1090
- right: P.right ?? void 0,
1091
- url: m(Ve)(P.url)
1092
- }, null, 8, ["id", "right", "url"])
1093
- ], 64)) : (p(), T("div", eo, [
1094
- m($e)(P.name) ? (p(), T("div", to, B(u.$i18n.Projects.Add_project) + ": ", 1)) : E("", !0),
1095
- J(" " + B(P.name), 1)
1096
- ]))
1097
- ]),
1098
- _: 1
1099
- }, 8, ["modelValue", "items", "title", "modificator", "placeholder", "api", "apiSetSearchParams", "appendSearchToResultCond", "buttonProps", "openerShortcut"])) : E("", !0);
1100
- };
1101
- }
1102
- }), Oe = (e) => "-" + e, te = (e) => e[0] === "-" ? e.substring(1) : e, ce = (e, t) => {
1103
- e = te(e);
1104
- const o = t.find((a) => a.id === e);
775
+ }), Be = (e) => "-" + e, X = (e) => e[0] === "-" ? e.substring(1) : e, ie = (e, a) => {
776
+ e = X(e);
777
+ const o = a.find((t) => t.id === e);
1105
778
  if (o)
1106
779
  return o;
1107
- }, Ao = (e, t, o) => {
1108
- t || (t = { id: e.id }), t.id = e.id, t.pos ??= "3", t.notch ??= !0, t.posBy ??= "fixed";
1109
- const a = mt.genElPopupOpener("div", t);
1110
- return a.classList.add("top-tagSelector"), e.useTopButton && a.classList.add("top-tagSelector-useTopButton", "top-button", "top-color_theme", "top-as-selector"), e.useTopButton || a.classList.add("top-tagSelector-custom"), e.mode === "filter" && a.classList.add("top-tagSelector-filter"), e.mode === "setter" && !e.filters && a.classList.add("top-tagSelector-setter_single"), e.mode === "setter" && e.filters && a.classList.add("top-tagSelector-setter_several"), a.onclick = (r) => {
1111
- r.preventDefault(), r.stopPropagation(), a.onclick = null;
1112
- const l = _(e.modelValue), n = {
780
+ }, Dt = (e, a, o) => {
781
+ a || (a = { id: e.id }), a.id = e.id, a.pos ??= "3", a.notch ??= !0, a.posBy ??= "fixed";
782
+ const t = Ze.genElPopupOpener("div", a);
783
+ return t.classList.add("top-tagSelector"), e.useTopButton && t.classList.add("top-tagSelector-useTopButton", "top-button", "top-color_theme", "top-as-selector"), e.useTopButton || t.classList.add("top-tagSelector-custom"), e.mode === "filter" && t.classList.add("top-tagSelector-filter"), e.mode === "setter" && !e.filters && t.classList.add("top-tagSelector-setter_single"), e.mode === "setter" && e.filters && t.classList.add("top-tagSelector-setter_several"), t.onclick = (r) => {
784
+ r.preventDefault(), r.stopPropagation(), t.onclick = null;
785
+ const l = K(e.modelValue), n = {
1113
786
  model: l,
1114
787
  mode: e.mode,
1115
788
  targetId: e.targetId,
1116
789
  filters: e.filters,
1117
790
  payload: e.payload
1118
791
  };
1119
- X(a, "topTagSelectorTarget", n), delete a.dataset.topPopupDisabled, we(e.modelValue) || G(l, () => {
1120
- e.modelValue = l.value, re(a, e, o);
1121
- }), a.click();
1122
- }, we(e.modelValue) ? G(e.modelValue, () => re(a, e, o)) : X(a, "topTagSelectorRender", (r) => {
792
+ W(t, "topTagSelectorTarget", n), delete t.dataset.topPopupDisabled, he(e.modelValue) || E(l, () => {
793
+ e.modelValue = l.value, te(t, e, o);
794
+ }), t.click();
795
+ }, he(e.modelValue) ? E(e.modelValue, () => te(t, e, o)) : W(t, "topTagSelectorRender", (r) => {
1123
796
  e.modelValue = r;
1124
- const l = X(a, "topTagSelectorTarget");
1125
- l && (l.model.value = r), re(a, e, o);
1126
- }), re(a, e, o), a;
1127
- }, Bo = (e, t) => {
1128
- X(e, "topTagSelectorRender")?.(t);
1129
- }, re = (e, t, o) => {
1130
- const a = m(t.modelValue);
1131
- if (e.classList.toggle("top-tagSelector-selectedOne", !a.length || a.length === 1), e.classList.toggle("top-tagSelector-toTwoLine", a.length > 5), t.mode === "setter" && t.filters) {
797
+ const l = W(t, "topTagSelectorTarget");
798
+ l && (l.model.value = r), te(t, e, o);
799
+ }), te(t, e, o), t;
800
+ }, Ft = (e, a) => {
801
+ W(e, "topTagSelectorRender")?.(a);
802
+ }, te = (e, a, o) => {
803
+ const t = v(a.modelValue);
804
+ if (e.classList.toggle("top-tagSelector-selectedOne", !t.length || t.length === 1), e.classList.toggle("top-tagSelector-toTwoLine", t.length > 5), a.mode === "setter" && a.filters) {
1132
805
  e.innerHTML = `<div>${o}</div>`;
1133
806
  return;
1134
807
  }
1135
- if (e.innerHTML = "", !a.length && t.mode === "filter") {
1136
- const r = Re({
808
+ if (e.innerHTML = "", !t.length && a.mode === "filter") {
809
+ const r = Te({
1137
810
  id: "all",
1138
811
  colorId: "",
1139
- name: A().Common?.All_tags ?? "",
812
+ name: w().Common?.All_tags ?? "",
1140
813
  state: ""
1141
814
  });
1142
815
  e.append(r);
1143
816
  }
1144
- a.forEach((r) => {
1145
- const l = Re({
1146
- id: te(r),
1147
- colorId: ce(r, t.tags)?.color_id ?? "",
1148
- name: ce(r, t.tags)?.name ?? "",
1149
- state: te(r) === r ? "selected" : "excluded"
817
+ t.forEach((r) => {
818
+ const l = Te({
819
+ id: X(r),
820
+ colorId: ie(r, a.tags)?.color_id ?? "",
821
+ name: ie(r, a.tags)?.name ?? "",
822
+ state: X(r) === r ? "selected" : "excluded"
1150
823
  });
1151
824
  e.append(l);
1152
825
  });
1153
- }, Re = (e) => {
1154
- const t = document.createElement("div");
1155
- return t.classList.add("top-tagSelector_tagIcon"), t.classList.toggle("top-tagSelector-active", !!e.state), t.classList.toggle("top-tagSelector-excluded", e.state === "excluded"), t.dataset.tag_id = e.id, t.dataset.tag_color_id = e.colorId, t.title = e.name, t;
1156
- }, oo = [
826
+ }, Te = (e) => {
827
+ const a = document.createElement("div");
828
+ return a.classList.add("top-tagSelector_tagIcon"), a.classList.toggle("top-tagSelector-active", !!e.state), a.classList.toggle("top-tagSelector-excluded", e.state === "excluded"), a.dataset.tag_id = e.id, a.dataset.tag_color_id = e.colorId, a.title = e.name, a;
829
+ }, kt = [
1157
830
  {
1158
831
  id: "1",
1159
832
  name: "Without Tag",
@@ -1204,7 +877,7 @@ const Pt = /* @__PURE__ */ L({
1204
877
  name: "Turquoise",
1205
878
  color_id: "10"
1206
879
  }
1207
- ], ao = ["data-tag_id", "data-tag_color_id", "title"], Ce = /* @__PURE__ */ L({
880
+ ], Ct = ["data-tag_id", "data-tag_color_id", "title"], fe = /* @__PURE__ */ R({
1208
881
  __name: "tagIcon",
1209
882
  props: {
1210
883
  id: {},
@@ -1213,8 +886,8 @@ const Pt = /* @__PURE__ */ L({
1213
886
  state: {}
1214
887
  },
1215
888
  setup(e) {
1216
- return (t, o) => (p(), T("div", {
1217
- class: oe({
889
+ return (a, o) => (h(), A("div", {
890
+ class: Z({
1218
891
  "top-tagSelector_tagIcon": !0,
1219
892
  "top-tagSelector-active": !!e.state,
1220
893
  "top-tagSelector-excluded": e.state === "excluded"
@@ -1222,9 +895,9 @@ const Pt = /* @__PURE__ */ L({
1222
895
  "data-tag_id": e.id,
1223
896
  "data-tag_color_id": e.colorId,
1224
897
  title: e.name
1225
- }, null, 10, ao));
898
+ }, null, 10, Ct));
1226
899
  }
1227
- }), lo = ["contenteditable", "onKeydown"], Ue = /* @__PURE__ */ L({
900
+ }), Bt = ["contenteditable", "onKeydown"], Ae = /* @__PURE__ */ R({
1228
901
  __name: "tagPopupListItem",
1229
902
  props: /* @__PURE__ */ V({
1230
903
  editable: { type: Boolean },
@@ -1241,70 +914,70 @@ const Pt = /* @__PURE__ */ L({
1241
914
  nameModifiers: {}
1242
915
  }),
1243
916
  emits: /* @__PURE__ */ V(["update:name", "unselect", "exclude", "select"], ["update:name"]),
1244
- setup(e, { emit: t }) {
1245
- const o = e, a = t, r = b(e, "name"), l = _(null), n = M(() => navigator.userAgent.indexOf("Firefox") != -1 ? {
1246
- contenteditable: s.value,
1247
- onpaste: (v) => v.preventDefault()
1248
- } : {}), s = _(!1), g = async () => {
1249
- s.value = !0, await et(), l.value?.focus();
917
+ setup(e, { emit: a }) {
918
+ const o = e, t = a, r = T(e, "name"), l = K(null), n = M(() => navigator.userAgent.indexOf("Firefox") != -1 ? {
919
+ contenteditable: u.value,
920
+ onpaste: (m) => m.preventDefault()
921
+ } : {}), u = K(!1), f = async () => {
922
+ u.value = !0, await Re(), l.value?.focus();
1250
923
  }, c = () => {
1251
- const v = l.value?.innerText;
1252
- if (!v) return S();
1253
- l.value && (l.value.innerText = v), s.value = !1, a("update:name", v);
1254
- }, S = async () => {
1255
- l.value && (l.value.innerText = o.name), s.value = !1;
1256
- }, i = (v) => {
1257
- if (s.value || o.disabled) return;
924
+ const m = l.value?.innerText;
925
+ if (!m) return x();
926
+ l.value && (l.value.innerText = m), u.value = !1, t("update:name", m);
927
+ }, x = async () => {
928
+ l.value && (l.value.innerText = o.name), u.value = !1;
929
+ }, i = (m) => {
930
+ if (u.value || o.disabled) return;
1258
931
  let d = "selected";
1259
- o.canExclude && (v.ctrlKey || v.metaKey) && (d = "excluded"), o.state == d && (d = ""), d === "" && a("unselect"), d === "selected" && a("select"), d === "excluded" && a("exclude");
932
+ o.canExclude && (m.ctrlKey || m.metaKey) && (d = "excluded"), o.state == d && (d = ""), d === "" && t("unselect"), d === "selected" && t("select"), d === "excluded" && t("exclude");
1260
933
  };
1261
- return (v, d) => (p(), k(Te, {
1262
- class: oe({
934
+ return (m, d) => (h(), C(ve, {
935
+ class: Z({
1263
936
  "top-tagSelector_tagListItem": !0,
1264
- "top-tagSelector_tagListItem-inEdit": s.value,
937
+ "top-tagSelector_tagListItem-inEdit": u.value,
1265
938
  "top-tagSelector_tagListItem-disabled": e.disabled,
1266
939
  "top-tagSelector_tagListItem-canExclude": e.canExclude,
1267
940
  "top-tagSelector-active": !!e.state,
1268
941
  "top-tagSelector-excluded": e.state === "excluded"
1269
942
  }),
1270
- onClick: W(i, ["stop"])
943
+ onClick: U(i, ["stop"])
1271
944
  }, {
1272
- default: j(() => [
1273
- O(Ce, {
945
+ default: B(() => [
946
+ P(fe, {
1274
947
  id: e.id,
1275
948
  name: r.value,
1276
949
  colorId: e.colorId,
1277
950
  state: e.state
1278
951
  }, null, 8, ["id", "name", "colorId", "state"]),
1279
- R("span", Fe({
952
+ oe("span", Ve({
1280
953
  ref_key: "elName",
1281
954
  ref: l,
1282
955
  class: "top-tagSelector_tagListItemName",
1283
- contenteditable: s.value ? "plaintext-only" : !1
956
+ contenteditable: u.value ? "plaintext-only" : !1
1284
957
  }, n.value, {
1285
958
  onKeydown: [
1286
- Pe(W(c, ["stop"]), ["enter"]),
1287
- Pe(W(S, ["stop"]), ["esc"])
959
+ Ie(U(c, ["stop"]), ["enter"]),
960
+ Ie(U(x, ["stop"]), ["esc"])
1288
961
  ]
1289
- }), B(r.value), 17, lo),
1290
- e.editable ? (p(), T(F, { key: 0 }, [
1291
- s.value ? (p(), T("span", {
962
+ }), b(r.value), 17, Bt),
963
+ e.editable ? (h(), A(Q, { key: 0 }, [
964
+ u.value ? (h(), A("span", {
1292
965
  key: 1,
1293
966
  "data-top-icon": "",
1294
967
  class: "top-tagSelector_edit",
1295
- onClick: W(c, ["stop"])
1296
- })) : (p(), T("span", {
968
+ onClick: U(c, ["stop"])
969
+ })) : (h(), A("span", {
1297
970
  key: 0,
1298
971
  "data-top-icon": "",
1299
972
  class: "top-tagSelector_edit",
1300
- onClick: g
973
+ onClick: f
1301
974
  }))
1302
- ], 64)) : E("", !0)
975
+ ], 64)) : O("", !0)
1303
976
  ]),
1304
977
  _: 1
1305
978
  }, 8, ["class"]));
1306
979
  }
1307
- }), no = { key: 1 }, ro = /* @__PURE__ */ L({
980
+ }), Tt = { key: 1 }, At = /* @__PURE__ */ R({
1308
981
  inheritAttrs: !1,
1309
982
  __name: "popupOpener",
1310
983
  props: /* @__PURE__ */ V({
@@ -1325,59 +998,59 @@ const Pt = /* @__PURE__ */ L({
1325
998
  }),
1326
999
  emits: ["update:modelValue"],
1327
1000
  setup(e) {
1328
- const t = e, o = b(e, "modelValue"), a = t.useTopButton ? ee : "div", r = t.useTopButton ? "html" : "default", l = {
1001
+ const a = e, o = T(e, "modelValue"), t = a.useTopButton ? H : "div", r = a.useTopButton ? "html" : "default", l = {
1329
1002
  model: o,
1330
- mode: t.mode,
1331
- targetId: t.targetId,
1332
- filters: t.filters,
1333
- payload: t.payload
1003
+ mode: a.mode,
1004
+ targetId: a.targetId,
1005
+ filters: a.filters,
1006
+ payload: a.payload
1334
1007
  };
1335
- return (n, s) => {
1336
- const g = tt("top-data");
1337
- return p(), k(it, { id: e.id }, {
1338
- default: j(() => [
1339
- ot((p(), k(at(m(a)), Fe({
1008
+ return (n, u) => {
1009
+ const f = Pe("top-data");
1010
+ return h(), C(Je, { id: e.id }, {
1011
+ default: B(() => [
1012
+ Ne((h(), C(qe(v(t)), Ve({
1340
1013
  class: {
1341
1014
  "top-tagSelector": !0,
1342
- "top-tagSelector-useTopButton": t.useTopButton,
1343
- "top-tagSelector-custom": !t.useTopButton,
1344
- "top-as-selector": t.useTopButton,
1345
- "top-tagSelector-filter": t.mode === "filter",
1346
- "top-tagSelector-setter_single": t.mode === "setter" && !e.filters,
1347
- "top-tagSelector-setter_several": t.mode === "setter" && e.filters,
1015
+ "top-tagSelector-useTopButton": a.useTopButton,
1016
+ "top-tagSelector-custom": !a.useTopButton,
1017
+ "top-as-selector": a.useTopButton,
1018
+ "top-tagSelector-filter": a.mode === "filter",
1019
+ "top-tagSelector-setter_single": a.mode === "setter" && !e.filters,
1020
+ "top-tagSelector-setter_several": a.mode === "setter" && e.filters,
1348
1021
  "top-tagSelector-selectedOne": !o.value.length || o.value.length === 1,
1349
1022
  "top-tagSelector-toTwoLine": o.value.length > 5
1350
1023
  },
1351
1024
  color: "theme",
1352
1025
  styling: e.styling
1353
1026
  }, n.$attrs), {
1354
- [m(r)]: j(() => [
1355
- !o.value.length && e.mode === "filter" ? (p(), k(Ce, {
1027
+ [v(r)]: B(() => [
1028
+ !o.value.length && e.mode === "filter" ? (h(), C(fe, {
1356
1029
  key: 0,
1357
1030
  id: "all",
1358
1031
  colorId: "",
1359
1032
  name: n.$i18n.Common.All_tags ?? "",
1360
1033
  state: ""
1361
- }, null, 8, ["name"])) : E("", !0),
1362
- e.mode === "setter" && e.filters ? (p(), T("div", no, [
1363
- lt(n.$slots, "default")
1364
- ])) : (p(!0), T(F, { key: 2 }, fe(o.value, (c) => (p(), k(Ce, {
1365
- id: m(te)(c),
1366
- colorId: m(ce)(c, e.tags)?.color_id ?? "",
1367
- name: m(ce)(c, e.tags)?.name ?? "",
1368
- state: m(te)(c) === c ? "selected" : "excluded"
1034
+ }, null, 8, ["name"])) : O("", !0),
1035
+ e.mode === "setter" && e.filters ? (h(), A("div", Tt, [
1036
+ De(n.$slots, "default")
1037
+ ])) : (h(!0), A(Q, { key: 2 }, me(o.value, (c) => (h(), C(fe, {
1038
+ id: v(X)(c),
1039
+ colorId: v(ie)(c, e.tags)?.color_id ?? "",
1040
+ name: v(ie)(c, e.tags)?.name ?? "",
1041
+ state: v(X)(c) === c ? "selected" : "excluded"
1369
1042
  }, null, 8, ["id", "colorId", "name", "state"]))), 256))
1370
1043
  ]),
1371
1044
  _: 2
1372
1045
  }, 1040, ["class", "styling"])), [
1373
- [g, l, "topTagSelectorTarget"]
1046
+ [f, l, "topTagSelectorTarget"]
1374
1047
  ])
1375
1048
  ]),
1376
1049
  _: 3
1377
1050
  }, 8, ["id"]);
1378
1051
  };
1379
1052
  }
1380
- }), bo = /* @__PURE__ */ L({
1053
+ }), Ut = /* @__PURE__ */ R({
1381
1054
  __name: "tagSelector",
1382
1055
  props: /* @__PURE__ */ V({
1383
1056
  modelValue: {},
@@ -1397,177 +1070,177 @@ const Pt = /* @__PURE__ */ L({
1397
1070
  },
1398
1071
  modelModifiers: {},
1399
1072
  tags: {
1400
- default: Ne(oo)
1073
+ default: be(kt)
1401
1074
  },
1402
1075
  tagsModifiers: {}
1403
1076
  }),
1404
1077
  emits: /* @__PURE__ */ V(["selector", "setter", "tagsChanged"], ["update:modelValue", "update:tags"]),
1405
- setup(e, { emit: t }) {
1406
- const o = A(), a = e, r = b(e, "modelValue"), l = b(e, "tags"), n = t, s = rt((h, I) => {
1407
- n(h, I);
1408
- }, a.emitDelay);
1409
- a.singleMode && !r.value.length && (r.value = [l.value[0].id]);
1410
- const g = a.id ?? "top-popup-id-" + Math.random(), c = _("add"), S = () => {
1411
- const h = " " + o.Common.Tags?.toLowerCase(), I = /* @__PURE__ */ new Map();
1412
- return I.set("add", { value: "add", title: o.Common.Add + h }), I.set("replace", { value: "replace", title: o.Common.Replace + h }), I.set("delete", { value: "delete", title: o.Common.Delete + h }), I;
1078
+ setup(e, { emit: a }) {
1079
+ const o = w(), t = e, r = T(e, "modelValue"), l = T(e, "tags"), n = a, u = ze((p, I) => {
1080
+ n(p, I);
1081
+ }, t.emitDelay);
1082
+ t.singleMode && !r.value.length && (r.value = [l.value[0].id]);
1083
+ const f = t.id ?? "top-popup-id-" + Math.random(), c = K("add"), x = () => {
1084
+ const p = " " + o.Common.Tags?.toLowerCase(), I = /* @__PURE__ */ new Map();
1085
+ return I.set("add", { value: "add", title: o.Common.Add + p }), I.set("replace", { value: "replace", title: o.Common.Replace + p }), I.set("delete", { value: "delete", title: o.Common.Delete + p }), I;
1413
1086
  };
1414
- let i = qe({
1087
+ let i = Fe({
1415
1088
  model: r,
1416
1089
  mode: "filter",
1417
1090
  targetId: void 0,
1418
1091
  filters: void 0,
1419
1092
  payload: void 0
1420
1093
  });
1421
- G(r, () => {
1422
- s("selector", r.value);
1094
+ E(r, () => {
1095
+ u("selector", r.value);
1423
1096
  });
1424
- const v = M(() => {
1425
- if (i.value.mode === "setter" && a.maxTagsForSetter && !i.value.filters)
1426
- return i.value.model.value.length >= a.maxTagsForSetter;
1427
- }), d = (h) => {
1428
- if (h !== "all") {
1429
- if (i.value.model.value.includes(h)) return "selected";
1430
- if (i.value.model.value.includes(Oe(h))) return "excluded";
1097
+ const m = M(() => {
1098
+ if (i.value.mode === "setter" && t.maxTagsForSetter && !i.value.filters)
1099
+ return i.value.model.value.length >= t.maxTagsForSetter;
1100
+ }), d = (p) => {
1101
+ if (p !== "all") {
1102
+ if (i.value.model.value.includes(p)) return "selected";
1103
+ if (i.value.model.value.includes(Be(p))) return "excluded";
1431
1104
  }
1432
- return h === "all" && !i.value.model.value.length ? "selected" : "";
1433
- }, f = (h, I) => {
1434
- const x = Oe(h);
1435
- let C = i.value.model.value.filter((K) => K !== h && K !== x);
1436
- I === "select" && C.push(h), I === "exclude" && C.push(x), i.value.mode === "setter" && i.value.targetId !== void 0 && a.requiredForSetter && (C.length || C.push("1"), C.length === 2 && i.value.model.value.length === 1 && i.value.model.value[0] === "1" && (C = C.filter((K) => K !== "1"))), a.singleMode && !i.value.filters && (C.length || (C = i.value.model.value), C.length > 1 && (C = [C[C.length - 1]])), C.sort((K, ae) => {
1437
- if (!a.tags) return 0;
1438
- const H = a.tags.findIndex((Y) => Y.id === K), z = a.tags.findIndex((Y) => Y.id === ae);
1439
- return H - z;
1440
- }), i.value.model.value = C, i.value.mode === "setter" && i.value.targetId !== void 0 && s("setter", {
1441
- tagsIds: C,
1105
+ return p === "all" && !i.value.model.value.length ? "selected" : "";
1106
+ }, s = (p, I) => {
1107
+ const S = Be(p);
1108
+ let k = i.value.model.value.filter((G) => G !== p && G !== S);
1109
+ I === "select" && k.push(p), I === "exclude" && k.push(S), i.value.mode === "setter" && i.value.targetId !== void 0 && t.requiredForSetter && (k.length || k.push("1"), k.length === 2 && i.value.model.value.length === 1 && i.value.model.value[0] === "1" && (k = k.filter((G) => G !== "1"))), t.singleMode && !i.value.filters && (k.length || (k = i.value.model.value), k.length > 1 && (k = [k[k.length - 1]])), k.sort((G, ee) => {
1110
+ if (!t.tags) return 0;
1111
+ const q = t.tags.findIndex((F) => F.id === G), D = t.tags.findIndex((F) => F.id === ee);
1112
+ return q - D;
1113
+ }), i.value.model.value = k, i.value.mode === "setter" && i.value.targetId !== void 0 && u("setter", {
1114
+ tagsIds: k,
1442
1115
  targetId: i.value.targetId,
1443
1116
  payload: i.value.payload
1444
1117
  });
1445
- }, u = M(() => {
1446
- let h = "top-tagSelector_popup";
1447
- return i.value.mode === "filter" && (h += " top-tagSelector_popup-filter"), i.value.mode === "setter" && (h += " top-tagSelector_popup-setter"), h;
1448
- }), w = () => {
1449
- const h = prompt("", "New tag");
1450
- if (!h || h === "New tag") return;
1118
+ }, g = M(() => {
1119
+ let p = "top-tagSelector_popup";
1120
+ return i.value.mode === "filter" && (p += " top-tagSelector_popup-filter"), i.value.mode === "setter" && (p += " top-tagSelector_popup-setter"), p;
1121
+ }), _ = () => {
1122
+ const p = prompt("", "New tag");
1123
+ if (!p || p === "New tag") return;
1451
1124
  const I = l.value.length + 1;
1452
1125
  l.value.push({
1453
1126
  id: String(I),
1454
- name: h,
1127
+ name: p,
1455
1128
  color_id: String((I - 1) % 10 + 1)
1456
1129
  }), n("tagsChanged", l.value);
1457
- }, U = (h) => {
1458
- if (i.value = X(h.elPopupOpener, "topTagSelectorTarget"), !i.value) throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");
1459
- if (i.value.filters && (c.value = "add", i.value.model.value = []), !Q.$?.ui.sortable) {
1130
+ }, N = (p) => {
1131
+ if (i.value = W(p.elPopupOpener, "topTagSelectorTarget"), !i.value) throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");
1132
+ if (i.value.filters && (c.value = "add", i.value.model.value = []), !z.$?.ui.sortable) {
1460
1133
  console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");
1461
1134
  return;
1462
1135
  }
1463
- !Q.state.isMobile && !Q.state.isMobileUA && l.value && $(h.elPopup).sortable({
1136
+ !z.state.isMobile && !z.state.isMobileUA && l.value && $(p.elPopup).sortable({
1464
1137
  items: 'li:has([data-tag_id]:not([data-tag_id="all"]))',
1465
1138
  /**
1466
1139
  * @todo Удалить `[contenteditable="true"]` через пол года после выхода версии firefox с поддержкой contenteditable plaintext-only, включая бета версии
1467
1140
  */
1468
1141
  cancel: '[contenteditable="plaintext-only"], [contenteditable="true"]',
1469
1142
  distance: 10,
1470
- stop: function(I, x) {
1143
+ stop: function(I, S) {
1471
1144
  if (!l.value) return;
1472
- const C = $(x.item).parent().find("[data-tag_id]"), K = [];
1473
- C.each((ae, H) => {
1145
+ const k = $(S.item).parent().find("[data-tag_id]"), G = [];
1146
+ k.each((ee, q) => {
1474
1147
  if (!l.value) return;
1475
- const z = $(H).attr("data-tag_id");
1476
- K.push(z);
1477
- }), l.value.sort((ae, H) => {
1478
- const z = K.findIndex((ge) => ge === ae.id), Y = K.findIndex((ge) => ge === H.id);
1479
- return z - Y;
1480
- }), s("tagsChanged", l.value);
1148
+ const D = $(q).attr("data-tag_id");
1149
+ G.push(D);
1150
+ }), l.value.sort((ee, q) => {
1151
+ const D = G.findIndex((de) => de === ee.id), F = G.findIndex((de) => de === q.id);
1152
+ return D - F;
1153
+ }), u("tagsChanged", l.value);
1481
1154
  }
1482
1155
  });
1483
- }, P = (h) => {
1484
- Q.$?.ui.sortable && $(h.elPopup).data("ui-sortable") && $(h.elPopup).sortable("destroy");
1156
+ }, je = (p) => {
1157
+ z.$?.ui.sortable && $(p.elPopup).data("ui-sortable") && $(p.elPopup).sortable("destroy");
1485
1158
  };
1486
- return (h, I) => (p(), T(F, null, [
1487
- O(ro, {
1159
+ return (p, I) => (h(), A(Q, null, [
1160
+ P(At, {
1488
1161
  modelValue: r.value,
1489
- "onUpdate:modelValue": I[0] || (I[0] = (x) => r.value = x),
1490
- id: m(g),
1162
+ "onUpdate:modelValue": I[0] || (I[0] = (S) => r.value = S),
1163
+ id: v(f),
1491
1164
  tags: l.value,
1492
1165
  styling: e.styling,
1493
1166
  mode: "filter",
1494
1167
  useTopButton: e.useTopButton
1495
1168
  }, null, 8, ["modelValue", "id", "tags", "styling", "useTopButton"]),
1496
- O(ke, {
1497
- id: m(g),
1498
- class: oe(u.value),
1499
- onOpen: I[4] || (I[4] = (x) => U(x)),
1500
- onClose: I[5] || (I[5] = (x) => P(x)),
1169
+ P(we, {
1170
+ id: v(f),
1171
+ class: Z(g.value),
1172
+ onOpen: I[4] || (I[4] = (S) => N(S)),
1173
+ onClose: I[5] || (I[5] = (S) => je(S)),
1501
1174
  "transition-duration": 50
1502
- }, nt({
1503
- contentList: j(() => [
1504
- m(i).mode === "filter" && !e.singleMode ? (p(), k(Ue, {
1175
+ }, Ue({
1176
+ contentList: B(() => [
1177
+ v(i).mode === "filter" && !e.singleMode ? (h(), C(Ae, {
1505
1178
  key: 0,
1506
1179
  id: "all",
1507
1180
  colorId: "",
1508
- name: h.$i18n.Common.All_tags ?? "",
1509
- state: m(i).model.value.length ? "" : "selected",
1510
- onSelect: I[3] || (I[3] = (x) => m(i).model.value = [])
1511
- }, null, 8, ["name", "state"])) : E("", !0),
1512
- (p(!0), T(F, null, fe(l.value, (x) => (p(), k(Ue, {
1513
- key: x.id,
1514
- id: x.id,
1515
- colorId: x.color_id,
1516
- name: x.name,
1517
- state: d(x.id),
1518
- canExclude: m(i).mode === "filter" && !e.singleMode,
1181
+ name: p.$i18n.Common.All_tags ?? "",
1182
+ state: v(i).model.value.length ? "" : "selected",
1183
+ onSelect: I[3] || (I[3] = (S) => v(i).model.value = [])
1184
+ }, null, 8, ["name", "state"])) : O("", !0),
1185
+ (h(!0), A(Q, null, me(l.value, (S) => (h(), C(Ae, {
1186
+ key: S.id,
1187
+ id: S.id,
1188
+ colorId: S.color_id,
1189
+ name: S.name,
1190
+ state: d(S.id),
1191
+ canExclude: v(i).mode === "filter" && !e.singleMode,
1519
1192
  editable: e.tagsEditable,
1520
- disabled: v.value && d(x.id) === "",
1521
- onUnselect: (C) => f(x.id, "unselect"),
1522
- onSelect: (C) => f(x.id, "select"),
1523
- onExclude: (C) => f(x.id, "exclude"),
1524
- "onUpdate:name": (C) => {
1525
- x.name = C, m(s)("tagsChanged", l.value);
1193
+ disabled: m.value && d(S.id) === "",
1194
+ onUnselect: (k) => s(S.id, "unselect"),
1195
+ onSelect: (k) => s(S.id, "select"),
1196
+ onExclude: (k) => s(S.id, "exclude"),
1197
+ "onUpdate:name": (k) => {
1198
+ S.name = k, v(u)("tagsChanged", l.value);
1526
1199
  }
1527
1200
  }, null, 8, ["id", "colorId", "name", "state", "canExclude", "editable", "disabled", "onUnselect", "onSelect", "onExclude", "onUpdate:name"]))), 128)),
1528
- e.tagsEditable && l.value.length < e.tagsMax && l.value.length < 20 ? (p(), k(Te, {
1201
+ e.tagsEditable && l.value.length < e.tagsMax && l.value.length < 20 ? (h(), C(ve, {
1529
1202
  key: 1,
1530
1203
  "data-top-icon": "",
1531
- onClick: W(w, ["stop"])
1204
+ onClick: U(_, ["stop"])
1532
1205
  }, {
1533
- default: j(() => [
1534
- J(B(h.$i18n.Common.Add), 1)
1206
+ default: B(() => [
1207
+ J(b(p.$i18n.Common.Add), 1)
1535
1208
  ]),
1536
1209
  _: 1
1537
- })) : E("", !0)
1210
+ })) : O("", !0)
1538
1211
  ]),
1539
1212
  _: 2
1540
1213
  }, [
1541
- m(i).mode === "setter" && m(i).filters ? {
1214
+ v(i).mode === "setter" && v(i).filters ? {
1542
1215
  name: "header",
1543
- fn: j(() => [
1544
- O(he, {
1216
+ fn: B(() => [
1217
+ P(ce, {
1545
1218
  modelValue: c.value,
1546
- "onUpdate:modelValue": I[1] || (I[1] = (x) => c.value = x),
1547
- options: S()
1219
+ "onUpdate:modelValue": I[1] || (I[1] = (S) => c.value = S),
1220
+ options: x()
1548
1221
  }, null, 8, ["modelValue", "options"])
1549
1222
  ]),
1550
1223
  key: "0"
1551
1224
  } : void 0,
1552
- m(i).mode === "setter" && m(i).filters ? {
1225
+ v(i).mode === "setter" && v(i).filters ? {
1553
1226
  name: "footer",
1554
- fn: j(() => [
1555
- O(ee, { color: "theme" }, {
1556
- default: j(() => [
1557
- J(B(h.$i18n.Common.Cancel2), 1)
1227
+ fn: B(() => [
1228
+ P(H, { color: "theme" }, {
1229
+ default: B(() => [
1230
+ J(b(p.$i18n.Common.Cancel), 1)
1558
1231
  ]),
1559
1232
  _: 1
1560
1233
  }),
1561
- O(ee, {
1562
- onClick: I[2] || (I[2] = (x) => m(s)("setter", {
1563
- tagsIds: m(i).model.value,
1564
- filters: m(i).filters,
1234
+ P(H, {
1235
+ onClick: I[2] || (I[2] = (S) => v(u)("setter", {
1236
+ tagsIds: v(i).model.value,
1237
+ filters: v(i).filters,
1565
1238
  filtersAction: c.value,
1566
- payload: m(i).payload
1239
+ payload: v(i).payload
1567
1240
  }))
1568
1241
  }, {
1569
- default: j(() => [
1570
- J(B(c.value === "add" ? h.$i18n.Common.Add : "") + " " + B(c.value === "replace" ? h.$i18n.Common.Replace : "") + " " + B(c.value === "delete" ? h.$i18n.Common.Delete : ""), 1)
1242
+ default: B(() => [
1243
+ J(b(c.value === "add" ? p.$i18n.Common.Add : "") + " " + b(c.value === "replace" ? p.$i18n.Common.Replace : "") + " " + b(c.value === "delete" ? p.$i18n.Common.Delete : ""), 1)
1571
1244
  ]),
1572
1245
  _: 1
1573
1246
  })
@@ -1579,18 +1252,17 @@ const Pt = /* @__PURE__ */ L({
1579
1252
  }
1580
1253
  });
1581
1254
  export {
1582
- xo as TopCompetitorSelector,
1583
- To as TopGroupSelector,
1584
- jo as TopProjectSelector,
1585
- ko as TopRegionSelector,
1586
- bo as TopTagSelector,
1587
- ro as TopTagSelectorPopupOpener,
1588
- Ce as TopTagSelectorTagIcon,
1589
- kt as dialogRegionSelector,
1590
- Ct as findRegion,
1591
- Ao as genElTopTagSelectorPopupOpener,
1592
- He as genSearcherByKey,
1593
- Bo as renderElTopTagSelectorPopupOpener,
1594
- Co as useItemsFromCompetitors
1255
+ Rt as TopCompetitorSelector,
1256
+ qt as TopGroupSelector,
1257
+ Nt as TopRegionSelector,
1258
+ Ut as TopTagSelector,
1259
+ At as TopTagSelectorPopupOpener,
1260
+ fe as TopTagSelectorTagIcon,
1261
+ it as dialogRegionSelector,
1262
+ rt as findRegion,
1263
+ Dt as genElTopTagSelectorPopupOpener,
1264
+ Ke as genSearcherByKey,
1265
+ Ft as renderElTopTagSelectorPopupOpener,
1266
+ Pt as useItemsFromCompetitors
1595
1267
  };
1596
1268
  //# sourceMappingURL=project.js.map