twd-js 1.5.2 → 1.6.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,252 +1,244 @@
1
- var Ze = Object.defineProperty;
2
- var Qe = (e, t, r) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var me = (e, t, r) => Qe(e, typeof t != "symbol" ? t + "" : t, r);
4
- var K, w, He, C, ve, ze, Ne, Be, le, ne, oe, z = {}, De = [], et = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Z = Array.isArray;
5
- function T(e, t) {
6
- for (var r in t) e[r] = t[r];
7
- return e;
1
+ var Ye = Object.defineProperty;
2
+ var Qe = (t, e, r) => e in t ? Ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var ne = (t, e, r) => Qe(t, typeof e != "symbol" ? e + "" : e, r);
4
+ var Z, w, ze, M, ve, Ne, We, He, ce, ie, ae, G = {}, K = [], Ze = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ee = Array.isArray;
5
+ function E(t, e) {
6
+ for (var r in e) t[r] = e[r];
7
+ return t;
8
8
  }
9
- function ce(e) {
10
- e && e.parentNode && e.parentNode.removeChild(e);
9
+ function ue(t) {
10
+ t && t.parentNode && t.parentNode.removeChild(t);
11
11
  }
12
- function tt(e, t, r) {
13
- var n, s, o, l = {};
14
- for (o in t) o == "key" ? n = t[o] : o == "ref" ? s = t[o] : l[o] = t[o];
15
- if (arguments.length > 2 && (l.children = arguments.length > 3 ? K.call(arguments, 2) : r), typeof e == "function" && e.defaultProps != null) for (o in e.defaultProps) l[o] === void 0 && (l[o] = e.defaultProps[o]);
16
- return U(e, l, n, s, null);
12
+ function et(t, e, r) {
13
+ var n, o, s, l = {};
14
+ for (s in e) s == "key" ? n = e[s] : s == "ref" ? o = e[s] : l[s] = e[s];
15
+ if (arguments.length > 2 && (l.children = arguments.length > 3 ? Z.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) l[s] === void 0 && (l[s] = t.defaultProps[s]);
16
+ return V(t, l, n, o, null);
17
17
  }
18
- function U(e, t, r, n, s) {
19
- var o = { type: e, props: t, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: s ?? ++He, __i: -1, __u: 0 };
20
- return s == null && w.vnode != null && w.vnode(o), o;
18
+ function V(t, e, r, n, o) {
19
+ var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++ze, __i: -1, __u: 0 };
20
+ return o == null && w.vnode != null && w.vnode(s), s;
21
21
  }
22
- function D(e) {
23
- return e.children;
22
+ function U(t) {
23
+ return t.children;
24
24
  }
25
- function q(e, t) {
26
- this.props = e, this.context = t;
25
+ function J(t, e) {
26
+ this.props = t, this.context = e;
27
27
  }
28
- function I(e, t) {
29
- if (t == null) return e.__ ? I(e.__, e.__i + 1) : null;
30
- for (var r; t < e.__k.length; t++) if ((r = e.__k[t]) != null && r.__e != null) return r.__e;
31
- return typeof e.type == "function" ? I(e) : null;
28
+ function W(t, e) {
29
+ if (e == null) return t.__ ? W(t.__, t.__i + 1) : null;
30
+ for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e;
31
+ return typeof t.type == "function" ? W(t) : null;
32
32
  }
33
- function Pe(e) {
34
- var t, r;
35
- if ((e = e.__) != null && e.__c != null) {
36
- for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((r = e.__k[t]) != null && r.__e != null) {
37
- e.__e = e.__c.base = r.__e;
38
- break;
39
- }
40
- return Pe(e);
33
+ function tt(t) {
34
+ if (t.__P && t.__d) {
35
+ var e = t.__v, r = e.__e, n = [], o = [], s = E({}, e);
36
+ s.__v = e.__v + 1, w.vnode && w.vnode(s), _e(t.__P, s, e, t.__n, t.__P.namespaceURI, 32 & e.__u ? [r] : null, n, r ?? W(e), !!(32 & e.__u), o), s.__v = e.__v, s.__.__k[s.__i] = s, Pe(n, s, o), e.__e = e.__ = null, s.__e != r && Be(s);
41
37
  }
42
38
  }
43
- function we(e) {
44
- (!e.__d && (e.__d = !0) && C.push(e) && !G.__r++ || ve != w.debounceRendering) && ((ve = w.debounceRendering) || ze)(G);
39
+ function Be(t) {
40
+ if ((t = t.__) != null && t.__c != null) return t.__e = t.__c.base = null, t.__k.some(function(e) {
41
+ if (e != null && e.__e != null) return t.__e = t.__c.base = e.__e;
42
+ }), Be(t);
43
+ }
44
+ function we(t) {
45
+ (!t.__d && (t.__d = !0) && M.push(t) && !Y.__r++ || ve != w.debounceRendering) && ((ve = w.debounceRendering) || Ne)(Y);
45
46
  }
46
- function G() {
47
- for (var e, t, r, n, s, o, l, c = 1; C.length; ) C.length > c && C.sort(Ne), e = C.shift(), c = C.length, e.__d && (r = void 0, n = void 0, s = (n = (t = e).__v).__e, o = [], l = [], t.__P && ((r = T({}, n)).__v = n.__v + 1, w.vnode && w.vnode(r), de(t.__P, r, n, t.__n, t.__P.namespaceURI, 32 & n.__u ? [s] : null, o, s ?? I(n), !!(32 & n.__u), l), r.__v = n.__v, r.__.__k[r.__i] = r, je(o, r, l), n.__e = n.__ = null, r.__e != s && Pe(r)));
48
- G.__r = 0;
47
+ function Y() {
48
+ for (var t, e = 1; M.length; ) M.length > e && M.sort(We), t = M.shift(), e = M.length, tt(t);
49
+ Y.__r = 0;
49
50
  }
50
- function Fe(e, t, r, n, s, o, l, c, f, a, h) {
51
- var i, u, p, _, g, v, m, y = n && n.__k || De, E = t.length;
52
- for (f = rt(r, t, y, f, E), i = 0; i < E; i++) (p = r.__k[i]) != null && (u = p.__i == -1 ? z : y[p.__i] || z, p.__i = i, v = de(e, p, u, s, o, l, c, f, a, h), _ = p.__e, p.ref && u.ref != p.ref && (u.ref && _e(u.ref, null, p), h.push(p.ref, p.__c || _, p)), g == null && _ != null && (g = _), (m = !!(4 & p.__u)) || u.__k === p.__k ? f = Oe(p, f, e, m) : typeof p.type == "function" && v !== void 0 ? f = v : _ && (f = _.nextSibling), p.__u &= -7);
53
- return r.__e = g, f;
51
+ function De(t, e, r, n, o, s, l, d, u, a, p) {
52
+ var i, f, _, v, T, b, m, g = n && n.__k || K, I = e.length;
53
+ for (u = rt(r, e, g, u, I), i = 0; i < I; i++) (_ = r.__k[i]) != null && (f = _.__i != -1 && g[_.__i] || G, _.__i = i, b = _e(t, _, f, o, s, l, d, u, a, p), v = _.__e, _.ref && f.ref != _.ref && (f.ref && pe(f.ref, null, _), p.push(_.ref, _.__c || v, _)), T == null && v != null && (T = v), (m = !!(4 & _.__u)) || f.__k === _.__k ? u = Fe(_, u, t, m) : typeof _.type == "function" && b !== void 0 ? u = b : v && (u = v.nextSibling), _.__u &= -7);
54
+ return r.__e = T, u;
54
55
  }
55
- function rt(e, t, r, n, s) {
56
- var o, l, c, f, a, h = r.length, i = h, u = 0;
57
- for (e.__k = new Array(s), o = 0; o < s; o++) (l = t[o]) != null && typeof l != "boolean" && typeof l != "function" ? (typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? l = e.__k[o] = U(null, l, null, null, null) : Z(l) ? l = e.__k[o] = U(D, { children: l }, null, null, null) : l.constructor === void 0 && l.__b > 0 ? l = e.__k[o] = U(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : e.__k[o] = l, f = o + u, l.__ = e, l.__b = e.__b + 1, c = null, (a = l.__i = nt(l, r, f, i)) != -1 && (i--, (c = r[a]) && (c.__u |= 2)), c == null || c.__v == null ? (a == -1 && (s > h ? u-- : s < h && u++), typeof l.type != "function" && (l.__u |= 4)) : a != f && (a == f - 1 ? u-- : a == f + 1 ? u++ : (a > f ? u-- : u++, l.__u |= 4))) : e.__k[o] = null;
58
- if (i) for (o = 0; o < h; o++) (c = r[o]) != null && (2 & c.__u) == 0 && (c.__e == n && (n = I(c)), qe(c, c));
56
+ function rt(t, e, r, n, o) {
57
+ var s, l, d, u, a, p = r.length, i = p, f = 0;
58
+ for (t.__k = new Array(o), s = 0; s < o; s++) (l = e[s]) != null && typeof l != "boolean" && typeof l != "function" ? (typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? l = t.__k[s] = V(null, l, null, null, null) : ee(l) ? l = t.__k[s] = V(U, { children: l }, null, null, null) : l.constructor === void 0 && l.__b > 0 ? l = t.__k[s] = V(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : t.__k[s] = l, u = s + f, l.__ = t, l.__b = t.__b + 1, d = null, (a = l.__i = nt(l, r, u, i)) != -1 && (i--, (d = r[a]) && (d.__u |= 2)), d == null || d.__v == null ? (a == -1 && (o > p ? f-- : o < p && f++), typeof l.type != "function" && (l.__u |= 4)) : a != u && (a == u - 1 ? f-- : a == u + 1 ? f++ : (a > u ? f-- : f++, l.__u |= 4))) : t.__k[s] = null;
59
+ if (i) for (s = 0; s < p; s++) (d = r[s]) != null && (2 & d.__u) == 0 && (d.__e == n && (n = W(d)), Ue(d, d));
59
60
  return n;
60
61
  }
61
- function Oe(e, t, r, n) {
62
- var s, o;
63
- if (typeof e.type == "function") {
64
- for (s = e.__k, o = 0; s && o < s.length; o++) s[o] && (s[o].__ = e, t = Oe(s[o], t, r, n));
65
- return t;
62
+ function Fe(t, e, r, n) {
63
+ var o, s;
64
+ if (typeof t.type == "function") {
65
+ for (o = t.__k, s = 0; o && s < o.length; s++) o[s] && (o[s].__ = t, e = Fe(o[s], e, r, n));
66
+ return e;
66
67
  }
67
- e.__e != t && (n && (t && e.type && !t.parentNode && (t = I(e)), r.insertBefore(e.__e, t || null)), t = e.__e);
68
+ t.__e != e && (n && (e && t.type && !e.parentNode && (e = W(t)), r.insertBefore(t.__e, e || null)), e = t.__e);
68
69
  do
69
- t = t && t.nextSibling;
70
- while (t != null && t.nodeType == 8);
71
- return t;
70
+ e = e && e.nextSibling;
71
+ while (e != null && e.nodeType == 8);
72
+ return e;
72
73
  }
73
- function nt(e, t, r, n) {
74
- var s, o, l, c = e.key, f = e.type, a = t[r], h = a != null && (2 & a.__u) == 0;
75
- if (a === null && c == null || h && c == a.key && f == a.type) return r;
76
- if (n > (h ? 1 : 0)) {
77
- for (s = r - 1, o = r + 1; s >= 0 || o < t.length; ) if ((a = t[l = s >= 0 ? s-- : o++]) != null && (2 & a.__u) == 0 && c == a.key && f == a.type) return l;
74
+ function nt(t, e, r, n) {
75
+ var o, s, l, d = t.key, u = t.type, a = e[r], p = a != null && (2 & a.__u) == 0;
76
+ if (a === null && d == null || p && d == a.key && u == a.type) return r;
77
+ if (n > (p ? 1 : 0)) {
78
+ for (o = r - 1, s = r + 1; o >= 0 || s < e.length; ) if ((a = e[l = o >= 0 ? o-- : s++]) != null && (2 & a.__u) == 0 && d == a.key && u == a.type) return l;
78
79
  }
79
80
  return -1;
80
81
  }
81
- function ye(e, t, r) {
82
- t[0] == "-" ? e.setProperty(t, r ?? "") : e[t] = r == null ? "" : typeof r != "number" || et.test(t) ? r : r + "px";
82
+ function ye(t, e, r) {
83
+ e[0] == "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || Ze.test(e) ? r : r + "px";
83
84
  }
84
- function O(e, t, r, n, s) {
85
- var o, l;
86
- e: if (t == "style") if (typeof r == "string") e.style.cssText = r;
85
+ function j(t, e, r, n, o) {
86
+ var s, l;
87
+ e: if (e == "style") if (typeof r == "string") t.style.cssText = r;
87
88
  else {
88
- if (typeof n == "string" && (e.style.cssText = n = ""), n) for (t in n) r && t in r || ye(e.style, t, "");
89
- if (r) for (t in r) n && r[t] == n[t] || ye(e.style, t, r[t]);
89
+ if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || ye(t.style, e, "");
90
+ if (r) for (e in r) n && r[e] == n[e] || ye(t.style, e, r[e]);
90
91
  }
91
- else if (t[0] == "o" && t[1] == "n") o = t != (t = t.replace(Be, "$1")), l = t.toLowerCase(), t = l in e || t == "onFocusOut" || t == "onFocusIn" ? l.slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + o] = r, r ? n ? r.u = n.u : (r.u = le, e.addEventListener(t, o ? oe : ne, o)) : e.removeEventListener(t, o ? oe : ne, o);
92
+ else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(He, "$1")), l = e.toLowerCase(), e = l in t || e == "onFocusOut" || e == "onFocusIn" ? l.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = ce, t.addEventListener(e, s ? ae : ie, s)) : t.removeEventListener(e, s ? ae : ie, s);
92
93
  else {
93
- if (s == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
94
- else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
95
- e[t] = r ?? "";
94
+ if (o == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
95
+ else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
96
+ t[e] = r ?? "";
96
97
  break e;
97
98
  } catch {
98
99
  }
99
- typeof r == "function" || (r == null || r === !1 && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && r == 1 ? "" : r));
100
+ typeof r == "function" || (r == null || r === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r));
100
101
  }
101
102
  }
102
- function be(e) {
103
- return function(t) {
103
+ function be(t) {
104
+ return function(e) {
104
105
  if (this.l) {
105
- var r = this.l[t.type + e];
106
- if (t.t == null) t.t = le++;
107
- else if (t.t < r.u) return;
108
- return r(w.event ? w.event(t) : t);
106
+ var r = this.l[e.type + t];
107
+ if (e.t == null) e.t = ce++;
108
+ else if (e.t < r.u) return;
109
+ return r(w.event ? w.event(e) : e);
109
110
  }
110
111
  };
111
112
  }
112
- function de(e, t, r, n, s, o, l, c, f, a) {
113
- var h, i, u, p, _, g, v, m, y, E, $, P, L, ge, F, M, te, x = t.type;
114
- if (t.constructor !== void 0) return null;
115
- 128 & r.__u && (f = !!(32 & r.__u), o = [c = t.__e = r.__e]), (h = w.__b) && h(t);
116
- e: if (typeof x == "function") try {
117
- if (m = t.props, y = "prototype" in x && x.prototype.render, E = (h = x.contextType) && n[h.__c], $ = h ? E ? E.props.value : h.__ : n, r.__c ? v = (i = t.__c = r.__c).__ = i.__E : (y ? t.__c = i = new x(m, $) : (t.__c = i = new q(m, $), i.constructor = x, i.render = st), E && E.sub(i), i.state || (i.state = {}), i.__n = n, u = i.__d = !0, i.__h = [], i._sb = []), y && i.__s == null && (i.__s = i.state), y && x.getDerivedStateFromProps != null && (i.__s == i.state && (i.__s = T({}, i.__s)), T(i.__s, x.getDerivedStateFromProps(m, i.__s))), p = i.props, _ = i.state, i.__v = t, u) y && x.getDerivedStateFromProps == null && i.componentWillMount != null && i.componentWillMount(), y && i.componentDidMount != null && i.__h.push(i.componentDidMount);
113
+ function _e(t, e, r, n, o, s, l, d, u, a) {
114
+ var p, i, f, _, v, T, b, m, g, I, $, L, h, y, C, R = e.type;
115
+ if (e.constructor !== void 0) return null;
116
+ 128 & r.__u && (u = !!(32 & r.__u), s = [d = e.__e = r.__e]), (p = w.__b) && p(e);
117
+ e: if (typeof R == "function") try {
118
+ if (m = e.props, g = "prototype" in R && R.prototype.render, I = (p = R.contextType) && n[p.__c], $ = p ? I ? I.props.value : p.__ : n, r.__c ? b = (i = e.__c = r.__c).__ = i.__E : (g ? e.__c = i = new R(m, $) : (e.__c = i = new J(m, $), i.constructor = R, i.render = ot), I && I.sub(i), i.state || (i.state = {}), i.__n = n, f = i.__d = !0, i.__h = [], i._sb = []), g && i.__s == null && (i.__s = i.state), g && R.getDerivedStateFromProps != null && (i.__s == i.state && (i.__s = E({}, i.__s)), E(i.__s, R.getDerivedStateFromProps(m, i.__s))), _ = i.props, v = i.state, i.__v = e, f) g && R.getDerivedStateFromProps == null && i.componentWillMount != null && i.componentWillMount(), g && i.componentDidMount != null && i.__h.push(i.componentDidMount);
118
119
  else {
119
- if (y && x.getDerivedStateFromProps == null && m !== p && i.componentWillReceiveProps != null && i.componentWillReceiveProps(m, $), t.__v == r.__v || !i.__e && i.shouldComponentUpdate != null && i.shouldComponentUpdate(m, i.__s, $) === !1) {
120
- for (t.__v != r.__v && (i.props = m, i.state = i.__s, i.__d = !1), t.__e = r.__e, t.__k = r.__k, t.__k.some(function(A) {
121
- A && (A.__ = t);
122
- }), P = 0; P < i._sb.length; P++) i.__h.push(i._sb[P]);
123
- i._sb = [], i.__h.length && l.push(i);
120
+ if (g && R.getDerivedStateFromProps == null && m !== _ && i.componentWillReceiveProps != null && i.componentWillReceiveProps(m, $), e.__v == r.__v || !i.__e && i.shouldComponentUpdate != null && i.shouldComponentUpdate(m, i.__s, $) === !1) {
121
+ e.__v != r.__v && (i.props = m, i.state = i.__s, i.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(N) {
122
+ N && (N.__ = e);
123
+ }), K.push.apply(i.__h, i._sb), i._sb = [], i.__h.length && l.push(i);
124
124
  break e;
125
125
  }
126
- i.componentWillUpdate != null && i.componentWillUpdate(m, i.__s, $), y && i.componentDidUpdate != null && i.__h.push(function() {
127
- i.componentDidUpdate(p, _, g);
126
+ i.componentWillUpdate != null && i.componentWillUpdate(m, i.__s, $), g && i.componentDidUpdate != null && i.__h.push(function() {
127
+ i.componentDidUpdate(_, v, T);
128
128
  });
129
129
  }
130
- if (i.context = $, i.props = m, i.__P = e, i.__e = !1, L = w.__r, ge = 0, y) {
131
- for (i.state = i.__s, i.__d = !1, L && L(t), h = i.render(i.props, i.state, i.context), F = 0; F < i._sb.length; F++) i.__h.push(i._sb[F]);
132
- i._sb = [];
133
- } else do
134
- i.__d = !1, L && L(t), h = i.render(i.props, i.state, i.context), i.state = i.__s;
135
- while (i.__d && ++ge < 25);
136
- i.state = i.__s, i.getChildContext != null && (n = T(T({}, n), i.getChildContext())), y && !u && i.getSnapshotBeforeUpdate != null && (g = i.getSnapshotBeforeUpdate(p, _)), M = h, h != null && h.type === D && h.key == null && (M = Ue(h.props.children)), c = Fe(e, Z(M) ? M : [M], t, r, n, s, o, l, c, f, a), i.base = t.__e, t.__u &= -161, i.__h.length && l.push(i), v && (i.__E = i.__ = null);
137
- } catch (A) {
138
- if (t.__v = null, f || o != null) if (A.then) {
139
- for (t.__u |= f ? 160 : 128; c && c.nodeType == 8 && c.nextSibling; ) c = c.nextSibling;
140
- o[o.indexOf(c)] = null, t.__e = c;
130
+ if (i.context = $, i.props = m, i.__P = t, i.__e = !1, L = w.__r, h = 0, g) i.state = i.__s, i.__d = !1, L && L(e), p = i.render(i.props, i.state, i.context), K.push.apply(i.__h, i._sb), i._sb = [];
131
+ else do
132
+ i.__d = !1, L && L(e), p = i.render(i.props, i.state, i.context), i.state = i.__s;
133
+ while (i.__d && ++h < 25);
134
+ i.state = i.__s, i.getChildContext != null && (n = E(E({}, n), i.getChildContext())), g && !f && i.getSnapshotBeforeUpdate != null && (T = i.getSnapshotBeforeUpdate(_, v)), y = p != null && p.type === U && p.key == null ? Oe(p.props.children) : p, d = De(t, ee(y) ? y : [y], e, r, n, o, s, l, d, u, a), i.base = e.__e, e.__u &= -161, i.__h.length && l.push(i), b && (i.__E = i.__ = null);
135
+ } catch (N) {
136
+ if (e.__v = null, u || s != null) if (N.then) {
137
+ for (e.__u |= u ? 160 : 128; d && d.nodeType == 8 && d.nextSibling; ) d = d.nextSibling;
138
+ s[s.indexOf(d)] = null, e.__e = d;
141
139
  } else {
142
- for (te = o.length; te--; ) ce(o[te]);
143
- se(t);
140
+ for (C = s.length; C--; ) ue(s[C]);
141
+ le(e);
144
142
  }
145
- else t.__e = r.__e, t.__k = r.__k, A.then || se(t);
146
- w.__e(A, t, r);
143
+ else e.__e = r.__e, e.__k = r.__k, N.then || le(e);
144
+ w.__e(N, e, r);
147
145
  }
148
- else o == null && t.__v == r.__v ? (t.__k = r.__k, t.__e = r.__e) : c = t.__e = ot(r.__e, t, r, n, s, o, l, f, a);
149
- return (h = w.diffed) && h(t), 128 & t.__u ? void 0 : c;
146
+ else s == null && e.__v == r.__v ? (e.__k = r.__k, e.__e = r.__e) : d = e.__e = st(r.__e, e, r, n, o, s, l, u, a);
147
+ return (p = w.diffed) && p(e), 128 & e.__u ? void 0 : d;
150
148
  }
151
- function se(e) {
152
- e && e.__c && (e.__c.__e = !0), e && e.__k && e.__k.forEach(se);
149
+ function le(t) {
150
+ t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(le));
153
151
  }
154
- function je(e, t, r) {
155
- for (var n = 0; n < r.length; n++) _e(r[n], r[++n], r[++n]);
156
- w.__c && w.__c(t, e), e.some(function(s) {
152
+ function Pe(t, e, r) {
153
+ for (var n = 0; n < r.length; n++) pe(r[n], r[++n], r[++n]);
154
+ w.__c && w.__c(e, t), t.some(function(o) {
157
155
  try {
158
- e = s.__h, s.__h = [], e.some(function(o) {
159
- o.call(s);
156
+ t = o.__h, o.__h = [], t.some(function(s) {
157
+ s.call(o);
160
158
  });
161
- } catch (o) {
162
- w.__e(o, s.__v);
159
+ } catch (s) {
160
+ w.__e(s, o.__v);
163
161
  }
164
162
  });
165
163
  }
166
- function Ue(e) {
167
- return typeof e != "object" || e == null || e.__b && e.__b > 0 ? e : Z(e) ? e.map(Ue) : T({}, e);
164
+ function Oe(t) {
165
+ return typeof t != "object" || t == null || t.__b > 0 ? t : ee(t) ? t.map(Oe) : E({}, t);
168
166
  }
169
- function ot(e, t, r, n, s, o, l, c, f) {
170
- var a, h, i, u, p, _, g, v = r.props || z, m = t.props, y = t.type;
171
- if (y == "svg" ? s = "http://www.w3.org/2000/svg" : y == "math" ? s = "http://www.w3.org/1998/Math/MathML" : s || (s = "http://www.w3.org/1999/xhtml"), o != null) {
172
- for (a = 0; a < o.length; a++) if ((p = o[a]) && "setAttribute" in p == !!y && (y ? p.localName == y : p.nodeType == 3)) {
173
- e = p, o[a] = null;
167
+ function st(t, e, r, n, o, s, l, d, u) {
168
+ var a, p, i, f, _, v, T, b = r.props || G, m = e.props, g = e.type;
169
+ if (g == "svg" ? o = "http://www.w3.org/2000/svg" : g == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), s != null) {
170
+ for (a = 0; a < s.length; a++) if ((_ = s[a]) && "setAttribute" in _ == !!g && (g ? _.localName == g : _.nodeType == 3)) {
171
+ t = _, s[a] = null;
174
172
  break;
175
173
  }
176
174
  }
177
- if (e == null) {
178
- if (y == null) return document.createTextNode(m);
179
- e = document.createElementNS(s, y, m.is && m), c && (w.__m && w.__m(t, o), c = !1), o = null;
175
+ if (t == null) {
176
+ if (g == null) return document.createTextNode(m);
177
+ t = document.createElementNS(o, g, m.is && m), d && (w.__m && w.__m(e, s), d = !1), s = null;
180
178
  }
181
- if (y == null) v === m || c && e.data == m || (e.data = m);
179
+ if (g == null) b === m || d && t.data == m || (t.data = m);
182
180
  else {
183
- if (o = o && K.call(e.childNodes), !c && o != null) for (v = {}, a = 0; a < e.attributes.length; a++) v[(p = e.attributes[a]).name] = p.value;
184
- for (a in v) if (p = v[a], a != "children") {
185
- if (a == "dangerouslySetInnerHTML") i = p;
186
- else if (!(a in m)) {
187
- if (a == "value" && "defaultValue" in m || a == "checked" && "defaultChecked" in m) continue;
188
- O(e, a, null, p, s);
189
- }
190
- }
191
- for (a in m) p = m[a], a == "children" ? u = p : a == "dangerouslySetInnerHTML" ? h = p : a == "value" ? _ = p : a == "checked" ? g = p : c && typeof p != "function" || v[a] === p || O(e, a, p, v[a], s);
192
- if (h) c || i && (h.__html == i.__html || h.__html == e.innerHTML) || (e.innerHTML = h.__html), t.__k = [];
193
- else if (i && (e.innerHTML = ""), Fe(t.type == "template" ? e.content : e, Z(u) ? u : [u], t, r, n, y == "foreignObject" ? "http://www.w3.org/1999/xhtml" : s, o, l, o ? o[0] : r.__k && I(r, 0), c, f), o != null) for (a = o.length; a--; ) ce(o[a]);
194
- c || (a = "value", y == "progress" && _ == null ? e.removeAttribute("value") : _ != null && (_ !== e[a] || y == "progress" && !_ || y == "option" && _ != v[a]) && O(e, a, _, v[a], s), a = "checked", g != null && g != e[a] && O(e, a, g, v[a], s));
181
+ if (s = s && Z.call(t.childNodes), !d && s != null) for (b = {}, a = 0; a < t.attributes.length; a++) b[(_ = t.attributes[a]).name] = _.value;
182
+ for (a in b) _ = b[a], a == "dangerouslySetInnerHTML" ? i = _ : a == "children" || a in m || a == "value" && "defaultValue" in m || a == "checked" && "defaultChecked" in m || j(t, a, null, _, o);
183
+ for (a in m) _ = m[a], a == "children" ? f = _ : a == "dangerouslySetInnerHTML" ? p = _ : a == "value" ? v = _ : a == "checked" ? T = _ : d && typeof _ != "function" || b[a] === _ || j(t, a, _, b[a], o);
184
+ if (p) d || i && (p.__html == i.__html || p.__html == t.innerHTML) || (t.innerHTML = p.__html), e.__k = [];
185
+ else if (i && (t.innerHTML = ""), De(e.type == "template" ? t.content : t, ee(f) ? f : [f], e, r, n, g == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, l, s ? s[0] : r.__k && W(r, 0), d, u), s != null) for (a = s.length; a--; ) ue(s[a]);
186
+ d || (a = "value", g == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[a] || g == "progress" && !v || g == "option" && v != b[a]) && j(t, a, v, b[a], o), a = "checked", T != null && T != t[a] && j(t, a, T, b[a], o));
195
187
  }
196
- return e;
188
+ return t;
197
189
  }
198
- function _e(e, t, r) {
190
+ function pe(t, e, r) {
199
191
  try {
200
- if (typeof e == "function") {
201
- var n = typeof e.__u == "function";
202
- n && e.__u(), n && t == null || (e.__u = e(t));
203
- } else e.current = t;
204
- } catch (s) {
205
- w.__e(s, r);
192
+ if (typeof t == "function") {
193
+ var n = typeof t.__u == "function";
194
+ n && t.__u(), n && e == null || (t.__u = t(e));
195
+ } else t.current = e;
196
+ } catch (o) {
197
+ w.__e(o, r);
206
198
  }
207
199
  }
208
- function qe(e, t, r) {
209
- var n, s;
210
- if (w.unmount && w.unmount(e), (n = e.ref) && (n.current && n.current != e.__e || _e(n, null, t)), (n = e.__c) != null) {
200
+ function Ue(t, e, r) {
201
+ var n, o;
202
+ if (w.unmount && w.unmount(t), (n = t.ref) && (n.current && n.current != t.__e || pe(n, null, e)), (n = t.__c) != null) {
211
203
  if (n.componentWillUnmount) try {
212
204
  n.componentWillUnmount();
213
- } catch (o) {
214
- w.__e(o, t);
205
+ } catch (s) {
206
+ w.__e(s, e);
215
207
  }
216
208
  n.base = n.__P = null;
217
209
  }
218
- if (n = e.__k) for (s = 0; s < n.length; s++) n[s] && qe(n[s], t, r || typeof e.type != "function");
219
- r || ce(e.__e), e.__c = e.__ = e.__e = void 0;
210
+ if (n = t.__k) for (o = 0; o < n.length; o++) n[o] && Ue(n[o], e, r || typeof t.type != "function");
211
+ r || ue(t.__e), t.__c = t.__ = t.__e = void 0;
220
212
  }
221
- function st(e, t, r) {
222
- return this.constructor(e, r);
213
+ function ot(t, e, r) {
214
+ return this.constructor(t, r);
223
215
  }
224
- function it(e, t, r) {
225
- var n, s, o, l;
226
- t == document && (t = document.documentElement), w.__ && w.__(e, t), s = (n = !1) ? null : t.__k, o = [], l = [], de(t, e = t.__k = tt(D, null, [e]), s || z, z, t.namespaceURI, s ? null : t.firstChild ? K.call(t.childNodes) : null, o, s ? s.__e : t.firstChild, n, l), je(o, e, l);
216
+ function it(t, e, r) {
217
+ var n, o, s, l;
218
+ e == document && (e = document.documentElement), w.__ && w.__(t, e), o = (n = !1) ? null : e.__k, s = [], l = [], _e(e, t = e.__k = et(U, null, [t]), o || G, G, e.namespaceURI, o ? null : e.firstChild ? Z.call(e.childNodes) : null, s, o ? o.__e : e.firstChild, n, l), Pe(s, t, l);
227
219
  }
228
- K = De.slice, w = { __e: function(e, t, r, n) {
229
- for (var s, o, l; t = t.__; ) if ((s = t.__c) && !s.__) try {
230
- if ((o = s.constructor) && o.getDerivedStateFromError != null && (s.setState(o.getDerivedStateFromError(e)), l = s.__d), s.componentDidCatch != null && (s.componentDidCatch(e, n || {}), l = s.__d), l) return s.__E = s;
231
- } catch (c) {
232
- e = c;
220
+ Z = K.slice, w = { __e: function(t, e, r, n) {
221
+ for (var o, s, l; e = e.__; ) if ((o = e.__c) && !o.__) try {
222
+ if ((s = o.constructor) && s.getDerivedStateFromError != null && (o.setState(s.getDerivedStateFromError(t)), l = o.__d), o.componentDidCatch != null && (o.componentDidCatch(t, n || {}), l = o.__d), l) return o.__E = o;
223
+ } catch (d) {
224
+ t = d;
233
225
  }
234
- throw e;
235
- } }, He = 0, q.prototype.setState = function(e, t) {
226
+ throw t;
227
+ } }, ze = 0, J.prototype.setState = function(t, e) {
236
228
  var r;
237
- r = this.__s != null && this.__s != this.state ? this.__s : this.__s = T({}, this.state), typeof e == "function" && (e = e(T({}, r), this.props)), e && T(r, e), e != null && this.__v && (t && this._sb.push(t), we(this));
238
- }, q.prototype.forceUpdate = function(e) {
239
- this.__v && (this.__e = !0, e && this.__h.push(e), we(this));
240
- }, q.prototype.render = D, C = [], ze = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ne = function(e, t) {
241
- return e.__v.__b - t.__v.__b;
242
- }, G.__r = 0, Be = /(PointerCapture)$|Capture$/i, le = 0, ne = be(!1), oe = be(!0);
229
+ r = this.__s != null && this.__s != this.state ? this.__s : this.__s = E({}, this.state), typeof t == "function" && (t = t(E({}, r), this.props)), t && E(r, t), t != null && this.__v && (e && this._sb.push(e), we(this));
230
+ }, J.prototype.forceUpdate = function(t) {
231
+ this.__v && (this.__e = !0, t && this.__h.push(t), we(this));
232
+ }, J.prototype.render = U, M = [], Ne = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, We = function(t, e) {
233
+ return t.__v.__b - e.__v.__b;
234
+ }, Y.__r = 0, He = /(PointerCapture)$|Capture$/i, ce = 0, ie = be(!1), ae = be(!0);
243
235
  var at = 0;
244
- function d(e, t, r, n, s, o) {
245
- t || (t = {});
246
- var l, c, f = t;
247
- if ("ref" in f) for (c in f = {}, t) c == "ref" ? l = t[c] : f[c] = t[c];
248
- var a = { type: e, props: f, key: r, ref: l, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --at, __i: -1, __u: 0, __source: s, __self: o };
249
- if (typeof e == "function" && (l = e.defaultProps)) for (c in l) f[c] === void 0 && (f[c] = l[c]);
236
+ function c(t, e, r, n, o, s) {
237
+ e || (e = {});
238
+ var l, d, u = e;
239
+ if ("ref" in u) for (d in u = {}, e) d == "ref" ? l = e[d] : u[d] = e[d];
240
+ var a = { type: t, props: u, key: r, ref: l, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --at, __i: -1, __u: 0, __source: o, __self: s };
241
+ if (typeof t == "function" && (l = t.defaultProps)) for (d in l) u[d] === void 0 && (u[d] = l[d]);
250
242
  return w.vnode && w.vnode(a), a;
251
243
  }
252
244
  const lt = {
@@ -312,165 +304,162 @@ const lt = {
312
304
  iconColor: "#f1f5f9",
313
305
  iconColorSecondary: "#cbd5e1"
314
306
  };
315
- function ct(e = {}) {
316
- const t = { ...lt, ...e };
317
- return Object.entries(t).map(([r, n]) => `${`--twd-${r.replace(/([A-Z])/g, "-$1").toLowerCase()}`}: ${n};`).join(`
307
+ function dt(t = {}) {
308
+ const e = { ...lt, ...t };
309
+ return Object.entries(e).map(([r, n]) => `${`--twd-${r.replace(/([A-Z])/g, "-$1").toLowerCase()}`}: ${n};`).join(`
318
310
  `);
319
311
  }
320
- function dt(e) {
321
- const t = "twd-theme-variables";
322
- let r = document.getElementById(t);
323
- r || (r = document.createElement("style"), r.id = t, document.head.appendChild(r));
324
- const n = ct(e);
312
+ function ct(t) {
313
+ const e = "twd-theme-variables";
314
+ let r = document.getElementById(e);
315
+ r || (r = document.createElement("style"), r.id = e, document.head.appendChild(r));
316
+ const n = dt(t);
325
317
  r.textContent = `
326
318
  :root {
327
319
  ${n}
328
320
  }
329
321
  `;
330
322
  }
331
- const _t = (e) => {
332
- const { Component: t, createRoot: r, theme: n } = e;
333
- dt(n);
334
- const s = document.createElement("div");
335
- s.setAttribute("id", "twd-sidebar-root"), document.body.appendChild(s), r(s).render(t);
336
- }, ut = async (e, t, r, n) => {
337
- for (const s in e) await e[s]();
338
- _t({ Component: t, createRoot: r, theme: n });
323
+ const ut = (t) => {
324
+ const { Component: e, createRoot: r, theme: n } = t;
325
+ ct(n);
326
+ const o = document.createElement("div");
327
+ o.setAttribute("id", "twd-sidebar-root"), document.body.appendChild(o), r(o).render(e);
328
+ }, _t = async (t, e, r, n) => {
329
+ for (const o in t) await t[o]();
330
+ ut({ Component: e, createRoot: r, theme: n });
339
331
  };
340
- var N, b, re, ke, Y = 0, Ve = [], k = w, Se = k.__b, xe = k.__r, Te = k.diffed, Ee = k.__c, Re = k.unmount, $e = k.__;
341
- function ue(e, t) {
342
- k.__h && k.__h(b, e, Y || t), Y = 0;
343
- var r = b.__H || (b.__H = { __: [], __h: [] });
344
- return e >= r.__.length && r.__.push({}), r.__[e];
332
+ var P, k, se, ke, Q = 0, je = [], S = w, Se = S.__b, xe = S.__r, Te = S.diffed, Ce = S.__c, Re = S.unmount, Ie = S.__;
333
+ function fe(t, e) {
334
+ S.__h && S.__h(k, t, Q || e), Q = 0;
335
+ var r = k.__H || (k.__H = { __: [], __h: [] });
336
+ return t >= r.__.length && r.__.push({}), r.__[t];
345
337
  }
346
- function V(e) {
347
- return Y = 1, pt(Xe, e);
338
+ function B(t) {
339
+ return Q = 1, pt(Ve, t);
348
340
  }
349
- function pt(e, t, r) {
350
- var n = ue(N++, 2);
351
- if (n.t = e, !n.__c && (n.__ = [Xe(void 0, t), function(c) {
352
- var f = n.__N ? n.__N[0] : n.__[0], a = n.t(f, c);
353
- f !== a && (n.__N = [a, n.__[1]], n.__c.setState({}));
354
- }], n.__c = b, !b.__f)) {
355
- var s = function(c, f, a) {
341
+ function pt(t, e, r) {
342
+ var n = fe(P++, 2);
343
+ if (n.t = t, !n.__c && (n.__ = [Ve(void 0, e), function(d) {
344
+ var u = n.__N ? n.__N[0] : n.__[0], a = n.t(u, d);
345
+ u !== a && (n.__N = [a, n.__[1]], n.__c.setState({}));
346
+ }], n.__c = k, !k.__f)) {
347
+ var o = function(d, u, a) {
356
348
  if (!n.__c.__H) return !0;
357
- var h = n.__c.__H.__.filter(function(u) {
358
- return !!u.__c;
349
+ var p = n.__c.__H.__.filter(function(f) {
350
+ return f.__c;
359
351
  });
360
- if (h.every(function(u) {
361
- return !u.__N;
362
- })) return !o || o.call(this, c, f, a);
363
- var i = n.__c.props !== c;
364
- return h.forEach(function(u) {
365
- if (u.__N) {
366
- var p = u.__[0];
367
- u.__ = u.__N, u.__N = void 0, p !== u.__[0] && (i = !0);
352
+ if (p.every(function(f) {
353
+ return !f.__N;
354
+ })) return !s || s.call(this, d, u, a);
355
+ var i = n.__c.props !== d;
356
+ return p.some(function(f) {
357
+ if (f.__N) {
358
+ var _ = f.__[0];
359
+ f.__ = f.__N, f.__N = void 0, _ !== f.__[0] && (i = !0);
368
360
  }
369
- }), o && o.call(this, c, f, a) || i;
361
+ }), s && s.call(this, d, u, a) || i;
370
362
  };
371
- b.__f = !0;
372
- var o = b.shouldComponentUpdate, l = b.componentWillUpdate;
373
- b.componentWillUpdate = function(c, f, a) {
363
+ k.__f = !0;
364
+ var s = k.shouldComponentUpdate, l = k.componentWillUpdate;
365
+ k.componentWillUpdate = function(d, u, a) {
374
366
  if (this.__e) {
375
- var h = o;
376
- o = void 0, s(c, f, a), o = h;
367
+ var p = s;
368
+ s = void 0, o(d, u, a), s = p;
377
369
  }
378
- l && l.call(this, c, f, a);
379
- }, b.shouldComponentUpdate = s;
370
+ l && l.call(this, d, u, a);
371
+ }, k.shouldComponentUpdate = o;
380
372
  }
381
373
  return n.__N || n.__;
382
374
  }
383
- function Q(e, t) {
384
- var r = ue(N++, 3);
385
- !k.__s && Je(r.__H, t) && (r.__ = e, r.u = t, b.__H.__h.push(r));
375
+ function te(t, e) {
376
+ var r = fe(P++, 3);
377
+ !S.__s && qe(r.__H, e) && (r.__ = t, r.u = e, k.__H.__h.push(r));
386
378
  }
387
- function H(e) {
388
- return Y = 5, J(function() {
389
- return { current: e };
379
+ function F(t) {
380
+ return Q = 5, z(function() {
381
+ return { current: t };
390
382
  }, []);
391
383
  }
392
- function J(e, t) {
393
- var r = ue(N++, 7);
394
- return Je(r.__H, t) && (r.__ = e(), r.__H = t, r.__h = e), r.__;
384
+ function z(t, e) {
385
+ var r = fe(P++, 7);
386
+ return qe(r.__H, e) && (r.__ = t(), r.__H = e, r.__h = t), r.__;
395
387
  }
396
388
  function ft() {
397
- for (var e; e = Ve.shift(); ) if (e.__P && e.__H) try {
398
- e.__H.__h.forEach(X), e.__H.__h.forEach(ie), e.__H.__h = [];
399
- } catch (t) {
400
- e.__H.__h = [], k.__e(t, e.__v);
389
+ for (var t; t = je.shift(); ) {
390
+ var e = t.__H;
391
+ if (t.__P && e) try {
392
+ e.__h.some(X), e.__h.some(de), e.__h = [];
393
+ } catch (r) {
394
+ e.__h = [], S.__e(r, t.__v);
395
+ }
401
396
  }
402
397
  }
403
- k.__b = function(e) {
404
- b = null, Se && Se(e);
405
- }, k.__ = function(e, t) {
406
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), $e && $e(e, t);
407
- }, k.__r = function(e) {
408
- xe && xe(e), N = 0;
409
- var t = (b = e.__c).__H;
410
- t && (re === b ? (t.__h = [], b.__h = [], t.__.forEach(function(r) {
398
+ S.__b = function(t) {
399
+ k = null, Se && Se(t);
400
+ }, S.__ = function(t, e) {
401
+ t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Ie && Ie(t, e);
402
+ }, S.__r = function(t) {
403
+ xe && xe(t), P = 0;
404
+ var e = (k = t.__c).__H;
405
+ e && (se === k ? (e.__h = [], k.__h = [], e.__.some(function(r) {
411
406
  r.__N && (r.__ = r.__N), r.u = r.__N = void 0;
412
- })) : (t.__h.forEach(X), t.__h.forEach(ie), t.__h = [], N = 0)), re = b;
413
- }, k.diffed = function(e) {
414
- Te && Te(e);
415
- var t = e.__c;
416
- t && t.__H && (t.__H.__h.length && (Ve.push(t) !== 1 && ke === k.requestAnimationFrame || ((ke = k.requestAnimationFrame) || ht)(ft)), t.__H.__.forEach(function(r) {
407
+ })) : (e.__h.some(X), e.__h.some(de), e.__h = [], P = 0)), se = k;
408
+ }, S.diffed = function(t) {
409
+ Te && Te(t);
410
+ var e = t.__c;
411
+ e && e.__H && (e.__H.__h.length && (je.push(e) !== 1 && ke === S.requestAnimationFrame || ((ke = S.requestAnimationFrame) || ht)(ft)), e.__H.__.some(function(r) {
417
412
  r.u && (r.__H = r.u), r.u = void 0;
418
- })), re = b = null;
419
- }, k.__c = function(e, t) {
420
- t.some(function(r) {
413
+ })), se = k = null;
414
+ }, S.__c = function(t, e) {
415
+ e.some(function(r) {
421
416
  try {
422
- r.__h.forEach(X), r.__h = r.__h.filter(function(n) {
423
- return !n.__ || ie(n);
417
+ r.__h.some(X), r.__h = r.__h.filter(function(n) {
418
+ return !n.__ || de(n);
424
419
  });
425
420
  } catch (n) {
426
- t.some(function(s) {
427
- s.__h && (s.__h = []);
428
- }), t = [], k.__e(n, r.__v);
421
+ e.some(function(o) {
422
+ o.__h && (o.__h = []);
423
+ }), e = [], S.__e(n, r.__v);
429
424
  }
430
- }), Ee && Ee(e, t);
431
- }, k.unmount = function(e) {
432
- Re && Re(e);
433
- var t, r = e.__c;
434
- r && r.__H && (r.__H.__.forEach(function(n) {
425
+ }), Ce && Ce(t, e);
426
+ }, S.unmount = function(t) {
427
+ Re && Re(t);
428
+ var e, r = t.__c;
429
+ r && r.__H && (r.__H.__.some(function(n) {
435
430
  try {
436
431
  X(n);
437
- } catch (s) {
438
- t = s;
432
+ } catch (o) {
433
+ e = o;
439
434
  }
440
- }), r.__H = void 0, t && k.__e(t, r.__v));
435
+ }), r.__H = void 0, e && S.__e(e, r.__v));
441
436
  };
442
- var Ce = typeof requestAnimationFrame == "function";
443
- function ht(e) {
444
- var t, r = function() {
445
- clearTimeout(n), Ce && cancelAnimationFrame(t), setTimeout(e);
437
+ var $e = typeof requestAnimationFrame == "function";
438
+ function ht(t) {
439
+ var e, r = function() {
440
+ clearTimeout(n), $e && cancelAnimationFrame(e), setTimeout(t);
446
441
  }, n = setTimeout(r, 35);
447
- Ce && (t = requestAnimationFrame(r));
442
+ $e && (e = requestAnimationFrame(r));
448
443
  }
449
- function X(e) {
450
- var t = b, r = e.__c;
451
- typeof r == "function" && (e.__c = void 0, r()), b = t;
444
+ function X(t) {
445
+ var e = k, r = t.__c;
446
+ typeof r == "function" && (t.__c = void 0, r()), k = e;
452
447
  }
453
- function ie(e) {
454
- var t = b;
455
- e.__c = e.__(), b = t;
448
+ function de(t) {
449
+ var e = k;
450
+ t.__c = t.__(), k = e;
456
451
  }
457
- function Je(e, t) {
458
- return !e || e.length !== t.length || t.some(function(r, n) {
459
- return r !== e[n];
452
+ function qe(t, e) {
453
+ return !t || t.length !== e.length || e.some(function(r, n) {
454
+ return r !== t[n];
460
455
  });
461
456
  }
462
- function Xe(e, t) {
463
- return typeof t == "function" ? t(e) : t;
457
+ function Ve(t, e) {
458
+ return typeof e == "function" ? e(t) : e;
464
459
  }
465
- const gt = (e) => {
466
- const t = /* @__PURE__ */ new Map(), r = [];
467
- for (const n of e) t.set(n.id, { ...n, childrenNodes: [] });
468
- for (const n of t.values())
469
- n.parent ? t.get(n.parent)?.childrenNodes?.push(n) : r.push(n);
470
- return r;
471
- }, mt = {
460
+ const gt = {
472
461
  animation: "spin 1s linear infinite"
473
- }, vt = () => /* @__PURE__ */ d(
462
+ }, mt = () => /* @__PURE__ */ c(
474
463
  "svg",
475
464
  {
476
465
  xmlns: "http://www.w3.org/2000/svg",
@@ -483,18 +472,18 @@ const gt = (e) => {
483
472
  strokeLinecap: "round",
484
473
  strokeLinejoin: "round",
485
474
  className: "lucide lucide-loader-circle-icon lucide-loader-circle",
486
- style: mt,
475
+ style: gt,
487
476
  "data-testid": "loader-icon",
488
- children: /* @__PURE__ */ d("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
477
+ children: /* @__PURE__ */ c("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
489
478
  }
490
- ), j = document.createElement("style");
491
- j && !document.getElementById("loader-spin-keyframes") && (j.id = "loader-spin-keyframes", j.innerHTML = `
479
+ ), q = document.createElement("style");
480
+ q && !document.getElementById("loader-spin-keyframes") && (q.id = "loader-spin-keyframes", q.innerHTML = `
492
481
  @keyframes spin {
493
482
  0% { transform: rotate(0deg); }
494
483
  100% { transform: rotate(360deg); }
495
484
  }
496
- `, document.head.appendChild(j));
497
- const ee = ({ className: e, children: t, dataTestId: r }) => /* @__PURE__ */ d(
485
+ `, document.head.appendChild(q));
486
+ const re = ({ className: t, children: e, dataTestId: r }) => /* @__PURE__ */ c(
498
487
  "svg",
499
488
  {
500
489
  xmlns: "http://www.w3.org/2000/svg",
@@ -506,29 +495,29 @@ const ee = ({ className: e, children: t, dataTestId: r }) => /* @__PURE__ */ d(
506
495
  strokeWidth: "2",
507
496
  strokeLinecap: "round",
508
497
  strokeLinejoin: "round",
509
- className: `lucide ${e}`,
498
+ className: `lucide ${t}`,
510
499
  "data-testid": r,
511
- children: t
500
+ children: e
512
501
  }
513
- ), wt = () => /* @__PURE__ */ d(ee, { className: "lucide-play-icon lucide-play", dataTestId: "play-icon", children: /* @__PURE__ */ d("path", { d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" }) }), Ge = ({ id: e, name: t, skip: r, only: n }) => /* @__PURE__ */ d(D, { children: [
514
- t,
502
+ ), vt = () => /* @__PURE__ */ c(re, { className: "lucide-play-icon lucide-play", dataTestId: "play-icon", children: /* @__PURE__ */ c("path", { d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" }) }), Je = ({ id: t, name: e, skip: r, only: n }) => /* @__PURE__ */ c(U, { children: [
503
+ e,
515
504
  " ",
516
- n && /* @__PURE__ */ d(
505
+ n && /* @__PURE__ */ c(
517
506
  "span",
518
507
  {
519
508
  style: { color: "var(--twd-primary)" },
520
- "data-testid": `only-indicator-${e}`,
509
+ "data-testid": `only-indicator-${t}`,
521
510
  children: [
522
511
  " ",
523
512
  "(only)"
524
513
  ]
525
514
  }
526
515
  ),
527
- r && /* @__PURE__ */ d(
516
+ r && /* @__PURE__ */ c(
528
517
  "span",
529
518
  {
530
519
  style: { color: "var(--twd-text-secondary)" },
531
- "data-testid": `skip-indicator-${e}`,
520
+ "data-testid": `skip-indicator-${t}`,
532
521
  children: [
533
522
  " ",
534
523
  "(skipped)"
@@ -536,30 +525,30 @@ const ee = ({ className: e, children: t, dataTestId: r }) => /* @__PURE__ */ d(
536
525
  }
537
526
  )
538
527
  ] });
539
- var R = /* @__PURE__ */ ((e) => (e.CHAI_DIFF = "chai-diff", e.CHAI_MESSAGE = "chai-message", e.ERROR = "error", e))(R || {});
540
- const yt = (e) => {
528
+ var A = /* @__PURE__ */ ((t) => (t.CHAI_DIFF = "chai-diff", t.CHAI_MESSAGE = "chai-message", t.ERROR = "error", t))(A || {});
529
+ const wt = (t) => {
541
530
  try {
542
- const t = JSON.parse(e);
543
- if (t && typeof t == "object" && "type" in t)
544
- return t;
531
+ const e = JSON.parse(t);
532
+ if (e && typeof e == "object" && "type" in e)
533
+ return e;
545
534
  } catch {
546
535
  }
547
536
  return null;
548
- }, Ae = (e) => {
549
- if (e === null) return "null";
550
- if (e === void 0) return "undefined";
551
- if (typeof e == "string") return e;
552
- if (typeof e == "object")
537
+ }, Ee = (t) => {
538
+ if (t === null) return "null";
539
+ if (t === void 0) return "undefined";
540
+ if (typeof t == "string") return t;
541
+ if (typeof t == "object")
553
542
  try {
554
- return JSON.stringify(e, null, 2);
543
+ return JSON.stringify(t, null, 2);
555
544
  } catch {
556
- return String(e);
545
+ return String(t);
557
546
  }
558
- return String(e);
559
- }, bt = (e) => e.startsWith("Assertion passed") || e.startsWith("Event fired") ? { color: "var(--twd-success)", fontWeight: "var(--twd-font-weight-bold)" } : e.startsWith("Test failed") ? { color: "var(--twd-error)", fontWeight: "var(--twd-font-weight-bold)" } : {}, kt = (e) => e.type === "chai-message" || e.type === "error", St = (e, t) => t && kt(t) ? t.message : e, xt = ({ log: e, index: t }) => {
560
- const r = yt(e);
561
- if (r?.type === R.CHAI_DIFF)
562
- return /* @__PURE__ */ d(
547
+ return String(t);
548
+ }, yt = (t) => t.startsWith("Assertion passed") || t.startsWith("Event fired") ? { color: "var(--twd-success)", fontWeight: "var(--twd-font-weight-bold)" } : t.startsWith("Test failed") ? { color: "var(--twd-error)", fontWeight: "var(--twd-font-weight-bold)" } : {}, bt = (t) => t.type === "chai-message" || t.type === "error", kt = (t, e) => e && bt(e) ? e.message : t, St = ({ log: t, index: e }) => {
549
+ const r = wt(t);
550
+ if (r?.type === A.CHAI_DIFF)
551
+ return /* @__PURE__ */ c(
563
552
  "li",
564
553
  {
565
554
  style: {
@@ -569,22 +558,22 @@ const yt = (e) => {
569
558
  color: "var(--twd-text)"
570
559
  },
571
560
  children: [
572
- /* @__PURE__ */ d("div", { style: {
561
+ /* @__PURE__ */ c("div", { style: {
573
562
  color: "var(--twd-error)",
574
563
  fontWeight: "var(--twd-font-weight-bold)",
575
564
  marginBottom: "var(--twd-spacing-xs)"
576
565
  }, children: "❌ Assertion failed" }),
577
- /* @__PURE__ */ d("div", { style: {
566
+ /* @__PURE__ */ c("div", { style: {
578
567
  marginTop: "var(--twd-spacing-xs)",
579
568
  paddingLeft: "var(--twd-spacing-sm)",
580
569
  borderLeft: "2px solid var(--twd-success)"
581
570
  }, children: [
582
- /* @__PURE__ */ d("div", { style: {
571
+ /* @__PURE__ */ c("div", { style: {
583
572
  color: "var(--twd-success)",
584
573
  fontWeight: "var(--twd-font-weight-medium)",
585
574
  marginBottom: "var(--twd-spacing-xs)"
586
575
  }, children: "Expected:" }),
587
- /* @__PURE__ */ d("pre", { style: {
576
+ /* @__PURE__ */ c("pre", { style: {
588
577
  margin: 0,
589
578
  padding: "var(--twd-spacing-xs)",
590
579
  background: "var(--twd-background)",
@@ -593,19 +582,19 @@ const yt = (e) => {
593
582
  overflowX: "auto",
594
583
  whiteSpace: "pre-wrap",
595
584
  wordBreak: "break-word"
596
- }, children: Ae(r.expected) })
585
+ }, children: Ee(r.expected) })
597
586
  ] }),
598
- /* @__PURE__ */ d("div", { style: {
587
+ /* @__PURE__ */ c("div", { style: {
599
588
  marginTop: "var(--twd-spacing-xs)",
600
589
  paddingLeft: "var(--twd-spacing-sm)",
601
590
  borderLeft: "2px solid var(--twd-error)"
602
591
  }, children: [
603
- /* @__PURE__ */ d("div", { style: {
592
+ /* @__PURE__ */ c("div", { style: {
604
593
  color: "var(--twd-error)",
605
594
  fontWeight: "var(--twd-font-weight-medium)",
606
595
  marginBottom: "var(--twd-spacing-xs)"
607
596
  }, children: "Actual:" }),
608
- /* @__PURE__ */ d("pre", { style: {
597
+ /* @__PURE__ */ c("pre", { style: {
609
598
  margin: 0,
610
599
  padding: "var(--twd-spacing-xs)",
611
600
  background: "var(--twd-background)",
@@ -614,14 +603,14 @@ const yt = (e) => {
614
603
  overflowX: "auto",
615
604
  whiteSpace: "pre-wrap",
616
605
  wordBreak: "break-word"
617
- }, children: Ae(r.actual) })
606
+ }, children: Ee(r.actual) })
618
607
  ] })
619
608
  ]
620
609
  },
621
- t
610
+ e
622
611
  );
623
- const n = St(e, r);
624
- return /* @__PURE__ */ d(
612
+ const n = kt(t, r);
613
+ return /* @__PURE__ */ c(
625
614
  "li",
626
615
  {
627
616
  style: {
@@ -629,13 +618,13 @@ const yt = (e) => {
629
618
  padding: "var(--twd-spacing-xs) var(--twd-spacing-sm)",
630
619
  borderBottom: "1px solid var(--twd-border-light)",
631
620
  color: "var(--twd-text)",
632
- ...bt(n)
621
+ ...yt(n)
633
622
  },
634
623
  children: n
635
624
  },
636
- t
625
+ e
637
626
  );
638
- }, W = {
627
+ }, H = {
639
628
  container: {
640
629
  marginBottom: "var(--twd-spacing-xs)"
641
630
  },
@@ -676,8 +665,8 @@ const yt = (e) => {
676
665
  marginTop: "var(--twd-spacing-xs)",
677
666
  textAlign: "left"
678
667
  }
679
- }, Tt = (e) => {
680
- switch (e.status) {
668
+ }, xt = (t) => {
669
+ switch (t.status) {
681
670
  case "pass":
682
671
  return {
683
672
  item: {
@@ -715,39 +704,39 @@ const yt = (e) => {
715
704
  }
716
705
  };
717
706
  }
718
- }, Et = ({
719
- node: e,
720
- depth: t,
707
+ }, Tt = ({
708
+ node: t,
709
+ depth: e,
721
710
  id: r,
722
711
  runTest: n
723
712
  }) => {
724
- const s = H(null), o = H(e.status), l = H(e.logs?.length || 0), c = J(() => Tt(e), [e.status]), f = typeof window < "u" && sessionStorage.getItem("twd-last-run-test-name") === e.name, a = J(
713
+ const o = F(null), s = F(t.status), l = F(t.logs?.length || 0), d = z(() => xt(t), [t.status]), u = typeof window < "u" && sessionStorage.getItem("twd-last-run-test-name") === t.name, a = z(
725
714
  () => ({
726
- ...W.container,
727
- marginLeft: `calc(${t} * var(--twd-spacing-sm))`,
728
- ...c.container || {}
715
+ ...H.container,
716
+ marginLeft: `calc(${e} * var(--twd-spacing-sm))`,
717
+ ...d.container || {}
729
718
  }),
730
- [t, c]
731
- ), h = J(
719
+ [e, d]
720
+ ), p = z(
732
721
  () => ({
733
- ...W.item,
734
- ...c.item,
735
- ...f && {
722
+ ...H.item,
723
+ ...d.item,
724
+ ...u && {
736
725
  border: "1px dashed var(--twd-border)"
737
726
  }
738
727
  }),
739
- [c, f]
728
+ [d, u]
740
729
  );
741
- Q(() => {
742
- const u = s.current;
743
- if (!u || !e.logs || e.logs.length === 0) return;
744
- const p = o.current === "running" && (e.status === "pass" || e.status === "fail"), _ = e.logs.length > l.current;
745
- (p || _) && setTimeout(() => {
746
- u.scrollTop = u.scrollHeight;
747
- }, 0), o.current = e.status, l.current = e.logs.length;
748
- }, [e.status, e.logs]);
730
+ te(() => {
731
+ const f = o.current;
732
+ if (!f || !t.logs || t.logs.length === 0) return;
733
+ const _ = s.current === "running" && (t.status === "pass" || t.status === "fail"), v = t.logs.length > l.current;
734
+ (_ || v) && setTimeout(() => {
735
+ f.scrollTop = f.scrollHeight;
736
+ }, 0), s.current = t.status, l.current = t.logs.length;
737
+ }, [t.status, t.logs]);
749
738
  const i = () => {
750
- switch (e.status) {
739
+ switch (t.status) {
751
740
  case "pass":
752
741
  return "passed";
753
742
  case "fail":
@@ -760,80 +749,80 @@ const yt = (e) => {
760
749
  return "not run";
761
750
  }
762
751
  };
763
- return /* @__PURE__ */ d(
752
+ return /* @__PURE__ */ c(
764
753
  "li",
765
754
  {
766
755
  style: a,
767
756
  "data-testid": `test-list-item-${r}`,
768
- "data-test-name": e.name,
757
+ "data-test-name": t.name,
769
758
  role: "listitem",
770
- "aria-label": `Test ${e.name}, status: ${i()}`,
759
+ "aria-label": `Test ${t.name}, status: ${i()}`,
771
760
  children: [
772
- /* @__PURE__ */ d("div", { style: h, children: [
773
- /* @__PURE__ */ d("span", { style: W.nameSpan, children: /* @__PURE__ */ d(
774
- Ge,
761
+ /* @__PURE__ */ c("div", { style: p, children: [
762
+ /* @__PURE__ */ c("span", { style: H.nameSpan, children: /* @__PURE__ */ c(
763
+ Je,
775
764
  {
776
765
  id: r,
777
- name: e.name,
778
- skip: e.skip,
779
- only: e.only
766
+ name: t.name,
767
+ skip: t.skip,
768
+ only: t.only
780
769
  }
781
770
  ) }),
782
- /* @__PURE__ */ d(
771
+ /* @__PURE__ */ c(
783
772
  "button",
784
773
  {
785
774
  onClick: () => n(r),
786
- "aria-label": `Run ${e.name} test`,
787
- style: W.button,
788
- disabled: e.status === "running",
775
+ "aria-label": `Run ${t.name} test`,
776
+ style: H.button,
777
+ disabled: t.status === "running",
789
778
  "data-testid": `run-test-button-${r}`,
790
- children: e.status === "running" ? /* @__PURE__ */ d(vt, {}) : /* @__PURE__ */ d(wt, {})
779
+ children: t.status === "running" ? /* @__PURE__ */ c(mt, {}) : /* @__PURE__ */ c(vt, {})
791
780
  }
792
781
  )
793
782
  ] }),
794
- e.logs && e.logs.length > 0 && /* @__PURE__ */ d("ul", { ref: s, style: W.logsList, children: e.logs.map((u, p) => /* @__PURE__ */ d(xt, { log: u, index: p }, p)) })
783
+ t.logs && t.logs.length > 0 && /* @__PURE__ */ c("ul", { ref: o, style: H.logsList, children: t.logs.map((f, _) => /* @__PURE__ */ c(St, { log: f, index: _ }, _)) })
795
784
  ]
796
785
  },
797
- e.name
786
+ t.name
798
787
  );
799
- }, Rt = () => /* @__PURE__ */ d(ee, { className: "lucide-chevron-down-icon lucide-chevron-down", dataTestId: "chevron-down-icon", children: /* @__PURE__ */ d("path", { d: "m6 9 6 6 6-6" }) }), $t = () => /* @__PURE__ */ d(ee, { className: "lucide-chevron-right-icon lucide-chevron-right", dataTestId: "chevron-right-icon", children: /* @__PURE__ */ d("path", { d: "m9 18 6-6-6-6" }) }), Ct = ({ tests: e, runTest: t }) => {
800
- const [r, n] = V({}), s = H(null), o = H(!1), l = (a) => n((h) => ({ ...h, [a]: !h[a] }));
801
- Q(() => {
802
- if (o.current) return;
788
+ }, Ct = () => /* @__PURE__ */ c(re, { className: "lucide-chevron-down-icon lucide-chevron-down", dataTestId: "chevron-down-icon", children: /* @__PURE__ */ c("path", { d: "m6 9 6 6 6-6" }) }), Rt = () => /* @__PURE__ */ c(re, { className: "lucide-chevron-right-icon lucide-chevron-right", dataTestId: "chevron-right-icon", children: /* @__PURE__ */ c("path", { d: "m9 18 6-6-6-6" }) }), It = ({ roots: t, runTest: e, searchQuery: r = "" }) => {
789
+ const [n, o] = B({}), s = F(null), l = F(!1), d = (a) => o((p) => ({ ...p, [a]: !p[a] }));
790
+ te(() => {
791
+ if (l.current) return;
803
792
  const a = sessionStorage.getItem("twd-last-run-test-name");
804
793
  if (!a) return;
805
- const h = setTimeout(() => {
794
+ const p = setTimeout(() => {
806
795
  const i = document.querySelector(`[data-test-name="${a}"]`);
807
796
  if (i) {
808
- const u = s.current?.closest('[data-testid="twd-sidebar"]');
809
- if (u) {
810
- const p = i.getBoundingClientRect(), _ = u.getBoundingClientRect(), g = u.scrollTop, v = p.top - _.top + g;
811
- u.scrollTo({
812
- top: v - 150,
797
+ const f = s.current?.closest('[data-testid="twd-sidebar"]');
798
+ if (f) {
799
+ const _ = i.getBoundingClientRect(), v = f.getBoundingClientRect(), T = f.scrollTop, b = _.top - v.top + T;
800
+ f.scrollTo({
801
+ top: b - 150,
813
802
  // 150px offset from top
814
803
  behavior: "smooth"
815
804
  });
816
805
  }
817
- o.current = !0;
806
+ l.current = !0;
818
807
  }
819
808
  }, 100);
820
- return () => clearTimeout(h);
809
+ return () => clearTimeout(p);
821
810
  }, []);
822
- const c = (a, h = 0) => {
811
+ const u = (a, p = 0) => {
823
812
  if (a.type === "test")
824
- return /* @__PURE__ */ d(
825
- Et,
813
+ return /* @__PURE__ */ c(
814
+ Tt,
826
815
  {
827
816
  node: a,
828
- depth: h,
817
+ depth: p,
829
818
  id: a.id,
830
- runTest: () => t(a.id)
819
+ runTest: () => e(a.id)
831
820
  },
832
821
  a.id
833
822
  );
834
- const i = r[a.id];
835
- return /* @__PURE__ */ d("li", { style: { marginLeft: `calc(${h} * var(--twd-spacing-lg))` }, children: [
836
- /* @__PURE__ */ d(
823
+ const i = n[a.id];
824
+ return /* @__PURE__ */ c("li", { style: { marginLeft: `calc(${p} * var(--twd-spacing-lg))` }, children: [
825
+ /* @__PURE__ */ c(
837
826
  "div",
838
827
  {
839
828
  style: {
@@ -843,7 +832,7 @@ const yt = (e) => {
843
832
  padding: "var(--twd-spacing-xs) var(--twd-spacing-sm)",
844
833
  marginBottom: "var(--twd-spacing-sm)"
845
834
  },
846
- children: /* @__PURE__ */ d(
835
+ children: /* @__PURE__ */ c(
847
836
  "span",
848
837
  {
849
838
  style: {
@@ -863,29 +852,38 @@ const yt = (e) => {
863
852
  role: "button",
864
853
  "aria-expanded": !i,
865
854
  "aria-label": `${i ? "Expand" : "Collapse"} test suite ${a.name}`,
866
- onClick: () => l(a.id),
855
+ onClick: () => d(a.id),
867
856
  children: [
868
- /* @__PURE__ */ d(Ge, { id: a.id, name: a.name, skip: a.skip, only: a.only }),
869
- i ? /* @__PURE__ */ d($t, {}) : /* @__PURE__ */ d(Rt, {})
857
+ /* @__PURE__ */ c(Je, { id: a.id, name: a.name, skip: a.skip, only: a.only }),
858
+ i ? /* @__PURE__ */ c(Rt, {}) : /* @__PURE__ */ c(Ct, {})
870
859
  ]
871
860
  }
872
861
  )
873
862
  }
874
863
  ),
875
- !i && a.childrenNodes && a.childrenNodes.length > 0 && /* @__PURE__ */ d("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: a.childrenNodes.map((u) => c(u, h + 1)) })
864
+ !i && a.childrenNodes && a.childrenNodes.length > 0 && /* @__PURE__ */ c("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: a.childrenNodes.map((f) => u(f, p + 1)) })
876
865
  ] }, a.id);
877
- }, f = gt(e);
878
- return /* @__PURE__ */ d(
866
+ };
867
+ return /* @__PURE__ */ c(
879
868
  "ul",
880
869
  {
881
870
  ref: s,
882
871
  style: { listStyle: "none", padding: 0, margin: 0 },
883
872
  role: "list",
884
873
  "aria-label": "Test list",
885
- children: f.map((a) => c(a))
874
+ children: t.length === 0 && r ? /* @__PURE__ */ c("li", { style: {
875
+ padding: "var(--twd-spacing-md)",
876
+ color: "var(--twd-text-secondary)",
877
+ fontSize: "var(--twd-font-size-sm)",
878
+ textAlign: "center"
879
+ }, children: [
880
+ 'No tests match "',
881
+ r,
882
+ '"'
883
+ ] }) : t.map((a) => u(a))
886
884
  }
887
885
  );
888
- }, At = {
886
+ }, $t = {
889
887
  left: {
890
888
  left: 0,
891
889
  borderTopRightRadius: "var(--twd-border-radius-lg)",
@@ -900,7 +898,7 @@ const yt = (e) => {
900
898
  borderTopRightRadius: "0",
901
899
  borderBottomRightRadius: "0"
902
900
  }
903
- }, It = ({ setOpen: e, position: t }) => /* @__PURE__ */ d(
901
+ }, Et = ({ setOpen: t, position: e }) => /* @__PURE__ */ c(
904
902
  "button",
905
903
  {
906
904
  "aria-label": "Open TWD sidebar",
@@ -913,19 +911,19 @@ const yt = (e) => {
913
911
  padding: "var(--twd-spacing-sm) 10px",
914
912
  cursor: "pointer",
915
913
  fontSize: "var(--twd-font-size-sm)",
916
- ...At[t]
914
+ ...$t[e]
917
915
  },
918
- onClick: () => e(!0),
916
+ onClick: () => t(!0),
919
917
  children: "TWD"
920
918
  }
921
- ), Lt = ({ isOpen: e, position: t }) => {
922
- Q(() => {
919
+ ), At = ({ isOpen: t, position: e }) => {
920
+ te(() => {
923
921
  const r = document.documentElement, n = getComputedStyle(document.documentElement).getPropertyValue("--twd-sidebar-width") || "280px";
924
- return e ? t === "left" ? r.style.marginLeft = n : r.style.marginRight = n : (r.style.marginRight = "0", r.style.marginLeft = "0"), () => {
922
+ return t ? e === "left" ? r.style.marginLeft = n : r.style.marginRight = n : (r.style.marginRight = "0", r.style.marginLeft = "0"), () => {
925
923
  r.style.marginRight = "0", r.style.marginLeft = "0";
926
924
  };
927
- }, [e, t]);
928
- }, Mt = () => typeof window < "u" ? (window.__TWD_STATE__ || (window.__TWD_STATE__ = {
925
+ }, [t, e]);
926
+ }, Lt = () => typeof window < "u" ? (window.__TWD_STATE__ || (window.__TWD_STATE__ = {
929
927
  handlers: /* @__PURE__ */ new Map(),
930
928
  beforeEachHooks: /* @__PURE__ */ new Map(),
931
929
  afterEachHooks: /* @__PURE__ */ new Map(),
@@ -935,129 +933,161 @@ const yt = (e) => {
935
933
  beforeEachHooks: /* @__PURE__ */ new Map(),
936
934
  afterEachHooks: /* @__PURE__ */ new Map(),
937
935
  stack: []
938
- }, pe = Mt(), S = pe.handlers, Ie = pe.beforeEachHooks, Le = pe.afterEachHooks, Wt = (e) => {
939
- const t = [], r = [];
940
- let n = e;
936
+ }, he = Lt(), x = he.handlers, Ae = he.beforeEachHooks, Le = he.afterEachHooks, Mt = (t) => {
937
+ const e = [], r = [];
938
+ let n = t;
941
939
  for (; n; )
942
- Ie.has(n) && t.unshift(...Ie.get(n)), Le.has(n) && r.push(...Le.get(n)), n = S.get(n)?.parent;
943
- return { before: t, after: r };
944
- }, ae = (e) => {
945
- const t = S.get(e);
946
- return t ? t.only ? !0 : t.children ? t.children.some((r) => ae(r)) : !1 : !1;
947
- }, Ht = (e) => {
948
- let t = S.get(e);
949
- for (; t?.parent; ) {
950
- const r = S.get(t.parent);
940
+ Ae.has(n) && e.unshift(...Ae.get(n)), Le.has(n) && r.push(...Le.get(n)), n = x.get(n)?.parent;
941
+ return { before: e, after: r };
942
+ }, D = (t) => {
943
+ const e = x.get(t);
944
+ return e ? e.only ? !0 : e.children ? e.children.some((r) => D(r)) : !1 : !1;
945
+ }, zt = (t) => {
946
+ let e = x.get(t);
947
+ for (; e?.parent; ) {
948
+ const r = x.get(e.parent);
951
949
  if (r?.only) return !0;
952
- t = r;
950
+ e = r;
953
951
  }
954
952
  return !1;
955
- }, Me = (e) => {
956
- let t = S.get(e);
957
- for (; t; ) {
958
- if (t.skip) return !0;
959
- if (!t.parent) break;
960
- t = S.get(t.parent);
953
+ }, oe = (t) => {
954
+ let e = x.get(t);
955
+ for (; e; ) {
956
+ if (e.skip) return !0;
957
+ if (!e.parent) break;
958
+ e = x.get(e.parent);
961
959
  }
962
960
  return !1;
963
961
  };
964
- class Ye {
965
- constructor(t) {
966
- me(this, "events");
967
- this.events = t;
962
+ class Xe {
963
+ constructor(e, r) {
964
+ ne(this, "events");
965
+ ne(this, "retryCount");
966
+ this.events = e, this.retryCount = r?.retryCount ?? 1;
968
967
  }
969
968
  async runAll() {
970
- const t = Array.from(S.values()).filter(
969
+ const e = Array.from(x.values()).filter(
971
970
  (n) => !n.parent && n.type === "suite"
972
- ), r = Array.from(S.values()).some((n) => n.only);
973
- for (const n of t)
971
+ ), r = Array.from(x.values()).some((n) => n.only);
972
+ for (const n of e)
974
973
  await this.runSuite(n, r);
975
- return S;
974
+ return x;
976
975
  }
977
- async runSingle(t) {
978
- const r = S.get(t);
976
+ async runSingle(e) {
977
+ const r = x.get(e);
979
978
  if (!r || r.type !== "test") return;
980
979
  await this.runTest(r, !1);
981
980
  }
982
- async runSuite(t, r) {
983
- if (Me(t.id) && !ae(t.id)) {
984
- this.events.onSkip?.(t);
981
+ async runByIds(e) {
982
+ const r = new Set(e), n = Array.from(x.values()).filter(
983
+ (s) => !s.parent && s.type === "suite"
984
+ ), o = Array.from(x.values()).some((s) => s.only);
985
+ for (const s of n)
986
+ await this.runSuiteByIds(s, r, o);
987
+ return x;
988
+ }
989
+ async runSuiteByIds(e, r, n) {
990
+ if (!this.hasDescendantInSet(e, r)) return;
991
+ if (oe(e.id) && !D(e.id)) {
992
+ this.events.onSkip?.(e);
985
993
  return;
986
994
  }
987
- if (r && !ae(t.id)) return;
988
- this.events.onSuiteStart?.(t);
989
- const s = (t.children || []).map((o) => S.get(o));
990
- for (const o of s)
991
- o.type === "suite" ? await this.runSuite(o, r) : o.type === "test" && await this.runTest(o, r);
992
- this.events.onSuiteEnd?.(t);
995
+ if (n && !D(e.id)) return;
996
+ this.events.onSuiteStart?.(e);
997
+ const l = (e.children || []).map((d) => x.get(d));
998
+ for (const d of l)
999
+ d.type === "suite" ? await this.runSuiteByIds(d, r, n) : d.type === "test" && r.has(d.id) && await this.runTest(d, n);
1000
+ this.events.onSuiteEnd?.(e);
993
1001
  }
994
- async runTest(t, r) {
995
- if ((Me(t.id) || t.skip) && !t.only) {
996
- this.events.onSkip(t);
1002
+ hasDescendantInSet(e, r) {
1003
+ return r.has(e.id) ? !0 : e.children ? e.children.some((n) => {
1004
+ const o = x.get(n);
1005
+ return o ? this.hasDescendantInSet(o, r) : !1;
1006
+ }) : !1;
1007
+ }
1008
+ async runSuite(e, r) {
1009
+ if (oe(e.id) && !D(e.id)) {
1010
+ this.events.onSkip?.(e);
997
1011
  return;
998
1012
  }
999
- const s = Ht(t.id);
1000
- if (r && !t.only && !s) {
1001
- this.events.onSkip(t);
1013
+ if (r && !D(e.id)) return;
1014
+ this.events.onSuiteStart?.(e);
1015
+ const o = (e.children || []).map((s) => x.get(s));
1016
+ for (const s of o)
1017
+ s.type === "suite" ? await this.runSuite(s, r) : s.type === "test" && await this.runTest(s, r);
1018
+ this.events.onSuiteEnd?.(e);
1019
+ }
1020
+ async runTest(e, r) {
1021
+ if ((oe(e.id) || e.skip) && !e.only) {
1022
+ this.events.onSkip(e);
1002
1023
  return;
1003
1024
  }
1004
- this.events.onStart?.(t);
1005
- const o = Wt(t.parent);
1006
- try {
1007
- for (const l of o.before) await l();
1008
- t.logs = [], await t.handler(), this.events.onPass(t);
1009
- } catch (l) {
1010
- this.events.onFail(t, l);
1011
- } finally {
1012
- for (const l of o.after) await l();
1025
+ const o = zt(e.id);
1026
+ if (r && !e.only && !o) {
1027
+ this.events.onSkip(e);
1028
+ return;
1013
1029
  }
1030
+ this.events.onStart?.(e);
1031
+ const s = Mt(e.parent);
1032
+ let l = null;
1033
+ for (let d = 1; d <= this.retryCount; d++)
1034
+ try {
1035
+ for (const u of s.before) await u();
1036
+ e.logs = [], await e.handler(), this.events.onPass(e, d > 1 ? d : void 0);
1037
+ return;
1038
+ } catch (u) {
1039
+ l = u;
1040
+ } finally {
1041
+ for (const u of s.after) await u();
1042
+ }
1043
+ this.events.onFail(e, l);
1014
1044
  }
1015
1045
  }
1016
- window.__testRunner = Ye;
1017
- const fe = "1.5.2", zt = () => typeof window < "u" ? (window.__TWD_MOCK_STATE__ || (window.__TWD_MOCK_STATE__ = {
1046
+ window.__testRunner = Xe;
1047
+ const ge = "1.6.1", Nt = () => typeof window < "u" ? (window.__TWD_MOCK_STATE__ || (window.__TWD_MOCK_STATE__ = {
1018
1048
  rules: [],
1019
1049
  counts: {}
1020
1050
  }), window.__TWD_MOCK_STATE__) : {
1021
1051
  rules: [],
1022
1052
  counts: {}
1023
- }, B = zt(), he = B.rules;
1024
- let We = !1;
1025
- const Nt = async (e) => {
1026
- if (We) {
1053
+ }, O = Nt(), me = O.rules;
1054
+ let Me = !1;
1055
+ const Wt = async (t) => {
1056
+ if (Me) {
1027
1057
  console.warn("[TWD] Request mocking already initialized");
1028
1058
  return;
1029
1059
  }
1030
1060
  if ("serviceWorker" in navigator) {
1031
- We = !0;
1032
- const t = e ?? "/mock-sw.js";
1033
- await navigator.serviceWorker.register(`${t}?v=${fe}`), navigator.serviceWorker.controller || await new Promise((r) => {
1061
+ Me = !0;
1062
+ const e = t ?? "/mock-sw.js";
1063
+ await navigator.serviceWorker.register(`${e}?v=${ge}`), navigator.serviceWorker.controller || await new Promise((r) => {
1034
1064
  navigator.serviceWorker.addEventListener("controllerchange", r, { once: !0 });
1035
1065
  }), navigator.serviceWorker.addEventListener("message", (r) => {
1036
1066
  if (r.data?.type === "EXECUTED") {
1037
- const { alias: n, request: s, hitCount: o } = r.data, l = he.find((c) => c.alias === n);
1038
- l && (l.executed = !0, l.request = s, l.hitCount = o), B.counts[n] = o ?? (B.counts[n] ?? 0) + 1;
1067
+ const { alias: n, request: o, hitCount: s } = r.data, l = me.find((d) => d.alias === n);
1068
+ l && (l.executed = !0, l.request = o, l.hitCount = s), O.counts[n] = s ?? (O.counts[n] ?? 0) + 1;
1039
1069
  }
1040
1070
  });
1041
1071
  }
1042
- }, Bt = () => he, Dt = () => {
1072
+ }, Ht = () => me, Bt = () => {
1043
1073
  navigator.serviceWorker.controller?.postMessage({
1044
1074
  type: "CLEAR_RULES",
1045
- version: fe
1046
- }), he.length = 0;
1047
- for (const e in B.counts)
1048
- delete B.counts[e];
1049
- }, Pt = () => /* @__PURE__ */ d(ee, { className: "lucide-wifi-pen-icon lucide-wifi-pen", dataTestId: "wifi-pen-icon", children: [
1050
- /* @__PURE__ */ d("path", { d: "M2 8.82a15 15 0 0 1 20 0" }),
1051
- /* @__PURE__ */ d("path", { d: "M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z" }),
1052
- /* @__PURE__ */ d("path", { d: "M5 12.859a10 10 0 0 1 10.5-2.222" }),
1053
- /* @__PURE__ */ d("path", { d: "M8.5 16.429a5 5 0 0 1 3-1.406" })
1075
+ version: ge
1076
+ }), me.length = 0;
1077
+ for (const t in O.counts)
1078
+ delete O.counts[t];
1079
+ }, Dt = () => /* @__PURE__ */ c(re, { className: "lucide-wifi-pen-icon lucide-wifi-pen", dataTestId: "wifi-pen-icon", children: [
1080
+ /* @__PURE__ */ c("path", { d: "M2 8.82a15 15 0 0 1 20 0" }),
1081
+ /* @__PURE__ */ c("path", { d: "M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z" }),
1082
+ /* @__PURE__ */ c("path", { d: "M5 12.859a10 10 0 0 1 10.5-2.222" }),
1083
+ /* @__PURE__ */ c("path", { d: "M8.5 16.429a5 5 0 0 1 3-1.406" })
1054
1084
  ] }), Ft = () => {
1055
- const e = Bt(), t = e.filter((n) => n.executed);
1056
- return /* @__PURE__ */ d(
1085
+ const t = Ht(), e = t.filter((n) => n.executed);
1086
+ return /* @__PURE__ */ c(
1057
1087
  "button",
1058
1088
  {
1059
1089
  onClick: () => {
1060
- console.group("🌐 TWD Mock Rules"), console.log("Total rules:", e.length), console.log("Triggered rules:", t.length), console.log("Rules details:"), console.log(e), console.groupEnd();
1090
+ console.group("🌐 TWD Mock Rules"), console.log("Total rules:", t.length), console.log("Triggered rules:", e.length), console.log("Rules details:"), console.log(t), console.groupEnd();
1061
1091
  },
1062
1092
  "aria-label": "View mock rules details in console",
1063
1093
  style: {
@@ -1078,15 +1108,15 @@ const Nt = async (e) => {
1078
1108
  boxShadow: "var(--twd-shadow-sm)"
1079
1109
  },
1080
1110
  children: [
1081
- /* @__PURE__ */ d(Pt, {}),
1082
- /* @__PURE__ */ d("span", { style: { flex: 1 }, children: [
1111
+ /* @__PURE__ */ c(Dt, {}),
1112
+ /* @__PURE__ */ c("span", { style: { flex: 1 }, children: [
1083
1113
  "Rules: ",
1084
- t.length,
1085
- "/",
1086
1114
  e.length,
1115
+ "/",
1116
+ t.length,
1087
1117
  " triggered"
1088
1118
  ] }),
1089
- /* @__PURE__ */ d("span", { style: {
1119
+ /* @__PURE__ */ c("span", { style: {
1090
1120
  fontSize: "var(--twd-font-size-xs)",
1091
1121
  color: "var(--twd-text)",
1092
1122
  fontWeight: "var(--twd-font-weight-medium)"
@@ -1094,105 +1124,171 @@ const Nt = async (e) => {
1094
1124
  ]
1095
1125
  }
1096
1126
  );
1097
- }, Ot = /* @__PURE__ */ new Map();
1098
- function jt() {
1099
- Ot.clear();
1127
+ }, Pt = /* @__PURE__ */ new Map();
1128
+ function Ot() {
1129
+ Pt.clear();
1100
1130
  }
1101
- const Ut = (e) => e instanceof Error && "actual" in e && "expected" in e, Ke = (e) => e.actual !== void 0 && e.expected !== void 0 ? {
1131
+ const Ut = (t) => t instanceof Error && "actual" in t && "expected" in t, Ge = (t) => t.actual !== void 0 && t.expected !== void 0 ? {
1102
1132
  type: "diff",
1103
- actual: e.actual,
1104
- expected: e.expected,
1105
- operator: e.operator
1133
+ actual: t.actual,
1134
+ expected: t.expected,
1135
+ operator: t.operator
1106
1136
  } : {
1107
1137
  type: "message",
1108
- message: e.message
1109
- }, qt = (e) => {
1110
- const t = Ke(e);
1111
- if (t.type === "diff") {
1112
- const r = t.operator || "unknown";
1113
- console.error(`Assertion failed with operator: ${r}`), console.group("Expected:"), console.log(t.expected), console.groupEnd(), console.group("Actual:"), console.log(t.actual), console.groupEnd();
1138
+ message: t.message
1139
+ }, jt = (t) => {
1140
+ const e = Ge(t);
1141
+ if (e.type === "diff") {
1142
+ const r = e.operator || "unknown";
1143
+ console.error(`Assertion failed with operator: ${r}`), console.group("Expected:"), console.log(e.expected), console.groupEnd(), console.group("Actual:"), console.log(e.actual), console.groupEnd();
1114
1144
  } else
1115
- console.error(t.message);
1116
- }, Vt = (e) => {
1117
- if (e.status === "pass")
1118
- return `Test "${e.name}" passed.`;
1119
- if (e.status === "fail") {
1120
- if (!e.logs || e.logs.length === 0)
1121
- return `Test "${e.name}" failed.`;
1122
- const t = e.logs[e.logs.length - 1];
1145
+ console.error(e.message);
1146
+ }, qt = (t) => {
1147
+ if (t.status === "pass")
1148
+ return `Test "${t.name}" passed.`;
1149
+ if (t.status === "fail") {
1150
+ if (!t.logs || t.logs.length === 0)
1151
+ return `Test "${t.name}" failed.`;
1152
+ const e = t.logs[t.logs.length - 1];
1123
1153
  try {
1124
- const r = JSON.parse(t);
1125
- return r.type === R.CHAI_MESSAGE || r.type === R.ERROR ? `Test "${e.name}" failed. ${r.message}` : r.type === R.CHAI_DIFF ? `Test "${e.name}" failed. Expected value does not match actual value.` : `Test "${e.name}" failed.`;
1154
+ const r = JSON.parse(e);
1155
+ return r.type === A.CHAI_MESSAGE || r.type === A.ERROR ? `Test "${t.name}" failed. ${r.message}` : r.type === A.CHAI_DIFF ? `Test "${t.name}" failed. Expected value does not match actual value.` : `Test "${t.name}" failed.`;
1126
1156
  } catch {
1127
- return `Test "${e.name}" failed. ${t}`;
1157
+ return `Test "${t.name}" failed. ${e}`;
1128
1158
  }
1129
- } else if (e.status === "skip")
1130
- return `Test "${e.name}" skipped.`;
1159
+ } else if (t.status === "skip")
1160
+ return `Test "${t.name}" skipped.`;
1131
1161
  return "";
1132
- }, Jt = (e) => {
1133
- const t = e.filter((l) => l.type === "test"), r = t.filter((l) => l.status === "pass").length, n = t.filter((l) => l.status === "fail").length, s = t.filter((l) => l.status === "skip").length, o = [];
1134
- return n > 0 ? (o.push("Test run completed."), o.push(`${r} test${r !== 1 ? "s" : ""} passed`), o.push(`${n} test${n !== 1 ? "s" : ""} failed`), s > 0 && o.push(`${s} test${s !== 1 ? "s" : ""} skipped`), o.join(", ") + ".") : (o.push("All tests passed."), o.push(`${r} test${r !== 1 ? "s" : ""} completed`), s > 0 && o.push(`${s} test${s !== 1 ? "s" : ""} skipped`), o.join(", ") + ".");
1135
- }, Xt = {
1162
+ }, Vt = (t) => {
1163
+ const e = t.filter((l) => l.type === "test"), r = e.filter((l) => l.status === "pass").length, n = e.filter((l) => l.status === "fail").length, o = e.filter((l) => l.status === "skip").length, s = [];
1164
+ return n > 0 ? (s.push("Test run completed."), s.push(`${r} test${r !== 1 ? "s" : ""} passed`), s.push(`${n} test${n !== 1 ? "s" : ""} failed`), o > 0 && s.push(`${o} test${o !== 1 ? "s" : ""} skipped`), s.join(", ") + ".") : (s.push("All tests passed."), s.push(`${r} test${r !== 1 ? "s" : ""} completed`), o > 0 && s.push(`${o} test${o !== 1 ? "s" : ""} skipped`), s.join(", ") + ".");
1165
+ }, Jt = ({ value: t, onChange: e }) => /* @__PURE__ */ c("div", { style: { position: "relative", marginBottom: "var(--twd-spacing-md)" }, children: /* @__PURE__ */ c(
1166
+ "input",
1167
+ {
1168
+ type: "search",
1169
+ id: "twd-search-input",
1170
+ "aria-label": "Filter tests",
1171
+ placeholder: "Filter tests...",
1172
+ value: t,
1173
+ onChange: (r) => e(r.target.value),
1174
+ style: {
1175
+ width: "100%",
1176
+ padding: "var(--twd-spacing-md)",
1177
+ background: "var(--twd-background)",
1178
+ color: "var(--twd-text)",
1179
+ border: "1px solid var(--twd-border)",
1180
+ borderRadius: "var(--twd-border-radius)",
1181
+ fontSize: "var(--twd-font-size-md)",
1182
+ boxSizing: "border-box",
1183
+ outline: "none"
1184
+ }
1185
+ }
1186
+ ) }), Xt = (t, e) => {
1187
+ if (!e.trim()) return t;
1188
+ const r = e.toLowerCase(), n = (o) => {
1189
+ const s = o.name.toLowerCase().includes(r);
1190
+ if (o.type === "test")
1191
+ return s ? o : null;
1192
+ const l = (o.childrenNodes || []).map(n).filter((d) => d !== null);
1193
+ return s || l.length > 0 ? {
1194
+ ...o,
1195
+ childrenNodes: s ? o.childrenNodes : l
1196
+ } : null;
1197
+ };
1198
+ return t.map(n).filter((o) => o !== null);
1199
+ }, Gt = (t) => {
1200
+ const e = /* @__PURE__ */ new Map(), r = [];
1201
+ for (const n of t) e.set(n.id, { ...n, childrenNodes: [] });
1202
+ for (const n of e.values())
1203
+ n.parent ? e.get(n.parent)?.childrenNodes?.push(n) : r.push(n);
1204
+ return r;
1205
+ }, Kt = {
1136
1206
  left: { left: 0, borderRight: "1px solid var(--twd-border)" },
1137
1207
  right: { right: 0, borderLeft: "1px solid var(--twd-border)" }
1138
- }, Gt = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', Yt = (e) => sessionStorage.getItem("twd-sidebar-open") ? sessionStorage.getItem("twd-sidebar-open") === "true" : e, Kt = ({ open: e, position: t = "left" }) => {
1139
- const [r, n] = V(0), [s, o] = V(Yt(e));
1140
- Lt({ isOpen: s, position: t });
1141
- const [l, c] = V("");
1142
- Q(() => {
1143
- const _ = () => n((g) => g + 1);
1144
- return window.addEventListener("twd:state-change", _), () => window.removeEventListener("twd:state-change", _);
1208
+ }, Yt = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', Qt = (t) => t ? sessionStorage.getItem("twd-search-filter") || "" : (sessionStorage.removeItem("twd-search-filter"), ""), Zt = (t) => sessionStorage.getItem("twd-sidebar-open") ? sessionStorage.getItem("twd-sidebar-open") === "true" : t, Ke = (t) => {
1209
+ const e = [];
1210
+ for (const r of t)
1211
+ r.type === "test" && e.push(r.id), r.childrenNodes && e.push(...Ke(r.childrenNodes));
1212
+ return e;
1213
+ }, er = ({ open: t, position: e = "left", search: r }) => {
1214
+ const [n, o] = B(0), [s, l] = B(Zt(t));
1215
+ At({ isOpen: s, position: e });
1216
+ const [d, u] = B(""), [a, p] = B(Qt(r));
1217
+ te(() => {
1218
+ const h = () => o((y) => y + 1);
1219
+ return window.addEventListener("twd:state-change", h), () => window.removeEventListener("twd:state-change", h);
1145
1220
  }, []);
1146
- const f = new Ye({
1147
- onStart: (_) => {
1148
- _.status = "running", n((g) => g + 1);
1221
+ const i = new Xe({
1222
+ onStart: (h) => {
1223
+ h.status = "running", o((y) => y + 1);
1149
1224
  },
1150
- onPass: (_) => {
1151
- _.status = "pass", n((g) => g + 1);
1225
+ onPass: (h) => {
1226
+ h.status = "pass", o((y) => y + 1);
1152
1227
  },
1153
- onFail: (_, g) => {
1154
- if (_.status = "fail", console.group(`%c❌ Test failed: ${_.name}`, "color: red; font-weight: bold;"), Ut(g)) {
1155
- qt(g);
1156
- const v = Ke(g);
1157
- v.type === "diff" ? _.logs.push(JSON.stringify({
1158
- type: R.CHAI_DIFF,
1159
- expected: v.expected,
1160
- actual: v.actual
1161
- })) : _.logs.push(JSON.stringify({
1162
- type: R.CHAI_MESSAGE,
1163
- message: `Test failed: ${v.message}`
1228
+ onFail: (h, y) => {
1229
+ if (h.status = "fail", console.group(`%c❌ Test failed: ${h.name}`, "color: red; font-weight: bold;"), Ut(y)) {
1230
+ jt(y);
1231
+ const C = Ge(y);
1232
+ C.type === "diff" ? h.logs.push(JSON.stringify({
1233
+ type: A.CHAI_DIFF,
1234
+ expected: C.expected,
1235
+ actual: C.actual
1236
+ })) : h.logs.push(JSON.stringify({
1237
+ type: A.CHAI_MESSAGE,
1238
+ message: `Test failed: ${C.message}`
1164
1239
  }));
1165
1240
  } else
1166
- console.error(g.message), _.logs.push(JSON.stringify({
1167
- type: R.ERROR,
1168
- message: `Test failed: ${g.message}`
1241
+ console.error(y.message), h.logs.push(JSON.stringify({
1242
+ type: A.ERROR,
1243
+ message: `Test failed: ${y.message}`
1169
1244
  }));
1170
- console.groupEnd(), n((v) => v + 1);
1245
+ console.groupEnd(), o((C) => C + 1);
1171
1246
  },
1172
- onSkip: (_) => {
1173
- _.status = "skip", n((g) => g + 1);
1247
+ onSkip: (h) => {
1248
+ h.status = "skip", o((y) => y + 1);
1174
1249
  }
1175
- }), a = (_) => {
1176
- o(_), sessionStorage.setItem("twd-sidebar-open", _.toString());
1177
- }, h = async () => {
1178
- c(""), sessionStorage.removeItem("twd-last-run-test-name"), await f.runAll();
1179
- const _ = Jt(u);
1180
- c(_);
1181
- }, i = async (_) => {
1182
- const g = Array.from(S.values()).filter((m) => m.type === "test").find((m) => m.id === _);
1183
- if (!g) return;
1184
- c(""), sessionStorage.setItem("twd-last-run-test-name", g.name), await f.runSingle(g.id);
1185
- const v = Vt(g);
1186
- c(v);
1187
- }, u = Array.from(S.values());
1250
+ }), f = (h) => {
1251
+ p(h), h ? sessionStorage.setItem("twd-search-filter", h) : sessionStorage.removeItem("twd-search-filter");
1252
+ }, _ = (h) => {
1253
+ l(h), sessionStorage.setItem("twd-sidebar-open", h.toString());
1254
+ }, v = Array.from(x.values()), T = z(
1255
+ () => Gt(v),
1256
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1257
+ [n]
1258
+ ), b = z(
1259
+ () => Xt(T, a),
1260
+ [T, a]
1261
+ ), { filteredTestIds: m, displayTests: g } = z(() => {
1262
+ if (a) {
1263
+ const h = Ke(b), y = new Set(h);
1264
+ return {
1265
+ filteredTestIds: h,
1266
+ displayTests: v.filter((C) => C.type === "test" && y.has(C.id))
1267
+ };
1268
+ }
1269
+ return {
1270
+ filteredTestIds: null,
1271
+ displayTests: v.filter((h) => h.type === "test")
1272
+ };
1273
+ }, [b, a, n]), I = async () => {
1274
+ u(""), sessionStorage.removeItem("twd-last-run-test-name"), m ? await i.runByIds(m) : await i.runAll();
1275
+ const h = Vt(v);
1276
+ u(h);
1277
+ }, $ = async (h) => {
1278
+ const y = Array.from(x.values()).filter((R) => R.type === "test").find((R) => R.id === h);
1279
+ if (!y) return;
1280
+ u(""), sessionStorage.setItem("twd-last-run-test-name", y.name), await i.runSingle(y.id);
1281
+ const C = qt(y);
1282
+ u(C);
1283
+ };
1188
1284
  if (!s)
1189
- return /* @__PURE__ */ d(It, { position: t, setOpen: a });
1190
- const p = u.filter((_) => _.type === "test").length;
1191
- return /* @__PURE__ */ d(
1285
+ return /* @__PURE__ */ c(Et, { position: e, setOpen: _ });
1286
+ const L = g.length;
1287
+ return /* @__PURE__ */ c(
1192
1288
  "div",
1193
1289
  {
1194
1290
  style: {
1195
- fontFamily: Gt,
1291
+ fontFamily: Yt,
1196
1292
  position: "fixed",
1197
1293
  top: 0,
1198
1294
  bottom: 0,
@@ -1205,14 +1301,14 @@ const Ut = (e) => e instanceof Error && "actual" in e && "expected" in e, Ke = (
1205
1301
  zIndex: "var(--twd-z-index-sidebar)",
1206
1302
  pointerEvents: "all",
1207
1303
  isolation: "isolate",
1208
- ...Xt[t]
1304
+ ...Kt[e]
1209
1305
  },
1210
1306
  "data-testid": "twd-sidebar",
1211
1307
  role: "complementary",
1212
1308
  "aria-label": "Test While Developing sidebar",
1213
1309
  children: [
1214
- /* @__PURE__ */ d("div", { "aria-live": "polite", "aria-atomic": "true", style: { position: "absolute", width: "1px", height: "1px", margin: "-1px", border: "0", padding: "0", overflow: "hidden", clip: "rect(0 0 0 0)" }, children: l }),
1215
- /* @__PURE__ */ d("div", { style: {
1310
+ /* @__PURE__ */ c("div", { "aria-live": "polite", "aria-atomic": "true", style: { position: "absolute", width: "1px", height: "1px", margin: "-1px", border: "0", padding: "0", overflow: "hidden", clip: "rect(0 0 0 0)" }, children: d }),
1311
+ /* @__PURE__ */ c("div", { style: {
1216
1312
  padding: "var(--twd-spacing-md)",
1217
1313
  background: "var(--twd-background)",
1218
1314
  position: "sticky",
@@ -1220,17 +1316,17 @@ const Ut = (e) => e instanceof Error && "actual" in e && "expected" in e, Ke = (
1220
1316
  zIndex: "var(--twd-z-index-sticky)",
1221
1317
  borderBottom: "1px solid var(--twd-border)"
1222
1318
  }, children: [
1223
- /* @__PURE__ */ d("div", { style: {
1319
+ /* @__PURE__ */ c("div", { style: {
1224
1320
  display: "flex",
1225
1321
  justifyContent: "space-between",
1226
1322
  alignItems: "center",
1227
1323
  marginBottom: "var(--twd-spacing-xl)"
1228
1324
  }, children: [
1229
- /* @__PURE__ */ d("div", { style: { display: "flex", gap: "var(--twd-spacing-xs)" }, children: [
1230
- /* @__PURE__ */ d(
1325
+ /* @__PURE__ */ c("div", { style: { display: "flex", gap: "var(--twd-spacing-xs)" }, children: [
1326
+ /* @__PURE__ */ c(
1231
1327
  "button",
1232
1328
  {
1233
- onClick: h,
1329
+ onClick: I,
1234
1330
  style: {
1235
1331
  background: "var(--twd-button-primary)",
1236
1332
  color: "var(--twd-button-primary-text)",
@@ -1239,14 +1335,14 @@ const Ut = (e) => e instanceof Error && "actual" in e && "expected" in e, Ke = (
1239
1335
  border: "none",
1240
1336
  cursor: "pointer"
1241
1337
  },
1242
- children: "Run All"
1338
+ children: /* @__PURE__ */ c("span", { "aria-live": "polite", children: a ? "Run Filtered" : "Run All" })
1243
1339
  }
1244
1340
  ),
1245
- /* @__PURE__ */ d(
1341
+ /* @__PURE__ */ c(
1246
1342
  "button",
1247
1343
  {
1248
1344
  onClick: () => {
1249
- Dt(), jt();
1345
+ Bt(), Ot();
1250
1346
  },
1251
1347
  "aria-label": "Clear all mocks",
1252
1348
  style: {
@@ -1260,16 +1356,16 @@ const Ut = (e) => e instanceof Error && "actual" in e && "expected" in e, Ke = (
1260
1356
  children: "Clear mocks"
1261
1357
  }
1262
1358
  ),
1263
- /* @__PURE__ */ d("span", { style: {
1359
+ /* @__PURE__ */ c("span", { style: {
1264
1360
  color: "var(--twd-text-secondary)",
1265
1361
  fontSize: "var(--twd-font-size-sm)",
1266
1362
  alignSelf: "center"
1267
1363
  }, children: [
1268
1364
  "v",
1269
- fe
1365
+ ge
1270
1366
  ] })
1271
1367
  ] }),
1272
- /* @__PURE__ */ d(
1368
+ /* @__PURE__ */ c(
1273
1369
  "button",
1274
1370
  {
1275
1371
  "aria-label": "Close sidebar",
@@ -1281,12 +1377,12 @@ const Ut = (e) => e instanceof Error && "actual" in e && "expected" in e, Ke = (
1281
1377
  paddingRight: "0",
1282
1378
  paddingLeft: "0"
1283
1379
  },
1284
- onClick: () => a(!1),
1380
+ onClick: () => _(!1),
1285
1381
  children: "✖"
1286
1382
  }
1287
1383
  )
1288
1384
  ] }),
1289
- /* @__PURE__ */ d("div", { style: {
1385
+ /* @__PURE__ */ c("div", { style: {
1290
1386
  display: "flex",
1291
1387
  justifyContent: "space-between",
1292
1388
  alignItems: "center",
@@ -1294,55 +1390,47 @@ const Ut = (e) => e instanceof Error && "actual" in e && "expected" in e, Ke = (
1294
1390
  color: "var(--twd-text-secondary)",
1295
1391
  marginBottom: "10px"
1296
1392
  }, children: [
1297
- /* @__PURE__ */ d("span", { style: { color: "var(--twd-text)" }, children: [
1393
+ /* @__PURE__ */ c("span", { style: { color: "var(--twd-text)" }, children: [
1298
1394
  "Total: ",
1299
- p
1395
+ L
1300
1396
  ] }),
1301
- /* @__PURE__ */ d("div", { style: { display: "flex", gap: "var(--twd-spacing-xs)" }, children: [
1302
- /* @__PURE__ */ d("span", { style: { color: "var(--twd-success)" }, children: [
1397
+ /* @__PURE__ */ c("div", { style: { display: "flex", gap: "var(--twd-spacing-xs)" }, children: [
1398
+ /* @__PURE__ */ c("span", { style: { color: "var(--twd-success)" }, children: [
1303
1399
  "✓ ",
1304
- u.filter((_) => _.status === "pass").length
1400
+ g.filter((h) => h.status === "pass").length
1305
1401
  ] }),
1306
- /* @__PURE__ */ d("span", { style: { color: "var(--twd-error)" }, children: [
1402
+ /* @__PURE__ */ c("span", { style: { color: "var(--twd-error)" }, children: [
1307
1403
  "✗ ",
1308
- u.filter((_) => _.status === "fail").length
1404
+ g.filter((h) => h.status === "fail").length
1309
1405
  ] })
1310
1406
  ] })
1311
1407
  ] }),
1312
- /* @__PURE__ */ d(Ft, {})
1408
+ /* @__PURE__ */ c(Ft, {}),
1409
+ r && /* @__PURE__ */ c(Jt, { value: a, onChange: f })
1313
1410
  ] }),
1314
- /* @__PURE__ */ d("div", { style: { padding: "var(--twd-spacing-md)" }, children: /* @__PURE__ */ d(
1315
- Ct,
1411
+ /* @__PURE__ */ c("div", { style: { padding: "var(--twd-spacing-md)" }, children: /* @__PURE__ */ c(
1412
+ It,
1316
1413
  {
1317
- tests: u.map((_) => ({
1318
- name: _.name,
1319
- depth: _.depth,
1320
- status: _.status,
1321
- logs: _.logs,
1322
- id: _.id,
1323
- parent: _.parent,
1324
- type: _.type,
1325
- only: _.only,
1326
- skip: _.skip
1327
- })),
1328
- runTest: i
1414
+ roots: b,
1415
+ runTest: $,
1416
+ searchQuery: a
1329
1417
  }
1330
1418
  ) })
1331
1419
  ]
1332
1420
  }
1333
1421
  );
1334
- }, Zt = (e) => ({
1335
- render: (t) => {
1336
- it(t, e);
1422
+ }, tr = (t) => ({
1423
+ render: (e) => {
1424
+ it(e, t);
1337
1425
  }
1338
- }), er = (e, t) => {
1339
- const { open: r = !0, position: n = "left", serviceWorker: s = !0, serviceWorkerUrl: o = "/mock-sw.js", theme: l } = t || {};
1340
- ut(e, /* @__PURE__ */ d(Kt, { open: r, position: n }), Zt, l), s && Nt(o).then(() => {
1426
+ }), nr = (t, e) => {
1427
+ const { open: r = !0, position: n = "left", serviceWorker: o = !0, serviceWorkerUrl: s = "/mock-sw.js", theme: l, search: d } = e || {};
1428
+ _t(t, /* @__PURE__ */ c(er, { open: r, position: n, ...d !== void 0 && { search: d } }), tr, l), o && Wt(s).then(() => {
1341
1429
  console.log("Request mocking initialized");
1342
- }).catch((c) => {
1343
- console.error("Error initializing request mocking:", c);
1430
+ }).catch((u) => {
1431
+ console.error("Error initializing request mocking:", u);
1344
1432
  });
1345
1433
  };
1346
1434
  export {
1347
- er as initTWD
1435
+ nr as initTWD
1348
1436
  };