slim-select 3.3.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- import re, { forwardRef as oe, useRef as I, useImperativeHandle as ce, useEffect as Y } from "react";
2
- var V = { exports: {} }, R = {};
1
+ import re, { forwardRef as oe, useRef as I, useImperativeHandle as ce, useEffect as $ } from "react";
2
+ var V = { exports: {} }, M = {};
3
3
  var ee;
4
4
  function he() {
5
- if (ee) return R;
5
+ if (ee) return M;
6
6
  ee = 1;
7
- var p = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
7
+ var p = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
8
8
  function t(s, i, n) {
9
9
  var r = null;
10
10
  if (n !== void 0 && (r = "" + n), i.key !== void 0 && (r = "" + i.key), "key" in i) {
11
11
  n = {};
12
- for (var a in i)
13
- a !== "key" && (n[a] = i[a]);
12
+ for (var l in i)
13
+ l !== "key" && (n[l] = i[l]);
14
14
  } else n = i;
15
15
  return i = n.ref, {
16
16
  $$typeof: p,
@@ -20,18 +20,18 @@ function he() {
20
20
  props: n
21
21
  };
22
22
  }
23
- return R.Fragment = e, R.jsx = t, R.jsxs = t, R;
23
+ return M.Fragment = e, M.jsx = t, M.jsxs = t, M;
24
24
  }
25
25
  var _ = {};
26
26
  var te;
27
27
  function de() {
28
- return te || (te = 1, process.env.NODE_ENV !== "production" && function() {
29
- function p(l) {
30
- if (l == null) return null;
31
- if (typeof l == "function")
32
- return l.$$typeof === ne ? null : l.displayName || l.name || null;
33
- if (typeof l == "string") return l;
34
- switch (l) {
28
+ return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function p(a) {
30
+ if (a == null) return null;
31
+ if (typeof a == "function")
32
+ return a.$$typeof === ne ? null : a.displayName || a.name || null;
33
+ if (typeof a == "string") return a;
34
+ switch (a) {
35
35
  case A:
36
36
  return "Fragment";
37
37
  case v:
@@ -42,130 +42,130 @@ function de() {
42
42
  return "Suspense";
43
43
  case P:
44
44
  return "SuspenseList";
45
- case M:
45
+ case R:
46
46
  return "Activity";
47
47
  }
48
- if (typeof l == "object")
49
- switch (typeof l.tag == "number" && console.error(
48
+ if (typeof a == "object")
49
+ switch (typeof a.tag == "number" && console.error(
50
50
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
- ), l.$$typeof) {
52
- case m:
51
+ ), a.$$typeof) {
52
+ case g:
53
53
  return "Portal";
54
54
  case L:
55
- return l.displayName || "Context";
55
+ return a.displayName || "Context";
56
56
  case k:
57
- return (l._context.displayName || "Context") + ".Consumer";
57
+ return (a._context.displayName || "Context") + ".Consumer";
58
58
  case b:
59
- var u = l.render;
60
- return l = l.displayName, l || (l = u.displayName || u.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l;
59
+ var u = a.render;
60
+ return a = a.displayName, a || (a = u.displayName || u.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
61
61
  case B:
62
- return u = l.displayName || null, u !== null ? u : p(l.type) || "Memo";
62
+ return u = a.displayName || null, u !== null ? u : p(a.type) || "Memo";
63
63
  case T:
64
- u = l._payload, l = l._init;
64
+ u = a._payload, a = a._init;
65
65
  try {
66
- return p(l(u));
66
+ return p(a(u));
67
67
  } catch {
68
68
  }
69
69
  }
70
70
  return null;
71
71
  }
72
- function e(l) {
73
- return "" + l;
72
+ function e(a) {
73
+ return "" + a;
74
74
  }
75
- function t(l) {
75
+ function t(a) {
76
76
  try {
77
- e(l);
77
+ e(a);
78
78
  var u = !1;
79
79
  } catch {
80
80
  u = !0;
81
81
  }
82
82
  if (u) {
83
83
  u = console;
84
- var C = u.error, O = typeof Symbol == "function" && Symbol.toStringTag && l[Symbol.toStringTag] || l.constructor.name || "Object";
84
+ var C = u.error, O = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
85
85
  return C.call(
86
86
  u,
87
87
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
88
  O
89
- ), e(l);
89
+ ), e(a);
90
90
  }
91
91
  }
92
- function s(l) {
93
- if (l === A) return "<>";
94
- if (typeof l == "object" && l !== null && l.$$typeof === T)
92
+ function s(a) {
93
+ if (a === A) return "<>";
94
+ if (typeof a == "object" && a !== null && a.$$typeof === T)
95
95
  return "<...>";
96
96
  try {
97
- var u = p(l);
97
+ var u = p(a);
98
98
  return u ? "<" + u + ">" : "<...>";
99
99
  } catch {
100
100
  return "<...>";
101
101
  }
102
102
  }
103
103
  function i() {
104
- var l = j.A;
105
- return l === null ? null : l.getOwner();
104
+ var a = j.A;
105
+ return a === null ? null : a.getOwner();
106
106
  }
107
107
  function n() {
108
108
  return Error("react-stack-top-frame");
109
109
  }
110
- function r(l) {
111
- if (J.call(l, "key")) {
112
- var u = Object.getOwnPropertyDescriptor(l, "key").get;
110
+ function r(a) {
111
+ if (J.call(a, "key")) {
112
+ var u = Object.getOwnPropertyDescriptor(a, "key").get;
113
113
  if (u && u.isReactWarning) return !1;
114
114
  }
115
- return l.key !== void 0;
115
+ return a.key !== void 0;
116
116
  }
117
- function a(l, u) {
117
+ function l(a, u) {
118
118
  function C() {
119
119
  G || (G = !0, console.error(
120
120
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
121
121
  u
122
122
  ));
123
123
  }
124
- C.isReactWarning = !0, Object.defineProperty(l, "key", {
124
+ C.isReactWarning = !0, Object.defineProperty(a, "key", {
125
125
  get: C,
126
126
  configurable: !0
127
127
  });
128
128
  }
129
129
  function c() {
130
- var l = p(this.type);
131
- return X[l] || (X[l] = !0, console.error(
130
+ var a = p(this.type);
131
+ return X[a] || (X[a] = !0, console.error(
132
132
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
- )), l = this.props.ref, l !== void 0 ? l : null;
133
+ )), a = this.props.ref, a !== void 0 ? a : null;
134
134
  }
135
- function h(l, u, C, O, F, q) {
135
+ function h(a, u, C, O, F, U) {
136
136
  var y = C.ref;
137
- return l = {
137
+ return a = {
138
138
  $$typeof: E,
139
- type: l,
139
+ type: a,
140
140
  key: u,
141
141
  props: C,
142
142
  _owner: O
143
- }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(l, "ref", {
143
+ }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(a, "ref", {
144
144
  enumerable: !1,
145
145
  get: c
146
- }) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", {
146
+ }) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
147
147
  configurable: !1,
148
148
  enumerable: !1,
149
149
  writable: !0,
150
150
  value: 0
151
- }), Object.defineProperty(l, "_debugInfo", {
151
+ }), Object.defineProperty(a, "_debugInfo", {
152
152
  configurable: !1,
153
153
  enumerable: !1,
154
154
  writable: !0,
155
155
  value: null
156
- }), Object.defineProperty(l, "_debugStack", {
156
+ }), Object.defineProperty(a, "_debugStack", {
157
157
  configurable: !1,
158
158
  enumerable: !1,
159
159
  writable: !0,
160
160
  value: F
161
- }), Object.defineProperty(l, "_debugTask", {
161
+ }), Object.defineProperty(a, "_debugTask", {
162
162
  configurable: !1,
163
163
  enumerable: !1,
164
164
  writable: !0,
165
- value: q
166
- }), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
165
+ value: U
166
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
167
167
  }
168
- function o(l, u, C, O, F, q) {
168
+ function o(a, u, C, O, F, U) {
169
169
  var y = u.children;
170
170
  if (y !== void 0)
171
171
  if (O)
@@ -179,7 +179,7 @@ function de() {
179
179
  );
180
180
  else d(y);
181
181
  if (J.call(u, "key")) {
182
- y = p(l);
182
+ y = p(a);
183
183
  var N = Object.keys(u).filter(function(ae) {
184
184
  return ae !== "key";
185
185
  });
@@ -198,61 +198,61 @@ React keys must be passed directly to JSX without using spread:
198
198
  }
199
199
  if (y = null, C !== void 0 && (t(C), y = "" + C), r(u) && (t(u.key), y = "" + u.key), "key" in u) {
200
200
  C = {};
201
- for (var $ in u)
202
- $ !== "key" && (C[$] = u[$]);
201
+ for (var W in u)
202
+ W !== "key" && (C[W] = u[W]);
203
203
  } else C = u;
204
- return y && a(
204
+ return y && l(
205
205
  C,
206
- typeof l == "function" ? l.displayName || l.name || "Unknown" : l
206
+ typeof a == "function" ? a.displayName || a.name || "Unknown" : a
207
207
  ), h(
208
- l,
208
+ a,
209
209
  y,
210
210
  C,
211
211
  i(),
212
212
  F,
213
- q
213
+ U
214
214
  );
215
215
  }
216
- function d(l) {
217
- g(l) ? l._store && (l._store.validated = 1) : typeof l == "object" && l !== null && l.$$typeof === T && (l._payload.status === "fulfilled" ? g(l._payload.value) && l._payload.value._store && (l._payload.value._store.validated = 1) : l._store && (l._store.validated = 1));
216
+ function d(a) {
217
+ m(a) ? a._store && (a._store.validated = 1) : typeof a == "object" && a !== null && a.$$typeof === T && (a._payload.status === "fulfilled" ? m(a._payload.value) && a._payload.value._store && (a._payload.value._store.validated = 1) : a._store && (a._store.validated = 1));
218
218
  }
219
- function g(l) {
220
- return typeof l == "object" && l !== null && l.$$typeof === E;
219
+ function m(a) {
220
+ return typeof a == "object" && a !== null && a.$$typeof === E;
221
221
  }
222
- var f = re, E = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), k = Symbol.for("react.consumer"), L = Symbol.for("react.context"), b = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), M = Symbol.for("react.activity"), ne = Symbol.for("react.client.reference"), j = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, le = Array.isArray, U = console.createTask ? console.createTask : function() {
222
+ var f = re, E = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.portal"), A = /* @__PURE__ */ Symbol.for("react.fragment"), S = /* @__PURE__ */ Symbol.for("react.strict_mode"), v = /* @__PURE__ */ Symbol.for("react.profiler"), k = /* @__PURE__ */ Symbol.for("react.consumer"), L = /* @__PURE__ */ Symbol.for("react.context"), b = /* @__PURE__ */ Symbol.for("react.forward_ref"), D = /* @__PURE__ */ Symbol.for("react.suspense"), P = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), T = /* @__PURE__ */ Symbol.for("react.lazy"), R = /* @__PURE__ */ Symbol.for("react.activity"), ne = /* @__PURE__ */ Symbol.for("react.client.reference"), j = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, le = Array.isArray, q = console.createTask ? console.createTask : function() {
223
223
  return null;
224
224
  };
225
225
  f = {
226
- react_stack_bottom_frame: function(l) {
227
- return l();
226
+ react_stack_bottom_frame: function(a) {
227
+ return a();
228
228
  }
229
229
  };
230
230
  var G, X = {}, K = f.react_stack_bottom_frame.bind(
231
231
  f,
232
232
  n
233
- )(), Z = U(s(n)), Q = {};
234
- _.Fragment = A, _.jsx = function(l, u, C) {
233
+ )(), Z = q(s(n)), Q = {};
234
+ _.Fragment = A, _.jsx = function(a, u, C) {
235
235
  var O = 1e4 > j.recentlyCreatedOwnerStacks++;
236
236
  return o(
237
- l,
237
+ a,
238
238
  u,
239
239
  C,
240
240
  !1,
241
241
  O ? Error("react-stack-top-frame") : K,
242
- O ? U(s(l)) : Z
242
+ O ? q(s(a)) : Z
243
243
  );
244
- }, _.jsxs = function(l, u, C) {
244
+ }, _.jsxs = function(a, u, C) {
245
245
  var O = 1e4 > j.recentlyCreatedOwnerStacks++;
246
246
  return o(
247
- l,
247
+ a,
248
248
  u,
249
249
  C,
250
250
  !0,
251
251
  O ? Error("react-stack-top-frame") : K,
252
- O ? U(s(l)) : Z
252
+ O ? q(s(a)) : Z
253
253
  );
254
254
  };
255
- }()), _;
255
+ })()), _;
256
256
  }
257
257
  var se;
258
258
  function ue() {
@@ -345,11 +345,11 @@ function H(p, e = 50, t = !1) {
345
345
  return function(...i) {
346
346
  const n = self, r = () => {
347
347
  s = null, t || p.apply(n, i);
348
- }, a = t && !s;
349
- clearTimeout(s), s = setTimeout(r, e), a && p.apply(n, i);
348
+ }, l = t && !s;
349
+ clearTimeout(s), s = setTimeout(r, e), l && p.apply(n, i);
350
350
  };
351
351
  }
352
- function W(p, e) {
352
+ function Y(p, e) {
353
353
  return JSON.stringify(p) === JSON.stringify(e);
354
354
  }
355
355
  function me(p) {
@@ -441,21 +441,21 @@ class ge {
441
441
  if (t) {
442
442
  const i = this.getSelectedOptions(), n = [];
443
443
  i.forEach((r) => {
444
- let a = !1;
444
+ let l = !1;
445
445
  for (const c of s) {
446
446
  if (c instanceof w && c.id === r.id) {
447
- a = !0;
447
+ l = !0;
448
448
  break;
449
449
  }
450
450
  if (c instanceof x) {
451
451
  for (const h of c.options)
452
452
  if (h.id === r.id) {
453
- a = !0;
453
+ l = !0;
454
454
  break;
455
455
  }
456
456
  }
457
457
  }
458
- a || n.push(r);
458
+ l || n.push(r);
459
459
  }), this.data = [...n, ...s];
460
460
  } else
461
461
  this.data = s;
@@ -483,17 +483,17 @@ class ge {
483
483
  setSelectedBy(e, t) {
484
484
  let s = null, i = !1;
485
485
  const n = [];
486
- for (let a of this.data) {
487
- if (a instanceof x)
488
- for (let c of a.options) {
486
+ for (let l of this.data) {
487
+ if (l instanceof x)
488
+ for (let c of l.options) {
489
489
  s || (s = c);
490
490
  let h = c[e] || "";
491
491
  c.selected = i ? !1 : t.includes(h), c.selected && (n.push(c), this.selectType === "single" && (i = !0));
492
492
  }
493
- a instanceof w && (s || (s = a), a.selected = i ? !1 : t.includes(a[e]), a.selected && (n.push(a), this.selectType === "single" && (i = !0)));
493
+ l instanceof w && (s || (s = l), l.selected = i ? !1 : t.includes(l[e]), l.selected && (n.push(l), this.selectType === "single" && (i = !0)));
494
494
  }
495
495
  this.selectType === "single" && s && !i && (s.selected = !0, n.push(s));
496
- const r = t.map((a) => n.find((c) => c[e] === a)?.id || "");
496
+ const r = t.map((l) => n.find((c) => c[e] === l)?.id || "");
497
497
  this.selectedOrder = r;
498
498
  }
499
499
  getSelected() {
@@ -536,11 +536,11 @@ class ge {
536
536
  return this.data.forEach((i) => {
537
537
  if (i instanceof x) {
538
538
  let n = [];
539
- if (i.options.forEach((a) => {
540
- (!e || e(a)) && (t ? n.push(new w(a)) : s.push(new w(a)));
539
+ if (i.options.forEach((l) => {
540
+ (!e || e(l)) && (t ? n.push(new w(l)) : s.push(new w(l)));
541
541
  }), n.length > 0) {
542
- let a = new x(i);
543
- a.options = n, s.push(a);
542
+ let l = new x(i);
543
+ l.options = n, s.push(l);
544
544
  }
545
545
  }
546
546
  i instanceof w && (!e || e(i)) && s.push(new w(i));
@@ -674,8 +674,8 @@ class ve {
674
674
  if (h.stopPropagation(), this.settings.disabled)
675
675
  return;
676
676
  let o = !0;
677
- const d = this.store.getSelectedOptions(), g = [];
678
- if (this.callbacks.beforeChange && (o = this.callbacks.beforeChange(g, d) === !0), o) {
677
+ const d = this.store.getSelectedOptions(), m = [];
678
+ if (this.callbacks.beforeChange && (o = this.callbacks.beforeChange(m, d) === !0), o) {
679
679
  if (this.settings.isMultiple)
680
680
  this.callbacks.setSelected([], !1), this.updateDeselectAll();
681
681
  else {
@@ -689,10 +689,10 @@ class ve {
689
689
  n.setAttribute("viewBox", "0 0 100 100");
690
690
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
691
691
  r.setAttribute("d", this.classes.deselectPath), n.appendChild(r), s.appendChild(n), e.appendChild(s);
692
- const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
693
- this.addClasses(a, this.classes.arrow), a.setAttribute("viewBox", "0 0 100 100");
692
+ const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
693
+ this.addClasses(l, this.classes.arrow), l.setAttribute("viewBox", "0 0 100 100");
694
694
  const c = document.createElementNS("http://www.w3.org/2000/svg", "path");
695
- return c.setAttribute("d", this.classes.arrowClose), this.settings.alwaysOpen && this.addClasses(a, this.classes.hide), a.appendChild(c), e.appendChild(a), {
695
+ return c.setAttribute("d", this.classes.arrowClose), this.settings.alwaysOpen && this.addClasses(l, this.classes.hide), l.appendChild(c), e.appendChild(l), {
696
696
  main: e,
697
697
  values: t,
698
698
  deselect: {
@@ -701,7 +701,7 @@ class ve {
701
701
  path: r
702
702
  },
703
703
  arrow: {
704
- main: a,
704
+ main: l,
705
705
  path: c
706
706
  }
707
707
  };
@@ -776,18 +776,18 @@ class ve {
776
776
  const s = document.createElement("div");
777
777
  if (this.addClasses(s, this.classes.valueText), s.textContent = e.text, t.appendChild(s), !e.mandatory) {
778
778
  const i = document.createElement("div");
779
- this.addClasses(i, this.classes.valueDelete), i.setAttribute("tabindex", "0"), i.onclick = (a) => {
780
- if (a.preventDefault(), a.stopPropagation(), this.settings.disabled)
779
+ this.addClasses(i, this.classes.valueDelete), i.setAttribute("tabindex", "0"), i.onclick = (l) => {
780
+ if (l.preventDefault(), l.stopPropagation(), this.settings.disabled)
781
781
  return;
782
782
  let c = !0;
783
783
  const h = this.store.getSelectedOptions(), o = h.filter((d) => d.selected && d.id !== e.id, !0);
784
784
  if (!(this.settings.minSelected && o.length < this.settings.minSelected) && (this.callbacks.beforeChange && (c = this.callbacks.beforeChange(o, h) === !0), c)) {
785
785
  let d = [];
786
- for (const g of o) {
787
- if (g instanceof x)
788
- for (const f of g.options)
786
+ for (const m of o) {
787
+ if (m instanceof x)
788
+ for (const f of m.options)
789
789
  f.id && d.push(f.id);
790
- g instanceof w && d.push(g.id);
790
+ m instanceof w && d.push(m.id);
791
791
  }
792
792
  this.callbacks.setSelected(d, !1), this.settings.closeOnSelect && this.callbacks.close(), this.callbacks.afterChange && this.callbacks.afterChange(o), this.updateDeselectAll();
793
793
  }
@@ -795,8 +795,8 @@ class ve {
795
795
  const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
796
796
  n.setAttribute("viewBox", "0 0 100 100");
797
797
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
798
- r.setAttribute("d", this.classes.optionDelete), n.appendChild(r), i.appendChild(n), t.appendChild(i), i.onkeydown = (a) => {
799
- a.key === "Enter" && i.click();
798
+ r.setAttribute("d", this.classes.optionDelete), n.appendChild(r), i.appendChild(n), t.appendChild(i), i.onkeydown = (l) => {
799
+ l.key === "Enter" && i.click();
800
800
  };
801
801
  }
802
802
  return t;
@@ -852,10 +852,10 @@ class ve {
852
852
  );
853
853
  return r ? (r.click(), !1) : !0;
854
854
  case "Enter":
855
- const a = this.content.list.querySelector(
855
+ const l = this.content.list.querySelector(
856
856
  "." + this.classes.getFirst("highlighted")
857
857
  );
858
- return a ? (a.click(), !1) : this.callbacks.addable ? (s.click(), !1) : !0;
858
+ return l ? (l.click(), !1) : this.callbacks.addable ? (s.click(), !1) : !0;
859
859
  }
860
860
  return !0;
861
861
  }, e.appendChild(t), this.callbacks.addable) {
@@ -863,8 +863,8 @@ class ve {
863
863
  const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
864
864
  n.setAttribute("viewBox", "0 0 100 100");
865
865
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
866
- r.setAttribute("d", this.classes.addablePath), n.appendChild(r), s.appendChild(n), s.onclick = (a) => {
867
- if (a.preventDefault(), a.stopPropagation(), !this.callbacks.addable)
866
+ r.setAttribute("d", this.classes.addablePath), n.appendChild(r), s.appendChild(n), s.onclick = (l) => {
867
+ if (l.preventDefault(), l.stopPropagation(), !this.callbacks.addable)
868
868
  return;
869
869
  const c = this.content.search.input.value.trim();
870
870
  if (c === "") {
@@ -872,12 +872,12 @@ class ve {
872
872
  return;
873
873
  }
874
874
  const h = (d) => {
875
- let g = new w(d);
876
- if (this.callbacks.addOption(g), this.settings.isMultiple) {
875
+ let m = new w(d);
876
+ if (this.callbacks.addOption(m), this.settings.isMultiple) {
877
877
  let f = this.store.getSelected();
878
- f.push(g.id), this.callbacks.setSelected(f, !0);
878
+ f.push(m.id), this.callbacks.setSelected(f, !0);
879
879
  } else
880
- this.callbacks.setSelected([g.id], !0);
880
+ this.callbacks.setSelected([m.id], !0);
881
881
  this.callbacks.search(""), this.settings.closeOnSelect && setTimeout(() => {
882
882
  this.callbacks.close();
883
883
  }, 100);
@@ -929,9 +929,9 @@ class ve {
929
929
  if (t[n].classList.contains(this.classes.getFirst("highlighted"))) {
930
930
  const r = t[n];
931
931
  this.removeClasses(r, this.classes.highlighted);
932
- const a = r.parentElement;
933
- if (a && a.classList.contains(this.classes.getFirst("mainOpen"))) {
934
- const o = a.querySelector("." + this.classes.getFirst("optgroupLabel"));
932
+ const l = r.parentElement;
933
+ if (l && l.classList.contains(this.classes.getFirst("mainOpen"))) {
934
+ const o = l.querySelector("." + this.classes.getFirst("optgroupLabel"));
935
935
  o && o.click();
936
936
  }
937
937
  let c = t[e === "down" ? n + 1 < t.length ? n + 1 : 0 : n - 1 >= 0 ? n - 1 : t.length - 1];
@@ -990,8 +990,8 @@ class ve {
990
990
  this.addClasses(n, this.classes.optgroupLabel), i.appendChild(n);
991
991
  const r = document.createElement("div");
992
992
  this.addClasses(r, this.classes.optgroupLabelText), r.textContent = s.label, n.appendChild(r);
993
- const a = document.createElement("div");
994
- if (this.addClasses(a, this.classes.optgroupActions), n.appendChild(a), this.settings.isMultiple && s.selectAll) {
993
+ const l = document.createElement("div");
994
+ if (this.addClasses(l, this.classes.optgroupActions), n.appendChild(l), this.settings.isMultiple && s.selectAll) {
995
995
  const c = document.createElement("div");
996
996
  this.addClasses(c, this.classes.optgroupSelectAll);
997
997
  let h = !0;
@@ -1005,14 +1005,14 @@ class ve {
1005
1005
  o.textContent = s.selectAllText, c.appendChild(o);
1006
1006
  const d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1007
1007
  d.setAttribute("viewBox", "0 0 100 100"), c.appendChild(d);
1008
- const g = document.createElementNS("http://www.w3.org/2000/svg", "path");
1009
- g.setAttribute("d", this.classes.optgroupSelectAllBox), d.appendChild(g);
1008
+ const m = document.createElementNS("http://www.w3.org/2000/svg", "path");
1009
+ m.setAttribute("d", this.classes.optgroupSelectAllBox), d.appendChild(m);
1010
1010
  const f = document.createElementNS("http://www.w3.org/2000/svg", "path");
1011
1011
  f.setAttribute("d", this.classes.optgroupSelectAllCheck), d.appendChild(f), c.addEventListener("click", (E) => {
1012
1012
  E.preventDefault(), E.stopPropagation();
1013
- const m = this.store.getSelected();
1013
+ const g = this.store.getSelected();
1014
1014
  if (h) {
1015
- const A = m.filter((S) => {
1015
+ const A = g.filter((S) => {
1016
1016
  for (const v of s.options)
1017
1017
  if (S === v.id)
1018
1018
  return !1;
@@ -1022,13 +1022,13 @@ class ve {
1022
1022
  return;
1023
1023
  } else {
1024
1024
  let A = s.options.map((v) => v.id).filter((v) => v !== void 0);
1025
- const S = m.concat(A);
1025
+ const S = g.concat(A);
1026
1026
  for (const v of s.options)
1027
1027
  v.id && !this.store.getOptionByID(v.id) && this.callbacks.addOption(new w(v));
1028
1028
  this.callbacks.setSelected(S, !0);
1029
1029
  return;
1030
1030
  }
1031
- }), a.appendChild(c);
1031
+ }), l.appendChild(c);
1032
1032
  }
1033
1033
  if (s.closable !== "off") {
1034
1034
  const c = document.createElement("div");
@@ -1038,7 +1038,7 @@ class ve {
1038
1038
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1039
1039
  h.appendChild(o), s.options.some((d) => d.selected) || this.content.search.input.value.trim() !== "" ? (this.addClasses(c, this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "open" ? (this.addClasses(i, this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "close" && (this.addClasses(i, this.classes.close), o.setAttribute("d", this.classes.arrowClose)), n.addEventListener("click", (d) => {
1040
1040
  d.preventDefault(), d.stopPropagation(), i.classList.contains(this.classes.getFirst("close")) ? (this.removeClasses(i, this.classes.close), this.addClasses(i, this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : (this.removeClasses(i, this.classes.mainOpen), this.addClasses(i, this.classes.close), o.setAttribute("d", this.classes.arrowClose));
1041
- }), a.appendChild(c);
1041
+ }), l.appendChild(c);
1042
1042
  }
1043
1043
  i.appendChild(n);
1044
1044
  for (const c of s.options)
@@ -1063,8 +1063,8 @@ class ve {
1063
1063
  this.classes.searchHighlighter
1064
1064
  ) : e.html !== "" ? t.innerHTML = e.html : t.textContent = e.text, this.settings.showOptionTooltips && t.textContent && t.setAttribute("title", t.textContent), e.display || this.addClasses(t, this.classes.hide), e.disabled && this.addClasses(t, this.classes.disabled), e.selected && this.settings.hideSelected && this.addClasses(t, this.classes.hide), e.selected ? (this.addClasses(t, this.classes.selected), t.setAttribute("aria-selected", "true"), this.main.main.setAttribute("aria-activedescendant", t.id)) : (this.removeClasses(t, this.classes.selected), t.setAttribute("aria-selected", "false")), t.addEventListener("click", (s) => {
1065
1065
  s.preventDefault(), s.stopPropagation();
1066
- const i = this.store.getSelected(), n = s.currentTarget, r = String(n.dataset.id), a = s.ctrlKey || s.metaKey;
1067
- if (e.disabled || !this.settings.isMultiple && e.selected && !this.settings.allowDeselect || e.selected && e.mandatory || this.settings.isMultiple && this.settings.maxSelected <= i.length && !e.selected || this.settings.isMultiple && this.settings.minSelected >= i.length && e.selected && !a)
1066
+ const i = this.store.getSelected(), n = s.currentTarget, r = String(n.dataset.id), l = s.ctrlKey || s.metaKey;
1067
+ if (e.disabled || !this.settings.isMultiple && e.selected && !this.settings.allowDeselect || e.selected && e.mandatory || this.settings.isMultiple && this.settings.maxSelected <= i.length && !e.selected || this.settings.isMultiple && this.settings.minSelected >= i.length && e.selected && !l)
1068
1068
  return;
1069
1069
  let c = !1;
1070
1070
  const h = this.store.getSelectedOptions();
@@ -1072,13 +1072,13 @@ class ve {
1072
1072
  if (this.settings.isMultiple) {
1073
1073
  const d = h.some((f) => f.id === r);
1074
1074
  if (s.shiftKey && this.lastSelectedOption) {
1075
- const f = this.store.getDataOptions(), E = f.findIndex((A) => A.id === this.lastSelectedOption.id), m = f.findIndex((A) => A.id === e.id);
1076
- if (E >= 0 && m >= 0) {
1077
- const A = Math.min(E, m), S = Math.max(E, m), k = f.slice(A, S + 1).filter((L) => !h.find((b) => b.id === L.id));
1075
+ const f = this.store.getDataOptions(), E = f.findIndex((A) => A.id === this.lastSelectedOption.id), g = f.findIndex((A) => A.id === e.id);
1076
+ if (E >= 0 && g >= 0) {
1077
+ const A = Math.min(E, g), S = Math.max(E, g), k = f.slice(A, S + 1).filter((L) => !h.find((b) => b.id === L.id));
1078
1078
  h.length + k.length <= this.settings.maxSelected ? o = h.concat(k) : o = h;
1079
1079
  } else
1080
1080
  o = h;
1081
- } else a ? (d ? o = h.filter((f) => f.id !== r) : o = h.concat(e), this.lastSelectedOption = e) : (d ? o = h.filter((f) => f.id !== r) : o = h.concat(e), this.lastSelectedOption = e);
1081
+ } else l ? (d ? o = h.filter((f) => f.id !== r) : o = h.concat(e), this.lastSelectedOption = e) : (d ? o = h.filter((f) => f.id !== r) : o = h.concat(e), this.lastSelectedOption = e);
1082
1082
  }
1083
1083
  if (this.settings.isMultiple || (e.selected ? o = [] : o = [e]), this.callbacks.beforeChange || (c = !0), this.callbacks.beforeChange && (this.callbacks.beforeChange(o, h) === !1 ? c = !1 : c = !0), c) {
1084
1084
  this.store.getOptionByID(r) || this.callbacks.addOption(e), this.callbacks.setSelected(
@@ -1099,21 +1099,21 @@ class ve {
1099
1099
  return e;
1100
1100
  const n = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = document.createElement("div");
1101
1101
  r.innerHTML = e;
1102
- const a = (c) => {
1102
+ const l = (c) => {
1103
1103
  if (c.nodeType === Node.TEXT_NODE) {
1104
1104
  const h = c.textContent || "", o = new RegExp("(" + n + ")", "i");
1105
1105
  if (o.test(h)) {
1106
1106
  const d = document.createElement("span");
1107
1107
  h.split(o).forEach((f, E) => {
1108
1108
  if (f && o.test(f)) {
1109
- const m = document.createElement("mark");
1110
- m.className = s, m.textContent = f, d.appendChild(m);
1109
+ const g = document.createElement("mark");
1110
+ g.className = s, g.textContent = f, d.appendChild(g);
1111
1111
  } else f && d.appendChild(document.createTextNode(f));
1112
1112
  }), c.parentNode?.replaceChild(d, c);
1113
1113
  }
1114
- } else c.nodeType === Node.ELEMENT_NODE && Array.from(c.childNodes).forEach((h) => a(h));
1114
+ } else c.nodeType === Node.ELEMENT_NODE && Array.from(c.childNodes).forEach((h) => l(h));
1115
1115
  };
1116
- return Array.from(r.childNodes).forEach((c) => a(c)), r.innerHTML;
1116
+ return Array.from(r.childNodes).forEach((c) => l(c)), r.innerHTML;
1117
1117
  }
1118
1118
  setContentDirection(e) {
1119
1119
  const t = e === "above", s = t ? this.classes.dirAbove : this.classes.dirBelow, i = t ? this.classes.dirBelow : this.classes.dirAbove;
@@ -1128,13 +1128,24 @@ class ve {
1128
1128
  return;
1129
1129
  const e = this.main.main.getBoundingClientRect();
1130
1130
  let t, s;
1131
- if (this.settings.contentPosition === "fixed")
1132
- t = e.top + e.height, s = e.left;
1133
- else {
1134
- const i = this.content.main.offsetParent, n = i ? i.getBoundingClientRect() : { top: 0, left: 0 };
1135
- t = e.top - n.top + e.height - (i?.clientTop || 0), s = e.left - n.left - (i?.clientLeft || 0);
1136
- }
1137
- this.content.main.style.top = t + "px", this.content.main.style.left = s + "px", this.content.main.style.width = e.width + "px";
1131
+ this.settings.contentPosition === "fixed" ? (t = e.top + e.height, s = e.left) : (t = e.top + window.scrollY + e.height, s = e.left + window.scrollX), this.content.main.style.top = t + "px", this.content.main.style.left = s + "px";
1132
+ const i = this.settings.contentWidth;
1133
+ this.content.main.style.width = "", this.content.main.style.minWidth = "", this.content.main.style.maxWidth = "", i ? i.startsWith(">") ? this.content.main.style.minWidth = i.slice(1) : i.startsWith("<") ? this.content.main.style.maxWidth = i.slice(1) : this.content.main.style.width = i : this.content.main.style.width = e.width + "px";
1134
+ const n = 20, r = window.innerWidth - n, l = () => {
1135
+ const h = this.content.main.getBoundingClientRect().right;
1136
+ if (h <= r) return;
1137
+ const o = h - r, d = parseFloat(this.content.main.style.left) || 0;
1138
+ if (this.settings.contentPosition === "fixed") {
1139
+ const m = Math.max(n, d - o);
1140
+ this.content.main.style.left = m + "px";
1141
+ } else {
1142
+ const m = Math.max(window.scrollX + n, d - o);
1143
+ this.content.main.style.left = m + "px";
1144
+ }
1145
+ };
1146
+ requestAnimationFrame(() => {
1147
+ l(), requestAnimationFrame(l);
1148
+ });
1138
1149
  }
1139
1150
  moveContentAbove() {
1140
1151
  this.setContentDirection("above"), this.setContentPosition();
@@ -1220,8 +1231,8 @@ class be {
1220
1231
  let t = !1, s = !1, i = !1, n = !1;
1221
1232
  for (const r of e) {
1222
1233
  if (r.target === this.select && (r.attributeName === "disabled" && (s = !0), r.attributeName === "class" && (t = !0), r.type === "childList")) {
1223
- for (const a of Array.from(r.addedNodes))
1224
- if (a.nodeName === "OPTION" && a.value === this.select.value) {
1234
+ for (const l of Array.from(r.addedNodes))
1235
+ if (l.nodeName === "OPTION" && l.value === this.select.value) {
1225
1236
  n = !0;
1226
1237
  break;
1227
1238
  }
@@ -1312,8 +1323,8 @@ class be {
1312
1323
  const n = s.childNodes;
1313
1324
  for (const r of n)
1314
1325
  if (r.nodeName === "OPTION") {
1315
- const a = r;
1316
- a.selected = e.includes(a.id);
1326
+ const l = r;
1327
+ l.selected = e.includes(l.id);
1317
1328
  }
1318
1329
  }
1319
1330
  if (s.nodeName === "OPTION") {
@@ -1335,8 +1346,8 @@ class be {
1335
1346
  const n = s.childNodes;
1336
1347
  for (const r of n)
1337
1348
  if (r.nodeName === "OPTION") {
1338
- const a = r;
1339
- a.selected = e.includes(a.value);
1349
+ const l = r;
1350
+ l.selected = e.includes(l.value);
1340
1351
  }
1341
1352
  }
1342
1353
  if (s.nodeName === "OPTION") {
@@ -1392,9 +1403,9 @@ class be {
1392
1403
  Array.from(new Set(e)).forEach((n) => {
1393
1404
  if (n.__slimSelectLabelHandler)
1394
1405
  return;
1395
- const r = (a) => {
1396
- const c = a.target, h = ie(c, this.select.dataset.id);
1397
- a.preventDefault(), !h && this.onLabelClick && this.onLabelClick();
1406
+ const r = (l) => {
1407
+ const c = l.target, h = ie(c, this.select.dataset.id);
1408
+ l.preventDefault(), !h && this.onLabelClick && this.onLabelClick();
1398
1409
  };
1399
1410
  n.__slimSelectLabelHandler = r, n.addEventListener("click", r, { capture: !0, passive: !1 });
1400
1411
  });
@@ -1446,6 +1457,7 @@ class Ce {
1446
1457
  closeOnSelect;
1447
1458
  contentLocation;
1448
1459
  contentPosition;
1460
+ contentWidth;
1449
1461
  openPosition;
1450
1462
  placeholderText;
1451
1463
  allowDeselect;
@@ -1459,7 +1471,7 @@ class Ce {
1459
1471
  maxValuesMessage;
1460
1472
  addableText;
1461
1473
  constructor(e) {
1462
- e || (e = {}), this.id = "ss-" + z(), this.style = e.style || "", this.class = e.class || [], this.disabled = e.disabled !== void 0 ? e.disabled : !1, this.alwaysOpen = e.alwaysOpen !== void 0 ? e.alwaysOpen : !1, this.showSearch = e.showSearch !== void 0 ? e.showSearch : !0, this.focusSearch = e.focusSearch !== void 0 ? e.focusSearch : !0, this.keepSearch = e.keepSearch !== void 0 ? e.keepSearch : !1, this.ariaLabel = e.ariaLabel || "Combobox", this.searchPlaceholder = e.searchPlaceholder || "Search...", this.searchText = e.searchText || "No Results", this.searchingText = e.searchingText || "Searching...", this.searchHighlight = e.searchHighlight !== void 0 ? e.searchHighlight : !1, this.closeOnSelect = e.closeOnSelect !== void 0 ? e.closeOnSelect : !0, this.contentLocation = e.contentLocation || document.body, this.contentPosition = e.contentPosition || "absolute", this.openPosition = e.openPosition || "auto", this.placeholderText = e.placeholderText !== void 0 ? e.placeholderText : "Select Value", this.allowDeselect = e.allowDeselect !== void 0 ? e.allowDeselect : !1, this.hideSelected = e.hideSelected !== void 0 ? e.hideSelected : !1, this.keepOrder = e.keepOrder !== void 0 ? e.keepOrder : !1, this.showOptionTooltips = e.showOptionTooltips !== void 0 ? e.showOptionTooltips : !1, this.minSelected = e.minSelected || 0, this.maxSelected = e.maxSelected || 1e3, this.timeoutDelay = e.timeoutDelay || 200, this.maxValuesShown = e.maxValuesShown || 20, this.maxValuesMessage = e.maxValuesMessage || "{number} selected", this.addableText = e.addableText || 'Press "Enter" to add {value}';
1474
+ e || (e = {}), this.id = "ss-" + z(), this.style = e.style || "", this.class = e.class || [], this.disabled = e.disabled !== void 0 ? e.disabled : !1, this.alwaysOpen = e.alwaysOpen !== void 0 ? e.alwaysOpen : !1, this.showSearch = e.showSearch !== void 0 ? e.showSearch : !0, this.focusSearch = e.focusSearch !== void 0 ? e.focusSearch : !0, this.keepSearch = e.keepSearch !== void 0 ? e.keepSearch : !1, this.ariaLabel = e.ariaLabel || "Combobox", this.searchPlaceholder = e.searchPlaceholder || "Search...", this.searchText = e.searchText || "No Results", this.searchingText = e.searchingText || "Searching...", this.searchHighlight = e.searchHighlight !== void 0 ? e.searchHighlight : !1, this.closeOnSelect = e.closeOnSelect !== void 0 ? e.closeOnSelect : !0, this.contentLocation = e.contentLocation || document.body, this.contentPosition = e.contentPosition || "absolute", this.contentWidth = e.contentWidth || "", this.openPosition = e.openPosition || "auto", this.placeholderText = e.placeholderText !== void 0 ? e.placeholderText : "Select Value", this.allowDeselect = e.allowDeselect !== void 0 ? e.allowDeselect : !1, this.hideSelected = e.hideSelected !== void 0 ? e.hideSelected : !1, this.keepOrder = e.keepOrder !== void 0 ? e.keepOrder : !1, this.showOptionTooltips = e.showOptionTooltips !== void 0 ? e.showOptionTooltips : !1, this.minSelected = e.minSelected || 0, this.maxSelected = e.maxSelected || 1e3, this.timeoutDelay = e.timeoutDelay || 200, this.maxValuesShown = e.maxValuesShown || 20, this.maxValuesMessage = e.maxValuesMessage || "{number} selected", this.addableText = e.addableText || 'Press "Enter" to add {value}';
1463
1475
  }
1464
1476
  }
1465
1477
  let we = class {
@@ -1496,16 +1508,16 @@ let we = class {
1496
1508
  }
1497
1509
  this.selectEl.dataset.ssid && this.destroy(), this.settings = new Ce(e.settings), this.cssClasses = new pe(e.cssClasses);
1498
1510
  const t = ["beforeOpen", "afterOpen", "beforeClose", "afterClose"];
1499
- for (const a in e.events)
1500
- e.events.hasOwnProperty(a) && (t.indexOf(a) !== -1 ? this.events[a] = H(e.events[a], 100) : this.events[a] = e.events[a]);
1501
- this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new be(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onValueChange = (a) => {
1502
- this.setSelected(a.map((c) => c.id));
1503
- }, this.select.onClassChange = (a) => {
1504
- this.settings.class = a, this.render.updateClassStyles();
1505
- }, this.select.onDisabledChange = (a) => {
1506
- a ? this.disable() : this.enable();
1507
- }, this.select.onOptionsChange = (a) => {
1508
- this.setData(a || []);
1511
+ for (const l in e.events)
1512
+ e.events.hasOwnProperty(l) && (t.indexOf(l) !== -1 ? this.events[l] = H(e.events[l], 100) : this.events[l] = e.events[l]);
1513
+ this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new be(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onValueChange = (l) => {
1514
+ this.setSelected(l.map((c) => c.id));
1515
+ }, this.select.onClassChange = (l) => {
1516
+ this.settings.class = l, this.render.updateClassStyles();
1517
+ }, this.select.onDisabledChange = (l) => {
1518
+ l ? this.disable() : this.enable();
1519
+ }, this.select.onOptionsChange = (l) => {
1520
+ this.setData(l || []);
1509
1521
  }, this.select.onLabelClick = () => {
1510
1522
  this.settings.disabled || (this.settings.isOpen ? this.close() : this.open());
1511
1523
  };
@@ -1544,7 +1556,7 @@ let we = class {
1544
1556
  }
1545
1557
  this.store.setData(e);
1546
1558
  const i = this.store.getData();
1547
- this.select.updateOptions(i), this.render.renderValues(), this.render.renderOptions(i), this.events.afterChange && !W(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1559
+ this.select.updateOptions(i), this.render.renderValues(), this.render.renderOptions(i), this.events.afterChange && !Y(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1548
1560
  }
1549
1561
  getSelected() {
1550
1562
  let e = this.store.getSelectedOptions();
@@ -1555,23 +1567,23 @@ let we = class {
1555
1567
  const s = this.store.getSelected(), i = this.store.getDataOptions();
1556
1568
  e = Array.isArray(e) ? e : [e];
1557
1569
  const n = [];
1558
- for (const a of e) {
1559
- if (i.find((c) => c.id == a)) {
1560
- n.push(a);
1570
+ for (const l of e) {
1571
+ if (i.find((c) => c.id == l)) {
1572
+ n.push(l);
1561
1573
  continue;
1562
1574
  }
1563
- for (const c of i.filter((h) => h.value == a))
1575
+ for (const c of i.filter((h) => h.value == l))
1564
1576
  n.push(c.id);
1565
1577
  }
1566
1578
  this.store.setSelectedBy("id", n);
1567
1579
  const r = this.store.getData();
1568
- this.select.updateOptions(r), this.render.renderValues(), this.render.content.search.input.value !== "" ? this.search(this.render.content.search.input.value) : this.render.renderOptions(r), t && this.events.afterChange && !W(s, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1580
+ this.select.updateOptions(r), this.render.renderValues(), this.render.content.search.input.value !== "" ? this.search(this.render.content.search.input.value) : this.render.renderOptions(r), t && this.events.afterChange && !Y(s, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1569
1581
  }
1570
1582
  addOption(e) {
1571
1583
  const t = this.store.getSelected();
1572
1584
  this.store.getDataOptions().some((i) => i.value === (e.value ?? e.text)) || this.store.addOption(e);
1573
1585
  const s = this.store.getData();
1574
- this.select.updateOptions(s), this.render.renderValues(), this.render.renderOptions(s), this.events.afterChange && !W(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1586
+ this.select.updateOptions(s), this.render.renderValues(), this.render.renderOptions(s), this.events.afterChange && !Y(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1575
1587
  }
1576
1588
  open() {
1577
1589
  this.settings.disabled || this.settings.isOpen || (this.closeTimeout && (clearTimeout(this.closeTimeout), this.closeTimeout = null), this.events.beforeOpen && this.events.beforeOpen(), this.render.open(), this.settings.showSearch && this.settings.focusSearch && this.render.searchFocus(), this.settings.isOpen = !0, this.openTimeout = setTimeout(() => {
@@ -1625,15 +1637,15 @@ let we = class {
1625
1637
  };
1626
1638
  };
1627
1639
  const Se = oe(
1628
- ({ data: p, settings: e, events: t, cssClasses: s, value: i, onChange: n, children: r, multiple: a }, c) => {
1629
- const h = I(null), o = I(null), d = I(!0), g = I(i);
1640
+ ({ data: p, settings: e, events: t, cssClasses: s, value: i, onChange: n, children: r, multiple: l }, c) => {
1641
+ const h = I(null), o = I(null), d = I(!0), m = I(i);
1630
1642
  ce(c, () => ({
1631
1643
  slimSelect: o.current
1632
1644
  }));
1633
- const f = (m) => typeof m == "string" ? a ? [m] : m : Array.isArray(m) ? a ? m : m[0] : a ? [] : "", E = (m, A = !1) => {
1634
- if (!o.current || m === void 0)
1645
+ const f = (g) => typeof g == "string" ? l ? [g] : g : Array.isArray(g) ? l ? g : g[0] : l ? [] : "", E = (g, A = !1) => {
1646
+ if (!o.current || g === void 0)
1635
1647
  return;
1636
- const S = f(m), k = o.current.getData().flatMap((b) => "label" in b ? b.options : [b]);
1648
+ const S = f(g), k = o.current.getData().flatMap((b) => "label" in b ? b.options : [b]);
1637
1649
  if (!(Array.isArray(S) ? S.length > 0 && S.every((b) => k.some((D) => D.value === b)) : S !== "" && k.some((b) => b.value === S)) && !Array.isArray(S) && !k.some((D) => D.placeholder)) {
1638
1650
  const D = o.current.getData(), P = {
1639
1651
  value: "",
@@ -1644,34 +1656,34 @@ const Se = oe(
1644
1656
  }
1645
1657
  o.current.setSelected(S, A);
1646
1658
  };
1647
- return Y(() => {
1659
+ return $(() => {
1648
1660
  if (!h.current) return;
1649
- const m = {
1661
+ const g = {
1650
1662
  select: h.current
1651
1663
  };
1652
- p && (m.data = p), e && (m.settings = e), s && (m.cssClasses = s);
1664
+ p && (g.data = p), e && (g.settings = e), s && (g.cssClasses = s);
1653
1665
  const A = t?.afterChange;
1654
- return m.events = {
1666
+ return g.events = {
1655
1667
  ...t,
1656
1668
  afterChange: (S) => {
1657
1669
  if (!o.current) return;
1658
- const v = a ? S.map((T) => T.value) : S[0]?.value ?? "", L = o.current.getData().flatMap(
1670
+ const v = l ? S.map((T) => T.value) : S[0]?.value ?? "", L = o.current.getData().flatMap(
1659
1671
  (T) => "label" in T ? T.options : [T]
1660
- ), b = g.current, D = b === void 0 ? !1 : Array.isArray(b) ? b.length > 0 && b.every((T) => L.some((M) => M.value === T)) : b !== "" && L.some((T) => T.value === b), P = Array.isArray(v) ? v.length > 0 && v.every((T) => L.some((M) => M.value === T)) : v !== "" && L.some((T) => T.value === v), B = Array.isArray(v) && Array.isArray(b) ? JSON.stringify(v.sort()) !== JSON.stringify(b.sort()) : b !== v;
1661
- n && B && (D || P) && (n(v), g.current = v), A && A(S);
1672
+ ), b = m.current, D = b === void 0 ? !1 : Array.isArray(b) ? b.length > 0 && b.every((T) => L.some((R) => R.value === T)) : b !== "" && L.some((T) => T.value === b), P = Array.isArray(v) ? v.length > 0 && v.every((T) => L.some((R) => R.value === T)) : v !== "" && L.some((T) => T.value === v), B = Array.isArray(v) && Array.isArray(b) ? JSON.stringify(v.sort()) !== JSON.stringify(b.sort()) : b !== v;
1673
+ n && B && (D || P) && (n(v), m.current = v), A && A(S);
1662
1674
  }
1663
- }, o.current = new we(m), i !== void 0 && E(i, !1), () => {
1675
+ }, o.current = new we(g), i !== void 0 && E(i, !1), () => {
1664
1676
  o.current && (o.current.destroy(), o.current = null);
1665
1677
  };
1666
- }, []), Y(() => {
1678
+ }, []), $(() => {
1667
1679
  if (d.current) {
1668
- d.current = !1, g.current = i;
1680
+ d.current = !1, m.current = i;
1669
1681
  return;
1670
1682
  }
1671
- o.current && i !== void 0 && (g.current = i, E(i, !1));
1672
- }, [i]), Y(() => {
1683
+ o.current && i !== void 0 && (m.current = i, E(i, !1));
1684
+ }, [i]), $(() => {
1673
1685
  o.current && p && !d.current && (o.current.setData(p), i !== void 0 && E(i, !1));
1674
- }, [p]), /* @__PURE__ */ fe.jsx("select", { ref: h, multiple: a, children: r });
1686
+ }, [p]), /* @__PURE__ */ fe.jsx("select", { ref: h, multiple: l, children: r });
1675
1687
  }
1676
1688
  );
1677
1689
  Se.displayName = "SlimSelect";