@kupola/kupola 1.6.3 → 1.6.4

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.
@@ -201,8 +201,8 @@ class ht {
201
201
  console.error(`[KupolaLifecycle] Unhandled error in ${t.phase}:`, t.error);
202
202
  }
203
203
  }
204
- const Ia = new ht("app");
205
- function Ta(i = "app") {
204
+ const Ta = new ht("app");
205
+ function Ia(i = "app") {
206
206
  return new ht(i);
207
207
  }
208
208
  const Le = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
@@ -218,10 +218,10 @@ function He(i) {
218
218
  function Me(i) {
219
219
  return i ? i.replace(/\s+$/, "") : "";
220
220
  }
221
- function Ie(i) {
221
+ function Te(i) {
222
222
  return i ? i.toUpperCase() : "";
223
223
  }
224
- function Te(i) {
224
+ function Ie(i) {
225
225
  return i ? i.toLowerCase() : "";
226
226
  }
227
227
  function Ae(i) {
@@ -289,7 +289,7 @@ function Je() {
289
289
  return (i === "x" ? t : t & 3 | 8).toString(16);
290
290
  });
291
291
  }
292
- const Ze = { trim: De, trimLeft: He, trimRight: Me, toUpperCase: Ie, toLowerCase: Te, capitalize: Ae, camelize: ze, hyphenate: Pe, padStart: $e, padEnd: Be, truncate: qe, replaceAll: Oe, format: Fe, startsWith: Ne, endsWith: Re, includes: Ve, repeat: Ke, reverse: We, countOccurrences: Ue, escapeHtml: Ye, unescapeHtml: Xe, generateRandom: je, generateUUID: Je };
292
+ const Ze = { trim: De, trimLeft: He, trimRight: Me, toUpperCase: Te, toLowerCase: Ie, capitalize: Ae, camelize: ze, hyphenate: Pe, padStart: $e, padEnd: Be, truncate: qe, replaceAll: Oe, format: Fe, startsWith: Ne, endsWith: Re, includes: Ve, repeat: Ke, reverse: We, countOccurrences: Ue, escapeHtml: Ye, unescapeHtml: Xe, generateRandom: je, generateUUID: Je };
293
293
  function Ge(i) {
294
294
  return Array.isArray(i);
295
295
  }
@@ -415,14 +415,14 @@ function Ms(i, t) {
415
415
  return e.has(n) ? !1 : (e.add(n), !0);
416
416
  });
417
417
  }
418
- function Is(i, t) {
418
+ function Ts(i, t) {
419
419
  if (!i || t <= 0) return [];
420
420
  const e = [];
421
421
  for (let s = 0; s < i.length; s += t)
422
422
  e.push(i.slice(s, s + t));
423
423
  return e;
424
424
  }
425
- function Ts(i) {
425
+ function Is(i) {
426
426
  if (!i) return [];
427
427
  const t = i.slice();
428
428
  for (let e = t.length - 1; e > 0; e--) {
@@ -457,7 +457,7 @@ function Os(...i) {
457
457
  const t = Math.max(...i.map((e) => e ? e.length : 0));
458
458
  return Array.from({ length: t }, (e, s) => i.map((n) => n && n[s]));
459
459
  }
460
- const Fs = { isArray: Ge, isEmpty: Qe, size: ts, first: es, last: ss, get: is, slice: ns, concat: rs, join: as, indexOf: os, lastIndexOf: ls, includes: cs, push: hs, pop: ds, shift: us, unshift: ps, remove: fs, removeAt: ms, insert: gs, reverse: _s, sort: ys, sortBy: vs, filter: bs, map: xs, reduce: Es, forEach: ws, every: ks, some: Cs, find: Ss, findIndex: Ls, flat: Ds, flattenDeep: St, unique: Hs, uniqueBy: Ms, chunk: Is, shuffle: Ts, sum: Lt, average: As, max: zs, min: Ps, intersection: $s, union: Bs, difference: qs, zip: Os };
460
+ const Fs = { isArray: Ge, isEmpty: Qe, size: ts, first: es, last: ss, get: is, slice: ns, concat: rs, join: as, indexOf: os, lastIndexOf: ls, includes: cs, push: hs, pop: ds, shift: us, unshift: ps, remove: fs, removeAt: ms, insert: gs, reverse: _s, sort: ys, sortBy: vs, filter: bs, map: xs, reduce: Es, forEach: ws, every: ks, some: Cs, find: Ss, findIndex: Ls, flat: Ds, flattenDeep: St, unique: Hs, uniqueBy: Ms, chunk: Ts, shuffle: Is, sum: Lt, average: As, max: zs, min: Ps, intersection: $s, union: Bs, difference: qs, zip: Os };
461
461
  function rt(i) {
462
462
  return i !== null && typeof i == "object" && !Array.isArray(i);
463
463
  }
@@ -624,18 +624,18 @@ function yi(...i) {
624
624
  const t = i.filter(L);
625
625
  return t.length > 0 ? Math.max(...t) : void 0;
626
626
  }
627
- function It(...i) {
627
+ function Tt(...i) {
628
628
  return i.flat().filter(L).reduce((e, s) => e + s, 0);
629
629
  }
630
630
  function vi(...i) {
631
631
  const t = i.flat().filter(L);
632
- return t.length > 0 ? It(t) / t.length : 0;
632
+ return t.length > 0 ? Tt(t) / t.length : 0;
633
633
  }
634
- function Tt(i = 0, t = 1) {
634
+ function It(i = 0, t = 1) {
635
635
  return Math.random() * (t - i) + i;
636
636
  }
637
637
  function bi(i, t) {
638
- return Math.floor(Tt(i, t + 1));
638
+ return Math.floor(It(i, t + 1));
639
639
  }
640
640
  function xi(i, t = 2) {
641
641
  return L(i) ? i.toFixed(t) : String(i);
@@ -668,13 +668,13 @@ function Mi(i, t = 0) {
668
668
  const e = Number(i);
669
669
  return isNaN(e) ? t : e;
670
670
  }
671
- function Ii(i, t, e = 0) {
671
+ function Ti(i, t, e = 0) {
672
672
  return !L(i) || !L(t) || t === 0 ? e : i / t;
673
673
  }
674
- function Ti(...i) {
674
+ function Ii(...i) {
675
675
  return i.reduce((t, e) => !L(t) || !L(e) ? 0 : t * e, 1);
676
676
  }
677
- const Ai = { isNumber: L, isInteger: oi, isFloat: li, isPositive: ci, isNegative: hi, isZero: di, clamp: ui, round: pi, floor: fi, ceil: mi, abs: gi, min: _i, max: yi, sum: It, average: vi, random: Tt, randomInt: bi, format: xi, formatCurrency: Ei, formatPercent: wi, toFixed: ki, toPrecision: Ci, isNaN: Si, isFinite: Li, parseInt: Di, parseFloat: Hi, toNumber: Mi, safeDivide: Ii, safeMultiply: Ti };
677
+ const Ai = { isNumber: L, isInteger: oi, isFloat: li, isPositive: ci, isNegative: hi, isZero: di, clamp: ui, round: pi, floor: fi, ceil: mi, abs: gi, min: _i, max: yi, sum: Tt, average: vi, random: It, randomInt: bi, format: xi, formatCurrency: Ei, formatPercent: wi, toFixed: ki, toPrecision: Ci, isNaN: Si, isFinite: Li, parseInt: Di, parseFloat: Hi, toNumber: Mi, safeDivide: Ti, safeMultiply: Ii };
678
678
  function tt() {
679
679
  return Date.now();
680
680
  }
@@ -934,10 +934,10 @@ function Hn(i) {
934
934
  function Mn(i) {
935
935
  return /^[a-zA-Z]+$/.test(i || "");
936
936
  }
937
- function In(i) {
937
+ function Tn(i) {
938
938
  return /^[a-zA-Z0-9]+$/.test(i || "");
939
939
  }
940
- function Tn(i) {
940
+ function In(i) {
941
941
  return /^[\u4e00-\u9fa5]+$/.test(i || "");
942
942
  }
943
943
  function An(i, t, e) {
@@ -996,7 +996,7 @@ function Wn(i, t) {
996
996
  }), a.length > 0 && (e[s] = a);
997
997
  }), { valid: Object.keys(e).length === 0, errors: e };
998
998
  }
999
- const Nt = { isEmail: pn, isPhone: fn, isURL: mn, isIPv4: Pt, isIPv6: $t, isIP: gn, isIDCard: _n, isPassport: yn, isCreditCard: vn, isHexColor: Bt, isRGB: qt, isRGBA: Ot, isColor: bn, isDate: xn, isJSON: En, isEmpty: wn, isWhitespace: kn, isNumber: Cn, isInteger: Sn, isFloat: Ln, isPositive: Dn, isNegative: Hn, isAlpha: Mn, isAlphaNumeric: In, isChinese: Tn, isLength: An, minLength: zn, maxLength: Pn, matches: $n, equals: Bn, contains: Ft, notContains: qn, isArray: On, arrayLength: Fn, arrayMinLength: Nn, arrayMaxLength: Rn, isObject: Vn, hasKeys: Kn, validate: Wn };
999
+ const Nt = { isEmail: pn, isPhone: fn, isURL: mn, isIPv4: Pt, isIPv6: $t, isIP: gn, isIDCard: _n, isPassport: yn, isCreditCard: vn, isHexColor: Bt, isRGB: qt, isRGBA: Ot, isColor: bn, isDate: xn, isJSON: En, isEmpty: wn, isWhitespace: kn, isNumber: Cn, isInteger: Sn, isFloat: Ln, isPositive: Dn, isNegative: Hn, isAlpha: Mn, isAlphaNumeric: Tn, isChinese: In, isLength: An, minLength: zn, maxLength: Pn, matches: $n, equals: Bn, contains: Ft, notContains: qn, isArray: On, arrayLength: Fn, arrayMinLength: Nn, arrayMaxLength: Rn, isObject: Vn, hasKeys: Kn, validate: Wn };
1000
1000
  function Un(i) {
1001
1001
  const t = i ? String(i) : "", e = [1732584193, 4023233417, 2562383102, 271733878], s = [3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448, 568446438, 3275163606, 4107603335, 1163531501, 2850285829, 4243563512, 1735328473, 2368359562, 4294588738, 2272392833, 1839030562, 4259657740, 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074, 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645, 4096336452, 1126891415, 2878612391, 4237533241, 1700485571, 2399980690, 4293915773, 2240044497, 1873313359, 4264355552, 2734768916, 1309151649, 4149444226, 3174756917, 718787259, 3951481745], n = [[7, 12, 17, 22], [5, 9, 14, 20], [4, 11, 16, 23], [6, 10, 15, 21]];
1002
1002
  function r(d, u) {
@@ -1854,7 +1854,7 @@ class lr {
1854
1854
  }), this.events = {}, this.delegatedEvents = {}, this.eventListeners = {};
1855
1855
  }
1856
1856
  }
1857
- function T(i = null) {
1857
+ function I(i = null) {
1858
1858
  const t = {
1859
1859
  _value: i,
1860
1860
  _subscribers: /* @__PURE__ */ new Set()
@@ -1881,7 +1881,7 @@ function Pa(i, t) {
1881
1881
  function $a(i) {
1882
1882
  return Kt.getStore(i);
1883
1883
  }
1884
- const I = {
1884
+ const T = {
1885
1885
  paths: {
1886
1886
  icons: "/icons/",
1887
1887
  base: "/"
@@ -1977,46 +1977,46 @@ const I = {
1977
1977
  }
1978
1978
  };
1979
1979
  function Ba(i) {
1980
- Ut(I, i);
1980
+ Ut(T, i);
1981
1981
  }
1982
1982
  function dt(i) {
1983
- return i ? mr(I, i) : I;
1983
+ return i ? mr(T, i) : T;
1984
1984
  }
1985
1985
  function Wt() {
1986
- return I.paths.base + I.paths.icons.replace(/^\//, "");
1986
+ return T.paths.base + T.paths.icons.replace(/^\//, "");
1987
1987
  }
1988
1988
  function qa() {
1989
- return I.paths.base;
1989
+ return T.paths.base;
1990
1990
  }
1991
1991
  function cr() {
1992
- return I.theme.default;
1992
+ return T.theme.default;
1993
1993
  }
1994
1994
  function hr() {
1995
- return I.theme.brand;
1995
+ return T.theme.brand;
1996
1996
  }
1997
1997
  function Oa() {
1998
- return I.http;
1998
+ return T.http;
1999
1999
  }
2000
2000
  function j() {
2001
- return I.ui;
2001
+ return T.ui;
2002
2002
  }
2003
2003
  function W() {
2004
- return I.zIndex;
2004
+ return T.zIndex;
2005
2005
  }
2006
2006
  function st() {
2007
- return I.security;
2007
+ return T.security;
2008
2008
  }
2009
2009
  function dr() {
2010
- return I.performance;
2010
+ return T.performance;
2011
2011
  }
2012
2012
  function ur() {
2013
- return I.message;
2013
+ return T.message;
2014
2014
  }
2015
2015
  function pr() {
2016
- return I.notification;
2016
+ return T.notification;
2017
2017
  }
2018
2018
  function fr() {
2019
- return I.validation;
2019
+ return T.validation;
2020
2020
  }
2021
2021
  function Ut(i, t) {
2022
2022
  for (const e in t)
@@ -2269,13 +2269,13 @@ class _r {
2269
2269
  const e = t.className;
2270
2270
  if (typeof e == "string") {
2271
2271
  for (const s of this._cssClasses)
2272
- if (e.includes(s)) {
2273
- const n = s.replace("ds-", ""), r = this.initializers.get(n) || this.initializers.get(s);
2274
- if (r) {
2272
+ if (new RegExp(`(^|\\s)${s}(\\s|$)`).test(e)) {
2273
+ const r = s.replace("ds-", ""), a = this.initializers.get(r) || this.initializers.get(s);
2274
+ if (a) {
2275
2275
  try {
2276
- await r(t), this.processedElements.add(t);
2277
- } catch (a) {
2278
- console.error(`[ComponentInitializerRegistry] Error initializing "${n}":`, a);
2276
+ await a(t), this.processedElements.add(t);
2277
+ } catch (o) {
2278
+ console.error(`[ComponentInitializerRegistry] Error initializing "${r}":`, o);
2279
2279
  }
2280
2280
  return;
2281
2281
  }
@@ -2302,13 +2302,13 @@ class _r {
2302
2302
  const e = t.className;
2303
2303
  if (typeof e == "string") {
2304
2304
  for (const s of this._cssClasses)
2305
- if (e.includes(s)) {
2306
- const n = s.replace("ds-", ""), r = this.cleanupFunctions.get(n) || this.cleanupFunctions.get(s);
2307
- if (r) {
2305
+ if (new RegExp(`(^|\\s)${s}(\\s|$)`).test(e)) {
2306
+ const r = s.replace("ds-", ""), a = this.cleanupFunctions.get(r) || this.cleanupFunctions.get(s);
2307
+ if (a) {
2308
2308
  try {
2309
- r(t);
2310
- } catch (a) {
2311
- console.error(`[ComponentInitializerRegistry] Error cleaning up "${n}":`, a);
2309
+ a(t);
2310
+ } catch (o) {
2311
+ console.error(`[ComponentInitializerRegistry] Error cleaning up "${r}":`, o);
2312
2312
  }
2313
2313
  this.processedElements.delete(t);
2314
2314
  return;
@@ -2958,7 +2958,7 @@ class Er {
2958
2958
  !this.trigger || !this.menu || this.element.__kupolaInitialized || (this._itemClickHandler = (t) => {
2959
2959
  t.stopPropagation();
2960
2960
  const e = t.currentTarget;
2961
- e.classList.contains("is-disabled") || e.classList.contains("ds-dropdown__divider") || (this.menu.querySelectorAll(".ds-dropdown__item").forEach((s) => s.classList.remove("is-selected")), e.classList.add("is-selected"), this.triggerText && !e.hasAttribute("data-no-update-trigger") && (this.triggerText.textContent = e.textContent.trim()), this.element.setAttribute("data-value", e.getAttribute("data-value") || ""), this.onSelect && this.onSelect({ item: e, value: e.getAttribute("data-value"), text: e.textContent.trim() }), this.closeOnClick && (this.hideMenu(), this.trigger.focus()));
2961
+ e.classList.contains("is-disabled") || e.classList.contains("ds-dropdown__divider") || (this.menu.querySelectorAll(".ds-dropdown__item").forEach((s) => s.classList.remove("is-selected")), e.classList.add("is-selected"), this.triggerText && !e.hasAttribute("data-no-update-trigger") && (this.triggerText.textContent = e.textContent.trim()), this.element.setAttribute("data-value", e.getAttribute("data-value") || ""), this.onSelect && this.onSelect({ item: e, value: e.getAttribute("data-value"), text: e.textContent.trim() }), this.closeOnClick !== !1 && (this.hideMenu(), this.trigger && this.trigger.focus()));
2962
2962
  }, this._bindMenuItems(), this._triggerClickHandler = (t) => {
2963
2963
  t.stopPropagation(), !this.disabled && this.toggleMenu();
2964
2964
  }, this._triggerMouseenterHandler = () => {
@@ -3017,14 +3017,14 @@ class Er {
3017
3017
  _calculatePosition() {
3018
3018
  if (!this.autoPosition)
3019
3019
  return;
3020
- const t = this.element.getBoundingClientRect(), e = this.menu.getBoundingClientRect(), s = window.innerHeight, n = window.innerWidth;
3020
+ const t = this.element.getBoundingClientRect(), e = window.innerHeight, s = window.innerWidth;
3021
3021
  if (this.menu.classList.remove("ds-dropdown--top", "ds-dropdown--right", "ds-dropdown--dropup"), this.appendToBody) {
3022
- this.menu.style.width = `${Math.max(t.width, e.width)}px`;
3023
- const r = s - t.bottom, a = t.top;
3024
- r < e.height && a > r ? (this.menu.style.top = `${t.top - e.height - 4}px`, this.menu.style.bottom = "auto") : (this.menu.style.top = `${t.bottom + 4}px`, this.menu.style.bottom = "auto"), t.left + e.width > n ? (this.menu.style.left = `${t.right - Math.max(t.width, e.width)}px`, this.menu.style.right = "auto") : (this.menu.style.left = `${t.left}px`, this.menu.style.right = "auto");
3022
+ this.menu.style.width = `${t.width}px`;
3023
+ const n = this.menu.getBoundingClientRect(), r = e - t.bottom, a = t.top;
3024
+ r < n.height && a > r ? (this.menu.style.top = `${t.top - n.height - 4}px`, this.menu.style.bottom = "auto") : (this.menu.style.top = `${t.bottom + 4}px`, this.menu.style.bottom = "auto"), t.left + n.width > s ? (this.menu.style.left = `${t.right - n.width}px`, this.menu.style.right = "auto") : (this.menu.style.left = `${t.left}px`, this.menu.style.right = "auto");
3025
3025
  } else {
3026
- const r = s - t.bottom, a = t.top;
3027
- r < e.height && a > r ? (this.menu.classList.add("ds-dropdown--dropup"), this.menu.style.top = "auto", this.menu.style.bottom = "100%", this.menu.style.marginBottom = "4px") : (this.menu.style.top = "100%", this.menu.style.bottom = "auto", this.menu.style.marginBottom = "0"), t.left + e.width > n ? (this.menu.style.left = "auto", this.menu.style.right = "0") : (this.menu.style.left = "0", this.menu.style.right = "auto");
3026
+ const n = e - t.bottom, r = t.top;
3027
+ n < menuRect.height && r > n ? (this.menu.classList.add("ds-dropdown--dropup"), this.menu.style.top = "auto", this.menu.style.bottom = "100%", this.menu.style.marginBottom = "4px") : (this.menu.style.top = "100%", this.menu.style.bottom = "auto", this.menu.style.marginBottom = "0"), t.left + menuRect.width > s ? (this.menu.style.left = "auto", this.menu.style.right = "0") : (this.menu.style.left = "0", this.menu.style.right = "auto");
3028
3028
  }
3029
3029
  }
3030
3030
  showMenu() {
@@ -3035,12 +3035,12 @@ class Er {
3035
3035
  }
3036
3036
  _appendMenuToBody() {
3037
3037
  if (!this.menu) return;
3038
- this._originalParent = this.menu.parentNode, this._originalPosition = this.menu.style.position, this._originalTop = this.menu.style.top, this._originalLeft = this.menu.style.left, this._originalRight = this.menu.style.right, this._originalBottom = this.menu.style.bottom, this._originalMarginBottom = this.menu.style.marginBottom, this._originalWidth = this.menu.style.width, this._originalTransform = this.menu.style.transform, this._originalZIndex = this.menu.style.zIndex;
3039
- const t = W().dropdown;
3040
- this.menu.style.position = "fixed", this.menu.style.zIndex = t, this.menu.style.transform = "translateZ(0)", document.body.appendChild(this.menu);
3038
+ this._originalParent = this.menu.parentNode, this._originalPosition = this.menu.style.position, this._originalTop = this.menu.style.top, this._originalLeft = this.menu.style.left, this._originalRight = this.menu.style.right, this._originalBottom = this.menu.style.bottom, this._originalMarginBottom = this.menu.style.marginBottom, this._originalWidth = this.menu.style.width, this._originalTransform = this.menu.style.transform, this._originalZIndex = this.menu.style.zIndex, this._originalDisplay = this.menu.style.display;
3039
+ const t = this.element.getBoundingClientRect(), e = W().dropdown;
3040
+ this.menu.style.position = "fixed", this.menu.style.width = `${t.width}px`, this.menu.style.zIndex = e, this.menu.style.transform = "translateZ(0)", document.body.appendChild(this.menu);
3041
3041
  }
3042
3042
  _restoreMenuFromBody() {
3043
- !this.menu || !this._originalParent || (this._originalParent.appendChild(this.menu), this.menu.style.position = this._originalPosition || "", this.menu.style.top = this._originalTop || "", this.menu.style.left = this._originalLeft || "", this.menu.style.right = this._originalRight || "", this.menu.style.bottom = this._originalBottom || "", this.menu.style.marginBottom = this._originalMarginBottom || "", this.menu.style.width = this._originalWidth || "", this.menu.style.zIndex = this._originalZIndex || "", this.menu.style.transform = this._originalTransform || "", this._originalParent = null);
3043
+ !this.menu || !this._originalParent || (this._originalParent.appendChild(this.menu), this.menu.style.position = this._originalPosition || "", this.menu.style.top = this._originalTop || "", this.menu.style.left = this._originalLeft || "", this.menu.style.right = this._originalRight || "", this.menu.style.bottom = this._originalBottom || "", this.menu.style.marginBottom = this._originalMarginBottom || "", this.menu.style.width = this._originalWidth || "", this.menu.style.zIndex = this._originalZIndex || "", this.menu.style.transform = this._originalTransform || "", this.menu.style.display = this._originalDisplay || "", this._originalParent = null, console.log("[Dropdown] Menu restored from body"));
3044
3044
  }
3045
3045
  _addScrollListener() {
3046
3046
  this._scrollHandler = () => {
@@ -3061,15 +3061,19 @@ class Er {
3061
3061
  }
3062
3062
  // Update menu items dynamically
3063
3063
  setItems(t) {
3064
- this.menu.querySelectorAll(".ds-dropdown__item").forEach((e) => {
3064
+ this._itemClickHandler || (this._itemClickHandler = (e) => {
3065
+ e.stopPropagation();
3066
+ const s = e.currentTarget;
3067
+ s.classList.contains("is-disabled") || s.classList.contains("ds-dropdown__divider") || (this.menu.querySelectorAll(".ds-dropdown__item").forEach((n) => n.classList.remove("is-selected")), s.classList.add("is-selected"), this.triggerText && !s.hasAttribute("data-no-update-trigger") && (this.triggerText.textContent = s.textContent.trim()), this.element.setAttribute("data-value", s.getAttribute("data-value") || ""), this.onSelect && this.onSelect({ item: s, value: s.getAttribute("data-value"), text: s.textContent.trim() }), this.closeOnClick !== !1 && (this.hideMenu(), this.trigger && this.trigger.focus()));
3068
+ }), this.menu.querySelectorAll(".ds-dropdown__item").forEach((e) => {
3065
3069
  e._dropdownItemClickHandler && e.removeEventListener("click", e._dropdownItemClickHandler);
3066
- }), this.menu.innerHTML = "", t.forEach((e) => {
3070
+ }), this.menu.innerHTML = "", t.forEach((e, s) => {
3067
3071
  if (e.type === "divider") {
3068
- const s = document.createElement("div");
3069
- s.className = "ds-dropdown__divider", this.menu.appendChild(s);
3072
+ const n = document.createElement("div");
3073
+ n.className = "ds-dropdown__divider", this.menu.appendChild(n);
3070
3074
  } else {
3071
- const s = document.createElement("div");
3072
- s.className = "ds-dropdown__item" + (e.disabled ? " is-disabled" : "") + (e.active ? " is-selected" : ""), s.textContent = e.text || e.label || "", e.value !== void 0 && s.setAttribute("data-value", e.value), e.icon && (s.innerHTML = e.icon + s.innerHTML), e.disabled && s.classList.add("is-disabled"), s._dropdownItemClickHandler = (n) => this._itemClickHandler(n), s.addEventListener("click", s._dropdownItemClickHandler), this.menu.appendChild(s);
3075
+ const n = document.createElement("div");
3076
+ n.className = "ds-dropdown__item" + (e.disabled ? " is-disabled" : "") + (e.active ? " is-selected" : ""), n.textContent = e.text || e.label || "", e.value !== void 0 && n.setAttribute("data-value", e.value), e.icon && (n.innerHTML = e.icon + n.innerHTML), e.disabled && n.classList.add("is-disabled"), n._dropdownItemClickHandler = (r) => this._itemClickHandler(r), n.addEventListener("click", n._dropdownItemClickHandler), this.menu.appendChild(n);
3073
3077
  }
3074
3078
  });
3075
3079
  }
@@ -3080,6 +3084,7 @@ class Er {
3080
3084
  }
3081
3085
  }
3082
3086
  function Jt(i, t) {
3087
+ i._kupolaDropdown && i._kupolaDropdown.destroy();
3083
3088
  const e = new Er(i, t);
3084
3089
  e.init(), i._kupolaDropdown = e;
3085
3090
  }
@@ -3179,7 +3184,13 @@ class wr {
3179
3184
  }), this.focusIndex = -1;
3180
3185
  }
3181
3186
  _renderRemoteOptions(t) {
3182
- this.optionsEl.querySelectorAll(".ds-select__option, .ds-select__item").forEach((e) => {
3187
+ this._optionClickHandler || (this._optionClickHandler = (e) => {
3188
+ e.stopPropagation();
3189
+ const s = e.currentTarget;
3190
+ if (s.classList.contains("is-disabled")) return;
3191
+ const n = s.getAttribute("data-value");
3192
+ this.multiple ? this._toggleMultiOption(n, s) : this._selectSingleOption(n, s);
3193
+ }), this.optionsEl.querySelectorAll(".ds-select__option, .ds-select__item").forEach((e) => {
3183
3194
  e._selectOptionClickHandler && e.removeEventListener("click", e._selectOptionClickHandler), e.remove();
3184
3195
  }), t.forEach((e) => {
3185
3196
  const s = document.createElement("div");
@@ -3289,18 +3300,18 @@ class wr {
3289
3300
  _appendOptionsToBody() {
3290
3301
  if (!this.optionsEl) return;
3291
3302
  this._originalParent = this.optionsEl.parentNode, this._originalPosition = this.optionsEl.style.position, this._originalTop = this.optionsEl.style.top, this._originalLeft = this.optionsEl.style.left, this._originalRight = this.optionsEl.style.right, this._originalWidth = this.optionsEl.style.width, this._originalTransform = this.optionsEl.style.transform, this._originalZIndex = this.optionsEl.style.zIndex;
3292
- const t = W().dropdown;
3293
- this.optionsEl.style.position = "fixed", this.optionsEl.style.zIndex = t, this.optionsEl.style.transform = "translateZ(0)", document.body.appendChild(this.optionsEl);
3303
+ const t = this.element.getBoundingClientRect(), e = W().dropdown;
3304
+ this.optionsEl.style.position = "fixed", this.optionsEl.style.width = `${t.width}px`, this.optionsEl.style.zIndex = e, this.optionsEl.style.transform = "translateZ(0)", document.body.appendChild(this.optionsEl);
3294
3305
  }
3295
3306
  _restoreOptionsFromBody() {
3296
3307
  !this.optionsEl || !this._originalParent || (this._originalParent.appendChild(this.optionsEl), this.optionsEl.style.position = this._originalPosition || "", this.optionsEl.style.top = this._originalTop || "", this.optionsEl.style.left = this._originalLeft || "", this.optionsEl.style.right = this._originalRight || "", this.optionsEl.style.width = this._originalWidth || "", this.optionsEl.style.zIndex = this._originalZIndex || "", this.optionsEl.style.transform = this._originalTransform || "", this._originalParent = null);
3297
3308
  }
3298
3309
  _calculateOptionsPosition() {
3299
3310
  if (!this.appendToBody || !this.optionsEl) return;
3300
- const t = this.element.getBoundingClientRect(), e = this.optionsEl.getBoundingClientRect(), s = window.innerHeight, n = window.innerWidth;
3301
- this.optionsEl.style.width = `${Math.max(t.width, e.width)}px`;
3302
- const r = s - t.bottom, a = t.top;
3303
- r < e.height && a > r ? this.optionsEl.style.top = `${t.top - e.height - 4}px` : this.optionsEl.style.top = `${t.bottom + 4}px`, t.left + e.width > n ? this.optionsEl.style.left = `${t.right - Math.max(t.width, e.width)}px` : this.optionsEl.style.left = `${t.left}px`;
3311
+ const t = this.element.getBoundingClientRect(), e = window.innerHeight, s = window.innerWidth;
3312
+ this.optionsEl.style.width = `${t.width}px`;
3313
+ const n = this.optionsEl.getBoundingClientRect(), r = e - t.bottom, a = t.top;
3314
+ r < n.height && a > r ? this.optionsEl.style.top = `${t.top - n.height - 4}px` : this.optionsEl.style.top = `${t.bottom + 4}px`, t.left + n.width > s ? this.optionsEl.style.left = `${t.right - n.width}px` : this.optionsEl.style.left = `${t.left}px`;
3304
3315
  }
3305
3316
  toggleOptions() {
3306
3317
  this.isOpen ? this.hideOptions() : this.showOptions();
@@ -3988,7 +3999,7 @@ function xo() {
3988
3999
  });
3989
4000
  }
3990
4001
  E.register("slider", ee, Mr);
3991
- class Ir {
4002
+ class Tr {
3992
4003
  constructor(t, e = {}) {
3993
4004
  this.element = t, this.track = t.querySelector(".ds-carousel__track"), this.items = t.querySelectorAll(".ds-carousel__item"), this.prevBtn = t.querySelector(".ds-carousel__prev"), this.nextBtn = t.querySelector(".ds-carousel__next"), this.indicators = t.querySelectorAll(".ds-carousel__indicator"), this.autoBtn = t.querySelector(".ds-carousel__auto"), this.mode = e.mode || t.getAttribute("data-carousel-mode") || "slide", this.vertical = e.vertical || t.hasAttribute("data-carousel-vertical"), this.autoPlay = e.autoPlay !== !1, this.interval = e.interval || parseInt(t.getAttribute("data-carousel-interval")) || 3e3, this.transitionDuration = e.transitionDuration || parseInt(t.getAttribute("data-carousel-duration")) || 500, this.loop = e.loop !== !1, this.pauseOnHover = e.pauseOnHover !== !1, this.swipe = e.swipe !== !1, this.swipeThreshold = e.swipeThreshold || 50, this.keyboardNav = e.keyboardNav || t.hasAttribute("data-carousel-keyboard"), this.onChange = e.onChange || null, this.currentIndex = 0, this.totalItems = this.items.length, this.autoPlayTimer = null, this.isAutoPlaying = !1, this.isTransitioning = !1, this.touchStartX = 0, this.touchStartY = 0, this.touchDeltaX = 0, this.touchDeltaY = 0, this.isSwiping = !1, this._mouseEnterHandler = () => {
3994
4005
  this.pauseOnHover && this.stopAutoPlay();
@@ -4071,7 +4082,7 @@ class Ir {
4071
4082
  }
4072
4083
  function se(i, t) {
4073
4084
  if (i.__kupolaInitialized) return;
4074
- const e = new Ir(i, t);
4085
+ const e = new Tr(i, t);
4075
4086
  i.__kupolaInstance = e, i.__kupolaInitialized = !0;
4076
4087
  }
4077
4088
  function Eo(i = document) {
@@ -4079,11 +4090,11 @@ function Eo(i = document) {
4079
4090
  se(t);
4080
4091
  });
4081
4092
  }
4082
- function Tr(i) {
4093
+ function Ir(i) {
4083
4094
  if (!i.__kupolaInitialized || !i.__kupolaInstance) return;
4084
4095
  i.__kupolaInstance.destroy(), i.__kupolaInstance = null, i.__kupolaInitialized = !1;
4085
4096
  }
4086
- E.register("carousel", se, Tr);
4097
+ E.register("carousel", se, Ir);
4087
4098
  class Ar {
4088
4099
  constructor(t, e = {}) {
4089
4100
  this.element = t, this.mask = t.querySelector(".ds-drawer-mask"), this.drawerEl = t.querySelector(".ds-drawer"), this.placement = e.placement || t.getAttribute("data-drawer-placement") || "right", this.width = e.width || t.getAttribute("data-drawer-width") || "400px", this.height = e.height || t.getAttribute("data-drawer-height") || "400px", this.escClose = e.escClose !== !1, this.maskClosable = e.maskClosable !== !1, this.showMask = e.showMask !== !1, this.onOpen = e.onOpen || null, this.onClose = e.onClose || null, this.onBeforeClose = e.onBeforeClose || null, this._keydownHandler = null, this._bindEvents();
@@ -4455,7 +4466,7 @@ const Mo = {
4455
4466
  }, n);
4456
4467
  }
4457
4468
  };
4458
- function Io() {
4469
+ function To() {
4459
4470
  }
4460
4471
  function bt(i) {
4461
4472
  return i ? i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;") : "";
@@ -4627,7 +4638,7 @@ function Br(i) {
4627
4638
  if (!i.__kupolaInitialized || !i.__kupolaInstance) return;
4628
4639
  i.__kupolaInstance.destroy(), i.__kupolaInstance = null, i.__kupolaInitialized = !1;
4629
4640
  }
4630
- function To() {
4641
+ function Io() {
4631
4642
  document.querySelectorAll(".ds-fileupload").forEach((i) => {
4632
4643
  re(i);
4633
4644
  });
@@ -7423,7 +7434,7 @@ function Zo(i, t) {
7423
7434
  const o = {
7424
7435
  ...a,
7425
7436
  cacheKey: a.cacheKey || `${r}-${JSON.stringify(wt(i))}`
7426
- }, l = Ee(o, s), c = T(null), h = T(!0), d = T(null), u = T(null);
7437
+ }, l = Ee(o, s), c = I(null), h = I(!0), d = I(null), u = I(null);
7427
7438
  let f = 0;
7428
7439
  async function m() {
7429
7440
  const b = ++f;
@@ -7481,7 +7492,7 @@ function Zo(i, t) {
7481
7492
  }, window.__kupolaDepInstances || (window.__kupolaDepInstances = []), window.__kupolaDepInstances.push(e), e;
7482
7493
  }
7483
7494
  function Go(i) {
7484
- const t = new ve(), e = Ee(i, t), s = T(null), n = T(!0), r = T(null);
7495
+ const t = new ve(), e = Ee(i, t), s = I(null), n = I(!0), r = I(null);
7485
7496
  let a = 0;
7486
7497
  async function o() {
7487
7498
  const l = ++a;
@@ -7521,7 +7532,7 @@ function Qo() {
7521
7532
  }
7522
7533
  class Ea {
7523
7534
  constructor(t, e = {}) {
7524
- this.element = typeof t == "string" ? document.querySelector(t) : t, this.options = e, this.columns = (e.columns || []).map((s, n) => ({ ...s, _index: n })), this.rowKey = e.rowKey || "id", this._data = [], this._loading = !1, this.striped = e.striped !== !1, this.bordered = e.bordered || !1, this.hoverable = e.hoverable !== !1, this.compact = e.compact || !1, this.emptyText = e.emptyText || "暂无数据", this.loadingText = e.loadingText || "加载中...", this.multiSort = e.multiSort || !1, this._sorts = [], this._filterText = "", this._showPagination = e.pagination !== !1, this._pageSizes = e.pageSizes || [10, 20, 50, 100], this._pageSize = e.pageSize || 10, this._currentPage = 1, this._total = 0, this.selection = e.selection || null, this._selectedKeys = /* @__PURE__ */ new Set(), this.selectionColumnTitle = e.selectionColumnTitle || "", this.expandable = e.expandable || null, this._expandedKeys = /* @__PURE__ */ new Set(), this.expandColumnTitle = e.expandColumnTitle || "", this.editable = e.editable || !1, this._editingCell = null, this._editBuffer = {}, this.resizable = e.resizable || !1, this.draggable = e.draggable || !1, this._dragState = null, this.tree = e.tree || null, this._treeExpandedKeys = /* @__PURE__ */ new Set(), e.tree?.defaultExpandAll && (this._treeExpandAll = !0), this.virtualScroll = e.virtualScroll || null, this._scrollContainer = null, this._scrollHandler = null, this._resizeCleanups = [], this._filterDebounceTimer = null, this._reactiveCleanups = [], this.mergeCells = e.mergeCells || null, this.onSort = e.onSort || null, this.onPageChange = e.onPageChange || null, this.onRowClick = e.onRowClick || null, this.onFilter = e.onFilter || null, this.onSelect = e.onSelect || null, this.onExpand = e.onExpand || null, this.onEditSave = e.onEditSave || null, this.onEditCancel = e.onEditCancel || null, this.onRowDragEnd = e.onRowDragEnd || null, this.onColumnResize = e.onColumnResize || null, this.sortKey = T(null), this.sortOrder = T(null), this.currentPage = T(1), this.filterText = T(""), this.selectedKeys = T([]), this._init();
7535
+ this.element = typeof t == "string" ? document.querySelector(t) : t, this.options = e, this.columns = (e.columns || []).map((s, n) => ({ ...s, _index: n })), this.rowKey = e.rowKey || "id", this._data = [], this._loading = !1, this.striped = e.striped !== !1, this.bordered = e.bordered || !1, this.hoverable = e.hoverable !== !1, this.compact = e.compact || !1, this.emptyText = e.emptyText || "暂无数据", this.loadingText = e.loadingText || "加载中...", this.multiSort = e.multiSort || !1, this._sorts = [], this._filterText = "", this._showPagination = e.pagination !== !1, this._pageSizes = e.pageSizes || [10, 20, 50, 100], this._pageSize = e.pageSize || 10, this._currentPage = 1, this._total = 0, this.selection = e.selection || null, this._selectedKeys = /* @__PURE__ */ new Set(), this.selectionColumnTitle = e.selectionColumnTitle || "", this.expandable = e.expandable || null, this._expandedKeys = /* @__PURE__ */ new Set(), this.expandColumnTitle = e.expandColumnTitle || "", this.editable = e.editable || !1, this._editingCell = null, this._editBuffer = {}, this.resizable = e.resizable || !1, this.draggable = e.draggable || !1, this._dragState = null, this.tree = e.tree || null, this._treeExpandedKeys = /* @__PURE__ */ new Set(), e.tree?.defaultExpandAll && (this._treeExpandAll = !0), this.virtualScroll = e.virtualScroll || null, this._scrollContainer = null, this._scrollHandler = null, this._resizeCleanups = [], this._filterDebounceTimer = null, this._reactiveCleanups = [], this.mergeCells = e.mergeCells || null, this.onSort = e.onSort || null, this.onPageChange = e.onPageChange || null, this.onRowClick = e.onRowClick || null, this.onFilter = e.onFilter || null, this.onSelect = e.onSelect || null, this.onExpand = e.onExpand || null, this.onEditSave = e.onEditSave || null, this.onEditCancel = e.onEditCancel || null, this.onRowDragEnd = e.onRowDragEnd || null, this.onColumnResize = e.onColumnResize || null, this.sortKey = I(null), this.sortOrder = I(null), this.currentPage = I(1), this.filterText = I(""), this.selectedKeys = I([]), this._init();
7525
7536
  }
7526
7537
  _init() {
7527
7538
  this.element.classList.add("kupola-table-wrapper"), this.virtualScroll && this.element.classList.add("kupola-table-virtual-wrapper"), this.render();
@@ -8077,7 +8088,7 @@ function tl() {
8077
8088
  E.register("table", we);
8078
8089
  class wa {
8079
8090
  constructor(t, e = {}) {
8080
- this.element = typeof t == "string" ? document.querySelector(t) : t, this.options = e, this._current = e.current || 1, this._total = e.total || 0, this._pageSize = e.pageSize || 10, this._maxPages = e.maxPages || 7, this._showTotal = e.showTotal !== !1, this._showSizeChanger = e.showSizeChanger || !1, this._pageSizes = e.pageSizes || [10, 20, 50, 100], this._simple = e.simple || !1, this.current = T(this._current), this.total = T(this._total), this.onChange = e.onChange || null, this.onPageSizeChange = e.onPageSizeChange || null, this._init();
8091
+ this.element = typeof t == "string" ? document.querySelector(t) : t, this.options = e, this._current = e.current || 1, this._total = e.total || 0, this._pageSize = e.pageSize || 10, this._maxPages = e.maxPages || 7, this._showTotal = e.showTotal !== !1, this._showSizeChanger = e.showSizeChanger || !1, this._pageSizes = e.pageSizes || [10, 20, 50, 100], this._simple = e.simple || !1, this.current = I(this._current), this.total = I(this._total), this.onChange = e.onChange || null, this.onPageSizeChange = e.onPageSizeChange || null, this._init();
8081
8092
  }
8082
8093
  _init() {
8083
8094
  this.element.classList.add("kupola-pagination"), this.render();
@@ -8340,7 +8351,7 @@ export {
8340
8351
  _a as CacheEntry,
8341
8352
  ve as CacheManager,
8342
8353
  Rr as Calendar,
8343
- Ir as Carousel,
8354
+ Tr as Carousel,
8344
8355
  qr as Collapse,
8345
8356
  Fr as ColorPicker,
8346
8357
  _r as ComponentInitializerRegistry,
@@ -8397,7 +8408,7 @@ export {
8397
8408
  _o as cleanupAllDropdowns,
8398
8409
  ua as cleanupAllSlideCaptchas,
8399
8410
  Vr as cleanupCalendar,
8400
- Tr as cleanupCarousel,
8411
+ Ir as cleanupCarousel,
8401
8412
  Or as cleanupCollapse,
8402
8413
  Nr as cleanupColorPicker,
8403
8414
  aa as cleanupCountdown,
@@ -8422,7 +8433,7 @@ export {
8422
8433
  ko as confirmModal,
8423
8434
  Na as createBrandPicker,
8424
8435
  Qa as createI18n,
8425
- Ta as createLifecycle,
8436
+ Ia as createLifecycle,
8426
8437
  ie as createModal,
8427
8438
  Ee as createSource,
8428
8439
  Pa as createStore,
@@ -8479,12 +8490,12 @@ export {
8479
8490
  ce as initDynamicTags,
8480
8491
  $o as initDynamicTagsAll,
8481
8492
  re as initFileUpload,
8482
- To as initFileUploads,
8493
+ Io as initFileUploads,
8483
8494
  fa as initFormValidation,
8484
8495
  pe as initHeatmap,
8485
8496
  No as initHeatmaps,
8486
8497
  Bo as initImagePreview,
8487
- Io as initMessages,
8498
+ To as initMessages,
8488
8499
  ne as initModal,
8489
8500
  So as initModals,
8490
8501
  Ho as initNotifications,
@@ -8512,7 +8523,7 @@ export {
8512
8523
  za as kupolaEvents,
8513
8524
  N as kupolaI18n,
8514
8525
  E as kupolaInitializer,
8515
- Ia as kupolaLifecycle,
8526
+ Ta as kupolaLifecycle,
8516
8527
  M as kupolaRegistry,
8517
8528
  Kt as kupolaStoreManager,
8518
8529
  Wa as maskData,
@@ -8525,7 +8536,7 @@ export {
8525
8536
  oo as on,
8526
8537
  lo as once,
8527
8538
  nr as preloadUtils,
8528
- T as ref,
8539
+ I as ref,
8529
8540
  Ya as registerComponent,
8530
8541
  Xa as registerLazyComponent,
8531
8542
  sl as registerWebComponents,