treeselectjs 0.8.5 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- var Js = Object.defineProperty;
2
- var Zs = (l, e, t) => e in l ? Js(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
- var c = (l, e, t) => (Zs(l, typeof e != "symbol" ? e + "" : e, t), t), ft = (l, e, t) => {
1
+ var ii = Object.defineProperty;
2
+ var li = (l, e, t) => e in l ? ii(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
+ var c = (l, e, t) => (li(l, typeof e != "symbol" ? e + "" : e, t), t), bt = (l, e, t) => {
4
4
  if (!e.has(l))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var n = (l, e, t) => (ft(l, e, "read from private field"), t ? t.call(l) : e.get(l)), r = (l, e, t) => {
7
+ var n = (l, e, t) => (bt(l, e, "read from private field"), t ? t.call(l) : e.get(l)), r = (l, e, t) => {
8
8
  if (e.has(l))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  e instanceof WeakSet ? e.add(l) : e.set(l, t);
11
- }, m = (l, e, t, s) => (ft(l, e, "write to private field"), s ? s.call(l, t) : e.set(l, t), t);
12
- var a = (l, e, t) => (ft(l, e, "access private method"), t);
13
- const At = {
11
+ }, m = (l, e, t, s) => (bt(l, e, "write to private field"), s ? s.call(l, t) : e.set(l, t), t);
12
+ var o = (l, e, t) => (bt(l, e, "access private method"), t);
13
+ const Ot = {
14
14
  arrowUp: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 15l-6-6-6 6"/></svg>',
15
15
  arrowDown: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>',
16
16
  arrowRight: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>',
@@ -19,50 +19,49 @@ const At = {
19
19
  cross: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',
20
20
  check: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',
21
21
  partialCheck: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>'
22
- }, N = (l, e) => {
22
+ }, O = (l, e) => {
23
23
  if (e.innerHTML = "", typeof l == "string")
24
24
  e.innerHTML = l;
25
25
  else {
26
26
  const t = l.cloneNode(!0);
27
27
  e.appendChild(t);
28
28
  }
29
- }, Tt = (l) => {
29
+ }, It = (l) => {
30
30
  const e = l ? { ...l } : {};
31
- return Object.keys(At).forEach((t) => {
32
- e[t] || (e[t] = At[t]);
31
+ return Object.keys(Ot).forEach((t) => {
32
+ e[t] || (e[t] = Ot[t]);
33
33
  }), e;
34
- }, Qs = (l) => l.reduce((e, { name: t }, s) => (e += t, s < l.length - 1 && (e += ", "), e), "");
35
- var A, E, I, v, he, Pt, H, U, ue, Bt, pe, Vt, G, z, T, D, me, Dt, fe, It, Ce, Ht, be, Gt, ge, Mt, we, Ft, ke, qt, Ee, jt, ve, $t, Le, Wt, ye, Rt, xe, Ut, Se, zt, _e, Yt, Ae, Kt, Te, Xt, Y, bt;
36
- class ei {
34
+ }, ni = (l) => l.reduce((e, { name: t }, s) => (e += t, s < l.length - 1 && (e += ", "), e), "");
35
+ var T, E, D, v, ue, Vt, H, R, pe, Dt, me, Ht, G, U, N, V, fe, Gt, Ce, Mt, be, Ft, ge, qt, we, jt, ke, $t, Ee, Wt, ve, Rt, Le, Ut, ye, zt, xe, Yt, Se, Kt, _e, Xt, Ae, Jt, Te, Zt, Ne, Qt, z, gt;
36
+ class ai {
37
37
  constructor({
38
38
  value: e,
39
39
  showTags: t,
40
40
  tagsCountText: s,
41
41
  clearable: i,
42
- isAlwaysOpened: o,
42
+ isAlwaysOpened: a,
43
43
  searchable: d,
44
- placeholder: u,
44
+ placeholder: p,
45
45
  disabled: f,
46
46
  isSingleSelect: C,
47
47
  id: b,
48
48
  iconElements: g,
49
49
  inputCallback: w,
50
50
  searchCallback: k,
51
- openCallback: O,
52
- closeCallback: P,
53
- keydownCallback: R,
54
- focusCallback: ne,
55
- blurCallback: mt,
51
+ openCallback: y,
52
+ closeCallback: I,
53
+ keydownCallback: W,
54
+ focusCallback: ae,
55
+ blurCallback: Ct,
56
56
  nameChangeCallback: oe
57
57
  }) {
58
58
  // Private methods
59
- r(this, he);
60
- r(this, H);
61
59
  r(this, ue);
60
+ r(this, H);
62
61
  r(this, pe);
63
- r(this, G);
64
- r(this, T);
65
62
  r(this, me);
63
+ r(this, G);
64
+ r(this, N);
66
65
  r(this, fe);
67
66
  r(this, Ce);
68
67
  r(this, be);
@@ -78,8 +77,9 @@ class ei {
78
77
  r(this, _e);
79
78
  r(this, Ae);
80
79
  r(this, Te);
80
+ r(this, Ne);
81
81
  // Emits
82
- r(this, Y);
82
+ r(this, z);
83
83
  // Props
84
84
  c(this, "value");
85
85
  c(this, "showTags");
@@ -97,9 +97,9 @@ class ei {
97
97
  c(this, "searchText");
98
98
  c(this, "srcElement");
99
99
  // PrivateInnerState
100
- r(this, A, void 0);
100
+ r(this, T, void 0);
101
101
  r(this, E, void 0);
102
- r(this, I, void 0);
102
+ r(this, D, void 0);
103
103
  r(this, v, void 0);
104
104
  // Callbacks
105
105
  c(this, "inputCallback");
@@ -110,93 +110,93 @@ class ei {
110
110
  c(this, "focusCallback");
111
111
  c(this, "blurCallback");
112
112
  c(this, "nameChangeCallback");
113
- this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = d, this.placeholder = u, this.clearable = i, this.isAlwaysOpened = o, this.disabled = f, this.isSingleSelect = C, this.id = b, this.iconElements = g, this.isOpened = !1, this.searchText = "", m(this, A, a(this, Ce, Ht).call(this)), m(this, E, a(this, ve, $t).call(this)), m(this, I, a(this, xe, Ut).call(this)), m(this, v, null), this.inputCallback = w, this.searchCallback = k, this.openCallback = O, this.closeCallback = P, this.keydownCallback = R, this.focusCallback = ne, this.blurCallback = mt, this.nameChangeCallback = oe, this.srcElement = a(this, me, Dt).call(this, n(this, A), n(this, E), n(this, I)), a(this, he, Pt).call(this);
113
+ this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = d, this.placeholder = p, this.clearable = i, this.isAlwaysOpened = a, this.disabled = f, this.isSingleSelect = C, this.id = b, this.iconElements = g, this.isOpened = !1, this.searchText = "", m(this, T, o(this, be, Ft).call(this)), m(this, E, o(this, Le, Ut).call(this)), m(this, D, o(this, Se, Kt).call(this)), m(this, v, null), this.inputCallback = w, this.searchCallback = k, this.openCallback = y, this.closeCallback = I, this.keydownCallback = W, this.focusCallback = ae, this.blurCallback = Ct, this.nameChangeCallback = oe, this.srcElement = o(this, fe, Gt).call(this, n(this, T), n(this, E), n(this, D)), o(this, ue, Vt).call(this);
114
114
  }
115
115
  // Public methods
116
116
  focus() {
117
117
  setTimeout(() => n(this, E).focus(), 0);
118
118
  }
119
119
  blur() {
120
- this.isOpened && a(this, T, D).call(this), this.clearSearch(), n(this, E).blur();
120
+ this.isOpened && o(this, N, V).call(this), this.clearSearch(), n(this, E).blur();
121
121
  }
122
122
  updateValue(e) {
123
- this.value = e, a(this, H, U).call(this), a(this, G, z).call(this);
123
+ this.value = e, o(this, H, R).call(this), o(this, G, U).call(this);
124
124
  }
125
125
  removeItem(e) {
126
- this.value = this.value.filter((t) => t.id !== e), a(this, Y, bt).call(this), a(this, H, U).call(this), a(this, G, z).call(this);
126
+ this.value = this.value.filter((t) => t.id !== e), o(this, z, gt).call(this), o(this, H, R).call(this), o(this, G, U).call(this);
127
127
  }
128
128
  clear() {
129
- this.value = [], a(this, Y, bt).call(this), a(this, H, U).call(this), this.clearSearch();
129
+ this.value = [], o(this, z, gt).call(this), o(this, H, R).call(this), this.clearSearch();
130
130
  }
131
131
  openClose() {
132
- a(this, T, D).call(this);
132
+ o(this, N, V).call(this);
133
133
  }
134
134
  clearSearch() {
135
- this.searchText = "", this.searchCallback(""), a(this, G, z).call(this);
135
+ this.searchText = "", this.searchCallback(""), o(this, G, U).call(this);
136
136
  }
137
137
  }
138
- A = new WeakMap(), E = new WeakMap(), I = new WeakMap(), v = new WeakMap(), he = new WeakSet(), Pt = function() {
139
- a(this, H, U).call(this), a(this, G, z).call(this), a(this, ue, Bt).call(this);
140
- }, H = new WeakSet(), U = function() {
141
- if (n(this, A).innerHTML = "", this.showTags) {
142
- n(this, A).append(...a(this, be, Gt).call(this));
143
- const e = Qs(this.value);
138
+ T = new WeakMap(), E = new WeakMap(), D = new WeakMap(), v = new WeakMap(), ue = new WeakSet(), Vt = function() {
139
+ o(this, H, R).call(this), o(this, G, U).call(this), o(this, pe, Dt).call(this);
140
+ }, H = new WeakSet(), R = function() {
141
+ if (n(this, T).innerHTML = "", this.showTags) {
142
+ n(this, T).append(...o(this, ge, qt).call(this));
143
+ const e = ni(this.value);
144
144
  this.nameChangeCallback(e);
145
145
  } else {
146
- const e = a(this, Ee, jt).call(this);
147
- n(this, A).appendChild(e), this.nameChangeCallback(e.innerText);
146
+ const e = o(this, ve, Rt).call(this);
147
+ n(this, T).appendChild(e), this.nameChangeCallback(e.innerText);
148
148
  }
149
- n(this, A).appendChild(n(this, E));
150
- }, ue = new WeakSet(), Bt = function() {
149
+ n(this, T).appendChild(n(this, E));
150
+ }, pe = new WeakSet(), Dt = function() {
151
151
  const e = [];
152
- n(this, I).innerHTML = "", this.clearable && e.push(a(this, Se, zt).call(this)), this.isAlwaysOpened || e.push(a(this, Ae, Kt).call(this, this.isOpened)), e.length && n(this, I).append(...e);
153
- }, pe = new WeakSet(), Vt = function() {
152
+ n(this, D).innerHTML = "", this.clearable && e.push(o(this, _e, Xt).call(this)), this.isAlwaysOpened || e.push(o(this, Te, Zt).call(this, this.isOpened)), e.length && n(this, D).append(...e);
153
+ }, me = new WeakSet(), Ht = function() {
154
154
  if (!this.isAlwaysOpened && n(this, v)) {
155
155
  const e = this.isOpened ? this.iconElements.arrowUp : this.iconElements.arrowDown;
156
- N(e, n(this, v));
156
+ O(e, n(this, v));
157
157
  }
158
- }, G = new WeakSet(), z = function() {
158
+ }, G = new WeakSet(), U = function() {
159
159
  var e;
160
160
  (e = this.value) != null && e.length ? (n(this, E).removeAttribute("placeholder"), this.srcElement.classList.remove("treeselect-input--value-not-selected")) : (n(this, E).setAttribute("placeholder", this.placeholder), this.srcElement.classList.add("treeselect-input--value-not-selected")), this.searchable ? this.srcElement.classList.remove("treeselect-input--unsearchable") : this.srcElement.classList.add("treeselect-input--unsearchable"), this.isSingleSelect ? this.srcElement.classList.add("treeselect-input--is-single-select") : this.srcElement.classList.remove("treeselect-input--is-single-select"), n(this, E).value = this.searchText;
161
- }, T = new WeakSet(), D = function() {
162
- this.isOpened = !this.isOpened, a(this, pe, Vt).call(this), this.isOpened ? this.openCallback() : this.closeCallback();
163
- }, me = new WeakSet(), Dt = function(e, t, s) {
161
+ }, N = new WeakSet(), V = function() {
162
+ this.isOpened = !this.isOpened, o(this, me, Ht).call(this), this.isOpened ? this.openCallback() : this.closeCallback();
163
+ }, fe = new WeakSet(), Gt = function(e, t, s) {
164
164
  const i = document.createElement("div");
165
- return i.classList.add("treeselect-input"), i.setAttribute("tabindex", "-1"), i.addEventListener("mousedown", (o) => a(this, fe, It).call(this, o)), i.addEventListener("focus", () => this.focusCallback(), !0), i.addEventListener("blur", () => this.blurCallback(), !0), e.appendChild(t), i.append(e, s), i;
166
- }, fe = new WeakSet(), It = function(e) {
167
- e.stopPropagation(), this.isOpened || a(this, T, D).call(this), this.focus();
168
- }, Ce = new WeakSet(), Ht = function() {
165
+ return i.classList.add("treeselect-input"), i.setAttribute("tabindex", "-1"), i.addEventListener("mousedown", (a) => o(this, Ce, Mt).call(this, a)), i.addEventListener("focus", () => this.focusCallback(), !0), i.addEventListener("blur", () => this.blurCallback(), !0), e.appendChild(t), i.append(e, s), i;
166
+ }, Ce = new WeakSet(), Mt = function(e) {
167
+ e.stopPropagation(), this.isOpened || o(this, N, V).call(this), this.focus();
168
+ }, be = new WeakSet(), Ft = function() {
169
169
  const e = document.createElement("div");
170
170
  return e.classList.add("treeselect-input__tags"), e;
171
- }, be = new WeakSet(), Gt = function() {
171
+ }, ge = new WeakSet(), qt = function() {
172
172
  return this.value.map((e) => {
173
173
  const t = document.createElement("div");
174
174
  t.classList.add("treeselect-input__tags-element"), t.setAttribute("tabindex", "-1"), t.setAttribute("tag-id", e.id.toString()), t.setAttribute("title", e.name);
175
- const s = a(this, we, Ft).call(this, e.name), i = a(this, ke, qt).call(this);
176
- return t.addEventListener("mousedown", (o) => a(this, ge, Mt).call(this, o, e.id)), t.append(s, i), t;
175
+ const s = o(this, ke, $t).call(this, e.name), i = o(this, Ee, Wt).call(this);
176
+ return t.addEventListener("mousedown", (a) => o(this, we, jt).call(this, a, e.id)), t.append(s, i), t;
177
177
  });
178
- }, ge = new WeakSet(), Mt = function(e, t) {
178
+ }, we = new WeakSet(), jt = function(e, t) {
179
179
  e.preventDefault(), e.stopPropagation(), this.removeItem(t), this.focus();
180
- }, we = new WeakSet(), Ft = function(e) {
180
+ }, ke = new WeakSet(), $t = function(e) {
181
181
  const t = document.createElement("span");
182
182
  return t.classList.add("treeselect-input__tags-name"), t.textContent = e, t;
183
- }, ke = new WeakSet(), qt = function() {
183
+ }, Ee = new WeakSet(), Wt = function() {
184
184
  const e = document.createElement("span");
185
- return e.classList.add("treeselect-input__tags-cross"), N(this.iconElements.cross, e), e;
186
- }, Ee = new WeakSet(), jt = function() {
185
+ return e.classList.add("treeselect-input__tags-cross"), O(this.iconElements.cross, e), e;
186
+ }, ve = new WeakSet(), Rt = function() {
187
187
  const e = document.createElement("span");
188
188
  if (e.classList.add("treeselect-input__tags-count"), !this.value.length)
189
189
  return e.textContent = "", e.setAttribute("title", ""), e;
190
190
  const t = this.value.length === 1 ? this.value[0].name : `${this.value.length} ${this.tagsCountText}`;
191
191
  return e.textContent = t, e.setAttribute("title", t), e;
192
- }, ve = new WeakSet(), $t = function() {
192
+ }, Le = new WeakSet(), Ut = function() {
193
193
  const e = document.createElement("input");
194
- return e.classList.add("treeselect-input__edit"), this.id && e.setAttribute("id", this.id), (!this.searchable || this.disabled) && e.setAttribute("readonly", "readonly"), this.disabled && e.setAttribute("tabindex", "-1"), e.addEventListener("keydown", (t) => a(this, Le, Wt).call(this, t)), e.addEventListener("input", (t) => a(this, ye, Rt).call(this, t, e)), e;
195
- }, Le = new WeakSet(), Wt = function(e) {
194
+ return e.classList.add("treeselect-input__edit"), this.id && e.setAttribute("id", this.id), (!this.searchable || this.disabled) && e.setAttribute("readonly", "readonly"), this.disabled && e.setAttribute("tabindex", "-1"), e.addEventListener("keydown", (t) => o(this, ye, zt).call(this, t)), e.addEventListener("input", (t) => o(this, xe, Yt).call(this, t, e)), e;
195
+ }, ye = new WeakSet(), zt = function(e) {
196
196
  e.stopPropagation();
197
197
  const t = e.key;
198
- t === "Backspace" && !this.searchText.length && this.value.length && !this.showTags && this.clear(), t === "Backspace" && !this.searchText.length && this.value.length && this.removeItem(this.value[this.value.length - 1].id), e.code === "Space" && (!this.searchText || !this.searchable) && a(this, T, D).call(this), (t === "Enter" || t === "ArrowDown" || t === "ArrowUp") && e.preventDefault(), this.keydownCallback(e), t !== "Tab" && this.focus();
199
- }, ye = new WeakSet(), Rt = function(e, t) {
198
+ t === "Backspace" && !this.searchText.length && this.value.length && !this.showTags && this.clear(), t === "Backspace" && !this.searchText.length && this.value.length && this.removeItem(this.value[this.value.length - 1].id), e.code === "Space" && (!this.searchText || !this.searchable) && o(this, N, V).call(this), (t === "Enter" || t === "ArrowDown" || t === "ArrowUp") && e.preventDefault(), this.keydownCallback(e), t !== "Tab" && this.focus();
199
+ }, xe = new WeakSet(), Yt = function(e, t) {
200
200
  e.stopPropagation();
201
201
  const s = this.searchText, i = t.value.trim();
202
202
  if (s.length === 0 && i.length === 0) {
@@ -204,145 +204,149 @@ A = new WeakMap(), E = new WeakMap(), I = new WeakMap(), v = new WeakMap(), he =
204
204
  return;
205
205
  }
206
206
  if (this.searchable) {
207
- const o = e.target.value;
208
- this.searchCallback(o), this.isOpened || a(this, T, D).call(this);
207
+ const a = e.target.value;
208
+ this.searchCallback(a), this.isOpened || o(this, N, V).call(this);
209
209
  } else
210
210
  t.value = "";
211
211
  this.searchText = t.value;
212
- }, xe = new WeakSet(), Ut = function() {
212
+ }, Se = new WeakSet(), Kt = function() {
213
213
  const e = document.createElement("div");
214
214
  return e.classList.add("treeselect-input__operators"), e;
215
- }, Se = new WeakSet(), zt = function() {
215
+ }, _e = new WeakSet(), Xt = function() {
216
216
  const e = document.createElement("span");
217
- return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), N(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => a(this, _e, Yt).call(this, t)), e;
218
- }, _e = new WeakSet(), Yt = function(e) {
217
+ return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), O(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => o(this, Ae, Jt).call(this, t)), e;
218
+ }, Ae = new WeakSet(), Jt = function(e) {
219
219
  e.preventDefault(), e.stopPropagation(), (this.searchText.length || this.value.length) && this.clear(), this.focus();
220
- }, Ae = new WeakSet(), Kt = function(e) {
220
+ }, Te = new WeakSet(), Zt = function(e) {
221
221
  m(this, v, document.createElement("span")), n(this, v).classList.add("treeselect-input__arrow");
222
222
  const t = e ? this.iconElements.arrowUp : this.iconElements.arrowDown;
223
- return N(t, n(this, v)), n(this, v).addEventListener("mousedown", (s) => a(this, Te, Xt).call(this, s)), n(this, v);
224
- }, Te = new WeakSet(), Xt = function(e) {
225
- e.stopPropagation(), e.preventDefault(), this.focus(), a(this, T, D).call(this);
226
- }, Y = new WeakSet(), bt = function() {
223
+ return O(t, n(this, v)), n(this, v).addEventListener("mousedown", (s) => o(this, Ne, Qt).call(this, s)), n(this, v);
224
+ }, Ne = new WeakSet(), Qt = function(e) {
225
+ e.stopPropagation(), e.preventDefault(), this.focus(), o(this, N, V).call(this);
226
+ }, z = new WeakSet(), gt = function() {
227
227
  this.inputCallback(this.value);
228
228
  };
229
- const Jt = (l, e, t) => {
230
- li(e);
231
- const s = e.filter((i) => !i.disabled && l.some((o) => o === i.id));
232
- if (t && s.length) {
233
- s[0].checked = !0;
229
+ const es = (l, e, t, s) => {
230
+ di(e);
231
+ const i = e.filter((a) => !a.disabled && l.some((d) => d === a.id));
232
+ if (t && i.length) {
233
+ i[0].checked = !0;
234
234
  return;
235
235
  }
236
- s.forEach((i) => {
237
- i.checked = !0;
238
- const o = _t(i, e);
239
- i.checked = o;
236
+ i.forEach((a) => {
237
+ a.checked = !0;
238
+ const d = Nt(a, e, s);
239
+ a.checked = d;
240
240
  });
241
- }, _t = ({ id: l, checked: e }, t) => {
242
- const s = t.find((o) => o.id === l);
243
- if (!s)
241
+ }, Nt = ({ id: l, checked: e }, t, s) => {
242
+ const i = t.find((d) => d.id === l);
243
+ if (!i)
244
244
  return !1;
245
- const i = Zt(!!e, s, t);
246
- return Qt(s, t), i;
247
- }, Zt = (l, e, t) => {
245
+ if (s)
246
+ return i.checked = i.disabled ? !1 : !!e, i.checked;
247
+ const a = ts(!!e, i, t);
248
+ return ss(i, t), a;
249
+ }, ts = (l, e, t) => {
248
250
  if (!e.isGroup)
249
251
  return e.checked = e.disabled ? !1 : !!l, e.isPartialChecked = !1, e.checked;
250
- const s = t.filter((u) => u.childOf === e.id);
251
- return !l || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1, gt(e, s, t), e.checked) : es(s, t) ? ts(s) ? (e.checked = !1, e.isPartialChecked = !1, e.disabled = !0, e.checked) : (e.checked = !1, e.isPartialChecked = !0, s.forEach((u) => {
252
- Zt(l, u, t);
253
- }), e.checked) : (e.checked = !0, e.isPartialChecked = !1, gt(e, s, t), e.checked);
254
- }, Qt = (l, e) => {
252
+ const s = t.filter((p) => p.childOf === e.id);
253
+ return !l || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1, wt(e, s, t), e.checked) : is(s, t) ? ls(s) ? (e.checked = !1, e.isPartialChecked = !1, e.disabled = !0, e.checked) : (e.checked = !1, e.isPartialChecked = !0, s.forEach((p) => {
254
+ ts(l, p, t);
255
+ }), e.checked) : (e.checked = !0, e.isPartialChecked = !1, wt(e, s, t), e.checked);
256
+ }, ss = (l, e) => {
255
257
  const t = e.find((s) => s.id === l.childOf);
256
- t && (ti(t, e), Qt(t, e));
257
- }, ti = (l, e) => {
258
- const t = ut(l, e);
259
- if (ts(t)) {
258
+ t && (oi(t, e), ss(t, e));
259
+ }, oi = (l, e) => {
260
+ const t = mt(l, e);
261
+ if (ls(t)) {
260
262
  l.checked = !1, l.isPartialChecked = !1, l.disabled = !0;
261
263
  return;
262
264
  }
263
- if (si(t)) {
265
+ if (ri(t)) {
264
266
  l.checked = !0, l.isPartialChecked = !1;
265
267
  return;
266
268
  }
267
- if (ii(t)) {
269
+ if (ci(t)) {
268
270
  l.checked = !1, l.isPartialChecked = !0;
269
271
  return;
270
272
  }
271
273
  l.checked = !1, l.isPartialChecked = !1;
272
- }, gt = ({ checked: l, disabled: e }, t, s) => {
274
+ }, wt = ({ checked: l, disabled: e }, t, s) => {
273
275
  t.forEach((i) => {
274
276
  i.disabled = !!e || !!i.disabled, i.checked = !!l && !i.disabled, i.isPartialChecked = !1;
275
- const o = ut(i, s);
276
- gt({ checked: l, disabled: e }, o, s);
277
+ const a = mt(i, s);
278
+ wt({ checked: l, disabled: e }, a, s);
277
279
  });
278
- }, es = (l, e) => l.some((i) => i.disabled) ? !0 : l.some((i) => {
280
+ }, is = (l, e) => l.some((i) => i.disabled) ? !0 : l.some((i) => {
279
281
  if (i.isGroup) {
280
- const o = ut(i, e);
281
- return es(o, e);
282
+ const a = mt(i, e);
283
+ return is(a, e);
282
284
  }
283
285
  return !1;
284
- }), ts = (l) => l.every((e) => !!e.disabled), si = (l) => l.every((e) => !!e.checked), ii = (l) => l.some((e) => !!e.checked || !!e.isPartialChecked), li = (l) => {
286
+ }), ls = (l) => l.every((e) => !!e.disabled), ri = (l) => l.every((e) => !!e.checked), ci = (l) => l.some((e) => !!e.checked || !!e.isPartialChecked), di = (l) => {
285
287
  l.forEach((e) => {
286
288
  e.checked = !1, e.isPartialChecked = !1;
287
289
  });
288
- }, ni = (l, e, t = "", s = 0) => {
289
- const i = ss(l, e, t, s);
290
- return ai(i);
291
- }, ss = (l, e, t, s) => l.reduce((i, o) => {
290
+ }, hi = (l, e, t) => {
291
+ const s = { level: 0, groupId: "" }, i = ns(l, e, s.groupId, s.level);
292
+ return pi(i, t);
293
+ }, ns = (l, e, t, s) => l.reduce((i, a) => {
292
294
  var C;
293
- const d = !!((C = o.children) != null && C.length), u = s >= e && d, f = s > e;
295
+ const d = !!((C = a.children) != null && C.length), p = s >= e && d, f = s > e;
294
296
  if (i.push({
295
- id: o.value,
296
- name: o.name,
297
+ id: a.value,
298
+ name: a.name,
297
299
  childOf: t,
298
300
  isGroup: d,
299
301
  checked: !1,
300
302
  isPartialChecked: !1,
301
303
  level: s,
302
- isClosed: u,
304
+ isClosed: p,
303
305
  hidden: f,
304
- disabled: o.disabled ?? !1
306
+ disabled: a.disabled ?? !1
305
307
  }), d) {
306
- const b = ss(o.children, e, o.value, s + 1);
308
+ const b = ns(a.children, e, a.value, s + 1);
307
309
  i.push(...b);
308
310
  }
309
311
  return i;
310
- }, []), ut = ({ id: l }, e) => e.filter((t) => t.childOf === l), oi = (l) => {
312
+ }, []), mt = ({ id: l }, e) => e.filter((t) => t.childOf === l), ui = (l) => {
311
313
  const { ungroupedNodes: e, allGroupedNodes: t, allNodes: s } = l.reduce(
312
- (o, d) => (d.checked && (o.allNodes.push(d), d.isGroup ? o.allGroupedNodes.push(d) : o.ungroupedNodes.push(d)), o),
314
+ (a, d) => (d.checked && (a.allNodes.push(d), d.isGroup ? a.allGroupedNodes.push(d) : a.ungroupedNodes.push(d)), a),
313
315
  {
314
316
  ungroupedNodes: [],
315
317
  allGroupedNodes: [],
316
318
  allNodes: []
317
319
  }
318
- ), i = s.filter((o) => !t.some(({ id: d }) => d === o.childOf));
320
+ ), i = s.filter((a) => !t.some(({ id: d }) => d === a.childOf));
319
321
  return { ungroupedNodes: e, groupedNodes: i, allNodes: s };
320
- }, ai = (l) => (l.filter((t) => !!t.disabled).forEach(({ id: t }) => _t({ id: t, checked: !1 }, l)), l), pt = (l, { id: e, isClosed: t }) => {
321
- ut({ id: e }, l).forEach((i) => {
322
- i.hidden = t ?? !1, i.isGroup && !i.isClosed && pt(l, { id: i.id, isClosed: t });
322
+ }, pi = (l, e) => (l.filter((s) => !!s.disabled).forEach(
323
+ ({ id: s }) => Nt({ id: s, checked: !1 }, l, e)
324
+ ), l), ft = (l, { id: e, isClosed: t }) => {
325
+ mt({ id: e }, l).forEach((i) => {
326
+ i.hidden = t ?? !1, i.isGroup && !i.isClosed && ft(l, { id: i.id, isClosed: t });
323
327
  });
324
- }, ri = (l) => {
328
+ }, mi = (l) => {
325
329
  l.filter((e) => e.isGroup && !e.disabled && (e.checked || e.isPartialChecked)).forEach((e) => {
326
- e.isClosed = !1, pt(l, e);
330
+ e.isClosed = !1, ft(l, e);
327
331
  });
328
- }, ci = (l, e) => {
329
- const t = di(l, e);
332
+ }, fi = (l, e) => {
333
+ const t = Ci(l, e);
330
334
  l.forEach((s) => {
331
- t.some(({ id: o }) => o === s.id) ? (s.isGroup && (s.isClosed = !1, pt(l, s)), s.hidden = !1) : s.hidden = !0;
335
+ t.some(({ id: a }) => a === s.id) ? (s.isGroup && (s.isClosed = !1, ft(l, s)), s.hidden = !1) : s.hidden = !0;
332
336
  });
333
- }, di = (l, e) => l.reduce((t, s) => {
337
+ }, Ci = (l, e) => l.reduce((t, s) => {
334
338
  if (s.name.toLowerCase().includes(e.toLowerCase())) {
335
339
  if (t.push(s), s.isGroup) {
336
- const o = is(s.id, l);
337
- t.push(...o);
340
+ const a = as(s.id, l);
341
+ t.push(...a);
338
342
  }
339
343
  if (s.childOf) {
340
- const o = ls(s.childOf, l);
341
- t.push(...o);
344
+ const a = os(s.childOf, l);
345
+ t.push(...a);
342
346
  }
343
347
  }
344
348
  return t;
345
- }, []), is = (l, e) => e.reduce((t, s) => (s.childOf === l && (t.push(s), s.isGroup && t.push(...is(s.id, e))), t), []), ls = (l, e) => e.reduce((t, s) => (s.id === l && (t.push(s), s.childOf && t.push(...ls(s.childOf, e))), t), []), hi = (l) => {
349
+ }, []), as = (l, e) => e.reduce((t, s) => (s.childOf === l && (t.push(s), s.isGroup && t.push(...as(s.id, e))), t), []), os = (l, e) => e.reduce((t, s) => (s.id === l && (t.push(s), s.childOf && t.push(...os(s.childOf, e))), t), []), bi = (l) => {
346
350
  const { duplications: e } = l.reduce(
347
351
  (t, s) => (t.allItems.some((i) => i.toString() === s.id.toString()) && t.duplications.push(s.id), t.allItems.push(s.id), t),
348
352
  {
@@ -351,76 +355,76 @@ const Jt = (l, e, t) => {
351
355
  }
352
356
  );
353
357
  e.length && console.error(`Validation: You have duplicated values: ${e.join(", ")}! You should use unique values.`);
354
- }, ui = (l, e, t, s, i, o, d, u) => {
355
- Jt(l, e, i), u && d && ri(e), ae(e, t, s, o);
356
- }, ae = (l, e, t, s) => {
358
+ }, gi = (l, e, t, s, i, a, d, p, f) => {
359
+ es(l, e, i, f), p && d && mi(e), ce(e, t, s, a);
360
+ }, ce = (l, e, t, s) => {
357
361
  l.forEach((i) => {
358
- const o = e.querySelector(`[input-id="${i.id}"]`), d = _(o);
359
- o.checked = i.checked, pi(i, d, s), mi(i, d), fi(i, d), Ci(i, d, t), bi(i, d), wi(i, d, l), gi(i, o, t);
360
- }), ki(l, e);
361
- }, pi = (l, e, t) => {
362
+ const a = e.querySelector(`[input-id="${i.id}"]`), d = A(a);
363
+ a.checked = i.checked, wi(i, d, s), ki(i, d), Ei(i, d), vi(i, d, t), Li(i, d), xi(i, d, l), yi(i, a, t);
364
+ }), Si(l, e);
365
+ }, wi = (l, e, t) => {
362
366
  l.checked ? e.classList.add("treeselect-list__item--checked") : e.classList.remove("treeselect-list__item--checked"), Array.isArray(t) && t[0] === l.id && !l.disabled ? e.classList.add("treeselect-list__item--single-selected") : e.classList.remove("treeselect-list__item--single-selected");
363
- }, mi = (l, e) => {
367
+ }, ki = (l, e) => {
364
368
  l.isPartialChecked ? e.classList.add("treeselect-list__item--partial-checked") : e.classList.remove("treeselect-list__item--partial-checked");
365
- }, fi = (l, e) => {
369
+ }, Ei = (l, e) => {
366
370
  l.disabled ? e.classList.add("treeselect-list__item--disabled") : e.classList.remove("treeselect-list__item--disabled");
367
- }, Ci = (l, e, t) => {
371
+ }, vi = (l, e, t) => {
368
372
  if (l.isGroup) {
369
373
  const s = e.querySelector(".treeselect-list__item-icon"), i = l.isClosed ? t.arrowRight : t.arrowDown;
370
- N(i, s), l.isClosed ? e.classList.add("treeselect-list__item--closed") : e.classList.remove("treeselect-list__item--closed");
374
+ O(i, s), l.isClosed ? e.classList.add("treeselect-list__item--closed") : e.classList.remove("treeselect-list__item--closed");
371
375
  }
372
- }, bi = (l, e) => {
376
+ }, Li = (l, e) => {
373
377
  l.hidden ? e.classList.add("treeselect-list__item--hidden") : e.classList.remove("treeselect-list__item--hidden");
374
- }, gi = (l, e, t) => {
378
+ }, yi = (l, e, t) => {
375
379
  const i = e.parentNode.querySelector(".treeselect-list__item-checkbox-icon");
376
- l.checked ? N(t.check, i) : l.isPartialChecked ? N(t.partialCheck, i) : i.innerHTML = "";
377
- }, wi = (l, e, t) => {
378
- const s = l.level === 0, i = 20, o = 5;
380
+ l.checked ? O(t.check, i) : l.isPartialChecked ? O(t.partialCheck, i) : i.innerHTML = "";
381
+ }, xi = (l, e, t) => {
382
+ const s = l.level === 0, i = 20, a = 5;
379
383
  if (s) {
380
- const d = t.some((f) => f.isGroup && f.level === l.level), u = !l.isGroup && d ? `${i}px` : `${o}px`;
381
- e.style.paddingLeft = l.isGroup ? "0" : u;
384
+ const d = t.some((f) => f.isGroup && f.level === l.level), p = !l.isGroup && d ? `${i}px` : `${a}px`;
385
+ e.style.paddingLeft = l.isGroup ? "0" : p;
382
386
  } else
383
387
  e.style.paddingLeft = l.isGroup ? `${l.level * i}px` : `${l.level * i + i}px`;
384
388
  e.setAttribute("level", l.level.toString()), e.setAttribute("group", l.isGroup.toString());
385
- }, ki = (l, e) => {
389
+ }, Si = (l, e) => {
386
390
  const t = l.some((i) => !i.hidden), s = e.querySelector(".treeselect-list__empty");
387
391
  t ? s.classList.add("treeselect-list__empty--hidden") : s.classList.remove("treeselect-list__empty--hidden");
388
- }, _ = (l) => l.parentNode.parentNode, Nt = (l, e) => e.find((t) => t.id.toString() === l), Ei = (l) => _(l).querySelector(".treeselect-list__item-icon"), vi = (l, e) => {
392
+ }, A = (l) => l.parentNode.parentNode, Pt = (l, e) => e.find((t) => t.id.toString() === l), _i = (l) => A(l).querySelector(".treeselect-list__item-icon"), Ai = (l, e) => {
389
393
  e && Object.keys(e).forEach((t) => {
390
394
  const s = e[t];
391
395
  typeof s == "string" && l.setAttribute(t, s);
392
396
  });
393
397
  };
394
- var M, B, y, K, Ne, ns, Oe, os, Pe, as, Be, rs, Ve, cs, De, ds, X, wt, Ie, hs, He, us, Ge, ps, J, kt, Me, ms, Fe, fs, qe, Cs, je, bs, $e, gs, We, ws, Re, ks, Ue, Es, ze, vs, Ye, Ls, Ke, ys, Z, Et, Q, vt, Xe, xs;
395
- class Li {
398
+ var M, P, x, Y, Oe, rs, Ie, cs, Pe, ds, Be, hs, Ve, us, De, ps, K, kt, He, ms, Ge, fs, Me, Cs, X, Et, Fe, bs, qe, gs, je, ws, $e, ks, We, Es, Re, vs, Ue, Ls, ze, ys, Ye, xs, Ke, Ss, Xe, _s, J, vt, Z, Lt, Je, As;
399
+ class Ti {
396
400
  constructor({
397
401
  options: e,
398
402
  value: t,
399
403
  openLevel: s,
400
404
  listSlotHtmlComponent: i,
401
- emptyText: o,
405
+ emptyText: a,
402
406
  isSingleSelect: d,
403
- iconElements: u,
407
+ iconElements: p,
404
408
  showCount: f,
405
409
  disabledBranchNode: C,
406
410
  expandSelected: b,
407
- inputCallback: g,
408
- arrowClickCallback: w,
409
- mouseupCallback: k
411
+ isIndependentNodes: g,
412
+ inputCallback: w,
413
+ arrowClickCallback: k,
414
+ mouseupCallback: y
410
415
  }) {
411
416
  // Private methods
412
- r(this, Ne);
413
417
  r(this, Oe);
418
+ r(this, Ie);
414
419
  r(this, Pe);
415
420
  r(this, Be);
416
421
  r(this, Ve);
417
422
  r(this, De);
418
- r(this, X);
419
- r(this, Ie);
423
+ r(this, K);
420
424
  r(this, He);
421
425
  r(this, Ge);
422
- r(this, J);
423
426
  r(this, Me);
427
+ r(this, X);
424
428
  r(this, Fe);
425
429
  r(this, qe);
426
430
  r(this, je);
@@ -429,13 +433,14 @@ class Li {
429
433
  r(this, Re);
430
434
  r(this, Ue);
431
435
  r(this, ze);
432
- // Actions
433
436
  r(this, Ye);
437
+ // Actions
434
438
  r(this, Ke);
439
+ r(this, Xe);
440
+ r(this, J);
435
441
  r(this, Z);
436
- r(this, Q);
437
442
  // Emits
438
- r(this, Xe);
443
+ r(this, Je);
439
444
  // Props
440
445
  c(this, "options");
441
446
  c(this, "value");
@@ -446,6 +451,7 @@ class Li {
446
451
  c(this, "showCount");
447
452
  c(this, "disabledBranchNode");
448
453
  c(this, "expandSelected");
454
+ c(this, "isIndependentNodes");
449
455
  c(this, "iconElements");
450
456
  // InnerState
451
457
  c(this, "searchText");
@@ -459,72 +465,73 @@ class Li {
459
465
  c(this, "mouseupCallback");
460
466
  // PrivateInnerState
461
467
  r(this, M, null);
462
- r(this, B, !0);
463
- r(this, y, []);
464
- r(this, K, !0);
465
- this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = i ?? null, this.emptyText = o ?? "No results found...", this.isSingleSelect = d ?? !1, this.showCount = f ?? !1, this.disabledBranchNode = C ?? !1, this.expandSelected = b ?? !1, this.iconElements = u, this.searchText = "", this.flattedOptions = ni(this.options, this.openLevel), this.flattedOptionsBeforeSearch = this.flattedOptions, this.selectedNodes = { nodes: [], groupedNodes: [] }, this.srcElement = a(this, Pe, as).call(this), this.inputCallback = g, this.arrowClickCallback = w, this.mouseupCallback = k, hi(this.flattedOptions);
468
+ r(this, P, !0);
469
+ r(this, x, []);
470
+ r(this, Y, !0);
471
+ this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = i ?? null, this.emptyText = a ?? "No results found...", this.isSingleSelect = d ?? !1, this.showCount = f ?? !1, this.disabledBranchNode = C ?? !1, this.expandSelected = b ?? !1, this.isIndependentNodes = g ?? !1, this.iconElements = p, this.searchText = "", this.flattedOptions = hi(this.options, this.openLevel, this.isIndependentNodes), this.flattedOptionsBeforeSearch = this.flattedOptions, this.selectedNodes = { nodes: [], groupedNodes: [], allNodes: [] }, this.srcElement = o(this, Pe, ds).call(this), this.inputCallback = w, this.arrowClickCallback = k, this.mouseupCallback = y, bi(this.flattedOptions);
466
472
  }
467
473
  // Public methods
468
474
  updateValue(e) {
469
- this.value = e, m(this, y, this.isSingleSelect ? this.value : []), ui(
475
+ this.value = e, m(this, x, this.isSingleSelect ? this.value : []), gi(
470
476
  e,
471
477
  this.flattedOptions,
472
478
  this.srcElement,
473
479
  this.iconElements,
474
480
  this.isSingleSelect,
475
- n(this, y),
481
+ n(this, x),
476
482
  this.expandSelected,
477
- n(this, K)
478
- ), m(this, K, !1), a(this, Q, vt).call(this);
483
+ n(this, Y),
484
+ this.isIndependentNodes
485
+ ), m(this, Y, !1), o(this, Z, Lt).call(this);
479
486
  }
480
487
  updateSearchValue(e) {
481
488
  if (e === this.searchText)
482
489
  return;
483
490
  const t = this.searchText === "" && e !== "";
484
491
  this.searchText = e, t && (this.flattedOptionsBeforeSearch = JSON.parse(JSON.stringify(this.flattedOptions))), this.searchText === "" && (this.flattedOptions = this.flattedOptionsBeforeSearch.map((s) => {
485
- const i = this.flattedOptions.find((o) => o.id === s.id);
492
+ const i = this.flattedOptions.find((a) => a.id === s.id);
486
493
  return i.isClosed = s.isClosed, i.hidden = s.hidden, i;
487
- }), this.flattedOptionsBeforeSearch = []), this.searchText && ci(this.flattedOptions, e), ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), this.focusFirstListElement();
494
+ }), this.flattedOptionsBeforeSearch = []), this.searchText && fi(this.flattedOptions, e), ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, x)), this.focusFirstListElement();
488
495
  }
489
496
  callKeyAction(e) {
490
- m(this, B, !1);
497
+ m(this, P, !1);
491
498
  const t = this.srcElement.querySelector(".treeselect-list__item--focused");
492
499
  if (t == null ? void 0 : t.classList.contains("treeselect-list__item--hidden"))
493
500
  return;
494
501
  const i = e.key;
495
- i === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (i === "ArrowLeft" || i === "ArrowRight") && a(this, Ne, ns).call(this, t, e), (i === "ArrowDown" || i === "ArrowUp") && a(this, Oe, os).call(this, t, i);
502
+ i === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (i === "ArrowLeft" || i === "ArrowRight") && o(this, Oe, rs).call(this, t, e), (i === "ArrowDown" || i === "ArrowUp") && o(this, Ie, cs).call(this, t, i);
496
503
  }
497
504
  focusFirstListElement() {
498
505
  const e = "treeselect-list__item--focused", t = this.srcElement.querySelector(`.${e}`), s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
499
- (o) => window.getComputedStyle(_(o)).display !== "none"
506
+ (a) => window.getComputedStyle(A(a)).display !== "none"
500
507
  );
501
508
  if (!s.length)
502
509
  return;
503
- t && t.classList.remove(e), _(s[0]).classList.add(e);
510
+ t && t.classList.remove(e), A(s[0]).classList.add(e);
504
511
  }
505
512
  isLastFocusedElementExist() {
506
513
  return !!n(this, M);
507
514
  }
508
515
  }
509
- M = new WeakMap(), B = new WeakMap(), y = new WeakMap(), K = new WeakMap(), Ne = new WeakSet(), ns = function(e, t) {
516
+ M = new WeakMap(), P = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), Oe = new WeakSet(), rs = function(e, t) {
510
517
  if (!e)
511
518
  return;
512
- const s = t.key, o = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), d = Nt(o, this.flattedOptions), u = e.querySelector(".treeselect-list__item-icon");
513
- s === "ArrowLeft" && !d.isClosed && d.isGroup && (u.dispatchEvent(new Event("mousedown")), t.preventDefault()), s === "ArrowRight" && d.isClosed && d.isGroup && (u.dispatchEvent(new Event("mousedown")), t.preventDefault());
514
- }, Oe = new WeakSet(), os = function(e, t) {
519
+ const s = t.key, a = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), d = Pt(a, this.flattedOptions), p = e.querySelector(".treeselect-list__item-icon");
520
+ s === "ArrowLeft" && !d.isClosed && d.isGroup && (p.dispatchEvent(new Event("mousedown")), t.preventDefault()), s === "ArrowRight" && d.isClosed && d.isGroup && (p.dispatchEvent(new Event("mousedown")), t.preventDefault());
521
+ }, Ie = new WeakSet(), cs = function(e, t) {
515
522
  var i;
516
523
  const s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
517
- (o) => window.getComputedStyle(_(o)).display !== "none"
524
+ (a) => window.getComputedStyle(A(a)).display !== "none"
518
525
  );
519
526
  if (s.length)
520
527
  if (!e)
521
- _(s[0]).classList.add("treeselect-list__item--focused");
528
+ A(s[0]).classList.add("treeselect-list__item--focused");
522
529
  else {
523
- const o = s.findIndex(
524
- (P) => _(P).classList.contains("treeselect-list__item--focused")
530
+ const a = s.findIndex(
531
+ (I) => A(I).classList.contains("treeselect-list__item--focused")
525
532
  );
526
- _(s[o]).classList.remove("treeselect-list__item--focused");
527
- const u = t === "ArrowDown" ? o + 1 : o - 1, f = t === "ArrowDown" ? 0 : s.length - 1, C = s[u] ?? s[f], b = !s[u], g = _(C);
533
+ A(s[a]).classList.remove("treeselect-list__item--focused");
534
+ const p = t === "ArrowDown" ? a + 1 : a - 1, f = t === "ArrowDown" ? 0 : s.length - 1, C = s[p] ?? s[f], b = !s[p], g = A(C);
528
535
  g.classList.add("treeselect-list__item--focused");
529
536
  const w = this.srcElement.getBoundingClientRect(), k = g.getBoundingClientRect();
530
537
  if (b && t === "ArrowDown") {
@@ -535,8 +542,8 @@ M = new WeakMap(), B = new WeakMap(), y = new WeakMap(), K = new WeakMap(), Ne =
535
542
  this.srcElement.scroll(0, this.srcElement.scrollHeight);
536
543
  return;
537
544
  }
538
- const O = ((i = this.listSlotHtmlComponent) == null ? void 0 : i.clientHeight) ?? 0;
539
- if (w.y + w.height < k.y + k.height + O) {
545
+ const y = ((i = this.listSlotHtmlComponent) == null ? void 0 : i.clientHeight) ?? 0;
546
+ if (w.y + w.height < k.y + k.height + y) {
540
547
  this.srcElement.scroll(0, this.srcElement.scrollTop + k.height);
541
548
  return;
542
549
  }
@@ -545,199 +552,203 @@ M = new WeakMap(), B = new WeakMap(), y = new WeakMap(), K = new WeakMap(), Ne =
545
552
  return;
546
553
  }
547
554
  }
548
- }, Pe = new WeakSet(), as = function() {
549
- const e = a(this, Be, rs).call(this), t = a(this, X, wt).call(this, this.options);
555
+ }, Pe = new WeakSet(), ds = function() {
556
+ const e = o(this, Be, hs).call(this), t = o(this, K, kt).call(this, this.options);
550
557
  e.append(...t);
551
- const s = a(this, He, us).call(this);
558
+ const s = o(this, Ge, fs).call(this);
552
559
  e.append(s);
553
- const i = a(this, Ie, hs).call(this);
560
+ const i = o(this, He, ms).call(this);
554
561
  return i && e.append(i), e;
555
- }, Be = new WeakSet(), rs = function() {
562
+ }, Be = new WeakSet(), hs = function() {
556
563
  const e = document.createElement("div");
557
- return e.classList.add("treeselect-list"), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => a(this, Ve, cs).call(this, t)), e.addEventListener("mousemove", () => a(this, De, ds).call(this)), e.addEventListener("mouseup", () => this.mouseupCallback(), !0), e;
558
- }, Ve = new WeakSet(), cs = function(e) {
559
- e.stopPropagation(), n(this, M) && n(this, B) && n(this, M).classList.add("treeselect-list__item--focused");
560
- }, De = new WeakSet(), ds = function() {
561
- m(this, B, !0);
562
- }, X = new WeakSet(), wt = function(e) {
564
+ return e.classList.add("treeselect-list"), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => o(this, Ve, us).call(this, t)), e.addEventListener("mousemove", () => o(this, De, ps).call(this)), e.addEventListener("mouseup", () => this.mouseupCallback(), !0), e;
565
+ }, Ve = new WeakSet(), us = function(e) {
566
+ e.stopPropagation(), n(this, M) && n(this, P) && n(this, M).classList.add("treeselect-list__item--focused");
567
+ }, De = new WeakSet(), ps = function() {
568
+ m(this, P, !0);
569
+ }, K = new WeakSet(), kt = function(e) {
563
570
  return e.reduce((t, s) => {
564
- var o;
565
- if ((o = s.children) != null && o.length) {
566
- const d = a(this, Ge, ps).call(this, s), u = a(this, X, wt).call(this, s.children);
567
- return d.append(...u), t.push(d), t;
571
+ var a;
572
+ if ((a = s.children) != null && a.length) {
573
+ const d = o(this, Me, Cs).call(this, s), p = o(this, K, kt).call(this, s.children);
574
+ return d.append(...p), t.push(d), t;
568
575
  }
569
- const i = a(this, J, kt).call(this, s, !1);
576
+ const i = o(this, X, Et).call(this, s, !1);
570
577
  return t.push(i), t;
571
578
  }, []);
572
- }, Ie = new WeakSet(), hs = function() {
579
+ }, He = new WeakSet(), ms = function() {
573
580
  if (!this.listSlotHtmlComponent)
574
581
  return null;
575
582
  const e = document.createElement("div");
576
583
  return e.classList.add("treeselect-list__slot"), e.appendChild(this.listSlotHtmlComponent), e;
577
- }, He = new WeakSet(), us = function() {
584
+ }, Ge = new WeakSet(), fs = function() {
578
585
  const e = document.createElement("div");
579
586
  e.classList.add("treeselect-list__empty"), e.setAttribute("title", this.emptyText);
580
587
  const t = document.createElement("span");
581
- t.classList.add("treeselect-list__empty-icon"), N(this.iconElements.attention, t);
588
+ t.classList.add("treeselect-list__empty-icon"), O(this.iconElements.attention, t);
582
589
  const s = document.createElement("span");
583
590
  return s.classList.add("treeselect-list__empty-text"), s.textContent = this.emptyText, e.append(t, s), e;
584
- }, Ge = new WeakSet(), ps = function(e) {
591
+ }, Me = new WeakSet(), Cs = function(e) {
585
592
  const t = document.createElement("div");
586
593
  t.setAttribute("group-container-id", e.value.toString()), t.classList.add("treeselect-list__group-container");
587
- const s = a(this, J, kt).call(this, e, !0);
594
+ const s = o(this, X, Et).call(this, e, !0);
588
595
  return t.appendChild(s), t;
589
- }, J = new WeakSet(), kt = function(e, t) {
590
- const s = a(this, Me, ms).call(this, e);
596
+ }, X = new WeakSet(), Et = function(e, t) {
597
+ const s = o(this, Fe, bs).call(this, e);
591
598
  if (t) {
592
- const d = a(this, $e, gs).call(this);
599
+ const d = o(this, We, Es).call(this);
593
600
  s.appendChild(d), s.classList.add("treeselect-list__item--group");
594
601
  }
595
- const i = a(this, Re, ks).call(this, e), o = a(this, Ue, Es).call(this, e, t);
596
- return s.append(i, o), s;
597
- }, Me = new WeakSet(), ms = function(e) {
602
+ const i = o(this, Ue, Ls).call(this, e), a = o(this, ze, ys).call(this, e, t);
603
+ return s.append(i, a), s;
604
+ }, Fe = new WeakSet(), bs = function(e) {
598
605
  const t = document.createElement("div");
599
- return vi(t, e.htmlAttr), t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name), t.classList.add("treeselect-list__item"), t.addEventListener("mouseover", () => a(this, Fe, fs).call(this, t), !0), t.addEventListener("mouseout", () => a(this, qe, Cs).call(this, t), !0), t.addEventListener("mousedown", (s) => a(this, je, bs).call(this, s, e)), t;
600
- }, Fe = new WeakSet(), fs = function(e) {
601
- n(this, B) && a(this, Z, Et).call(this, !0, e);
602
- }, qe = new WeakSet(), Cs = function(e) {
603
- n(this, B) && (a(this, Z, Et).call(this, !1, e), m(this, M, e));
604
- }, je = new WeakSet(), bs = function(e, t) {
605
- var o;
606
- if (e.preventDefault(), e.stopPropagation(), (o = this.flattedOptions.find((d) => d.id === t.value)) == null ? void 0 : o.disabled)
606
+ return Ai(t, e.htmlAttr), t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name), t.classList.add("treeselect-list__item"), t.addEventListener("mouseover", () => o(this, qe, gs).call(this, t), !0), t.addEventListener("mouseout", () => o(this, je, ws).call(this, t), !0), t.addEventListener("mousedown", (s) => o(this, $e, ks).call(this, s, e)), t;
607
+ }, qe = new WeakSet(), gs = function(e) {
608
+ n(this, P) && o(this, J, vt).call(this, !0, e);
609
+ }, je = new WeakSet(), ws = function(e) {
610
+ n(this, P) && (o(this, J, vt).call(this, !1, e), m(this, M, e));
611
+ }, $e = new WeakSet(), ks = function(e, t) {
612
+ var a;
613
+ if (e.preventDefault(), e.stopPropagation(), (a = this.flattedOptions.find((d) => d.id === t.value)) == null ? void 0 : a.disabled)
607
614
  return;
608
615
  const i = e.target.querySelector(".treeselect-list__item-checkbox");
609
- i.checked = !i.checked, a(this, Ye, Ls).call(this, i, t);
610
- }, $e = new WeakSet(), gs = function() {
616
+ i.checked = !i.checked, o(this, Ke, Ss).call(this, i, t);
617
+ }, We = new WeakSet(), Es = function() {
611
618
  const e = document.createElement("span");
612
- return e.setAttribute("tabindex", "-1"), e.classList.add("treeselect-list__item-icon"), N(this.iconElements.arrowDown, e), e.addEventListener("mousedown", (t) => a(this, We, ws).call(this, t)), e;
613
- }, We = new WeakSet(), ws = function(e) {
614
- e.preventDefault(), e.stopPropagation(), a(this, Ke, ys).call(this, e);
615
- }, Re = new WeakSet(), ks = function(e) {
619
+ return e.setAttribute("tabindex", "-1"), e.classList.add("treeselect-list__item-icon"), O(this.iconElements.arrowDown, e), e.addEventListener("mousedown", (t) => o(this, Re, vs).call(this, t)), e;
620
+ }, Re = new WeakSet(), vs = function(e) {
621
+ e.preventDefault(), e.stopPropagation(), o(this, Xe, _s).call(this, e);
622
+ }, Ue = new WeakSet(), Ls = function(e) {
616
623
  const t = document.createElement("div");
617
624
  t.classList.add("treeselect-list__item-checkbox-container");
618
625
  const s = document.createElement("span");
619
626
  s.classList.add("treeselect-list__item-checkbox-icon"), s.innerHTML = "";
620
627
  const i = document.createElement("input");
621
628
  return i.setAttribute("tabindex", "-1"), i.setAttribute("type", "checkbox"), i.setAttribute("input-id", e.value.toString()), i.classList.add("treeselect-list__item-checkbox"), t.append(s, i), t;
622
- }, Ue = new WeakSet(), Es = function(e, t) {
629
+ }, ze = new WeakSet(), ys = function(e, t) {
623
630
  const s = document.createElement("label");
624
631
  if (s.textContent = e.name, s.classList.add("treeselect-list__item-label"), t && this.showCount) {
625
- const i = a(this, ze, vs).call(this, e);
632
+ const i = o(this, Ye, xs).call(this, e);
626
633
  s.appendChild(i);
627
634
  }
628
635
  return s;
629
- }, ze = new WeakSet(), vs = function(e) {
636
+ }, Ye = new WeakSet(), xs = function(e) {
630
637
  const t = document.createElement("span"), s = this.flattedOptions.filter((i) => i.childOf === e.value);
631
638
  return t.textContent = `(${s.length})`, t.classList.add("treeselect-list__item-label-counter"), t;
632
- }, Ye = new WeakSet(), Ls = function(e, t) {
639
+ }, Ke = new WeakSet(), Ss = function(e, t) {
633
640
  const s = this.flattedOptions.find((i) => i.id === t.value);
634
641
  if (s) {
635
642
  if (s != null && s.isGroup && this.disabledBranchNode) {
636
- const i = Ei(e);
643
+ const i = _i(e);
637
644
  i == null || i.dispatchEvent(new Event("mousedown"));
638
645
  return;
639
646
  }
640
647
  if (this.isSingleSelect) {
641
- const [i] = n(this, y);
648
+ const [i] = n(this, x);
642
649
  if (s.id === i)
643
650
  return;
644
- m(this, y, [s.id]), Jt([s.id], this.flattedOptions, this.isSingleSelect);
651
+ m(this, x, [s.id]), es([s.id], this.flattedOptions, this.isSingleSelect, this.isIndependentNodes);
645
652
  } else {
646
653
  s.checked = e.checked;
647
- const i = _t(s, this.flattedOptions);
654
+ const i = Nt(s, this.flattedOptions, this.isIndependentNodes);
648
655
  e.checked = i;
649
656
  }
650
- ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), a(this, Xe, xs).call(this);
657
+ ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, x)), o(this, Je, As).call(this);
651
658
  }
652
- }, Ke = new WeakSet(), ys = function(e) {
653
- var o, d;
654
- const t = (d = (o = e.target) == null ? void 0 : o.parentNode) == null ? void 0 : d.querySelector("[input-id]"), s = (t == null ? void 0 : t.getAttribute("input-id")) ?? null, i = Nt(s, this.flattedOptions);
655
- i && (i.isClosed = !i.isClosed, pt(this.flattedOptions, i), ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), this.arrowClickCallback());
656
- }, Z = new WeakSet(), Et = function(e, t) {
659
+ }, Xe = new WeakSet(), _s = function(e) {
660
+ var a, d;
661
+ const t = (d = (a = e.target) == null ? void 0 : a.parentNode) == null ? void 0 : d.querySelector("[input-id]"), s = (t == null ? void 0 : t.getAttribute("input-id")) ?? null, i = Pt(s, this.flattedOptions);
662
+ i && (i.isClosed = !i.isClosed, ft(this.flattedOptions, i), ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, x)), this.arrowClickCallback());
663
+ }, J = new WeakSet(), vt = function(e, t) {
657
664
  const s = "treeselect-list__item--focused";
658
665
  if (e) {
659
666
  const i = Array.from(this.srcElement.querySelectorAll(`.${s}`));
660
- i.length && i.forEach((o) => o.classList.remove(s)), t.classList.add(s);
667
+ i.length && i.forEach((a) => a.classList.remove(s)), t.classList.add(s);
661
668
  } else
662
669
  t.classList.remove(s);
663
- }, Q = new WeakSet(), vt = function() {
664
- const { ungroupedNodes: e, groupedNodes: t } = oi(this.flattedOptions);
665
- this.selectedNodes = { nodes: e, groupedNodes: t };
666
- }, Xe = new WeakSet(), xs = function() {
667
- a(this, Q, vt).call(this), this.inputCallback(this.selectedNodes), this.value = this.selectedNodes.nodes.map((e) => e.id);
670
+ }, Z = new WeakSet(), Lt = function() {
671
+ const { ungroupedNodes: e, groupedNodes: t, allNodes: s } = ui(this.flattedOptions);
672
+ this.selectedNodes = { nodes: e, groupedNodes: t, allNodes: s };
673
+ }, Je = new WeakSet(), As = function() {
674
+ o(this, Z, Lt).call(this), this.inputCallback(this.selectedNodes), this.value = this.selectedNodes.nodes.map((e) => e.id);
668
675
  };
669
- const Ot = ({
676
+ const Bt = ({
670
677
  parentHtmlContainer: l,
671
678
  staticList: e,
672
679
  appendToBody: t,
673
680
  isSingleSelect: s,
674
681
  value: i,
675
- direction: o
682
+ direction: a
676
683
  }) => {
677
- l || console.error("Validation: parentHtmlContainer prop is required!"), e && t && console.error("Validation: You should set staticList to false if you use appendToBody!"), s && Array.isArray(i) && console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"), !s && !Array.isArray(i) && console.error("Validation: you should pass an array as a value!"), o && o !== "auto" && o !== "bottom" && o !== "top" && console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!");
678
- }, Ct = (l) => l.map((e) => e.id), yi = (l) => l ? Array.isArray(l) ? l : [l] : [], xi = (l, e) => {
684
+ l || console.error("Validation: parentHtmlContainer prop is required!"), e && t && console.error("Validation: You should set staticList to false if you use appendToBody!"), s && Array.isArray(i) && console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"), !s && !Array.isArray(i) && console.error("Validation: you should pass an array as a value!"), a && a !== "auto" && a !== "bottom" && a !== "top" && console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!");
685
+ }, re = (l) => l.map((e) => e.id), Ni = (l) => l ? Array.isArray(l) ? l : [l] : [], Oi = (l, e) => {
679
686
  if (e) {
680
687
  const [t] = l;
681
688
  return t ?? null;
682
689
  }
683
690
  return l;
684
691
  };
685
- var h, p, F, ee, q, x, S, L, V, te, Lt, j, re, Je, Ss, Ze, _s, Qe, As, et, Ts, tt, Ns, st, Os, it, Ps, lt, Bs, nt, Vs, ot, Ds, se, yt, at, Is, $, ce, ie, xt, W, de, rt, Hs, le, St, ct, Gs, dt, Ms, ht, Fs;
686
- class _i {
692
+ var h, u, F, Q, q, S, _, L, B, ee, yt, te, xt, Ze, Ts, Qe, Ns, et, Os, tt, Is, st, Ps, it, Bs, se, St, lt, Vs, nt, Ds, at, Hs, ot, Gs, ie, _t, rt, Ms, j, de, le, At, $, he, ct, Fs, ne, Tt, dt, qs, ht, js, ut, $s, pt, Ws;
693
+ class Pi {
687
694
  constructor({
688
695
  parentHtmlContainer: e,
689
696
  value: t,
690
697
  options: s,
691
698
  openLevel: i,
692
- appendToBody: o,
699
+ appendToBody: a,
693
700
  alwaysOpen: d,
694
- showTags: u,
701
+ showTags: p,
695
702
  tagsCountText: f,
696
703
  clearable: C,
697
704
  searchable: b,
698
705
  placeholder: g,
699
706
  grouped: w,
700
707
  isGroupedValue: k,
701
- listSlotHtmlComponent: O,
702
- disabled: P,
703
- emptyText: R,
704
- staticList: ne,
705
- id: mt,
708
+ listSlotHtmlComponent: y,
709
+ disabled: I,
710
+ emptyText: W,
711
+ staticList: ae,
712
+ id: Ct,
706
713
  isSingleSelect: oe,
707
- showCount: qs,
708
- disabledBranchNode: js,
709
- direction: $s,
710
- expandSelected: Ws,
711
- saveScrollPosition: Rs,
712
- iconElements: Us,
713
- inputCallback: zs,
714
- openCallback: Ys,
715
- closeCallback: Ks,
716
- nameChangeCallback: Xs
714
+ showCount: Rs,
715
+ disabledBranchNode: Us,
716
+ direction: zs,
717
+ expandSelected: Ys,
718
+ saveScrollPosition: Ks,
719
+ isIndependentNodes: Xs,
720
+ iconElements: Js,
721
+ inputCallback: Zs,
722
+ openCallback: Qs,
723
+ closeCallback: ei,
724
+ nameChangeCallback: ti,
725
+ searchCallback: si
717
726
  }) {
727
+ r(this, ee);
718
728
  r(this, te);
719
- r(this, j);
720
- r(this, Je);
721
729
  r(this, Ze);
722
730
  r(this, Qe);
723
731
  r(this, et);
724
732
  r(this, tt);
725
733
  r(this, st);
726
734
  r(this, it);
735
+ r(this, se);
727
736
  r(this, lt);
728
737
  r(this, nt);
729
- r(this, ot);
730
- r(this, se);
731
738
  r(this, at);
732
- r(this, $);
739
+ r(this, ot);
733
740
  r(this, ie);
734
- r(this, W);
735
741
  r(this, rt);
736
- // Emits
742
+ r(this, j);
737
743
  r(this, le);
744
+ r(this, $);
738
745
  r(this, ct);
746
+ // Emits
747
+ r(this, ne);
739
748
  r(this, dt);
740
749
  r(this, ht);
750
+ r(this, ut);
751
+ r(this, pt);
741
752
  // Props
742
753
  c(this, "parentHtmlContainer");
743
754
  c(this, "value");
@@ -763,116 +774,118 @@ class _i {
763
774
  c(this, "direction");
764
775
  c(this, "expandSelected");
765
776
  c(this, "saveScrollPosition");
777
+ c(this, "isIndependentNodes");
766
778
  c(this, "iconElements");
767
779
  c(this, "inputCallback");
768
780
  c(this, "openCallback");
769
781
  c(this, "closeCallback");
770
782
  c(this, "nameChangeCallback");
783
+ c(this, "searchCallback");
771
784
  // InnerState
772
785
  c(this, "ungroupedValue");
773
786
  c(this, "groupedValue");
787
+ c(this, "allValue");
774
788
  c(this, "isListOpened");
775
789
  c(this, "selectedName");
776
790
  c(this, "srcElement");
777
791
  // Components
778
792
  r(this, h, null);
779
- r(this, p, null);
793
+ r(this, u, null);
780
794
  // Resize props
781
795
  r(this, F, null);
782
796
  // List position scroll
783
- r(this, ee, 0);
797
+ r(this, Q, 0);
784
798
  // Timer for search text
785
799
  r(this, q, 0);
786
800
  // Outside listeners
787
- r(this, x, null);
788
801
  r(this, S, null);
802
+ r(this, _, null);
789
803
  r(this, L, null);
790
- r(this, V, null);
791
- Ot({
804
+ r(this, B, null);
805
+ Bt({
792
806
  parentHtmlContainer: e,
793
807
  value: t,
794
- staticList: ne,
795
- appendToBody: o,
808
+ staticList: ae,
809
+ appendToBody: a,
796
810
  isSingleSelect: oe
797
- }), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = i ?? 0, this.appendToBody = o ?? !1, this.alwaysOpen = !!(d && !P), this.showTags = u ?? !0, this.tagsCountText = f ?? "elements selected", this.clearable = C ?? !0, this.searchable = b ?? !0, this.placeholder = g ?? "Search...", this.grouped = w ?? !0, this.isGroupedValue = k ?? !1, this.listSlotHtmlComponent = O ?? null, this.disabled = P ?? !1, this.emptyText = R ?? "No results found...", this.staticList = !!(ne && !this.appendToBody), this.id = mt ?? "", this.isSingleSelect = oe ?? !1, this.showCount = qs ?? !1, this.disabledBranchNode = js ?? !1, this.direction = $s ?? "auto", this.expandSelected = Ws ?? !1, this.saveScrollPosition = Rs ?? !0, this.iconElements = Tt(Us), this.inputCallback = zs, this.openCallback = Ys, this.closeCallback = Ks, this.nameChangeCallback = Xs, this.ungroupedValue = [], this.groupedValue = [], this.isListOpened = !1, this.selectedName = "", this.srcElement = null, a(this, te, Lt).call(this, t);
811
+ }), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = i ?? 0, this.appendToBody = a ?? !1, this.alwaysOpen = !!(d && !I), this.showTags = p ?? !0, this.tagsCountText = f ?? "elements selected", this.clearable = C ?? !0, this.searchable = b ?? !0, this.placeholder = g ?? "Search...", this.grouped = w ?? !0, this.isGroupedValue = k ?? !1, this.listSlotHtmlComponent = y ?? null, this.disabled = I ?? !1, this.emptyText = W ?? "No results found...", this.staticList = !!(ae && !this.appendToBody), this.id = Ct ?? "", this.isSingleSelect = oe ?? !1, this.showCount = Rs ?? !1, this.disabledBranchNode = Us ?? !1, this.direction = zs ?? "auto", this.expandSelected = Ys ?? !1, this.saveScrollPosition = Ks ?? !0, this.isIndependentNodes = Xs ?? !1, this.iconElements = It(Js), this.inputCallback = Zs, this.openCallback = Qs, this.closeCallback = ei, this.nameChangeCallback = ti, this.searchCallback = si, this.ungroupedValue = [], this.groupedValue = [], this.allValue = [], this.isListOpened = !1, this.selectedName = "", this.srcElement = null, o(this, ee, yt).call(this, t);
798
812
  }
799
813
  mount() {
800
- Ot({
814
+ Bt({
801
815
  parentHtmlContainer: this.parentHtmlContainer,
802
816
  value: this.value,
803
817
  staticList: this.staticList,
804
818
  appendToBody: this.appendToBody,
805
819
  isSingleSelect: this.isSingleSelect
806
- }), this.iconElements = Tt(this.iconElements), a(this, te, Lt).call(this, this.value);
820
+ }), this.iconElements = It(this.iconElements), o(this, ee, yt).call(this, this.value);
807
821
  }
808
822
  updateValue(e) {
809
- var s;
810
- const t = n(this, h);
811
- if (t) {
812
- const i = yi(e);
813
- t.updateValue(i);
814
- const { groupedNodes: o, nodes: d } = t.selectedNodes, u = this.grouped || this.isSingleSelect ? o : d;
815
- (s = n(this, p)) == null || s.updateValue(u), a(this, j, re).call(this, { groupedNodes: o, nodes: d });
816
- }
823
+ const t = Ni(e), s = n(this, h);
824
+ s && (s.updateValue(t), o(this, se, St).call(this, s == null ? void 0 : s.selectedNodes));
817
825
  }
818
826
  destroy() {
819
- this.srcElement && (a(this, se, yt).call(this), this.srcElement.innerHTML = "", this.srcElement = null, a(this, W, de).call(this, !0));
827
+ this.srcElement && (o(this, ie, _t).call(this), this.srcElement.innerHTML = "", this.srcElement = null, o(this, $, he).call(this, !0));
820
828
  }
821
829
  focus() {
822
- n(this, p) && n(this, p).focus();
830
+ n(this, u) && n(this, u).focus();
823
831
  }
824
832
  toggleOpenClose() {
825
- n(this, p) && (n(this, p).openClose(), n(this, p).focus());
833
+ n(this, u) && (n(this, u).openClose(), n(this, u).focus());
826
834
  }
827
835
  // Outside Listeners
828
836
  scrollWindowHandler() {
829
837
  this.updateListPosition();
830
838
  }
831
839
  focusWindowHandler(e) {
832
- var s, i, o;
833
- ((s = this.srcElement) == null ? void 0 : s.contains(e.target)) || ((i = n(this, h)) == null ? void 0 : i.srcElement.contains(e.target)) || ((o = n(this, p)) == null || o.blur(), a(this, W, de).call(this, !1), a(this, $, ce).call(this, !1));
840
+ var s, i, a;
841
+ ((s = this.srcElement) == null ? void 0 : s.contains(e.target)) || ((i = n(this, h)) == null ? void 0 : i.srcElement.contains(e.target)) || ((a = n(this, u)) == null || a.blur(), o(this, $, he).call(this, !1), o(this, j, de).call(this, !1));
834
842
  }
835
843
  blurWindowHandler() {
836
844
  var e;
837
- (e = n(this, p)) == null || e.blur(), a(this, W, de).call(this, !1), a(this, $, ce).call(this, !1);
845
+ (e = n(this, u)) == null || e.blur(), o(this, $, he).call(this, !1), o(this, j, de).call(this, !1);
838
846
  }
839
847
  // Update direction of the list. Support appendToBody and standard mode with absolute
840
848
  updateListPosition() {
841
- var O;
842
- const e = this.srcElement, t = (O = n(this, h)) == null ? void 0 : O.srcElement;
849
+ var y;
850
+ const e = this.srcElement, t = (y = n(this, h)) == null ? void 0 : y.srcElement;
843
851
  if (!e || !t)
844
852
  return;
845
853
  const { height: s } = t.getBoundingClientRect(), {
846
854
  x: i,
847
- y: o,
855
+ y: a,
848
856
  height: d,
849
- width: u
850
- } = e.getBoundingClientRect(), f = window.innerHeight, C = o, b = f - o - d;
857
+ width: p
858
+ } = e.getBoundingClientRect(), f = window.innerHeight, C = a, b = f - a - d;
851
859
  let g = C > b && C >= s && b < s;
852
860
  if (this.direction !== "auto" && (g = this.direction === "top"), this.appendToBody) {
853
861
  (t.style.top !== "0px" || t.style.left !== "0px") && (t.style.top = "0px", t.style.left = "0px");
854
- const P = i + window.scrollX, R = g ? o + window.scrollY - s : o + window.scrollY + d;
855
- t.style.transform = `translate(${P}px,${R}px)`, t.style.width = `${u}px`;
862
+ const I = i + window.scrollX, W = g ? a + window.scrollY - s : a + window.scrollY + d;
863
+ t.style.transform = `translate(${I}px,${W}px)`, t.style.width = `${p}px`;
856
864
  }
857
865
  const w = g ? "top" : "bottom";
858
- t.getAttribute("direction") !== w && (t.setAttribute("direction", w), a(this, at, Is).call(this, g, this.appendToBody));
866
+ t.getAttribute("direction") !== w && (t.setAttribute("direction", w), o(this, rt, Ms).call(this, g, this.appendToBody));
859
867
  }
860
868
  }
861
- h = new WeakMap(), p = new WeakMap(), F = new WeakMap(), ee = new WeakMap(), q = new WeakMap(), x = new WeakMap(), S = new WeakMap(), L = new WeakMap(), V = new WeakMap(), te = new WeakSet(), Lt = function(e) {
862
- var o;
869
+ h = new WeakMap(), u = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), q = new WeakMap(), S = new WeakMap(), _ = new WeakMap(), L = new WeakMap(), B = new WeakMap(), ee = new WeakSet(), yt = function(e) {
870
+ var a;
863
871
  this.destroy();
864
- const { container: t, list: s, input: i } = a(this, Je, Ss).call(this);
865
- this.srcElement = t, m(this, h, s), m(this, p, i), m(this, x, this.scrollWindowHandler.bind(this)), m(this, S, this.scrollWindowHandler.bind(this)), m(this, L, this.focusWindowHandler.bind(this)), m(this, V, this.blurWindowHandler.bind(this)), this.alwaysOpen && ((o = n(this, p)) == null || o.openClose()), this.disabled ? this.srcElement.classList.add("treeselect--disabled") : this.srcElement.classList.remove("treeselect--disabled"), this.updateValue(e ?? this.value);
866
- }, j = new WeakSet(), re = function({ groupedNodes: e, nodes: t }) {
867
- this.ungroupedValue = t ? Ct(t) : [], this.groupedValue = e ? Ct(e) : [];
868
- const s = this.isGroupedValue || this.isSingleSelect ? this.groupedValue : this.ungroupedValue;
869
- this.value = xi(s, this.isSingleSelect);
870
- }, Je = new WeakSet(), Ss = function() {
872
+ const { container: t, list: s, input: i } = o(this, Ze, Ts).call(this);
873
+ this.srcElement = t, m(this, h, s), m(this, u, i), m(this, S, this.scrollWindowHandler.bind(this)), m(this, _, this.scrollWindowHandler.bind(this)), m(this, L, this.focusWindowHandler.bind(this)), m(this, B, this.blurWindowHandler.bind(this)), this.alwaysOpen && ((a = n(this, u)) == null || a.openClose()), this.disabled ? this.srcElement.classList.add("treeselect--disabled") : this.srcElement.classList.remove("treeselect--disabled"), this.updateValue(e ?? this.value);
874
+ }, te = new WeakSet(), xt = function({
875
+ groupedNodes: e,
876
+ nodes: t,
877
+ allNodes: s
878
+ }) {
879
+ this.ungroupedValue = t ? re(t) : [], this.groupedValue = e ? re(e) : [], this.allValue = s ? re(s) : [];
880
+ let i = [];
881
+ this.isIndependentNodes || this.isSingleSelect ? i = this.allValue : this.isGroupedValue ? i = this.groupedValue : i = this.ungroupedValue, this.value = Oi(i, this.isSingleSelect);
882
+ }, Ze = new WeakSet(), Ts = function() {
871
883
  const e = this.parentHtmlContainer;
872
884
  e.classList.add("treeselect");
873
- const t = new Li({
885
+ const t = new Ti({
886
+ value: [],
887
+ // updateValue method calls in initMount method to set actual value
874
888
  options: this.options,
875
- value: this.ungroupedValue,
876
889
  openLevel: this.openLevel,
877
890
  listSlotHtmlComponent: this.listSlotHtmlComponent,
878
891
  emptyText: this.emptyText,
@@ -880,15 +893,17 @@ h = new WeakMap(), p = new WeakMap(), F = new WeakMap(), ee = new WeakMap(), q =
880
893
  showCount: this.showCount,
881
894
  disabledBranchNode: this.disabledBranchNode,
882
895
  expandSelected: this.expandSelected,
896
+ isIndependentNodes: this.isIndependentNodes,
883
897
  iconElements: this.iconElements,
884
- inputCallback: (d) => a(this, it, Ps).call(this, d),
885
- arrowClickCallback: () => a(this, lt, Bs).call(this),
898
+ inputCallback: (i) => o(this, lt, Vs).call(this, i),
899
+ arrowClickCallback: () => o(this, nt, Ds).call(this),
886
900
  mouseupCallback: () => {
887
- var d;
888
- return (d = n(this, p)) == null ? void 0 : d.focus();
901
+ var i;
902
+ return (i = n(this, u)) == null ? void 0 : i.focus();
889
903
  }
890
- }), { groupedNodes: s, nodes: i } = t.selectedNodes, o = new ei({
891
- value: this.grouped || this.isSingleSelect ? s : i,
904
+ }), s = new ai({
905
+ value: [],
906
+ // updateValue method calls in initMount method to set actual value
892
907
  showTags: this.showTags,
893
908
  tagsCountText: this.tagsCountText,
894
909
  clearable: this.clearable,
@@ -899,82 +914,91 @@ h = new WeakMap(), p = new WeakMap(), F = new WeakMap(), ee = new WeakMap(), q =
899
914
  isSingleSelect: this.isSingleSelect,
900
915
  id: this.id,
901
916
  iconElements: this.iconElements,
902
- inputCallback: (d) => a(this, Ze, _s).call(this, d),
903
- searchCallback: (d) => a(this, et, Ts).call(this, d),
904
- openCallback: () => a(this, ot, Ds).call(this),
905
- closeCallback: () => a(this, se, yt).call(this),
906
- keydownCallback: (d) => a(this, Qe, As).call(this, d),
907
- focusCallback: () => a(this, tt, Ns).call(this),
908
- blurCallback: () => a(this, st, Os).call(this),
909
- nameChangeCallback: (d) => a(this, nt, Vs).call(this, d)
917
+ inputCallback: (i) => o(this, Qe, Ns).call(this, i),
918
+ searchCallback: (i) => o(this, tt, Is).call(this, i),
919
+ openCallback: () => o(this, ot, Gs).call(this),
920
+ closeCallback: () => o(this, ie, _t).call(this),
921
+ keydownCallback: (i) => o(this, et, Os).call(this, i),
922
+ focusCallback: () => o(this, st, Ps).call(this),
923
+ blurCallback: () => o(this, it, Bs).call(this),
924
+ nameChangeCallback: (i) => o(this, at, Hs).call(this, i)
910
925
  });
911
- return this.appendToBody && m(this, F, new ResizeObserver(() => this.updateListPosition())), e.append(o.srcElement), { container: e, list: t, input: o };
912
- }, Ze = new WeakSet(), _s = function(e) {
913
- var o, d, u, f, C;
914
- const t = Ct(e);
915
- (o = n(this, h)) == null || o.updateValue(t);
916
- const s = (u = (d = n(this, h)) == null ? void 0 : d.selectedNodes) == null ? void 0 : u.nodes, i = (C = (f = n(this, h)) == null ? void 0 : f.selectedNodes) == null ? void 0 : C.groupedNodes;
917
- a(this, j, re).call(this, { groupedNodes: i, nodes: s }), a(this, le, St).call(this);
918
- }, Qe = new WeakSet(), As = function(e) {
926
+ return this.appendToBody && m(this, F, new ResizeObserver(() => this.updateListPosition())), e.append(s.srcElement), { container: e, list: t, input: s };
927
+ }, Qe = new WeakSet(), Ns = function(e) {
928
+ var i, a;
929
+ const t = re(e);
930
+ (i = n(this, h)) == null || i.updateValue(t);
931
+ const s = ((a = n(this, h)) == null ? void 0 : a.selectedNodes) ?? {};
932
+ o(this, te, xt).call(this, s), o(this, ne, Tt).call(this);
933
+ }, et = new WeakSet(), Os = function(e) {
919
934
  var t;
920
935
  this.isListOpened && ((t = n(this, h)) == null || t.callKeyAction(e));
921
- }, et = new WeakSet(), Ts = function(e) {
922
- n(this, q) && clearTimeout(n(this, q)), m(this, q, setTimeout(() => {
936
+ }, tt = new WeakSet(), Is = function(e) {
937
+ n(this, q) && clearTimeout(n(this, q)), m(this, q, window.setTimeout(() => {
923
938
  var t;
924
939
  (t = n(this, h)) == null || t.updateSearchValue(e), this.updateListPosition();
925
- }, 350));
926
- }, tt = new WeakSet(), Ns = function() {
927
- a(this, $, ce).call(this, !0), n(this, L) && n(this, L) && n(this, V) && (document.addEventListener("mousedown", n(this, L), !0), document.addEventListener("focus", n(this, L), !0), window.addEventListener("blur", n(this, V)));
928
- }, st = new WeakSet(), Os = function() {
940
+ }, 350)), o(this, pt, Ws).call(this, e);
941
+ }, st = new WeakSet(), Ps = function() {
942
+ o(this, j, de).call(this, !0), n(this, L) && n(this, L) && n(this, B) && (document.addEventListener("mousedown", n(this, L), !0), document.addEventListener("focus", n(this, L), !0), window.addEventListener("blur", n(this, B)));
943
+ }, it = new WeakSet(), Bs = function() {
929
944
  setTimeout(() => {
930
945
  var s, i;
931
- const e = (s = n(this, p)) == null ? void 0 : s.srcElement.contains(document.activeElement), t = (i = n(this, h)) == null ? void 0 : i.srcElement.contains(document.activeElement);
946
+ const e = (s = n(this, u)) == null ? void 0 : s.srcElement.contains(document.activeElement), t = (i = n(this, h)) == null ? void 0 : i.srcElement.contains(document.activeElement);
932
947
  !e && !t && this.blurWindowHandler();
933
948
  }, 1);
934
- }, it = new WeakSet(), Ps = function(e) {
935
- var o, d, u, f;
936
- const { groupedNodes: t, nodes: s } = e, i = this.grouped || this.isSingleSelect ? t : s;
937
- (o = n(this, p)) == null || o.updateValue(i), a(this, j, re).call(this, { groupedNodes: t, nodes: s }), this.isSingleSelect && !this.alwaysOpen && ((d = n(this, p)) == null || d.openClose(), (u = n(this, p)) == null || u.clearSearch()), (f = n(this, p)) == null || f.focus(), a(this, le, St).call(this);
938
- }, lt = new WeakSet(), Bs = function() {
949
+ }, se = new WeakSet(), St = function(e) {
950
+ var s;
951
+ if (!e)
952
+ return;
953
+ let t = [];
954
+ this.isIndependentNodes || this.isSingleSelect ? t = e.allNodes : this.grouped ? t = e.groupedNodes : t = e.nodes, (s = n(this, u)) == null || s.updateValue(t), o(this, te, xt).call(this, e);
955
+ }, lt = new WeakSet(), Vs = function(e) {
956
+ var t, s, i;
957
+ o(this, se, St).call(this, e), this.isSingleSelect && !this.alwaysOpen && ((t = n(this, u)) == null || t.openClose(), (s = n(this, u)) == null || s.clearSearch()), (i = n(this, u)) == null || i.focus(), o(this, ne, Tt).call(this);
958
+ }, nt = new WeakSet(), Ds = function() {
939
959
  var e;
940
- (e = n(this, p)) == null || e.focus(), this.updateListPosition();
941
- }, nt = new WeakSet(), Vs = function(e) {
942
- this.selectedName !== e && (this.selectedName = e, a(this, ct, Gs).call(this));
943
- }, ot = new WeakSet(), Ds = function() {
960
+ (e = n(this, u)) == null || e.focus(), this.updateListPosition();
961
+ }, at = new WeakSet(), Hs = function(e) {
962
+ this.selectedName !== e && (this.selectedName = e, o(this, dt, qs).call(this));
963
+ }, ot = new WeakSet(), Gs = function() {
944
964
  var e;
945
- this.isListOpened = !0, n(this, x) && n(this, S) && (window.addEventListener("scroll", n(this, x), !0), window.addEventListener("resize", n(this, S))), !(!n(this, h) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, h).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, h).srcElement), this.updateListPosition(), a(this, ie, xt).call(this, !0), a(this, rt, Hs).call(this), a(this, dt, Ms).call(this));
946
- }, se = new WeakSet(), yt = function() {
965
+ this.isListOpened = !0, n(this, S) && n(this, _) && (window.addEventListener("scroll", n(this, S), !0), window.addEventListener("resize", n(this, _))), !(!n(this, h) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, h).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, h).srcElement), this.updateListPosition(), o(this, le, At).call(this, !0), o(this, ct, Fs).call(this), o(this, ht, js).call(this));
966
+ }, ie = new WeakSet(), _t = function() {
947
967
  var t;
948
- this.alwaysOpen || (this.isListOpened = !1, n(this, x) && n(this, S) && (window.removeEventListener("scroll", n(this, x), !0), window.removeEventListener("resize", n(this, S))), !n(this, h) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, h).srcElement) : this.srcElement.contains(n(this, h).srcElement)) || (m(this, ee, n(this, h).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, h).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, h).srcElement), a(this, ie, xt).call(this, !1), a(this, ht, Fs).call(this));
949
- }, at = new WeakSet(), Is = function(e, t) {
950
- if (!n(this, h) || !n(this, p))
968
+ this.alwaysOpen || (this.isListOpened = !1, n(this, S) && n(this, _) && (window.removeEventListener("scroll", n(this, S), !0), window.removeEventListener("resize", n(this, _))), !n(this, h) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, h).srcElement) : this.srcElement.contains(n(this, h).srcElement)) || (m(this, Q, n(this, h).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, h).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, h).srcElement), o(this, le, At).call(this, !1), o(this, ut, $s).call(this));
969
+ }, rt = new WeakSet(), Ms = function(e, t) {
970
+ if (!n(this, h) || !n(this, u))
951
971
  return;
952
972
  const s = t ? "treeselect-list--top-to-body" : "treeselect-list--top", i = t ? "treeselect-list--bottom-to-body" : "treeselect-list--bottom";
953
- e ? (n(this, h).srcElement.classList.add(s), n(this, h).srcElement.classList.remove(i), n(this, p).srcElement.classList.add("treeselect-input--top"), n(this, p).srcElement.classList.remove("treeselect-input--bottom")) : (n(this, h).srcElement.classList.remove(s), n(this, h).srcElement.classList.add(i), n(this, p).srcElement.classList.remove("treeselect-input--top"), n(this, p).srcElement.classList.add("treeselect-input--bottom"));
954
- }, $ = new WeakSet(), ce = function(e) {
955
- !n(this, p) || !n(this, h) || (e ? (n(this, p).srcElement.classList.add("treeselect-input--focused"), n(this, h).srcElement.classList.add("treeselect-list--focused")) : (n(this, p).srcElement.classList.remove("treeselect-input--focused"), n(this, h).srcElement.classList.remove("treeselect-list--focused")));
956
- }, ie = new WeakSet(), xt = function(e) {
957
- var t, s, i, o;
958
- e ? (t = n(this, p)) == null || t.srcElement.classList.add("treeselect-input--opened") : (s = n(this, p)) == null || s.srcElement.classList.remove("treeselect-input--opened"), this.staticList ? (i = n(this, h)) == null || i.srcElement.classList.add("treeselect-list--static") : (o = n(this, h)) == null || o.srcElement.classList.remove("treeselect-list--static");
959
- }, W = new WeakSet(), de = function(e) {
960
- !n(this, x) || !n(this, S) || !n(this, L) || !n(this, V) || ((!this.alwaysOpen || e) && (window.removeEventListener("scroll", n(this, x), !0), window.removeEventListener("resize", n(this, S))), document.removeEventListener("mousedown", n(this, L), !0), document.removeEventListener("focus", n(this, L), !0), window.removeEventListener("blur", n(this, V)));
961
- }, rt = new WeakSet(), Hs = function() {
973
+ e ? (n(this, h).srcElement.classList.add(s), n(this, h).srcElement.classList.remove(i), n(this, u).srcElement.classList.add("treeselect-input--top"), n(this, u).srcElement.classList.remove("treeselect-input--bottom")) : (n(this, h).srcElement.classList.remove(s), n(this, h).srcElement.classList.add(i), n(this, u).srcElement.classList.remove("treeselect-input--top"), n(this, u).srcElement.classList.add("treeselect-input--bottom"));
974
+ }, j = new WeakSet(), de = function(e) {
975
+ !n(this, u) || !n(this, h) || (e ? (n(this, u).srcElement.classList.add("treeselect-input--focused"), n(this, h).srcElement.classList.add("treeselect-list--focused")) : (n(this, u).srcElement.classList.remove("treeselect-input--focused"), n(this, h).srcElement.classList.remove("treeselect-list--focused")));
976
+ }, le = new WeakSet(), At = function(e) {
977
+ var t, s, i, a;
978
+ e ? (t = n(this, u)) == null || t.srcElement.classList.add("treeselect-input--opened") : (s = n(this, u)) == null || s.srcElement.classList.remove("treeselect-input--opened"), this.staticList ? (i = n(this, h)) == null || i.srcElement.classList.add("treeselect-list--static") : (a = n(this, h)) == null || a.srcElement.classList.remove("treeselect-list--static");
979
+ }, $ = new WeakSet(), he = function(e) {
980
+ !n(this, S) || !n(this, _) || !n(this, L) || !n(this, B) || ((!this.alwaysOpen || e) && (window.removeEventListener("scroll", n(this, S), !0), window.removeEventListener("resize", n(this, _))), document.removeEventListener("mousedown", n(this, L), !0), document.removeEventListener("focus", n(this, L), !0), window.removeEventListener("blur", n(this, B)));
981
+ }, ct = new WeakSet(), Fs = function() {
962
982
  var t, s, i;
963
983
  const e = (t = n(this, h)) == null ? void 0 : t.isLastFocusedElementExist();
964
- this.saveScrollPosition && e ? (s = n(this, h)) == null || s.srcElement.scroll(0, n(this, ee)) : (i = n(this, h)) == null || i.focusFirstListElement();
965
- }, le = new WeakSet(), St = function() {
984
+ this.saveScrollPosition && e ? (s = n(this, h)) == null || s.srcElement.scroll(0, n(this, Q)) : (i = n(this, h)) == null || i.focusFirstListElement();
985
+ }, ne = new WeakSet(), Tt = function() {
966
986
  var e;
967
987
  (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("input", { detail: this.value })), this.inputCallback && this.inputCallback(this.value);
968
- }, ct = new WeakSet(), Gs = function() {
988
+ }, dt = new WeakSet(), qs = function() {
969
989
  var e;
970
990
  (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("name-change", { detail: this.selectedName })), this.nameChangeCallback && this.nameChangeCallback(this.selectedName);
971
- }, dt = new WeakSet(), Ms = function() {
991
+ }, ht = new WeakSet(), js = function() {
972
992
  var e;
973
993
  this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("open", { detail: this.value })), this.openCallback && this.openCallback(this.value));
974
- }, ht = new WeakSet(), Fs = function() {
994
+ }, ut = new WeakSet(), $s = function() {
975
995
  var e;
976
996
  this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("close", { detail: this.value })), this.closeCallback && this.closeCallback(this.value));
997
+ }, pt = new WeakSet(), Ws = function(e) {
998
+ var s;
999
+ const t = (e == null ? void 0 : e.trim()) ?? "";
1000
+ (s = this.srcElement) == null || s.dispatchEvent(new CustomEvent("search", { detail: t })), this.searchCallback && this.searchCallback(t);
977
1001
  };
978
1002
  export {
979
- _i as default
1003
+ Pi as default
980
1004
  };