@roudanio/maze 0.1.1 → 0.1.2
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.iife.js +3 -3
- package/dist/maze.js +765 -759
- package/dist/maze.umd.js +3 -3
- package/package.json +1 -1
package/dist/maze.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
1
|
+
var le, L, je, U, Te, Ge, He, qe, pe, fe, _e, Be, X = {}, Ve = [], lt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ae = Array.isArray;
|
|
2
2
|
function $(t, e) {
|
|
3
3
|
for (var n in e) t[n] = e[n];
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function ge(t) {
|
|
7
7
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
var o, i, s,
|
|
11
|
-
for (s in e) s == "key" ? o = e[s] : s == "ref" ? i = e[s] :
|
|
12
|
-
if (arguments.length > 2 && (
|
|
13
|
-
return
|
|
9
|
+
function at(t, e, n) {
|
|
10
|
+
var o, i, s, c = {};
|
|
11
|
+
for (s in e) s == "key" ? o = e[s] : s == "ref" ? i = e[s] : c[s] = e[s];
|
|
12
|
+
if (arguments.length > 2 && (c.children = arguments.length > 3 ? le.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) c[s] == null && (c[s] = t.defaultProps[s]);
|
|
13
|
+
return ee(t, c, o, i, null);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
var s = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++
|
|
17
|
-
return i == null &&
|
|
15
|
+
function ee(t, e, n, o, i) {
|
|
16
|
+
var s = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++je, __i: -1, __u: 0 };
|
|
17
|
+
return i == null && L.vnode != null && L.vnode(s), s;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function ce(t) {
|
|
20
20
|
return t.children;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function te(t, e) {
|
|
23
23
|
this.props = t, this.context = e;
|
|
24
24
|
}
|
|
25
25
|
function G(t, e) {
|
|
@@ -27,38 +27,38 @@ function G(t, e) {
|
|
|
27
27
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
28
28
|
return typeof t.type == "function" ? G(t) : null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Ye(t) {
|
|
31
31
|
var e, n;
|
|
32
32
|
if ((t = t.__) != null && t.__c != null) {
|
|
33
33
|
for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
|
|
34
34
|
t.__e = t.__c.base = n.__e;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return Ye(t);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
(!t.__d && (t.__d = !0) &&
|
|
40
|
+
function me(t) {
|
|
41
|
+
(!t.__d && (t.__d = !0) && U.push(t) && !ie.__r++ || Te != L.debounceRendering) && ((Te = L.debounceRendering) || Ge)(ie);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
for (var t, e, n, o, i, s,
|
|
45
|
-
|
|
43
|
+
function ie() {
|
|
44
|
+
for (var t, e, n, o, i, s, c, r = 1; U.length; ) U.length > r && U.sort(He), t = U.shift(), r = U.length, t.__d && (n = void 0, i = (o = (e = t).__v).__e, s = [], c = [], e.__P && ((n = $({}, o)).__v = o.__v + 1, L.vnode && L.vnode(n), Ce(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [i] : null, s, i ?? G(o), !!(32 & o.__u), c), n.__v = o.__v, n.__.__k[n.__i] = n, Je(s, n, c), n.__e != i && Ye(n)));
|
|
45
|
+
ie.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
var u, h,
|
|
49
|
-
for (
|
|
50
|
-
return n.__e = g,
|
|
47
|
+
function Xe(t, e, n, o, i, s, c, r, l, a, d) {
|
|
48
|
+
var u, h, f, w, g, _, v = o && o.__k || Ve, m = e.length;
|
|
49
|
+
for (l = ct(n, e, v, l, m), u = 0; u < m; u++) (f = n.__k[u]) != null && (h = f.__i == -1 ? X : v[f.__i] || X, f.__i = u, _ = Ce(t, f, h, i, s, c, r, l, a, d), w = f.__e, f.ref && h.ref != f.ref && (h.ref && we(h.ref, null, f), d.push(f.ref, f.__c || w, f)), g == null && w != null && (g = w), 4 & f.__u || h.__k === f.__k ? l = Ke(f, l, t) : typeof f.type == "function" && _ !== void 0 ? l = _ : w && (l = w.nextSibling), f.__u &= -7);
|
|
50
|
+
return n.__e = g, l;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
var s,
|
|
54
|
-
for (t.__k = new Array(i), s = 0; s < i; s++) (
|
|
55
|
-
if (u) for (s = 0; s < d; s++) (r = n[s]) != null && (2 & r.__u) == 0 && (r.__e == o && (o = G(r)),
|
|
52
|
+
function ct(t, e, n, o, i) {
|
|
53
|
+
var s, c, r, l, a, d = n.length, u = d, h = 0;
|
|
54
|
+
for (t.__k = new Array(i), s = 0; s < i; s++) (c = e[s]) != null && typeof c != "boolean" && typeof c != "function" ? (l = s + h, (c = t.__k[s] = typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? ee(null, c, null, null, null) : ae(c) ? ee(ce, { children: c }, null, null, null) : c.constructor == null && c.__b > 0 ? ee(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : c).__ = t, c.__b = t.__b + 1, r = null, (a = c.__i = ut(c, n, l, u)) != -1 && (u--, (r = n[a]) && (r.__u |= 2)), r == null || r.__v == null ? (a == -1 && (i > d ? h-- : i < d && h++), typeof c.type != "function" && (c.__u |= 4)) : a != l && (a == l - 1 ? h-- : a == l + 1 ? h++ : (a > l ? h-- : h++, c.__u |= 4))) : t.__k[s] = null;
|
|
55
|
+
if (u) for (s = 0; s < d; s++) (r = n[s]) != null && (2 & r.__u) == 0 && (r.__e == o && (o = G(r)), Qe(r, r));
|
|
56
56
|
return o;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ke(t, e, n) {
|
|
59
59
|
var o, i;
|
|
60
60
|
if (typeof t.type == "function") {
|
|
61
|
-
for (o = t.__k, i = 0; o && i < o.length; i++) o[i] && (o[i].__ = t, e =
|
|
61
|
+
for (o = t.__k, i = 0; o && i < o.length; i++) o[i] && (o[i].__ = t, e = Ke(o[i], e, n));
|
|
62
62
|
return e;
|
|
63
63
|
}
|
|
64
64
|
t.__e != e && (e && t.type && !n.contains(e) && (e = G(t)), n.insertBefore(t.__e, e || null), e = t.__e);
|
|
@@ -67,32 +67,32 @@ function Ye(t, e, n) {
|
|
|
67
67
|
while (e != null && e.nodeType == 8);
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
var i, s,
|
|
72
|
-
if (
|
|
73
|
-
if (o > (
|
|
70
|
+
function ut(t, e, n, o) {
|
|
71
|
+
var i, s, c = t.key, r = t.type, l = e[n];
|
|
72
|
+
if (l === null && t.key == null || l && c == l.key && r == l.type && (2 & l.__u) == 0) return n;
|
|
73
|
+
if (o > (l != null && (2 & l.__u) == 0 ? 1 : 0)) for (i = n - 1, s = n + 1; i >= 0 || s < e.length; ) {
|
|
74
74
|
if (i >= 0) {
|
|
75
|
-
if ((
|
|
75
|
+
if ((l = e[i]) && (2 & l.__u) == 0 && c == l.key && r == l.type) return i;
|
|
76
76
|
i--;
|
|
77
77
|
}
|
|
78
78
|
if (s < e.length) {
|
|
79
|
-
if ((
|
|
79
|
+
if ((l = e[s]) && (2 & l.__u) == 0 && c == l.key && r == l.type) return s;
|
|
80
80
|
s++;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
return -1;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" ||
|
|
85
|
+
function Se(t, e, n) {
|
|
86
|
+
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || lt.test(e) ? n : n + "px";
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Z(t, e, n, o, i) {
|
|
89
89
|
var s;
|
|
90
90
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
91
91
|
else {
|
|
92
|
-
if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n ||
|
|
93
|
-
if (n) for (e in n) o && n[e] == o[e] ||
|
|
92
|
+
if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || Se(t.style, e, "");
|
|
93
|
+
if (n) for (e in n) o && n[e] == o[e] || Se(t.style, e, n[e]);
|
|
94
94
|
}
|
|
95
|
-
else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(
|
|
95
|
+
else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(qe, "$1")), e = e.toLowerCase() in t || e == "onFocusOut" || e == "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = n, n ? o ? n.u = o.u : (n.u = pe, t.addEventListener(e, s ? _e : fe, s)) : t.removeEventListener(e, s ? _e : fe, s);
|
|
96
96
|
else {
|
|
97
97
|
if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
98
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 {
|
|
@@ -103,127 +103,127 @@ function J(t, e, n, o, i) {
|
|
|
103
103
|
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function ze(t) {
|
|
107
107
|
return function(e) {
|
|
108
108
|
if (this.l) {
|
|
109
109
|
var n = this.l[e.type + t];
|
|
110
|
-
if (e.t == null) e.t =
|
|
110
|
+
if (e.t == null) e.t = pe++;
|
|
111
111
|
else if (e.t < n.u) return;
|
|
112
|
-
return n(
|
|
112
|
+
return n(L.event ? L.event(e) : e);
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
var d, u, h,
|
|
116
|
+
function Ce(t, e, n, o, i, s, c, r, l, a) {
|
|
117
|
+
var d, u, h, f, w, g, _, v, m, y, C, k, T, z, S, b, E, N = e.type;
|
|
118
118
|
if (e.constructor != null) return null;
|
|
119
|
-
128 & n.__u && (
|
|
120
|
-
e: if (typeof
|
|
121
|
-
if (
|
|
119
|
+
128 & n.__u && (l = !!(32 & n.__u), s = [r = e.__e = n.__e]), (d = L.__b) && d(e);
|
|
120
|
+
e: if (typeof N == "function") try {
|
|
121
|
+
if (v = e.props, m = "prototype" in N && N.prototype.render, y = (d = N.contextType) && o[d.__c], C = d ? y ? y.props.value : d.__ : o, n.__c ? _ = (u = e.__c = n.__c).__ = u.__E : (m ? e.__c = u = new N(v, C) : (e.__c = u = new te(v, C), u.constructor = N, u.render = ht), y && y.sub(u), u.props = v, u.state || (u.state = {}), u.context = C, u.__n = o, h = u.__d = !0, u.__h = [], u._sb = []), m && u.__s == null && (u.__s = u.state), m && N.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = $({}, u.__s)), $(u.__s, N.getDerivedStateFromProps(v, u.__s))), f = u.props, w = u.state, u.__v = e, h) m && N.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), m && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
122
122
|
else {
|
|
123
|
-
if (
|
|
124
|
-
for (e.__v != n.__v && (u.props =
|
|
123
|
+
if (m && N.getDerivedStateFromProps == null && v !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(v, C), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(v, u.__s, C) === !1 || e.__v == n.__v) {
|
|
124
|
+
for (e.__v != n.__v && (u.props = v, u.state = u.__s, u.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(P) {
|
|
125
125
|
P && (P.__ = e);
|
|
126
|
-
}),
|
|
127
|
-
u._sb = [], u.__h.length &&
|
|
126
|
+
}), k = 0; k < u._sb.length; k++) u.__h.push(u._sb[k]);
|
|
127
|
+
u._sb = [], u.__h.length && c.push(u);
|
|
128
128
|
break e;
|
|
129
129
|
}
|
|
130
|
-
u.componentWillUpdate != null && u.componentWillUpdate(
|
|
131
|
-
u.componentDidUpdate(
|
|
130
|
+
u.componentWillUpdate != null && u.componentWillUpdate(v, u.__s, C), m && u.componentDidUpdate != null && u.__h.push(function() {
|
|
131
|
+
u.componentDidUpdate(f, w, g);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
if (u.context =
|
|
135
|
-
for (u.state = u.__s, u.__d = !1,
|
|
134
|
+
if (u.context = C, u.props = v, u.__P = t, u.__e = !1, T = L.__r, z = 0, m) {
|
|
135
|
+
for (u.state = u.__s, u.__d = !1, T && T(e), d = u.render(u.props, u.state, u.context), S = 0; S < u._sb.length; S++) u.__h.push(u._sb[S]);
|
|
136
136
|
u._sb = [];
|
|
137
137
|
} else do
|
|
138
|
-
u.__d = !1,
|
|
139
|
-
while (u.__d && ++
|
|
140
|
-
u.state = u.__s, u.getChildContext != null && (o = $($({}, o), u.getChildContext())),
|
|
138
|
+
u.__d = !1, T && T(e), d = u.render(u.props, u.state, u.context), u.state = u.__s;
|
|
139
|
+
while (u.__d && ++z < 25);
|
|
140
|
+
u.state = u.__s, u.getChildContext != null && (o = $($({}, o), u.getChildContext())), m && !h && u.getSnapshotBeforeUpdate != null && (g = u.getSnapshotBeforeUpdate(f, w)), b = d, d != null && d.type === ce && d.key == null && (b = Ze(d.props.children)), r = Xe(t, ae(b) ? b : [b], e, n, o, i, s, c, r, l, a), u.base = e.__e, e.__u &= -161, u.__h.length && c.push(u), _ && (u.__E = u.__ = null);
|
|
141
141
|
} catch (P) {
|
|
142
|
-
if (e.__v = null,
|
|
143
|
-
for (e.__u |=
|
|
142
|
+
if (e.__v = null, l || s != null) if (P.then) {
|
|
143
|
+
for (e.__u |= l ? 160 : 128; r && r.nodeType == 8 && r.nextSibling; ) r = r.nextSibling;
|
|
144
144
|
s[s.indexOf(r)] = null, e.__e = r;
|
|
145
|
-
} else for (
|
|
145
|
+
} else for (E = s.length; E--; ) ge(s[E]);
|
|
146
146
|
else e.__e = n.__e, e.__k = n.__k;
|
|
147
|
-
|
|
147
|
+
L.__e(P, e, n);
|
|
148
148
|
}
|
|
149
|
-
else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : r = e.__e =
|
|
150
|
-
return (d =
|
|
149
|
+
else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : r = e.__e = dt(n.__e, e, n, o, i, s, c, l, a);
|
|
150
|
+
return (d = L.diffed) && d(e), 128 & e.__u ? void 0 : r;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
for (var o = 0; o < n.length; o++)
|
|
154
|
-
|
|
152
|
+
function Je(t, e, n) {
|
|
153
|
+
for (var o = 0; o < n.length; o++) we(n[o], n[++o], n[++o]);
|
|
154
|
+
L.__c && L.__c(e, t), t.some(function(i) {
|
|
155
155
|
try {
|
|
156
156
|
t = i.__h, i.__h = [], t.some(function(s) {
|
|
157
157
|
s.call(i);
|
|
158
158
|
});
|
|
159
159
|
} catch (s) {
|
|
160
|
-
|
|
160
|
+
L.__e(s, i.__v);
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t :
|
|
164
|
+
function Ze(t) {
|
|
165
|
+
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : ae(t) ? t.map(Ze) : $({}, t);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
var
|
|
169
|
-
if (
|
|
170
|
-
for (
|
|
171
|
-
t =
|
|
167
|
+
function dt(t, e, n, o, i, s, c, r, l) {
|
|
168
|
+
var a, d, u, h, f, w, g, _ = n.props, v = e.props, m = e.type;
|
|
169
|
+
if (m == "svg" ? i = "http://www.w3.org/2000/svg" : m == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) {
|
|
170
|
+
for (a = 0; a < s.length; a++) if ((f = s[a]) && "setAttribute" in f == !!m && (m ? f.localName == m : f.nodeType == 3)) {
|
|
171
|
+
t = f, s[a] = null;
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
if (t == null) {
|
|
176
|
-
if (
|
|
177
|
-
t = document.createElementNS(i,
|
|
176
|
+
if (m == null) return document.createTextNode(v);
|
|
177
|
+
t = document.createElementNS(i, m, v.is && v), r && (L.__m && L.__m(e, s), r = !1), s = null;
|
|
178
178
|
}
|
|
179
|
-
if (
|
|
179
|
+
if (m == null) _ === v || r && t.data == v || (t.data = v);
|
|
180
180
|
else {
|
|
181
|
-
if (s = s &&
|
|
182
|
-
for (
|
|
183
|
-
if (
|
|
184
|
-
else if (!(
|
|
185
|
-
if (
|
|
186
|
-
|
|
181
|
+
if (s = s && le.call(t.childNodes), _ = n.props || X, !r && s != null) for (_ = {}, a = 0; a < t.attributes.length; a++) _[(f = t.attributes[a]).name] = f.value;
|
|
182
|
+
for (a in _) if (f = _[a], a != "children") {
|
|
183
|
+
if (a == "dangerouslySetInnerHTML") u = f;
|
|
184
|
+
else if (!(a in v)) {
|
|
185
|
+
if (a == "value" && "defaultValue" in v || a == "checked" && "defaultChecked" in v) continue;
|
|
186
|
+
Z(t, a, null, f, i);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
for (
|
|
189
|
+
for (a in v) f = v[a], a == "children" ? h = f : a == "dangerouslySetInnerHTML" ? d = f : a == "value" ? w = f : a == "checked" ? g = f : r && typeof f != "function" || _[a] === f || Z(t, a, f, _[a], i);
|
|
190
190
|
if (d) r || u && (d.__html == u.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
|
|
191
|
-
else if (u && (t.innerHTML = ""),
|
|
192
|
-
r || (
|
|
191
|
+
else if (u && (t.innerHTML = ""), Xe(e.type == "template" ? t.content : t, ae(h) ? h : [h], e, n, o, m == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, c, s ? s[0] : n.__k && G(n, 0), r, l), s != null) for (a = s.length; a--; ) ge(s[a]);
|
|
192
|
+
r || (a = "value", m == "progress" && w == null ? t.removeAttribute("value") : w != null && (w !== t[a] || m == "progress" && !w || m == "option" && w != _[a]) && Z(t, a, w, _[a], i), a = "checked", g != null && g != t[a] && Z(t, a, g, _[a], i));
|
|
193
193
|
}
|
|
194
194
|
return t;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function we(t, e, n) {
|
|
197
197
|
try {
|
|
198
198
|
if (typeof t == "function") {
|
|
199
199
|
var o = typeof t.__u == "function";
|
|
200
200
|
o && t.__u(), o && e == null || (t.__u = t(e));
|
|
201
201
|
} else t.current = e;
|
|
202
202
|
} catch (i) {
|
|
203
|
-
|
|
203
|
+
L.__e(i, n);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Qe(t, e, n) {
|
|
207
207
|
var o, i;
|
|
208
|
-
if (
|
|
208
|
+
if (L.unmount && L.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || we(o, null, e)), (o = t.__c) != null) {
|
|
209
209
|
if (o.componentWillUnmount) try {
|
|
210
210
|
o.componentWillUnmount();
|
|
211
211
|
} catch (s) {
|
|
212
|
-
|
|
212
|
+
L.__e(s, e);
|
|
213
213
|
}
|
|
214
214
|
o.base = o.__P = null;
|
|
215
215
|
}
|
|
216
|
-
if (o = t.__k) for (i = 0; i < o.length; i++) o[i] &&
|
|
217
|
-
n ||
|
|
216
|
+
if (o = t.__k) for (i = 0; i < o.length; i++) o[i] && Qe(o[i], e, n || typeof t.type != "function");
|
|
217
|
+
n || ge(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function ht(t, e, n) {
|
|
220
220
|
return this.constructor(t, n);
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
var o, i, s,
|
|
224
|
-
e == document && (e = document.documentElement),
|
|
222
|
+
function ft(t, e, n) {
|
|
223
|
+
var o, i, s, c;
|
|
224
|
+
e == document && (e = document.documentElement), L.__ && L.__(t, e), i = (o = !1) ? null : e.__k, s = [], c = [], Ce(e, t = e.__k = at(ce, null, [t]), i || X, X, e.namespaceURI, i ? null : e.firstChild ? le.call(e.childNodes) : null, s, i ? i.__e : e.firstChild, o, c), Je(s, t, c);
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function _t(t) {
|
|
227
227
|
function e(n) {
|
|
228
228
|
var o, i;
|
|
229
229
|
return this.getChildContext || (o = /* @__PURE__ */ new Set(), (i = {})[e.__c] = this, this.getChildContext = function() {
|
|
@@ -231,180 +231,180 @@ function ht(t) {
|
|
|
231
231
|
}, this.componentWillUnmount = function() {
|
|
232
232
|
o = null;
|
|
233
233
|
}, this.shouldComponentUpdate = function(s) {
|
|
234
|
-
this.props.value != s.value && o.forEach(function(
|
|
235
|
-
|
|
234
|
+
this.props.value != s.value && o.forEach(function(c) {
|
|
235
|
+
c.__e = !0, me(c);
|
|
236
236
|
});
|
|
237
237
|
}, this.sub = function(s) {
|
|
238
238
|
o.add(s);
|
|
239
|
-
var
|
|
239
|
+
var c = s.componentWillUnmount;
|
|
240
240
|
s.componentWillUnmount = function() {
|
|
241
|
-
o && o.delete(s),
|
|
241
|
+
o && o.delete(s), c && c.call(s);
|
|
242
242
|
};
|
|
243
243
|
}), n.children;
|
|
244
244
|
}
|
|
245
|
-
return e.__c = "__cC" +
|
|
245
|
+
return e.__c = "__cC" + Be++, e.__ = t, e.Provider = e.__l = (e.Consumer = function(n, o) {
|
|
246
246
|
return n.children(o);
|
|
247
247
|
}).contextType = e, e;
|
|
248
248
|
}
|
|
249
|
-
|
|
250
|
-
for (var i, s,
|
|
251
|
-
if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)),
|
|
249
|
+
le = Ve.slice, L = { __e: function(t, e, n, o) {
|
|
250
|
+
for (var i, s, c; e = e.__; ) if ((i = e.__c) && !i.__) try {
|
|
251
|
+
if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), c = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, o || {}), c = i.__d), c) return i.__E = i;
|
|
252
252
|
} catch (r) {
|
|
253
253
|
t = r;
|
|
254
254
|
}
|
|
255
255
|
throw t;
|
|
256
|
-
} },
|
|
256
|
+
} }, je = 0, te.prototype.setState = function(t, e) {
|
|
257
257
|
var n;
|
|
258
|
-
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = $({}, this.state), typeof t == "function" && (t = t($({}, n), this.props)), t && $(n, t), t != null && this.__v && (e && this._sb.push(e),
|
|
259
|
-
},
|
|
260
|
-
this.__v && (this.__e = !0, t && this.__h.push(t),
|
|
261
|
-
},
|
|
258
|
+
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = $({}, this.state), typeof t == "function" && (t = t($({}, n), this.props)), t && $(n, t), t != null && this.__v && (e && this._sb.push(e), me(this));
|
|
259
|
+
}, te.prototype.forceUpdate = function(t) {
|
|
260
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), me(this));
|
|
261
|
+
}, te.prototype.render = ce, U = [], Ge = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, He = function(t, e) {
|
|
262
262
|
return t.__v.__b - e.__v.__b;
|
|
263
|
-
},
|
|
264
|
-
var
|
|
265
|
-
function
|
|
263
|
+
}, ie.__r = 0, qe = /(PointerCapture)$|Capture$/i, pe = 0, fe = ze(!1), _e = ze(!0), Be = 0;
|
|
264
|
+
var mt = 0;
|
|
265
|
+
function p(t, e, n, o, i, s) {
|
|
266
266
|
e || (e = {});
|
|
267
|
-
var
|
|
268
|
-
if ("ref" in
|
|
269
|
-
var
|
|
270
|
-
if (typeof t == "function" && (
|
|
271
|
-
return
|
|
272
|
-
}
|
|
273
|
-
var H,
|
|
274
|
-
function
|
|
275
|
-
M.__h && M.__h(
|
|
276
|
-
var n =
|
|
267
|
+
var c, r, l = e;
|
|
268
|
+
if ("ref" in l) for (r in l = {}, e) r == "ref" ? c = e[r] : l[r] = e[r];
|
|
269
|
+
var a = { type: t, props: l, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --mt, __i: -1, __u: 0, __source: i, __self: s };
|
|
270
|
+
if (typeof t == "function" && (c = t.defaultProps)) for (r in c) l[r] === void 0 && (l[r] = c[r]);
|
|
271
|
+
return L.vnode && L.vnode(a), a;
|
|
272
|
+
}
|
|
273
|
+
var H, A, he, Le, K = 0, et = [], M = L, Ne = M.__b, Ae = M.__r, Ee = M.diffed, Me = M.__c, Pe = M.unmount, Ie = M.__;
|
|
274
|
+
function ue(t, e) {
|
|
275
|
+
M.__h && M.__h(A, t, K || e), K = 0;
|
|
276
|
+
var n = A.__H || (A.__H = { __: [], __h: [] });
|
|
277
277
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
278
278
|
}
|
|
279
279
|
function j(t) {
|
|
280
|
-
return
|
|
281
|
-
}
|
|
282
|
-
function
|
|
283
|
-
var o =
|
|
284
|
-
if (o.t = t, !o.__c && (o.__ = [
|
|
285
|
-
var
|
|
286
|
-
|
|
287
|
-
}], o.__c =
|
|
288
|
-
var i = function(r,
|
|
280
|
+
return K = 1, vt(nt, t);
|
|
281
|
+
}
|
|
282
|
+
function vt(t, e, n) {
|
|
283
|
+
var o = ue(H++, 2);
|
|
284
|
+
if (o.t = t, !o.__c && (o.__ = [nt(void 0, e), function(r) {
|
|
285
|
+
var l = o.__N ? o.__N[0] : o.__[0], a = o.t(l, r);
|
|
286
|
+
l !== a && (o.__N = [a, o.__[1]], o.__c.setState({}));
|
|
287
|
+
}], o.__c = A, !A.__f)) {
|
|
288
|
+
var i = function(r, l, a) {
|
|
289
289
|
if (!o.__c.__H) return !0;
|
|
290
290
|
var d = o.__c.__H.__.filter(function(h) {
|
|
291
291
|
return !!h.__c;
|
|
292
292
|
});
|
|
293
293
|
if (d.every(function(h) {
|
|
294
294
|
return !h.__N;
|
|
295
|
-
})) return !s || s.call(this, r,
|
|
295
|
+
})) return !s || s.call(this, r, l, a);
|
|
296
296
|
var u = o.__c.props !== r;
|
|
297
297
|
return d.forEach(function(h) {
|
|
298
298
|
if (h.__N) {
|
|
299
|
-
var
|
|
300
|
-
h.__ = h.__N, h.__N = void 0,
|
|
299
|
+
var f = h.__[0];
|
|
300
|
+
h.__ = h.__N, h.__N = void 0, f !== h.__[0] && (u = !0);
|
|
301
301
|
}
|
|
302
|
-
}), s && s.call(this, r,
|
|
302
|
+
}), s && s.call(this, r, l, a) || u;
|
|
303
303
|
};
|
|
304
|
-
|
|
305
|
-
var s =
|
|
306
|
-
|
|
304
|
+
A.__f = !0;
|
|
305
|
+
var s = A.shouldComponentUpdate, c = A.componentWillUpdate;
|
|
306
|
+
A.componentWillUpdate = function(r, l, a) {
|
|
307
307
|
if (this.__e) {
|
|
308
308
|
var d = s;
|
|
309
|
-
s = void 0, i(r,
|
|
309
|
+
s = void 0, i(r, l, a), s = d;
|
|
310
310
|
}
|
|
311
|
-
|
|
312
|
-
},
|
|
311
|
+
c && c.call(this, r, l, a);
|
|
312
|
+
}, A.shouldComponentUpdate = i;
|
|
313
313
|
}
|
|
314
314
|
return o.__N || o.__;
|
|
315
315
|
}
|
|
316
316
|
function x(t, e) {
|
|
317
|
-
var n =
|
|
318
|
-
!M.__s &&
|
|
317
|
+
var n = ue(H++, 3);
|
|
318
|
+
!M.__s && tt(n.__H, e) && (n.__ = t, n.u = e, A.__H.__h.push(n));
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
return
|
|
320
|
+
function F(t) {
|
|
321
|
+
return K = 5, q(function() {
|
|
322
322
|
return { current: t };
|
|
323
323
|
}, []);
|
|
324
324
|
}
|
|
325
325
|
function q(t, e) {
|
|
326
|
-
var n =
|
|
327
|
-
return
|
|
326
|
+
var n = ue(H++, 7);
|
|
327
|
+
return tt(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
|
|
328
328
|
}
|
|
329
|
-
function
|
|
330
|
-
return
|
|
329
|
+
function pt(t, e) {
|
|
330
|
+
return K = 8, q(function() {
|
|
331
331
|
return t;
|
|
332
332
|
}, e);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
var e =
|
|
336
|
-
return n.c = t, e ? (n.__ == null && (n.__ = !0, e.sub(
|
|
334
|
+
function gt(t) {
|
|
335
|
+
var e = A.context[t.__c], n = ue(H++, 9);
|
|
336
|
+
return n.c = t, e ? (n.__ == null && (n.__ = !0, e.sub(A)), e.props.value) : t.__;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
for (var t; t =
|
|
340
|
-
t.__H.__h.forEach(
|
|
338
|
+
function Ct() {
|
|
339
|
+
for (var t; t = et.shift(); ) if (t.__P && t.__H) try {
|
|
340
|
+
t.__H.__h.forEach(ne), t.__H.__h.forEach(ve), t.__H.__h = [];
|
|
341
341
|
} catch (e) {
|
|
342
342
|
t.__H.__h = [], M.__e(e, t.__v);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
M.__b = function(t) {
|
|
346
|
-
|
|
346
|
+
A = null, Ne && Ne(t);
|
|
347
347
|
}, M.__ = function(t, e) {
|
|
348
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
348
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Ie && Ie(t, e);
|
|
349
349
|
}, M.__r = function(t) {
|
|
350
|
-
|
|
351
|
-
var e = (
|
|
352
|
-
e && (
|
|
350
|
+
Ae && Ae(t), H = 0;
|
|
351
|
+
var e = (A = t.__c).__H;
|
|
352
|
+
e && (he === A ? (e.__h = [], A.__h = [], e.__.forEach(function(n) {
|
|
353
353
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
354
|
-
})) : (e.__h.forEach(
|
|
354
|
+
})) : (e.__h.forEach(ne), e.__h.forEach(ve), e.__h = [], H = 0)), he = A;
|
|
355
355
|
}, M.diffed = function(t) {
|
|
356
|
-
|
|
356
|
+
Ee && Ee(t);
|
|
357
357
|
var e = t.__c;
|
|
358
|
-
e && e.__H && (e.__H.__h.length && (
|
|
358
|
+
e && e.__H && (e.__H.__h.length && (et.push(e) !== 1 && Le === M.requestAnimationFrame || ((Le = M.requestAnimationFrame) || wt)(Ct)), e.__H.__.forEach(function(n) {
|
|
359
359
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
360
|
-
})),
|
|
360
|
+
})), he = A = null;
|
|
361
361
|
}, M.__c = function(t, e) {
|
|
362
362
|
e.some(function(n) {
|
|
363
363
|
try {
|
|
364
|
-
n.__h.forEach(
|
|
365
|
-
return !o.__ ||
|
|
364
|
+
n.__h.forEach(ne), n.__h = n.__h.filter(function(o) {
|
|
365
|
+
return !o.__ || ve(o);
|
|
366
366
|
});
|
|
367
367
|
} catch (o) {
|
|
368
368
|
e.some(function(i) {
|
|
369
369
|
i.__h && (i.__h = []);
|
|
370
370
|
}), e = [], M.__e(o, n.__v);
|
|
371
371
|
}
|
|
372
|
-
}),
|
|
372
|
+
}), Me && Me(t, e);
|
|
373
373
|
}, M.unmount = function(t) {
|
|
374
|
-
|
|
374
|
+
Pe && Pe(t);
|
|
375
375
|
var e, n = t.__c;
|
|
376
376
|
n && n.__H && (n.__H.__.forEach(function(o) {
|
|
377
377
|
try {
|
|
378
|
-
|
|
378
|
+
ne(o);
|
|
379
379
|
} catch (i) {
|
|
380
380
|
e = i;
|
|
381
381
|
}
|
|
382
382
|
}), n.__H = void 0, e && M.__e(e, n.__v));
|
|
383
383
|
};
|
|
384
|
-
var
|
|
385
|
-
function
|
|
384
|
+
var xe = typeof requestAnimationFrame == "function";
|
|
385
|
+
function wt(t) {
|
|
386
386
|
var e, n = function() {
|
|
387
|
-
clearTimeout(o),
|
|
387
|
+
clearTimeout(o), xe && cancelAnimationFrame(e), setTimeout(t);
|
|
388
388
|
}, o = setTimeout(n, 100);
|
|
389
|
-
|
|
389
|
+
xe && (e = requestAnimationFrame(n));
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
var e =
|
|
393
|
-
typeof n == "function" && (t.__c = void 0, n()),
|
|
391
|
+
function ne(t) {
|
|
392
|
+
var e = A, n = t.__c;
|
|
393
|
+
typeof n == "function" && (t.__c = void 0, n()), A = e;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
var e =
|
|
397
|
-
t.__c = t.__(),
|
|
395
|
+
function ve(t) {
|
|
396
|
+
var e = A;
|
|
397
|
+
t.__c = t.__(), A = e;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function tt(t, e) {
|
|
400
400
|
return !t || t.length !== e.length || e.some(function(n, o) {
|
|
401
401
|
return n !== t[o];
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function nt(t, e) {
|
|
405
405
|
return typeof e == "function" ? e(t) : e;
|
|
406
406
|
}
|
|
407
|
-
const
|
|
407
|
+
const yt = (t) => ({
|
|
408
408
|
saveGameData(e) {
|
|
409
409
|
try {
|
|
410
410
|
localStorage.setItem(t, JSON.stringify(e));
|
|
@@ -427,14 +427,14 @@ const Ct = (t) => ({
|
|
|
427
427
|
console.error("Failed to reset maze game data:", e);
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
}),
|
|
430
|
+
}), ot = _t(void 0), De = {
|
|
431
431
|
currentLevel: 1,
|
|
432
432
|
highestUnlockedLevel: 1,
|
|
433
433
|
currentTier: 1,
|
|
434
434
|
highestUnlockedTier: 1,
|
|
435
435
|
levelScores: {},
|
|
436
436
|
totalScore: 0
|
|
437
|
-
},
|
|
437
|
+
}, Fe = {
|
|
438
438
|
isGameActive: !0,
|
|
439
439
|
levelTransitioning: !1,
|
|
440
440
|
maze: null,
|
|
@@ -447,11 +447,11 @@ const Ct = (t) => ({
|
|
|
447
447
|
showClue: !1,
|
|
448
448
|
playerPath: [],
|
|
449
449
|
visitCounts: {}
|
|
450
|
-
},
|
|
451
|
-
const n =
|
|
450
|
+
}, bt = ({ children: t, config: e }) => {
|
|
451
|
+
const n = yt(e.lcPrefix + "progress"), o = n.loadGameData(), [i, s] = j(() => o || { ...De });
|
|
452
452
|
x(() => {
|
|
453
453
|
const u = Object.values(i.levelScores).reduce(
|
|
454
|
-
(h,
|
|
454
|
+
(h, f) => h + f,
|
|
455
455
|
0
|
|
456
456
|
);
|
|
457
457
|
s((h) => ({
|
|
@@ -468,114 +468,114 @@ const Ct = (t) => ({
|
|
|
468
468
|
i.levelScores,
|
|
469
469
|
i.totalScore
|
|
470
470
|
]);
|
|
471
|
-
const [
|
|
472
|
-
...
|
|
473
|
-
}),
|
|
471
|
+
const [c, r] = j({
|
|
472
|
+
...Fe
|
|
473
|
+
}), l = F(c);
|
|
474
474
|
x(() => {
|
|
475
|
-
|
|
476
|
-
}, [
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
475
|
+
l.current = c;
|
|
476
|
+
}, [c]);
|
|
477
|
+
const a = q(() => [
|
|
478
|
+
c.playerAtExit ? 1 : 0,
|
|
479
|
+
c.foodCollected === c.totalFoodCount ? 1 : 0,
|
|
480
|
+
c.showClue ? 0 : 1
|
|
481
481
|
], [
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
482
|
+
c.playerAtExit,
|
|
483
|
+
c.foodCollected,
|
|
484
|
+
c.totalFoodCount,
|
|
485
|
+
c.showClue
|
|
486
486
|
]), d = () => {
|
|
487
487
|
n.resetGameData(), s({
|
|
488
|
-
...
|
|
488
|
+
...De
|
|
489
489
|
}), r({
|
|
490
|
-
...
|
|
490
|
+
...Fe
|
|
491
491
|
});
|
|
492
492
|
};
|
|
493
|
-
return /* @__PURE__ */
|
|
494
|
-
|
|
493
|
+
return /* @__PURE__ */ p(
|
|
494
|
+
ot.Provider,
|
|
495
495
|
{
|
|
496
496
|
value: {
|
|
497
497
|
gameProgress: i,
|
|
498
498
|
setGameProgress: s,
|
|
499
|
-
gamePlayState:
|
|
499
|
+
gamePlayState: c,
|
|
500
500
|
setGamePlayState: r,
|
|
501
|
-
gamePlayStateRef:
|
|
502
|
-
currentScore:
|
|
501
|
+
gamePlayStateRef: l,
|
|
502
|
+
currentScore: a,
|
|
503
503
|
config: e,
|
|
504
504
|
resetGame: d
|
|
505
505
|
},
|
|
506
506
|
children: t
|
|
507
507
|
}
|
|
508
508
|
);
|
|
509
|
-
},
|
|
510
|
-
const t =
|
|
509
|
+
}, B = () => {
|
|
510
|
+
const t = gt(ot);
|
|
511
511
|
if (!t)
|
|
512
512
|
throw new Error("useGameContext must be used within a GameProvider");
|
|
513
513
|
return t;
|
|
514
|
-
},
|
|
515
|
-
const e = t.map((r) => r.length), n = e.reduce((r,
|
|
514
|
+
}, J = (t) => q(() => {
|
|
515
|
+
const e = t.map((r) => r.length), n = e.reduce((r, l) => r + l, 0), o = t.length, i = (r) => {
|
|
516
516
|
if (r < 1 || r > n) return 0;
|
|
517
|
-
let
|
|
518
|
-
for (let
|
|
519
|
-
if (
|
|
517
|
+
let l = 0;
|
|
518
|
+
for (let a = 0; a < e.length; a++)
|
|
519
|
+
if (l += e[a], r <= l) return a + 1;
|
|
520
520
|
return 0;
|
|
521
|
-
}, s = (r) => r < 1 || r > o ? 0 : e.slice(0, r - 1).reduce((
|
|
521
|
+
}, s = (r) => r < 1 || r > o ? 0 : e.slice(0, r - 1).reduce((l, a) => l + a, 0) + 1, c = {
|
|
522
522
|
getTotalLevels: () => n,
|
|
523
523
|
getTotalTiers: () => o,
|
|
524
524
|
getTierLevelsRange: (r) => {
|
|
525
525
|
if (r < 1 || r > o) return [0, 0];
|
|
526
|
-
const
|
|
527
|
-
return [
|
|
526
|
+
const l = s(r), a = l + e[r - 1] - 1;
|
|
527
|
+
return [l, a];
|
|
528
528
|
},
|
|
529
529
|
getTierByLevel: i,
|
|
530
530
|
getFirstLevelOfTier: s,
|
|
531
531
|
getLevelConfig: (r) => {
|
|
532
532
|
if (r < 1 || r > n) return null;
|
|
533
|
-
const
|
|
534
|
-
return t[
|
|
533
|
+
const l = i(r), a = s(l), d = r - a;
|
|
534
|
+
return t[l - 1][d];
|
|
535
535
|
},
|
|
536
536
|
getTierConfig: (r) => r < 1 || r > o ? null : t[r - 1],
|
|
537
|
-
isLevelUnlocked: (r,
|
|
538
|
-
isTierUnlocked: (r,
|
|
537
|
+
isLevelUnlocked: (r, l) => r <= l,
|
|
538
|
+
isTierUnlocked: (r, l) => r <= l,
|
|
539
539
|
getNextLevelInfo: (r) => {
|
|
540
540
|
if (r >= n) return null;
|
|
541
|
-
const
|
|
541
|
+
const l = r + 1, a = i(r), d = i(l);
|
|
542
542
|
return {
|
|
543
|
-
nextLevel:
|
|
543
|
+
nextLevel: l,
|
|
544
544
|
nextTier: d,
|
|
545
|
-
isTierChange: d >
|
|
545
|
+
isTierChange: d > a
|
|
546
546
|
};
|
|
547
547
|
},
|
|
548
|
-
getCurrentTierProgress: (r,
|
|
549
|
-
const [
|
|
548
|
+
getCurrentTierProgress: (r, l) => {
|
|
549
|
+
const [a, d] = c.getTierLevelsRange(l), u = r - a + 1, h = d - a + 1;
|
|
550
550
|
return { current: u, total: h };
|
|
551
551
|
},
|
|
552
552
|
isLastLevelInTier: (r) => {
|
|
553
|
-
const
|
|
554
|
-
return r ===
|
|
553
|
+
const l = i(r), [, a] = c.getTierLevelsRange(l);
|
|
554
|
+
return r === a;
|
|
555
555
|
},
|
|
556
556
|
getPreviousLevelInfo: (r) => {
|
|
557
557
|
if (r <= 1) return null;
|
|
558
|
-
const
|
|
558
|
+
const l = r - 1, a = i(r), d = i(l);
|
|
559
559
|
return {
|
|
560
|
-
prevLevel:
|
|
560
|
+
prevLevel: l,
|
|
561
561
|
prevTier: d,
|
|
562
|
-
isTierChange: d <
|
|
562
|
+
isTierChange: d < a
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
565
|
};
|
|
566
|
-
return
|
|
567
|
-
}, [t]),
|
|
568
|
-
const { gameProgress: n, config: o } =
|
|
569
|
-
return /* @__PURE__ */
|
|
566
|
+
return c;
|
|
567
|
+
}, [t]), kt = ({ onTierChange: t, disabled: e }) => {
|
|
568
|
+
const { gameProgress: n, config: o } = B(), { i18n: i, levelConfig: s } = o, { currentTier: c, highestUnlockedTier: r } = n, a = J(s).getTotalTiers();
|
|
569
|
+
return /* @__PURE__ */ p("div", { className: "tier-selector", children: /* @__PURE__ */ p(
|
|
570
570
|
"select",
|
|
571
571
|
{
|
|
572
|
-
value:
|
|
572
|
+
value: c,
|
|
573
573
|
onChange: (d) => {
|
|
574
574
|
d.target && d.target.value && t(Number(d.target.value));
|
|
575
575
|
},
|
|
576
576
|
disabled: e,
|
|
577
577
|
className: "tier-dropdown",
|
|
578
|
-
children: Array.from({ length:
|
|
578
|
+
children: Array.from({ length: a }, (d, u) => u + 1).map((d) => /* @__PURE__ */ p(
|
|
579
579
|
"option",
|
|
580
580
|
{
|
|
581
581
|
value: d,
|
|
@@ -586,81 +586,81 @@ const Ct = (t) => ({
|
|
|
586
586
|
))
|
|
587
587
|
}
|
|
588
588
|
) });
|
|
589
|
-
},
|
|
590
|
-
const { gameProgress: n, config: o } =
|
|
591
|
-
const [h,
|
|
592
|
-
return Array.from({ length:
|
|
593
|
-
const
|
|
589
|
+
}, Tt = ({ onLevelChange: t, disabled: e }) => {
|
|
590
|
+
const { gameProgress: n, config: o } = B(), { i18n: i, levelConfig: s } = o, { currentTier: c, levelScores: r, currentLevel: l, highestUnlockedLevel: a } = n, d = J(s), u = q(() => {
|
|
591
|
+
const [h, f] = d.getTierLevelsRange(c);
|
|
592
|
+
return Array.from({ length: f - h + 1 }, (w, g) => {
|
|
593
|
+
const _ = h + g, v = r[_] || 0;
|
|
594
594
|
return {
|
|
595
|
-
level:
|
|
596
|
-
score:
|
|
595
|
+
level: _,
|
|
596
|
+
score: v
|
|
597
597
|
};
|
|
598
598
|
});
|
|
599
|
-
}, [
|
|
600
|
-
return /* @__PURE__ */
|
|
599
|
+
}, [c, r]);
|
|
600
|
+
return /* @__PURE__ */ p("div", { className: "level-selector", children: /* @__PURE__ */ p(
|
|
601
601
|
"select",
|
|
602
602
|
{
|
|
603
|
-
value:
|
|
603
|
+
value: l,
|
|
604
604
|
onChange: (h) => {
|
|
605
605
|
h.target && h.target.value && t(Number(h.target.value));
|
|
606
606
|
},
|
|
607
607
|
disabled: e,
|
|
608
608
|
className: "level-dropdown",
|
|
609
|
-
children: u.map(({ level: h, score:
|
|
609
|
+
children: u.map(({ level: h, score: f }) => /* @__PURE__ */ p(
|
|
610
610
|
"option",
|
|
611
611
|
{
|
|
612
612
|
value: h,
|
|
613
|
-
disabled: h >
|
|
614
|
-
children: `${i.level} ${h} ${"★".repeat(
|
|
613
|
+
disabled: h > a,
|
|
614
|
+
children: `${i.level} ${h} ${"★".repeat(f)}`
|
|
615
615
|
},
|
|
616
616
|
`level-${h}`
|
|
617
617
|
))
|
|
618
618
|
}
|
|
619
619
|
) });
|
|
620
|
-
},
|
|
620
|
+
}, oe = ({
|
|
621
621
|
isOpen: t,
|
|
622
622
|
title: e,
|
|
623
623
|
className: n = "",
|
|
624
624
|
message: o,
|
|
625
625
|
children: i,
|
|
626
626
|
noConfirm: s = !1,
|
|
627
|
-
noCancel:
|
|
627
|
+
noCancel: c = !1,
|
|
628
628
|
confirmText: r = "OK",
|
|
629
|
-
cancelText:
|
|
630
|
-
onConfirm:
|
|
629
|
+
cancelText: l = "Cancel",
|
|
630
|
+
onConfirm: a,
|
|
631
631
|
onCancel: d
|
|
632
632
|
}) => {
|
|
633
|
-
const u =
|
|
633
|
+
const u = F(null);
|
|
634
634
|
return x(() => {
|
|
635
|
-
const h = (
|
|
636
|
-
|
|
635
|
+
const h = (f) => {
|
|
636
|
+
f.key === "Escape" && d?.();
|
|
637
637
|
};
|
|
638
638
|
return t && document.addEventListener("keydown", h), () => {
|
|
639
639
|
document.removeEventListener("keydown", h);
|
|
640
640
|
};
|
|
641
|
-
}, [t, d]), /* @__PURE__ */
|
|
641
|
+
}, [t, d]), /* @__PURE__ */ p(
|
|
642
642
|
"div",
|
|
643
643
|
{
|
|
644
644
|
className: `maze-dialog-overlay ${t ? "maze-dialog-visible" : ""}`,
|
|
645
|
-
children: /* @__PURE__ */
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
(!
|
|
649
|
-
!
|
|
645
|
+
children: /* @__PURE__ */ p("div", { className: "maze-dialog " + n, ref: u, children: [
|
|
646
|
+
/* @__PURE__ */ p("div", { className: "maze-dialog-title", children: e }),
|
|
647
|
+
/* @__PURE__ */ p("div", { className: "maze-dialog-content", children: i || /* @__PURE__ */ p("div", { className: "maze-dialog-message", children: o }) }),
|
|
648
|
+
(!c || !s) && /* @__PURE__ */ p("div", { className: "maze-dialog-buttons", children: [
|
|
649
|
+
!c && /* @__PURE__ */ p(
|
|
650
650
|
"button",
|
|
651
651
|
{
|
|
652
652
|
type: "button",
|
|
653
653
|
className: "maze-dialog-cancel",
|
|
654
654
|
onClick: d,
|
|
655
|
-
children:
|
|
655
|
+
children: l
|
|
656
656
|
}
|
|
657
657
|
),
|
|
658
|
-
!s && /* @__PURE__ */
|
|
658
|
+
!s && /* @__PURE__ */ p(
|
|
659
659
|
"button",
|
|
660
660
|
{
|
|
661
661
|
type: "button",
|
|
662
662
|
className: "maze-dialog-confirm",
|
|
663
|
-
onClick:
|
|
663
|
+
onClick: a,
|
|
664
664
|
children: r
|
|
665
665
|
}
|
|
666
666
|
)
|
|
@@ -668,7 +668,7 @@ const Ct = (t) => ({
|
|
|
668
668
|
] })
|
|
669
669
|
}
|
|
670
670
|
);
|
|
671
|
-
},
|
|
671
|
+
}, R = {
|
|
672
672
|
container: null,
|
|
673
673
|
// attach Toast container to element, only need to execute once
|
|
674
674
|
attachTo(t) {
|
|
@@ -698,7 +698,7 @@ const Ct = (t) => ({
|
|
|
698
698
|
for (; this.container.firstChild; )
|
|
699
699
|
this.container.removeChild(this.container.firstChild);
|
|
700
700
|
}
|
|
701
|
-
},
|
|
701
|
+
}, St = () => {
|
|
702
702
|
const {
|
|
703
703
|
gameProgress: t,
|
|
704
704
|
setGameProgress: e,
|
|
@@ -706,82 +706,82 @@ const Ct = (t) => ({
|
|
|
706
706
|
setGamePlayState: o,
|
|
707
707
|
gamePlayStateRef: i,
|
|
708
708
|
resetGame: s,
|
|
709
|
-
config:
|
|
710
|
-
} =
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
},
|
|
714
|
-
|
|
715
|
-
r.levelGoToast.replace("%LEVEL%",
|
|
709
|
+
config: c
|
|
710
|
+
} = B(), { i18n: r, levelConfig: l } = c, a = J(l), { levelTransitioning: d, showClue: u } = n, { highestUnlockedLevel: h, totalScore: f } = t, w = a.getTotalLevels(), [g, _] = j(!1), [v, m] = j(!1), [y, C] = j(!1), k = (O) => {
|
|
711
|
+
const Y = a.getFirstLevelOfTier(O);
|
|
712
|
+
a.isLevelUnlocked(Y, h) && (e((W) => ({ ...W, currentTier: O })), T(Y));
|
|
713
|
+
}, T = (O) => {
|
|
714
|
+
a.isLevelUnlocked(O, h) && (e((Y) => ({ ...Y, currentLevel: O })), R.show(
|
|
715
|
+
r.levelGoToast.replace("%LEVEL%", O.toString()),
|
|
716
716
|
"success"
|
|
717
717
|
));
|
|
718
|
-
}, T = () => {
|
|
719
|
-
f(!0);
|
|
720
|
-
}, N = () => {
|
|
721
|
-
f(!1);
|
|
722
|
-
}, L = () => {
|
|
723
|
-
w(!0);
|
|
724
|
-
}, A = () => {
|
|
725
|
-
w(!1);
|
|
726
718
|
}, z = () => {
|
|
727
|
-
|
|
719
|
+
_(!0);
|
|
720
|
+
}, S = () => {
|
|
721
|
+
_(!1);
|
|
722
|
+
}, b = () => {
|
|
723
|
+
C(!0);
|
|
724
|
+
}, E = () => {
|
|
725
|
+
C(!1);
|
|
726
|
+
}, N = () => {
|
|
727
|
+
R.show(u ? r.cluePathDisabled : r.cluePathEnabled), o(() => ({
|
|
728
728
|
...i.current,
|
|
729
729
|
// need to sync with ref
|
|
730
730
|
showClue: !i.current.showClue
|
|
731
|
-
})),
|
|
731
|
+
})), C(!1);
|
|
732
732
|
}, P = () => {
|
|
733
|
-
|
|
733
|
+
m(!0);
|
|
734
734
|
}, I = () => {
|
|
735
|
-
s(),
|
|
736
|
-
},
|
|
737
|
-
|
|
735
|
+
s(), m(!1), R.show(r.resetDoneToast);
|
|
736
|
+
}, V = () => {
|
|
737
|
+
m(!1);
|
|
738
738
|
};
|
|
739
|
-
return /* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
|
|
739
|
+
return /* @__PURE__ */ p("div", { class: "game-panel-container", children: [
|
|
740
|
+
/* @__PURE__ */ p("div", { className: "game-controls", children: [
|
|
741
|
+
/* @__PURE__ */ p("div", { className: "selectors-container", children: [
|
|
742
|
+
/* @__PURE__ */ p(
|
|
743
|
+
kt,
|
|
744
744
|
{
|
|
745
|
-
onTierChange:
|
|
745
|
+
onTierChange: k,
|
|
746
746
|
disabled: d
|
|
747
747
|
}
|
|
748
748
|
),
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
|
|
749
|
+
/* @__PURE__ */ p(
|
|
750
|
+
Tt,
|
|
751
751
|
{
|
|
752
|
-
onLevelChange:
|
|
752
|
+
onLevelChange: T,
|
|
753
753
|
disabled: d
|
|
754
754
|
}
|
|
755
755
|
)
|
|
756
756
|
] }),
|
|
757
|
-
/* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ p(
|
|
758
758
|
"button",
|
|
759
759
|
{
|
|
760
760
|
className: `settings-clue-button ${u ? "clue-on" : "clue-off"}`,
|
|
761
761
|
disabled: u,
|
|
762
762
|
title: "Toggle Clue",
|
|
763
|
-
onClick:
|
|
763
|
+
onClick: b,
|
|
764
764
|
children: u ? r.clueOn : r.clueOff
|
|
765
765
|
}
|
|
766
766
|
)
|
|
767
767
|
] }),
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
|
|
768
|
+
/* @__PURE__ */ p("div", { className: "game-settings", children: /* @__PURE__ */ p("span", { className: "game-settings-icon", onClick: z, children: "★ " + f }) }),
|
|
769
|
+
/* @__PURE__ */ p(
|
|
770
|
+
oe,
|
|
771
771
|
{
|
|
772
772
|
isOpen: g,
|
|
773
773
|
title: r.settings,
|
|
774
774
|
noConfirm: !0,
|
|
775
775
|
cancelText: r.close,
|
|
776
|
-
onCancel:
|
|
776
|
+
onCancel: S,
|
|
777
777
|
children: [
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
778
|
+
/* @__PURE__ */ p("div", { className: "settings-stats", children: [
|
|
779
|
+
/* @__PURE__ */ p("div", { children: r.levelComplete + `: ${h}/${w}` }),
|
|
780
|
+
/* @__PURE__ */ p("div", { children: r.starsCollected + ": " + f }),
|
|
781
|
+
/* @__PURE__ */ p("div", { children: r.avgStarPerLevel + ": " + (f / h).toFixed(2) })
|
|
782
782
|
] }),
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */
|
|
783
|
+
/* @__PURE__ */ p("div", { className: "settings-item-box", children: [
|
|
784
|
+
/* @__PURE__ */ p(
|
|
785
785
|
"button",
|
|
786
786
|
{
|
|
787
787
|
className: "settings-reset-button",
|
|
@@ -790,133 +790,133 @@ const Ct = (t) => ({
|
|
|
790
790
|
children: r.reset
|
|
791
791
|
}
|
|
792
792
|
),
|
|
793
|
-
/* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ p("div", { className: "settings-item-tip", children: r.resetTip })
|
|
794
794
|
] })
|
|
795
795
|
]
|
|
796
796
|
}
|
|
797
797
|
),
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
|
|
798
|
+
/* @__PURE__ */ p(
|
|
799
|
+
oe,
|
|
800
800
|
{
|
|
801
|
-
isOpen:
|
|
801
|
+
isOpen: v,
|
|
802
802
|
title: r.confirmReset,
|
|
803
803
|
message: r.confirmResetMessage,
|
|
804
804
|
confirmText: r.reset,
|
|
805
805
|
cancelText: r.cancel,
|
|
806
806
|
onConfirm: I,
|
|
807
|
-
onCancel:
|
|
807
|
+
onCancel: V
|
|
808
808
|
}
|
|
809
809
|
),
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
|
|
810
|
+
/* @__PURE__ */ p(
|
|
811
|
+
oe,
|
|
812
812
|
{
|
|
813
813
|
isOpen: y,
|
|
814
814
|
title: r.confirmClue,
|
|
815
815
|
message: r.confirmClueMessage,
|
|
816
816
|
confirmText: r.confirm,
|
|
817
817
|
cancelText: r.cancel,
|
|
818
|
-
onConfirm:
|
|
819
|
-
onCancel:
|
|
818
|
+
onConfirm: N,
|
|
819
|
+
onCancel: E
|
|
820
820
|
}
|
|
821
821
|
)
|
|
822
822
|
] });
|
|
823
823
|
};
|
|
824
|
-
function
|
|
824
|
+
function ye(t, e) {
|
|
825
825
|
if (!(t instanceof e))
|
|
826
826
|
throw new TypeError("Cannot call a class as a function");
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function zt(t, e) {
|
|
829
829
|
for (var n = 0; n < e.length; n++) {
|
|
830
830
|
var o = e[n];
|
|
831
831
|
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
function
|
|
835
|
-
return e &&
|
|
834
|
+
function be(t, e, n) {
|
|
835
|
+
return e && zt(t.prototype, e), t;
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function Re(t) {
|
|
838
838
|
return +t.replace(/px/, "");
|
|
839
839
|
}
|
|
840
840
|
function Lt(t) {
|
|
841
|
-
var e = window.devicePixelRatio, n = getComputedStyle(t), o =
|
|
841
|
+
var e = window.devicePixelRatio, n = getComputedStyle(t), o = Re(n.getPropertyValue("width")), i = Re(n.getPropertyValue("height"));
|
|
842
842
|
t.setAttribute("width", (o * e).toString()), t.setAttribute("height", (i * e).toString());
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function D(t, e) {
|
|
845
845
|
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, o = Math.random() * (e - t) + t;
|
|
846
846
|
return Math.floor(o * Math.pow(10, n)) / Math.pow(10, n);
|
|
847
847
|
}
|
|
848
|
-
function
|
|
849
|
-
return t[
|
|
848
|
+
function Oe(t) {
|
|
849
|
+
return t[D(0, t.length)];
|
|
850
850
|
}
|
|
851
|
-
var
|
|
852
|
-
function
|
|
851
|
+
var Nt = 125e-5, At = 5e-4, Et = 9e-4, Mt = 1e-5, Pt = 6, It = 80, xt = 0.9, Dt = 1.7, Ft = 0.2, Rt = 0.6, Ot = 0.03, $t = 0.07, Ut = 15, Wt = 82, jt = 100, Gt = 250, Ht = 40, qt = ["#fcf403", "#62fc03", "#f4fc03", "#03e7fc", "#03fca5", "#a503fc", "#fc03ad", "#fc03c2"];
|
|
852
|
+
function $e(t) {
|
|
853
853
|
var e = 1920;
|
|
854
854
|
return Math.log(t) / Math.log(e);
|
|
855
855
|
}
|
|
856
|
-
var
|
|
856
|
+
var Ue = /* @__PURE__ */ function() {
|
|
857
857
|
function t(e) {
|
|
858
|
-
|
|
859
|
-
var n = e.initialPosition, o = e.direction, i = e.confettiRadius, s = e.confettiColors,
|
|
858
|
+
ye(this, t);
|
|
859
|
+
var n = e.initialPosition, o = e.direction, i = e.confettiRadius, s = e.confettiColors, c = e.emojis, r = e.emojiSize, l = e.canvasWidth, a = D(xt, Dt, 3), d = a * $e(l);
|
|
860
860
|
this.confettiSpeed = {
|
|
861
861
|
x: d,
|
|
862
862
|
y: d
|
|
863
|
-
}, this.finalConfettiSpeedX =
|
|
863
|
+
}, this.finalConfettiSpeedX = D(Ft, Rt, 3), this.rotationSpeed = c.length ? 0.01 : D(Ot, $t, 3) * $e(l), this.dragForceCoefficient = D(At, Et, 6), this.radius = {
|
|
864
864
|
x: i,
|
|
865
865
|
y: i
|
|
866
|
-
}, this.initialRadius = i, this.rotationAngle = o === "left" ?
|
|
867
|
-
var u = o === "left" ?
|
|
866
|
+
}, this.initialRadius = i, this.rotationAngle = o === "left" ? D(0, 0.2, 3) : D(-0.2, 0, 3), this.emojiSize = r, this.emojiRotationAngle = D(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
|
|
867
|
+
var u = o === "left" ? D(Wt, Ut) * Math.PI / 180 : D(-15, -82) * Math.PI / 180;
|
|
868
868
|
this.absCos = Math.abs(Math.cos(u)), this.absSin = Math.abs(Math.sin(u));
|
|
869
|
-
var h =
|
|
869
|
+
var h = D(-150, 0), f = {
|
|
870
870
|
x: n.x + (o === "left" ? -h : h) * this.absCos,
|
|
871
871
|
y: n.y - h * this.absSin
|
|
872
872
|
};
|
|
873
|
-
this.currentPosition = Object.assign({},
|
|
873
|
+
this.currentPosition = Object.assign({}, f), this.initialPosition = Object.assign({}, f), this.color = c.length ? null : Oe(s), this.emoji = c.length ? Oe(c) : null, this.createdAt = (/* @__PURE__ */ new Date()).getTime(), this.direction = o;
|
|
874
874
|
}
|
|
875
|
-
return
|
|
875
|
+
return be(t, [{
|
|
876
876
|
key: "draw",
|
|
877
877
|
value: function(n) {
|
|
878
|
-
var o = this.currentPosition, i = this.radius, s = this.color,
|
|
879
|
-
s ? (n.fillStyle = s, n.beginPath(), n.ellipse(o.x * d, o.y * d, i.x * d, i.y * d, r, 0, 2 * Math.PI), n.fill()) :
|
|
878
|
+
var o = this.currentPosition, i = this.radius, s = this.color, c = this.emoji, r = this.rotationAngle, l = this.emojiRotationAngle, a = this.emojiSize, d = window.devicePixelRatio;
|
|
879
|
+
s ? (n.fillStyle = s, n.beginPath(), n.ellipse(o.x * d, o.y * d, i.x * d, i.y * d, r, 0, 2 * Math.PI), n.fill()) : c && (n.font = "".concat(a, "px serif"), n.save(), n.translate(d * o.x, d * o.y), n.rotate(l), n.textAlign = "center", n.fillText(c, 0, 0), n.restore());
|
|
880
880
|
}
|
|
881
881
|
}, {
|
|
882
882
|
key: "updatePosition",
|
|
883
883
|
value: function(n, o) {
|
|
884
|
-
var i = this.confettiSpeed, s = this.dragForceCoefficient,
|
|
885
|
-
if (i.x >
|
|
884
|
+
var i = this.confettiSpeed, s = this.dragForceCoefficient, c = this.finalConfettiSpeedX, r = this.radiusYUpdateDirection, l = this.rotationSpeed, a = this.createdAt, d = this.direction, u = o - a;
|
|
885
|
+
if (i.x > c && (this.confettiSpeed.x -= s * n), this.currentPosition.x += i.x * (d === "left" ? -this.absCos : this.absCos) * n, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + Nt * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : Mt * n, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
|
|
886
886
|
this.emojiRotationAngle += this.rotationSpeed * n % (2 * Math.PI);
|
|
887
887
|
return;
|
|
888
888
|
}
|
|
889
|
-
r === "down" ? (this.radius.y -= n *
|
|
889
|
+
r === "down" ? (this.radius.y -= n * l, this.radius.y <= 0 && (this.radius.y = 0, this.radiusYUpdateDirection = "up")) : (this.radius.y += n * l, this.radius.y >= this.initialRadius && (this.radius.y = this.initialRadius, this.radiusYUpdateDirection = "down"));
|
|
890
890
|
}
|
|
891
891
|
}, {
|
|
892
892
|
key: "getIsVisibleOnCanvas",
|
|
893
893
|
value: function(n) {
|
|
894
|
-
return this.currentPosition.y < n +
|
|
894
|
+
return this.currentPosition.y < n + jt;
|
|
895
895
|
}
|
|
896
896
|
}]), t;
|
|
897
897
|
}();
|
|
898
|
-
function
|
|
898
|
+
function Bt() {
|
|
899
899
|
var t = document.createElement("canvas");
|
|
900
900
|
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;
|
|
901
901
|
}
|
|
902
|
-
function
|
|
903
|
-
var e = t.confettiRadius, n = e === void 0 ?
|
|
902
|
+
function Vt(t) {
|
|
903
|
+
var e = t.confettiRadius, n = e === void 0 ? Pt : e, o = t.confettiNumber, i = o === void 0 ? t.confettiesNumber || (t.emojis ? Ht : Gt) : o, s = t.confettiColors, c = s === void 0 ? qt : s, r = t.emojis, l = r === void 0 ? t.emojies || [] : r, a = t.emojiSize, d = a === void 0 ? It : a;
|
|
904
904
|
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"), {
|
|
905
905
|
confettiRadius: n,
|
|
906
906
|
confettiNumber: i,
|
|
907
|
-
confettiColors:
|
|
908
|
-
emojis:
|
|
907
|
+
confettiColors: c,
|
|
908
|
+
emojis: l,
|
|
909
909
|
emojiSize: d
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
|
-
var
|
|
912
|
+
var Yt = /* @__PURE__ */ function() {
|
|
913
913
|
function t(e) {
|
|
914
914
|
var n = this;
|
|
915
|
-
|
|
915
|
+
ye(this, t), this.canvasContext = e, this.shapes = [], this.promise = new Promise(function(o) {
|
|
916
916
|
return n.resolvePromise = o;
|
|
917
917
|
});
|
|
918
918
|
}
|
|
919
|
-
return
|
|
919
|
+
return be(t, [{
|
|
920
920
|
key: "getBatchCompletePromise",
|
|
921
921
|
value: function() {
|
|
922
922
|
return this.promise;
|
|
@@ -936,27 +936,27 @@ var Vt = /* @__PURE__ */ function() {
|
|
|
936
936
|
}, {
|
|
937
937
|
key: "processShapes",
|
|
938
938
|
value: function(n, o, i) {
|
|
939
|
-
var s = this,
|
|
940
|
-
this.shapes = this.shapes.filter(function(
|
|
941
|
-
return
|
|
939
|
+
var s = this, c = n.timeDelta, r = n.currentTime;
|
|
940
|
+
this.shapes = this.shapes.filter(function(l) {
|
|
941
|
+
return l.updatePosition(c, r), l.draw(s.canvasContext), i ? l.getIsVisibleOnCanvas(o) : !0;
|
|
942
942
|
});
|
|
943
943
|
}
|
|
944
944
|
}]), t;
|
|
945
|
-
}(),
|
|
945
|
+
}(), Xt = /* @__PURE__ */ function() {
|
|
946
946
|
function t() {
|
|
947
947
|
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
948
|
-
|
|
948
|
+
ye(this, t), this.activeConfettiBatches = [], this.canvas = e.canvas || Bt(), 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);
|
|
949
949
|
}
|
|
950
|
-
return
|
|
950
|
+
return be(t, [{
|
|
951
951
|
key: "loop",
|
|
952
952
|
value: function() {
|
|
953
953
|
this.requestAnimationFrameRequested = !1, Lt(this.canvas);
|
|
954
954
|
var n = (/* @__PURE__ */ new Date()).getTime(), o = n - this.lastUpdated, i = this.canvas.offsetHeight, s = this.iterationIndex % 10 === 0;
|
|
955
|
-
this.activeConfettiBatches = this.activeConfettiBatches.filter(function(
|
|
956
|
-
return
|
|
955
|
+
this.activeConfettiBatches = this.activeConfettiBatches.filter(function(c) {
|
|
956
|
+
return c.processShapes({
|
|
957
957
|
timeDelta: o,
|
|
958
958
|
currentTime: n
|
|
959
|
-
}, i, s), s ? !
|
|
959
|
+
}, i, s), s ? !c.complete() : !0;
|
|
960
960
|
}), this.iterationIndex++, this.queueAnimationFrameIfNeeded(n);
|
|
961
961
|
}
|
|
962
962
|
}, {
|
|
@@ -967,33 +967,33 @@ var Vt = /* @__PURE__ */ function() {
|
|
|
967
967
|
}, {
|
|
968
968
|
key: "addConfetti",
|
|
969
969
|
value: function() {
|
|
970
|
-
for (var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, o =
|
|
970
|
+
for (var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, o = Vt(n), i = o.confettiRadius, s = o.confettiNumber, c = o.confettiColors, r = o.emojis, l = o.emojiSize, a = this.canvas.getBoundingClientRect(), d = a.width, u = a.height, h = u * 5 / 7, f = {
|
|
971
971
|
x: 0,
|
|
972
972
|
y: h
|
|
973
|
-
},
|
|
973
|
+
}, w = {
|
|
974
974
|
x: d,
|
|
975
975
|
y: h
|
|
976
|
-
}, g = new
|
|
977
|
-
var
|
|
978
|
-
initialPosition:
|
|
976
|
+
}, g = new Yt(this.canvasContext), _ = 0; _ < s / 2; _++) {
|
|
977
|
+
var v = new Ue({
|
|
978
|
+
initialPosition: f,
|
|
979
979
|
direction: "right",
|
|
980
980
|
confettiRadius: i,
|
|
981
|
-
confettiColors:
|
|
981
|
+
confettiColors: c,
|
|
982
982
|
confettiNumber: s,
|
|
983
983
|
emojis: r,
|
|
984
|
-
emojiSize:
|
|
984
|
+
emojiSize: l,
|
|
985
985
|
canvasWidth: d
|
|
986
|
-
}),
|
|
987
|
-
initialPosition:
|
|
986
|
+
}), m = new Ue({
|
|
987
|
+
initialPosition: w,
|
|
988
988
|
direction: "left",
|
|
989
989
|
confettiRadius: i,
|
|
990
|
-
confettiColors:
|
|
990
|
+
confettiColors: c,
|
|
991
991
|
confettiNumber: s,
|
|
992
992
|
emojis: r,
|
|
993
|
-
emojiSize:
|
|
993
|
+
emojiSize: l,
|
|
994
994
|
canvasWidth: d
|
|
995
995
|
});
|
|
996
|
-
g.addShapes(
|
|
996
|
+
g.addShapes(v, m);
|
|
997
997
|
}
|
|
998
998
|
return this.activeConfettiBatches.push(g), this.queueAnimationFrameIfNeeded(), g.getBatchCompletePromise();
|
|
999
999
|
}
|
|
@@ -1009,40 +1009,40 @@ var Vt = /* @__PURE__ */ function() {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
}]), t;
|
|
1011
1011
|
}();
|
|
1012
|
-
const
|
|
1012
|
+
const Kt = new Xt(), Jt = ({ onRetry: t }) => {
|
|
1013
1013
|
const {
|
|
1014
1014
|
config: e,
|
|
1015
1015
|
currentScore: n,
|
|
1016
1016
|
gamePlayState: o,
|
|
1017
1017
|
setGamePlayState: i,
|
|
1018
1018
|
gameProgress: s,
|
|
1019
|
-
setGameProgress:
|
|
1020
|
-
} =
|
|
1019
|
+
setGameProgress: c
|
|
1020
|
+
} = B(), { i18n: r, levelConfig: l } = e, [a, d, u] = n, { foodCollected: h, totalFoodCount: f, playerAtExit: w, levelTransitioning: g } = o, { currentLevel: _ } = s, [v, m] = j(!1);
|
|
1021
1021
|
x(() => {
|
|
1022
|
-
|
|
1023
|
-
}, [
|
|
1024
|
-
const y =
|
|
1025
|
-
|
|
1026
|
-
},
|
|
1027
|
-
|
|
1028
|
-
...
|
|
1022
|
+
w && g && (Kt.addConfetti(), R.show(r.levelCompleteToast, "success"), m(!0));
|
|
1023
|
+
}, [w, g]);
|
|
1024
|
+
const y = J(l), C = y.getTotalLevels(), k = q(() => _ >= C, [_, C]), T = () => {
|
|
1025
|
+
m(!1), R.show(r.levelRestartToast, "info"), t?.();
|
|
1026
|
+
}, z = () => {
|
|
1027
|
+
m(!1), i((b) => ({
|
|
1028
|
+
...b,
|
|
1029
1029
|
isGameActive: !0,
|
|
1030
1030
|
levelTransitioning: !1
|
|
1031
1031
|
}));
|
|
1032
|
-
},
|
|
1033
|
-
|
|
1034
|
-
const
|
|
1035
|
-
if (!
|
|
1036
|
-
const { nextLevel:
|
|
1037
|
-
P &&
|
|
1038
|
-
r.tierUnlockedToast.replace("%TIER%",
|
|
1032
|
+
}, S = () => {
|
|
1033
|
+
m(!1);
|
|
1034
|
+
const b = y.getNextLevelInfo(_);
|
|
1035
|
+
if (!b) return;
|
|
1036
|
+
const { nextLevel: E, nextTier: N, isTierChange: P } = b;
|
|
1037
|
+
P && R.show(
|
|
1038
|
+
r.tierUnlockedToast.replace("%TIER%", N.toString()),
|
|
1039
1039
|
"success"
|
|
1040
|
-
),
|
|
1040
|
+
), c((I) => ({
|
|
1041
1041
|
...I,
|
|
1042
|
-
currentLevel:
|
|
1043
|
-
currentTier:
|
|
1044
|
-
highestUnlockedLevel: Math.max(I.highestUnlockedLevel,
|
|
1045
|
-
highestUnlockedTier: Math.max(I.highestUnlockedTier,
|
|
1042
|
+
currentLevel: E,
|
|
1043
|
+
currentTier: N,
|
|
1044
|
+
highestUnlockedLevel: Math.max(I.highestUnlockedLevel, E),
|
|
1045
|
+
highestUnlockedTier: Math.max(I.highestUnlockedTier, N),
|
|
1046
1046
|
levelScores: {
|
|
1047
1047
|
...I.levelScores,
|
|
1048
1048
|
[I.currentLevel]: Math.max(
|
|
@@ -1052,31 +1052,31 @@ const Yt = new Bt(), Xt = ({ onRetry: t }) => {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
}));
|
|
1054
1054
|
};
|
|
1055
|
-
return /* @__PURE__ */
|
|
1056
|
-
|
|
1055
|
+
return /* @__PURE__ */ p(
|
|
1056
|
+
oe,
|
|
1057
1057
|
{
|
|
1058
1058
|
className: "level-complete-dialog",
|
|
1059
|
-
isOpen:
|
|
1059
|
+
isOpen: v,
|
|
1060
1060
|
title: r.congratulations,
|
|
1061
1061
|
cancelText: r.retry,
|
|
1062
|
-
onCancel:
|
|
1062
|
+
onCancel: T,
|
|
1063
1063
|
noConfirm: !!d,
|
|
1064
1064
|
confirmText: r.continue,
|
|
1065
|
-
onConfirm:
|
|
1065
|
+
onConfirm: z,
|
|
1066
1066
|
children: [
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
!!
|
|
1069
|
-
/* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
1067
|
+
/* @__PURE__ */ p("div", { className: "maze-summary-message", children: [
|
|
1068
|
+
!!a && /* @__PURE__ */ p("div", { children: "★ - " + r.findYourExit }),
|
|
1069
|
+
/* @__PURE__ */ p("div", { children: u ? "★ - " + r.withoutClue : "☆ - " + r.withClue }),
|
|
1070
|
+
/* @__PURE__ */ p("div", { children: (d ? "★ - " + r.collectAllStars : "☆ - " + r.notCollectAllStars) + ` (${h}/${f})` })
|
|
1071
1071
|
] }),
|
|
1072
|
-
|
|
1073
|
-
/* @__PURE__ */
|
|
1074
|
-
!d && /* @__PURE__ */
|
|
1072
|
+
k && /* @__PURE__ */ p("div", { className: "all-levels-completed", children: r.allLevelsCompleted }),
|
|
1073
|
+
/* @__PURE__ */ p("div", { className: "go-next-level", children: k ? "OK" : /* @__PURE__ */ p("button", { type: "button", onClick: S, children: r.nextLevel }) }),
|
|
1074
|
+
!d && /* @__PURE__ */ p("div", { className: "not-all-stars-collected", children: r.continueMessage })
|
|
1075
1075
|
]
|
|
1076
1076
|
}
|
|
1077
1077
|
);
|
|
1078
|
-
},
|
|
1079
|
-
const n =
|
|
1078
|
+
}, Zt = (t, e) => {
|
|
1079
|
+
const n = F({
|
|
1080
1080
|
canvasWidth: 0,
|
|
1081
1081
|
canvasHeight: 0
|
|
1082
1082
|
});
|
|
@@ -1084,12 +1084,12 @@ const Yt = new Bt(), Xt = ({ onRetry: t }) => {
|
|
|
1084
1084
|
const o = () => {
|
|
1085
1085
|
const s = t.current;
|
|
1086
1086
|
if (!s) return;
|
|
1087
|
-
const
|
|
1088
|
-
if (!
|
|
1089
|
-
const r =
|
|
1087
|
+
const c = s.parentElement;
|
|
1088
|
+
if (!c) return;
|
|
1089
|
+
const r = c.clientWidth, l = window.devicePixelRatio || 1;
|
|
1090
1090
|
s.style.width = `${r}px`, s.style.height = `${r}px`;
|
|
1091
|
-
const
|
|
1092
|
-
s.width =
|
|
1091
|
+
const a = r * l, d = r * l;
|
|
1092
|
+
s.width = a, s.height = d, n.current = { canvasWidth: a, canvasHeight: d }, e?.();
|
|
1093
1093
|
};
|
|
1094
1094
|
o();
|
|
1095
1095
|
let i = null;
|
|
@@ -1097,32 +1097,32 @@ const Yt = new Bt(), Xt = ({ onRetry: t }) => {
|
|
|
1097
1097
|
window.removeEventListener("resize", o), i?.disconnect();
|
|
1098
1098
|
};
|
|
1099
1099
|
}, [t, e]), n;
|
|
1100
|
-
},
|
|
1100
|
+
}, Qt = (t) => {
|
|
1101
1101
|
const {
|
|
1102
1102
|
config: e,
|
|
1103
1103
|
gamePlayState: { maze: n }
|
|
1104
|
-
} =
|
|
1104
|
+
} = B(), o = F({ cellWidth: 0, cellHeight: 0 });
|
|
1105
1105
|
return x(() => {
|
|
1106
1106
|
const i = e.renderConfig.padding, s = () => {
|
|
1107
1107
|
const r = t.current;
|
|
1108
1108
|
if (!r || !n) return;
|
|
1109
|
-
const { rows:
|
|
1110
|
-
if (
|
|
1111
|
-
const d = (r.width - i * 2) /
|
|
1109
|
+
const { rows: l, cols: a } = n;
|
|
1110
|
+
if (l <= 0 || a <= 0) return;
|
|
1111
|
+
const d = (r.width - i * 2) / a, u = (r.height - i * 2) / l;
|
|
1112
1112
|
o.current = { cellWidth: d, cellHeight: u };
|
|
1113
1113
|
};
|
|
1114
1114
|
s();
|
|
1115
|
-
let
|
|
1116
|
-
return t.current && window.ResizeObserver && (
|
|
1117
|
-
t.current &&
|
|
1115
|
+
let c = null;
|
|
1116
|
+
return t.current && window.ResizeObserver && (c = new ResizeObserver(s), c.observe(t.current)), () => {
|
|
1117
|
+
t.current && c?.disconnect();
|
|
1118
1118
|
};
|
|
1119
1119
|
}, [t, n]), o;
|
|
1120
|
-
},
|
|
1120
|
+
}, Q = {
|
|
1121
1121
|
ArrowUp: [-1, 0],
|
|
1122
1122
|
ArrowDown: [1, 0],
|
|
1123
1123
|
ArrowLeft: [0, -1],
|
|
1124
1124
|
ArrowRight: [0, 1]
|
|
1125
|
-
},
|
|
1125
|
+
}, en = ({
|
|
1126
1126
|
containerRef: t,
|
|
1127
1127
|
gamePlayStateRef: e,
|
|
1128
1128
|
setGamePlayState: n,
|
|
@@ -1130,45 +1130,49 @@ const Yt = new Bt(), Xt = ({ onRetry: t }) => {
|
|
|
1130
1130
|
// move X grid units per frame, default 0.03
|
|
1131
1131
|
playerRadius: i,
|
|
1132
1132
|
// player radius in grid unit, default 0.2
|
|
1133
|
-
|
|
1133
|
+
exitWallWidth: s,
|
|
1134
|
+
getCellSizeInPixels: c,
|
|
1135
|
+
onFoodCollected: r
|
|
1134
1136
|
}) => {
|
|
1135
|
-
const l =
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1137
|
+
const l = F(!1), a = F(/* @__PURE__ */ new Set()), d = (_, v) => {
|
|
1138
|
+
const m = e.current;
|
|
1139
|
+
if (!m.maze)
|
|
1138
1140
|
return { canMove: !1, newCell: null };
|
|
1139
|
-
const [
|
|
1140
|
-
if (
|
|
1141
|
-
g,
|
|
1142
|
-
p,
|
|
1141
|
+
const [y, C] = Q[_];
|
|
1142
|
+
if (We(
|
|
1143
1143
|
v,
|
|
1144
|
+
y,
|
|
1145
|
+
C,
|
|
1144
1146
|
i,
|
|
1145
1147
|
o,
|
|
1146
|
-
|
|
1148
|
+
m.maze
|
|
1147
1149
|
))
|
|
1148
1150
|
return { canMove: !1, newCell: null };
|
|
1149
|
-
const { row:
|
|
1150
|
-
return
|
|
1151
|
+
const { row: T, col: z } = v, S = T + y * o, b = z + C * o, E = Math.floor(T), N = Math.floor(z), P = Math.floor(S), I = Math.floor(b);
|
|
1152
|
+
return P !== E || I !== N ? m.maze.isValid(P, I) ? {
|
|
1151
1153
|
canMove: !0,
|
|
1152
|
-
newCell: { row:
|
|
1154
|
+
newCell: { row: P, col: I }
|
|
1153
1155
|
} : { canMove: !1, newCell: null } : { canMove: !0, newCell: null };
|
|
1154
|
-
},
|
|
1155
|
-
const
|
|
1156
|
-
Math.pow(
|
|
1157
|
-
) <
|
|
1158
|
-
|
|
1156
|
+
}, u = () => {
|
|
1157
|
+
const _ = e.current, { row: v, col: m } = _.playerCell, y = i * 2, C = _.foodCells.findIndex((z) => Math.sqrt(
|
|
1158
|
+
Math.pow(v - z.row, 2) + Math.pow(m - z.col, 2)
|
|
1159
|
+
) < y);
|
|
1160
|
+
C !== -1 && r && (r(), e.current = {
|
|
1159
1161
|
...e.current,
|
|
1160
1162
|
foodCollected: e.current.foodCollected + 1,
|
|
1161
1163
|
foodCells: e.current.foodCells.filter(
|
|
1162
|
-
(
|
|
1164
|
+
(z, S) => S !== C
|
|
1163
1165
|
)
|
|
1164
1166
|
});
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
i
|
|
1167
|
+
const T = nn(
|
|
1168
|
+
_.playerCell,
|
|
1169
|
+
_.exitCell,
|
|
1170
|
+
_.maze,
|
|
1171
|
+
i,
|
|
1172
|
+
s,
|
|
1173
|
+
c
|
|
1170
1174
|
);
|
|
1171
|
-
|
|
1175
|
+
T && !e.current.playerAtExit ? (e.current = {
|
|
1172
1176
|
...e.current,
|
|
1173
1177
|
playerAtExit: !0,
|
|
1174
1178
|
isGameActive: !1,
|
|
@@ -1179,119 +1183,119 @@ const Yt = new Bt(), Xt = ({ onRetry: t }) => {
|
|
|
1179
1183
|
n(() => ({ ...e.current }));
|
|
1180
1184
|
},
|
|
1181
1185
|
{ timeout: 10 }
|
|
1182
|
-
)) : !
|
|
1186
|
+
)) : !T && e.current.playerAtExit && (e.current = {
|
|
1183
1187
|
...e.current,
|
|
1184
1188
|
playerAtExit: !1,
|
|
1185
1189
|
isGameActive: !0,
|
|
1186
1190
|
levelTransitioning: !1
|
|
1187
1191
|
});
|
|
1188
|
-
},
|
|
1189
|
-
const
|
|
1190
|
-
if ((
|
|
1191
|
-
const
|
|
1192
|
+
}, h = (_) => {
|
|
1193
|
+
const v = e.current, m = Math.round(_.row), y = Math.round(_.col), C = v.playerPath[v.playerPath.length - 1], k = C.row === m && C.col === y, T = Math.abs(C.row - m), z = Math.abs(C.col - y);
|
|
1194
|
+
if ((T === 1 && z === 0 || T === 0 && z === 1) && !k) {
|
|
1195
|
+
const b = `${C.row},${C.col}-${m},${y}`;
|
|
1192
1196
|
e.current = {
|
|
1193
1197
|
...e.current,
|
|
1194
1198
|
playerPath: [
|
|
1195
1199
|
...e.current.playerPath,
|
|
1196
|
-
{ row:
|
|
1200
|
+
{ row: m, col: y }
|
|
1197
1201
|
],
|
|
1198
1202
|
visitCounts: {
|
|
1199
1203
|
...e.current.visitCounts,
|
|
1200
|
-
[
|
|
1204
|
+
[b]: (e.current.visitCounts[b] || 0) + 1
|
|
1201
1205
|
}
|
|
1202
1206
|
};
|
|
1203
1207
|
}
|
|
1204
|
-
},
|
|
1205
|
-
if (l.current ||
|
|
1206
|
-
const
|
|
1207
|
-
!
|
|
1208
|
-
(
|
|
1209
|
-
const { canMove:
|
|
1210
|
-
|
|
1211
|
-
|
|
1208
|
+
}, f = () => {
|
|
1209
|
+
if (l.current || a.current.size === 0) return;
|
|
1210
|
+
const _ = e.current;
|
|
1211
|
+
!_.playerCell || !Array.from(a.current).some(
|
|
1212
|
+
(m) => {
|
|
1213
|
+
const { canMove: y } = d(
|
|
1214
|
+
m,
|
|
1215
|
+
_.playerCell
|
|
1212
1216
|
);
|
|
1213
|
-
return
|
|
1217
|
+
return y;
|
|
1214
1218
|
}
|
|
1215
1219
|
) || (l.current = !0);
|
|
1216
1220
|
};
|
|
1217
1221
|
x(() => {
|
|
1218
|
-
const
|
|
1219
|
-
(
|
|
1220
|
-
},
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1223
|
-
},
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1226
|
-
},
|
|
1227
|
-
|
|
1228
|
-
const
|
|
1229
|
-
if (!
|
|
1222
|
+
const _ = (k) => {
|
|
1223
|
+
(k.key === "ArrowUp" || k.key === "ArrowDown" || k.key === "ArrowLeft" || k.key === "ArrowRight" || k.key === " ") && k.preventDefault();
|
|
1224
|
+
}, v = (k) => {
|
|
1225
|
+
const T = k.key;
|
|
1226
|
+
T in Q && (k.preventDefault(), e.current.isGameActive && (a.current.has(T) || (a.current.add(T), l.current || f())));
|
|
1227
|
+
}, m = (k) => {
|
|
1228
|
+
const T = k.key;
|
|
1229
|
+
T in Q && (k.preventDefault(), a.current.delete(T), a.current.size === 0 && g());
|
|
1230
|
+
}, y = (k) => {
|
|
1231
|
+
k.preventDefault();
|
|
1232
|
+
const T = e.current;
|
|
1233
|
+
if (!T.isGameActive || !T.maze || l.current)
|
|
1230
1234
|
return;
|
|
1231
|
-
const
|
|
1232
|
-
let
|
|
1233
|
-
|
|
1234
|
-
},
|
|
1235
|
-
|
|
1235
|
+
const z = k.touches[0], S = document.elementFromPoint(z.clientX, z.clientY);
|
|
1236
|
+
let b = null;
|
|
1237
|
+
S && (S.classList.contains("maze-up") ? b = "ArrowUp" : S.classList.contains("maze-down") ? b = "ArrowDown" : S.classList.contains("maze-left") ? b = "ArrowLeft" : S.classList.contains("maze-right") && (b = "ArrowRight")), b && (a.current.clear(), a.current.add(b), f());
|
|
1238
|
+
}, C = () => {
|
|
1239
|
+
g();
|
|
1236
1240
|
};
|
|
1237
|
-
return window.addEventListener("keydown",
|
|
1241
|
+
return window.addEventListener("keydown", _, {
|
|
1238
1242
|
capture: !0
|
|
1239
|
-
}), window.addEventListener("keydown",
|
|
1243
|
+
}), window.addEventListener("keydown", v), window.addEventListener("keyup", m), t.current?.addEventListener("touchstart", y, {
|
|
1240
1244
|
passive: !1
|
|
1241
|
-
}), t.current?.addEventListener("touchend",
|
|
1242
|
-
window.removeEventListener("keydown",
|
|
1245
|
+
}), t.current?.addEventListener("touchend", C), () => {
|
|
1246
|
+
window.removeEventListener("keydown", _, {
|
|
1243
1247
|
capture: !0
|
|
1244
|
-
}), window.removeEventListener("keydown",
|
|
1248
|
+
}), window.removeEventListener("keydown", v), window.removeEventListener("keyup", m), t.current?.removeEventListener("touchstart", y), t.current?.removeEventListener("touchend", C);
|
|
1245
1249
|
};
|
|
1246
1250
|
}, []);
|
|
1247
|
-
const
|
|
1248
|
-
if (!l.current ||
|
|
1251
|
+
const w = pt(() => {
|
|
1252
|
+
if (!l.current || a.current.size === 0)
|
|
1249
1253
|
return e.current.playerCell;
|
|
1250
|
-
const
|
|
1251
|
-
let
|
|
1252
|
-
for (const
|
|
1253
|
-
const { canMove:
|
|
1254
|
-
if (
|
|
1255
|
-
const [
|
|
1256
|
-
|
|
1254
|
+
const _ = e.current.playerCell;
|
|
1255
|
+
let v = 0, m = 0, y = 0;
|
|
1256
|
+
for (const W of a.current) {
|
|
1257
|
+
const { canMove: de } = d(W, _);
|
|
1258
|
+
if (de) {
|
|
1259
|
+
const [ke, st] = Q[W];
|
|
1260
|
+
v += ke, m += st, y++;
|
|
1257
1261
|
}
|
|
1258
1262
|
}
|
|
1259
|
-
if (
|
|
1263
|
+
if (y === 0)
|
|
1260
1264
|
return e.current.playerCell;
|
|
1261
|
-
const
|
|
1262
|
-
(
|
|
1263
|
-
),
|
|
1264
|
-
(
|
|
1265
|
-
),
|
|
1266
|
-
if (
|
|
1267
|
-
const
|
|
1268
|
-
if (
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1265
|
+
const C = Math.sqrt(v * v + m * m), k = C > 0 ? v / C : 0, T = C > 0 ? m / C : 0, z = Number(
|
|
1266
|
+
(_.row + k * o).toFixed(2)
|
|
1267
|
+
), S = Number(
|
|
1268
|
+
(_.col + T * o).toFixed(2)
|
|
1269
|
+
), b = z - _.row, E = S - _.col, N = Math.sqrt(b * b + E * E);
|
|
1270
|
+
if (N > 0) {
|
|
1271
|
+
const W = b / N, de = E / N;
|
|
1272
|
+
if (We(
|
|
1273
|
+
_,
|
|
1274
|
+
W,
|
|
1275
|
+
de,
|
|
1272
1276
|
i,
|
|
1273
|
-
|
|
1277
|
+
N,
|
|
1274
1278
|
e.current.maze
|
|
1275
1279
|
))
|
|
1276
1280
|
return e.current.playerCell;
|
|
1277
1281
|
}
|
|
1278
1282
|
e.current.playerCell = {
|
|
1279
|
-
row:
|
|
1280
|
-
col:
|
|
1281
|
-
},
|
|
1282
|
-
const
|
|
1283
|
-
return (
|
|
1284
|
-
}, [o]),
|
|
1285
|
-
l.current = !1,
|
|
1283
|
+
row: z,
|
|
1284
|
+
col: S
|
|
1285
|
+
}, u();
|
|
1286
|
+
const P = Math.round(_.row), I = Math.round(_.col), V = Math.round(z), O = Math.round(S);
|
|
1287
|
+
return (V !== P || O !== I) && h({ row: V, col: O }), e.current.playerCell;
|
|
1288
|
+
}, [o]), g = () => {
|
|
1289
|
+
l.current = !1, a.current.clear();
|
|
1286
1290
|
};
|
|
1287
1291
|
return {
|
|
1288
|
-
updatePlayerPos:
|
|
1289
|
-
resetMovingState:
|
|
1292
|
+
updatePlayerPos: w,
|
|
1293
|
+
resetMovingState: g
|
|
1290
1294
|
};
|
|
1291
1295
|
};
|
|
1292
|
-
function
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1296
|
+
function We(t, e, n, o, i, s) {
|
|
1297
|
+
const c = t.row + e * i, r = t.col + n * i, l = { row: c, col: r }, a = [], d = Math.floor(t.row), u = Math.floor(t.col);
|
|
1298
|
+
a.push({ row: d, col: u });
|
|
1295
1299
|
const h = [
|
|
1296
1300
|
[-1, 0],
|
|
1297
1301
|
// up
|
|
@@ -1310,19 +1314,19 @@ function $e(t, e, n, o, i, s) {
|
|
|
1310
1314
|
[1, 1]
|
|
1311
1315
|
// lower right, diagonal
|
|
1312
1316
|
];
|
|
1313
|
-
for (const [
|
|
1314
|
-
const g = d +
|
|
1315
|
-
s.isValid(g,
|
|
1317
|
+
for (const [f, w] of h) {
|
|
1318
|
+
const g = d + f, _ = u + w;
|
|
1319
|
+
s.isValid(g, _) && a.push({ row: g, col: _ });
|
|
1316
1320
|
}
|
|
1317
|
-
for (const
|
|
1318
|
-
const
|
|
1319
|
-
for (const g of
|
|
1320
|
-
if (
|
|
1321
|
+
for (const f of a) {
|
|
1322
|
+
const w = tn(f.row, f.col, s);
|
|
1323
|
+
for (const g of w)
|
|
1324
|
+
if (rt(l, g) < o)
|
|
1321
1325
|
return !0;
|
|
1322
1326
|
}
|
|
1323
1327
|
return !1;
|
|
1324
1328
|
}
|
|
1325
|
-
function
|
|
1329
|
+
function tn(t, e, n) {
|
|
1326
1330
|
const o = [], i = n.grid[t][e];
|
|
1327
1331
|
return i.walls.top && o.push({
|
|
1328
1332
|
start: { row: t - 0.5, col: e - 0.5 },
|
|
@@ -1338,158 +1342,158 @@ function Qt(t, e, n) {
|
|
|
1338
1342
|
end: { row: t + 0.5, col: e - 0.5 }
|
|
1339
1343
|
}), o;
|
|
1340
1344
|
}
|
|
1341
|
-
function
|
|
1342
|
-
const { start: n, end: o } = e, i = o.col - n.col, s = o.row - n.row,
|
|
1343
|
-
if (
|
|
1344
|
-
return Math.sqrt(
|
|
1345
|
-
const
|
|
1345
|
+
function rt(t, e) {
|
|
1346
|
+
const { start: n, end: o } = e, i = o.col - n.col, s = o.row - n.row, c = t.col - n.col, r = t.row - n.row, l = i * i + s * s;
|
|
1347
|
+
if (l === 0)
|
|
1348
|
+
return Math.sqrt(c * c + r * r);
|
|
1349
|
+
const a = Math.max(
|
|
1346
1350
|
0,
|
|
1347
1351
|
Math.min(
|
|
1348
1352
|
1,
|
|
1349
|
-
(
|
|
1353
|
+
(c * i + r * s) / l
|
|
1350
1354
|
)
|
|
1351
|
-
), d = n.col +
|
|
1352
|
-
return Math.sqrt(h * h +
|
|
1355
|
+
), d = n.col + a * i, u = n.row + a * s, h = t.col - d, f = t.row - u;
|
|
1356
|
+
return Math.sqrt(h * h + f * f);
|
|
1353
1357
|
}
|
|
1354
|
-
function
|
|
1358
|
+
function nn(t, e, n, o, i, s) {
|
|
1355
1359
|
if (Math.sqrt(
|
|
1356
1360
|
Math.pow(t.row - e.row, 2) + Math.pow(t.col - e.col, 2)
|
|
1357
1361
|
) > 1.5 || !n.isValid(e.row, e.col)) return !1;
|
|
1358
1362
|
if (n.grid[e.row][e.col].walls.bottom) {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
+
let l = 0;
|
|
1364
|
+
if (s && i) {
|
|
1365
|
+
const h = s();
|
|
1366
|
+
l = i / h;
|
|
1367
|
+
} else
|
|
1368
|
+
l = (i || 3) / 100;
|
|
1369
|
+
const a = l * 0.5, d = {
|
|
1370
|
+
start: { row: e.row + 0.5 - a, col: e.col - 0.5 },
|
|
1371
|
+
end: { row: e.row + 0.5 - a, col: e.col + 0.5 }
|
|
1372
|
+
};
|
|
1373
|
+
if (rt(
|
|
1363
1374
|
t,
|
|
1364
|
-
|
|
1365
|
-
)
|
|
1366
|
-
0
|
|
1367
|
-
Math.min(0.1, o * 0.15)
|
|
1368
|
-
);
|
|
1369
|
-
if (console.log("Distance between player point to exit wall: ", r), console.log("Player radius: ", o), console.log("Relative tolerance: ", u), console.log(
|
|
1370
|
-
"Collision condition: playerRadius + tolerance: ",
|
|
1371
|
-
o + u
|
|
1372
|
-
), r <= o + u)
|
|
1373
|
-
return console.log("-> collision true"), !0;
|
|
1375
|
+
d
|
|
1376
|
+
) <= o * 1.5)
|
|
1377
|
+
return !0;
|
|
1374
1378
|
}
|
|
1375
1379
|
return !1;
|
|
1376
1380
|
}
|
|
1377
|
-
function
|
|
1381
|
+
function on(t, e, n, o, i) {
|
|
1378
1382
|
if (!t || !e.maze) return;
|
|
1379
|
-
const { canvasWidth: s, canvasHeight:
|
|
1380
|
-
maze:
|
|
1383
|
+
const { canvasWidth: s, canvasHeight: c } = n, { cellWidth: r, cellHeight: l } = o, {
|
|
1384
|
+
maze: a,
|
|
1381
1385
|
playerCell: d,
|
|
1382
1386
|
// row, col, but floating allowed
|
|
1383
1387
|
exitCell: u,
|
|
1384
1388
|
foodCells: h,
|
|
1385
|
-
showClue:
|
|
1386
|
-
playerPath:
|
|
1389
|
+
showClue: f,
|
|
1390
|
+
playerPath: w,
|
|
1387
1391
|
visitCounts: g
|
|
1388
1392
|
} = e, {
|
|
1389
|
-
padding:
|
|
1390
|
-
wallWidth:
|
|
1393
|
+
padding: _,
|
|
1394
|
+
wallWidth: v,
|
|
1391
1395
|
// need merge with level config when passed here
|
|
1392
|
-
wallColor:
|
|
1396
|
+
wallColor: m,
|
|
1393
1397
|
playerColor: y,
|
|
1394
|
-
playerRadius:
|
|
1395
|
-
foodColor:
|
|
1396
|
-
backgroundColor:
|
|
1397
|
-
clueColor:
|
|
1398
|
-
exitColor:
|
|
1399
|
-
exitWallWidth:
|
|
1400
|
-
exitDashArray:
|
|
1398
|
+
playerRadius: C,
|
|
1399
|
+
foodColor: k,
|
|
1400
|
+
backgroundColor: T,
|
|
1401
|
+
clueColor: z,
|
|
1402
|
+
exitColor: S,
|
|
1403
|
+
exitWallWidth: b,
|
|
1404
|
+
exitDashArray: E
|
|
1401
1405
|
} = i;
|
|
1402
|
-
t.clearRect(0, 0, s,
|
|
1406
|
+
t.clearRect(0, 0, s, c), t.save(), t.fillStyle = T, t.fillRect(0, 0, s, c), t.restore(), f && un({
|
|
1403
1407
|
ctx: t,
|
|
1404
|
-
playerPath:
|
|
1408
|
+
playerPath: w,
|
|
1405
1409
|
visitCounts: g,
|
|
1406
1410
|
cellWidth: r,
|
|
1407
|
-
cellHeight:
|
|
1408
|
-
padding:
|
|
1409
|
-
clueColor:
|
|
1410
|
-
}),
|
|
1411
|
+
cellHeight: l,
|
|
1412
|
+
padding: _,
|
|
1413
|
+
clueColor: z
|
|
1414
|
+
}), rn({
|
|
1411
1415
|
ctx: t,
|
|
1412
|
-
maze:
|
|
1416
|
+
maze: a,
|
|
1413
1417
|
cellWidth: r,
|
|
1414
|
-
cellHeight:
|
|
1415
|
-
padding:
|
|
1416
|
-
wallColor:
|
|
1417
|
-
wallWidth:
|
|
1418
|
-
}),
|
|
1418
|
+
cellHeight: l,
|
|
1419
|
+
padding: _,
|
|
1420
|
+
wallColor: m,
|
|
1421
|
+
wallWidth: v
|
|
1422
|
+
}), ln({
|
|
1419
1423
|
ctx: t,
|
|
1420
|
-
maze:
|
|
1424
|
+
maze: a,
|
|
1421
1425
|
exitCell: u,
|
|
1422
1426
|
cellWidth: r,
|
|
1423
|
-
cellHeight:
|
|
1424
|
-
padding:
|
|
1425
|
-
exitColor:
|
|
1426
|
-
exitWallWidth:
|
|
1427
|
-
exitDashArray:
|
|
1428
|
-
}),
|
|
1427
|
+
cellHeight: l,
|
|
1428
|
+
padding: _,
|
|
1429
|
+
exitColor: S,
|
|
1430
|
+
exitWallWidth: b,
|
|
1431
|
+
exitDashArray: E
|
|
1432
|
+
}), an({
|
|
1429
1433
|
ctx: t,
|
|
1430
1434
|
foodCells: h,
|
|
1431
1435
|
cellWidth: r,
|
|
1432
|
-
cellHeight:
|
|
1433
|
-
padding:
|
|
1434
|
-
foodColor:
|
|
1435
|
-
}),
|
|
1436
|
+
cellHeight: l,
|
|
1437
|
+
padding: _,
|
|
1438
|
+
foodColor: k
|
|
1439
|
+
}), sn({
|
|
1436
1440
|
ctx: t,
|
|
1437
1441
|
playerCell: d,
|
|
1438
|
-
playerRadius:
|
|
1442
|
+
playerRadius: C,
|
|
1439
1443
|
cellWidth: r,
|
|
1440
|
-
cellHeight:
|
|
1441
|
-
padding:
|
|
1444
|
+
cellHeight: l,
|
|
1445
|
+
padding: _,
|
|
1442
1446
|
playerColor: y
|
|
1443
1447
|
});
|
|
1444
1448
|
}
|
|
1445
|
-
function
|
|
1449
|
+
function rn({
|
|
1446
1450
|
ctx: t,
|
|
1447
1451
|
maze: e,
|
|
1448
1452
|
cellWidth: n,
|
|
1449
1453
|
cellHeight: o,
|
|
1450
1454
|
padding: i,
|
|
1451
1455
|
wallColor: s,
|
|
1452
|
-
wallWidth:
|
|
1456
|
+
wallWidth: c
|
|
1453
1457
|
}) {
|
|
1454
|
-
t.save(), t.strokeStyle = s, t.lineWidth =
|
|
1455
|
-
t.moveTo(
|
|
1458
|
+
t.save(), t.strokeStyle = s, t.lineWidth = c, t.lineCap = "round", t.beginPath(), dn(e, n, o, i).forEach((l) => {
|
|
1459
|
+
t.moveTo(l.x1, l.y1), t.lineTo(l.x2, l.y2);
|
|
1456
1460
|
}), t.stroke(), t.restore();
|
|
1457
1461
|
}
|
|
1458
|
-
function
|
|
1462
|
+
function sn({
|
|
1459
1463
|
ctx: t,
|
|
1460
1464
|
playerCell: e,
|
|
1461
1465
|
playerRadius: n,
|
|
1462
1466
|
cellWidth: o,
|
|
1463
1467
|
cellHeight: i,
|
|
1464
1468
|
padding: s,
|
|
1465
|
-
playerColor:
|
|
1469
|
+
playerColor: c
|
|
1466
1470
|
}) {
|
|
1467
|
-
const { x: r, y:
|
|
1471
|
+
const { x: r, y: l } = se(
|
|
1468
1472
|
e.row,
|
|
1469
1473
|
e.col,
|
|
1470
1474
|
o,
|
|
1471
1475
|
i,
|
|
1472
1476
|
s
|
|
1473
|
-
),
|
|
1474
|
-
t.save(), t.fillStyle =
|
|
1477
|
+
), a = Math.min(o, i) * Math.min(n, 0.5);
|
|
1478
|
+
t.save(), t.fillStyle = c, t.beginPath(), t.arc(r, l, a, 0, Math.PI * 2), t.fill(), t.restore();
|
|
1475
1479
|
}
|
|
1476
|
-
function
|
|
1480
|
+
function ln({
|
|
1477
1481
|
ctx: t,
|
|
1478
1482
|
maze: e,
|
|
1479
1483
|
exitCell: n,
|
|
1480
1484
|
cellWidth: o,
|
|
1481
1485
|
cellHeight: i,
|
|
1482
1486
|
padding: s,
|
|
1483
|
-
exitColor:
|
|
1487
|
+
exitColor: c,
|
|
1484
1488
|
exitWallWidth: r,
|
|
1485
|
-
exitDashArray:
|
|
1489
|
+
exitDashArray: l = [8, 12]
|
|
1486
1490
|
}) {
|
|
1487
|
-
const { row:
|
|
1488
|
-
if (!e.isValid(
|
|
1489
|
-
const u = e.grid[
|
|
1490
|
-
t.save(), t.globalCompositeOperation = "destination-out", t.lineWidth = r, t.lineCap = "round", t.beginPath(), u.walls.bottom && (t.moveTo(h,
|
|
1491
|
+
const { row: a, col: d } = n;
|
|
1492
|
+
if (!e.isValid(a, d)) return;
|
|
1493
|
+
const u = e.grid[a][d], h = s + d * o, f = s + a * i;
|
|
1494
|
+
t.save(), t.globalCompositeOperation = "destination-out", t.lineWidth = r, t.lineCap = "round", t.beginPath(), u.walls.bottom && (t.moveTo(h, f + i), t.lineTo(h + o, f + i)), t.stroke(), t.globalCompositeOperation = "source-over", t.strokeStyle = c, t.lineWidth = r, t.setLineDash(l), t.beginPath(), u.walls.bottom && (t.moveTo(h, f + i), t.lineTo(h + o, f + i)), t.stroke(), t.restore();
|
|
1491
1495
|
}
|
|
1492
|
-
function
|
|
1496
|
+
function an({
|
|
1493
1497
|
ctx: t,
|
|
1494
1498
|
foodCells: e,
|
|
1495
1499
|
cellWidth: n,
|
|
@@ -1498,105 +1502,105 @@ function sn({
|
|
|
1498
1502
|
foodColor: s
|
|
1499
1503
|
}) {
|
|
1500
1504
|
t.fillStyle = s;
|
|
1501
|
-
const
|
|
1505
|
+
const c = Math.min(n, o) * 0.25;
|
|
1502
1506
|
e.forEach((r) => {
|
|
1503
|
-
const { x:
|
|
1507
|
+
const { x: l, y: a } = se(
|
|
1504
1508
|
r.row,
|
|
1505
1509
|
r.col,
|
|
1506
1510
|
n,
|
|
1507
1511
|
o,
|
|
1508
1512
|
i
|
|
1509
1513
|
);
|
|
1510
|
-
|
|
1514
|
+
cn(t, l, a, c * 1.2, 5, c * 0.6);
|
|
1511
1515
|
});
|
|
1512
1516
|
}
|
|
1513
|
-
function
|
|
1517
|
+
function cn(t, e, n, o, i, s) {
|
|
1514
1518
|
t.save(), t.beginPath();
|
|
1515
|
-
for (let
|
|
1516
|
-
const r =
|
|
1517
|
-
t.lineTo(e + r * Math.sin(
|
|
1519
|
+
for (let c = 0; c < i * 2; c++) {
|
|
1520
|
+
const r = c % 2 === 0 ? o : s, l = Math.PI * c / i;
|
|
1521
|
+
t.lineTo(e + r * Math.sin(l), n + r * Math.cos(l));
|
|
1518
1522
|
}
|
|
1519
1523
|
t.closePath(), t.fill(), t.restore();
|
|
1520
1524
|
}
|
|
1521
|
-
function
|
|
1525
|
+
function un({
|
|
1522
1526
|
ctx: t,
|
|
1523
1527
|
playerPath: e,
|
|
1524
1528
|
visitCounts: n,
|
|
1525
1529
|
cellWidth: o,
|
|
1526
1530
|
cellHeight: i,
|
|
1527
1531
|
padding: s,
|
|
1528
|
-
clueColor:
|
|
1532
|
+
clueColor: c
|
|
1529
1533
|
}) {
|
|
1530
1534
|
if (!(!e || e.length < 2 || !n)) {
|
|
1531
1535
|
t.save();
|
|
1532
1536
|
for (let r = 1; r < e.length; r++) {
|
|
1533
|
-
const
|
|
1537
|
+
const l = e[r - 1], a = e[r], d = `${l.row},${l.col}-${a.row},${a.col}`, u = `${a.row},${a.col}-${l.row},${l.col}`, h = (n[d] || 0) + (n[u] || 0), f = Math.min(0.2 + h * 0.1, 0.9), w = Math.max(3, o * 0.1) + h * 0.5;
|
|
1534
1538
|
try {
|
|
1535
|
-
t.strokeStyle =
|
|
1539
|
+
t.strokeStyle = c.replace(")", `, ${f})`).replace("rgb(", "rgba(");
|
|
1536
1540
|
} catch {
|
|
1537
|
-
t.strokeStyle = `rgba(255, 0, 0, ${
|
|
1541
|
+
t.strokeStyle = `rgba(255, 0, 0, ${f})`;
|
|
1538
1542
|
}
|
|
1539
|
-
t.lineWidth =
|
|
1540
|
-
const { x: g, y:
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
+
t.lineWidth = w, t.lineCap = "round", t.lineJoin = "round";
|
|
1544
|
+
const { x: g, y: _ } = se(
|
|
1545
|
+
l.row,
|
|
1546
|
+
l.col,
|
|
1543
1547
|
o,
|
|
1544
1548
|
i,
|
|
1545
1549
|
s
|
|
1546
|
-
), { x:
|
|
1547
|
-
|
|
1548
|
-
|
|
1550
|
+
), { x: v, y: m } = se(
|
|
1551
|
+
a.row,
|
|
1552
|
+
a.col,
|
|
1549
1553
|
o,
|
|
1550
1554
|
i,
|
|
1551
1555
|
s
|
|
1552
1556
|
);
|
|
1553
|
-
t.beginPath(), t.moveTo(g,
|
|
1557
|
+
t.beginPath(), t.moveTo(g, _), t.lineTo(v, m), t.stroke();
|
|
1554
1558
|
}
|
|
1555
1559
|
t.restore();
|
|
1556
1560
|
}
|
|
1557
1561
|
}
|
|
1558
|
-
function
|
|
1562
|
+
function dn(t, e, n, o) {
|
|
1559
1563
|
const i = [];
|
|
1560
1564
|
for (let s = 0; s < t.rows; s++)
|
|
1561
|
-
for (let
|
|
1562
|
-
const r = t.grid[s][
|
|
1565
|
+
for (let c = 0; c < t.cols; c++) {
|
|
1566
|
+
const r = t.grid[s][c], l = o + c * e, a = o + s * n;
|
|
1563
1567
|
r.walls.top && i.push({
|
|
1564
|
-
x1:
|
|
1565
|
-
y1:
|
|
1566
|
-
x2:
|
|
1567
|
-
y2:
|
|
1568
|
+
x1: l,
|
|
1569
|
+
y1: a,
|
|
1570
|
+
x2: l + e,
|
|
1571
|
+
y2: a
|
|
1568
1572
|
}), r.walls.right && i.push({
|
|
1569
|
-
x1:
|
|
1570
|
-
y1:
|
|
1571
|
-
x2:
|
|
1572
|
-
y2:
|
|
1573
|
+
x1: l + e,
|
|
1574
|
+
y1: a,
|
|
1575
|
+
x2: l + e,
|
|
1576
|
+
y2: a + n
|
|
1573
1577
|
}), r.walls.bottom && i.push({
|
|
1574
|
-
x1:
|
|
1575
|
-
y1:
|
|
1576
|
-
x2:
|
|
1577
|
-
y2:
|
|
1578
|
+
x1: l,
|
|
1579
|
+
y1: a + n,
|
|
1580
|
+
x2: l + e,
|
|
1581
|
+
y2: a + n
|
|
1578
1582
|
}), r.walls.left && i.push({
|
|
1579
|
-
x1:
|
|
1580
|
-
y1:
|
|
1581
|
-
x2:
|
|
1582
|
-
y2:
|
|
1583
|
+
x1: l,
|
|
1584
|
+
y1: a,
|
|
1585
|
+
x2: l,
|
|
1586
|
+
y2: a + n
|
|
1583
1587
|
});
|
|
1584
1588
|
}
|
|
1585
1589
|
return i;
|
|
1586
1590
|
}
|
|
1587
|
-
function
|
|
1591
|
+
function se(t, e, n, o, i) {
|
|
1588
1592
|
return {
|
|
1589
1593
|
x: i + e * n + n / 2,
|
|
1590
1594
|
y: i + t * o + o / 2
|
|
1591
1595
|
};
|
|
1592
1596
|
}
|
|
1593
|
-
function
|
|
1597
|
+
function hn(t) {
|
|
1594
1598
|
return function() {
|
|
1595
1599
|
let e = t += 1831565813;
|
|
1596
1600
|
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
1597
1601
|
};
|
|
1598
1602
|
}
|
|
1599
|
-
class
|
|
1603
|
+
class fn {
|
|
1600
1604
|
// initially all walls exit
|
|
1601
1605
|
constructor(e, n) {
|
|
1602
1606
|
this.row = e, this.col = n;
|
|
@@ -1604,7 +1608,7 @@ class dn {
|
|
|
1604
1608
|
visited = !1;
|
|
1605
1609
|
walls = { top: !0, right: !0, bottom: !0, left: !0 };
|
|
1606
1610
|
}
|
|
1607
|
-
class
|
|
1611
|
+
class _n {
|
|
1608
1612
|
rows;
|
|
1609
1613
|
cols;
|
|
1610
1614
|
grid;
|
|
@@ -1621,7 +1625,7 @@ class hn {
|
|
|
1621
1625
|
* @param exit Optional exit cell position
|
|
1622
1626
|
*/
|
|
1623
1627
|
constructor(e, n, o, i, s = { row: 0, col: 0 }) {
|
|
1624
|
-
this.rows = e, this.cols = n, this.seed = i ?? Math.floor(Math.random() * 1e6), this.random =
|
|
1628
|
+
this.rows = e, this.cols = n, this.seed = i ?? Math.floor(Math.random() * 1e6), this.random = hn(this.seed), this.grid = this.initializeGrid(), this.generate(o, s);
|
|
1625
1629
|
}
|
|
1626
1630
|
// Initialize the grid with new MazeCell objects
|
|
1627
1631
|
initializeGrid() {
|
|
@@ -1629,7 +1633,7 @@ class hn {
|
|
|
1629
1633
|
for (let n = 0; n < this.rows; n++) {
|
|
1630
1634
|
e[n] = [];
|
|
1631
1635
|
for (let o = 0; o < this.cols; o++)
|
|
1632
|
-
e[n][o] = new
|
|
1636
|
+
e[n][o] = new fn(n, o);
|
|
1633
1637
|
}
|
|
1634
1638
|
return e;
|
|
1635
1639
|
}
|
|
@@ -1650,8 +1654,8 @@ class hn {
|
|
|
1650
1654
|
// Left
|
|
1651
1655
|
];
|
|
1652
1656
|
for (const s of i) {
|
|
1653
|
-
const
|
|
1654
|
-
this.isValid(
|
|
1657
|
+
const c = e + s.r, r = n + s.c;
|
|
1658
|
+
this.isValid(c, r) && o.push({ row: c, col: r });
|
|
1655
1659
|
}
|
|
1656
1660
|
return o;
|
|
1657
1661
|
}
|
|
@@ -1671,8 +1675,8 @@ class hn {
|
|
|
1671
1675
|
}
|
|
1672
1676
|
// Remove the wall between two adjacent cells
|
|
1673
1677
|
removeWall(e, n, o, i) {
|
|
1674
|
-
const s = this.grid[e][n],
|
|
1675
|
-
e === o + 1 ? (s.walls.top = !1,
|
|
1678
|
+
const s = this.grid[e][n], c = this.grid[o][i];
|
|
1679
|
+
e === o + 1 ? (s.walls.top = !1, c.walls.bottom = !1) : e === o - 1 ? (s.walls.bottom = !1, c.walls.top = !1) : n === i + 1 ? (s.walls.left = !1, c.walls.right = !1) : n === i - 1 && (s.walls.right = !1, c.walls.left = !1);
|
|
1676
1680
|
}
|
|
1677
1681
|
// --- Generation Methods ---
|
|
1678
1682
|
/**
|
|
@@ -1701,28 +1705,28 @@ class hn {
|
|
|
1701
1705
|
let i = { row: n, col: o };
|
|
1702
1706
|
for (this.grid[n][o].visited = !0, e.push(i); e.length > 0; ) {
|
|
1703
1707
|
i = e[e.length - 1];
|
|
1704
|
-
const { row: s, col:
|
|
1708
|
+
const { row: s, col: c } = i, r = this.getUnvisitedNeighbors(s, c);
|
|
1705
1709
|
if (r.length > 0) {
|
|
1706
|
-
const
|
|
1707
|
-
this.removeWall(s,
|
|
1710
|
+
const l = this.randomPick(r), { row: a, col: d } = l;
|
|
1711
|
+
this.removeWall(s, c, a, d), this.grid[a][d].visited = !0, e.push(l);
|
|
1708
1712
|
} else
|
|
1709
1713
|
e.pop();
|
|
1710
1714
|
}
|
|
1711
1715
|
}
|
|
1712
1716
|
// --- Prim's Algorithm Implementation ---
|
|
1713
1717
|
generateWithPrims() {
|
|
1714
|
-
const e = [], n = (s,
|
|
1715
|
-
const r = this.getNeighbors(s,
|
|
1716
|
-
for (const
|
|
1717
|
-
!this.grid[
|
|
1718
|
-
(
|
|
1719
|
-
) && e.push(
|
|
1718
|
+
const e = [], n = (s, c) => {
|
|
1719
|
+
const r = this.getNeighbors(s, c);
|
|
1720
|
+
for (const l of r)
|
|
1721
|
+
!this.grid[l.row][l.col].visited && !e.some(
|
|
1722
|
+
(a) => a.row === l.row && a.col === l.col
|
|
1723
|
+
) && e.push(l);
|
|
1720
1724
|
}, o = this.randomNumber(this.rows), i = this.randomNumber(this.cols);
|
|
1721
1725
|
for (this.grid[o][i].visited = !0, n(o, i); e.length > 0; ) {
|
|
1722
|
-
const s = this.randomNumber(e.length),
|
|
1723
|
-
if (
|
|
1724
|
-
const d = this.randomPick(
|
|
1725
|
-
this.removeWall(r,
|
|
1726
|
+
const s = this.randomNumber(e.length), c = e[s], { row: r, col: l } = c, a = this.getVisitedNeighbors(r, l);
|
|
1727
|
+
if (a.length > 0) {
|
|
1728
|
+
const d = this.randomPick(a);
|
|
1729
|
+
this.removeWall(r, l, d.row, d.col), this.grid[r][l].visited = !0, n(r, l);
|
|
1726
1730
|
}
|
|
1727
1731
|
e.splice(s, 1);
|
|
1728
1732
|
}
|
|
@@ -1747,140 +1751,142 @@ class hn {
|
|
|
1747
1751
|
return e[Math.floor(this.random() * e.length)];
|
|
1748
1752
|
}
|
|
1749
1753
|
}
|
|
1750
|
-
const
|
|
1754
|
+
const mn = (t, e, n) => {
|
|
1751
1755
|
if (!t.isValid(e, n)) return !1;
|
|
1752
1756
|
const o = t.grid[e][n];
|
|
1753
1757
|
return !o.walls.top || !o.walls.right || !o.walls.bottom || !o.walls.left;
|
|
1754
|
-
},
|
|
1758
|
+
}, vn = (t) => t === 1 ? 2 : t >= 2 && t <= 5 ? 3 : t >= 6 && t <= 11 ? 4 : t >= 12 && t <= 15 ? 5 : 6, pn = (t, e) => {
|
|
1755
1759
|
if (!e)
|
|
1756
1760
|
return console.error(`Cannot find Level ${t}'s config.`), null;
|
|
1757
|
-
const { size: n, seed: o, method: i, entry: s, exit:
|
|
1761
|
+
const { size: n, seed: o, method: i, entry: s, exit: c } = e, r = n, l = n, a = s || { row: 0, col: 0 }, d = c || {
|
|
1758
1762
|
row: r - 1,
|
|
1759
|
-
col:
|
|
1760
|
-
}, u = new
|
|
1761
|
-
for (let
|
|
1763
|
+
col: l - 1
|
|
1764
|
+
}, u = new _n(r, l, i, o, s), h = vn(t), f = [];
|
|
1765
|
+
for (let w = 0; w < h; w++) {
|
|
1762
1766
|
let g;
|
|
1763
1767
|
do
|
|
1764
1768
|
g = {
|
|
1765
1769
|
row: Math.floor(u.random() * r),
|
|
1766
|
-
col: Math.floor(u.random() *
|
|
1770
|
+
col: Math.floor(u.random() * l)
|
|
1767
1771
|
};
|
|
1768
|
-
while (g.row ===
|
|
1769
|
-
|
|
1772
|
+
while (g.row === a.row && g.col === a.col || g.row === d.row && g.col === d.col || !mn(u, g.row, g.col) || f.some((_) => _.row === g.row && _.col === g.col));
|
|
1773
|
+
f.push(g);
|
|
1770
1774
|
}
|
|
1771
1775
|
return {
|
|
1772
1776
|
isGameActive: !0,
|
|
1773
1777
|
levelTransitioning: !1,
|
|
1774
1778
|
maze: u,
|
|
1775
|
-
playerCell:
|
|
1779
|
+
playerCell: a,
|
|
1776
1780
|
exitCell: d,
|
|
1777
|
-
foodCells:
|
|
1781
|
+
foodCells: f,
|
|
1778
1782
|
playerAtExit: !1,
|
|
1779
1783
|
foodCollected: 0,
|
|
1780
1784
|
totalFoodCount: h,
|
|
1781
1785
|
showClue: !1,
|
|
1782
|
-
playerPath: [
|
|
1783
|
-
visitCounts: { [`${
|
|
1786
|
+
playerPath: [a],
|
|
1787
|
+
visitCounts: { [`${a.row},${a.col}`]: 1 }
|
|
1784
1788
|
};
|
|
1785
1789
|
};
|
|
1786
|
-
function
|
|
1787
|
-
const { setGamePlayState: t, gamePlayStateRef: e, gameProgress: n, config: o } =
|
|
1790
|
+
function gn() {
|
|
1791
|
+
const { setGamePlayState: t, gamePlayStateRef: e, gameProgress: n, config: o } = B(), i = F(null), s = F(null), c = F(null), { i18n: r, levelConfig: l, renderConfig: a } = o, d = J(l), u = F(
|
|
1788
1792
|
d.getLevelConfig(n.currentLevel)
|
|
1789
1793
|
);
|
|
1790
1794
|
x(() => {
|
|
1791
|
-
i.current &&
|
|
1795
|
+
i.current && R.attachTo(i.current);
|
|
1792
1796
|
}, []);
|
|
1793
|
-
const h =
|
|
1797
|
+
const h = F(), f = Zt(c, () => {
|
|
1794
1798
|
h.current?.();
|
|
1795
|
-
}),
|
|
1799
|
+
}), w = Qt(c);
|
|
1796
1800
|
x(() => {
|
|
1797
1801
|
u.current = d.getLevelConfig(
|
|
1798
1802
|
n.currentLevel
|
|
1799
1803
|
);
|
|
1800
1804
|
}, [n.currentLevel]);
|
|
1801
1805
|
const g = () => {
|
|
1802
|
-
const y =
|
|
1806
|
+
const y = pn(
|
|
1803
1807
|
n.currentLevel,
|
|
1804
1808
|
u.current
|
|
1805
1809
|
);
|
|
1806
|
-
y && t((
|
|
1807
|
-
...
|
|
1810
|
+
y && t((C) => ({
|
|
1811
|
+
...C,
|
|
1808
1812
|
...y
|
|
1809
1813
|
}));
|
|
1810
1814
|
};
|
|
1811
1815
|
x(() => {
|
|
1812
1816
|
g();
|
|
1813
1817
|
}, [n.currentLevel]);
|
|
1814
|
-
const
|
|
1818
|
+
const _ = () => {
|
|
1815
1819
|
g();
|
|
1816
|
-
}, { updatePlayerPos:
|
|
1820
|
+
}, { updatePlayerPos: v, resetMovingState: m } = en({
|
|
1817
1821
|
containerRef: s,
|
|
1818
1822
|
gamePlayStateRef: e,
|
|
1819
1823
|
setGamePlayState: t,
|
|
1820
|
-
playerRadius:
|
|
1821
|
-
moveSpeed:
|
|
1824
|
+
playerRadius: a.playerRadius,
|
|
1825
|
+
moveSpeed: a.gridMoveSpeed,
|
|
1826
|
+
exitWallWidth: u.current?.exitWallWidth || a?.exitWallWidth,
|
|
1827
|
+
getCellSizeInPixels: () => w.current.cellWidth,
|
|
1822
1828
|
onFoodCollected: () => {
|
|
1823
1829
|
const y = e.current.totalFoodCount - e.current.foodCollected - 1;
|
|
1824
|
-
y > 0 ?
|
|
1830
|
+
y > 0 ? R.show(
|
|
1825
1831
|
r.foodCollectedToast.replace("%NUM%", y.toString()),
|
|
1826
1832
|
"success",
|
|
1827
1833
|
3e3
|
|
1828
|
-
) :
|
|
1834
|
+
) : R.show(r.allFoodCollectedToast, "success");
|
|
1829
1835
|
}
|
|
1830
1836
|
});
|
|
1831
1837
|
return x(() => {
|
|
1832
|
-
|
|
1833
|
-
}, [n.currentLevel,
|
|
1834
|
-
let y,
|
|
1835
|
-
const
|
|
1836
|
-
const
|
|
1837
|
-
if (!(
|
|
1838
|
-
y = requestAnimationFrame(
|
|
1838
|
+
m();
|
|
1839
|
+
}, [n.currentLevel, m]), x(() => {
|
|
1840
|
+
let y, C = !document.hidden;
|
|
1841
|
+
const k = () => {
|
|
1842
|
+
const S = c.current?.getContext("2d"), b = e.current;
|
|
1843
|
+
if (!(C && b?.isGameActive && S && b?.maze)) {
|
|
1844
|
+
y = requestAnimationFrame(k);
|
|
1839
1845
|
return;
|
|
1840
1846
|
}
|
|
1841
|
-
|
|
1842
|
-
},
|
|
1843
|
-
const
|
|
1844
|
-
if (
|
|
1845
|
-
const
|
|
1846
|
-
|
|
1847
|
-
...
|
|
1848
|
-
wallWidth:
|
|
1849
|
-
exitColor:
|
|
1847
|
+
v(), T(), y = requestAnimationFrame(k);
|
|
1848
|
+
}, T = () => {
|
|
1849
|
+
const S = c.current?.getContext("2d"), b = e.current;
|
|
1850
|
+
if (S && b?.maze) {
|
|
1851
|
+
const E = u.current?.wallWidth || a?.wallWidth, N = u.current?.exitColor || a?.exitColor, P = u.current?.exitWallWidth || a?.exitWallWidth, I = u.current?.exitDashArray || a?.exitDashArray;
|
|
1852
|
+
on(S, b, f.current, w.current, {
|
|
1853
|
+
...a,
|
|
1854
|
+
wallWidth: E,
|
|
1855
|
+
exitColor: N,
|
|
1850
1856
|
exitWallWidth: P,
|
|
1851
1857
|
exitDashArray: I
|
|
1852
1858
|
});
|
|
1853
1859
|
}
|
|
1854
1860
|
};
|
|
1855
|
-
h.current =
|
|
1856
|
-
const
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1861
|
+
h.current = T;
|
|
1862
|
+
const z = (S) => {
|
|
1863
|
+
const b = C;
|
|
1864
|
+
C = !document.hidden && document.visibilityState === "visible" && (!S || S.type !== "blur"), !b && C ? e.current?.levelTransitioning === !1 && t({
|
|
1859
1865
|
...e.current,
|
|
1860
1866
|
isGameActive: !0
|
|
1861
|
-
}) :
|
|
1867
|
+
}) : b && !C && t({
|
|
1862
1868
|
...e.current,
|
|
1863
1869
|
isGameActive: !1
|
|
1864
1870
|
});
|
|
1865
1871
|
};
|
|
1866
|
-
return document.addEventListener("visibilitychange",
|
|
1867
|
-
cancelAnimationFrame(y), document.removeEventListener("visibilitychange",
|
|
1872
|
+
return document.addEventListener("visibilitychange", z), window.addEventListener("blur", z), window.addEventListener("focus", z), y = requestAnimationFrame(k), () => {
|
|
1873
|
+
cancelAnimationFrame(y), document.removeEventListener("visibilitychange", z), window.removeEventListener("blur", z), window.removeEventListener("focus", z);
|
|
1868
1874
|
};
|
|
1869
1875
|
}, []), x(() => {
|
|
1870
|
-
|
|
1871
|
-
}, []), /* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
1874
|
-
/* @__PURE__ */
|
|
1875
|
-
/* @__PURE__ */
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
/* @__PURE__ */
|
|
1878
|
-
/* @__PURE__ */
|
|
1879
|
-
/* @__PURE__ */
|
|
1876
|
+
R.show(r.useArrowKeyTips, "info", 3e3);
|
|
1877
|
+
}, []), /* @__PURE__ */ p("div", { className: "maze-game-container", ref: i, children: [
|
|
1878
|
+
/* @__PURE__ */ p(St, {}),
|
|
1879
|
+
/* @__PURE__ */ p(Jt, { onRetry: _ }),
|
|
1880
|
+
/* @__PURE__ */ p("div", { className: "maze-canvas-container", ref: s, children: [
|
|
1881
|
+
/* @__PURE__ */ p("canvas", { ref: c, className: "maze-game-canvas" }),
|
|
1882
|
+
/* @__PURE__ */ p("div", { className: "maze-touch-area maze-up" }),
|
|
1883
|
+
/* @__PURE__ */ p("div", { className: "maze-touch-area maze-down" }),
|
|
1884
|
+
/* @__PURE__ */ p("div", { className: "maze-touch-area maze-left" }),
|
|
1885
|
+
/* @__PURE__ */ p("div", { className: "maze-touch-area maze-right" })
|
|
1880
1886
|
] })
|
|
1881
1887
|
] });
|
|
1882
1888
|
}
|
|
1883
|
-
const
|
|
1889
|
+
const it = [
|
|
1884
1890
|
// Tier 1 (Levels 1-12) - Beginner
|
|
1885
1891
|
[
|
|
1886
1892
|
// debug
|
|
@@ -2038,7 +2044,7 @@ const ot = [
|
|
|
2038
2044
|
{ size: 68, seed: 33341, method: "backtracking" }
|
|
2039
2045
|
// Level 60 - Master
|
|
2040
2046
|
]
|
|
2041
|
-
],
|
|
2047
|
+
], re = {
|
|
2042
2048
|
lcPrefix: "maze-",
|
|
2043
2049
|
i18n: {
|
|
2044
2050
|
reset: "Reset",
|
|
@@ -2097,33 +2103,33 @@ const ot = [
|
|
|
2097
2103
|
exitDashArray: [8, 12]
|
|
2098
2104
|
// default dash: 8px dash, 12px gap
|
|
2099
2105
|
},
|
|
2100
|
-
levelConfig:
|
|
2106
|
+
levelConfig: it
|
|
2101
2107
|
};
|
|
2102
|
-
function
|
|
2103
|
-
const e = { ...
|
|
2104
|
-
...
|
|
2108
|
+
function Cn({ config: t = {} }) {
|
|
2109
|
+
const e = { ...re.i18n, ...t.i18n || {} }, n = {
|
|
2110
|
+
...re.renderConfig,
|
|
2105
2111
|
...t.renderConfig || {}
|
|
2106
|
-
}, o = t.levelConfig ||
|
|
2107
|
-
...
|
|
2112
|
+
}, o = t.levelConfig || it, i = {
|
|
2113
|
+
...re,
|
|
2108
2114
|
...t,
|
|
2109
2115
|
i18n: e,
|
|
2110
2116
|
levelConfig: o,
|
|
2111
2117
|
renderConfig: n
|
|
2112
2118
|
};
|
|
2113
|
-
return /* @__PURE__ */
|
|
2119
|
+
return /* @__PURE__ */ p(bt, { config: i, children: /* @__PURE__ */ p(gn, {}) });
|
|
2114
2120
|
}
|
|
2115
|
-
const
|
|
2116
|
-
root: "https://unpkg.com/@roudanio/maze@0.1.
|
|
2117
|
-
...
|
|
2121
|
+
const wn = {
|
|
2122
|
+
root: "https://unpkg.com/@roudanio/maze@0.1.2/dist/",
|
|
2123
|
+
...re
|
|
2118
2124
|
};
|
|
2119
|
-
`${JSON.stringify(
|
|
2120
|
-
const
|
|
2125
|
+
`${JSON.stringify(wn, null, 2)}`;
|
|
2126
|
+
const yn = {
|
|
2121
2127
|
async init(t, e) {
|
|
2122
2128
|
const n = typeof t == "string" ? document.querySelector(t) : t;
|
|
2123
2129
|
if (!n) {
|
|
2124
2130
|
console.warn("Cannot find the root element");
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2131
|
+
const l = document.createElement("div");
|
|
2132
|
+
l.style.textAlign = "center", l.style.padding = "20px", l.innerHTML = "Cannot find the root element", document.body.append(l);
|
|
2127
2133
|
return;
|
|
2128
2134
|
}
|
|
2129
2135
|
let { root: o = location.origin } = e;
|
|
@@ -2142,17 +2148,17 @@ const Cn = {
|
|
|
2142
2148
|
transition: width 1.5s ease-in-out;
|
|
2143
2149
|
transition: width 1.5s ease-in-out;
|
|
2144
2150
|
`, i.append(s), n.append(i);
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2151
|
+
const c = document.createElement("style");
|
|
2152
|
+
c.innerHTML = `
|
|
2147
2153
|
@keyframes loading {
|
|
2148
2154
|
0% { width: 0%; }
|
|
2149
2155
|
100% { width: 99%; }
|
|
2150
|
-
}`, document.head.appendChild(
|
|
2156
|
+
}`, document.head.appendChild(c), await (async (l) => new Promise((a, d) => {
|
|
2151
2157
|
const u = document.createElement("link");
|
|
2152
|
-
u.rel = "stylesheet", u.type = "text/css", u.href =
|
|
2153
|
-
}))(o + "maze.css"),
|
|
2158
|
+
u.rel = "stylesheet", u.type = "text/css", u.href = l, u.onload = a, u.onerror = d, document.head.appendChild(u);
|
|
2159
|
+
}))(o + "maze.css"), ft(/* @__PURE__ */ p(Cn, { config: e }), n);
|
|
2154
2160
|
}
|
|
2155
2161
|
};
|
|
2156
2162
|
export {
|
|
2157
|
-
|
|
2163
|
+
yn as default
|
|
2158
2164
|
};
|