@roudanio/maze 0.0.7 → 0.0.8

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.
package/dist/maze.js CHANGED
@@ -1,243 +1,238 @@
1
- var ne, y, qe, O, we, Xe, Ye, Je, de, ae, ce, Ke, B = {}, Ze = [], St = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, X = Array.isArray;
2
- function I(e, t) {
3
- for (var o in t) e[o] = t[o];
4
- return e;
1
+ var Z, w, Re, F, pe, Fe, $e, Ue, ae, ie, re, De, G = {}, Oe = [], dt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Q = Array.isArray;
2
+ function E(t, e) {
3
+ for (var o in e) t[o] = e[o];
4
+ return t;
5
5
  }
6
- function he(e) {
7
- e && e.parentNode && e.parentNode.removeChild(e);
6
+ function ce(t) {
7
+ t && t.parentNode && t.parentNode.removeChild(t);
8
8
  }
9
- function W(e, t, o) {
9
+ function ht(t, e, o) {
10
10
  var n, i, r, s = {};
11
- for (r in t) r == "key" ? n = t[r] : r == "ref" ? i = t[r] : s[r] = t[r];
12
- if (arguments.length > 2 && (s.children = arguments.length > 3 ? ne.call(arguments, 2) : o), typeof e == "function" && e.defaultProps != null) for (r in e.defaultProps) s[r] == null && (s[r] = e.defaultProps[r]);
13
- return Z(e, s, n, i, null);
14
- }
15
- function Z(e, t, o, n, i) {
16
- var r = { type: e, props: t, key: o, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++qe, __i: -1, __u: 0 };
17
- return i == null && y.vnode != null && y.vnode(r), r;
18
- }
19
- function j(e) {
20
- return e.children;
21
- }
22
- function $(e, t) {
23
- this.props = e, this.context = t;
24
- }
25
- function H(e, t) {
26
- if (t == null) return e.__ ? H(e.__, e.__i + 1) : null;
27
- for (var o; t < e.__k.length; t++) if ((o = e.__k[t]) != null && o.__e != null) return o.__e;
28
- return typeof e.type == "function" ? H(e) : null;
29
- }
30
- function Qe(e) {
31
- var t, o;
32
- if ((e = e.__) != null && e.__c != null) {
33
- for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((o = e.__k[t]) != null && o.__e != null) {
34
- e.__e = e.__c.base = o.__e;
11
+ for (r in e) r == "key" ? n = e[r] : r == "ref" ? i = e[r] : s[r] = e[r];
12
+ if (arguments.length > 2 && (s.children = arguments.length > 3 ? Z.call(arguments, 2) : o), typeof t == "function" && t.defaultProps != null) for (r in t.defaultProps) s[r] == null && (s[r] = t.defaultProps[r]);
13
+ return V(t, s, n, i, null);
14
+ }
15
+ function V(t, e, o, n, i) {
16
+ var r = { type: t, props: e, key: o, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Re, __i: -1, __u: 0 };
17
+ return i == null && w.vnode != null && w.vnode(r), r;
18
+ }
19
+ function ee(t) {
20
+ return t.children;
21
+ }
22
+ function X(t, e) {
23
+ this.props = t, this.context = e;
24
+ }
25
+ function D(t, e) {
26
+ if (e == null) return t.__ ? D(t.__, t.__i + 1) : null;
27
+ for (var o; e < t.__k.length; e++) if ((o = t.__k[e]) != null && o.__e != null) return o.__e;
28
+ return typeof t.type == "function" ? D(t) : null;
29
+ }
30
+ function je(t) {
31
+ var e, o;
32
+ if ((t = t.__) != null && t.__c != null) {
33
+ for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((o = t.__k[e]) != null && o.__e != null) {
34
+ t.__e = t.__c.base = o.__e;
35
35
  break;
36
36
  }
37
- return Qe(e);
37
+ return je(t);
38
38
  }
39
39
  }
40
- function ue(e) {
41
- (!e.__d && (e.__d = !0) && O.push(e) && !te.__r++ || we != y.debounceRendering) && ((we = y.debounceRendering) || Xe)(te);
42
- }
43
- function te() {
44
- for (var e, t, o, n, i, r, s, l = 1; O.length; ) O.length > l && O.sort(Ye), e = O.shift(), l = O.length, e.__d && (o = void 0, i = (n = (t = e).__v).__e, r = [], s = [], t.__P && ((o = I({}, n)).__v = n.__v + 1, y.vnode && y.vnode(o), fe(t.__P, o, n, t.__n, t.__P.namespaceURI, 32 & n.__u ? [i] : null, r, i ?? H(n), !!(32 & n.__u), s), o.__v = n.__v, o.__.__k[o.__i] = o, ot(r, o, s), o.__e != i && Qe(o)));
45
- te.__r = 0;
46
- }
47
- function et(e, t, o, n, i, r, s, l, a, c, _) {
48
- var u, h, d, f, g, v, C = n && n.__k || Ze, p = t.length;
49
- for (a = Lt(o, t, C, a, p), u = 0; u < p; u++) (d = o.__k[u]) != null && (h = d.__i == -1 ? B : C[d.__i] || B, d.__i = u, v = fe(e, d, h, i, r, s, l, a, c, _), f = d.__e, d.ref && h.ref != d.ref && (h.ref && me(h.ref, null, d), _.push(d.ref, d.__c || f, d)), g == null && f != null && (g = f), 4 & d.__u || h.__k === d.__k ? a = tt(d, a, e) : typeof d.type == "function" && v !== void 0 ? a = v : f && (a = f.nextSibling), d.__u &= -7);
50
- return o.__e = g, a;
40
+ function se(t) {
41
+ (!t.__d && (t.__d = !0) && F.push(t) && !K.__r++ || pe != w.debounceRendering) && ((pe = w.debounceRendering) || Fe)(K);
51
42
  }
52
- function Lt(e, t, o, n, i) {
53
- var r, s, l, a, c, _ = o.length, u = _, h = 0;
54
- for (e.__k = new Array(i), r = 0; r < i; r++) (s = t[r]) != null && typeof s != "boolean" && typeof s != "function" ? (a = r + h, (s = e.__k[r] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Z(null, s, null, null, null) : X(s) ? Z(j, { children: s }, null, null, null) : s.constructor == null && s.__b > 0 ? Z(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = e, s.__b = e.__b + 1, l = null, (c = s.__i = xt(s, o, a, u)) != -1 && (u--, (l = o[c]) && (l.__u |= 2)), l == null || l.__v == null ? (c == -1 && (i > _ ? h-- : i < _ && h++), typeof s.type != "function" && (s.__u |= 4)) : c != a && (c == a - 1 ? h-- : c == a + 1 ? h++ : (c > a ? h-- : h++, s.__u |= 4))) : e.__k[r] = null;
55
- if (u) for (r = 0; r < _; r++) (l = o[r]) != null && (2 & l.__u) == 0 && (l.__e == n && (n = H(l)), it(l, l));
43
+ function K() {
44
+ for (var t, e, o, n, i, r, s, l = 1; F.length; ) F.length > l && F.sort($e), t = F.shift(), l = F.length, t.__d && (o = void 0, i = (n = (e = t).__v).__e, r = [], s = [], e.__P && ((o = E({}, n)).__v = n.__v + 1, w.vnode && w.vnode(o), ue(e.__P, o, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [i] : null, r, i ?? D(n), !!(32 & n.__u), s), o.__v = n.__v, o.__.__k[o.__i] = o, We(r, o, s), o.__e != i && je(o)));
45
+ K.__r = 0;
46
+ }
47
+ function Ge(t, e, o, n, i, r, s, l, c, a, d) {
48
+ var u, _, h, v, g, p, f = n && n.__k || Oe, C = e.length;
49
+ for (c = _t(o, e, f, c, C), u = 0; u < C; u++) (h = o.__k[u]) != null && (_ = h.__i == -1 ? G : f[h.__i] || G, h.__i = u, p = ue(t, h, _, i, r, s, l, c, a, d), v = h.__e, h.ref && _.ref != h.ref && (_.ref && de(_.ref, null, h), d.push(h.ref, h.__c || v, h)), g == null && v != null && (g = v), 4 & h.__u || _.__k === h.__k ? c = He(h, c, t) : typeof h.type == "function" && p !== void 0 ? c = p : v && (c = v.nextSibling), h.__u &= -7);
50
+ return o.__e = g, c;
51
+ }
52
+ function _t(t, e, o, n, i) {
53
+ var r, s, l, c, a, d = o.length, u = d, _ = 0;
54
+ for (t.__k = new Array(i), r = 0; r < i; r++) (s = e[r]) != null && typeof s != "boolean" && typeof s != "function" ? (c = r + _, (s = t.__k[r] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? V(null, s, null, null, null) : Q(s) ? V(ee, { children: s }, null, null, null) : s.constructor == null && s.__b > 0 ? V(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, l = null, (a = s.__i = ft(s, o, c, u)) != -1 && (u--, (l = o[a]) && (l.__u |= 2)), l == null || l.__v == null ? (a == -1 && (i > d ? _-- : i < d && _++), typeof s.type != "function" && (s.__u |= 4)) : a != c && (a == c - 1 ? _-- : a == c + 1 ? _++ : (a > c ? _-- : _++, s.__u |= 4))) : t.__k[r] = null;
55
+ if (u) for (r = 0; r < d; r++) (l = o[r]) != null && (2 & l.__u) == 0 && (l.__e == n && (n = D(l)), qe(l, l));
56
56
  return n;
57
57
  }
58
- function tt(e, t, o) {
58
+ function He(t, e, o) {
59
59
  var n, i;
60
- if (typeof e.type == "function") {
61
- for (n = e.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = e, t = tt(n[i], t, o));
62
- return t;
60
+ if (typeof t.type == "function") {
61
+ for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = He(n[i], e, o));
62
+ return e;
63
63
  }
64
- e.__e != t && (t && e.type && !o.contains(t) && (t = H(e)), o.insertBefore(e.__e, t || null), t = e.__e);
64
+ t.__e != e && (e && t.type && !o.contains(e) && (e = D(t)), o.insertBefore(t.__e, e || null), e = t.__e);
65
65
  do
66
- t = t && t.nextSibling;
67
- while (t != null && t.nodeType == 8);
68
- return t;
69
- }
70
- function oe(e, t) {
71
- return t = t || [], e == null || typeof e == "boolean" || (X(e) ? e.some(function(o) {
72
- oe(o, t);
73
- }) : t.push(e)), t;
66
+ e = e && e.nextSibling;
67
+ while (e != null && e.nodeType == 8);
68
+ return e;
74
69
  }
75
- function xt(e, t, o, n) {
76
- var i, r, s = e.key, l = e.type, a = t[o];
77
- if (a === null && e.key == null || a && s == a.key && l == a.type && (2 & a.__u) == 0) return o;
78
- if (n > (a != null && (2 & a.__u) == 0 ? 1 : 0)) for (i = o - 1, r = o + 1; i >= 0 || r < t.length; ) {
70
+ function ft(t, e, o, n) {
71
+ var i, r, s = t.key, l = t.type, c = e[o];
72
+ if (c === null && t.key == null || c && s == c.key && l == c.type && (2 & c.__u) == 0) return o;
73
+ if (n > (c != null && (2 & c.__u) == 0 ? 1 : 0)) for (i = o - 1, r = o + 1; i >= 0 || r < e.length; ) {
79
74
  if (i >= 0) {
80
- if ((a = t[i]) && (2 & a.__u) == 0 && s == a.key && l == a.type) return i;
75
+ if ((c = e[i]) && (2 & c.__u) == 0 && s == c.key && l == c.type) return i;
81
76
  i--;
82
77
  }
83
- if (r < t.length) {
84
- if ((a = t[r]) && (2 & a.__u) == 0 && s == a.key && l == a.type) return r;
78
+ if (r < e.length) {
79
+ if ((c = e[r]) && (2 & c.__u) == 0 && s == c.key && l == c.type) return r;
85
80
  r++;
86
81
  }
87
82
  }
88
83
  return -1;
89
84
  }
90
- function be(e, t, o) {
91
- t[0] == "-" ? e.setProperty(t, o ?? "") : e[t] = o == null ? "" : typeof o != "number" || St.test(t) ? o : o + "px";
85
+ function Ce(t, e, o) {
86
+ e[0] == "-" ? t.setProperty(e, o ?? "") : t[e] = o == null ? "" : typeof o != "number" || dt.test(e) ? o : o + "px";
92
87
  }
93
- function J(e, t, o, n, i) {
88
+ function q(t, e, o, n, i) {
94
89
  var r;
95
- e: if (t == "style") if (typeof o == "string") e.style.cssText = o;
90
+ e: if (e == "style") if (typeof o == "string") t.style.cssText = o;
96
91
  else {
97
- if (typeof n == "string" && (e.style.cssText = n = ""), n) for (t in n) o && t in o || be(e.style, t, "");
98
- if (o) for (t in o) n && o[t] == n[t] || be(e.style, t, o[t]);
92
+ if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) o && e in o || Ce(t.style, e, "");
93
+ if (o) for (e in o) n && o[e] == n[e] || Ce(t.style, e, o[e]);
99
94
  }
100
- else if (t[0] == "o" && t[1] == "n") r = t != (t = t.replace(Je, "$1")), t = t.toLowerCase() in e || t == "onFocusOut" || t == "onFocusIn" ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + r] = o, o ? n ? o.u = n.u : (o.u = de, e.addEventListener(t, r ? ce : ae, r)) : e.removeEventListener(t, r ? ce : ae, r);
95
+ else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(Ue, "$1")), e = e.toLowerCase() in t || e == "onFocusOut" || e == "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + r] = o, o ? n ? o.u = n.u : (o.u = ae, t.addEventListener(e, r ? re : ie, r)) : t.removeEventListener(e, r ? re : ie, r);
101
96
  else {
102
- if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
103
- 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 {
104
- e[t] = o ?? "";
97
+ if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
98
+ 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 {
99
+ t[e] = o ?? "";
105
100
  break e;
106
101
  } catch {
107
102
  }
108
- typeof o == "function" || (o == null || o === !1 && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && o == 1 ? "" : o));
103
+ typeof o == "function" || (o == null || o === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && o == 1 ? "" : o));
109
104
  }
110
105
  }
111
- function ke(e) {
112
- return function(t) {
106
+ function we(t) {
107
+ return function(e) {
113
108
  if (this.l) {
114
- var o = this.l[t.type + e];
115
- if (t.t == null) t.t = de++;
116
- else if (t.t < o.u) return;
117
- return o(y.event ? y.event(t) : t);
109
+ var o = this.l[e.type + t];
110
+ if (e.t == null) e.t = ae++;
111
+ else if (e.t < o.u) return;
112
+ return o(w.event ? w.event(e) : e);
118
113
  }
119
114
  };
120
115
  }
121
- function fe(e, t, o, n, i, r, s, l, a, c) {
122
- var _, u, h, d, f, g, v, C, p, T, k, E, P, F, M, N, S, z = t.type;
123
- if (t.constructor != null) return null;
124
- 128 & o.__u && (a = !!(32 & o.__u), r = [l = t.__e = o.__e]), (_ = y.__b) && _(t);
125
- e: if (typeof z == "function") try {
126
- if (C = t.props, p = "prototype" in z && z.prototype.render, T = (_ = z.contextType) && n[_.__c], k = _ ? T ? T.props.value : _.__ : n, o.__c ? v = (u = t.__c = o.__c).__ = u.__E : (p ? t.__c = u = new z(C, k) : (t.__c = u = new $(C, k), u.constructor = z, u.render = Et), T && T.sub(u), u.props = C, u.state || (u.state = {}), u.context = k, u.__n = n, h = u.__d = !0, u.__h = [], u._sb = []), p && u.__s == null && (u.__s = u.state), p && z.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = I({}, u.__s)), I(u.__s, z.getDerivedStateFromProps(C, u.__s))), d = u.props, f = u.state, u.__v = t, h) p && z.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), p && u.componentDidMount != null && u.__h.push(u.componentDidMount);
116
+ function ue(t, e, o, n, i, r, s, l, c, a) {
117
+ var d, u, _, h, v, g, p, f, C, z, b, A, P, N, $, M, j, T = e.type;
118
+ if (e.constructor != null) return null;
119
+ 128 & o.__u && (c = !!(32 & o.__u), r = [l = e.__e = o.__e]), (d = w.__b) && d(e);
120
+ e: if (typeof T == "function") try {
121
+ if (f = e.props, C = "prototype" in T && T.prototype.render, z = (d = T.contextType) && n[d.__c], b = d ? z ? z.props.value : d.__ : n, o.__c ? p = (u = e.__c = o.__c).__ = u.__E : (C ? e.__c = u = new T(f, b) : (e.__c = u = new X(f, b), u.constructor = T, u.render = vt), z && z.sub(u), u.props = f, u.state || (u.state = {}), u.context = b, u.__n = n, _ = u.__d = !0, u.__h = [], u._sb = []), C && u.__s == null && (u.__s = u.state), C && T.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = E({}, u.__s)), E(u.__s, T.getDerivedStateFromProps(f, u.__s))), h = u.props, v = u.state, u.__v = e, _) C && T.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), C && u.componentDidMount != null && u.__h.push(u.componentDidMount);
127
122
  else {
128
- if (p && z.getDerivedStateFromProps == null && C !== d && u.componentWillReceiveProps != null && u.componentWillReceiveProps(C, k), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(C, u.__s, k) === !1 || t.__v == o.__v) {
129
- for (t.__v != o.__v && (u.props = C, u.state = u.__s, u.__d = !1), t.__e = o.__e, t.__k = o.__k, t.__k.some(function(U) {
130
- U && (U.__ = t);
131
- }), E = 0; E < u._sb.length; E++) u.__h.push(u._sb[E]);
123
+ if (C && T.getDerivedStateFromProps == null && f !== h && u.componentWillReceiveProps != null && u.componentWillReceiveProps(f, b), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(f, u.__s, b) === !1 || e.__v == o.__v) {
124
+ for (e.__v != o.__v && (u.props = f, u.state = u.__s, u.__d = !1), e.__e = o.__e, e.__k = o.__k, e.__k.some(function(R) {
125
+ R && (R.__ = e);
126
+ }), A = 0; A < u._sb.length; A++) u.__h.push(u._sb[A]);
132
127
  u._sb = [], u.__h.length && s.push(u);
133
128
  break e;
134
129
  }
135
- u.componentWillUpdate != null && u.componentWillUpdate(C, u.__s, k), p && u.componentDidUpdate != null && u.__h.push(function() {
136
- u.componentDidUpdate(d, f, g);
130
+ u.componentWillUpdate != null && u.componentWillUpdate(f, u.__s, b), C && u.componentDidUpdate != null && u.__h.push(function() {
131
+ u.componentDidUpdate(h, v, g);
137
132
  });
138
133
  }
139
- if (u.context = k, u.props = C, u.__P = e, u.__e = !1, P = y.__r, F = 0, p) {
140
- for (u.state = u.__s, u.__d = !1, P && P(t), _ = u.render(u.props, u.state, u.context), M = 0; M < u._sb.length; M++) u.__h.push(u._sb[M]);
134
+ if (u.context = b, u.props = f, u.__P = t, u.__e = !1, P = w.__r, N = 0, C) {
135
+ for (u.state = u.__s, u.__d = !1, P && P(e), d = u.render(u.props, u.state, u.context), $ = 0; $ < u._sb.length; $++) u.__h.push(u._sb[$]);
141
136
  u._sb = [];
142
137
  } else do
143
- u.__d = !1, P && P(t), _ = u.render(u.props, u.state, u.context), u.state = u.__s;
144
- while (u.__d && ++F < 25);
145
- u.state = u.__s, u.getChildContext != null && (n = I(I({}, n), u.getChildContext())), p && !h && u.getSnapshotBeforeUpdate != null && (g = u.getSnapshotBeforeUpdate(d, f)), N = _, _ != null && _.type === j && _.key == null && (N = nt(_.props.children)), l = et(e, X(N) ? N : [N], t, o, n, i, r, s, l, a, c), u.base = t.__e, t.__u &= -161, u.__h.length && s.push(u), v && (u.__E = u.__ = null);
146
- } catch (U) {
147
- if (t.__v = null, a || r != null) if (U.then) {
148
- for (t.__u |= a ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
149
- r[r.indexOf(l)] = null, t.__e = l;
150
- } else for (S = r.length; S--; ) he(r[S]);
151
- else t.__e = o.__e, t.__k = o.__k;
152
- y.__e(U, t, o);
138
+ u.__d = !1, P && P(e), d = u.render(u.props, u.state, u.context), u.state = u.__s;
139
+ while (u.__d && ++N < 25);
140
+ u.state = u.__s, u.getChildContext != null && (n = E(E({}, n), u.getChildContext())), C && !_ && u.getSnapshotBeforeUpdate != null && (g = u.getSnapshotBeforeUpdate(h, v)), M = d, d != null && d.type === ee && d.key == null && (M = Be(d.props.children)), l = Ge(t, Q(M) ? M : [M], e, o, n, i, r, s, l, c, a), u.base = e.__e, e.__u &= -161, u.__h.length && s.push(u), p && (u.__E = u.__ = null);
141
+ } catch (R) {
142
+ if (e.__v = null, c || r != null) if (R.then) {
143
+ for (e.__u |= c ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
144
+ r[r.indexOf(l)] = null, e.__e = l;
145
+ } else for (j = r.length; j--; ) ce(r[j]);
146
+ else e.__e = o.__e, e.__k = o.__k;
147
+ w.__e(R, e, o);
153
148
  }
154
- else r == null && t.__v == o.__v ? (t.__k = o.__k, t.__e = o.__e) : l = t.__e = At(o.__e, t, o, n, i, r, s, a, c);
155
- return (_ = y.diffed) && _(t), 128 & t.__u ? void 0 : l;
149
+ else r == null && e.__v == o.__v ? (e.__k = o.__k, e.__e = o.__e) : l = e.__e = mt(o.__e, e, o, n, i, r, s, c, a);
150
+ return (d = w.diffed) && d(e), 128 & e.__u ? void 0 : l;
156
151
  }
157
- function ot(e, t, o) {
158
- for (var n = 0; n < o.length; n++) me(o[n], o[++n], o[++n]);
159
- y.__c && y.__c(t, e), e.some(function(i) {
152
+ function We(t, e, o) {
153
+ for (var n = 0; n < o.length; n++) de(o[n], o[++n], o[++n]);
154
+ w.__c && w.__c(e, t), t.some(function(i) {
160
155
  try {
161
- e = i.__h, i.__h = [], e.some(function(r) {
156
+ t = i.__h, i.__h = [], t.some(function(r) {
162
157
  r.call(i);
163
158
  });
164
159
  } catch (r) {
165
- y.__e(r, i.__v);
160
+ w.__e(r, i.__v);
166
161
  }
167
162
  });
168
163
  }
169
- function nt(e) {
170
- return typeof e != "object" || e == null || e.__b && e.__b > 0 ? e : X(e) ? e.map(nt) : I({}, e);
164
+ function Be(t) {
165
+ return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : Q(t) ? t.map(Be) : E({}, t);
171
166
  }
172
- function At(e, t, o, n, i, r, s, l, a) {
173
- var c, _, u, h, d, f, g, v = o.props, C = t.props, p = t.type;
174
- if (p == "svg" ? i = "http://www.w3.org/2000/svg" : p == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), r != null) {
175
- for (c = 0; c < r.length; c++) if ((d = r[c]) && "setAttribute" in d == !!p && (p ? d.localName == p : d.nodeType == 3)) {
176
- e = d, r[c] = null;
167
+ function mt(t, e, o, n, i, r, s, l, c) {
168
+ var a, d, u, _, h, v, g, p = o.props, f = e.props, C = e.type;
169
+ if (C == "svg" ? i = "http://www.w3.org/2000/svg" : C == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), r != null) {
170
+ for (a = 0; a < r.length; a++) if ((h = r[a]) && "setAttribute" in h == !!C && (C ? h.localName == C : h.nodeType == 3)) {
171
+ t = h, r[a] = null;
177
172
  break;
178
173
  }
179
174
  }
180
- if (e == null) {
181
- if (p == null) return document.createTextNode(C);
182
- e = document.createElementNS(i, p, C.is && C), l && (y.__m && y.__m(t, r), l = !1), r = null;
175
+ if (t == null) {
176
+ if (C == null) return document.createTextNode(f);
177
+ t = document.createElementNS(i, C, f.is && f), l && (w.__m && w.__m(e, r), l = !1), r = null;
183
178
  }
184
- if (p == null) v === C || l && e.data == C || (e.data = C);
179
+ if (C == null) p === f || l && t.data == f || (t.data = f);
185
180
  else {
186
- if (r = r && ne.call(e.childNodes), v = o.props || B, !l && r != null) for (v = {}, c = 0; c < e.attributes.length; c++) v[(d = e.attributes[c]).name] = d.value;
187
- for (c in v) if (d = v[c], c != "children") {
188
- if (c == "dangerouslySetInnerHTML") u = d;
189
- else if (!(c in C)) {
190
- if (c == "value" && "defaultValue" in C || c == "checked" && "defaultChecked" in C) continue;
191
- J(e, c, null, d, i);
181
+ if (r = r && Z.call(t.childNodes), p = o.props || G, !l && r != null) for (p = {}, a = 0; a < t.attributes.length; a++) p[(h = t.attributes[a]).name] = h.value;
182
+ for (a in p) if (h = p[a], a != "children") {
183
+ if (a == "dangerouslySetInnerHTML") u = h;
184
+ else if (!(a in f)) {
185
+ if (a == "value" && "defaultValue" in f || a == "checked" && "defaultChecked" in f) continue;
186
+ q(t, a, null, h, i);
192
187
  }
193
188
  }
194
- for (c in C) d = C[c], c == "children" ? h = d : c == "dangerouslySetInnerHTML" ? _ = d : c == "value" ? f = d : c == "checked" ? g = d : l && typeof d != "function" || v[c] === d || J(e, c, d, v[c], i);
195
- if (_) l || u && (_.__html == u.__html || _.__html == e.innerHTML) || (e.innerHTML = _.__html), t.__k = [];
196
- else if (u && (e.innerHTML = ""), et(t.type == "template" ? e.content : e, X(h) ? h : [h], t, o, n, p == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, s, r ? r[0] : o.__k && H(o, 0), l, a), r != null) for (c = r.length; c--; ) he(r[c]);
197
- l || (c = "value", p == "progress" && f == null ? e.removeAttribute("value") : f != null && (f !== e[c] || p == "progress" && !f || p == "option" && f != v[c]) && J(e, c, f, v[c], i), c = "checked", g != null && g != e[c] && J(e, c, g, v[c], i));
189
+ for (a in f) h = f[a], a == "children" ? _ = h : a == "dangerouslySetInnerHTML" ? d = h : a == "value" ? v = h : a == "checked" ? g = h : l && typeof h != "function" || p[a] === h || q(t, a, h, p[a], i);
190
+ if (d) l || u && (d.__html == u.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
191
+ else if (u && (t.innerHTML = ""), Ge(e.type == "template" ? t.content : t, Q(_) ? _ : [_], e, o, n, C == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, s, r ? r[0] : o.__k && D(o, 0), l, c), r != null) for (a = r.length; a--; ) ce(r[a]);
192
+ l || (a = "value", C == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[a] || C == "progress" && !v || C == "option" && v != p[a]) && q(t, a, v, p[a], i), a = "checked", g != null && g != t[a] && q(t, a, g, p[a], i));
198
193
  }
199
- return e;
194
+ return t;
200
195
  }
201
- function me(e, t, o) {
196
+ function de(t, e, o) {
202
197
  try {
203
- if (typeof e == "function") {
204
- var n = typeof e.__u == "function";
205
- n && e.__u(), n && t == null || (e.__u = e(t));
206
- } else e.current = t;
198
+ if (typeof t == "function") {
199
+ var n = typeof t.__u == "function";
200
+ n && t.__u(), n && e == null || (t.__u = t(e));
201
+ } else t.current = e;
207
202
  } catch (i) {
208
- y.__e(i, o);
203
+ w.__e(i, o);
209
204
  }
210
205
  }
211
- function it(e, t, o) {
206
+ function qe(t, e, o) {
212
207
  var n, i;
213
- if (y.unmount && y.unmount(e), (n = e.ref) && (n.current && n.current != e.__e || me(n, null, t)), (n = e.__c) != null) {
208
+ if (w.unmount && w.unmount(t), (n = t.ref) && (n.current && n.current != t.__e || de(n, null, e)), (n = t.__c) != null) {
214
209
  if (n.componentWillUnmount) try {
215
210
  n.componentWillUnmount();
216
211
  } catch (r) {
217
- y.__e(r, t);
212
+ w.__e(r, e);
218
213
  }
219
214
  n.base = n.__P = null;
220
215
  }
221
- if (n = e.__k) for (i = 0; i < n.length; i++) n[i] && it(n[i], t, o || typeof e.type != "function");
222
- o || he(e.__e), e.__c = e.__ = e.__e = void 0;
216
+ if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && qe(n[i], e, o || typeof t.type != "function");
217
+ o || ce(t.__e), t.__c = t.__ = t.__e = void 0;
223
218
  }
224
- function Et(e, t, o) {
225
- return this.constructor(e, o);
219
+ function vt(t, e, o) {
220
+ return this.constructor(t, o);
226
221
  }
227
- function Mt(e, t, o) {
222
+ function gt(t, e, o) {
228
223
  var n, i, r, s;
229
- t == document && (t = document.documentElement), y.__ && y.__(e, t), i = (n = !1) ? null : t.__k, r = [], s = [], fe(t, e = t.__k = W(j, null, [e]), i || B, B, t.namespaceURI, i ? null : t.firstChild ? ne.call(t.childNodes) : null, r, i ? i.__e : t.firstChild, n, s), ot(r, e, s);
224
+ e == document && (e = document.documentElement), w.__ && w.__(t, e), i = (n = !1) ? null : e.__k, r = [], s = [], ue(e, t = e.__k = ht(ee, null, [t]), i || G, G, e.namespaceURI, i ? null : e.firstChild ? Z.call(e.childNodes) : null, r, i ? i.__e : e.firstChild, n, s), We(r, t, s);
230
225
  }
231
- function rt(e) {
232
- function t(o) {
226
+ function Ve(t) {
227
+ function e(o) {
233
228
  var n, i;
234
- return this.getChildContext || (n = /* @__PURE__ */ new Set(), (i = {})[t.__c] = this, this.getChildContext = function() {
229
+ return this.getChildContext || (n = /* @__PURE__ */ new Set(), (i = {})[e.__c] = this, this.getChildContext = function() {
235
230
  return i;
236
231
  }, this.componentWillUnmount = function() {
237
232
  n = null;
238
233
  }, this.shouldComponentUpdate = function(r) {
239
234
  this.props.value != r.value && n.forEach(function(s) {
240
- s.__e = !0, ue(s);
235
+ s.__e = !0, se(s);
241
236
  });
242
237
  }, this.sub = function(r) {
243
238
  n.add(r);
@@ -247,187 +242,187 @@ function rt(e) {
247
242
  };
248
243
  }), o.children;
249
244
  }
250
- return t.__c = "__cC" + Ke++, t.__ = e, t.Provider = t.__l = (t.Consumer = function(o, n) {
245
+ return e.__c = "__cC" + De++, e.__ = t, e.Provider = e.__l = (e.Consumer = function(o, n) {
251
246
  return o.children(n);
252
- }).contextType = t, t;
247
+ }).contextType = e, e;
253
248
  }
254
- ne = Ze.slice, y = { __e: function(e, t, o, n) {
255
- for (var i, r, s; t = t.__; ) if ((i = t.__c) && !i.__) try {
256
- if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(e)), s = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, n || {}), s = i.__d), s) return i.__E = i;
249
+ Z = Oe.slice, w = { __e: function(t, e, o, n) {
250
+ for (var i, r, s; e = e.__; ) if ((i = e.__c) && !i.__) try {
251
+ if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(t)), s = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), s = i.__d), s) return i.__E = i;
257
252
  } catch (l) {
258
- e = l;
253
+ t = l;
259
254
  }
260
- throw e;
261
- } }, qe = 0, $.prototype.setState = function(e, t) {
255
+ throw t;
256
+ } }, Re = 0, X.prototype.setState = function(t, e) {
262
257
  var o;
263
- o = this.__s != null && this.__s != this.state ? this.__s : this.__s = I({}, this.state), typeof e == "function" && (e = e(I({}, o), this.props)), e && I(o, e), e != null && this.__v && (t && this._sb.push(t), ue(this));
264
- }, $.prototype.forceUpdate = function(e) {
265
- this.__v && (this.__e = !0, e && this.__h.push(e), ue(this));
266
- }, $.prototype.render = j, O = [], Xe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ye = function(e, t) {
267
- return e.__v.__b - t.__v.__b;
268
- }, te.__r = 0, Je = /(PointerCapture)$|Capture$/i, de = 0, ae = ke(!1), ce = ke(!0), Ke = 0;
269
- var It = 0;
270
- function m(e, t, o, n, i, r) {
271
- t || (t = {});
272
- var s, l, a = t;
273
- if ("ref" in a) for (l in a = {}, t) l == "ref" ? s = t[l] : a[l] = t[l];
274
- var c = { type: e, props: a, key: o, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --It, __i: -1, __u: 0, __source: i, __self: r };
275
- if (typeof e == "function" && (s = e.defaultProps)) for (l in s) a[l] === void 0 && (a[l] = s[l]);
276
- return y.vnode && y.vnode(c), c;
277
- }
278
- var G, w, re, Te, V = 0, st = [], b = y, ze = b.__b, Pe = b.__r, Ne = b.diffed, Se = b.__c, Le = b.unmount, xe = b.__;
279
- function ie(e, t) {
280
- b.__h && b.__h(w, e, V || t), V = 0;
281
- var o = w.__H || (w.__H = { __: [], __h: [] });
282
- return e >= o.__.length && o.__.push({}), o.__[e];
283
- }
284
- function R(e) {
285
- return V = 1, Rt(ct, e);
286
- }
287
- function Rt(e, t, o) {
288
- var n = ie(G++, 2);
289
- if (n.t = e, !n.__c && (n.__ = [o ? o(t) : ct(void 0, t), function(l) {
290
- var a = n.__N ? n.__N[0] : n.__[0], c = n.t(a, l);
291
- a !== c && (n.__N = [c, n.__[1]], n.__c.setState({}));
292
- }], n.__c = w, !w.__f)) {
293
- var i = function(l, a, c) {
258
+ o = this.__s != null && this.__s != this.state ? this.__s : this.__s = E({}, this.state), typeof t == "function" && (t = t(E({}, o), this.props)), t && E(o, t), t != null && this.__v && (e && this._sb.push(e), se(this));
259
+ }, X.prototype.forceUpdate = function(t) {
260
+ this.__v && (this.__e = !0, t && this.__h.push(t), se(this));
261
+ }, X.prototype.render = ee, F = [], Fe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, $e = function(t, e) {
262
+ return t.__v.__b - e.__v.__b;
263
+ }, K.__r = 0, Ue = /(PointerCapture)$|Capture$/i, ae = 0, ie = we(!1), re = we(!0), De = 0;
264
+ var pt = 0;
265
+ function m(t, e, o, n, i, r) {
266
+ e || (e = {});
267
+ var s, l, c = e;
268
+ if ("ref" in c) for (l in c = {}, e) l == "ref" ? s = e[l] : c[l] = e[l];
269
+ var a = { type: t, props: c, key: o, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --pt, __i: -1, __u: 0, __source: i, __self: r };
270
+ if (typeof t == "function" && (s = t.defaultProps)) for (l in s) c[l] === void 0 && (c[l] = s[l]);
271
+ return w.vnode && w.vnode(a), a;
272
+ }
273
+ var O, y, oe, ye, H = 0, Xe = [], k = w, be = k.__b, ke = k.__r, Te = k.diffed, ze = k.__c, Pe = k.unmount, Le = k.__;
274
+ function te(t, e) {
275
+ k.__h && k.__h(y, t, H || e), H = 0;
276
+ var o = y.__H || (y.__H = { __: [], __h: [] });
277
+ return t >= o.__.length && o.__.push({}), o.__[t];
278
+ }
279
+ function I(t) {
280
+ return H = 1, Ct(Ke, t);
281
+ }
282
+ function Ct(t, e, o) {
283
+ var n = te(O++, 2);
284
+ if (n.t = t, !n.__c && (n.__ = [Ke(void 0, e), function(l) {
285
+ var c = n.__N ? n.__N[0] : n.__[0], a = n.t(c, l);
286
+ c !== a && (n.__N = [a, n.__[1]], n.__c.setState({}));
287
+ }], n.__c = y, !y.__f)) {
288
+ var i = function(l, c, a) {
294
289
  if (!n.__c.__H) return !0;
295
- var _ = n.__c.__H.__.filter(function(h) {
296
- return !!h.__c;
290
+ var d = n.__c.__H.__.filter(function(_) {
291
+ return !!_.__c;
297
292
  });
298
- if (_.every(function(h) {
299
- return !h.__N;
300
- })) return !r || r.call(this, l, a, c);
293
+ if (d.every(function(_) {
294
+ return !_.__N;
295
+ })) return !r || r.call(this, l, c, a);
301
296
  var u = n.__c.props !== l;
302
- return _.forEach(function(h) {
303
- if (h.__N) {
304
- var d = h.__[0];
305
- h.__ = h.__N, h.__N = void 0, d !== h.__[0] && (u = !0);
297
+ return d.forEach(function(_) {
298
+ if (_.__N) {
299
+ var h = _.__[0];
300
+ _.__ = _.__N, _.__N = void 0, h !== _.__[0] && (u = !0);
306
301
  }
307
- }), r && r.call(this, l, a, c) || u;
302
+ }), r && r.call(this, l, c, a) || u;
308
303
  };
309
- w.__f = !0;
310
- var r = w.shouldComponentUpdate, s = w.componentWillUpdate;
311
- w.componentWillUpdate = function(l, a, c) {
304
+ y.__f = !0;
305
+ var r = y.shouldComponentUpdate, s = y.componentWillUpdate;
306
+ y.componentWillUpdate = function(l, c, a) {
312
307
  if (this.__e) {
313
- var _ = r;
314
- r = void 0, i(l, a, c), r = _;
308
+ var d = r;
309
+ r = void 0, i(l, c, a), r = d;
315
310
  }
316
- s && s.call(this, l, a, c);
317
- }, w.shouldComponentUpdate = i;
311
+ s && s.call(this, l, c, a);
312
+ }, y.shouldComponentUpdate = i;
318
313
  }
319
314
  return n.__N || n.__;
320
315
  }
321
- function A(e, t) {
322
- var o = ie(G++, 3);
323
- !b.__s && at(o.__H, t) && (o.__ = e, o.u = t, w.__H.__h.push(o));
316
+ function S(t, e) {
317
+ var o = te(O++, 3);
318
+ !k.__s && Je(o.__H, e) && (o.__ = t, o.u = e, y.__H.__h.push(o));
324
319
  }
325
- function D(e) {
326
- return V = 5, pe(function() {
327
- return { current: e };
320
+ function U(t) {
321
+ return H = 5, he(function() {
322
+ return { current: t };
328
323
  }, []);
329
324
  }
330
- function pe(e, t) {
331
- var o = ie(G++, 7);
332
- return at(o.__H, t) && (o.__ = e(), o.__H = t, o.__h = e), o.__;
325
+ function he(t, e) {
326
+ var o = te(O++, 7);
327
+ return Je(o.__H, e) && (o.__ = t(), o.__H = e, o.__h = t), o.__;
333
328
  }
334
- function Ae(e, t) {
335
- return V = 8, pe(function() {
336
- return e;
337
- }, t);
329
+ function Se(t, e) {
330
+ return H = 8, he(function() {
331
+ return t;
332
+ }, e);
338
333
  }
339
- function lt(e) {
340
- var t = w.context[e.__c], o = ie(G++, 9);
341
- return o.c = e, t ? (o.__ == null && (o.__ = !0, t.sub(w)), t.props.value) : e.__;
334
+ function Ye(t) {
335
+ var e = y.context[t.__c], o = te(O++, 9);
336
+ return o.c = t, e ? (o.__ == null && (o.__ = !0, e.sub(y)), e.props.value) : t.__;
342
337
  }
343
- function $t() {
344
- for (var e; e = st.shift(); ) if (e.__P && e.__H) try {
345
- e.__H.__h.forEach(Q), e.__H.__h.forEach(_e), e.__H.__h = [];
346
- } catch (t) {
347
- e.__H.__h = [], b.__e(t, e.__v);
338
+ function wt() {
339
+ for (var t; t = Xe.shift(); ) if (t.__P && t.__H) try {
340
+ t.__H.__h.forEach(Y), t.__H.__h.forEach(le), t.__H.__h = [];
341
+ } catch (e) {
342
+ t.__H.__h = [], k.__e(e, t.__v);
348
343
  }
349
344
  }
350
- b.__b = function(e) {
351
- w = null, ze && ze(e);
352
- }, b.__ = function(e, t) {
353
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), xe && xe(e, t);
354
- }, b.__r = function(e) {
355
- Pe && Pe(e), G = 0;
356
- var t = (w = e.__c).__H;
357
- t && (re === w ? (t.__h = [], w.__h = [], t.__.forEach(function(o) {
345
+ k.__b = function(t) {
346
+ y = null, be && be(t);
347
+ }, k.__ = function(t, e) {
348
+ t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Le && Le(t, e);
349
+ }, k.__r = function(t) {
350
+ ke && ke(t), O = 0;
351
+ var e = (y = t.__c).__H;
352
+ e && (oe === y ? (e.__h = [], y.__h = [], e.__.forEach(function(o) {
358
353
  o.__N && (o.__ = o.__N), o.u = o.__N = void 0;
359
- })) : (t.__h.forEach(Q), t.__h.forEach(_e), t.__h = [], G = 0)), re = w;
360
- }, b.diffed = function(e) {
361
- Ne && Ne(e);
362
- var t = e.__c;
363
- t && t.__H && (t.__H.__h.length && (st.push(t) !== 1 && Te === b.requestAnimationFrame || ((Te = b.requestAnimationFrame) || Ft)($t)), t.__H.__.forEach(function(o) {
354
+ })) : (e.__h.forEach(Y), e.__h.forEach(le), e.__h = [], O = 0)), oe = y;
355
+ }, k.diffed = function(t) {
356
+ Te && Te(t);
357
+ var e = t.__c;
358
+ e && e.__H && (e.__H.__h.length && (Xe.push(e) !== 1 && ye === k.requestAnimationFrame || ((ye = k.requestAnimationFrame) || yt)(wt)), e.__H.__.forEach(function(o) {
364
359
  o.u && (o.__H = o.u), o.u = void 0;
365
- })), re = w = null;
366
- }, b.__c = function(e, t) {
367
- t.some(function(o) {
360
+ })), oe = y = null;
361
+ }, k.__c = function(t, e) {
362
+ e.some(function(o) {
368
363
  try {
369
- o.__h.forEach(Q), o.__h = o.__h.filter(function(n) {
370
- return !n.__ || _e(n);
364
+ o.__h.forEach(Y), o.__h = o.__h.filter(function(n) {
365
+ return !n.__ || le(n);
371
366
  });
372
367
  } catch (n) {
373
- t.some(function(i) {
368
+ e.some(function(i) {
374
369
  i.__h && (i.__h = []);
375
- }), t = [], b.__e(n, o.__v);
370
+ }), e = [], k.__e(n, o.__v);
376
371
  }
377
- }), Se && Se(e, t);
378
- }, b.unmount = function(e) {
379
- Le && Le(e);
380
- var t, o = e.__c;
372
+ }), ze && ze(t, e);
373
+ }, k.unmount = function(t) {
374
+ Pe && Pe(t);
375
+ var e, o = t.__c;
381
376
  o && o.__H && (o.__H.__.forEach(function(n) {
382
377
  try {
383
- Q(n);
378
+ Y(n);
384
379
  } catch (i) {
385
- t = i;
380
+ e = i;
386
381
  }
387
- }), o.__H = void 0, t && b.__e(t, o.__v));
382
+ }), o.__H = void 0, e && k.__e(e, o.__v));
388
383
  };
389
- var Ee = typeof requestAnimationFrame == "function";
390
- function Ft(e) {
391
- var t, o = function() {
392
- clearTimeout(n), Ee && cancelAnimationFrame(t), setTimeout(e);
384
+ var Ne = typeof requestAnimationFrame == "function";
385
+ function yt(t) {
386
+ var e, o = function() {
387
+ clearTimeout(n), Ne && cancelAnimationFrame(e), setTimeout(t);
393
388
  }, n = setTimeout(o, 100);
394
- Ee && (t = requestAnimationFrame(o));
389
+ Ne && (e = requestAnimationFrame(o));
395
390
  }
396
- function Q(e) {
397
- var t = w, o = e.__c;
398
- typeof o == "function" && (e.__c = void 0, o()), w = t;
391
+ function Y(t) {
392
+ var e = y, o = t.__c;
393
+ typeof o == "function" && (t.__c = void 0, o()), y = e;
399
394
  }
400
- function _e(e) {
401
- var t = w;
402
- e.__c = e.__(), w = t;
395
+ function le(t) {
396
+ var e = y;
397
+ t.__c = t.__(), y = e;
403
398
  }
404
- function at(e, t) {
405
- return !e || e.length !== t.length || t.some(function(o, n) {
406
- return o !== e[n];
399
+ function Je(t, e) {
400
+ return !t || t.length !== e.length || e.some(function(o, n) {
401
+ return o !== t[n];
407
402
  });
408
403
  }
409
- function ct(e, t) {
410
- return typeof t == "function" ? t(e) : t;
404
+ function Ke(t, e) {
405
+ return typeof e == "function" ? e(t) : e;
411
406
  }
412
- const Ut = (e) => ({
413
- saveGameData(t) {
407
+ const bt = (t) => ({
408
+ saveGameData(e) {
414
409
  try {
415
410
  const o = {
416
- highestUnlockedLevel: t.highestUnlockedLevel,
417
- levelScores: t.levelScores,
418
- totalScore: t.totalScore,
419
- currentLevel: t.currentLevel
411
+ highestUnlockedLevel: e.highestUnlockedLevel,
412
+ levelScores: e.levelScores,
413
+ totalScore: e.totalScore,
414
+ currentLevel: e.currentLevel
420
415
  };
421
- localStorage.setItem(e, JSON.stringify(o));
416
+ localStorage.setItem(t, JSON.stringify(o));
422
417
  } catch (o) {
423
418
  console.error("Failed to save maze game data:", o);
424
419
  }
425
420
  },
426
421
  loadGameData() {
427
422
  try {
428
- const t = localStorage.getItem(e);
429
- if (!t) return null;
430
- const o = JSON.parse(t);
423
+ const e = localStorage.getItem(t);
424
+ if (!e) return null;
425
+ const o = JSON.parse(e);
431
426
  return {
432
427
  highestUnlockedLevel: o.highestUnlockedLevel,
433
428
  levelScores: o.levelScores,
@@ -436,19 +431,19 @@ const Ut = (e) => ({
436
431
  currentTier: Math.ceil(o.currentLevel / 12),
437
432
  highestUnlockedTier: Math.ceil(o.highestUnlockedLevel / 12)
438
433
  };
439
- } catch (t) {
440
- return console.error("Failed to load maze game data:", t), null;
434
+ } catch (e) {
435
+ return console.error("Failed to load maze game data:", e), null;
441
436
  }
442
437
  },
443
438
  resetGameData() {
444
439
  try {
445
- localStorage.removeItem(e);
446
- } catch (t) {
447
- console.error("Failed to reset game state:", t);
440
+ localStorage.removeItem(t);
441
+ } catch (e) {
442
+ console.error("Failed to reset game state:", e);
448
443
  }
449
444
  }
450
- }), ut = rt(void 0), Ot = ({ children: e, config: t }) => {
451
- const o = D(t), n = Ut(t.lcPrefix + "score"), i = n.loadGameData(), [r, s] = R({
445
+ }), Ze = Ve(void 0), kt = ({ children: t, config: e }) => {
446
+ const o = U(e), n = bt(e.lcPrefix + "score"), i = n.loadGameData(), [r, s] = I({
452
447
  currentLevel: 1,
453
448
  highestUnlockedLevel: 1,
454
449
  currentTier: 1,
@@ -471,7 +466,7 @@ const Ut = (e) => ({
471
466
  showClue: !1,
472
467
  ...i || {}
473
468
  });
474
- A(() => {
469
+ S(() => {
475
470
  n.saveGameData(r);
476
471
  }, [
477
472
  r.highestUnlockedLevel,
@@ -480,8 +475,8 @@ const Ut = (e) => ({
480
475
  r.currentLevel
481
476
  ]);
482
477
  const l = () => {
483
- n.resetGameData(), s((a) => ({
484
- ...a,
478
+ n.resetGameData(), s((c) => ({
479
+ ...c,
485
480
  currentLevel: 1,
486
481
  highestUnlockedLevel: 1,
487
482
  currentTier: 1,
@@ -499,7 +494,7 @@ const Ut = (e) => ({
499
494
  }));
500
495
  };
501
496
  return /* @__PURE__ */ m(
502
- ut.Provider,
497
+ Ze.Provider,
503
498
  {
504
499
  value: {
505
500
  gameState: r,
@@ -507,111 +502,111 @@ const Ut = (e) => ({
507
502
  config: o,
508
503
  resetGame: l
509
504
  },
510
- children: e
505
+ children: t
511
506
  }
512
507
  );
513
- }, _t = () => {
514
- const e = lt(ut);
515
- if (!e)
508
+ }, _e = () => {
509
+ const t = Ye(Ze);
510
+ if (!t)
516
511
  throw new Error("useGameContext must be used within a GameProvider");
517
- return e;
512
+ return t;
518
513
  };
519
- function ve(e, t) {
520
- if (!(e instanceof t))
514
+ function fe(t, e) {
515
+ if (!(t instanceof e))
521
516
  throw new TypeError("Cannot call a class as a function");
522
517
  }
523
- function Dt(e, t) {
524
- for (var o = 0; o < t.length; o++) {
525
- var n = t[o];
526
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
518
+ function Tt(t, e) {
519
+ for (var o = 0; o < e.length; o++) {
520
+ var n = e[o];
521
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);
527
522
  }
528
523
  }
529
- function ge(e, t, o) {
530
- return t && Dt(e.prototype, t), e;
524
+ function me(t, e, o) {
525
+ return e && Tt(t.prototype, e), t;
531
526
  }
532
- function Me(e) {
533
- return +e.replace(/px/, "");
527
+ function xe(t) {
528
+ return +t.replace(/px/, "");
534
529
  }
535
- function Wt(e) {
536
- var t = window.devicePixelRatio, o = getComputedStyle(e), n = Me(o.getPropertyValue("width")), i = Me(o.getPropertyValue("height"));
537
- e.setAttribute("width", (n * t).toString()), e.setAttribute("height", (i * t).toString());
530
+ function zt(t) {
531
+ var e = window.devicePixelRatio, o = getComputedStyle(t), n = xe(o.getPropertyValue("width")), i = xe(o.getPropertyValue("height"));
532
+ t.setAttribute("width", (n * e).toString()), t.setAttribute("height", (i * e).toString());
538
533
  }
539
- function x(e, t) {
540
- var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, n = Math.random() * (t - e) + e;
534
+ function L(t, e) {
535
+ var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, n = Math.random() * (e - t) + t;
541
536
  return Math.floor(n * Math.pow(10, o)) / Math.pow(10, o);
542
537
  }
543
- function Ie(e) {
544
- return e[x(0, e.length)];
538
+ function Ae(t) {
539
+ return t[L(0, t.length)];
545
540
  }
546
- var jt = 125e-5, Ht = 5e-4, Gt = 9e-4, Bt = 1e-5, Vt = 6, qt = 80, Xt = 0.9, Yt = 1.7, Jt = 0.2, Kt = 0.6, Zt = 0.03, Qt = 0.07, eo = 15, to = 82, oo = 100, no = 250, io = 40, ro = ["#fcf403", "#62fc03", "#f4fc03", "#03e7fc", "#03fca5", "#a503fc", "#fc03ad", "#fc03c2"];
547
- function Re(e) {
548
- var t = 1920;
549
- return Math.log(e) / Math.log(t);
541
+ var Pt = 125e-5, Lt = 5e-4, St = 9e-4, Nt = 1e-5, xt = 6, At = 80, Et = 0.9, It = 1.7, Mt = 0.2, Rt = 0.6, Ft = 0.03, $t = 0.07, Ut = 15, Dt = 82, Ot = 100, jt = 250, Gt = 40, Ht = ["#fcf403", "#62fc03", "#f4fc03", "#03e7fc", "#03fca5", "#a503fc", "#fc03ad", "#fc03c2"];
542
+ function Ee(t) {
543
+ var e = 1920;
544
+ return Math.log(t) / Math.log(e);
550
545
  }
551
- var $e = /* @__PURE__ */ function() {
552
- function e(t) {
553
- ve(this, e);
554
- var o = t.initialPosition, n = t.direction, i = t.confettiRadius, r = t.confettiColors, s = t.emojis, l = t.emojiSize, a = t.canvasWidth, c = x(Xt, Yt, 3), _ = c * Re(a);
546
+ var Ie = /* @__PURE__ */ function() {
547
+ function t(e) {
548
+ fe(this, t);
549
+ var o = e.initialPosition, n = e.direction, i = e.confettiRadius, r = e.confettiColors, s = e.emojis, l = e.emojiSize, c = e.canvasWidth, a = L(Et, It, 3), d = a * Ee(c);
555
550
  this.confettiSpeed = {
556
- x: _,
557
- y: _
558
- }, this.finalConfettiSpeedX = x(Jt, Kt, 3), this.rotationSpeed = s.length ? 0.01 : x(Zt, Qt, 3) * Re(a), this.dragForceCoefficient = x(Ht, Gt, 6), this.radius = {
551
+ x: d,
552
+ y: d
553
+ }, this.finalConfettiSpeedX = L(Mt, Rt, 3), this.rotationSpeed = s.length ? 0.01 : L(Ft, $t, 3) * Ee(c), this.dragForceCoefficient = L(Lt, St, 6), this.radius = {
559
554
  x: i,
560
555
  y: i
561
- }, this.initialRadius = i, this.rotationAngle = n === "left" ? x(0, 0.2, 3) : x(-0.2, 0, 3), this.emojiSize = l, this.emojiRotationAngle = x(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
562
- var u = n === "left" ? x(to, eo) * Math.PI / 180 : x(-15, -82) * Math.PI / 180;
556
+ }, this.initialRadius = i, this.rotationAngle = n === "left" ? L(0, 0.2, 3) : L(-0.2, 0, 3), this.emojiSize = l, this.emojiRotationAngle = L(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
557
+ var u = n === "left" ? L(Dt, Ut) * Math.PI / 180 : L(-15, -82) * Math.PI / 180;
563
558
  this.absCos = Math.abs(Math.cos(u)), this.absSin = Math.abs(Math.sin(u));
564
- var h = x(-150, 0), d = {
565
- x: o.x + (n === "left" ? -h : h) * this.absCos,
566
- y: o.y - h * this.absSin
559
+ var _ = L(-150, 0), h = {
560
+ x: o.x + (n === "left" ? -_ : _) * this.absCos,
561
+ y: o.y - _ * this.absSin
567
562
  };
568
- this.currentPosition = Object.assign({}, d), this.initialPosition = Object.assign({}, d), this.color = s.length ? null : Ie(r), this.emoji = s.length ? Ie(s) : null, this.createdAt = (/* @__PURE__ */ new Date()).getTime(), this.direction = n;
563
+ this.currentPosition = Object.assign({}, h), this.initialPosition = Object.assign({}, h), this.color = s.length ? null : Ae(r), this.emoji = s.length ? Ae(s) : null, this.createdAt = (/* @__PURE__ */ new Date()).getTime(), this.direction = n;
569
564
  }
570
- return ge(e, [{
565
+ return me(t, [{
571
566
  key: "draw",
572
567
  value: function(o) {
573
- var n = this.currentPosition, i = this.radius, r = this.color, s = this.emoji, l = this.rotationAngle, a = this.emojiRotationAngle, c = this.emojiSize, _ = window.devicePixelRatio;
574
- r ? (o.fillStyle = r, o.beginPath(), o.ellipse(n.x * _, n.y * _, i.x * _, i.y * _, l, 0, 2 * Math.PI), o.fill()) : s && (o.font = "".concat(c, "px serif"), o.save(), o.translate(_ * n.x, _ * n.y), o.rotate(a), o.textAlign = "center", o.fillText(s, 0, 0), o.restore());
568
+ var n = this.currentPosition, i = this.radius, r = this.color, s = this.emoji, l = this.rotationAngle, c = this.emojiRotationAngle, a = this.emojiSize, d = window.devicePixelRatio;
569
+ r ? (o.fillStyle = r, o.beginPath(), o.ellipse(n.x * d, n.y * d, i.x * d, i.y * d, l, 0, 2 * Math.PI), o.fill()) : s && (o.font = "".concat(a, "px serif"), o.save(), o.translate(d * n.x, d * n.y), o.rotate(c), o.textAlign = "center", o.fillText(s, 0, 0), o.restore());
575
570
  }
576
571
  }, {
577
572
  key: "updatePosition",
578
573
  value: function(o, n) {
579
- var i = this.confettiSpeed, r = this.dragForceCoefficient, s = this.finalConfettiSpeedX, l = this.radiusYUpdateDirection, a = this.rotationSpeed, c = this.createdAt, _ = this.direction, u = n - c;
580
- if (i.x > s && (this.confettiSpeed.x -= r * o), this.currentPosition.x += i.x * (_ === "left" ? -this.absCos : this.absCos) * o, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + jt * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : Bt * o, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
574
+ var i = this.confettiSpeed, r = this.dragForceCoefficient, s = this.finalConfettiSpeedX, l = this.radiusYUpdateDirection, c = this.rotationSpeed, a = this.createdAt, d = this.direction, u = n - a;
575
+ if (i.x > s && (this.confettiSpeed.x -= r * o), this.currentPosition.x += i.x * (d === "left" ? -this.absCos : this.absCos) * o, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + Pt * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : Nt * o, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
581
576
  this.emojiRotationAngle += this.rotationSpeed * o % (2 * Math.PI);
582
577
  return;
583
578
  }
584
- l === "down" ? (this.radius.y -= o * a, this.radius.y <= 0 && (this.radius.y = 0, this.radiusYUpdateDirection = "up")) : (this.radius.y += o * a, this.radius.y >= this.initialRadius && (this.radius.y = this.initialRadius, this.radiusYUpdateDirection = "down"));
579
+ l === "down" ? (this.radius.y -= o * c, this.radius.y <= 0 && (this.radius.y = 0, this.radiusYUpdateDirection = "up")) : (this.radius.y += o * c, this.radius.y >= this.initialRadius && (this.radius.y = this.initialRadius, this.radiusYUpdateDirection = "down"));
585
580
  }
586
581
  }, {
587
582
  key: "getIsVisibleOnCanvas",
588
583
  value: function(o) {
589
- return this.currentPosition.y < o + oo;
584
+ return this.currentPosition.y < o + Ot;
590
585
  }
591
- }]), e;
586
+ }]), t;
592
587
  }();
593
- function so() {
594
- var e = document.createElement("canvas");
595
- return e.style.position = "fixed", e.style.width = "100%", e.style.height = "100%", e.style.top = "0", e.style.left = "0", e.style.zIndex = "1000", e.style.pointerEvents = "none", document.body.appendChild(e), e;
588
+ function Wt() {
589
+ var t = document.createElement("canvas");
590
+ return t.style.position = "fixed", t.style.width = "100%", t.style.height = "100%", t.style.top = "0", t.style.left = "0", t.style.zIndex = "1000", t.style.pointerEvents = "none", document.body.appendChild(t), t;
596
591
  }
597
- function lo(e) {
598
- var t = e.confettiRadius, o = t === void 0 ? Vt : t, n = e.confettiNumber, i = n === void 0 ? e.confettiesNumber || (e.emojis ? io : no) : n, r = e.confettiColors, s = r === void 0 ? ro : r, l = e.emojis, a = l === void 0 ? e.emojies || [] : l, c = e.emojiSize, _ = c === void 0 ? qt : c;
599
- return e.emojies && console.error("emojies argument is deprecated, please use emojis instead"), e.confettiesNumber && console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"), {
592
+ function Bt(t) {
593
+ var e = t.confettiRadius, o = e === void 0 ? xt : e, n = t.confettiNumber, i = n === void 0 ? t.confettiesNumber || (t.emojis ? Gt : jt) : n, r = t.confettiColors, s = r === void 0 ? Ht : r, l = t.emojis, c = l === void 0 ? t.emojies || [] : l, a = t.emojiSize, d = a === void 0 ? At : a;
594
+ return t.emojies && console.error("emojies argument is deprecated, please use emojis instead"), t.confettiesNumber && console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"), {
600
595
  confettiRadius: o,
601
596
  confettiNumber: i,
602
597
  confettiColors: s,
603
- emojis: a,
604
- emojiSize: _
598
+ emojis: c,
599
+ emojiSize: d
605
600
  };
606
601
  }
607
- var ao = /* @__PURE__ */ function() {
608
- function e(t) {
602
+ var qt = /* @__PURE__ */ function() {
603
+ function t(e) {
609
604
  var o = this;
610
- ve(this, e), this.canvasContext = t, this.shapes = [], this.promise = new Promise(function(n) {
605
+ fe(this, t), this.canvasContext = e, this.shapes = [], this.promise = new Promise(function(n) {
611
606
  return o.resolvePromise = n;
612
607
  });
613
608
  }
614
- return ge(e, [{
609
+ return me(t, [{
615
610
  key: "getBatchCompletePromise",
616
611
  value: function() {
617
612
  return this.promise;
@@ -632,20 +627,20 @@ var ao = /* @__PURE__ */ function() {
632
627
  key: "processShapes",
633
628
  value: function(o, n, i) {
634
629
  var r = this, s = o.timeDelta, l = o.currentTime;
635
- this.shapes = this.shapes.filter(function(a) {
636
- return a.updatePosition(s, l), a.draw(r.canvasContext), i ? a.getIsVisibleOnCanvas(n) : !0;
630
+ this.shapes = this.shapes.filter(function(c) {
631
+ return c.updatePosition(s, l), c.draw(r.canvasContext), i ? c.getIsVisibleOnCanvas(n) : !0;
637
632
  });
638
633
  }
639
- }]), e;
640
- }(), co = /* @__PURE__ */ function() {
641
- function e() {
642
- var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
643
- ve(this, e), this.activeConfettiBatches = [], this.canvas = t.canvas || so(), this.canvasContext = this.canvas.getContext("2d"), this.requestAnimationFrameRequested = !1, this.lastUpdated = (/* @__PURE__ */ new Date()).getTime(), this.iterationIndex = 0, this.loop = this.loop.bind(this), requestAnimationFrame(this.loop);
634
+ }]), t;
635
+ }(), Vt = /* @__PURE__ */ function() {
636
+ function t() {
637
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
638
+ fe(this, t), this.activeConfettiBatches = [], this.canvas = e.canvas || Wt(), this.canvasContext = this.canvas.getContext("2d"), this.requestAnimationFrameRequested = !1, this.lastUpdated = (/* @__PURE__ */ new Date()).getTime(), this.iterationIndex = 0, this.loop = this.loop.bind(this), requestAnimationFrame(this.loop);
644
639
  }
645
- return ge(e, [{
640
+ return me(t, [{
646
641
  key: "loop",
647
642
  value: function() {
648
- this.requestAnimationFrameRequested = !1, Wt(this.canvas);
643
+ this.requestAnimationFrameRequested = !1, zt(this.canvas);
649
644
  var o = (/* @__PURE__ */ new Date()).getTime(), n = o - this.lastUpdated, i = this.canvas.offsetHeight, r = this.iterationIndex % 10 === 0;
650
645
  this.activeConfettiBatches = this.activeConfettiBatches.filter(function(s) {
651
646
  return s.processShapes({
@@ -662,33 +657,33 @@ var ao = /* @__PURE__ */ function() {
662
657
  }, {
663
658
  key: "addConfetti",
664
659
  value: function() {
665
- for (var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = lo(o), i = n.confettiRadius, r = n.confettiNumber, s = n.confettiColors, l = n.emojis, a = n.emojiSize, c = this.canvas.getBoundingClientRect(), _ = c.width, u = c.height, h = u * 5 / 7, d = {
660
+ for (var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = Bt(o), i = n.confettiRadius, r = n.confettiNumber, s = n.confettiColors, l = n.emojis, c = n.emojiSize, a = this.canvas.getBoundingClientRect(), d = a.width, u = a.height, _ = u * 5 / 7, h = {
666
661
  x: 0,
667
- y: h
668
- }, f = {
669
- x: _,
670
- y: h
671
- }, g = new ao(this.canvasContext), v = 0; v < r / 2; v++) {
672
- var C = new $e({
673
- initialPosition: d,
662
+ y: _
663
+ }, v = {
664
+ x: d,
665
+ y: _
666
+ }, g = new qt(this.canvasContext), p = 0; p < r / 2; p++) {
667
+ var f = new Ie({
668
+ initialPosition: h,
674
669
  direction: "right",
675
670
  confettiRadius: i,
676
671
  confettiColors: s,
677
672
  confettiNumber: r,
678
673
  emojis: l,
679
- emojiSize: a,
680
- canvasWidth: _
681
- }), p = new $e({
682
- initialPosition: f,
674
+ emojiSize: c,
675
+ canvasWidth: d
676
+ }), C = new Ie({
677
+ initialPosition: v,
683
678
  direction: "left",
684
679
  confettiRadius: i,
685
680
  confettiColors: s,
686
681
  confettiNumber: r,
687
682
  emojis: l,
688
- emojiSize: a,
689
- canvasWidth: _
683
+ emojiSize: c,
684
+ canvasWidth: d
690
685
  });
691
- g.addShapes(C, p);
686
+ g.addShapes(f, C);
692
687
  }
693
688
  return this.activeConfettiBatches.push(g), this.queueAnimationFrameIfNeeded(), g.getBatchCompletePromise();
694
689
  }
@@ -702,299 +697,39 @@ var ao = /* @__PURE__ */ function() {
702
697
  value: function() {
703
698
  this.canvas.remove();
704
699
  }
705
- }]), e;
700
+ }]), t;
706
701
  }();
707
- function dt(e, t) {
708
- for (var o in t) e[o] = t[o];
709
- return e;
710
- }
711
- function Fe(e, t) {
712
- for (var o in e) if (o !== "__source" && !(o in t)) return !0;
713
- for (var n in t) if (n !== "__source" && e[n] !== t[n]) return !0;
714
- return !1;
715
- }
716
- function Ue(e, t) {
717
- this.props = e, this.context = t;
718
- }
719
- (Ue.prototype = new $()).isPureReactComponent = !0, Ue.prototype.shouldComponentUpdate = function(e, t) {
720
- return Fe(this.props, e) || Fe(this.state, t);
721
- };
722
- var Oe = y.__b;
723
- y.__b = function(e) {
724
- e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), Oe && Oe(e);
725
- };
726
- var uo = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
727
- function ht(e) {
728
- function t(o) {
729
- var n = dt({}, o);
730
- return delete n.ref, e(n, o.ref || null);
731
- }
732
- return t.$$typeof = uo, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
733
- }
734
- var _o = y.__e;
735
- y.__e = function(e, t, o, n) {
736
- if (e.then) {
737
- for (var i, r = t; r = r.__; ) if ((i = r.__c) && i.__c) return t.__e == null && (t.__e = o.__e, t.__k = o.__k), i.__c(e, t);
738
- }
739
- _o(e, t, o, n);
740
- };
741
- var De = y.unmount;
742
- function ft(e, t, o) {
743
- return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(n) {
744
- typeof n.__c == "function" && n.__c();
745
- }), e.__c.__H = null), (e = dt({}, e)).__c != null && (e.__c.__P === o && (e.__c.__P = t), e.__c.__e = !0, e.__c = null), e.__k = e.__k && e.__k.map(function(n) {
746
- return ft(n, t, o);
747
- })), e;
748
- }
749
- function mt(e, t, o) {
750
- return e && o && (e.__v = null, e.__k = e.__k && e.__k.map(function(n) {
751
- return mt(n, t, o);
752
- }), e.__c && e.__c.__P === t && (e.__e && o.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = o)), e;
753
- }
754
- function se() {
755
- this.__u = 0, this.o = null, this.__b = null;
756
- }
757
- function pt(e) {
758
- var t = e.__.__c;
759
- return t && t.__a && t.__a(e);
760
- }
761
- function K() {
762
- this.i = null, this.l = null;
763
- }
764
- y.unmount = function(e) {
765
- var t = e.__c;
766
- t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), De && De(e);
767
- }, (se.prototype = new $()).__c = function(e, t) {
768
- var o = t.__c, n = this;
769
- n.o == null && (n.o = []), n.o.push(o);
770
- var i = pt(n.__v), r = !1, s = function() {
771
- r || (r = !0, o.__R = null, i ? i(l) : l());
772
- };
773
- o.__R = s;
774
- var l = function() {
775
- if (!--n.__u) {
776
- if (n.state.__a) {
777
- var a = n.state.__a;
778
- n.__v.__k[0] = mt(a, a.__c.__P, a.__c.__O);
779
- }
780
- var c;
781
- for (n.setState({ __a: n.__b = null }); c = n.o.pop(); ) c.forceUpdate();
782
- }
783
- };
784
- n.__u++ || 32 & t.__u || n.setState({ __a: n.__b = n.__v.__k[0] }), e.then(s, s);
785
- }, se.prototype.componentWillUnmount = function() {
786
- this.o = [];
787
- }, se.prototype.render = function(e, t) {
788
- if (this.__b) {
789
- if (this.__v.__k) {
790
- var o = document.createElement("div"), n = this.__v.__k[0].__c;
791
- this.__v.__k[0] = ft(this.__b, o, n.__O = n.__P);
792
- }
793
- this.__b = null;
794
- }
795
- var i = t.__a && W(j, null, e.fallback);
796
- return i && (i.__u &= -33), [W(j, null, t.__a ? null : e.children), i];
797
- };
798
- var We = function(e, t, o) {
799
- if (++o[1] === o[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (o = e.i; o; ) {
800
- for (; o.length > 3; ) o.pop()();
801
- if (o[1] < o[0]) break;
802
- e.i = o = o[2];
803
- }
804
- };
805
- (K.prototype = new $()).__a = function(e) {
806
- var t = this, o = pt(t.__v), n = t.l.get(e);
807
- return n[0]++, function(i) {
808
- var r = function() {
809
- t.props.revealOrder ? (n.push(i), We(t, e, n)) : i();
810
- };
811
- o ? o(r) : r();
812
- };
813
- }, K.prototype.render = function(e) {
814
- this.i = null, this.l = /* @__PURE__ */ new Map();
815
- var t = oe(e.children);
816
- e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
817
- for (var o = t.length; o--; ) this.l.set(t[o], this.i = [1, 0, this.i]);
818
- return e.children;
819
- }, K.prototype.componentDidUpdate = K.prototype.componentDidMount = function() {
820
- var e = this;
821
- this.l.forEach(function(t, o) {
822
- We(e, o, t);
823
- });
824
- };
825
- var ho = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, fo = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, mo = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, po = /[A-Z0-9]/g, vo = typeof document < "u", go = function(e) {
826
- return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
827
- };
828
- $.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
829
- Object.defineProperty($.prototype, e, { configurable: !0, get: function() {
830
- return this["UNSAFE_" + e];
831
- }, set: function(t) {
832
- Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
833
- } });
834
- });
835
- var je = y.event;
836
- function Co() {
837
- }
838
- function yo() {
839
- return this.cancelBubble;
840
- }
841
- function wo() {
842
- return this.defaultPrevented;
843
- }
844
- y.event = function(e) {
845
- return je && (e = je(e)), e.persist = Co, e.isPropagationStopped = yo, e.isDefaultPrevented = wo, e.nativeEvent = e;
846
- };
847
- var bo = { enumerable: !1, configurable: !0, get: function() {
848
- return this.class;
849
- } }, He = y.vnode;
850
- y.vnode = function(e) {
851
- typeof e.type == "string" && function(t) {
852
- var o = t.props, n = t.type, i = {}, r = n.indexOf("-") === -1;
853
- for (var s in o) {
854
- var l = o[s];
855
- if (!(s === "value" && "defaultValue" in o && l == null || vo && s === "children" && n === "noscript" || s === "class" || s === "className")) {
856
- var a = s.toLowerCase();
857
- s === "defaultValue" && "value" in o && o.value == null ? s = "value" : s === "download" && l === !0 ? l = "" : a === "translate" && l === "no" ? l = !1 : a[0] === "o" && a[1] === "n" ? a === "ondoubleclick" ? s = "ondblclick" : a !== "onchange" || n !== "input" && n !== "textarea" || go(o.type) ? a === "onfocus" ? s = "onfocusin" : a === "onblur" ? s = "onfocusout" : mo.test(s) && (s = a) : a = s = "oninput" : r && fo.test(s) ? s = s.replace(po, "-$&").toLowerCase() : l === null && (l = void 0), a === "oninput" && i[s = a] && (s = "oninputCapture"), i[s] = l;
858
- }
859
- }
860
- n == "select" && i.multiple && Array.isArray(i.value) && (i.value = oe(o.children).forEach(function(c) {
861
- c.props.selected = i.value.indexOf(c.props.value) != -1;
862
- })), n == "select" && i.defaultValue != null && (i.value = oe(o.children).forEach(function(c) {
863
- c.props.selected = i.multiple ? i.defaultValue.indexOf(c.props.value) != -1 : i.defaultValue == c.props.value;
864
- })), o.class && !o.className ? (i.class = o.class, Object.defineProperty(i, "className", bo)) : (o.className && !o.class || o.class && o.className) && (i.class = i.className = o.className), t.props = i;
865
- }(e), e.$$typeof = ho, He && He(e);
866
- };
867
- var Ge = y.__r;
868
- y.__r = function(e) {
869
- Ge && Ge(e), e.__c;
870
- };
871
- var Be = y.diffed;
872
- y.diffed = function(e) {
873
- Be && Be(e);
874
- var t = e.props, o = e.__e;
875
- o != null && e.type === "textarea" && "value" in t && t.value !== o.value && (o.value = t.value == null ? "" : t.value);
876
- };
877
- /**
878
- * @license lucide-react v0.473.0 - ISC
879
- *
880
- * This source code is licensed under the ISC license.
881
- * See the LICENSE file in the root directory of this source tree.
882
- */
883
- const ko = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), vt = (...e) => e.filter((t, o, n) => !!t && t.trim() !== "" && n.indexOf(t) === o).join(" ").trim();
884
- /**
885
- * @license lucide-react v0.473.0 - ISC
886
- *
887
- * This source code is licensed under the ISC license.
888
- * See the LICENSE file in the root directory of this source tree.
889
- */
890
- var To = {
891
- xmlns: "http://www.w3.org/2000/svg",
892
- width: 24,
893
- height: 24,
894
- viewBox: "0 0 24 24",
895
- fill: "none",
896
- stroke: "currentColor",
897
- strokeWidth: 2,
898
- strokeLinecap: "round",
899
- strokeLinejoin: "round"
900
- };
901
- /**
902
- * @license lucide-react v0.473.0 - ISC
903
- *
904
- * This source code is licensed under the ISC license.
905
- * See the LICENSE file in the root directory of this source tree.
906
- */
907
- const zo = ht(
908
- ({
909
- color: e = "currentColor",
910
- size: t = 24,
911
- strokeWidth: o = 2,
912
- absoluteStrokeWidth: n,
913
- className: i = "",
914
- children: r,
915
- iconNode: s,
916
- ...l
917
- }, a) => W(
918
- "svg",
919
- {
920
- ref: a,
921
- ...To,
922
- width: t,
923
- height: t,
924
- stroke: e,
925
- strokeWidth: n ? Number(o) * 24 / Number(t) : o,
926
- className: vt("lucide", i),
927
- ...l
928
- },
929
- [
930
- ...s.map(([c, _]) => W(c, _)),
931
- ...Array.isArray(r) ? r : [r]
932
- ]
933
- )
934
- );
935
- /**
936
- * @license lucide-react v0.473.0 - ISC
937
- *
938
- * This source code is licensed under the ISC license.
939
- * See the LICENSE file in the root directory of this source tree.
940
- */
941
- const Po = (e, t) => {
942
- const o = ht(
943
- ({ className: n, ...i }, r) => W(zo, {
944
- ref: r,
945
- iconNode: t,
946
- className: vt(`lucide-${ko(e)}`, n),
947
- ...i
948
- })
949
- );
950
- return o.displayName = `${e}`, o;
951
- };
952
- /**
953
- * @license lucide-react v0.473.0 - ISC
954
- *
955
- * This source code is licensed under the ISC license.
956
- * See the LICENSE file in the root directory of this source tree.
957
- */
958
- const No = [
959
- [
960
- "path",
961
- {
962
- d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",
963
- key: "1qme2f"
964
- }
965
- ],
966
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
967
- ], So = Po("Settings", No), gt = rt(void 0), Lo = ({ children: e }) => {
968
- const [t, o] = R(null), [n, i] = R(!1), [r, s] = R(
702
+ const Qe = Ve(void 0), Xt = ({ children: t }) => {
703
+ const [e, o] = I(null), [n, i] = I(!1), [r, s] = I(
969
704
  "info"
970
- ), [l, a] = R(null), c = Ae(() => {
971
- i(!1), l && (clearTimeout(l), a(null));
972
- }, [l]), _ = Ae(
973
- (u, h = "info", d = 3e3) => {
974
- if (n && c(), o(u), s(h), i(!0), d > 0) {
975
- const f = setTimeout(() => {
705
+ ), [l, c] = I(null), a = Se(() => {
706
+ i(!1), l && (clearTimeout(l), c(null));
707
+ }, [l]), d = Se(
708
+ (u, _ = "info", h = 3e3) => {
709
+ if (n && a(), o(u), s(_), i(!0), h > 0) {
710
+ const v = setTimeout(() => {
976
711
  i(!1);
977
- }, d);
978
- a(f);
712
+ }, h);
713
+ c(v);
979
714
  }
980
715
  },
981
- [n, c]
716
+ [n, a]
982
717
  );
983
718
  return /* @__PURE__ */ m(
984
- gt.Provider,
719
+ Qe.Provider,
985
720
  {
986
- value: { message: t, visible: n, type: r, showToast: _, hideToast: c },
987
- children: e
721
+ value: { message: e, visible: n, type: r, showToast: d, hideToast: a },
722
+ children: t
988
723
  }
989
724
  );
990
- }, Ce = () => {
991
- const e = lt(gt);
992
- if (!e)
725
+ }, ve = () => {
726
+ const t = Ye(Qe);
727
+ if (!t)
993
728
  throw new Error("useToast must be used within a ToastProvider");
994
- return e;
995
- }, xo = ({
996
- i18n: e,
997
- totalTiers: t,
729
+ return t;
730
+ }, Yt = ({
731
+ i18n: t,
732
+ totalTiers: e,
998
733
  currentTier: o,
999
734
  highestUnlockedTier: n,
1000
735
  onTierChange: i,
@@ -1008,98 +743,96 @@ const No = [
1008
743
  },
1009
744
  disabled: r,
1010
745
  className: "tier-dropdown",
1011
- children: Array.from({ length: t }, (s, l) => l + 1).map((s) => /* @__PURE__ */ m(
746
+ children: Array.from({ length: e }, (s, l) => l + 1).map((s) => /* @__PURE__ */ m(
1012
747
  "option",
1013
748
  {
1014
749
  value: s,
1015
750
  disabled: s > n,
1016
- children: [
1017
- e.tier,
1018
- " ",
1019
- s
1020
- ]
751
+ children: t.tier + " " + s
1021
752
  },
1022
753
  `tier-${s}`
1023
754
  ))
1024
755
  }
1025
- ) }), Ao = ([e, t]) => Array.from({ length: t - e + 1 }, (o, n) => e + n), Eo = ({
1026
- i18n: e,
1027
- levelsRange: t,
756
+ ) }), Jt = ({
757
+ i18n: t,
758
+ levelsRange: e,
1028
759
  currentLevel: o,
1029
760
  highestUnlockedLevel: n,
1030
761
  onLevelChange: i,
1031
762
  disabled: r
1032
763
  }) => {
1033
- const s = Ao(t);
764
+ const { gameState: s } = _e(), c = (([a, d]) => Array.from({ length: d - a + 1 }, (u, _) => {
765
+ const h = a + _, v = s.levelScores[h] || 0;
766
+ return {
767
+ level: h,
768
+ score: v
769
+ };
770
+ }))(e);
1034
771
  return /* @__PURE__ */ m("div", { className: "level-selector", children: /* @__PURE__ */ m(
1035
772
  "select",
1036
773
  {
1037
774
  value: o,
1038
- onChange: (l) => {
1039
- l.target && l.target.value && i(Number(l.target.value));
775
+ onChange: (a) => {
776
+ a.target && a.target.value && i(Number(a.target.value));
1040
777
  },
1041
778
  disabled: r,
1042
779
  className: "level-dropdown",
1043
- children: s.map((l) => /* @__PURE__ */ m(
780
+ children: c.map(({ level: a, score: d }) => /* @__PURE__ */ m(
1044
781
  "option",
1045
782
  {
1046
- value: l,
1047
- disabled: l > n,
1048
- children: [
1049
- e.level,
1050
- " ",
1051
- l
1052
- ]
783
+ value: a,
784
+ disabled: a > n,
785
+ children: `${t.level} ${a} ${"★".repeat(d)}`
1053
786
  },
1054
- `level-${l}`
787
+ `level-${a}`
1055
788
  ))
1056
789
  }
1057
790
  ) });
1058
- }, le = ({
1059
- isOpen: e,
1060
- title: t,
791
+ }, ne = ({
792
+ isOpen: t,
793
+ title: e,
1061
794
  message: o,
1062
795
  children: n,
1063
796
  noConfirm: i = !1,
1064
797
  noCancel: r = !1,
1065
798
  confirmText: s = "OK",
1066
799
  cancelText: l = "Cancel",
1067
- onConfirm: a,
1068
- onCancel: c
800
+ onConfirm: c,
801
+ onCancel: a
1069
802
  }) => {
1070
- const _ = D(null);
1071
- return A(() => {
1072
- const u = (h) => {
1073
- h.key === "Escape" && c?.();
803
+ const d = U(null);
804
+ return S(() => {
805
+ const u = (_) => {
806
+ _.key === "Escape" && a?.();
1074
807
  };
1075
- return e && document.addEventListener("keydown", u), () => {
808
+ return t && document.addEventListener("keydown", u), () => {
1076
809
  document.removeEventListener("keydown", u);
1077
810
  };
1078
- }, [e, c]), /* @__PURE__ */ m(
811
+ }, [t, a]), /* @__PURE__ */ m(
1079
812
  "div",
1080
813
  {
1081
- className: `maze-dialog-overlay ${e ? "maze-dialog-visible" : ""}`,
1082
- children: /* @__PURE__ */ m("div", { className: "maze-dialog", ref: _, children: [
1083
- /* @__PURE__ */ m("div", { className: "maze-dialog-title", children: t }),
814
+ className: `maze-dialog-overlay ${t ? "maze-dialog-visible" : ""}`,
815
+ children: /* @__PURE__ */ m("div", { className: "maze-dialog", ref: d, children: [
816
+ /* @__PURE__ */ m("div", { className: "maze-dialog-title", children: e }),
1084
817
  /* @__PURE__ */ m("div", { className: "maze-dialog-content", children: n || /* @__PURE__ */ m("div", { className: "maze-dialog-message", children: o }) }),
1085
818
  /* @__PURE__ */ m("div", { className: "maze-dialog-buttons", children: [
1086
- !r && /* @__PURE__ */ m("button", { className: "maze-dialog-cancel", onClick: c, children: l }),
1087
- !i && /* @__PURE__ */ m("button", { className: "maze-dialog-confirm", onClick: a, children: s })
819
+ !r && /* @__PURE__ */ m("button", { className: "maze-dialog-cancel", onClick: a, children: l }),
820
+ !i && /* @__PURE__ */ m("button", { className: "maze-dialog-confirm", onClick: c, children: s })
1088
821
  ] })
1089
822
  ] })
1090
823
  }
1091
824
  );
1092
825
  };
1093
- function Mo(e) {
826
+ function Kt(t) {
1094
827
  return function() {
1095
- let t = e += 1831565813;
1096
- return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
828
+ let e = t += 1831565813;
829
+ return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
1097
830
  };
1098
831
  }
1099
- const ye = [
832
+ const ge = [
1100
833
  // Tier 1 (Levels 1-12) - Beginner
1101
834
  [
1102
- { size: 8, seed: 12345, method: "backtracking" },
835
+ { size: 8, seed: 12345, method: "backtracking", wallWidth: 4 },
1103
836
  // Level 1 - Very easy, small maze
1104
837
  { size: 8, seed: 23456, method: "backtracking" },
1105
838
  // Level 2 - Very easy
@@ -1232,14 +965,11 @@ const ye = [
1232
965
  { size: 68, seed: 33341, method: "backtracking" }
1233
966
  // Level 60 - Master
1234
967
  ]
1235
- ], ee = {
968
+ ], J = {
1236
969
  lcPrefix: "maze-",
1237
970
  i18n: {
1238
971
  reset: "Reset",
1239
972
  resetTip: "Reset all game data and highest score.",
1240
- total: "Total",
1241
- levelScore: "Level Score",
1242
- bestScore: "Best Score",
1243
973
  confirmReset: "Confirm Reset",
1244
974
  confirmResetMessage: "Are you sure you want to reset the game? All progress will be lost.",
1245
975
  cancel: "Cancel",
@@ -1247,16 +977,18 @@ const ye = [
1247
977
  confirm: "Confirm",
1248
978
  resetDoneToast: "Game reset! Starting from Level 1...",
1249
979
  confirmClue: "Confirm to turn on clue?",
1250
- confirmClueMessage: "Are you sure you want to turn on clue? Your current score will be halved.",
980
+ confirmClueMessage: "Are you sure you want to turn on clue? Your will lose 1 ★.",
1251
981
  level: "Level",
1252
982
  tier: "Tier",
1253
983
  settings: "Settings",
1254
984
  clueOn: "Clue: ON",
1255
985
  clueOff: "Clue: OFF",
1256
- clueTip: "Turn on clue will halve your current score in this level",
1257
986
  foodCollectedToast: "Food collected! %NUM% remaining.",
1258
987
  allFoodCollectedToast: "All food collected! Head to the exit.",
1259
- warnNotAllFoodCollectedToast: "Collect all food first! %NUM% remaining.",
988
+ // warnNotAllFoodCollectedToast: 'Collect all food first! %NUM% remaining.',
989
+ levelComplete: "Level Complete",
990
+ starsCollected: "Stars Collected",
991
+ avgStarPerLevel: "Avg. Stars per Level",
1260
992
  levelCompleteToast: "Level completed! 🎉",
1261
993
  tierUnlockedToast: "Tier %TIER% unlocked! 🎉",
1262
994
  levelGoToast: "Level %LEVEL% - Go!",
@@ -1267,8 +999,7 @@ const ye = [
1267
999
  },
1268
1000
  renderConfig: {
1269
1001
  padding: 10,
1270
- wallWidth: 4,
1271
- minWallWidth: 1,
1002
+ wallWidth: 2,
1272
1003
  wallColor: "#000000",
1273
1004
  exitColor: "#F44336",
1274
1005
  foodColor: "#4CAF50",
@@ -1277,42 +1008,42 @@ const ye = [
1277
1008
  playerColor: "#4CAF50",
1278
1009
  playerAtExitColor: "#FFD700"
1279
1010
  },
1280
- levelConfig: ye
1011
+ levelConfig: ge
1281
1012
  // levelsPerTier: 12,
1282
- }, Io = (e) => e === 1 ? 2 : e >= 2 && e <= 5 ? 3 : e >= 6 && e <= 11 ? 4 : e >= 12 && e <= 15 ? 5 : 6;
1283
- class Ro {
1013
+ }, Zt = (t) => t === 1 ? 2 : t >= 2 && t <= 5 ? 3 : t >= 6 && t <= 11 ? 4 : t >= 12 && t <= 15 ? 5 : 6;
1014
+ class Qt {
1284
1015
  // initially all walls exit
1285
- constructor(t, o) {
1286
- this.row = t, this.col = o;
1016
+ constructor(e, o) {
1017
+ this.row = e, this.col = o;
1287
1018
  }
1288
1019
  visited = !1;
1289
1020
  walls = { top: !0, right: !0, bottom: !0, left: !0 };
1290
1021
  }
1291
- class $o {
1022
+ class eo {
1292
1023
  rows;
1293
1024
  cols;
1294
1025
  grid;
1295
1026
  seed;
1296
1027
  random;
1297
- constructor(t, o, n) {
1298
- this.rows = t, this.cols = o, this.seed = n ?? Math.floor(Math.random() * 1e6), this.random = Mo(this.seed), this.grid = this.initializeGrid();
1028
+ constructor(e, o, n) {
1029
+ this.rows = e, this.cols = o, this.seed = n ?? Math.floor(Math.random() * 1e6), this.random = Kt(this.seed), this.grid = this.initializeGrid();
1299
1030
  }
1300
1031
  // Initialize the grid with new MazeCell objects
1301
1032
  initializeGrid() {
1302
- const t = [];
1033
+ const e = [];
1303
1034
  for (let o = 0; o < this.rows; o++) {
1304
- t[o] = [];
1035
+ e[o] = [];
1305
1036
  for (let n = 0; n < this.cols; n++)
1306
- t[o][n] = new Ro(o, n);
1037
+ e[o][n] = new Qt(o, n);
1307
1038
  }
1308
- return t;
1039
+ return e;
1309
1040
  }
1310
1041
  // Check if coordinates are within the grid boundaries
1311
- isValid(t, o) {
1312
- return t >= 0 && t < this.rows && o >= 0 && o < this.cols;
1042
+ isValid(e, o) {
1043
+ return e >= 0 && e < this.rows && o >= 0 && o < this.cols;
1313
1044
  }
1314
1045
  // Get all valid neighbors (top, right, bottom, left)
1315
- getNeighbors(t, o) {
1046
+ getNeighbors(e, o) {
1316
1047
  const n = [], i = [
1317
1048
  { r: -1, c: 0 },
1318
1049
  // Top
@@ -1324,35 +1055,35 @@ class $o {
1324
1055
  // Left
1325
1056
  ];
1326
1057
  for (const r of i) {
1327
- const s = t + r.r, l = o + r.c;
1058
+ const s = e + r.r, l = o + r.c;
1328
1059
  this.isValid(s, l) && n.push({ row: s, col: l });
1329
1060
  }
1330
1061
  return n;
1331
1062
  }
1332
1063
  // Get only neighbors that haven't been visited yet
1333
- getUnvisitedNeighbors(t, o) {
1334
- return this.getNeighbors(t, o).filter(
1064
+ getUnvisitedNeighbors(e, o) {
1065
+ return this.getNeighbors(e, o).filter(
1335
1066
  (n) => !this.grid[n.row][n.col].visited
1336
1067
  );
1337
1068
  }
1338
1069
  /**
1339
1070
  * Gets neighbors that have already been visited (part of the maze path).
1340
1071
  */
1341
- getVisitedNeighbors(t, o) {
1342
- return this.getNeighbors(t, o).filter(
1072
+ getVisitedNeighbors(e, o) {
1073
+ return this.getNeighbors(e, o).filter(
1343
1074
  (n) => this.grid[n.row][n.col].visited
1344
1075
  );
1345
1076
  }
1346
1077
  // Remove the wall between two adjacent cells
1347
- removeWall(t, o, n, i) {
1348
- const r = this.grid[t][o], s = this.grid[n][i];
1349
- t === n + 1 ? (r.walls.top = !1, s.walls.bottom = !1) : t === n - 1 ? (r.walls.bottom = !1, s.walls.top = !1) : o === i + 1 ? (r.walls.left = !1, s.walls.right = !1) : o === i - 1 && (r.walls.right = !1, s.walls.left = !1);
1078
+ removeWall(e, o, n, i) {
1079
+ const r = this.grid[e][o], s = this.grid[n][i];
1080
+ e === n + 1 ? (r.walls.top = !1, s.walls.bottom = !1) : e === n - 1 ? (r.walls.bottom = !1, s.walls.top = !1) : o === i + 1 ? (r.walls.left = !1, s.walls.right = !1) : o === i - 1 && (r.walls.right = !1, s.walls.left = !1);
1350
1081
  }
1351
1082
  }
1352
- class Fo {
1083
+ class to {
1353
1084
  maze;
1354
- constructor(t, o, n, i, r = { row: 0, col: 0 }, s = { row: t - 1, col: o - 1 }) {
1355
- switch (this.maze = new $o(t, o, i), n) {
1085
+ constructor(e, o, n, i, r = { row: 0, col: 0 }, s = { row: e - 1, col: o - 1 }) {
1086
+ switch (this.maze = new eo(e, o, i), n) {
1356
1087
  case "backtracking":
1357
1088
  this.runBacktracking();
1358
1089
  break;
@@ -1372,282 +1103,255 @@ class Fo {
1372
1103
  }
1373
1104
  // --- Backtracking Algorithm Implementation ---
1374
1105
  runBacktracking() {
1375
- const t = [], o = this.randomNumber(this.maze.rows), n = this.randomNumber(this.maze.cols);
1106
+ const e = [], o = this.randomNumber(this.maze.rows), n = this.randomNumber(this.maze.cols);
1376
1107
  let i = { row: o, col: n };
1377
- for (this.maze.grid[o][n].visited = !0, t.push(i); t.length > 0; ) {
1378
- i = t[t.length - 1];
1108
+ for (this.maze.grid[o][n].visited = !0, e.push(i); e.length > 0; ) {
1109
+ i = e[e.length - 1];
1379
1110
  const { row: r, col: s } = i, l = this.maze.getUnvisitedNeighbors(r, s);
1380
1111
  if (l.length > 0) {
1381
- const a = this.randomPick(l), { row: c, col: _ } = a;
1382
- this.maze.removeWall(r, s, c, _), this.maze.grid[c][_].visited = !0, t.push(a);
1112
+ const c = this.randomPick(l), { row: a, col: d } = c;
1113
+ this.maze.removeWall(r, s, a, d), this.maze.grid[a][d].visited = !0, e.push(c);
1383
1114
  } else
1384
- t.pop();
1115
+ e.pop();
1385
1116
  }
1386
1117
  }
1387
1118
  // --- Prim's Algorithm Implementation ---
1388
1119
  runPrims() {
1389
- const t = [], o = (r, s) => {
1120
+ const e = [], o = (r, s) => {
1390
1121
  const l = this.maze.getNeighbors(r, s);
1391
- for (const a of l)
1392
- !this.maze.grid[a.row][a.col].visited && !t.some(
1393
- (c) => c.row === a.row && c.col === a.col
1394
- ) && t.push(a);
1122
+ for (const c of l)
1123
+ !this.maze.grid[c.row][c.col].visited && !e.some(
1124
+ (a) => a.row === c.row && a.col === c.col
1125
+ ) && e.push(c);
1395
1126
  }, n = this.randomNumber(this.maze.rows), i = this.randomNumber(this.maze.cols);
1396
- for (this.maze.grid[n][i].visited = !0, o(n, i); t.length > 0; ) {
1397
- const r = this.randomNumber(t.length), s = t[r], { row: l, col: a } = s, c = this.maze.getVisitedNeighbors(l, a);
1398
- if (c.length > 0) {
1399
- const _ = this.randomPick(c);
1400
- this.maze.removeWall(l, a, _.row, _.col), this.maze.grid[l][a].visited = !0, o(l, a);
1127
+ for (this.maze.grid[n][i].visited = !0, o(n, i); e.length > 0; ) {
1128
+ const r = this.randomNumber(e.length), s = e[r], { row: l, col: c } = s, a = this.maze.getVisitedNeighbors(l, c);
1129
+ if (a.length > 0) {
1130
+ const d = this.randomPick(a);
1131
+ this.maze.removeWall(l, c, d.row, d.col), this.maze.grid[l][c].visited = !0, o(l, c);
1401
1132
  }
1402
- t.splice(r, 1);
1133
+ e.splice(r, 1);
1403
1134
  }
1404
1135
  }
1405
1136
  // --- Helper ---
1406
- addOpenings(t, o) {
1407
- this.maze.grid[t.row][t.col].walls.top = !1, this.maze.grid[o.row][o.col].walls.bottom = !1;
1137
+ addOpenings(e, o) {
1138
+ this.maze.grid[e.row][e.col].walls.top = !1, this.maze.grid[o.row][o.col].walls.bottom = !1;
1408
1139
  }
1409
1140
  // random number
1410
- randomNumber(t) {
1411
- return Math.floor(this.maze.random() * t);
1141
+ randomNumber(e) {
1142
+ return Math.floor(this.maze.random() * e);
1412
1143
  }
1413
1144
  // Randomly pick an item from a list
1414
- randomPick(t) {
1415
- return t[Math.floor(this.maze.random() * t.length)];
1145
+ randomPick(e) {
1146
+ return e[Math.floor(this.maze.random() * e.length)];
1416
1147
  }
1417
1148
  }
1418
- function Uo(e, t, o, n, i, r) {
1419
- return new Fo(e, t, o, n, i, r).getMaze();
1149
+ function oo(t, e, o, n, i, r) {
1150
+ return new to(t, e, o, n, i, r).getMaze();
1420
1151
  }
1421
- const Oo = (e, t, o) => {
1422
- if (!e.isValid(t, o)) return !1;
1423
- const n = e.grid[t][o];
1152
+ const no = (t, e, o) => {
1153
+ if (!t.isValid(e, o)) return !1;
1154
+ const n = t.grid[e][o];
1424
1155
  return !n.walls.top || !n.walls.right || !n.walls.bottom || !n.walls.left;
1425
- }, Ct = (e, t = ye.flat()) => {
1426
- const o = e - 1, n = t[o];
1156
+ }, et = (t, e = ge.flat()) => {
1157
+ const o = t - 1, n = e[o];
1427
1158
  if (!n)
1428
- return console.error(`Cannot find Level ${e}'s config.`), null;
1429
- const i = n.size, r = i, s = i, l = n.seed, a = n.method, c = n.entry || { row: 0, col: 0 }, _ = n.exit || {
1159
+ return console.error(`Cannot find Level ${t}'s config.`), null;
1160
+ const i = n.size, r = i, s = i, l = n.seed, c = n.method, a = n.entry || { row: 0, col: 0 }, d = n.exit || {
1430
1161
  row: r - 1,
1431
1162
  col: s - 1
1432
- }, u = Uo(r, s, a, l, c, _), h = Io(e), d = [];
1433
- for (let f = 0; f < h; f++) {
1163
+ }, u = oo(r, s, c, l, a, d), _ = Zt(t), h = [];
1164
+ for (let v = 0; v < _; v++) {
1434
1165
  let g;
1435
1166
  do
1436
1167
  g = {
1437
1168
  row: Math.floor(u.random() * r),
1438
1169
  col: Math.floor(u.random() * s)
1439
1170
  };
1440
- while (g.row === c.row && g.col === c.col || g.row === _.row && g.col === _.col || !Oo(u, g.row, g.col) || d.some(
1441
- (v) => v.row === g.row && v.col === g.col
1171
+ while (g.row === a.row && g.col === a.col || g.row === d.row && g.col === d.col || !no(u, g.row, g.col) || h.some(
1172
+ (p) => p.row === g.row && p.col === g.col
1442
1173
  ));
1443
- d.push(g);
1174
+ h.push(g);
1444
1175
  }
1445
1176
  return {
1446
1177
  maze: u,
1447
- playerPosition: c,
1448
- exitPosition: _,
1449
- foodPositions: d,
1450
- totalFoodCount: h,
1178
+ playerPosition: a,
1179
+ exitPosition: d,
1180
+ foodPositions: h,
1181
+ totalFoodCount: _,
1451
1182
  foodCollected: 0,
1452
- playerPath: [c],
1453
- visitCounts: { [`${c.row},${c.col}`]: 1 },
1183
+ playerPath: [a],
1184
+ visitCounts: { [`${a.row},${a.col}`]: 1 },
1454
1185
  moveCount: 0,
1455
- currentScore: u.rows * u.cols * 5,
1186
+ currentScore: 0,
1456
1187
  playerAtExit: !1,
1457
1188
  isGameActive: !0,
1458
1189
  levelTransitioning: !1
1459
1190
  };
1460
- }, yt = ({
1461
- gameState: e,
1462
- setGameState: t,
1191
+ }, tt = ({
1192
+ gameState: t,
1193
+ setGameState: e,
1463
1194
  config: o
1464
1195
  }) => ({
1465
1196
  generateCurrentLevelMaze: () => {
1466
- const i = Ct(e.currentLevel, o.current.levelConfig.flat());
1467
- i && t((r) => ({
1197
+ const i = et(t.currentLevel, o.current.levelConfig.flat());
1198
+ i && e((r) => ({
1468
1199
  ...r,
1469
1200
  ...i
1470
1201
  }));
1471
1202
  }
1472
- }), wt = (e) => pe(() => {
1473
- const t = e.map((l) => l.length), o = t.reduce((l, a) => l + a, 0), n = e.length, i = (l) => {
1203
+ }), ot = (t) => he(() => {
1204
+ const e = t.map((l) => l.length), o = e.reduce((l, c) => l + c, 0), n = t.length, i = (l) => {
1474
1205
  if (l < 1 || l > o) return 0;
1475
- let a = 0;
1476
- for (let c = 0; c < t.length; c++)
1477
- if (a += t[c], l <= a) return c + 1;
1206
+ let c = 0;
1207
+ for (let a = 0; a < e.length; a++)
1208
+ if (c += e[a], l <= c) return a + 1;
1478
1209
  return 0;
1479
- }, r = (l) => l < 1 || l > n ? 0 : t.slice(0, l - 1).reduce((a, c) => a + c, 0) + 1, s = {
1210
+ }, r = (l) => l < 1 || l > n ? 0 : e.slice(0, l - 1).reduce((c, a) => c + a, 0) + 1, s = {
1480
1211
  getTotalLevels: () => o,
1481
1212
  getTotalTiers: () => n,
1482
1213
  getTierLevelsRange: (l) => {
1483
1214
  if (l < 1 || l > n) return [0, 0];
1484
- const a = r(l), c = a + t[l - 1] - 1;
1485
- return [a, c];
1215
+ const c = r(l), a = c + e[l - 1] - 1;
1216
+ return [c, a];
1486
1217
  },
1487
1218
  getTierByLevel: i,
1488
1219
  getFirstLevelOfTier: r,
1489
1220
  getLevelConfig: (l) => {
1490
1221
  if (l < 1 || l > o) return null;
1491
- const a = i(l), c = r(a), _ = l - c;
1492
- return e[a - 1][_];
1222
+ const c = i(l), a = r(c), d = l - a;
1223
+ return t[c - 1][d];
1493
1224
  },
1494
- getTierConfig: (l) => l < 1 || l > n ? null : e[l - 1],
1495
- isLevelUnlocked: (l, a) => l <= a,
1496
- isTierUnlocked: (l, a) => l <= a,
1225
+ getTierConfig: (l) => l < 1 || l > n ? null : t[l - 1],
1226
+ isLevelUnlocked: (l, c) => l <= c,
1227
+ isTierUnlocked: (l, c) => l <= c,
1497
1228
  getNextLevelInfo: (l) => {
1498
1229
  if (l >= o) return null;
1499
- const a = l + 1, c = i(l), _ = i(a);
1230
+ const c = l + 1, a = i(l), d = i(c);
1500
1231
  return {
1501
- nextLevel: a,
1502
- nextTier: _,
1503
- isTierChange: _ > c
1232
+ nextLevel: c,
1233
+ nextTier: d,
1234
+ isTierChange: d > a
1504
1235
  };
1505
1236
  },
1506
- getCurrentTierProgress: (l, a) => {
1507
- const [c, _] = s.getTierLevelsRange(a), u = l - c + 1, h = _ - c + 1;
1508
- return { current: u, total: h };
1237
+ getCurrentTierProgress: (l, c) => {
1238
+ const [a, d] = s.getTierLevelsRange(c), u = l - a + 1, _ = d - a + 1;
1239
+ return { current: u, total: _ };
1509
1240
  },
1510
1241
  isLastLevelInTier: (l) => {
1511
- const a = i(l), [, c] = s.getTierLevelsRange(a);
1512
- return l === c;
1242
+ const c = i(l), [, a] = s.getTierLevelsRange(c);
1243
+ return l === a;
1513
1244
  },
1514
1245
  getPreviousLevelInfo: (l) => {
1515
1246
  if (l <= 1) return null;
1516
- const a = l - 1, c = i(l), _ = i(a);
1247
+ const c = l - 1, a = i(l), d = i(c);
1517
1248
  return {
1518
- prevLevel: a,
1519
- prevTier: _,
1520
- isTierChange: _ < c
1249
+ prevLevel: c,
1250
+ prevTier: d,
1251
+ isTierChange: d < a
1521
1252
  };
1522
1253
  }
1523
1254
  };
1524
1255
  return s;
1525
- }, [e]), Do = () => {
1526
- const { gameState: e, setGameState: t, resetGame: o, config: n } = _t(), i = n.current.i18n, r = n.current.levelConfig, s = wt(r), { showToast: l } = Ce(), { currentLevel: a, totalScore: c, levelScores: _, currentScore: u, showClue: h } = e, d = _[a] || 0, f = s.getTotalTiers(), [g, v] = R(!1), [C, p] = R(!1), [T, k] = R(!1), [E, P] = R(s.getTierLevelsRange(1)), { generateCurrentLevelMaze: F } = yt({
1527
- gameState: e,
1528
- setGameState: t,
1256
+ }, [t]), io = () => {
1257
+ const { gameState: t, setGameState: e, resetGame: o, config: n } = _e(), i = n.current.i18n, r = n.current.levelConfig, s = ot(r), { showToast: l } = ve(), {
1258
+ totalScore: c,
1259
+ showClue: a,
1260
+ currentTier: d,
1261
+ currentLevel: u,
1262
+ highestUnlockedTier: _,
1263
+ highestUnlockedLevel: h,
1264
+ levelTransitioning: v
1265
+ } = t, g = s.getTotalLevels(), p = s.getTotalTiers(), [f, C] = I(!1), [z, b] = I(!1), [A, P] = I(!1), [N, $] = I(s.getTierLevelsRange(1)), { generateCurrentLevelMaze: M } = tt({
1266
+ gameState: t,
1267
+ setGameState: e,
1529
1268
  config: n
1530
1269
  });
1531
- A(() => {
1532
- P(
1533
- s.getTierLevelsRange(e.currentTier)
1534
- );
1535
- }, [e.currentTier]);
1536
- const M = (L) => {
1537
- const Y = s.getFirstLevelOfTier(L);
1538
- s.isLevelUnlocked(
1539
- Y,
1540
- e.highestUnlockedLevel
1541
- ) && (t((Nt) => ({ ...Nt, currentTier: L })), N(Y));
1542
- }, N = (L) => {
1543
- s.isLevelUnlocked(L, e.highestUnlockedLevel) && (t((Y) => ({
1544
- ...Y,
1545
- currentLevel: L
1546
- })), F(), l(
1547
- i.levelGoToast.replace("%LEVEL%", L.toString()),
1270
+ S(() => {
1271
+ $(s.getTierLevelsRange(d));
1272
+ }, [d]);
1273
+ const j = (x) => {
1274
+ const B = s.getFirstLevelOfTier(x);
1275
+ s.isLevelUnlocked(B, h) && (e((ut) => ({ ...ut, currentTier: x })), T(B));
1276
+ }, T = (x) => {
1277
+ s.isLevelUnlocked(x, h) && (e((B) => ({
1278
+ ...B,
1279
+ currentLevel: x
1280
+ })), M(), l(
1281
+ i.levelGoToast.replace("%LEVEL%", x.toString()),
1548
1282
  "success"
1549
1283
  ));
1550
- }, S = () => {
1551
- v(!0);
1552
- }, z = () => {
1553
- v(!1);
1554
- }, U = () => {
1555
- k(!0);
1556
- }, bt = () => {
1557
- k(!1);
1558
- }, kt = () => {
1559
- t((L) => (l(L.showClue ? i.cluePathDisabled : i.cluePathEnabled), {
1560
- ...L,
1561
- showClue: !L.showClue,
1562
- currentScore: Math.floor(L.currentScore / 2)
1563
- // half the current score
1564
- })), k(!1);
1565
- }, Tt = () => {
1566
- p(!0);
1567
- }, zt = () => {
1568
- o(), p(!1), l(i.resetDoneToast);
1569
- }, Pt = () => {
1570
- p(!1);
1284
+ }, R = () => {
1285
+ C(!0);
1286
+ }, nt = () => {
1287
+ C(!1);
1288
+ }, it = () => {
1289
+ P(!0);
1290
+ }, rt = () => {
1291
+ P(!1);
1292
+ }, st = () => {
1293
+ e((x) => (l(x.showClue ? i.cluePathDisabled : i.cluePathEnabled), {
1294
+ ...x,
1295
+ showClue: !x.showClue
1296
+ })), P(!1);
1297
+ }, lt = () => {
1298
+ b(!0);
1299
+ }, at = () => {
1300
+ o(), b(!1), l(i.resetDoneToast);
1301
+ }, ct = () => {
1302
+ b(!1);
1571
1303
  };
1572
1304
  return /* @__PURE__ */ m("div", { class: "game-panel-container", children: [
1573
1305
  /* @__PURE__ */ m("div", { className: "game-controls", children: [
1574
1306
  /* @__PURE__ */ m("div", { className: "selectors-container", children: [
1575
1307
  /* @__PURE__ */ m(
1576
- xo,
1308
+ Yt,
1577
1309
  {
1578
1310
  i18n: i,
1579
- totalTiers: f,
1580
- currentTier: e.currentTier,
1581
- highestUnlockedTier: e.highestUnlockedTier,
1582
- onTierChange: M,
1583
- disabled: e.levelTransitioning
1311
+ totalTiers: p,
1312
+ currentTier: d,
1313
+ highestUnlockedTier: _,
1314
+ onTierChange: j,
1315
+ disabled: v
1584
1316
  }
1585
1317
  ),
1586
1318
  /* @__PURE__ */ m(
1587
- Eo,
1319
+ Jt,
1588
1320
  {
1589
1321
  i18n: i,
1590
- levelsRange: E,
1591
- currentLevel: e.currentLevel,
1592
- highestUnlockedLevel: e.highestUnlockedLevel,
1593
- onLevelChange: N,
1594
- disabled: e.levelTransitioning
1322
+ levelsRange: N,
1323
+ currentLevel: u,
1324
+ highestUnlockedLevel: h,
1325
+ onLevelChange: T,
1326
+ disabled: v
1595
1327
  }
1596
1328
  )
1597
1329
  ] }),
1598
- /* @__PURE__ */ m("div", { className: "score-container", children: [
1599
- /* @__PURE__ */ m("div", { className: "score-box currentscore", children: [
1600
- /* @__PURE__ */ m("span", { className: "score-label", children: [
1601
- i.levelScore,
1602
- ":"
1603
- ] }),
1604
- /* @__PURE__ */ m("span", { className: "score-data", children: u })
1605
- ] }),
1606
- /* @__PURE__ */ m("div", { className: "score-box bestscore", children: [
1607
- /* @__PURE__ */ m("span", { className: "score-label", children: [
1608
- i.bestScore,
1609
- ":"
1610
- ] }),
1611
- /* @__PURE__ */ m("span", { className: "score-data", children: d })
1612
- ] }),
1613
- /* @__PURE__ */ m("div", { className: "score-box totalscore", children: [
1614
- /* @__PURE__ */ m("span", { className: "score-label", children: [
1615
- i.total,
1616
- ":"
1617
- ] }),
1618
- /* @__PURE__ */ m("span", { className: "score-data", children: c })
1619
- ] })
1620
- ] })
1330
+ /* @__PURE__ */ m(
1331
+ "button",
1332
+ {
1333
+ className: `settings-clue-button ${a ? "clue-on" : "clue-off"}`,
1334
+ disabled: a,
1335
+ title: "Toggle Clue",
1336
+ onClick: it,
1337
+ children: a ? i.clueOn : i.clueOff
1338
+ }
1339
+ )
1621
1340
  ] }),
1622
- /* @__PURE__ */ m("div", { className: "game-settings", children: /* @__PURE__ */ m(
1623
- So,
1624
- {
1625
- onClick: S,
1626
- className: "game-settings-icon"
1627
- }
1628
- ) }),
1341
+ /* @__PURE__ */ m("div", { className: "game-settings", children: /* @__PURE__ */ m("span", { className: "game-settings-icon", onClick: R, children: "★ " + c }) }),
1629
1342
  /* @__PURE__ */ m(
1630
- le,
1343
+ ne,
1631
1344
  {
1632
- isOpen: g,
1345
+ isOpen: f,
1633
1346
  title: i.settings,
1634
1347
  noConfirm: !0,
1635
1348
  cancelText: i.close,
1636
- onCancel: z,
1349
+ onCancel: nt,
1637
1350
  children: [
1638
- /* @__PURE__ */ m("div", { className: "settings-item-box", children: [
1639
- /* @__PURE__ */ m("div", {}),
1640
- /* @__PURE__ */ m(
1641
- "button",
1642
- {
1643
- className: `settings-clue-button ${h ? "clue-on" : "clue-off"}`,
1644
- disabled: h,
1645
- title: "Toggle Clue",
1646
- onClick: U,
1647
- children: h ? i.clueOn : i.clueOff
1648
- }
1649
- ),
1650
- /* @__PURE__ */ m("div", { className: "settings-item-tip", children: i.clueTip })
1351
+ /* @__PURE__ */ m("div", { className: "settings-stats", children: [
1352
+ /* @__PURE__ */ m("div", { children: i.levelComplete + `: ${h}/${g}` }),
1353
+ /* @__PURE__ */ m("div", { children: i.starsCollected + ": " + c }),
1354
+ /* @__PURE__ */ m("div", { children: i.avgStarPerLevel + ": " + (c / h).toFixed(2) })
1651
1355
  ] }),
1652
1356
  /* @__PURE__ */ m("div", { className: "settings-item-box", children: [
1653
1357
  /* @__PURE__ */ m(
@@ -1655,7 +1359,7 @@ const Oo = (e, t, o) => {
1655
1359
  {
1656
1360
  className: "settings-reset-button",
1657
1361
  title: "Reset Game",
1658
- onClick: Tt,
1362
+ onClick: lt,
1659
1363
  children: i.reset
1660
1364
  }
1661
1365
  ),
@@ -1665,166 +1369,163 @@ const Oo = (e, t, o) => {
1665
1369
  }
1666
1370
  ),
1667
1371
  /* @__PURE__ */ m(
1668
- le,
1372
+ ne,
1669
1373
  {
1670
- isOpen: C,
1374
+ isOpen: z,
1671
1375
  title: i.confirmReset,
1672
1376
  message: i.confirmResetMessage,
1673
1377
  confirmText: i.reset,
1674
1378
  cancelText: i.cancel,
1675
- onConfirm: zt,
1676
- onCancel: Pt
1379
+ onConfirm: at,
1380
+ onCancel: ct
1677
1381
  }
1678
1382
  ),
1679
1383
  /* @__PURE__ */ m(
1680
- le,
1384
+ ne,
1681
1385
  {
1682
- isOpen: T,
1386
+ isOpen: A,
1683
1387
  title: i.confirmClue,
1684
1388
  message: i.confirmClueMessage,
1685
1389
  confirmText: i.confirm,
1686
1390
  cancelText: i.cancel,
1687
- onConfirm: kt,
1688
- onCancel: bt
1391
+ onConfirm: st,
1392
+ onCancel: rt
1689
1393
  }
1690
1394
  )
1691
1395
  ] });
1692
- }, Wo = ({
1693
- message: e,
1694
- visible: t,
1396
+ }, ro = ({
1397
+ message: t,
1398
+ visible: e,
1695
1399
  duration: o = 2e3,
1696
1400
  onClose: n,
1697
1401
  position: i = "center",
1698
1402
  type: r = "info"
1699
- }) => e ? (A(() => {
1403
+ }) => t ? (S(() => {
1700
1404
  let s;
1701
- return t && o > 0 && n && (s = setTimeout(() => {
1405
+ return e && o > 0 && n && (s = setTimeout(() => {
1702
1406
  n();
1703
1407
  }, o)), () => {
1704
1408
  s && clearTimeout(s);
1705
1409
  };
1706
- }, [t, o, n]), /* @__PURE__ */ m("div", { className: `toast-container position-${i}`, children: /* @__PURE__ */ m("div", { className: `toast-message type-${r} ${t ? "toast-visible" : ""}`, children: e }) })) : null, jo = (e, t, o) => {
1707
- A(() => {
1410
+ }, [e, o, n]), /* @__PURE__ */ m("div", { className: `toast-container position-${i}`, children: /* @__PURE__ */ m("div", { className: `toast-message type-${r} ${e ? "toast-visible" : ""}`, children: t }) })) : null, so = (t, e, o) => {
1411
+ S(() => {
1708
1412
  const n = () => {
1709
- const i = e.current;
1413
+ const i = t.current;
1710
1414
  if (!i) return;
1711
1415
  const r = i.parentElement;
1712
1416
  if (!r) return;
1713
1417
  const s = r.clientWidth, l = window.devicePixelRatio || 1;
1714
- i.style.width = `${s}px`, i.style.height = `${s}px`, i.width = s * l, i.height = s * l, t(e, o.current);
1418
+ i.style.width = `${s}px`, i.style.height = `${s}px`, i.width = s * l, i.height = s * l, e(t, o.current);
1715
1419
  };
1716
1420
  return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
1717
- }, [e]);
1718
- }, Ve = {
1421
+ }, [t]);
1422
+ }, Me = {
1719
1423
  ArrowUp: [-1, 0],
1720
1424
  ArrowDown: [1, 0],
1721
1425
  ArrowLeft: [0, -1],
1722
1426
  ArrowRight: [0, 1]
1723
- }, Ho = ({
1724
- containerRef: e,
1725
- gameState: t,
1427
+ }, lo = ({
1428
+ containerRef: t,
1429
+ gameState: e,
1726
1430
  setGameState: o,
1727
- onFoodCollected: n,
1728
- onFoodNotAllCollected: i
1431
+ onFoodCollected: n
1729
1432
  }) => {
1730
- A(() => {
1731
- const r = (a) => {
1732
- if (!t.isGameActive || !t.maze) return;
1733
- const [c, _] = Ve[a], { row: u, col: h } = t.playerPosition, d = u + c, f = h + _;
1734
- if (!t.maze.isValid(d, f)) return;
1735
- const g = t.maze.grid[u][h];
1736
- if (c === -1 && g.walls.top || c === 1 && g.walls.bottom || _ === -1 && g.walls.left || _ === 1 && g.walls.right)
1433
+ S(() => {
1434
+ const i = (l) => {
1435
+ if (!e.isGameActive || !e.maze) return;
1436
+ const [c, a] = Me[l], { row: d, col: u } = e.playerPosition, _ = d + c, h = u + a;
1437
+ if (!e.maze.isValid(_, h)) return;
1438
+ const v = e.maze.grid[d][u];
1439
+ if (c === -1 && v.walls.top || c === 1 && v.walls.bottom || a === -1 && v.walls.left || a === 1 && v.walls.right)
1737
1440
  return;
1738
- const v = { row: d, col: f }, C = `${d},${f}`;
1739
- o((p) => {
1740
- const T = p.foodPositions.some(
1741
- (S) => S.row === d && S.col === f
1441
+ const g = { row: _, col: h }, p = `${_},${h}`;
1442
+ o((f) => {
1443
+ const C = f.foodPositions.some(
1444
+ (N) => N.row === _ && N.col === h
1742
1445
  );
1743
- T && n();
1744
- const k = Math.max(
1745
- 0,
1746
- p.currentScore - 1
1747
- ), E = `${u},${h}-${d},${f}`, P = d === p.exitPosition.row && f === p.exitPosition.col, F = T ? p.foodCollected + 1 : p.foodCollected, M = F === p.totalFoodCount, N = P && M;
1748
- return P && !M && i(), {
1749
- ...p,
1750
- playerPosition: v,
1751
- playerPath: [...p.playerPath, v],
1752
- foodPositions: p.foodPositions.filter(
1753
- (S) => !(S.row === d && S.col === f)
1446
+ C && n();
1447
+ const z = `${d},${u}-${_},${h}`, b = _ === f.exitPosition.row && h === f.exitPosition.col, A = C ? f.foodCollected + 1 : f.foodCollected, P = A === f.totalFoodCount;
1448
+ return {
1449
+ ...f,
1450
+ playerPosition: g,
1451
+ playerPath: [...f.playerPath, g],
1452
+ foodPositions: f.foodPositions.filter(
1453
+ (N) => !(N.row === _ && N.col === h)
1754
1454
  ),
1755
- foodCollected: F,
1756
- currentScore: k,
1455
+ foodCollected: A,
1456
+ // if not complete, then just 0, if complete, then count the ⭐️ by 3 conditions
1457
+ currentScore: b ? [b, !f.showClue, P].filter(Boolean).length : 0,
1757
1458
  visitCounts: {
1758
- ...p.visitCounts,
1759
- [E]: (p.visitCounts[E] || 0) + 1,
1760
- [C]: (p.visitCounts[C] || 0) + 1
1459
+ ...f.visitCounts,
1460
+ [z]: (f.visitCounts[z] || 0) + 1,
1461
+ [p]: (f.visitCounts[p] || 0) + 1
1761
1462
  },
1762
- moveCount: p.moveCount + 1,
1763
- playerAtExit: P,
1764
- isGameActive: !N,
1765
- levelTransitioning: N
1463
+ moveCount: f.moveCount + 1,
1464
+ playerAtExit: b,
1465
+ isGameActive: !b,
1466
+ levelTransitioning: b
1766
1467
  };
1767
1468
  });
1768
- }, s = (a) => {
1769
- if (!t.isGameActive || !t.maze) return;
1770
- const c = a.key;
1771
- c in Ve && (a.preventDefault(), r(c));
1772
- }, l = (a) => {
1773
- if (a.preventDefault(), !t.isGameActive || !t.maze) return;
1774
- const c = a.touches[0], _ = document.elementFromPoint(c.clientX, c.clientY);
1775
- _ && (_.classList.contains("maze-up") ? r("ArrowUp") : _.classList.contains("maze-down") ? r("ArrowDown") : _.classList.contains("maze-left") ? r("ArrowLeft") : _.classList.contains("maze-right") && r("ArrowRight"));
1469
+ }, r = (l) => {
1470
+ if (!e.isGameActive || !e.maze) return;
1471
+ const c = l.key;
1472
+ c in Me && (l.preventDefault(), i(c));
1473
+ }, s = (l) => {
1474
+ if (l.preventDefault(), !e.isGameActive || !e.maze) return;
1475
+ const c = l.touches[0], a = document.elementFromPoint(c.clientX, c.clientY);
1476
+ a && (a.classList.contains("maze-up") ? i("ArrowUp") : a.classList.contains("maze-down") ? i("ArrowDown") : a.classList.contains("maze-left") ? i("ArrowLeft") : a.classList.contains("maze-right") && i("ArrowRight"));
1776
1477
  };
1777
- return window.addEventListener("keydown", s), e.current?.addEventListener("touchstart", l, {
1478
+ return window.addEventListener("keydown", r), t.current?.addEventListener("touchstart", s, {
1778
1479
  passive: !1
1779
1480
  }), () => {
1780
- window.removeEventListener("keydown", s), e.current?.removeEventListener("touchstart", l);
1481
+ window.removeEventListener("keydown", r), t.current?.removeEventListener("touchstart", s);
1781
1482
  };
1782
1483
  }, [
1783
- t.isGameActive,
1784
- t.maze,
1785
- t.playerPosition,
1786
- t.exitPosition
1484
+ e.isGameActive,
1485
+ e.maze,
1486
+ e.playerPosition,
1487
+ e.exitPosition
1787
1488
  ]);
1788
- }, Go = ({
1789
- gameState: e,
1790
- setGameState: t,
1489
+ }, ao = ({
1490
+ gameState: t,
1491
+ setGameState: e,
1791
1492
  config: o,
1792
1493
  onLevelComplete: n,
1793
1494
  onTierUnlocked: i
1794
1495
  }) => {
1795
- A(() => {
1796
- if (e.levelTransitioning) {
1496
+ S(() => {
1497
+ if (t.levelTransitioning) {
1797
1498
  n();
1798
1499
  const l = setTimeout(() => {
1799
1500
  s(
1800
- e.currentScore,
1501
+ t.currentScore,
1801
1502
  o.current.levelConfig
1802
1503
  );
1803
1504
  }, 1e3);
1804
1505
  return () => clearTimeout(l);
1805
1506
  }
1806
- }, [e.levelTransitioning]);
1807
- const r = wt(o.current.levelConfig), s = (l, a) => {
1808
- const c = r.getNextLevelInfo(
1809
- e.currentLevel
1507
+ }, [t.levelTransitioning]);
1508
+ const r = ot(o.current.levelConfig), s = (l, c) => {
1509
+ const a = r.getNextLevelInfo(
1510
+ t.currentLevel
1810
1511
  );
1811
- if (!c) return;
1812
- const { nextLevel: _, nextTier: u, isTierChange: h } = c, d = Ct(_, a.flat());
1813
- d && t((f) => {
1814
- h && i(u);
1815
- const g = { ...f.levelScores };
1816
- return g[f.currentLevel] = Math.max(
1512
+ if (!a) return;
1513
+ const { nextLevel: d, nextTier: u, isTierChange: _ } = a, h = et(d, c.flat());
1514
+ h && e((v) => {
1515
+ _ && i(u);
1516
+ const g = { ...v.levelScores };
1517
+ return g[v.currentLevel] = Math.max(
1817
1518
  l,
1818
- g[f.currentLevel] || 0
1519
+ g[v.currentLevel] || 0
1819
1520
  ), {
1820
- ...f,
1821
- ...d,
1822
- currentLevel: _,
1521
+ ...v,
1522
+ ...h,
1523
+ currentLevel: d,
1823
1524
  currentTier: u,
1824
- highestUnlockedLevel: Math.max(f.highestUnlockedLevel, _),
1825
- highestUnlockedTier: Math.max(f.highestUnlockedTier, u),
1525
+ highestUnlockedLevel: Math.max(v.highestUnlockedLevel, d),
1526
+ highestUnlockedTier: Math.max(v.highestUnlockedTier, u),
1826
1527
  levelScores: g,
1827
- totalScore: Object.values(g).reduce((v, C) => v + C, 0),
1528
+ totalScore: Object.values(g).reduce((p, f) => p + f, 0),
1828
1529
  showClue: !1,
1829
1530
  // reset to false on new level
1830
1531
  isGameActive: !0,
@@ -1836,243 +1537,233 @@ const Oo = (e, t, o) => {
1836
1537
  handleLevelComplete: s
1837
1538
  };
1838
1539
  };
1839
- function Bo(e, t) {
1840
- const { ctx: o, width: n, height: i, maze: r } = e;
1841
- t.playerColor = e.playerAtExit ? t.playerAtExitColor : t.playerColor;
1540
+ function co(t, e) {
1541
+ const { ctx: o, width: n, height: i, maze: r } = t;
1542
+ e.playerColor = t.playerAtExit ? e.playerAtExitColor : e.playerColor;
1842
1543
  const {
1843
1544
  padding: s,
1844
1545
  wallWidth: l,
1845
- wallColor: a,
1846
- playerColor: c,
1847
- exitColor: _,
1546
+ wallColor: c,
1547
+ playerColor: a,
1548
+ exitColor: d,
1848
1549
  foodColor: u,
1849
- clueColor: h,
1850
- backgroundColor: d
1851
- } = t, f = r.cols, g = r.rows, v = (n - s * 2) / f, C = (i - s * 2) / g;
1852
- o.clearRect(0, 0, n, i), o.save(), o.fillStyle = d, o.fillRect(0, 0, n, i), o.restore(), e.showClue && e.playerPath && e.playerPath.length > 0 && Ko(e, {
1853
- cellWidth: v,
1854
- cellHeight: C,
1550
+ clueColor: _,
1551
+ backgroundColor: h
1552
+ } = e, v = r.cols, g = r.rows, p = (n - s * 2) / v, f = (i - s * 2) / g;
1553
+ o.clearRect(0, 0, n, i), o.save(), o.fillStyle = h, o.fillRect(0, 0, n, i), o.restore(), t.showClue && t.playerPath && t.playerPath.length > 0 && vo(t, {
1554
+ cellWidth: p,
1555
+ cellHeight: f,
1855
1556
  padding: s,
1856
- clueColor: h
1857
- }), Vo(e, {
1858
- cellWidth: v,
1859
- cellHeight: C,
1557
+ clueColor: _
1558
+ }), uo(t, {
1559
+ cellWidth: p,
1560
+ cellHeight: f,
1860
1561
  padding: s,
1861
- wallColor: a,
1562
+ wallColor: c,
1862
1563
  wallWidth: l
1863
- }), Yo(e, {
1864
- cellWidth: v,
1865
- cellHeight: C,
1564
+ }), fo(t, {
1565
+ cellWidth: p,
1566
+ cellHeight: f,
1866
1567
  padding: s,
1867
1568
  foodColor: u
1868
- }), e.playerAtExit || Xo(e, {
1869
- cellWidth: v,
1870
- cellHeight: C,
1569
+ }), t.playerAtExit || _o(t, {
1570
+ cellWidth: p,
1571
+ cellHeight: f,
1871
1572
  padding: s,
1872
- exitColor: _
1873
- }), qo(e, {
1874
- cellWidth: v,
1875
- cellHeight: C,
1573
+ exitColor: d
1574
+ }), ho(t, {
1575
+ cellWidth: p,
1576
+ cellHeight: f,
1876
1577
  padding: s,
1877
- playerColor: c
1578
+ playerColor: a
1878
1579
  });
1879
1580
  }
1880
- function Vo(e, t) {
1881
- const { ctx: o, maze: n } = e, { cellWidth: i, cellHeight: r, padding: s, wallColor: l, wallWidth: a } = t;
1882
- o.save(), o.strokeStyle = l, o.lineWidth = a, o.lineCap = "round", o.beginPath();
1883
- for (let c = 0; c < n.rows; c++)
1884
- for (let _ = 0; _ < n.cols; _++) {
1885
- const u = n.grid[c][_], h = s + _ * i, d = s + c * r;
1886
- u.walls.top && (o.moveTo(h, d), o.lineTo(h + i, d)), u.walls.right && (o.moveTo(h + i, d), o.lineTo(h + i, d + r)), u.walls.bottom && (o.moveTo(h + i, d + r), o.lineTo(h, d + r)), u.walls.left && (o.moveTo(h, d + r), o.lineTo(h, d));
1581
+ function uo(t, e) {
1582
+ const { ctx: o, maze: n } = t, { cellWidth: i, cellHeight: r, padding: s, wallColor: l, wallWidth: c } = e;
1583
+ o.save(), o.strokeStyle = l, o.lineWidth = c, o.lineCap = "round", o.beginPath();
1584
+ for (let a = 0; a < n.rows; a++)
1585
+ for (let d = 0; d < n.cols; d++) {
1586
+ const u = n.grid[a][d], _ = s + d * i, h = s + a * r;
1587
+ u.walls.top && (o.moveTo(_, h), o.lineTo(_ + i, h)), u.walls.right && (o.moveTo(_ + i, h), o.lineTo(_ + i, h + r)), u.walls.bottom && (o.moveTo(_ + i, h + r), o.lineTo(_, h + r)), u.walls.left && (o.moveTo(_, h + r), o.lineTo(_, h));
1887
1588
  }
1888
1589
  o.stroke(), o.restore();
1889
1590
  }
1890
- function qo(e, t) {
1891
- const { ctx: o, playerPosition: n } = e, { cellWidth: i, cellHeight: r, padding: s, playerColor: l } = t, { x: a, y: c } = q(
1591
+ function ho(t, e) {
1592
+ const { ctx: o, playerPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, playerColor: l } = e, { x: c, y: a } = W(
1892
1593
  n.row,
1893
1594
  n.col,
1894
1595
  i,
1895
1596
  r,
1896
1597
  s
1897
- ), _ = Math.min(i, r) * 0.35;
1898
- o.save(), o.fillStyle = l, o.beginPath(), o.arc(a, c, _, 0, Math.PI * 2), o.fill(), o.restore();
1598
+ ), d = Math.min(i, r) * 0.35;
1599
+ o.save(), o.fillStyle = l, o.beginPath(), o.arc(c, a, d, 0, Math.PI * 2), o.fill(), o.restore();
1899
1600
  }
1900
- function Xo(e, t) {
1901
- const { ctx: o, exitPosition: n } = e, { cellWidth: i, cellHeight: r, padding: s, exitColor: l } = t, { x: a, y: c } = q(
1601
+ function _o(t, e) {
1602
+ const { ctx: o, exitPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, exitColor: l } = e, { x: c, y: a } = W(
1902
1603
  n.row,
1903
1604
  n.col,
1904
1605
  i,
1905
1606
  r,
1906
1607
  s
1907
- ), _ = Math.min(i, r) * 0.35;
1908
- o.save(), o.fillStyle = l, o.beginPath(), o.arc(a, c, _, 0, Math.PI * 2), o.fill(), o.restore();
1608
+ ), d = Math.min(i, r) * 0.35;
1609
+ o.save(), o.fillStyle = l, o.beginPath(), o.arc(c, a, d, 0, Math.PI * 2), o.fill(), o.restore();
1909
1610
  }
1910
- function Yo(e, t) {
1911
- const { ctx: o, foodPositions: n } = e, { cellWidth: i, cellHeight: r, padding: s, foodColor: l } = t;
1611
+ function fo(t, e) {
1612
+ const { ctx: o, foodPositions: n } = t, { cellWidth: i, cellHeight: r, padding: s, foodColor: l } = e;
1912
1613
  o.fillStyle = l;
1913
- const a = Math.min(i, r) * 0.25;
1914
- n.forEach((c) => {
1915
- const { x: _, y: u } = q(
1916
- c.row,
1917
- c.col,
1614
+ const c = Math.min(i, r) * 0.25;
1615
+ n.forEach((a) => {
1616
+ const { x: d, y: u } = W(
1617
+ a.row,
1618
+ a.col,
1918
1619
  i,
1919
1620
  r,
1920
1621
  s
1921
1622
  );
1922
- Jo(o, _, u, a * 1.2, 5, a * 0.6);
1623
+ mo(o, d, u, c * 1.2, 5, c * 0.6);
1923
1624
  });
1924
1625
  }
1925
- function Jo(e, t, o, n, i, r) {
1926
- e.save(), e.beginPath();
1626
+ function mo(t, e, o, n, i, r) {
1627
+ t.save(), t.beginPath();
1927
1628
  for (let s = 0; s < i * 2; s++) {
1928
- const l = s % 2 === 0 ? n : r, a = Math.PI * s / i;
1929
- e.lineTo(t + l * Math.sin(a), o + l * Math.cos(a));
1629
+ const l = s % 2 === 0 ? n : r, c = Math.PI * s / i;
1630
+ t.lineTo(e + l * Math.sin(c), o + l * Math.cos(c));
1930
1631
  }
1931
- e.closePath(), e.fill(), e.restore();
1632
+ t.closePath(), t.fill(), t.restore();
1932
1633
  }
1933
- function Ko(e, t) {
1934
- const { ctx: o, playerPath: n, visitCounts: i } = e, { cellWidth: r, cellHeight: s, padding: l, clueColor: a } = t;
1634
+ function vo(t, e) {
1635
+ const { ctx: o, playerPath: n, visitCounts: i } = t, { cellWidth: r, cellHeight: s, padding: l, clueColor: c } = e;
1935
1636
  if (!(!n || n.length < 2 || !i)) {
1936
1637
  o.save();
1937
- for (let c = 1; c < n.length; c++) {
1938
- const _ = n[c - 1], u = n[c], h = `${_.row},${_.col}-${u.row},${u.col}`, d = `${u.row},${u.col}-${_.row},${_.col}`, f = (i[h] || 0) + (i[d] || 0), g = Math.min(0.2 + f * 0.1, 0.9), v = Math.max(3, r * 0.1) + f * 0.5;
1638
+ for (let a = 1; a < n.length; a++) {
1639
+ const d = n[a - 1], u = n[a], _ = `${d.row},${d.col}-${u.row},${u.col}`, h = `${u.row},${u.col}-${d.row},${d.col}`, v = (i[_] || 0) + (i[h] || 0), g = Math.min(0.2 + v * 0.1, 0.9), p = Math.max(3, r * 0.1) + v * 0.5;
1939
1640
  try {
1940
- o.strokeStyle = a.replace(")", `, ${g})`).replace("rgb(", "rgba(");
1641
+ o.strokeStyle = c.replace(")", `, ${g})`).replace("rgb(", "rgba(");
1941
1642
  } catch {
1942
1643
  o.strokeStyle = `rgba(255, 0, 0, ${g})`;
1943
1644
  }
1944
- o.lineWidth = v, o.lineCap = "round", o.lineJoin = "round";
1945
- const { x: C, y: p } = q(
1946
- _.row,
1947
- _.col,
1645
+ o.lineWidth = p, o.lineCap = "round", o.lineJoin = "round";
1646
+ const { x: f, y: C } = W(
1647
+ d.row,
1648
+ d.col,
1948
1649
  r,
1949
1650
  s,
1950
1651
  l
1951
- ), { x: T, y: k } = q(
1652
+ ), { x: z, y: b } = W(
1952
1653
  u.row,
1953
1654
  u.col,
1954
1655
  r,
1955
1656
  s,
1956
1657
  l
1957
1658
  );
1958
- o.beginPath(), o.moveTo(C, p), o.lineTo(T, k), o.stroke();
1659
+ o.beginPath(), o.moveTo(f, C), o.lineTo(z, b), o.stroke();
1959
1660
  }
1960
1661
  o.restore();
1961
1662
  }
1962
1663
  }
1963
- function q(e, t, o, n, i) {
1664
+ function W(t, e, o, n, i) {
1964
1665
  return {
1965
- x: i + t * o + o / 2,
1966
- y: i + e * n + n / 2
1666
+ x: i + e * o + o / 2,
1667
+ y: i + t * n + n / 2
1967
1668
  };
1968
1669
  }
1969
- const Zo = new co(), Qo = () => {
1970
- const { message: e, visible: t, type: o, hideToast: n } = Ce();
1670
+ const go = new Vt(), po = () => {
1671
+ const { message: t, visible: e, type: o, hideToast: n } = ve();
1971
1672
  return /* @__PURE__ */ m(
1972
- Wo,
1673
+ ro,
1973
1674
  {
1974
- message: e,
1975
- visible: t,
1675
+ message: t,
1676
+ visible: e,
1976
1677
  type: o,
1977
1678
  onClose: n,
1978
1679
  position: "top"
1979
1680
  }
1980
1681
  );
1981
- }, en = () => {
1982
- const { gameState: e, setGameState: t, config: o } = _t(), n = D(null), i = D(null), r = D(e), s = o.current.i18n, { showToast: l } = Ce(), a = D(!1);
1983
- A(() => {
1984
- r.current = e;
1985
- }, [e]);
1986
- const c = () => {
1987
- const d = e.totalFoodCount - e.foodCollected - 1;
1988
- if (d > 0) {
1682
+ }, Co = () => {
1683
+ const { gameState: t, setGameState: e, config: o } = _e(), n = U(null), i = U(null), r = U(t), s = o.current.i18n, { showToast: l } = ve(), c = U(!1);
1684
+ S(() => {
1685
+ r.current = t;
1686
+ }, [t]);
1687
+ const a = () => {
1688
+ const _ = t.totalFoodCount - t.foodCollected - 1;
1689
+ if (_ > 0) {
1989
1690
  l(
1990
- s.foodCollectedToast.replace("%NUM%", d.toString()),
1691
+ s.foodCollectedToast.replace("%NUM%", _.toString()),
1991
1692
  "success"
1992
1693
  );
1993
1694
  return;
1994
1695
  }
1995
1696
  l(s.allFoodCollectedToast, "success");
1996
- }, _ = () => {
1997
- const d = e.totalFoodCount - e.foodCollected - 1;
1998
- l(
1999
- s.warnNotAllFoodCollectedToast.replace("%NUM%", d.toString()),
2000
- "warning"
2001
- );
2002
- }, u = (d, f) => {
2003
- const g = d.current?.getContext("2d");
2004
- if (!g || !f.maze || a.current) return;
2005
- a.current = !0;
2006
- const v = { ...o.current.renderConfig || {} }, p = o.current.levelConfig.flat()[f.currentLevel - 1];
2007
- p.wallWidth ? v.wallWidth = p.wallWidth : f.maze.cols > 40 && (v.wallWidth -= v.wallWidth * 0.05 * (f.maze.cols - 40), v.wallWidth = Math.max(
2008
- v.wallWidth,
2009
- v.minWallWidth
2010
- )), Bo(
1697
+ }, d = (_, h) => {
1698
+ const v = _.current?.getContext("2d");
1699
+ if (!v || !h.maze || c.current) return;
1700
+ c.current = !0;
1701
+ const g = { ...o.current.renderConfig || {} }, f = o.current.levelConfig.flat()[h.currentLevel - 1];
1702
+ g.wallWidth = f.wallWidth || g.wallWidth, co(
2011
1703
  {
2012
- ctx: g,
2013
- width: d.current.width,
2014
- height: d.current.height,
2015
- maze: f.maze,
2016
- playerPosition: f.playerPosition,
2017
- exitPosition: f.exitPosition,
2018
- foodPositions: f.foodPositions,
2019
- showClue: f.showClue,
2020
- playerPath: f.playerPath,
2021
- visitCounts: f.visitCounts,
2022
- playerAtExit: f.playerAtExit
1704
+ ctx: v,
1705
+ width: _.current.width,
1706
+ height: _.current.height,
1707
+ maze: h.maze,
1708
+ playerPosition: h.playerPosition,
1709
+ exitPosition: h.exitPosition,
1710
+ foodPositions: h.foodPositions,
1711
+ showClue: h.showClue,
1712
+ playerPath: h.playerPath,
1713
+ visitCounts: h.visitCounts,
1714
+ playerAtExit: h.playerAtExit
2023
1715
  },
2024
- v
1716
+ g
2025
1717
  ), requestAnimationFrame(() => {
2026
- a.current = !1;
1718
+ c.current = !1;
2027
1719
  });
2028
1720
  };
2029
- A(() => {
1721
+ S(() => {
2030
1722
  l(s.useArrowKeyTips, "info", 3e3);
2031
- }, []), jo(i, u, r);
2032
- const { generateCurrentLevelMaze: h } = yt({
2033
- gameState: e,
2034
- setGameState: t,
1723
+ }, []), so(i, d, r);
1724
+ const { generateCurrentLevelMaze: u } = tt({
1725
+ gameState: t,
1726
+ setGameState: e,
2035
1727
  config: o
2036
1728
  });
2037
- return Ho({
1729
+ return lo({
2038
1730
  containerRef: n,
2039
- gameState: e,
2040
- setGameState: t,
2041
- onFoodCollected: c,
2042
- onFoodNotAllCollected: _
2043
- }), Go({
2044
- gameState: e,
2045
- setGameState: t,
1731
+ gameState: t,
1732
+ setGameState: e,
1733
+ onFoodCollected: a
1734
+ }), ao({
1735
+ gameState: t,
1736
+ setGameState: e,
2046
1737
  config: o,
2047
1738
  onLevelComplete: () => {
2048
- Zo.addConfetti(), l(s.levelCompleteToast, "success");
1739
+ go.addConfetti(), l(s.levelCompleteToast, "success");
2049
1740
  },
2050
- onTierUnlocked: (d) => {
1741
+ onTierUnlocked: (_) => {
2051
1742
  l(
2052
- s.tierUnlockedToast.replace("%TIER%", d.toString()),
1743
+ s.tierUnlockedToast.replace("%TIER%", _.toString()),
2053
1744
  "success"
2054
1745
  );
2055
1746
  }
2056
- }), A(() => {
2057
- e.isGameActive && !e.levelTransitioning && h();
1747
+ }), S(() => {
1748
+ t.isGameActive && !t.levelTransitioning && u();
2058
1749
  }, [
2059
- e.currentLevel,
2060
- e.isGameActive,
2061
- e.levelTransitioning
2062
- ]), A(() => {
2063
- i.current && e.maze && u(i, e);
1750
+ t.currentLevel,
1751
+ t.isGameActive,
1752
+ t.levelTransitioning
1753
+ ]), S(() => {
1754
+ i.current && t.maze && d(i, t);
2064
1755
  }, [
2065
- e.maze,
2066
- e.playerPosition,
2067
- e.exitPosition,
2068
- e.foodPositions,
2069
- e.showClue,
2070
- e.playerPath,
2071
- e.visitCounts,
2072
- e.playerAtExit
1756
+ t.maze,
1757
+ t.playerPosition,
1758
+ t.exitPosition,
1759
+ t.foodPositions,
1760
+ t.showClue,
1761
+ t.playerPath,
1762
+ t.visitCounts,
1763
+ t.playerAtExit
2073
1764
  ]), /* @__PURE__ */ m("div", { className: "maze-game-container", children: [
2074
- /* @__PURE__ */ m(Qo, {}),
2075
- /* @__PURE__ */ m(Do, {}),
1765
+ /* @__PURE__ */ m(po, {}),
1766
+ /* @__PURE__ */ m(io, {}),
2076
1767
  /* @__PURE__ */ m("div", { className: "maze-canvas-container", ref: n, children: [
2077
1768
  /* @__PURE__ */ m("canvas", { ref: i, className: "maze-game-canvas" }),
2078
1769
  /* @__PURE__ */ m("div", { className: "maze-touch-area maze-up" }),
@@ -2082,34 +1773,34 @@ const Zo = new co(), Qo = () => {
2082
1773
  ] })
2083
1774
  ] });
2084
1775
  };
2085
- function tn() {
2086
- return /* @__PURE__ */ m(Lo, { children: /* @__PURE__ */ m(en, {}) });
2087
- }
2088
- function on({ config: e = {} }) {
2089
- const t = { ...ee.i18n, ...e.i18n || {} }, o = { ...ee.renderConfig, ...e.renderConfig || {} }, n = e.levelConfig || ye;
2090
- return e = {
2091
- ...ee,
2092
- ...e,
2093
- i18n: t,
1776
+ function wo() {
1777
+ return /* @__PURE__ */ m(Xt, { children: /* @__PURE__ */ m(Co, {}) });
1778
+ }
1779
+ function yo({ config: t = {} }) {
1780
+ const e = { ...J.i18n, ...t.i18n || {} }, o = { ...J.renderConfig, ...t.renderConfig || {} }, n = t.levelConfig || ge;
1781
+ return t = {
1782
+ ...J,
1783
+ ...t,
1784
+ i18n: e,
2094
1785
  levelConfig: n,
2095
1786
  renderConfig: o
2096
- }, /* @__PURE__ */ m(Ot, { config: e, children: /* @__PURE__ */ m(tn, {}) });
1787
+ }, /* @__PURE__ */ m(kt, { config: t, children: /* @__PURE__ */ m(wo, {}) });
2097
1788
  }
2098
- const nn = {
2099
- root: "https://unpkg.com/@roudanio/maze@0.0.6/dist/",
2100
- ...ee
1789
+ const bo = {
1790
+ root: "https://unpkg.com/@roudanio/maze@0.0.8/dist/",
1791
+ ...J
2101
1792
  };
2102
- `${JSON.stringify(nn, null, 2)}`;
2103
- const rn = {
2104
- async init(e, t) {
2105
- const o = typeof e == "string" ? document.querySelector(e) : e;
1793
+ `${JSON.stringify(bo, null, 2)}`;
1794
+ const ko = {
1795
+ async init(t, e) {
1796
+ const o = typeof t == "string" ? document.querySelector(t) : t;
2106
1797
  if (!o) {
2107
1798
  console.warn("Cannot find the root element");
2108
- const a = document.createElement("div");
2109
- a.style.textAlign = "center", a.style.padding = "20px", a.innerHTML = "Cannot find the root element", document.body.append(a);
1799
+ const c = document.createElement("div");
1800
+ c.style.textAlign = "center", c.style.padding = "20px", c.innerHTML = "Cannot find the root element", document.body.append(c);
2110
1801
  return;
2111
1802
  }
2112
- let { root: n = location.origin } = t;
1803
+ let { root: n = location.origin } = e;
2113
1804
  n.at(-1) !== "/" && (n += "/");
2114
1805
  const i = document.createElement("div"), r = document.createElement("div");
2115
1806
  i.style.cssText = `
@@ -2130,12 +1821,12 @@ const rn = {
2130
1821
  @keyframes loading {
2131
1822
  0% { width: 0%; }
2132
1823
  100% { width: 99%; }
2133
- }`, document.head.appendChild(s), await (async (a) => new Promise((c, _) => {
1824
+ }`, document.head.appendChild(s), await (async (c) => new Promise((a, d) => {
2134
1825
  const u = document.createElement("link");
2135
- u.rel = "stylesheet", u.type = "text/css", u.href = a, u.onload = c, u.onerror = _, document.head.appendChild(u);
2136
- }))(n + "maze.css"), Mt(/* @__PURE__ */ m(on, { config: t }), o);
1826
+ u.rel = "stylesheet", u.type = "text/css", u.href = c, u.onload = a, u.onerror = d, document.head.appendChild(u);
1827
+ }))(n + "maze.css"), gt(/* @__PURE__ */ m(yo, { config: e }), o);
2137
1828
  }
2138
1829
  };
2139
1830
  export {
2140
- rn as default
1831
+ ko as default
2141
1832
  };