slim-select 3.1.0 → 3.1.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,5 +1,5 @@
1
- import ae, { forwardRef as re, useRef as V, useImperativeHandle as oe, useEffect as j } from "react";
2
- var D = { exports: {} }, A = {};
1
+ import ae, { forwardRef as re, useRef as V, useImperativeHandle as oe, useEffect as $ } from "react";
2
+ var B = { exports: {} }, R = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -9,29 +9,29 @@ var D = { exports: {} }, A = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var X;
12
+ var ee;
13
13
  function ce() {
14
- if (X) return A;
15
- X = 1;
14
+ if (ee) return R;
15
+ ee = 1;
16
16
  var p = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
17
- function t(s, i, l) {
17
+ function t(s, i, n) {
18
18
  var r = null;
19
- if (l !== void 0 && (r = "" + l), i.key !== void 0 && (r = "" + i.key), "key" in i) {
20
- l = {};
19
+ if (n !== void 0 && (r = "" + n), i.key !== void 0 && (r = "" + i.key), "key" in i) {
20
+ n = {};
21
21
  for (var a in i)
22
- a !== "key" && (l[a] = i[a]);
23
- } else l = i;
24
- return i = l.ref, {
22
+ a !== "key" && (n[a] = i[a]);
23
+ } else n = i;
24
+ return i = n.ref, {
25
25
  $$typeof: p,
26
26
  type: s,
27
27
  key: r,
28
28
  ref: i !== void 0 ? i : null,
29
- props: l
29
+ props: n
30
30
  };
31
31
  }
32
- return A.Fragment = e, A.jsx = t, A.jsxs = t, A;
32
+ return R.Fragment = e, R.jsx = t, R.jsxs = t, R;
33
33
  }
34
- var T = {};
34
+ var _ = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -41,240 +41,240 @@ var T = {};
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
- var K;
44
+ var te;
45
45
  function he() {
46
- return K || (K = 1, process.env.NODE_ENV !== "production" && function() {
47
- function p(n) {
48
- if (n == null) return null;
49
- if (typeof n == "function")
50
- return n.$$typeof === ie ? null : n.displayName || n.name || null;
51
- if (typeof n == "string") return n;
52
- switch (n) {
53
- case O:
46
+ return te || (te = 1, process.env.NODE_ENV !== "production" && function() {
47
+ function p(l) {
48
+ if (l == null) return null;
49
+ if (typeof l == "function")
50
+ return l.$$typeof === ie ? null : l.displayName || l.name || null;
51
+ if (typeof l == "string") return l;
52
+ switch (l) {
53
+ case L:
54
54
  return "Fragment";
55
- case y:
55
+ case v:
56
56
  return "Profiler";
57
- case C:
57
+ case O:
58
58
  return "StrictMode";
59
- case Q:
59
+ case D:
60
60
  return "Suspense";
61
- case ee:
61
+ case P:
62
62
  return "SuspenseList";
63
- case se:
63
+ case M:
64
64
  return "Activity";
65
65
  }
66
- if (typeof n == "object")
67
- switch (typeof n.tag == "number" && console.error(
66
+ if (typeof l == "object")
67
+ switch (typeof l.tag == "number" && console.error(
68
68
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
- ), n.$$typeof) {
70
- case E:
69
+ ), l.$$typeof) {
70
+ case m:
71
71
  return "Portal";
72
- case R:
73
- return n.displayName || "Context";
74
72
  case k:
75
- return (n._context.displayName || "Context") + ".Consumer";
76
- case M:
77
- var u = n.render;
78
- return n = n.displayName, n || (n = u.displayName || u.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
79
- case te:
80
- return u = n.displayName || null, u !== null ? u : p(n.type) || "Memo";
81
- case _:
82
- u = n._payload, n = n._init;
73
+ return l.displayName || "Context";
74
+ case T:
75
+ return (l._context.displayName || "Context") + ".Consumer";
76
+ case b:
77
+ var u = l.render;
78
+ return l = l.displayName, l || (l = u.displayName || u.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l;
79
+ case F:
80
+ return u = l.displayName || null, u !== null ? u : p(l.type) || "Memo";
81
+ case A:
82
+ u = l._payload, l = l._init;
83
83
  try {
84
- return p(n(u));
84
+ return p(l(u));
85
85
  } catch {
86
86
  }
87
87
  }
88
88
  return null;
89
89
  }
90
- function e(n) {
91
- return "" + n;
90
+ function e(l) {
91
+ return "" + l;
92
92
  }
93
- function t(n) {
93
+ function t(l) {
94
94
  try {
95
- e(n);
95
+ e(l);
96
96
  var u = !1;
97
97
  } catch {
98
98
  u = !0;
99
99
  }
100
100
  if (u) {
101
101
  u = console;
102
- var g = u.error, b = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
103
- return g.call(
102
+ var w = u.error, y = typeof Symbol == "function" && Symbol.toStringTag && l[Symbol.toStringTag] || l.constructor.name || "Object";
103
+ return w.call(
104
104
  u,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- b
107
- ), e(n);
106
+ y
107
+ ), e(l);
108
108
  }
109
109
  }
110
- function s(n) {
111
- if (n === O) return "<>";
112
- if (typeof n == "object" && n !== null && n.$$typeof === _)
110
+ function s(l) {
111
+ if (l === L) return "<>";
112
+ if (typeof l == "object" && l !== null && l.$$typeof === A)
113
113
  return "<...>";
114
114
  try {
115
- var u = p(n);
115
+ var u = p(l);
116
116
  return u ? "<" + u + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
119
119
  }
120
120
  }
121
121
  function i() {
122
- var n = I.A;
123
- return n === null ? null : n.getOwner();
122
+ var l = j.A;
123
+ return l === null ? null : l.getOwner();
124
124
  }
125
- function l() {
125
+ function n() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
- function r(n) {
129
- if (Y.call(n, "key")) {
130
- var u = Object.getOwnPropertyDescriptor(n, "key").get;
128
+ function r(l) {
129
+ if (J.call(l, "key")) {
130
+ var u = Object.getOwnPropertyDescriptor(l, "key").get;
131
131
  if (u && u.isReactWarning) return !1;
132
132
  }
133
- return n.key !== void 0;
133
+ return l.key !== void 0;
134
134
  }
135
- function a(n, u) {
136
- function g() {
137
- $ || ($ = !0, console.error(
135
+ function a(l, u) {
136
+ function w() {
137
+ G || (G = !0, console.error(
138
138
  "%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)",
139
139
  u
140
140
  ));
141
141
  }
142
- g.isReactWarning = !0, Object.defineProperty(n, "key", {
143
- get: g,
142
+ w.isReactWarning = !0, Object.defineProperty(l, "key", {
143
+ get: w,
144
144
  configurable: !0
145
145
  });
146
146
  }
147
147
  function c() {
148
- var n = p(this.type);
149
- return z[n] || (z[n] = !0, console.error(
148
+ var l = p(this.type);
149
+ return X[l] || (X[l] = !0, console.error(
150
150
  "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."
151
- )), n = this.props.ref, n !== void 0 ? n : null;
151
+ )), l = this.props.ref, l !== void 0 ? l : null;
152
152
  }
153
- function h(n, u, g, b, N, H) {
154
- var w = g.ref;
155
- return n = {
156
- $$typeof: S,
157
- type: n,
153
+ function h(l, u, w, y, I, q) {
154
+ var E = w.ref;
155
+ return l = {
156
+ $$typeof: C,
157
+ type: l,
158
158
  key: u,
159
- props: g,
160
- _owner: b
161
- }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(n, "ref", {
159
+ props: w,
160
+ _owner: y
161
+ }, (E !== void 0 ? E : null) !== null ? Object.defineProperty(l, "ref", {
162
162
  enumerable: !1,
163
163
  get: c
164
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
164
+ }) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", {
165
165
  configurable: !1,
166
166
  enumerable: !1,
167
167
  writable: !0,
168
168
  value: 0
169
- }), Object.defineProperty(n, "_debugInfo", {
169
+ }), Object.defineProperty(l, "_debugInfo", {
170
170
  configurable: !1,
171
171
  enumerable: !1,
172
172
  writable: !0,
173
173
  value: null
174
- }), Object.defineProperty(n, "_debugStack", {
174
+ }), Object.defineProperty(l, "_debugStack", {
175
175
  configurable: !1,
176
176
  enumerable: !1,
177
177
  writable: !0,
178
- value: N
179
- }), Object.defineProperty(n, "_debugTask", {
178
+ value: I
179
+ }), Object.defineProperty(l, "_debugTask", {
180
180
  configurable: !1,
181
181
  enumerable: !1,
182
182
  writable: !0,
183
- value: H
184
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
183
+ value: q
184
+ }), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
185
185
  }
186
- function o(n, u, g, b, N, H) {
187
- var w = u.children;
188
- if (w !== void 0)
189
- if (b)
190
- if (le(w)) {
191
- for (b = 0; b < w.length; b++)
192
- d(w[b]);
193
- Object.freeze && Object.freeze(w);
186
+ function o(l, u, w, y, I, q) {
187
+ var E = u.children;
188
+ if (E !== void 0)
189
+ if (y)
190
+ if (ne(E)) {
191
+ for (y = 0; y < E.length; y++)
192
+ d(E[y]);
193
+ Object.freeze && Object.freeze(E);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else d(w);
199
- if (Y.call(u, "key")) {
200
- w = p(n);
201
- var x = Object.keys(u).filter(function(ne) {
202
- return ne !== "key";
198
+ else d(E);
199
+ if (J.call(u, "key")) {
200
+ E = p(l);
201
+ var N = Object.keys(u).filter(function(le) {
202
+ return le !== "key";
203
203
  });
204
- b = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", J[w + b] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
204
+ y = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", Q[E + y] || (N = 0 < N.length ? "{" + N.join(": ..., ") + ": ...}" : "{}", console.error(
205
205
  `A props object containing a "key" prop is being spread into JSX:
206
206
  let props = %s;
207
207
  <%s {...props} />
208
208
  React keys must be passed directly to JSX without using spread:
209
209
  let props = %s;
210
210
  <%s key={someKey} {...props} />`,
211
- b,
212
- w,
213
- x,
214
- w
215
- ), J[w + b] = !0);
211
+ y,
212
+ E,
213
+ N,
214
+ E
215
+ ), Q[E + y] = !0);
216
216
  }
217
- if (w = null, g !== void 0 && (t(g), w = "" + g), r(u) && (t(u.key), w = "" + u.key), "key" in u) {
218
- g = {};
219
- for (var F in u)
220
- F !== "key" && (g[F] = u[F]);
221
- } else g = u;
222
- return w && a(
223
- g,
224
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
217
+ if (E = null, w !== void 0 && (t(w), E = "" + w), r(u) && (t(u.key), E = "" + u.key), "key" in u) {
218
+ w = {};
219
+ for (var Y in u)
220
+ Y !== "key" && (w[Y] = u[Y]);
221
+ } else w = u;
222
+ return E && a(
223
+ w,
224
+ typeof l == "function" ? l.displayName || l.name || "Unknown" : l
225
225
  ), h(
226
- n,
226
+ l,
227
+ E,
227
228
  w,
228
- g,
229
229
  i(),
230
- N,
231
- H
230
+ I,
231
+ q
232
232
  );
233
233
  }
234
- function d(n) {
235
- m(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === _ && (n._payload.status === "fulfilled" ? m(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
234
+ function d(l) {
235
+ g(l) ? l._store && (l._store.validated = 1) : typeof l == "object" && l !== null && l.$$typeof === A && (l._payload.status === "fulfilled" ? g(l._payload.value) && l._payload.value._store && (l._payload.value._store.validated = 1) : l._store && (l._store.validated = 1));
236
236
  }
237
- function m(n) {
238
- return typeof n == "object" && n !== null && n.$$typeof === S;
237
+ function g(l) {
238
+ return typeof l == "object" && l !== null && l.$$typeof === C;
239
239
  }
240
- var f = ae, S = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), k = Symbol.for("react.consumer"), R = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), Q = Symbol.for("react.suspense"), ee = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), se = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), I = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, le = Array.isArray, B = console.createTask ? console.createTask : function() {
240
+ var f = ae, C = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), L = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), k = Symbol.for("react.context"), b = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), F = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), M = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), j = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ne = Array.isArray, U = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
243
  f = {
244
- react_stack_bottom_frame: function(n) {
245
- return n();
244
+ react_stack_bottom_frame: function(l) {
245
+ return l();
246
246
  }
247
247
  };
248
- var $, z = {}, W = f.react_stack_bottom_frame.bind(
248
+ var G, X = {}, K = f.react_stack_bottom_frame.bind(
249
249
  f,
250
- l
251
- )(), G = B(s(l)), J = {};
252
- T.Fragment = O, T.jsx = function(n, u, g) {
253
- var b = 1e4 > I.recentlyCreatedOwnerStacks++;
250
+ n
251
+ )(), Z = U(s(n)), Q = {};
252
+ _.Fragment = L, _.jsx = function(l, u, w) {
253
+ var y = 1e4 > j.recentlyCreatedOwnerStacks++;
254
254
  return o(
255
- n,
255
+ l,
256
256
  u,
257
- g,
257
+ w,
258
258
  !1,
259
- b ? Error("react-stack-top-frame") : W,
260
- b ? B(s(n)) : G
259
+ y ? Error("react-stack-top-frame") : K,
260
+ y ? U(s(l)) : Z
261
261
  );
262
- }, T.jsxs = function(n, u, g) {
263
- var b = 1e4 > I.recentlyCreatedOwnerStacks++;
262
+ }, _.jsxs = function(l, u, w) {
263
+ var y = 1e4 > j.recentlyCreatedOwnerStacks++;
264
264
  return o(
265
- n,
265
+ l,
266
266
  u,
267
- g,
267
+ w,
268
268
  !0,
269
- b ? Error("react-stack-top-frame") : W,
270
- b ? B(s(n)) : G
269
+ y ? Error("react-stack-top-frame") : K,
270
+ y ? U(s(l)) : Z
271
271
  );
272
272
  };
273
- }()), T;
273
+ }()), _;
274
274
  }
275
- var Z;
275
+ var se;
276
276
  function de() {
277
- return Z || (Z = 1, process.env.NODE_ENV === "production" ? D.exports = ce() : D.exports = he()), D.exports;
277
+ return se || (se = 1, process.env.NODE_ENV === "production" ? B.exports = ce() : B.exports = he()), B.exports;
278
278
  }
279
279
  var ue = de();
280
280
  class fe {
@@ -341,35 +341,35 @@ class fe {
341
341
  e || (e = {}), this.main = e.main || "ss-main", this.placeholder = e.placeholder || "ss-placeholder", this.values = e.values || "ss-values", this.single = e.single || "ss-single", this.max = e.max || "ss-max", this.value = e.value || "ss-value", this.valueText = e.valueText || "ss-value-text", this.valueDelete = e.valueDelete || "ss-value-delete", this.valueOut = e.valueOut || "ss-value-out", this.deselect = e.deselect || "ss-deselect", this.deselectPath = e.deselectPath || "M10,10 L90,90 M10,90 L90,10", this.arrow = e.arrow || "ss-arrow", this.arrowClose = e.arrowClose || "M10,30 L50,70 L90,30", this.arrowOpen = e.arrowOpen || "M10,70 L50,30 L90,70", this.content = e.content || "ss-content", this.contentOpen = e.contentOpen || "ss-open", this.dirAbove = e.dirAbove || "ss-dir-above", this.dirBelow = e.dirBelow || "ss-dir-below", this.search = e.search || "ss-search", this.searchHighlighter = e.searchHighlighter || "ss-search-highlight", this.searching = e.searching || "ss-searching", this.addable = e.addable || "ss-addable", this.addablePath = e.addablePath || "M50,10 L50,90 M10,50 L90,50", this.list = e.list || "ss-list", this.optgroup = e.optgroup || "ss-optgroup", this.optgroupLabel = e.optgroupLabel || "ss-optgroup-label", this.optgroupLabelText = e.optgroupLabelText || "ss-optgroup-label-text", this.optgroupActions = e.optgroupActions || "ss-optgroup-actions", this.optgroupSelectAll = e.optgroupSelectAll || "ss-selectall", this.optgroupSelectAllBox = e.optgroupSelectAllBox || "M60,10 L10,10 L10,90 L90,90 L90,50", this.optgroupSelectAllCheck = e.optgroupSelectAllCheck || "M30,45 L50,70 L90,10", this.optgroupClosable = e.optgroupClosable || "ss-closable", this.option = e.option || "ss-option", this.optionDelete = e.optionDelete || "M10,10 L90,90 M10,90 L90,10", this.highlighted = e.highlighted || "ss-highlighted", this.mainOpen = e.mainOpen || "ss-open", this.close = e.close || "ss-close", this.selected = e.selected || "ss-selected", this.error = e.error || "ss-error", this.disabled = e.disabled || "ss-disabled", this.hide = e.hide || "ss-hide";
342
342
  }
343
343
  }
344
- function U() {
344
+ function W() {
345
345
  return Math.random().toString(36).substring(2, 10);
346
346
  }
347
347
  function pe(p, e) {
348
- function t(i, l) {
349
- return l && i && i.classList && i.classList.contains(l) || l && i && i.dataset && i.dataset.id && i.dataset.id === e ? i : null;
348
+ function t(i, n) {
349
+ return n && i && i.classList && i.classList.contains(n) || n && i && i.dataset && i.dataset.id && i.dataset.id === e ? i : null;
350
350
  }
351
- function s(i, l) {
352
- return !i || i === document ? null : t(i, l) ? i : s(i.parentNode, l);
351
+ function s(i, n) {
352
+ return !i || i === document ? null : t(i, n) ? i : s(i.parentNode, n);
353
353
  }
354
354
  return t(p, e) || s(p, e);
355
355
  }
356
- function P(p, e = 50, t = !1) {
356
+ function H(p, e = 50, t = !1) {
357
357
  let s;
358
358
  return function(...i) {
359
- const l = self, r = () => {
360
- s = null, t || p.apply(l, i);
359
+ const n = self, r = () => {
360
+ s = null, t || p.apply(n, i);
361
361
  }, a = t && !s;
362
- clearTimeout(s), s = setTimeout(r, e), a && p.apply(l, i);
362
+ clearTimeout(s), s = setTimeout(r, e), a && p.apply(n, i);
363
363
  };
364
364
  }
365
- function q(p, e) {
365
+ function z(p, e) {
366
366
  return JSON.stringify(p) === JSON.stringify(e);
367
367
  }
368
368
  function me(p) {
369
369
  const e = p.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, (t) => "-" + t.toLowerCase());
370
370
  return p[0] === p[0].toUpperCase() ? e.substring(1) : e;
371
371
  }
372
- class v {
372
+ class S {
373
373
  id;
374
374
  value;
375
375
  text;
@@ -384,10 +384,10 @@ class v {
384
384
  data;
385
385
  mandatory;
386
386
  constructor(e) {
387
- this.id = !e.id || e.id === "" ? U() : e.id, this.value = e.value === void 0 ? e.text || "" : e.value || "", this.text = e.text || "", this.html = e.html || "", this.defaultSelected = e.defaultSelected !== void 0 ? e.defaultSelected : !1, this.selected = e.selected !== void 0 ? e.selected : !1, this.display = e.display !== void 0 ? e.display : !0, this.disabled = e.disabled !== void 0 ? e.disabled : !1, this.mandatory = e.mandatory !== void 0 ? e.mandatory : !1, this.placeholder = e.placeholder !== void 0 ? e.placeholder : !1, this.class = e.class || "", this.style = e.style || "", this.data = e.data || {};
387
+ this.id = !e.id || e.id === "" ? W() : e.id, this.value = e.value === void 0 ? e.text || "" : e.value || "", this.text = e.text || "", this.html = e.html || "", this.defaultSelected = e.defaultSelected !== void 0 ? e.defaultSelected : !1, this.selected = e.selected !== void 0 ? e.selected : !1, this.display = e.display !== void 0 ? e.display : !0, this.disabled = e.disabled !== void 0 ? e.disabled : !1, this.mandatory = e.mandatory !== void 0 ? e.mandatory : !1, this.placeholder = e.placeholder !== void 0 ? e.placeholder : !1, this.class = e.class || "", this.style = e.style || "", this.data = e.data || {};
388
388
  }
389
389
  }
390
- class L {
390
+ class x {
391
391
  id;
392
392
  label;
393
393
  selectAll;
@@ -395,9 +395,9 @@ class L {
395
395
  closable;
396
396
  options;
397
397
  constructor(e) {
398
- if (this.id = !e.id || e.id === "" ? U() : e.id, this.label = e.label || "", this.selectAll = e.selectAll === void 0 ? !1 : e.selectAll, this.selectAllText = e.selectAllText || "Select All", this.closable = e.closable || "off", this.options = [], e.options)
398
+ if (this.id = !e.id || e.id === "" ? W() : e.id, this.label = e.label || "", this.selectAll = e.selectAll === void 0 ? !1 : e.selectAll, this.selectAllText = e.selectAllText || "Select All", this.closable = e.closable || "off", this.options = [], e.options)
399
399
  for (const t of e.options)
400
- this.options.push(new v(t));
400
+ this.options.push(new S(t));
401
401
  }
402
402
  }
403
403
  class ge {
@@ -414,7 +414,7 @@ class ge {
414
414
  return new Error("Data must be an array");
415
415
  for (let t of e)
416
416
  if (t)
417
- if (t instanceof L || "label" in t) {
417
+ if (t instanceof x || "label" in t) {
418
418
  if (!("label" in t))
419
419
  return new Error("Optgroup must have a label");
420
420
  if ("options" in t && t.options)
@@ -423,7 +423,7 @@ class ge {
423
423
  if (i)
424
424
  return i;
425
425
  }
426
- } else if (t instanceof v || "text" in t) {
426
+ } else if (t instanceof S || "text" in t) {
427
427
  const s = this.validateOption(t);
428
428
  if (s)
429
429
  return s;
@@ -439,28 +439,28 @@ class ge {
439
439
  let t = [];
440
440
  return e.forEach((s) => {
441
441
  if (s) {
442
- if (s instanceof L || "label" in s) {
442
+ if (s instanceof x || "label" in s) {
443
443
  let i = [];
444
- "options" in s && s.options && s.options.forEach((l) => {
445
- i.push(new v(l));
446
- }), i.length > 0 && t.push(new L(s));
444
+ "options" in s && s.options && s.options.forEach((n) => {
445
+ i.push(new S(n));
446
+ }), i.length > 0 && t.push(new x(s));
447
447
  }
448
- (s instanceof v || "text" in s) && t.push(new v(s));
448
+ (s instanceof S || "text" in s) && t.push(new S(s));
449
449
  }
450
450
  }), t;
451
451
  }
452
452
  setData(e, t = !1) {
453
453
  const s = this.partialToFullData(e);
454
454
  if (t) {
455
- const i = this.getSelectedOptions(), l = [];
455
+ const i = this.getSelectedOptions(), n = [];
456
456
  i.forEach((r) => {
457
457
  let a = !1;
458
458
  for (const c of s) {
459
- if (c instanceof v && c.id === r.id) {
459
+ if (c instanceof S && c.id === r.id) {
460
460
  a = !0;
461
461
  break;
462
462
  }
463
- if (c instanceof L) {
463
+ if (c instanceof x) {
464
464
  for (const h of c.options)
465
465
  if (h.id === r.id) {
466
466
  a = !0;
@@ -468,8 +468,8 @@ class ge {
468
468
  }
469
469
  }
470
470
  }
471
- a || l.push(r);
472
- }), this.data = [...l, ...s];
471
+ a || n.push(r);
472
+ }), this.data = [...n, ...s];
473
473
  } else
474
474
  this.data = s;
475
475
  this.selectType === "single" && this.setSelectedBy("id", this.getSelected());
@@ -485,28 +485,28 @@ class ge {
485
485
  }
486
486
  addOption(e, t = !1) {
487
487
  if (t) {
488
- let s = [new v(e)];
488
+ let s = [new S(e)];
489
489
  this.setData(s.concat(this.getData()));
490
490
  } else
491
- this.setData(this.getData().concat(new v(e)));
491
+ this.setData(this.getData().concat(new S(e)));
492
492
  }
493
493
  // Pass in an array of id that will loop through
494
494
  // each option and set the selected property to true
495
495
  // but also clean selected by determining selectType
496
496
  setSelectedBy(e, t) {
497
497
  let s = null, i = !1;
498
- const l = [];
498
+ const n = [];
499
499
  for (let a of this.data) {
500
- if (a instanceof L)
500
+ if (a instanceof x)
501
501
  for (let c of a.options) {
502
502
  s || (s = c);
503
503
  let h = c[e] || "";
504
- c.selected = i ? !1 : t.includes(h), c.selected && (l.push(c), this.selectType === "single" && (i = !0));
504
+ c.selected = i ? !1 : t.includes(h), c.selected && (n.push(c), this.selectType === "single" && (i = !0));
505
505
  }
506
- a instanceof v && (s || (s = a), a.selected = i ? !1 : t.includes(a[e]), a.selected && (l.push(a), this.selectType === "single" && (i = !0)));
506
+ a instanceof S && (s || (s = a), a.selected = i ? !1 : t.includes(a[e]), a.selected && (n.push(a), this.selectType === "single" && (i = !0)));
507
507
  }
508
- this.selectType === "single" && s && !i && (s.selected = !0, l.push(s));
509
- const r = t.map((a) => l.find((c) => c[e] === a)?.id || "");
508
+ this.selectType === "single" && s && !i && (s.selected = !0, n.push(s));
509
+ const r = t.map((a) => n.find((c) => c[e] === a)?.id || "");
510
510
  this.selectedOrder = r;
511
511
  }
512
512
  getSelected() {
@@ -520,7 +520,7 @@ class ge {
520
520
  }
521
521
  getOptgroupByID(e) {
522
522
  for (let t of this.data)
523
- if (t instanceof L && t.id === e)
523
+ if (t instanceof x && t.id === e)
524
524
  return t;
525
525
  return null;
526
526
  }
@@ -534,7 +534,7 @@ class ge {
534
534
  getFirstOption() {
535
535
  let e = null;
536
536
  for (let t of this.data)
537
- if (t instanceof L ? e = t.options[0] : t instanceof v && (e = t), e)
537
+ if (t instanceof x ? e = t.options[0] : t instanceof S && (e = t), e)
538
538
  break;
539
539
  return e;
540
540
  }
@@ -547,28 +547,28 @@ class ge {
547
547
  filter(e, t) {
548
548
  const s = [];
549
549
  return this.data.forEach((i) => {
550
- if (i instanceof L) {
551
- let l = [];
550
+ if (i instanceof x) {
551
+ let n = [];
552
552
  if (i.options.forEach((a) => {
553
- (!e || e(a)) && (t ? l.push(new v(a)) : s.push(new v(a)));
554
- }), l.length > 0) {
555
- let a = new L(i);
556
- a.options = l, s.push(a);
553
+ (!e || e(a)) && (t ? n.push(new S(a)) : s.push(new S(a)));
554
+ }), n.length > 0) {
555
+ let a = new x(i);
556
+ a.options = n, s.push(a);
557
557
  }
558
558
  }
559
- i instanceof v && (!e || e(i)) && s.push(new v(i));
559
+ i instanceof S && (!e || e(i)) && s.push(new S(i));
560
560
  }), s;
561
561
  }
562
562
  // Take in an array of options and reoder them based upon the selected order
563
563
  selectedOrderOptions(e) {
564
564
  const t = [];
565
565
  return this.selectedOrder.forEach((s) => {
566
- const i = e.find((l) => l.id === s);
566
+ const i = e.find((n) => n.id === s);
567
567
  i && t.push(i);
568
568
  }), e.forEach((s) => {
569
569
  let i = !1;
570
- t.forEach((l) => {
571
- if (s.id === l.id) {
570
+ t.forEach((n) => {
571
+ if (s.id === n.id) {
572
572
  i = !0;
573
573
  return;
574
574
  }
@@ -604,8 +604,8 @@ class ve {
604
604
  this.main.main.classList.add(t), this.content.main.classList.add(t), this.content.main.classList.add(this.classes.contentOpen), this.content.search.input.removeAttribute("aria-hidden"), this.moveContent();
605
605
  const s = this.store.getSelectedOptions();
606
606
  if (s.length) {
607
- const i = s[s.length - 1].id, l = this.content.list.querySelector('[data-id="' + i + '"]');
608
- l && this.ensureElementInView(this.content.list, l);
607
+ const i = s[s.length - 1].id, n = this.content.list.querySelector('[data-id="' + i + '"]');
608
+ n && this.ensureElementInView(this.content.list, n);
609
609
  }
610
610
  }
611
611
  close() {
@@ -654,21 +654,21 @@ class ve {
654
654
  if (h.stopPropagation(), this.settings.disabled)
655
655
  return;
656
656
  let o = !0;
657
- const d = this.store.getSelectedOptions(), m = [];
658
- if (this.callbacks.beforeChange && (o = this.callbacks.beforeChange(m, d) === !0), o) {
657
+ const d = this.store.getSelectedOptions(), g = [];
658
+ if (this.callbacks.beforeChange && (o = this.callbacks.beforeChange(g, d) === !0), o) {
659
659
  if (this.settings.isMultiple)
660
660
  this.callbacks.setSelected([], !1), this.updateDeselectAll();
661
661
  else {
662
- const f = this.store.getFirstOption(), S = f ? f.id : "";
663
- this.callbacks.setSelected(S, !1);
662
+ const f = this.store.getFirstOption(), C = f ? f.id : "";
663
+ this.callbacks.setSelected(C, !1);
664
664
  }
665
665
  this.settings.closeOnSelect && this.callbacks.close(), this.callbacks.afterChange && this.callbacks.afterChange(this.store.getSelectedOptions());
666
666
  }
667
667
  };
668
- const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
669
- l.setAttribute("viewBox", "0 0 100 100");
668
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
669
+ n.setAttribute("viewBox", "0 0 100 100");
670
670
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
671
- r.setAttribute("d", this.classes.deselectPath), l.appendChild(r), s.appendChild(l), e.appendChild(s);
671
+ r.setAttribute("d", this.classes.deselectPath), n.appendChild(r), s.appendChild(n), e.appendChild(s);
672
672
  const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
673
673
  a.classList.add(this.classes.arrow), a.setAttribute("viewBox", "0 0 100 100");
674
674
  const c = document.createElementNS("http://www.w3.org/2000/svg", "path");
@@ -677,7 +677,7 @@ class ve {
677
677
  values: t,
678
678
  deselect: {
679
679
  main: s,
680
- svg: l,
680
+ svg: n,
681
681
  path: r
682
682
  },
683
683
  arrow: {
@@ -735,8 +735,8 @@ class ve {
735
735
  this.settings.keepOrder && (t = this.store.selectedOrderOptions(t));
736
736
  let s = [];
737
737
  for (let i = 0; i < e.length; i++) {
738
- const l = e[i], r = l.getAttribute("data-id");
739
- r && (t.filter((c) => c.id === r, !1).length || s.push(l));
738
+ const n = e[i], r = n.getAttribute("data-id");
739
+ r && (t.filter((c) => c.id === r, !1).length || s.push(n));
740
740
  }
741
741
  for (const i of s)
742
742
  i.classList.add(this.classes.valueOut), setTimeout(() => {
@@ -744,10 +744,10 @@ class ve {
744
744
  }, 100);
745
745
  e = this.main.values.childNodes;
746
746
  for (let i = 0; i < t.length; i++) {
747
- let l = !0;
747
+ let n = !0;
748
748
  for (let r = 0; r < e.length; r++)
749
- t[i].id === String(e[r].dataset.id) && (l = !1);
750
- l && (this.settings.keepOrder ? this.main.values.appendChild(this.multipleValue(t[i])) : e.length === 0 ? this.main.values.appendChild(this.multipleValue(t[i])) : i === 0 ? this.main.values.insertBefore(this.multipleValue(t[i]), e[i]) : e[i - 1].insertAdjacentElement("afterend", this.multipleValue(t[i])));
749
+ t[i].id === String(e[r].dataset.id) && (n = !1);
750
+ n && (this.settings.keepOrder ? this.main.values.appendChild(this.multipleValue(t[i])) : e.length === 0 ? this.main.values.appendChild(this.multipleValue(t[i])) : i === 0 ? this.main.values.insertBefore(this.multipleValue(t[i]), e[i]) : e[i - 1].insertAdjacentElement("afterend", this.multipleValue(t[i])));
751
751
  }
752
752
  }
753
753
  multipleValue(e) {
@@ -763,19 +763,19 @@ class ve {
763
763
  const h = this.store.getSelectedOptions(), o = h.filter((d) => d.selected && d.id !== e.id, !0);
764
764
  if (!(this.settings.minSelected && o.length < this.settings.minSelected) && (this.callbacks.beforeChange && (c = this.callbacks.beforeChange(o, h) === !0), c)) {
765
765
  let d = [];
766
- for (const m of o) {
767
- if (m instanceof L)
768
- for (const f of m.options)
766
+ for (const g of o) {
767
+ if (g instanceof x)
768
+ for (const f of g.options)
769
769
  f.id && d.push(f.id);
770
- m instanceof v && d.push(m.id);
770
+ g instanceof S && d.push(g.id);
771
771
  }
772
772
  this.callbacks.setSelected(d, !1), this.settings.closeOnSelect && this.callbacks.close(), this.callbacks.afterChange && this.callbacks.afterChange(o), this.updateDeselectAll();
773
773
  }
774
774
  };
775
- const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
776
- l.setAttribute("viewBox", "0 0 100 100");
775
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
776
+ n.setAttribute("viewBox", "0 0 100 100");
777
777
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
778
- r.setAttribute("d", this.classes.optionDelete), l.appendChild(r), i.appendChild(l), t.appendChild(i), i.onkeydown = (a) => {
778
+ r.setAttribute("d", this.classes.optionDelete), n.appendChild(r), i.appendChild(n), t.appendChild(i), i.onkeydown = (a) => {
779
779
  a.key === "Enter" && i.click();
780
780
  };
781
781
  }
@@ -814,13 +814,13 @@ class ve {
814
814
  main: e,
815
815
  input: t
816
816
  };
817
- if (this.settings.showSearch || (e.classList.add(this.classes.hide), t.readOnly = !0), t.type = "search", t.placeholder = this.settings.searchPlaceholder, t.tabIndex = -1, t.setAttribute("aria-label", this.settings.searchPlaceholder), t.setAttribute("aria-autocomplete", "list"), t.setAttribute("autocapitalize", "off"), t.setAttribute("autocomplete", "off"), t.setAttribute("autocorrect", "off"), t.setAttribute("aria-hidden", "true"), t.oninput = P((l) => {
818
- this.callbacks.search(l.target.value);
819
- }, 100), t.onkeydown = (l) => {
820
- switch (l.key) {
817
+ if (this.settings.showSearch || (e.classList.add(this.classes.hide), t.readOnly = !0), t.type = "search", t.placeholder = this.settings.searchPlaceholder, t.tabIndex = -1, t.setAttribute("aria-label", this.settings.searchPlaceholder), t.setAttribute("aria-autocomplete", "list"), t.setAttribute("autocapitalize", "off"), t.setAttribute("autocomplete", "off"), t.setAttribute("autocorrect", "off"), t.setAttribute("aria-hidden", "true"), t.oninput = H((n) => {
818
+ this.callbacks.search(n.target.value);
819
+ }, 100), t.onkeydown = (n) => {
820
+ switch (n.key) {
821
821
  case "ArrowUp":
822
822
  case "ArrowDown":
823
- return l.key === "ArrowDown" ? this.highlight("down") : this.highlight("up"), !1;
823
+ return n.key === "ArrowDown" ? this.highlight("down") : this.highlight("up"), !1;
824
824
  case "Tab":
825
825
  return this.callbacks.close(), !0;
826
826
  // Continue doing normal tabbing
@@ -836,10 +836,10 @@ class ve {
836
836
  return !0;
837
837
  }, e.appendChild(t), this.callbacks.addable) {
838
838
  s.classList.add(this.classes.addable);
839
- const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
840
- l.setAttribute("viewBox", "0 0 100 100");
839
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
840
+ n.setAttribute("viewBox", "0 0 100 100");
841
841
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
842
- r.setAttribute("d", this.classes.addablePath), l.appendChild(r), s.appendChild(l), s.onclick = (a) => {
842
+ r.setAttribute("d", this.classes.addablePath), n.appendChild(r), s.appendChild(n), s.onclick = (a) => {
843
843
  if (a.preventDefault(), a.stopPropagation(), !this.callbacks.addable)
844
844
  return;
845
845
  const c = this.content.search.input.value.trim();
@@ -848,12 +848,12 @@ class ve {
848
848
  return;
849
849
  }
850
850
  const h = (d) => {
851
- let m = new v(d);
852
- if (this.callbacks.addOption(m), this.settings.isMultiple) {
851
+ let g = new S(d);
852
+ if (this.callbacks.addOption(g), this.settings.isMultiple) {
853
853
  let f = this.store.getSelected();
854
- f.push(m.id), this.callbacks.setSelected(f, !0);
854
+ f.push(g.id), this.callbacks.setSelected(f, !0);
855
855
  } else
856
- this.callbacks.setSelected([m.id], !0);
856
+ this.callbacks.setSelected([g.id], !0);
857
857
  this.callbacks.search(""), this.settings.closeOnSelect && setTimeout(() => {
858
858
  this.callbacks.close();
859
859
  }, 100);
@@ -869,7 +869,7 @@ class ve {
869
869
  }) : o instanceof Error ? this.renderError(o.message) : h(o));
870
870
  }, e.appendChild(s), i.addable = {
871
871
  main: s,
872
- svg: l,
872
+ svg: n,
873
873
  path: r
874
874
  };
875
875
  }
@@ -892,25 +892,25 @@ class ve {
892
892
  return;
893
893
  }
894
894
  let s = !1;
895
- for (const l of t)
896
- l.classList.contains(this.classes.highlighted) && (s = !0);
895
+ for (const n of t)
896
+ n.classList.contains(this.classes.highlighted) && (s = !0);
897
897
  if (!s) {
898
- for (const l of t)
899
- if (l.classList.contains(this.classes.selected)) {
900
- l.classList.add(this.classes.highlighted);
898
+ for (const n of t)
899
+ if (n.classList.contains(this.classes.selected)) {
900
+ n.classList.add(this.classes.highlighted);
901
901
  break;
902
902
  }
903
903
  }
904
- for (let l = 0; l < t.length; l++)
905
- if (t[l].classList.contains(this.classes.highlighted)) {
906
- const r = t[l];
904
+ for (let n = 0; n < t.length; n++)
905
+ if (t[n].classList.contains(this.classes.highlighted)) {
906
+ const r = t[n];
907
907
  r.classList.remove(this.classes.highlighted);
908
908
  const a = r.parentElement;
909
909
  if (a && a.classList.contains(this.classes.mainOpen)) {
910
910
  const o = a.querySelector("." + this.classes.optgroupLabel);
911
911
  o && o.click();
912
912
  }
913
- let c = t[e === "down" ? l + 1 < t.length ? l + 1 : 0 : l - 1 >= 0 ? l - 1 : t.length - 1];
913
+ let c = t[e === "down" ? n + 1 < t.length ? n + 1 : 0 : n - 1 >= 0 ? n - 1 : t.length - 1];
914
914
  c.classList.add(this.classes.highlighted), this.ensureElementInView(this.content.list, c), c.id && this.main.main.setAttribute("aria-activedescendant", c.id);
915
915
  const h = c.parentElement;
916
916
  if (h && h.classList.contains(this.classes.close)) {
@@ -947,7 +947,7 @@ class ve {
947
947
  return;
948
948
  }
949
949
  this.settings.allowDeselect && !this.settings.isMultiple && (this.store.filter((i) => i.placeholder, !1).length || this.store.addOption(
950
- new v({
950
+ new S({
951
951
  text: "",
952
952
  value: "",
953
953
  selected: !1,
@@ -957,20 +957,20 @@ class ve {
957
957
  ));
958
958
  const t = document.createDocumentFragment();
959
959
  for (const s of e) {
960
- if (s instanceof L) {
960
+ if (s instanceof x) {
961
961
  const i = document.createElement("div");
962
962
  i.classList.add(this.classes.optgroup);
963
- const l = document.createElement("div");
964
- l.classList.add(this.classes.optgroupLabel), i.appendChild(l);
963
+ const n = document.createElement("div");
964
+ n.classList.add(this.classes.optgroupLabel), i.appendChild(n);
965
965
  const r = document.createElement("div");
966
- r.classList.add(this.classes.optgroupLabelText), r.textContent = s.label, l.appendChild(r);
966
+ r.classList.add(this.classes.optgroupLabelText), r.textContent = s.label, n.appendChild(r);
967
967
  const a = document.createElement("div");
968
- if (a.classList.add(this.classes.optgroupActions), l.appendChild(a), this.settings.isMultiple && s.selectAll) {
968
+ if (a.classList.add(this.classes.optgroupActions), n.appendChild(a), this.settings.isMultiple && s.selectAll) {
969
969
  const c = document.createElement("div");
970
970
  c.classList.add(this.classes.optgroupSelectAll);
971
971
  let h = !0;
972
- for (const S of s.options)
973
- if (!S.selected) {
972
+ for (const C of s.options)
973
+ if (!C.selected) {
974
974
  h = !1;
975
975
  break;
976
976
  }
@@ -979,27 +979,27 @@ class ve {
979
979
  o.textContent = s.selectAllText, c.appendChild(o);
980
980
  const d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
981
981
  d.setAttribute("viewBox", "0 0 100 100"), c.appendChild(d);
982
- const m = document.createElementNS("http://www.w3.org/2000/svg", "path");
983
- m.setAttribute("d", this.classes.optgroupSelectAllBox), d.appendChild(m);
982
+ const g = document.createElementNS("http://www.w3.org/2000/svg", "path");
983
+ g.setAttribute("d", this.classes.optgroupSelectAllBox), d.appendChild(g);
984
984
  const f = document.createElementNS("http://www.w3.org/2000/svg", "path");
985
- f.setAttribute("d", this.classes.optgroupSelectAllCheck), d.appendChild(f), c.addEventListener("click", (S) => {
986
- S.preventDefault(), S.stopPropagation();
987
- const E = this.store.getSelected();
985
+ f.setAttribute("d", this.classes.optgroupSelectAllCheck), d.appendChild(f), c.addEventListener("click", (C) => {
986
+ C.preventDefault(), C.stopPropagation();
987
+ const m = this.store.getSelected();
988
988
  if (h) {
989
- const O = E.filter((C) => {
990
- for (const y of s.options)
991
- if (C === y.id)
989
+ const L = m.filter((O) => {
990
+ for (const v of s.options)
991
+ if (O === v.id)
992
992
  return !1;
993
993
  return !0;
994
994
  });
995
- this.callbacks.setSelected(O, !0);
995
+ this.callbacks.setSelected(L, !0);
996
996
  return;
997
997
  } else {
998
- let O = s.options.map((y) => y.id).filter((y) => y !== void 0);
999
- const C = E.concat(O);
1000
- for (const y of s.options)
1001
- y.id && !this.store.getOptionByID(y.id) && this.callbacks.addOption(new v(y));
1002
- this.callbacks.setSelected(C, !0);
998
+ let L = s.options.map((v) => v.id).filter((v) => v !== void 0);
999
+ const O = m.concat(L);
1000
+ for (const v of s.options)
1001
+ v.id && !this.store.getOptionByID(v.id) && this.callbacks.addOption(new S(v));
1002
+ this.callbacks.setSelected(O, !0);
1003
1003
  return;
1004
1004
  }
1005
1005
  }), a.appendChild(c);
@@ -1010,15 +1010,15 @@ class ve {
1010
1010
  const h = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1011
1011
  h.setAttribute("viewBox", "0 0 100 100"), h.classList.add(this.classes.arrow), c.appendChild(h);
1012
1012
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1013
- h.appendChild(o), s.options.some((d) => d.selected) || this.content.search.input.value.trim() !== "" ? (c.classList.add(this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "open" ? (i.classList.add(this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "close" && (i.classList.add(this.classes.close), o.setAttribute("d", this.classes.arrowClose)), l.addEventListener("click", (d) => {
1013
+ h.appendChild(o), s.options.some((d) => d.selected) || this.content.search.input.value.trim() !== "" ? (c.classList.add(this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "open" ? (i.classList.add(this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "close" && (i.classList.add(this.classes.close), o.setAttribute("d", this.classes.arrowClose)), n.addEventListener("click", (d) => {
1014
1014
  d.preventDefault(), d.stopPropagation(), i.classList.contains(this.classes.close) ? (i.classList.remove(this.classes.close), i.classList.add(this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : (i.classList.remove(this.classes.mainOpen), i.classList.add(this.classes.close), o.setAttribute("d", this.classes.arrowClose));
1015
1015
  }), a.appendChild(c);
1016
1016
  }
1017
- i.appendChild(l);
1017
+ i.appendChild(n);
1018
1018
  for (const c of s.options)
1019
- i.appendChild(this.option(new v(c))), t.appendChild(i);
1019
+ i.appendChild(this.option(new S(c))), t.appendChild(i);
1020
1020
  }
1021
- s instanceof v && t.appendChild(this.option(s));
1021
+ s instanceof S && t.appendChild(this.option(s));
1022
1022
  }
1023
1023
  this.content.list.appendChild(t);
1024
1024
  }
@@ -1037,7 +1037,7 @@ class ve {
1037
1037
  this.classes.searchHighlighter
1038
1038
  ) : e.html !== "" ? t.innerHTML = e.html : t.textContent = e.text, this.settings.showOptionTooltips && t.textContent && t.setAttribute("title", t.textContent), e.display || t.classList.add(this.classes.hide), e.disabled && t.classList.add(this.classes.disabled), e.selected && this.settings.hideSelected && t.classList.add(this.classes.hide), e.selected ? (t.classList.add(this.classes.selected), t.setAttribute("aria-selected", "true"), this.main.main.setAttribute("aria-activedescendant", t.id)) : (t.classList.remove(this.classes.selected), t.setAttribute("aria-selected", "false")), t.addEventListener("click", (s) => {
1039
1039
  s.preventDefault(), s.stopPropagation();
1040
- const i = this.store.getSelected(), l = s.currentTarget, r = String(l.dataset.id), a = s.ctrlKey || s.metaKey;
1040
+ const i = this.store.getSelected(), n = s.currentTarget, r = String(n.dataset.id), a = s.ctrlKey || s.metaKey;
1041
1041
  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)
1042
1042
  return;
1043
1043
  let c = !1;
@@ -1046,10 +1046,10 @@ class ve {
1046
1046
  if (this.settings.isMultiple) {
1047
1047
  const d = h.some((f) => f.id === r);
1048
1048
  if (s.shiftKey && this.lastSelectedOption) {
1049
- const f = this.store.getDataOptions(), S = f.findIndex((O) => O.id === this.lastSelectedOption.id), E = f.findIndex((O) => O.id === e.id);
1050
- if (S >= 0 && E >= 0) {
1051
- const O = Math.min(S, E), C = Math.max(S, E), k = f.slice(O, C + 1).filter((R) => !h.find((M) => M.id === R.id));
1052
- h.length + k.length <= this.settings.maxSelected ? o = h.concat(k) : o = h;
1049
+ const f = this.store.getDataOptions(), C = f.findIndex((L) => L.id === this.lastSelectedOption.id), m = f.findIndex((L) => L.id === e.id);
1050
+ if (C >= 0 && m >= 0) {
1051
+ const L = Math.min(C, m), O = Math.max(C, m), T = f.slice(L, O + 1).filter((k) => !h.find((b) => b.id === k.id));
1052
+ h.length + T.length <= this.settings.maxSelected ? o = h.concat(T) : o = h;
1053
1053
  } else
1054
1054
  o = h;
1055
1055
  } 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);
@@ -1071,17 +1071,17 @@ class ve {
1071
1071
  const i = t.trim();
1072
1072
  if (i === "")
1073
1073
  return e;
1074
- const l = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = document.createElement("div");
1074
+ const n = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = document.createElement("div");
1075
1075
  r.innerHTML = e;
1076
1076
  const a = (c) => {
1077
1077
  if (c.nodeType === Node.TEXT_NODE) {
1078
- const h = c.textContent || "", o = new RegExp("(" + l + ")", "i");
1078
+ const h = c.textContent || "", o = new RegExp("(" + n + ")", "i");
1079
1079
  if (o.test(h)) {
1080
1080
  const d = document.createElement("span");
1081
- h.split(o).forEach((f, S) => {
1081
+ h.split(o).forEach((f, C) => {
1082
1082
  if (f && o.test(f)) {
1083
- const E = document.createElement("mark");
1084
- E.className = s, E.textContent = f, d.appendChild(E);
1083
+ const m = document.createElement("mark");
1084
+ m.className = s, m.textContent = f, d.appendChild(m);
1085
1085
  } else f && d.appendChild(document.createTextNode(f));
1086
1086
  }), c.parentNode?.replaceChild(d, c);
1087
1087
  }
@@ -1101,8 +1101,8 @@ class ve {
1101
1101
  this.content.main.style.margin = "-1px 0px 0px 0px", this.settings.contentPosition !== "relative" && (this.content.main.style.top = e.top + e.height + (this.settings.contentPosition === "fixed" ? 0 : window.scrollY) + "px", this.content.main.style.left = e.left + (this.settings.contentPosition === "fixed" ? 0 : window.scrollX) + "px", this.content.main.style.width = e.width + "px");
1102
1102
  }
1103
1103
  ensureElementInView(e, t) {
1104
- const s = e.scrollTop + e.offsetTop, i = s + e.clientHeight, l = t.offsetTop, r = l + t.clientHeight;
1105
- l < s ? e.scrollTop -= s - l : r > i && (e.scrollTop += r - i);
1104
+ const s = e.scrollTop + e.offsetTop, i = s + e.clientHeight, n = t.offsetTop, r = n + t.clientHeight;
1105
+ n < s ? e.scrollTop -= s - n : r > i && (e.scrollTop += r - i);
1106
1106
  }
1107
1107
  putContent() {
1108
1108
  const e = this.main.main.offsetHeight, t = this.main.main.getBoundingClientRect(), s = this.content.main.offsetHeight;
@@ -1112,8 +1112,8 @@ class ve {
1112
1112
  updateDeselectAll() {
1113
1113
  if (!this.store || !this.settings)
1114
1114
  return;
1115
- const e = this.store.getSelectedOptions(), t = e && e.length > 0, s = this.settings.isMultiple, i = this.settings.allowDeselect, l = this.main.deselect.main, r = this.classes.hide;
1116
- i && !(s && !t) ? l.classList.remove(r) : l.classList.add(r);
1115
+ const e = this.store.getSelectedOptions(), t = e && e.length > 0, s = this.settings.isMultiple, i = this.settings.allowDeselect, n = this.main.deselect.main, r = this.classes.hide;
1116
+ i && !(s && !t) ? n.classList.remove(r) : n.classList.add(r);
1117
1117
  }
1118
1118
  }
1119
1119
  class be {
@@ -1127,6 +1127,8 @@ class be {
1127
1127
  // Change observers
1128
1128
  listen = !1;
1129
1129
  observer = null;
1130
+ isUpdating = !1;
1131
+ pendingOptionsChange = null;
1130
1132
  // Event handlers for preventing native select behavior (especially on iOS Safari)
1131
1133
  preventNativeSelect = null;
1132
1134
  preventNativeSelectMousedown = null;
@@ -1174,18 +1176,27 @@ class be {
1174
1176
  if (!this.listen)
1175
1177
  return;
1176
1178
  let t = !1, s = !1, i = !1;
1177
- for (const l of e) {
1178
- if (l.target === this.select && (l.attributeName === "disabled" && (s = !0), l.attributeName === "class" && (t = !0), l.type === "childList")) {
1179
- for (const r of Array.from(l.addedNodes))
1179
+ for (const n of e) {
1180
+ if (n.target === this.select && (n.attributeName === "disabled" && (s = !0), n.attributeName === "class" && (t = !0), n.type === "childList")) {
1181
+ for (const r of Array.from(n.addedNodes))
1180
1182
  if (r.nodeName === "OPTION" && r.value === this.select.value) {
1181
1183
  this.select.dispatchEvent(new Event("change"));
1182
1184
  break;
1183
1185
  }
1184
1186
  i = !0;
1185
1187
  }
1186
- (l.target.nodeName === "OPTGROUP" || l.target.nodeName === "OPTION") && (i = !0);
1188
+ (n.target.nodeName === "OPTGROUP" || n.target.nodeName === "OPTION") && (i = !0);
1189
+ }
1190
+ if (t && this.onClassChange && this.onClassChange(this.select.className.split(" ")), s && this.onDisabledChange && (this.changeListen(!1), this.onDisabledChange(this.select.disabled), this.changeListen(!0)), i && this.onOptionsChange) {
1191
+ if (this.isUpdating) {
1192
+ if (this.select.options.length > 0) {
1193
+ const n = this.getData();
1194
+ n.length > 0 && (this.pendingOptionsChange = n);
1195
+ }
1196
+ return;
1197
+ }
1198
+ this.changeListen(!1), this.onOptionsChange(this.getData()), this.changeListen(!0);
1187
1199
  }
1188
- t && this.onClassChange && this.onClassChange(this.select.className.split(" ")), s && this.onDisabledChange && (this.changeListen(!1), this.onDisabledChange(this.select.disabled), this.changeListen(!0)), i && this.onOptionsChange && (this.changeListen(!1), this.onOptionsChange(this.getData()), this.changeListen(!0));
1189
1200
  }
1190
1201
  // From the select element pull optgroup and options into data
1191
1202
  getData() {
@@ -1233,9 +1244,9 @@ class be {
1233
1244
  for (const s of t) {
1234
1245
  if (s.nodeName === "OPTGROUP") {
1235
1246
  const i = s.childNodes;
1236
- for (const l of i)
1237
- if (l.nodeName === "OPTION") {
1238
- const r = l;
1247
+ for (const n of i)
1248
+ if (n.nodeName === "OPTION") {
1249
+ const r = n;
1239
1250
  r.selected && e.push(this.getDataFromOption(r));
1240
1251
  }
1241
1252
  }
@@ -1254,8 +1265,8 @@ class be {
1254
1265
  const t = this.select.childNodes;
1255
1266
  for (const s of t) {
1256
1267
  if (s.nodeName === "OPTGROUP") {
1257
- const l = s.childNodes;
1258
- for (const r of l)
1268
+ const n = s.childNodes;
1269
+ for (const r of n)
1259
1270
  if (r.nodeName === "OPTION") {
1260
1271
  const a = r;
1261
1272
  a.selected = e.includes(a.id);
@@ -1277,8 +1288,8 @@ class be {
1277
1288
  const t = this.select.childNodes;
1278
1289
  for (const s of t) {
1279
1290
  if (s.nodeName === "OPTGROUP") {
1280
- const l = s.childNodes;
1281
- for (const r of l)
1291
+ const n = s.childNodes;
1292
+ for (const r of n)
1282
1293
  if (r.nodeName === "OPTION") {
1283
1294
  const a = r;
1284
1295
  a.selected = e.includes(a.value);
@@ -1297,10 +1308,15 @@ class be {
1297
1308
  })), this.changeListen(!0);
1298
1309
  }
1299
1310
  updateOptions(e) {
1300
- this.changeListen(!1), this.select.innerHTML = "";
1301
- for (const t of e)
1302
- t instanceof L && this.select.appendChild(this.createOptgroup(t)), t instanceof v && this.select.appendChild(this.createOption(t));
1303
- this.select.dispatchEvent(new Event("change", { bubbles: !0 })), this.changeListen(!0);
1311
+ if (!(!e || e.length === 0)) {
1312
+ this.isUpdating = !0, this.pendingOptionsChange = null, this.changeListen(!1), this.select.innerHTML = "";
1313
+ for (const t of e)
1314
+ t instanceof x && this.select.appendChild(this.createOptgroup(t)), t instanceof S && this.select.appendChild(this.createOption(t));
1315
+ if (this.select.dispatchEvent(new Event("change", { bubbles: !0 })), this.changeListen(!0), this.isUpdating = !1, this.pendingOptionsChange !== null) {
1316
+ const t = this.pendingOptionsChange;
1317
+ t.length > 0 && this.onOptionsChange ? (this.pendingOptionsChange = null, this.changeListen(!1), this.onOptionsChange(t), this.changeListen(!0)) : this.pendingOptionsChange = null;
1318
+ }
1319
+ }
1304
1320
  }
1305
1321
  createOptgroup(e) {
1306
1322
  const t = document.createElement("optgroup");
@@ -1329,15 +1345,15 @@ class be {
1329
1345
  }
1330
1346
  s = s.parentElement;
1331
1347
  }
1332
- Array.from(new Set(e)).forEach((l) => {
1333
- if (l.__slimSelectLabelHandler)
1348
+ Array.from(new Set(e)).forEach((n) => {
1349
+ if (n.__slimSelectLabelHandler)
1334
1350
  return;
1335
1351
  const r = (a) => {
1336
1352
  a.preventDefault(), a.stopPropagation(), this.onLabelClick && setTimeout(() => {
1337
1353
  this.onLabelClick();
1338
1354
  }, 0);
1339
1355
  };
1340
- l.__slimSelectLabelHandler = r, l.addEventListener("click", r, { capture: !0, passive: !1 });
1356
+ n.__slimSelectLabelHandler = r, n.addEventListener("click", r, { capture: !0, passive: !1 });
1341
1357
  });
1342
1358
  }
1343
1359
  // Remove label handlers
@@ -1352,9 +1368,9 @@ class be {
1352
1368
  }
1353
1369
  s = s.parentElement;
1354
1370
  }
1355
- Array.from(new Set(e)).forEach((l) => {
1356
- const r = l.__slimSelectLabelHandler;
1357
- r && (l.removeEventListener("click", r, { capture: !0 }), delete l.__slimSelectLabelHandler);
1371
+ Array.from(new Set(e)).forEach((n) => {
1372
+ const r = n.__slimSelectLabelHandler;
1373
+ r && (n.removeEventListener("click", r, { capture: !0 }), delete n.__slimSelectLabelHandler);
1358
1374
  });
1359
1375
  }
1360
1376
  destroy() {
@@ -1399,7 +1415,7 @@ class we {
1399
1415
  maxValuesMessage;
1400
1416
  addableText;
1401
1417
  constructor(e) {
1402
- e || (e = {}), this.id = "ss-" + U(), 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.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}';
1418
+ e || (e = {}), this.id = "ss-" + W(), 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.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}';
1403
1419
  }
1404
1420
  }
1405
1421
  let Se = class {
@@ -1437,7 +1453,7 @@ let Se = class {
1437
1453
  this.selectEl.dataset.ssid && this.destroy(), this.settings = new we(e.settings), this.cssClasses = new fe(e.cssClasses);
1438
1454
  const t = ["beforeOpen", "afterOpen", "beforeClose", "afterClose"];
1439
1455
  for (const a in e.events)
1440
- e.events.hasOwnProperty(a) && (t.indexOf(a) !== -1 ? this.events[a] = P(e.events[a], 100) : this.events[a] = e.events[a]);
1456
+ e.events.hasOwnProperty(a) && (t.indexOf(a) !== -1 ? this.events[a] = H(e.events[a], 100) : this.events[a] = e.events[a]);
1441
1457
  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) => {
1442
1458
  this.setSelected(a.map((c) => c.id));
1443
1459
  }, this.select.onClassChange = (a) => {
@@ -1445,7 +1461,7 @@ let Se = class {
1445
1461
  }, this.select.onDisabledChange = (a) => {
1446
1462
  a ? this.disable() : this.enable();
1447
1463
  }, this.select.onOptionsChange = (a) => {
1448
- this.setData(a);
1464
+ this.setData(a || []);
1449
1465
  }, this.select.onLabelClick = () => {
1450
1466
  this.settings.disabled || this.open();
1451
1467
  };
@@ -1462,8 +1478,8 @@ let Se = class {
1462
1478
  afterChange: this.events.afterChange
1463
1479
  };
1464
1480
  this.render = new ve(this.settings, this.cssClasses, this.store, i), this.render.renderValues(), this.render.renderOptions(this.store.getData());
1465
- const l = this.selectEl.getAttribute("aria-label"), r = this.selectEl.getAttribute("aria-labelledby");
1466
- l ? this.render.main.main.setAttribute("aria-label", l) : r && this.render.main.main.setAttribute("aria-labelledby", r), this.selectEl.parentNode && this.selectEl.parentNode.insertBefore(this.render.main.main, this.selectEl.nextSibling), window.addEventListener("resize", this.windowResize, !1), this.settings.openPosition === "auto" && window.addEventListener("scroll", this.windowScroll, !1), document.addEventListener("visibilitychange", this.windowVisibilityChange), this.settings.disabled && this.disable(), this.settings.alwaysOpen && this.open(), this.select.setupLabelHandlers(), this.selectEl.slim = this;
1481
+ const n = this.selectEl.getAttribute("aria-label"), r = this.selectEl.getAttribute("aria-labelledby");
1482
+ n ? this.render.main.main.setAttribute("aria-label", n) : r && this.render.main.main.setAttribute("aria-labelledby", r), this.selectEl.parentNode && this.selectEl.parentNode.insertBefore(this.render.main.main, this.selectEl.nextSibling), window.addEventListener("resize", this.windowResize, !1), this.settings.openPosition === "auto" && window.addEventListener("scroll", this.windowScroll, !1), document.addEventListener("visibilitychange", this.windowVisibilityChange), this.settings.disabled && this.disable(), this.settings.alwaysOpen && this.open(), this.select.setupLabelHandlers(), this.selectEl.slim = this;
1467
1483
  }
1468
1484
  // Set to enabled and remove disabled classes
1469
1485
  enable() {
@@ -1484,7 +1500,7 @@ let Se = class {
1484
1500
  }
1485
1501
  this.store.setData(e);
1486
1502
  const i = this.store.getData();
1487
- this.select.updateOptions(i), this.render.renderValues(), this.render.renderOptions(i), this.events.afterChange && !q(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1503
+ this.select.updateOptions(i), this.render.renderValues(), this.render.renderOptions(i), this.events.afterChange && !z(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1488
1504
  }
1489
1505
  getSelected() {
1490
1506
  let e = this.store.getSelectedOptions();
@@ -1494,24 +1510,24 @@ let Se = class {
1494
1510
  setSelected(e, t = !0) {
1495
1511
  const s = this.store.getSelected(), i = this.store.getDataOptions();
1496
1512
  e = Array.isArray(e) ? e : [e];
1497
- const l = [];
1513
+ const n = [];
1498
1514
  for (const a of e) {
1499
1515
  if (i.find((c) => c.id == a)) {
1500
- l.push(a);
1516
+ n.push(a);
1501
1517
  continue;
1502
1518
  }
1503
1519
  for (const c of i.filter((h) => h.value == a))
1504
- l.push(c.id);
1520
+ n.push(c.id);
1505
1521
  }
1506
- this.store.setSelectedBy("id", l);
1522
+ this.store.setSelectedBy("id", n);
1507
1523
  const r = this.store.getData();
1508
- 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 && !q(s, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1524
+ 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 && !z(s, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1509
1525
  }
1510
1526
  addOption(e) {
1511
1527
  const t = this.store.getSelected();
1512
1528
  this.store.getDataOptions().some((i) => i.value === (e.value ?? e.text)) || this.store.addOption(e);
1513
1529
  const s = this.store.getData();
1514
- this.select.updateOptions(s), this.render.renderValues(), this.render.renderOptions(s), this.events.afterChange && !q(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1530
+ this.select.updateOptions(s), this.render.renderValues(), this.render.renderOptions(s), this.events.afterChange && !z(t, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1515
1531
  }
1516
1532
  open() {
1517
1533
  this.settings.disabled || this.settings.isOpen || (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(() => {
@@ -1548,11 +1564,11 @@ let Se = class {
1548
1564
  destroy() {
1549
1565
  this.openTimeout && (clearTimeout(this.openTimeout), this.openTimeout = null), this.closeTimeout && (clearTimeout(this.closeTimeout), this.closeTimeout = null), this.settings.intervalMove && (clearInterval(this.settings.intervalMove), this.settings.intervalMove = null), document.removeEventListener("click", this.documentClick), window.removeEventListener("resize", this.windowResize, !1), this.settings.openPosition === "auto" && window.removeEventListener("scroll", this.windowScroll, !1), document.removeEventListener("visibilitychange", this.windowVisibilityChange), this.store.setData([]), this.render.destroy(), this.select.destroy();
1550
1566
  }
1551
- windowResize = P(() => {
1567
+ windowResize = H(() => {
1552
1568
  !this.settings.isOpen && !this.settings.isFullOpen || this.render.moveContent();
1553
1569
  });
1554
1570
  // Event listener for window scrolling
1555
- windowScroll = P(() => {
1571
+ windowScroll = H(() => {
1556
1572
  !this.settings.isOpen && !this.settings.isFullOpen || this.render.moveContent();
1557
1573
  });
1558
1574
  // Event listener for document click
@@ -1565,41 +1581,59 @@ let Se = class {
1565
1581
  };
1566
1582
  };
1567
1583
  const Oe = re(
1568
- ({ data: p, settings: e, events: t, cssClasses: s, value: i, onChange: l, children: r, multiple: a }, c) => {
1569
- const h = V(null), o = V(null), d = V(!0);
1570
- return oe(c, () => ({
1584
+ ({ data: p, settings: e, events: t, cssClasses: s, value: i, onChange: n, children: r, multiple: a }, c) => {
1585
+ const h = V(null), o = V(null), d = V(!0), g = V(i);
1586
+ oe(c, () => ({
1571
1587
  slimSelect: o.current
1572
- })), j(() => {
1588
+ }));
1589
+ const f = (m) => typeof m == "string" ? a ? [m] : m : Array.isArray(m) ? a ? m : m[0] : a ? [] : "", C = (m, L = !1) => {
1590
+ if (!o.current || m === void 0)
1591
+ return;
1592
+ const O = f(m), T = o.current.getData().flatMap((b) => "label" in b ? b.options : [b]);
1593
+ if (!(Array.isArray(O) ? O.length > 0 && O.every((b) => T.some((D) => D.value === b)) : O !== "" && T.some((b) => b.value === O)) && !Array.isArray(O) && !T.some((D) => D.placeholder)) {
1594
+ const D = o.current.getData(), P = {
1595
+ value: "",
1596
+ text: "",
1597
+ placeholder: !0
1598
+ };
1599
+ o.current.setData([P].concat(D));
1600
+ }
1601
+ o.current.setSelected(O, L);
1602
+ };
1603
+ return $(() => {
1573
1604
  if (!h.current) return;
1574
1605
  const m = {
1575
1606
  select: h.current
1576
1607
  };
1577
1608
  p && (m.data = p), e && (m.settings = e), s && (m.cssClasses = s);
1578
- const f = t?.afterChange;
1609
+ const L = t?.afterChange;
1579
1610
  return m.events = {
1580
1611
  ...t,
1581
- afterChange: (S) => {
1582
- const E = a ? S.map((O) => O.value) : S[0]?.value ?? "";
1583
- l && l(E), f && f(S);
1612
+ afterChange: (O) => {
1613
+ if (!o.current) return;
1614
+ const v = a ? O.map((A) => A.value) : O[0]?.value ?? "", k = o.current.getData().flatMap(
1615
+ (A) => "label" in A ? A.options : [A]
1616
+ ), b = g.current, D = b === void 0 ? !1 : Array.isArray(b) ? b.length > 0 && b.every((A) => k.some((M) => M.value === A)) : b !== "" && k.some((A) => A.value === b), P = Array.isArray(v) ? v.length > 0 && v.every((A) => k.some((M) => M.value === A)) : v !== "" && k.some((A) => A.value === v), F = Array.isArray(v) && Array.isArray(b) ? JSON.stringify(v.sort()) !== JSON.stringify(b.sort()) : b !== v;
1617
+ n && F && (D || P) && (n(v), g.current = v), L && L(O);
1584
1618
  }
1585
- }, o.current = new Se(m), i !== void 0 && o.current.setSelected(i, !1), () => {
1619
+ }, o.current = new Se(m), i !== void 0 && C(i, !1), () => {
1586
1620
  o.current && (o.current.destroy(), o.current = null);
1587
1621
  };
1588
- }, []), j(() => {
1622
+ }, []), $(() => {
1589
1623
  if (d.current) {
1590
- d.current = !1;
1624
+ d.current = !1, g.current = i;
1591
1625
  return;
1592
1626
  }
1593
- o.current && i !== void 0 && o.current.setSelected(i, !1);
1594
- }, [i]), j(() => {
1595
- o.current && p && !d.current && o.current.setData(p);
1627
+ o.current && i !== void 0 && (g.current = i, C(i, !1));
1628
+ }, [i]), $(() => {
1629
+ o.current && p && !d.current && (o.current.setData(p), i !== void 0 && C(i, !1));
1596
1630
  }, [p]), /* @__PURE__ */ ue.jsx("select", { ref: h, multiple: a, children: r });
1597
1631
  }
1598
1632
  );
1599
1633
  Oe.displayName = "SlimSelect";
1600
1634
  export {
1601
- L as Optgroup,
1602
- v as Option,
1635
+ x as Optgroup,
1636
+ S as Option,
1603
1637
  we as Settings,
1604
1638
  Oe as default
1605
1639
  };